Add .gdb_index version 7 support.
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-01-28  Cary Coutant  <ccoutant@google.com>
2
3         Add .gdb_index version 7 support.
4
5         * gold/dwarf_reader.cc: include <utility> (for make_pair).
6         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
7         debug sections.
8         (Dwarf_ranges_table::read_ranges_table): Likewise.
9         (Dwarf_pubnames_table::read_section): Check for GNU-style
10         sections, and for compressed debug sections.
11         (Dwarf_pubnames_table::read_header): Compute end address of table.
12         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
13         for end of list by offset, not by offset == 0.
14         (Dwarf_info_reader::do_read_string_table): Check for compressed
15         debug sections.
16         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
17         Initialize new data members.
18         (Dwarf_pubnames_table::next_name): return flag_byte.
19         (Dwarf_pubnames_table::end_of_table_): New data member.
20         (Dwarf_pubnames_table::is_gnu_style_): New data member.
21         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
22         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
23         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
24         read skeleton type unit DIEs.
25         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
26         (Gdb_index::do_write): Write flag_byte.
27         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
28         (Gdb_index::Cu_vector): Store flags along with cu indexes.
29         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
30         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
31
32 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
33
34         * version.cc (print_version): Update copyright year to 2014.
35
36 2013-12-19  Dimitry Andric  <dimitry@andric.com>
37
38         * stringpool.cc (Stringpool_template::reserve): Add
39         HAVE_UNORDERED_MAP case.
40         * stringpool.cc (Stringpool_template::print_stats): Likewise.
41
42 2013-12-18  Cary Coutant  <ccoutant@google.com>
43
44         * configure.ac: Check for <unordered_set> and <unordered_map>.
45         * config.in: Regenerate.
46         * configure: Regenerate.
47         * system.h: Use <unordered_set> and <unordered_map> if available.
48
49 2013-12-10  Roland McGrath  <mcgrathr@google.com>
50
51         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
52         with $(INSTALL_PROGRAM_ENV).
53         * Makefile.in: Regenerate.
54
55 2013-11-22  Cary Coutant  <ccoutant@google.com>
56
57         * configure.ac: Add check for which library is needed for
58         dlopen.
59         * configure: Regenerate.
60
61 2013-11-22  Cary Coutant  <ccoutant@google.com>
62
63         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
64         assembler.
65         * testsuite/Makefile.in: Regenerate.
66
67 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
68
69         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
70         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
71         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
72         (Target_x86_64<size>::Scan::local): Likewise.
73         (Target_x86_64<size>::Scan::global): Likewise.
74         (Target_x86_64<size>::Relocate::relocate): Likewise.
75         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
76         Likewise.
77         (Target_x86_64<size>::Scan::check_non_pic(): Handle
78         R_X86_64_PC32_BND.
79
80         * testsuite/Makefile.am (check_PROGRAMS): Add
81         exception_x86_64_bnd_test.
82         (exception_x86_64_bnd_test_SOURCES): New macro.
83         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
84         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
85         (exception_x86_64_bnd_test_LDADD): Likewise.
86         (exception_x86_64_bnd_1.o): New rule.
87         (exception_x86_64_bnd_2.o): Likewise.
88         * testsuite/Makefile.in: Regenerated.
89
90 2013-11-15  Alan Modra  <amodra@gmail.com>
91
92         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
93         accessor.
94         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
95         Only call ppc64_local_entry_offset for 64-bit.  Restrict
96         symval_for_branch lookup to ELFv1.
97         (Stub_table::add_plt_call_entry): Use unsigned int off.
98         (Output_data_glink::Address, invalid_address): New.
99         (Output_data_glink::add_eh_frame): Move out of line.  Add
100         support for ELFv2.
101         (Output_data_glink::add_global_entry, find_global_entry,
102         global_entry_address): New functions.
103         (Output_data_glink::global_entry_stubs_, end_branch_table_,
104         ge_size): New variables.
105         (Output_data_glink::set_final_data_size): Add global entry
106         stub sizing.
107         (Output_data_glink::do_write): Write global entry stubs.
108         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
109         parameter.  Return true for ELFv2.  Adjust callers.
110         (Target_powerpc::Scan::local, global): Restrict opd lookup to
111         ELFv1.  Similarly for ifunc and dynamic relocation processing
112         specific to ELFv1.  Recognize that symbols are defined on
113         their plt entries for ELFv2.
114         (Target_powerpc::symval_for_branch): Assert if called for
115         ELFv2 or ppc32.
116         (Target_powerpc::Relocate::relocate): Use global entry plt
117         stub for symbol value if such exists on ELFv2.
118         (Target_powerpc::Relocate::relocate): Don't call
119         symval_for_branch when ELFv2.  Do adjust for local entry
120         offset when ELFv2.
121         (Target_powerpc::do_dynsym_value): Set symbols to global entry
122         plt stub for ELFv2.
123         (Target_powerpc::do_plt_address_for_global): Similarly.
124
125 2013-11-14  Cary Coutant  <ccoutant@google.com>
126
127         Revert patch -- this did not fix the problem, and there is
128         no race there.
129
130         2013-11-14  Cary Coutant  <ccoutant@google.com>
131
132             PR gold/14860
133             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
134             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
135             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
136             updating fde_offsets_.
137             (Eh_frame_hdr::lock_): New data member.
138
139 2013-11-14  Cary Coutant  <ccoutant@google.com>
140
141         * dwp.cc (Dwo_file_entry): New type.
142         (File_list): Use Dwo_file_entry.
143         (Dwo_file::verify): New function.
144         (Dwo_file::verify_dwo_list): New function.
145         (Dwo_file::sized_verify_dwo_list): New function.
146         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
147         list.
148         (Dwp_options): New enum type.
149         (dwp_options): Add --verify-only.
150         (usage): Likewise.
151         (main): Likewise.
152         * dwp.h (gold_info): Add declaration.
153
154 2013-11-14  Cary Coutant  <ccoutant@google.com>
155
156         PR gold/14860
157         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
158         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
159         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
160         updating fde_offsets_.
161         (Eh_frame_hdr::lock_): New data member.
162
163 2013-11-06  Cary Coutant  <ccoutant@google.com>
164
165         PR gold/15758
166         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
167         before reloc sections.
168
169 2013-11-04  Alan Modra  <amodra@gmail.com>
170
171         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
172         (Symbol::needs_dynamic_reloc): Test new flag.
173         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
174         (Target_powerpc::Scan::get_reference_flags): Add target param.
175         Return FUNC_DESC_ABI for 64-bit ELFv1.
176         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
177         call.
178         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
179         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
180
181 2013-10-31  Cary Coutant  <ccoutant@google.com>
182
183         Restore support for dwp v2 DWARF package file format.
184
185         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
186         tu_length parameter.  Adjust all callers.
187         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
188         * dwp.cc: Include dwarf.h.
189         (Section_bounds): New struct type.
190         (Unit_set): New struct type.
191         (Dwo_file::Dwo_file): Initialize new data member.
192         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
193         Combine and rename to...
194         (Dwo_file::read_unit_index): ...this.
195         (Dwo_file::sized_read_compunit_index)
196         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
197         (Dwo_file::sized_read_unit_index): ...this.
198         (Dwo_file::copy_section): Remove section_name, is_str_offsets
199         parameters; add section_id parameter.
200         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
201         (Dwo_file::add_unit_set): ...this.
202         (Dwo_file::shndx_map_): Remove.
203         (Dwo_file::sect_offsets_): New data member.
204         (Dwp_output_file::Dwp_output_file): Initialize new data members.
205         (Dwp_output_file::add_section): Rename to...
206         (Dwp_output_file::add_contribution): ...this.
207         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
208         (Dwp_output_file::add_tu_set): Likewise.
209         (Dwp_output_file::Contribution): New type.
210         (Dwp_output_file::Section::contributions): New data member.
211         (Dwp_output_file::Cu_or_tu_set): Remove.
212         (Dwp_output_file::Section::Section): New ctor.
213         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
214         (Dwp_output_file::Dwp_index::Section_table): New type.
215         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
216         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
217         parameter.
218         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
219         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
220         (Dwp_output_file::Dwp_index::section_table): New member function.
221         (Dwp_output_file::Dwp_index::section_table_end): New member function.
222         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
223         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
224         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
225         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
226         (Dwp_output_file::Dwp_index::section_table_): New data member.
227         (Dwp_output_file::Dwp_index::section_mask_): New data member.
228         (Dwp_output_file::add_output_section): New member function.
229         (Dwp_output_file::write_new_section): New member function.
230         (Dwp_output_file::write_contributions): New member function.
231         (Dwp_output_file::section_id_map_): New data member.
232         (class Dwo_id_info_reader): Remove.
233         (class Unit_reader): New class.
234         (get_dwarf_section_name): New function.
235         (Dwo_file::read_executable): Adjust initializations of class data.
236         (Dwo_file::read): Add support for v2 package file format.
237         (Dwo_file::read_unit_index): Likewise.
238         (Dwo_file::sized_read_unit_index): Likewise.
239         (Dwo_file::copy_section): Likewise.
240         (Dwo_file::add_unit_set): Likewise.
241         (Dwp_output_file::add_output_section): Likewise.
242         (Dwp_output_file::add_contribution): Likewise.
243         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
244         for empty slot.
245         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
246         file format.
247         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
248         slot.
249         (Dwp_output_file::initialize): Remove unused function.
250         (Dwp_output_file::finalize): Add support for v2 package file format.
251         (Dwp_output_file::write_index): Likewise.
252         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
253         function prototype.
254
255 2013-10-31  Cary Coutant  <ccoutant@google.com>
256
257         * configure.ac: Fix check for -fmerge-constants.
258         * configure.ac: Regenerate.
259
260 2013-10-30  Roland McGrath  <mcgrathr@google.com>
261
262         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
263         Correct 9-byte nop sequence to match what the assembler generates.
264
265 2013-10-30  Alan Modra  <amodra@gmail.com>
266
267         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
268         ppc64_local_entry_offset, ppc64_local_entry_offset,
269         do_read_symbols): New functions.
270         (Powerpc_relobj::e_flags_, st_other_): New vars.
271         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
272         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
273         (Powerpc_relobj::e_flags_): New var.
274         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
275         and adjust for ELFv2.
276         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
277         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
278         (Powerpc_dynobj::do_find_special_sections): Likewise.
279         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
280         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
281         to ELFv2 local entry.
282         (Target_powerpc::do_relax): No thread safe barriers needed for
283         ELFv2.
284         (Output_data_plt_powerpc::initial_plt_entry_size_,
285         plt_entry_size): Delete.  Replace all uses with
286         first_plt_entry_offset() and plt_entry_size().
287         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
288         reserved_size parm.  Update callers.
289         (Output_data_plt_powerpc::entry_count): Update.
290         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
291         and use Target_powerpc::first_plt_entry_offset().
292         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
293         rename to plt_entry_size.
294         (Output_data_plt_powerpc::add_ifunc_entry,
295         add_local_ifunc_entry): Adjust reloc for ELFv2.
296         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
297         (glink_eh_frame_fde_64v2): New.
298         (Stub_table::plt_call_size): Support ELFv2 sizing.
299         (Output_data_glink::add_eh_frame): Use the new FDE.
300         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
301         (Stub_table::do_write): Write ELFv2 stubs and glink.
302         (Target_powerpc::Relocate::relocate): Replaces nop after call
303         with ld 2,24(1) and adjust local offset destination for ELFv2.
304
305 2013-10-30  Alan Modra  <amodra@gmail.com>
306
307         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
308         (Target_powerpc::Scan::global, local): Likewise.
309         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
310         on all ppc64 @h and @ha relocs.
311
312 2013-10-14  Alan Modra  <amodra@gmail.com>
313
314         * output.h (Output_data_got::add_constant): Tidy.
315         (Output_data_got::add_constant_pair): New function.
316         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
317         methods used so as to first call reserve_ent().
318
319 2013-10-11  Roland McGrath  <mcgrathr@google.com>
320
321         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
322         add_got_entry and add_got_entry_pair.
323
324         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
325         (HAVE_PUBNAMES): Likewise.
326         * configure: Regenerate.
327
328         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
329         * testsuite/Makefile.in: Regenerate.
330
331         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
332         Remove const from declaration.
333         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
334         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
335         * output.h (Output_file_header): Remove const from member target_
336         and corresponding constructor argument.
337         * output.cc (Output_file_header::Output_file_header): Update prototype.
338         (Output_file_header::do_sized_write): Use this->target_ in place
339         of parameters()->target().
340
341         * testsuite/undef_symbol.cc (Foo::get_a): New method.
342
343         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
344         * configure: Regenerate.
345         * Makefile.in: Regenerate.
346         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
347         * testsuite/merge_string_literals_2.c: Likewise.
348         * testsuite/Makefile.am
349         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
350         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
351         literal -fmerge-constants.
352         * testsuite/Makefile.in: Regenerate.
353
354         * i386.cc (Target_i386): Remove unused member dynbss_.
355         * arm.cc (Target_arm): Likewise.
356         * powerpc.cc (Target_powerpc): Likewise.
357         * sparc.cc (Target_sparc): Likewise.
358         * tilegx.cc (Target_tilegx): Likewise.
359         * x86_64.cc (Target_x86_64): Likewise.
360         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
361         type_signature_, type_offset_.
362         * plugin.h (Plugin_hook): Remove unused member layout_.
363         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
364         mapfile_.
365         (Read_member): Remove unused members input_objects_, symtab_,
366         mapfile_, layout_.
367         (Check_library): Remove unused member symtab_.
368         * archive.h (Lib_group): Remove unused member lib_.
369         * archive.cc (Lib_group::Lib_group): Update initializer.
370         * incremental.h (Incremental_binary): Remove unused member target_.
371         (Incremental_script_entry): Removed unused member script_.
372         * layout.h (Write_symbols_task): Remove unused member input_objects_.
373         * icf.h (Icf): Remove unused member num_tracked_relocs.
374
375         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
376         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
377         its only use.
378         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
379
380         * archive.h: Use struct rather than class for forward declaration
381         of Read_symbols_data.
382
383 2013-10-07  Cary Coutant  <ccoutant@google.com>
384
385         PR gold/16010
386         * testsuite/Makefile.am (icf_test): Fix dependencies.
387         (icf_safe_test): Likewise.
388         (icf_safe_so_test): Likewise.
389         (large_symbol_alignment): Add empty _LDADD rule.
390         * testsuite/Makefile.in: Regenerate.
391
392 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
393
394         PR gold/15927
395         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
396         relocation for R_X86_64_32 on x32.
397
398 2013-08-27  Roland McGrath  <mcgrathr@google.com>
399
400         * output.cc (Output_segment::set_section_addresses): Take new
401         Target* argument.  If target->isolate_execinstr() and the segment
402         is executable and starts at a target->abi_pagesize() boundary,
403         pad its end out to a target->abi_pagesize() boundary with code fill.
404         * output.h (Output_segment::set_section_addresses): Update decl.
405         * layout.h (Layout::check_output_data_for_reset_values): Take new
406         argument RELAX_OUTPUTS.
407         (Layout): New member relax_output_list_.
408         (Layout::add_relax_output): New method.
409         * layout.cc (Layout::Layout): Update constructor.
410         (Layout::reset_relax_output): New method.
411         (Layout::clean_up_after_relaxation): Call it.
412         (Layout::prepare_for_relaxation): Update caller.
413         (Layout::set_segment_offsets): Update callers of set_section_addresses.
414         Call reset_relax_output before re-processing segments for
415         isolate_execinstr case.
416         (Layout::write_data): Handle relax_output_list_.
417         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
418         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
419
420 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
421
422         PR binutils/15834
423         * object.h: Fix typos.
424
425 2013-08-16  Roland McGrath  <mcgrathr@google.com>
426
427         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
428         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
429
430 2013-08-07  Cary Coutant  <ccoutant@google.com>
431
432         Revert support for v2 DWP files:
433
434         2013-03-01  Cary Coutant  <ccoutant@google.com>
435
436             Add dwp support for v2 DWARF package file format.
437             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
438             tu_length parameter.  Adjust all callers.
439             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
440             * dwp.cc: Include dwarf.h.
441             (Section_bounds): New struct type.
442             (Unit_set): New struct type.
443             (Dwo_file::Dwo_file): Initialize new data member.
444             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
445             Combine and rename to...
446             (Dwo_file::read_unit_index): ...this.
447             (Dwo_file::sized_read_compunit_index)
448             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
449             (Dwo_file::sized_read_unit_index): ...this.
450             (Dwo_file::copy_section): Remove section_name, is_str_offsets
451             parameters; add section_id parameter.
452             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
453             (Dwo_file::add_unit_set): ...this.
454             (Dwo_file::shndx_map_): Remove.
455             (Dwo_file::sect_offsets_): New data member.
456             (Dwp_output_file::Dwp_output_file): Initialize new data members.
457             (Dwp_output_file::add_section): Rename to...
458             (Dwp_output_file::add_contribution): ...this.
459             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
460             (Dwp_output_file::add_tu_set): Likewise.
461             (Dwp_output_file::Contribution): New type.
462             (Dwp_output_file::Section::contributions): New data member.
463             (Dwp_output_file::Cu_or_tu_set): Remove.
464             (Dwp_output_file::Section::Section): New ctor.
465             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
466             (Dwp_output_file::Dwp_index::Section_table): New type.
467             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
468             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
469             parameter.
470             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
471             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
472             (Dwp_output_file::Dwp_index::section_table): New member function.
473             (Dwp_output_file::Dwp_index::section_table_end): New member function.
474             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
475             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
476             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
477             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
478             (Dwp_output_file::Dwp_index::section_table_): New data member.
479             (Dwp_output_file::Dwp_index::section_mask_): New data member.
480             (Dwp_output_file::add_output_section): New member function.
481             (Dwp_output_file::write_new_section): New member function.
482             (Dwp_output_file::write_contributions): New member function.
483             (Dwp_output_file::section_id_map_): New data member.
484             (class Dwo_id_info_reader): Remove.
485             (class Unit_reader): New class.
486             (get_dwarf_section_name): New function.
487             (Dwo_file::read_executable): Adjust initializations of class data.
488             (Dwo_file::read): Add support for v2 package file format.
489             (Dwo_file::read_unit_index): Likewise.
490             (Dwo_file::sized_read_unit_index): Likewise.
491             (Dwo_file::copy_section): Likewise.
492             (Dwo_file::add_unit_set): Likewise.
493             (Dwp_output_file::add_output_section): Likewise.
494             (Dwp_output_file::add_contribution): Likewise.
495             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
496             for empty slot.
497             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
498             file format.
499             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
500             slot.
501             (Dwp_output_file::initialize): Remove unused function.
502             (Dwp_output_file::finalize): Add support for v2 package file format.
503             (Dwp_output_file::write_index): Likewise.
504             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
505             function prototype.
506
507 2013-07-31  Cary Coutant  <ccoutant@google.com>
508
509         * object.cc (Sized_relobj::do_output_section_address): New function.
510         (Sized_relobj): Instantiate explicitly.
511         * object.h (Object::output_section_address): New function.
512         (Object::do_output_section_address): New function.
513         (Sized_relobj::do_output_section_address): New function.
514         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
515
516 2013-07-30  Cary Coutant  <ccoutant@google.com>
517             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
518
519         * parameters.cc (Parameters::entry): Return target-specific entry
520         symbol name.
521         * target.h (Target::entry_symbol_name): New function.
522         (Target_info::entry_symbol_name): New data member.
523
524         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
525         * i386.cc (Target_i386::i386_info): Likewise.
526         (Target_i386_nacl::i386_nacl_info): Likewise.
527         * sparc.cc (Target_sparc::sparc_info): Likewise.
528         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
529         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
530         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
531         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
532
533 2013-07-22  Sterling Augustine  <saugustine@google.com>
534
535         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
536         Convert parameter shndx to local variable. Add parameters symtab
537         and symtab_size.  Scan over section names.  Find relocation
538         section corresponding to current section.  Create and initialize
539         reloc_mapper_ and reloc_type_.
540         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
541         unit_length to off_t.  Initialize member unit_length_.  Fill in field
542         cu_offset_.
543         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
544         Initialize new fields unit_length_ and cu_offset_.
545         (Dwarf_pubnames_table::read_section): Update prototype.
546         (Dwarf_pubnames_table::cu_offset): New member function.
547         (Dwarf_pubnames_table::subsection_size): Likewise.
548         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
549         New fields.
550         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
551         member functions public.
552         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
553         Update comment.  Rework logic.  Move repeated parts to...
554         (Gdb_index_info_reader::read_pubtable): ...here. New function.
555         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
556         pubtypes_table_, and stmt_list_offset.
557         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
558         Gdb_index::find_pubtype_offset,
559         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
560         (Gdb_index::pubnames_read): Update prototype and rework logic.
561         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
562         Forward declare.
563         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
564         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
565         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
566         Gdb_index::map_pubtable_to_dies):
567         Declare functions.
568         (Gdb_index::pubnames_read): Update declaration.
569         (Gdb_index::Pubname_offset_map): New type.
570         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
571         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
572         Gdb_index::stmt_list_offset): Declare.
573         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
574         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
575         Gdb_index::pubtypes_offset_): Remove.
576
577 2013-07-19  Roland McGrath  <mcgrathr@google.com>
578
579         * options.h (General_options): Add -Trodata-segment option.
580         * parameters.cc (Parameters::check_rodata_segment): New function.
581         (Parameters::set_target_once): Call it.
582         * parameters.h (Parameters): Declare it (private member function).
583         * layout.cc (load_seg_unusable_for_headers): New function, broken
584         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
585         then validate rodata segment rather than text segment.
586         (relaxation_loop_body): Call that.
587         (is_text_segment): New function.  Don't admit a non-executable
588         segment if TARGET->isolate_execinstr().
589         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
590
591 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
592
593         PR gold/15070
594         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
595         * nacl.h (Sniff_file::View::View): Request aligned view.
596
597 2013-07-11  Cary Coutant  <ccoutant@google.com>
598
599         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
600         correct BRLT entry size.
601
602 2013-07-03  Alan Modra  <amodra@gmail.com>
603
604         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
605         comment.
606
607 2013-07-01  Cary Coutant  <ccoutant@google.com>
608
609         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
610         reloc_type_.
611         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
612         (Dwarf_ranges_table::lookup_reloc): New function.
613         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
614         reloc_type_.
615         (Dwarf_ranges_table::lookup_reloc): New function.
616         (Dwarf_ranges_table::reloc_type_): New data member.
617
618 2013-06-27  Jing Yu  <jingyu@google.com>
619
620         PR gold/15662
621         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
622         function.
623         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
624         (Target_powerpc::do_relax): Call the above.
625
626 2013-06-27  Cary Coutant  <ccoutant@google.com>
627
628         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
629         on garbage collected .opd section.
630
631 2013-06-27  Alan Modra  <amodra@gmail.com>
632
633         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
634         is non-zero.
635         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
636         (Target_powerpc::do_function_location): Likewise for loc->shndx.
637
638 2013-06-14  Cary Coutant  <ccoutant@google.com>
639
640         * resolve.cc (Symbol::override_base): Don't override st_type
641         from plugin placeholder symbols.
642         (Symbol_table::resolve): Likewise.
643         (Symbol_table::should_override): Don't complain about TLS mismatch
644         if the TO symbol is a plugin placeholder.
645         * testsuite/Makefile.am (plugin_test_tls): New test.
646         * testsuite/Makefile.in: Regenerate.
647         * testsuite/plugin_test_tls.sh: New test script.
648         * testsuite/two_file_test_2_tls.cc: New test source.
649         * testsuite/two_file_test_tls.cc: New test source.
650
651 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
652
653         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
654         the maximum segment alignment is larger than the page size.
655         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
656         correctly aligns the symbols with large alignemnt.
657         * testsuite/Makefile.in: Regenerate.
658         * testsuite/large_symbol_alignment.cc: New file.
659
660 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
661             Sriraman Tallam  <tmsriram@google.com>
662
663         * options.h (sort_section): New option.
664         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
665         Rename from Input_section_sort_section_name_special_ordering_compare.
666         (Input_section_sort_section_name_compare): New struct.
667         * output.cc (Output_section::Input_section_sort_section_name_compare::
668         operator()): New function.
669         (Output_section::sort_attached_input_sections): Use new sort function
670         for .text if --sort-section=name is specified.
671         * layout.cc (Layout::make_output_section):
672         Add sorting by name when --sort-section=name is specified.
673         * testsuite/Makefile.am (text_section_grouping): Test option
674         --sort-section=name.
675         * testsuite/Makefile.in: Regenerate.
676         * testsuite/section_sorting_name.cc: New file.
677         * testsuite/section_sorting_name.sh: New file.
678
679 2013-05-21  Cary Coutant  <ccoutant@google.com>
680
681         * symtab.h (Symbol::is_cxx_vtable): New function.
682         * target-reloc.h (relocate_section): Check for vtable symbol.
683         * testsuite/Makefile.am (missing_key_func.sh): New test case.
684         * testsuite/Makefile.in: Regenerate.
685         * testsuite/missing_key_func.cc: New test source.
686         * testsuite/missing_key_func.sh: New test script.
687
688 2013-05-21  Cary Coutant  <ccoutant@google.com>
689
690         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
691         type of enclosing symbol.
692         (Relocate_info::location): Check symbol type when describing symbol.
693         * object.h (Symbol_location_info): Remove unused line_number;
694         add enclosing_symbol_type.
695         * testsuite/debug_msg.sh: Adjust expected output.
696
697 2013-05-13  Cary Coutant  <ccoutant@google.com>
698
699         * configure.ac: Export DEFAULT_TARGET.
700         * configure: Regenerate.
701         * Makefile.in: Regenerate.
702         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
703         * testsuite/Makefile.in: Regenerate.
704         * testsuite/debug_msg.sh: Delete duplicate tests.
705         Don't check undef_int error message match for powerpc where the
706         source file and line number aren't available.
707
708 2013-05-10  Roland McGrath  <mcgrathr@google.com>
709
710         * options.h (General_options): Add --rosegment-gap option.
711         * options.cc (finalize): --rosegment-gap implies --rosegment.
712         * layout.cc (set_segment_offsets): Let user option override
713         target->rosegment_gap().
714
715 2013-05-10  Roland McGrath  <mcgrathr@google.com>
716
717         * options.h (General_options): Remove leading space from help
718         messages for -nostdlib and --rosegment.
719
720 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
721
722         PR ld/15365
723         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
724
725 2013-05-03  Alan Modra  <amodra@gmail.com>
726
727         * merge.cc (Output_merge_string::do_add_input_section): Correct
728         scan for number of strings.  Rename vars to avoid shadowing.
729         Include missing terminator in input_size_.
730
731 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
732
733         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
734         Restore empty string handling.
735
736 2013-05-01  Cary Coutant  <ccoutant@google.com>
737
738         * stringpool.cc (Stringpool_template::new_key_offset): Fix
739         uninitialized warning.
740
741 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
742
743         * output.cc (Output_section::add_merge_input_section): Allow
744         to merge sections if the alignment is more than character size.
745         * merge.h (Output_merge_string::Output_merge_string): Remove
746         assert.
747         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
748         only not-null strings. Check the alignment of strings.
749         * stringpool.h
750         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
751         alignment as the argument.
752         (Stringpool_template<Stringpool_char>::addralign_): New class member.
753         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
754         Align non-zero length strings according to the addralign_.
755         (Stringpool_template<Stringpool_char>::set_string_offsets):
756         Updating offsets according to the given alignment.
757         * testsuite/Makefile.am (text_section_grouping): Test if string
758         literals are getting merged.
759         * testsuite/Makefile.in: Regenerate.
760         * testsuite/merge_string_literals_1.c: New file.
761         * testsuite/merge_string_literals_2.c: Ditto.
762         * testsuite/merge_string_literals.sh: Ditto.
763
764 2013-04-26  Ian Lance Taylor  <iant@google.com>
765
766         * target-reloc.h (relocate_section): If the reloc offset is out of
767         range, pass VIEW as NULL to relocate.relocate.
768         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
769         * i386.cc (Target_i386::Relocate::relocate): Likewise.
770         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
771         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
772         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
773         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
774
775 2013-04-26  Geoff Pike  <gpike@chromium.org>
776
777         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
778         * layout.cc (Hash_task): New class.
779         (Layout::queue_build_id_tasks): New function.
780         (Layout::write_build_id): Handle single-thread portion of build ID
781         computation.  (In some cases, all of it is single-threaded.)  Replace
782         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
783         functionality in fewer lines of code.
784         * layout.h (Layout::queue_build_id_tasks): New function declaration.
785         * options.h (General_options): make "--build-id" default to tree
786         rather than sha1.  Add two new options related to --build-id=tree:
787         --build-id-chunk-size-for-treehash and
788         --build-id-min-file-size-for-treehash.
789         * Makefile.am: add testing of --build-id=tree and related new options
790         (these tests will be invoked by "make check").
791         * Makefile.in: Regenerate.
792
793 2013-04-25  Alan Modra  <amodra@gmail.com>
794
795         * configure.tgt: Add powerpcle and powerpc64le.
796
797 2013-04-22  Alan Modra  <amodra@gmail.com>
798
799         PR gold/15355
800         * layout.cc (Layout::segment_precedes): Allow more than one
801         segment with the same type and flags.
802
803 2013-04-15  Cary Coutant  <ccoutant@google.com>
804
805         * layout.cc (Layout::set_relocatable_section_offsets): Don't
806         allocate space in file for BSS sections.
807
808 2013-04-15  Cary Coutant  <ccoutant@google.com>
809
810         * script-sections.cc (Orphan_output_section): Reset address
811         to zero after each orphaned section for relocatable links.
812
813 2013-04-15  Cary Coutant  <ccoutant@google.com>
814
815         * symtab.cc (Symbol_table::sized_write_globals): Subtract
816         section starting address for relocatable link.
817         * testsuite/Makefile.am (script_test_11): New test.
818         * testsuite/Makefile.in: Regenerate.
819         * testsuite/script_test_11.c: New source file.
820         * testsuite/script_test_11.t: New linker script.
821
822 2013-04-13  Alan Modra  <amodra@gmail.com>
823
824         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
825         owner when sections are not adjacent and exceed group size.
826         (Target_powerpc::group_sections): Handle corner case.
827         (Target_powerpc::Branch_info::make_stub): Handle case where
828         stub table doesn't exist due to branches in non-exec sections.
829         (Target_powerpc::Relocate::relocate): Likewise.
830
831 2013-04-11  Alan Modra  <amodra@gmail.com>
832
833         PR gold/15354
834         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
835         .branch_lt to match bfd ld.  Adjust comments throughout file.
836
837 2013-04-04  Ian Lance Taylor  <iant@google.com>
838
839         GCC PR c++/56840
840         * object.cc (do_layout_deferred_sections): Handle .eh_frame
841         sections before checking whether they are included in the link.
842
843 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
844
845         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
846         object before calling the plugin claim_file handler.  Pass the elf
847         object of the archive to the plugin. Delete the elf object if the
848         plugin claims the file.
849
850 2013-03-21  Alan Modra  <amodra@gmail.com>
851
852         * layout.cc (Layout::set_segment_offsets): Accept writable .text
853         segment when omagic.
854
855 2013-03-21  Alan Modra  <amodra@gmail.com>
856
857         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
858         comparison warning.
859         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
860         uninitialized" warning.
861
862 2013-03-20  Alan Modra  <amodra@gmail.com>
863
864         * symtab.h (Symbol::clear_version): New function.
865         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
866         is_needed by weak references.  Clear version for symbols defined
867         in as-needed objects that are not needed.
868
869 2013-03-15  Alan Modra  <amodra@gmail.com>
870
871         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
872         static and public.  Add report_err param.  Return false for data refs.
873         (Target_powerpc::rela_dyn_section): New overloaded function.
874         (Target_powerpc::plt_, iplt_): Elucidate.
875         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
876         (Output_data_plt_powerpc::do_write): Don't write .iplt.
877         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
878         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
879         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
880         push_branch and make_plt_entry for ifunc syms when
881         reloc_needs_plt_for_ifunc.
882         (Target_powerpc::Relocate::relocate): Don't use plt entry value
883         for ifunc unless reloc_needs_plt_for_ifunc.
884
885 2013-03-15  Alan Modra  <amodra@gmail.com>
886
887         * gc.h (gc_process_relocs): Don't look through function descriptors.
888         * icf.cc (get_section_contents): Do so here instead.
889
890 2013-03-13  Alan Modra  <amodra@gmail.com>
891
892         * powerpc.cc (is_branch_reloc): Forward declare.
893         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
894         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
895         false for 64-bit, true for 32-bit non-branch relocs.
896         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
897         * testsuite/Makefile.am (icf_test): Use linker map file instead of
898         nm output.
899         (icf_safe_test): Generate linker map file as well as nm output.
900         (icf_safe_so_test): Likewise.
901         * testsuite/Makefile.in: Regenerate.
902         * testsuite/icf_test.sh: Parse linker map file to determine
903         section folding.
904         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
905         * testsuite/icf_safe_so_test.sh: Likewise.
906         (X86_32_or_ARM_specific_safe_fold): Merge into..
907         (arch_specific_safe_fold): ..this.
908         (X86_64_specific_safe_fold): Delete unused function.
909
910 2013-03-12  Alan Modra  <amodra@gmail.com>
911
912         * gc.h (gc_process_relocs): Look through function descriptors
913         to determine shndx, symvalue and addend used by ICF.  Tidy
914         variable duplication.
915
916 2013-03-11  Alan Modra  <amodra@gmail.com>
917
918         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
919         * layout.cc (Layout_task_runner::run): ..to here.
920         * symtab.h (struct Symbol_location): Extract from..
921         (class Symbol_table): ..here.
922         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
923         * target.h (class Target): Add function_location and
924         do_function_location functions.
925         (class Sized_target): Add do_function_location.
926         * object.h (class Sized_relobj_file): Move find_shdr..
927         (class Object): ..to here.
928         * object.cc: Likewise.  Update to suit.  Instantiate.
929         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
930         * powerpc.cc (class Powerpc_dynobj): New.
931         (Target_powerpc::do_function_location): New function.
932         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
933         (Powerpc_dynobj::do_read_symbols): New function.
934         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
935
936 2013-03-08  Ian Lance Taylor  <iant@google.com>
937
938         * options.cc (General_options::string_to_object_format): Accept
939         "default".
940
941 2013-03-08  Alan Modra  <amodra@gmail.com>
942
943         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
944         pointer to Post_fde.
945         (struct Post_fde): Move definition to here..
946         * ehframe.cc (struct Post_fde): ..from here.
947         (Cie::write): Don't alloc Post_fde.
948         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
949
950 2013-03-07  Alan Modra  <amodra@gmail.com>
951
952         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
953         relocation referencing .LC0.
954         * testsuite/discard_locals_test.sh: Remove FIXMEs.
955
956 2013-03-07  Alan Modra  <amodra@gmail.com>
957
958         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
959         always_inline.  Add assembly for powerpc to avoid GOT.
960
961 2013-03-07  Alan Modra  <amodra@gmail.com>
962
963         * testsuite/script_test_10.sh: Don't test .bss section
964         header number.
965
966 2013-03-06  Alan Modra  <amodra@gmail.com>
967
968         * powerpc.cc (class Powerpc_relobj): Move some member functions.
969         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
970         all callers.  Handle folded sections.
971         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
972         to Powerpc_relobj.
973         (Global_symbol_visitor_opd::operator()): Likewise.
974
975 2013-03-04  Alan Modra  <amodra@gmail.com>
976
977         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
978         * testsuite/Makefile.in: Regenerate.
979
980 2013-03-01  Cary Coutant  <ccoutant@google.com>
981
982         Add dwp support for v2 DWARF package file format.
983         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
984         tu_length parameter.  Adjust all callers.
985         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
986         * dwp.cc: Include dwarf.h.
987         (Section_bounds): New struct type.
988         (Unit_set): New struct type.
989         (Dwo_file::Dwo_file): Initialize new data member.
990         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
991         Combine and rename to...
992         (Dwo_file::read_unit_index): ...this.
993         (Dwo_file::sized_read_compunit_index)
994         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
995         (Dwo_file::sized_read_unit_index): ...this.
996         (Dwo_file::copy_section): Remove section_name, is_str_offsets
997         parameters; add section_id parameter.
998         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
999         (Dwo_file::add_unit_set): ...this.
1000         (Dwo_file::shndx_map_): Remove.
1001         (Dwo_file::sect_offsets_): New data member.
1002         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1003         (Dwp_output_file::add_section): Rename to...
1004         (Dwp_output_file::add_contribution): ...this.
1005         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1006         (Dwp_output_file::add_tu_set): Likewise.
1007         (Dwp_output_file::Contribution): New type.
1008         (Dwp_output_file::Section::contributions): New data member.
1009         (Dwp_output_file::Cu_or_tu_set): Remove.
1010         (Dwp_output_file::Section::Section): New ctor.
1011         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1012         (Dwp_output_file::Dwp_index::Section_table): New type.
1013         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1014         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1015         parameter.
1016         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1017         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1018         (Dwp_output_file::Dwp_index::section_table): New member function.
1019         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1020         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1021         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1022         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1023         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1024         (Dwp_output_file::Dwp_index::section_table_): New data member.
1025         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1026         (Dwp_output_file::add_output_section): New member function.
1027         (Dwp_output_file::write_new_section): New member function.
1028         (Dwp_output_file::write_contributions): New member function.
1029         (Dwp_output_file::section_id_map_): New data member.
1030         (class Dwo_id_info_reader): Remove.
1031         (class Unit_reader): New class.
1032         (get_dwarf_section_name): New function.
1033         (Dwo_file::read_executable): Adjust initializations of class data.
1034         (Dwo_file::read): Add support for v2 package file format.
1035         (Dwo_file::read_unit_index): Likewise.
1036         (Dwo_file::sized_read_unit_index): Likewise.
1037         (Dwo_file::copy_section): Likewise.
1038         (Dwo_file::add_unit_set): Likewise.
1039         (Dwp_output_file::add_output_section): Likewise.
1040         (Dwp_output_file::add_contribution): Likewise.
1041         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1042         for empty slot.
1043         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1044         file format.
1045         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1046         slot.
1047         (Dwp_output_file::initialize): Remove unused function.
1048         (Dwp_output_file::finalize): Add support for v2 package file format.
1049         (Dwp_output_file::write_index): Likewise.
1050         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1051         function prototype.
1052
1053 2013-03-01  Cary Coutant  <ccoutant@google.com>
1054
1055         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1056         function into class definition in header file.
1057         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1058         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1059         New function.
1060         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1061
1062 2013-02-28  Alan Modra  <amodra@gmail.com>
1063
1064         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1065         * target.cc (Target::do_plt_fde_location): New function.
1066         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1067         accessor function, and constructor param.
1068         (struct Post_fde, Post_fdes): Declare.
1069         (Cie::write): Add post_fdes param.
1070         * ehframe.cc (Fde::write): Use plt_fde_location.
1071         (struct Post_fde): Define.
1072         (Cie::write): Stash FDEs added post merge mapping.
1073         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1074         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1075         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1076         other FDEs.
1077         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1078         (Target_powerpc::has_glink): New function.
1079         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1080         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1081         glink_eh_frame_fde_32, default_fde): New data.
1082         (Stub_table::eh_frame_added_): New var.
1083         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1084         Make const.
1085         (Stub_table::add_eh_frame): New function.
1086         (Output_data_glink::add_eh_frame): New function.
1087         (Target_powerpc::make_glink_section): Call add_eh_frame.
1088
1089 2013-02-15  Ian Lance Taylor  <iant@google.com>
1090
1091         * options.h (DEFINE_uint64_alias): Define.
1092         (class General_options): Add -Ttext-segment as an alias for
1093         -Ttext.
1094
1095 2013-02-15  Alan Modra  <amodra@gmail.com>
1096
1097         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1098         (Stub_table::do_write): ..here, two places.
1099         (Stub_table::plt_call_size): Use it here too.
1100
1101 2013-02-11  Ian Lance Taylor  <iant@google.com>
1102
1103         * descriptors.cc (Descriptors::close_all): New function.
1104         * descriptors.h (class Descriptors): Declare close_all.
1105         (close_all_descriptors): New inline function.
1106         * plugin.cc: Include "descriptors.h".
1107         (Plugin_manager::cleanup): Call close_all_descriptors.
1108
1109 2013-02-06  Alan Modra  <amodra@gmail.com>
1110
1111         * README: Update coding style link.
1112
1113 2013-01-28  Cary Coutant  <ccoutant@google.com>
1114
1115         * dwp.cc (File_list): New typedef.
1116         (Dwo_name_info_reader): New class.
1117         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1118         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1119         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1120         (Dwo_file::read_executable): New function.
1121         (Dwo_file::read): Move common setup code to ...
1122         (Dwo_file::make_object): ... here.
1123         (dwp_options): Add --exec/-e.
1124         (usage): Likewise.
1125         (main): Likewise.
1126
1127 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1128
1129         * layout.cc (Layout::layout): Check for option text_reorder.
1130         (Layout::make_output_section): Ditto.
1131         * options.h (text_reorder): New option.
1132         * output.cc (Input_section_sort_compare): Remove special ordering
1133         of section names.
1134         (Output_section::
1135          Input_section_sort_section_name_special_ordering_compare::
1136          operator()): New function.
1137         (Output_section::sort_attached_input_sections): Use new sort function
1138         for .text.
1139         * output.h (Input_section_sort_section_name_special_ordering_compare):
1140         New struct.
1141         * testsuite/Makefile.am (text_section_grouping): Test option
1142         --no-text-reorder
1143         * testsuite/Makefile.in: Regenerate.
1144         * testsuite/text_section_grouping.sh: Check order of functions without
1145         default text reordering.
1146
1147 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1148
1149         * options.h (General_options): Change default to true for new_dtags.
1150
1151 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1152
1153         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1154         when enable_new_dtags is false.  Only add DT_RUNPATH when
1155         enable_new_dtags is true.
1156
1157 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1158
1159         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1160         used in declaration and definition consistent.
1161         (Target_powerpc::symval_for_branch): Ditto.
1162
1163 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1164
1165         * testsuite/plugin_final_layout.cc: Fix comment.
1166
1167 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1168
1169         * layout.cc (Layout::layout): Do not do default sorting for
1170         text sections when section ordering is specified.
1171         (make_output_section): Ditto.
1172         * testsuite/plugin_final_layout.cc: Name the function sections
1173         to catch reordering issues.
1174
1175 2013-01-15  Alan Modra  <amodra@gmail.com>
1176
1177         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1178         plt-thread-safe.
1179
1180 2013-01-15  Alan Modra  <amodra@gmail.com>
1181
1182         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1183         * testsuite/Makefile.in: Regenerate.
1184
1185 2013-01-14  Alan Modra  <amodra@gmail.com>
1186
1187         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1188         * testsuite/Makefile.in: Regenerate.
1189
1190 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1191
1192         PR bfd/14430
1193         Fix mingw gold build with plugins enabled
1194         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1195         * configure.ac: Export DLOPEN_LIBS and add headers check.
1196         * plugin.cc: Handle non-dlfcn case.
1197         * Makefile.in: Regenerate.
1198         * config.in: Regenerate.
1199         * configure: Regenerate.
1200         * testsuite/Makefile.in: Regenerate.
1201
1202 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1203
1204         * output.h (sort_attached_input_sections): Change to be public.
1205         * script-sections.cc
1206         (Output_section_definition::set_section_addresses): Sort
1207         attached input sections according to section order before linker
1208         script assigns section addresses.
1209         (Orphan_output_section::set_section_addresses): Sort
1210         attached input sections according to section order before linker
1211         script assigns section addresses.
1212         * Makefile.am (final_layout.sh): Use a simple linker script to
1213         check if section ordering still works.
1214         * Makefile.in: Regenerate.
1215
1216 2013-01-09  Ben Cheng  <bccheng@google.com>
1217
1218         * arm.cc (Target_arm::attributes_accept_div): New function.
1219         (Target_arm::attributes_forbid_div): New function.
1220         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1221         attribute using the same new functions as what bfd/elf32_arm.c
1222         does.
1223
1224 2013-01-07  Cary Coutant  <ccoutant@google.com>
1225
1226         PR gold/14993
1227         * output.cc (Output_section::add_input_section): For incremental
1228         updates, don't track input sections that are allocated from patch
1229         space.
1230
1231 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1232             Ian Lance Taylor  <iant@google.com>
1233
1234         PR gold/14897
1235         * configure.ac (--enable-ld): Removed.
1236         (install_as_default): Set to yes only for --enable-gold=default
1237         or --disable-ld.
1238         * configure: Regenerated.
1239
1240 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1241
1242         * options.h (General_options): Add -fuse-ld= for GCC linker
1243         option compatibility.
1244
1245 2013-01-04  Cary Coutant  <ccoutant@google.com>
1246
1247         * configure.ac: Fix typo restoring CXXFLAGS.
1248         * configure: Regenerate.
1249
1250 2013-01-04  Cary Coutant  <ccoutant@google.com>
1251
1252         * testsuite/Makefile.am (CXXLINK_S): New macro.
1253         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1254         * testsuite/Makefile.in: Regenerate.
1255
1256 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1257
1258         * version.cc (print_version): Update copyright year to 2013.
1259
1260 2012-12-20  Ian Lance Taylor  <iant@google.com>
1261
1262         * layout.cc (Layout::special_ordering_of_input_section): New
1263         function.
1264         (Layout::layout): If input section requires special ordering, must
1265         sort input sections.
1266         (Layout::make_output_section): May sort .text input sections.
1267         (Layout::is_section_name_prefix_grouped): Remove.
1268         * layout.h (class Layout): Declare
1269         special_ordering_of_input_section.  Don't declare
1270         is_section_name_prefix_grouped.
1271         * output.cc (Output_section::add_input_section): Revert last
1272         change.
1273         (Output_section::Input_section_sort::match_file_name): Don't crash
1274         if called on output section data.
1275         (Output_section::Input_section_sort_compare): Sort based on
1276         special ordering.
1277         (Output_section::Input_section_sort_section_order_index_compare):
1278         Revert last patch.
1279         (Output_section::sort_attached_input_sections): Likewise.
1280
1281 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1282
1283         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1284         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1285         * output.cc (Output_section::add_input_section): Check if section
1286         name contains special prefix.  Keep input sections to sort such
1287         sections.
1288         (Output_section::Input_section_sort_section_order_index_compare
1289          ::operator()): Group sections according to prefixes.
1290         (Output_section::sort_attached_input_sections): Add condition to
1291         Input_section_entry constructor call.
1292         * testsuite/Makefile.am (text_section_grouping): New test.
1293         * testsuite/Makefile.in: Regenerate.
1294         * testsuite/text_section_grouping.cc: New file.
1295         * testsuite/text_section_grouping.sh: New file.
1296
1297 2012-12-17  Nick Clifton  <nickc@redhat.com>
1298
1299         * Makefile.am: Add copyright notice.
1300         * NEWS: Likewise.
1301         * README: Likewise.
1302         * configure.ac: Likewise.
1303         * ftruncate.c: Likewise.
1304         * Makefile.in: Regenerate.
1305
1306 2012-12-14  Cary Coutant  <ccoutant@google.com>
1307
1308         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1309         --no-as-needed flag.
1310         (exception_separate_shared_12_test): Likewise.
1311         (incremental_copy_test): Likewise.
1312         * testsuite/Makefile.in: Regenerate.
1313
1314 2012-12-14  Cary Coutant  <ccoutant@google.com>
1315
1316         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1317         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1318
1319 2012-12-12  Alan Modra  <amodra@gmail.com>
1320
1321         * powerpc.cc (class Track_tls): New.
1322         (class Relocate, class Scan): Inherit Track_tls.
1323         (Target_powerpc::Scan::local, global): Track tls optimization
1324         and avoid creating plt entry for __tls_get_addr if all uses
1325         are optimized away.
1326         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1327
1328 2012-12-12  Alan Modra  <amodra@gmail.com>
1329
1330         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1331         Replace no_toc_optimize with toc_optimize.
1332         * output.h (Output_section::input_sections): Provide non-const variant.
1333         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1334         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1335         accessors.
1336         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1337         (class Sort_toc_sections): New.
1338         (Target_powerpc::do_finalize_sections): Sort toc sections.
1339         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1340
1341 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1342
1343         * testsuite/binary_unittest.cc (read_all): New function.
1344         (Sized_binary_test): Use it instead of ::read.
1345         * fileread.cc (do_read): Don't assume pread always reads the whole
1346         amount in a single call.
1347
1348 2012-12-10  Alan Modra  <amodra@gmail.com>
1349
1350         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1351         Set EM_PPC64 or EM_PPC here.
1352         (Target_selector_powerpc::do_recognize): Delete.
1353
1354 2012-12-10  Alan Modra  <amodra@gmail.com>
1355
1356         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1357         stub_table_.
1358         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1359
1360 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1361
1362         * testsuite/binary_unittest.cc (Sized_binary_test):
1363         Use open_descriptor rather than ::open.
1364
1365 2012-12-07  Alan Modra  <amodra@gmail.com>
1366
1367         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1368         typedef and invalid_address constant.
1369         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1370         instantiate constants.
1371
1372 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1373
1374         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1375         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1376         * aclocal.m4: Regenerate.
1377         * configure: Regenerate.
1378         * Makefile.in: Regenerate.
1379         * testsuite/Makefile.in: Regenerate.
1380
1381 2012-12-07  Alan Modra  <amodra@gmail.com>
1382
1383         * options.h (General_options): Add no_toc_optimize.
1384         * powerpc.cc (ok_lo_toc_insn): New function.
1385         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1386
1387 2012-12-06  Alan Modra  <amodra@gmail.com>
1388
1389         * options.h (General_options): Add plt_align, plt_static_chain,
1390         plt_thread_safe.  Update stub_group_size help text.
1391         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1392         for new plt_thread_safe_ var.
1393         (use_plt_offset): Correct comments.
1394         (Target_powerpc::do_relax): Look for thread creation symbols to
1395         determine default plt_thread_safe value.  Clear plt call stubs
1396         as well as branch stubs each iteration.
1397         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1398         insn constants.
1399         (l, hi, ha, write_insn): Move earlier.
1400         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1401         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1402         plt stubs too.
1403         (Stub_table::update_size): Adjust.
1404         (Stub_table::prev_size, set_prev_size): Delete.
1405         (Stub_table::stub_align): Let --plt-align affect result.
1406         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1407         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1408         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1409         (Stub_table::do_write): Support more stub variants.
1410
1411 2012-12-04  Alan Modra  <amodra@gmail.com>
1412
1413         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1414         (Target_powerpc::do_define_standard_symbols): New function.
1415
1416 2012-12-03  Alan Modra  <amodra@gmail.com>
1417
1418         * output.h: Formatting, whitespace.
1419
1420 2012-12-03  Alan Modra  <amodra@gmail.com>
1421
1422         * layout.h (Layout::get_executable_sections): Declare.
1423         * layout.cc (Layout::get_executable_sections): New function.
1424         * arm.cc (Target_arm::group_sections): Use it.
1425         (Arm_output_section::group_sections): Delete now redundant test.
1426         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1427         param to handle relative relocs.
1428         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1429         (Output_data_reloc::add_absolute): Adjust.
1430         (Output_data_reloc::add_relative): New function.
1431         (Output_data::reset_data_size): New function.
1432         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1433         (Output_section::set_addralign): New function.
1434         (Output_section::checkpoint_set_addralign): New function.
1435         (Output_section::clear_section_offsets_need_adjustment): New function.
1436         (Output_section::input_sections): Make public.
1437         * powerpc.cc (class Output_data_brlt_powerpc): New.
1438         (class Stub_table, class Stub_control): New.
1439         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1440         stub_table_, set_stub_table, stub_table): New vectors and accessor
1441         functions.
1442         (Target_powerpc::do_may_relax, do_relax, push_branch,
1443         new_stub_table, stub_tables, brlt_section, group_sections,
1444         add_branch_lookup_table, find_branch_lookup_table,
1445         write_branch_lookup_table, make_brlt_section): New functions.
1446         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1447         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1448         branch_info_): New vars.
1449         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1450         make call stubs here.
1451         (Output_data_glink): Remove all call stub handling from this class.
1452         (Target_powerpc::Scan::local, global): Save interesting branch
1453         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1454         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1455         functions on final link.
1456         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1457         Handle long branch destinations too.
1458         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1459         do_plt_address_for_local): Adjust lookup of plt call stubs.
1460
1461 2012-11-30  Alan Modra  <amodra@gmail.com>
1462
1463         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1464         relocs against protected symbols when building 32-bit shared libs.
1465
1466 2012-11-30  Alan Modra  <amodra@gmail.com>
1467
1468         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1469         param.  Call got_section() to make .got.  Update all callers
1470         and their callers and so on.
1471
1472 2012-11-30  Alan Modra  <amodra@gmail.com>
1473
1474         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1475         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1476         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1477         value if it already exists.
1478
1479 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1480
1481         PR gold/14858
1482         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1483
1484 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1485
1486         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1487         than bfc instruction for data sandboxing.
1488
1489 2012-11-08  Alan Modra  <amodra@gmail.com>
1490
1491         * po/POTFILES.in: Regenerate.
1492
1493 2012-11-05  Alan Modra  <amodra@gmail.com>
1494
1495         * configure.ac: Apply 2012-09-10 change to config.in here.
1496         * configure: Regenerate.
1497
1498 2012-11-05  Alan Modra  <amodra@gmail.com>
1499
1500         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1501         (struct Opd_ent): Use "Address" rather than "Offset".
1502         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1503         (Target_powerpc::got_section): Make public.
1504         (Target_powerpc::scan_relocs): Move code setting symbols..
1505         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1506         Create _SDA_BASE_ only when referenced.
1507
1508 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1509
1510         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1511         from last change.
1512
1513 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1514
1515         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1516         for offset_in_output_section parameter.
1517         (Sized_target::relocate_special_relocatable): Likewise.
1518         * arm.cc (Target_arm::relocate_relocs): Likewise.
1519         (Target_arm::relocate_special_relocatable): Likewise.
1520         * i386.cc (Target_i386::relocate_relocs): Likewise.
1521         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1522         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1523         * target-reloc.h (relocate_relocs): Likewise.
1524         * testsuite/testfile.cc (Target_test): Likewise.
1525         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1526         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1527
1528         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1529         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1530
1531         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1532         parameter, which is unused in the [!F_SETFD] case.
1533
1534         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1535         SYMNDX to off_t before comparing it to this->data_size().
1536         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1537         * incremental.cc (Output_section_incremental_inputs::do_write):
1538         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1539
1540         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1541
1542 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1543
1544         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1545         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1546         in EABI_VER5.
1547
1548 2012-10-29  Cary Coutant  <ccoutant@google.com>
1549
1550         * dwp.cc (usage): Add file and exit status parameters;
1551         add --help and --version options.
1552         (print_version): New function.
1553         (main): Add --help and --version options.
1554
1555 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1556
1557         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1558         final_layout_sequence.txt.
1559         * testsuite/Makefile.in: Regenerated.
1560
1561 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1562
1563         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1564         COMPILE generated by automake.
1565         (LINK1): Likewise.
1566         (CXXCOMPILE1): Likewise.
1567         (CXXLINK1): Likewise.
1568         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1569         (LINK): Likewise.
1570         (CXXCOMPILE): Likewise.
1571         (CXXLINK): Likewise.
1572         * testsuite/Makefile.in: Regenerated.
1573
1574 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1575
1576         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1577         on bad fwrite return.
1578
1579 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1580
1581         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1582         on val.
1583
1584 2012-10-23  Cary Coutant  <ccoutant@google.com>
1585
1586         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1587         * testsuite/Makefile.in: Regenerate.
1588         * testsuite/dwp_test.h: New source file.
1589         * testsuite/dwp_test_1.cc: New source file.
1590         * testsuite/dwp_test_1.s: New source file.
1591         * testsuite/dwp_test_1.sh: New source file.
1592         * testsuite/dwp_test_1b.cc: New source file.
1593         * testsuite/dwp_test_1b.s: New source file.
1594         * testsuite/dwp_test_2.cc: New source file.
1595         * testsuite/dwp_test_2.s: New source file.
1596         * testsuite/dwp_test_2.sh: New source file.
1597         * testsuite/dwp_test_main.cc: New source file.
1598         * testsuite/dwp_test_main.s: New source file.
1599
1600 2012-10-23  Cary Coutant  <ccoutant@google.com>
1601
1602         * dwp.h: New header file.
1603         * dwp.cc: New source file.
1604         * gold.h: Move shared declarations to system.h.
1605         * system.h: New header file.
1606         * Makefile.am: Add dwp.
1607         * Makefile.in: Regenerate.
1608
1609 2012-10-23  Cary Coutant  <ccoutant@google.com>
1610
1611         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1612         Dwarf_info_reader::read_from_pointer.
1613         (Dwarf_pubnames_table::read_header): Likewise.
1614         (Dwarf_pubnames_table::next_name): Likewise.
1615         (Dwarf_die::read_attributes): Likewise.
1616         (Dwarf_die::skip_attributes): Likewise.
1617         (Dwarf_info_reader::read_from_pointer): New function template.
1618         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1619         (Dwarf_pubnames_table): Likewise.
1620         (Dwarf_info_reader::read_from_pointer): New function template.
1621         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1622         Dwarf_pubnames_table ctor.
1623
1624 2012-10-23  Cary Coutant  <ccoutant@google.com>
1625
1626         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1627         abbrev_shndx.
1628         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1629         abbrev_shndx_.
1630         (Dwarf_info_reader::set_abbrev_shndx): New method.
1631         (Dwarf_info_reader::abbrev_shndx_): New data member.
1632
1633 2012-10-23  Cary Coutant  <ccoutant@google.com>
1634
1635         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1636         from object, not parameters.
1637         (Dwarf_info_reader::parse): Likewise.
1638         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1639         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1640         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1641         methods.
1642
1643 2012-10-23  Cary Coutant  <ccoutant@google.com>
1644
1645         * fileread.cc (Input_file::Input_file): New constructor.
1646         * fileread.h (class Input_file): Add new constructor.
1647
1648 2012-10-18  Alan Modra  <amodra@gmail.com>
1649
1650         PR gold/14727
1651         * object.cc (Relobj::is_section_name_included): Also match
1652         .sdata personality section.
1653
1654 2012-10-18  Alan Modra  <amodra@gmail.com>
1655
1656         * target-reloc.h (class Default_comdat_behavior): New, package up..
1657         (get_comdat_behaviour): ..this.
1658         (relocate_section): Add Relocate_comdat_behavior template arg,
1659         adjust code to suit.
1660         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1661         (Target_arm::scan_reloc_section): Likewise.
1662         * i386.cc (Target_i386::relocate_section): Likewise.
1663         * sparc.cc (Target_sparc::relocate_section): Likewise.
1664         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1665         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1666         * powerpc.cc (class Relocate_comdat_behavior): New.
1667         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1668         gold::relocate_section with new template arg.
1669
1670 2012-10-18  Alan Modra  <amodra@gmail.com>
1671
1672         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1673         dynamic relocs for GOT_TPREL got entries, without symbol if
1674         resolving locally.
1675         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1676         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1677         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1678
1679 2012-10-17  Alan Modra  <amodra@gmail.com>
1680
1681         PR gold/14726
1682         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1683
1684 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1685
1686         * layout.cc (Layout::include_section): Keep sections marked
1687         SHF_EXCLUDE when doing relocatable links.
1688
1689 2012-10-16  Alan Modra  <amodra@gmail.com>
1690
1691         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1692         (Target_powerpc::do_finalize_sections): Call it.
1693         (Output_data_save_res): New class and supporting functions.
1694         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1695         normal symbols defined in object files.
1696
1697 2012-10-12  Alan Modra  <amodra@gmail.com>
1698
1699         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1700         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1701         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1702         section if scan_opd_relocs not yet called.
1703         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1704
1705 2012-10-12  Alan Modra  <amodra@gmail.com>
1706
1707         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1708         add_local_ifunc_entry): Revert last change.
1709         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1710
1711 2012-10-05  Alan Modra  <amodra@gmail.com>
1712
1713         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1714         do_plt_address_for_global): New functions.
1715         (Output_data_got_powerpc::do_write): Don't segfault when linking
1716         statically.
1717         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1718         add_local_ifunc_entry): Return true on adding entry..
1719         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1720         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1721         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1722         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1723         set up symbols here.
1724         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1725         syms here.  Do so even when no .iplt.  Don't segfault when linking
1726         statically.
1727         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1728         new variants without reloc param.
1729         (Glink_sym_ent::Glink_sym_ent): Likewise.
1730         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1731         reloc when refs will resolve to plt call stub.
1732         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1733         R_PPC_PLTREL24 to resolve locally.
1734         (Target_powerpc::Scan::global): Correct ifunc handling.
1735         (Target_powerpc::Relocate::relocate): Correct local sym glink
1736         lookup.  Don't destroy "value" when we have a plt call stub,
1737         and when checking plt call validity.
1738         (Target_powerpc::do_dynsym_value): Simplify.
1739
1740 2012-10-05  Alan Modra  <amodra@gmail.com>
1741
1742         * i386.cc (Output_data_plt_i386::address_for_global,
1743         address_for_local): Add plt offset to returned value.  Adjust uses.
1744         * sparc.cc (Output_data_plt_sparc::address_for_global,
1745         address_for_local): Likewise.
1746         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1747         address_for_local): Likewise.
1748         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1749         address_for_local): Likewise.
1750         * target.h (Target::plt_address_for_global, plt_address_for_local):
1751         Update comment.
1752         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1753         (Output_data_got::Got_entry::write): Nor here.
1754         * output.h: Comment fix.
1755
1756 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1757
1758         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1759         global_offset_table_ value for larget got.
1760         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1761
1762 2012-09-29  Alan Modra  <amodra@gmail.com>
1763
1764         * powerpc.cc (Target_powerpc::iplt_): New output section.
1765         (Target_powerpc::iplt_section, make_iplt_section,
1766         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1767         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1768         Target_powerpc::plt_entry_count): Count iplt entries too.
1769         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1770         reloc section in constructor.  New params.
1771         (Target_powerpc::make_plt_section): Create reloc section here instead.
1772         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1773         functions.
1774         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1775         (Output_data_glink::add_entry, find_entry): New functions to
1776         deal with local syms.
1777         (Glink_sym_ent): Add support for local syms.
1778         (Output_data_glink::do_write): Handle ifunc plt entries.
1779         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1780         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1781         (Target_powerpc::Relocate::relocate): Likewise.
1782         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1783
1784 2012-09-25  Alan Modra  <amodra@gmail.com>
1785
1786         * object.h (Sized_relobj_file::adjust_local_symbol,
1787         do_adjust_local_symbol): New functions.
1788         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1789         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1790         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1791         and irregular opd entry spacing.
1792         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1793         (Global_symbol_visitor_opd): New functor.
1794         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1795         on deleted opd entries.
1796
1797 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1798
1799         * tilegx.cc: New file.
1800         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1801         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1802         * configure.tgt: Add entries for tilegx*.
1803         * configure.ac: Likewise.
1804         * Makefile.in: Rebuild.
1805         * configure: Likewise.
1806         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1807         tilegx.
1808
1809 2012-09-13  Alan Modra  <amodra@gmail.com>
1810
1811         * target-reloc.h (scan_relocs): Call scan.local for relocs
1812         against symbols in discarded sections.  Pass is_discarded
1813         param.
1814         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1815         Add is_discarded param.
1816         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1817         is_discarded to flag opd entry as discarded.  Don't emit dyn
1818         relocs on such entries.
1819         (Target_powerpc::Scan::global): Similarly detect and handle
1820         such opd entries.
1821         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1822         opd_ent_.  Update all uses.
1823         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1824         (Target_powerpc::relocate_section): Zero out discarded opd
1825         entry relocs.
1826
1827 2012-09-12  Ian Lance Taylor  <iant@google.com>
1828
1829         PR gold/14570
1830         * output.cc: Rename Output_data_got template parameter from size
1831         to got_size for all functions.  Compile all variants of
1832         Output_data_got.
1833         (Output_data_got::Got_entry::write): Correct use of size for
1834         symbol value.  Use local_is_tls rather than casting to
1835         Sized_relobj_file.
1836         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1837         (class Sized_relobj_file): Add do_local_is_tls.
1838         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1839
1840 2012-09-11  Alan Modra  <amodra@gmail.com>
1841
1842         PR gold/14566
1843         * layout.cc (Layout::set_segment_offsets): When using
1844         common-page-size alignment, ensure we are on a new max-page-size
1845         page.
1846         * output.cc (Output_segment::set_section_addresses): Use
1847         abi_pagesize, not common_pagesize for relro boundary.
1848         (Output_segment::set_offset): Likewise.
1849
1850 2012-09-11  Alan Modra  <amodra@gmail.com>
1851
1852         * output.h (Output_data_got::add_global_tls, add_local_tls,
1853         add_local_tls_pair): New functions.
1854         (Output_data_got::add_local_pair_with_rel): Remove second
1855         reloc param.  Expand comment.
1856         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1857         use_plt_or_tls_offset_, similarly for constructor param.
1858         (Output_data_got::Got_entry::write): Add got_index param.
1859         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1860         add_local_tls_pair): New functions.
1861         (Output_data_got::Got_entry::write): Handle tls symbols
1862         with use_plt_or_tls_offset_ set specially.
1863         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1864         (Output_data_got::do_write): Replace iterator with index, pass
1865         index to entry write function.
1866         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1867         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1868         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1869         call.
1870         * i386.cc (Target_i386::Scan::local): Likewise.
1871         * sparc.cc (Target_sparc::Scan::local): Likewise.
1872         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1873         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1874         do_tls_offset_for_global): New functions.
1875         (Target_powerpc::Scan::local): Correct TLS relocations and got
1876         entry values.
1877         (Target_powerpc::Scan::global): Don't emit unnecessary
1878         dynamic relocations on TLS GOT entries.
1879
1880 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1881
1882         * config.in: Disable sanity check for kfreebsd.
1883
1884 2012-09-10  Sterling Augustine  <saugustine@google.com>
1885
1886         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1887         (Gdb_index::pubtypes_read): New parameter.
1888         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1889         to calls.
1890         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1891         pubtypes_object_.
1892
1893 2012-09-09  Alan Modra  <amodra@gmail.com>
1894
1895         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1896         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1897         * gc.h (gc_process_relocs): Call target gc_add_reference.
1898         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1899         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1900         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1901         unnecessary cast.
1902         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1903         to cater for when we don't need code offset.  Update use.
1904         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1905         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1906         set_opd_valid): New functions.
1907         (Target_powerpc::do_gc_add_reference): New function.
1908         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1909         stashed refs.
1910         (Target_powerpc::do_gc_mark_symbol): New function.
1911
1912 2012-09-06  Cary Coutant  <ccoutant@google.com>
1913
1914         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1915         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1916         (Dwarf_die::skip_attributes): Likewise.
1917         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1918         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1919         (main): Call it.
1920         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1921
1922 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1923
1924         * testsuite/script_test_3.t: Add .got.plt output section
1925         statement.
1926         * testsuite/script_test_4.t: Likewise.
1927
1928 2012-09-05  Alan Modra  <amodra@gmail.com>
1929
1930         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1931         update all uses and lose "enum" when using type.
1932
1933 2012-09-05  Alan Modra  <amodra@gmail.com>
1934
1935         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1936         * configure: Regenerate.
1937         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1938         (plugin_final_layout.stdout): Likewise.
1939         (memory_test): Set page sizes to 0x1000.
1940         * testsuite/Makefile.in: Regenerate.
1941         * testsuite/discard_locals_test.sh: Add FIXME comment.
1942         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1943         * testsuite/pr14265.t: Add .got output section statement.
1944         * testsuite/script_test_2.t: Likewise.
1945         * testsuite/script_test_3.t: Likewise.
1946         * testsuite/script_test_4.t: Likewise.
1947         * testsuite/script_test_5.t: Likewise.
1948         * testsuite/script_test_6.t: Likewise.
1949         * testsuite/script_test_7.t: Likewise.
1950         * testsuite/script_test_9.t: Likewise.
1951
1952 2012-09-05  Alan Modra  <amodra@gmail.com>
1953
1954         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1955         (Powerpc_relocate_functions::Status): New typedef.
1956         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1957         (Target_powerpc::Scan::local): Handle REL64.
1958         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1959         for REL32 and REL64.
1960         (Target_powerpc::symval_for_branch): New function, extracted from..
1961         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1962         checks.  Report overflow errors.
1963
1964 2012-09-05  Alan Modra  <amodra@gmail.com>
1965
1966         * object.h (Sized_relobj_file::emit_relocs): Delete.
1967         (Sized_relobj_file::emit_relocs_reltype): Delete.
1968         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1969         relocate_relocs for --emit-relocs.
1970         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1971         * output.h: Update comment.
1972         (Output_segment::first_section): New function.
1973         (Output_segment::first_section_load_address): Use first_section.
1974         * output.cc (Output_segment::first_section): New function extracted..
1975         (Output_segment::first_section_load_address): ..from here.  Delete.
1976         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1977         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1978         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1979         adjust call to target.h function.
1980         * i386.cc (Target_i386): Likewise.
1981         * sparc.cc (Target_sparc): Likewise.
1982         * x86_64.cc (Target_x86_64): Likewise.
1983         * powerpc.cc (Target_powerpc): Likewise.
1984         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1985         first tls section has section symbol for optimised local dynamic
1986         output relocs.
1987         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1988         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1989         optimised tls code.
1990         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1991         Rename to relocate_relocs.  Update error message.
1992
1993 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1994
1995         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1996         --just-symbols.
1997
1998 2012-08-31  Alan Modra  <amodra@gmail.com>
1999
2000         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2001         (Powerpc_relobj::toc_base_offset): New stub function.
2002         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2003         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2004         (Target_powerpc::Relocate::enum skip_tls): New.
2005         (Target_powerpc::call_tls_get_addr_): New var.
2006         (Target_powerpc::is_branch_reloc): Move to file scope.
2007         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2008         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2009         New functions.
2010         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2011         (powerpc_info): Correct common_pagesize for ppc64.
2012         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2013         (Powerpc_relocate_functions): Add overflow check enums and functions.
2014         Add non-shift version of rela, rela_ua.  Delete all rel public
2015         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2016         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2017         addr16_ha3, addr14 functions.
2018         (Output_data_got_powerpc::add_constant_pair): New function.
2019         (Output_data_got_powerpc::got_base_offset): Likewise.
2020         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2021         (instruction constants): Sort, add some more.
2022         (Output_data_glink::do_write): Add and use Address typedef.  Use
2023         object->toc_base_offset() stub for 64-bit.
2024         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2025         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2026         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2027         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2028         Always treat .opd relocs as against locally defined symbol.
2029         Correct condition for RELATIVE relocs.
2030         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2031         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2032         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2033         calculations.  Handle TLS relocs, and more.  Add overflow
2034         checking and adjust for Powerpc_relocate_functions changes.
2035         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2036         Reinstate --emit-relocs code with FIXME.
2037
2038 2012-08-30  Alan Modra  <amodra@gmail.com>
2039
2040         * layout.cc (Layout::set_segment_offsets): Set p_align to
2041         abi_pagesize, not common_pagesize.
2042         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2043         to determine whether file header can go in segment.
2044
2045 2012-08-30  Alan Modra  <amodra@gmail.com>
2046
2047         * output.h (Output_reloc::Output_reloc <output section>): Add
2048         is_relative param.  Adjust calls.
2049         (Output_reloc::add_output_section_relative): New functions.
2050         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2051         is_relative.
2052         (Output_reloc::symbol_value): Handle SECTION_CODE.
2053
2054 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2055
2056         * gold.cc (queue_middle_tasks): Call layout again when unique
2057         segments for sections is desired.
2058         * layout.cc (Layout::Layout): Initialize new members.
2059         (Layout::get_output_section_flags): New function.
2060         (Layout::choose_output_section): Call get_output_section_flags.
2061         (Layout::layout): Make output section for mapping to a unique segment.
2062         (Layout::insert_section_segment_map): New function.
2063         (Layout::attach_allocated_section_to_segment): Make unique segment for
2064         output sections marked so.
2065         (Layout::segment_precedes): Check for unique segments when sorting.
2066         * layout.h (Layout::Unique_segment_info): New struct.
2067         (Layout::Section_segment_map): New typedef.
2068         (Layout::insert_section_segment_map): New function.
2069         (Layout::get_output_section_flags): New function.
2070         (Layout::is_unique_segment_for_sections_specified): New function.
2071         (Layout::set_unique_segment_for_sections_specified): New function.
2072         (Layout::unique_segment_for_sections_specified_): New member.
2073         (Layout::section_segment_map_): New member.
2074         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2075         Rename is_gc_pass_one to is_pass_one.
2076         Rename is_gc_pass_two to is_pass_two.
2077         Rename is_gc_or_icf to is_two_pass.
2078         Check for which pass based on whether symbols data is present.
2079         Make it two pass when unique segments for sections is desired.
2080         * output.cc (Output_section::Output_section): Initialize new
2081         members.
2082         * output.h (Output_section::is_unique_segment): New function.
2083         (Output_section::set_is_unique_segment): New function.
2084         (Output_section::is_unique_segment_): New member.
2085         (Output_section::extra_segment_flags): New function.
2086         (Output_section::set_extra_segment_flags): New function.
2087         (Output_section::extra_segment_flags_): New member.
2088         (Output_section::segment_alignment): New function.
2089         (Output_section::set_segment_alignment): New function.
2090         (Output_section::segment_alignment_): New member.
2091         (Output_segment::Output_segment): Initialize is_unique_segment_.
2092         (Output_segment::is_unique_segment): New function.
2093         (Output_segment::set_is_unique_segment): New function.
2094         (Output_segment::is_unique_segment_): New member.
2095         * plugin.cc (allow_unique_segment_for_sections): New function.
2096         (unique_segment_for_sections): New function.
2097         (Plugin::load): Add new functions to transfer vector.
2098         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2099         * Makefile.in: Regenerate.
2100         * testsuite/plugin_final_layout.sh: Check if unique segment
2101         functionality works.
2102         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2103         are available.
2104         (allow_unique_segment_for_sections): New global.
2105         (unique_segment_for_sections): New global.
2106         (claim_file_hook): Call allow_unique_segment_for_sections.
2107         (all_symbols_read_hook): Call unique_segment_for_sections.
2108
2109 2012-08-22  Cary Coutant  <ccoutant@google.com>
2110
2111         * layout.cc (Layout::include_section): Don't assert on GROUP
2112         sections with --emit-relocs.
2113
2114 2012-08-21  Cary Coutant  <ccoutant@google.com>
2115
2116         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2117         if --export-dynamic-symbol names an undef symbol.
2118
2119 2012-08-18  Alan Modra  <amodra@gmail.com>
2120
2121         * powerpc.cc: Formatting and white space.
2122         (Powerpc_relobj): Rename got2_section_ to special_.
2123         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2124         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2125         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2126         (Target_powerpc): Add Address typedef and invalid_address.  Use
2127         throughout.
2128         (Target_powerpc::is_branch_reloc): New function.
2129         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2130         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2131         for dst_mask, value and addend.
2132         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2133         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2134         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2135         uint16_t for 24-bit offset.  Use get_output_section_offset and
2136         check return.
2137         (Target_powerpc::Scan::local): Handle more relocs.
2138         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2139         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2140         Plug in toc restoring insn after plt calls.  Translate branches
2141         to function descriptor symbols to corresponding entry point.
2142         (Target_powerpc::relocate_for_relocatable): Check return from
2143         get_output_section_offset.
2144         * symtab.h: Comment typo.
2145
2146 2012-08-14  Ian Lance Taylor  <iant@google.com>
2147
2148         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2149         unsupported_relocal_local to call unsupported_reloc_global.
2150
2151 2012-08-14  Nick Clifton  <nickc@redhat.com>
2152
2153         PR ld/14265
2154         * script-sections.cc (Sections_element::output_section_name): Add
2155         keep return parameter.
2156         (Output_section_element::match_name): Add keep return parameter.
2157         Return the value of the keep_ member.
2158         * script-sections.h (class Output_section): Update
2159         output_section_name prototype.
2160         * layout.cc (Layout::keep_input_section): New public member
2161         function.
2162         (Layout::choose_output_section): Pass keep parameter to
2163         output_section_name.
2164         * layout.h (class Layout): Add keep_input_section.
2165         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2166         sections.
2167         * testsuite/Makefile.am: Add a test.
2168         * testsuite/Makefile.in: Regenerate.
2169         * testsuite/pr14265.c: Source file for the test.
2170         * testsuite/pr14265.t: Linker script for the test.
2171         * testsuite/pr14265.sh: Shell script for the test.
2172
2173 2012-08-14  Alan Modra  <amodra@gmail.com>
2174
2175         * target.h (Target::output_section_name): New function.
2176         (Target::do_output_section_name): New function.
2177         * layout.cc (Layout::choose_output_section): Call the above.
2178         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2179
2180 2012-08-14  Alan Modra  <amodra@gmail.com>
2181
2182         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2183         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2184         for replace_constant call.
2185         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2186         (Output_data_glink::do_print_to_mapfile): New function.
2187         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2188         (Target_powerpc::Relocate::relocate): Likewise.
2189
2190 2012-08-14  Alan Modra  <amodra@gmail.com>
2191
2192         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2193         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2194         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2195         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2196         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2197         here.
2198         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2199         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2200         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2201         here.
2202         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2203         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2204
2205 2012-08-12  Alan Modra  <amodra@gmail.com>
2206
2207         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2208         (glink insn constants): Use uint32_t.
2209         (Output_data_glink::add_entry): Use insert, not [] operator.
2210
2211 2012-08-11  Alan Modra  <amodra@gmail.com>
2212
2213         * object.h (Sized_relobj_file::find_shdr): New function.
2214         (Sized_relobj_file::find_special_sections): New function.
2215         * object.cc (Sized_relobj_file::find_shdr): New function.
2216         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2217         (Sized_relobj_file::find_special_sections): New function, split out..
2218         (Sized_relobj_file::do_read_symbols): ..from here.
2219         * output.h (Output_data_got::replace_constant): New function.
2220         (Output_data_got::num_entries): New function.
2221         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2222         (Output_data_got::got_offset): Protected rather than private.
2223         (Output_data_got::replace_got_entry): New function.
2224         * output.cc (Output_data_got::replace_got_entry): New function.
2225         * powerpc.cc (class Powerpc_relobj): New.
2226         (class Powerpc_relocate_functions): Delete all psymval variants or
2227         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2228         Implement _ha functions using corresponding _hi function.
2229         (Powerpc_relobj::find_special_sections): New function.
2230         (Target_powerpc::do_make_elf_object): New function.
2231         (class Output_data_got_powerpc): New.
2232         (class Output_data_glink): New.
2233         (class Powerpc_scan_relocatable_reloc): New.
2234         Many more changes througout file.
2235
2236 2012-08-09  Nick Clifton  <nickc@redhat.com>
2237
2238         * po/vi.po: Updated Vietnamese translation.
2239
2240 2012-08-07  Ian Lance Taylor  <iant@google.com>
2241
2242         * layout.cc (Layout::add_target_dynamic_tags): If
2243         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2244         plt_rel.
2245
2246 2012-07-30  Nick Clifton  <nickc@redhat.com>
2247
2248         * po/gold.pot: Updated template.
2249         * po/es.po: Updated Spanish translation.
2250
2251 2012-07-18  Cary Coutant  <ccoutant@google.com>
2252
2253         PR gold/14344
2254         * configure.ac: Add check for -gpubnames support.
2255         * configure: Regenerate.
2256         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2257         support; force -gno-pubnames.
2258         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2259         support.
2260         (gdb_index_test_4): New test.
2261         * testsuite/Makefile.in: Regenerate.
2262         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2263         * testsuite/gdb_index_test_2.sh: Likewise.
2264         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2265         * testsuite/gdb_index_test_4.sh: New script.
2266         * testsuite/gdb_index_test_comm.sh: New script with common code;
2267         don't look for space after colon.
2268
2269 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2270
2271         * gold.cc (queue_middle_tasks): Update function order only after
2272         deferred objects due to plugins are processed.
2273
2274 2012-07-11  Ian Lance Taylor  <iant@google.com>
2275
2276         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2277         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2278         (Target_arm::scan_reloc_for_stub): Likewise.
2279         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2280         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2281         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2282         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2283         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2284
2285 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2286             Ian Lance Taylor  <iant@google.com>
2287
2288         PR gold/14309
2289         * configure.ac: Test whether std::tr1::hash<off_t> works.
2290         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2291         needed.
2292         * output.h (class Output_fill): Add virtual destructor.
2293         * configure, config.in: Rebuild.
2294
2295 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2296
2297         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2298
2299 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2300
2301         * plugin.cc (Plugin::load): Handle position independent executables.
2302
2303 2012-06-06  Cary Coutant  <ccoutant@google.com>
2304
2305         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2306         add .debug_macro.
2307         (lines_only_debug_sections): Likewise.
2308         (gdb_fast_lookup_sections): New static array.
2309         (is_gdb_debug_section): Rename formal parameter.
2310         (is_lines_only_debug_section): Likewise.
2311         (is_gdb_fast_lookup_section): New function.
2312         (Layout::include_section): Check for ".zdebug_" prefix; pass
2313         section name suffix to is_gdb_debug_section, et al.; check for
2314         fast-lookup sections when building .gdb_index.
2315         * options.h (--strip-debug-gdb): Update GDB version number.
2316
2317 2012-06-06  Cary Coutant  <ccoutant@google.com>
2318
2319         * configure.ac: Add check for fallocate.
2320         * configure: Regenerate.
2321         * config.in: Regenerate.
2322
2323         * options.h (class General_options): Add --mmap-output-file and
2324         --posix-fallocate options.
2325         * output.cc: (posix_fallocate): Remove; replace with...
2326         (gold_fallocate): New function.
2327         (Output_file::map_no_anonymous): Call gold_fallocate.
2328         (Output_file::map): Check --mmap-output-file option.
2329
2330 2012-06-05  Jing Yu  <jingyu@google.com>
2331
2332         * gold.h (textdomain): Add do {} to empty while(0).
2333         (bindtextdomain): Likewise.
2334
2335 2012-06-04  Cary Coutant  <ccoutant@google.com>
2336
2337         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2338         has_dynsym_index.
2339
2340 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2341
2342         * symtab.cc (Symbol_table::define_special_symbol):
2343         Initialize *poldsym to prevent uninitialized variable errors.
2344
2345 2012-05-23  Cary Coutant  <ccoutant@google.com>
2346
2347         * layout.cc (Layout::section_name_mapping): Add rules to handle
2348         exact match on .data.rel.ro.local or .data.rel.ro.
2349         (Layout::output_section_name): Check for exact matches.
2350
2351 2012-05-23  Cary Coutant  <ccoutant@google.com>
2352
2353         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2354         more carefully.
2355
2356 2012-05-22  Cary Coutant  <ccoutant@google.com>
2357
2358         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2359         object before exporting symbol.
2360
2361 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2362
2363         * testsuite/tls_test.cc: Include "config.h" first.
2364         * testsuite/tls_test_c.c: Likewise.
2365
2366 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2367             Nick Clifton  <nickc@redhat.com>
2368
2369         PR 14072
2370         * configure.in: Add check that sysdep.h has been included before
2371         any system header files.
2372         * configure: Regenerate.
2373         * config.in: Regenerate.
2374
2375 2012-05-14  Cary Coutant  <ccoutant@google.com>
2376
2377         * layout.cc (Layout::make_output_section): Mark .tdata section
2378         as RELRO.
2379         * testsuite/relro_test.cc: Add a TLS variable.
2380
2381 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2382
2383         PR gold/14091
2384         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2385         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2386         R_X86_64_64.
2387
2388 2012-05-08  Cary Coutant  <ccoutant@google.com>
2389
2390         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2391         (lines_only_debug_sections): Likewise.
2392
2393 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2394
2395         * nacl.cc: New file.
2396         * nacl.h: New file.
2397         * Makefile.am (CCFILES, HFILES): Add them.
2398         * Makefile.in: Regenerate.
2399         * i386.cc (Output_data_plt_i386_nacl): New class.
2400         (Output_data_plt_i386_nacl_exec): New class.
2401         (Output_data_plt_i386_nacl_dyn): New class.
2402         (Target_i386_nacl): New class.
2403         (Target_selector_i386_nacl): New class.
2404         (target_selector_i386): Use it instead of Target_selector_i386.
2405         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2406         (Target_x86_64_nacl): New class.
2407         (Target_selector_x86_64_nacl): New class.
2408         (target_selector_x86_64, target_selector_x32): Use it instead of
2409         Target_selector_x86_64.
2410         * arm.cc (Output_data_plt_arm_nacl): New class.
2411         (Target_arm_nacl): New class.
2412         (Target_selector_arm_nacl): New class.
2413         (target_selector_arm, target_selector_armbe): Use it instead of
2414         Target_selector_arm.
2415
2416         * target-select.cc (select_target): Take new Input_file* and off_t
2417         arguments, pass them on to recognize method of selector.
2418         * object.cc (make_elf_sized_object): Update caller.
2419         * parameters.cc (parameters_force_valid_target): Likewise.
2420         * incremental.cc (make_sized_incremental_binary): Likewise.
2421         * target-select.h: Update decl.
2422         (Target_selector::recognize): Take new Input_file* argument,
2423         pass it on to do_recognize.
2424         (Target_selector::do_recognize): Take new Input_file* argument.
2425         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2426         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2427         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2428         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2429
2430         * target.h (Target::Target_info): New members isolate_execinstr
2431         and rosegment_gap.
2432         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2433         * arm.cc (Target_arm::arm_info): Update initializer.
2434         * i386.cc (Target_i386::i386_info): Likewise.
2435         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2436         * sparc.cc (Target_sparc::sparc_info): Likewise.
2437         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2438         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2439         * layout.cc (Layout::attach_allocated_section_to_segment):
2440         Take new const Target* argument.  If target->isolate_execinstr(), act
2441         like --rosegment.
2442         (Layout::find_first_load_seg): Take new const Target* argument;
2443         if target->isolate_execinstr(), reject PF_X segments.
2444         (Layout::relaxation_loop_body): Update caller.
2445         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2446         reset file offset to zero when we hit LOAD_SEG, and then do a second
2447         loop over the segments before LOAD_SEG to reassign offsets after
2448         addresses have been determined.  Handle target->rosegment_gap().
2449         (Layout::attach_section_to_segment): Take new const Target* argument;
2450         pass it to attach_allocated_section_to_segment.
2451         (Layout::make_output_section): Update caller.
2452         (Layout::attach_sections_to_segments): Take new const Target* argument;
2453         pass it to attach_section_to_segment.
2454         * gold.cc (queue_middle_tasks): Update caller.
2455         * layout.h (Layout): Update method decls with new arguments.
2456
2457         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2458         Target_info pointer to use.
2459         (Target_arm::do_make_data_plt): New virtual method.
2460         (Target_arm::make_data_plt): New method that calls it.
2461         (Target_arm::make_plt_entry): Use it.
2462         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2463         for the section alignment.
2464         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2465         method.
2466         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2467         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2468         method.
2469         (Output_data_plt_arm::get_plt_entry_size): Call it.
2470         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2471         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2472         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2473         method.
2474         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2475         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2476         method instead of sizeof(plt_entry).
2477         (Output_data_plt_arm::add_entry): Likewise.
2478         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2479         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2480         than static method.
2481         (Target_arm::plt_entry_size): Likewise.
2482         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2483         Move to ...
2484         (Output_data_plt_arm_standard): ... here, new class.
2485         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2486         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2487         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2488
2489         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2490         Take additional argument for the PLT entry size.
2491         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2492         Use get_plt_entry_size method rather than plt_entry_size variable.
2493         (Output_data_plt_x86_64::reserve_slot): Likewise.
2494         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2495         (Output_data_plt_x86_64::add_entry): Likewise.
2496         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2497         (Output_data_plt_x86_64::address_for_global): Likewise.
2498         (Output_data_plt_x86_64::address_for_local): Likewise.
2499         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2500         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2501         Make method non-static.
2502         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2503         method.
2504         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2505         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2506         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2507         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2508         virtual method.
2509         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2510         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2511         virtual method.
2512         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2513         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2514         virtual method.
2515         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2516         (Output_data_plt_x86_64::plt_entry_size)
2517         (Output_data_plt_x86_64::first_plt_entry)
2518         (Output_data_plt_x86_64::plt_entry)
2519         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2520         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2521         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2522         (Output_data_plt_x86_64_standard): ... here, new class.
2523         (Target_x86_64::Target_x86_64): Take optional argument for the
2524         Target_info pointer to use.
2525         (Target_x86_64::do_make_data_plt): New virtual method.
2526         (Target_x86_64::make_data_plt): New method to call it.
2527         (Target_x86_64::init_got_plt_for_update): Use that.
2528         Call this->plt_->add_eh_frame method here.
2529         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2530         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2531         rather than static method.
2532         (Target_x86_64::plt_entry_size): Likewise.
2533         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2534         rather than plt_entry_size variable.  Move guts of PLT filling to...
2535         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2536         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2537         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2538
2539         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2540         additional argument for the section alignment.
2541         Don't do add_eh_frame_for_plt here.
2542         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2543         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2544         variable.
2545         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2546         method.
2547         (Output_data_plt_i386::get_plt_entry_size): Call it.
2548         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2549         (Output_data_plt_i386::add_eh_frame): New method to call it.
2550         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2551         method.
2552         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2553         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2554         method.
2555         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2556         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2557         method instead of plt_entry_size.
2558         (Output_data_plt_i386::plt_entry_size)
2559         (Output_data_plt_i386::plt_eh_frame_fde_size)
2560         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2561         (Output_data_plt_i386_standard): ... here, new class.
2562         (Output_data_plt_i386_exec): New class.
2563         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2564         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2565         (Output_data_plt_i386::exec_plt_entry): Move to ...
2566         (Output_data_plt_i386_exec::plt_entry): ... here.
2567         (Output_data_plt_i386_dyn): New class.
2568         (Output_data_plt_i386::first_plt_entry): Move to ...
2569         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2570         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2571         (Output_data_plt_i386_dyn::plt_entry): ... here.
2572         (Target_i386::Target_i386): Take optional argument for the Target_info
2573         pointer to use.
2574         (Target_i386::do_make_data_plt): New virtual method.
2575         (Target_i386::make_data_plt): New method to call it.
2576         (Target_i386::make_plt_section): Use that.
2577         Call this->plt_->add_eh_frame method here.
2578         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2579         rather than plt_entry_size variable.
2580         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2581         (Output_data_plt_i386::address_for_local): Likewise.
2582         (Output_data_plt_i386::do_write): Likewise.
2583         Move guts of PLT filling to...
2584         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2585         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2586         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2587         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2588
2589 2012-05-01  Cary Coutant  <ccoutant@google.com>
2590
2591         * dwarf_reader.cc (Dwarf_die::read_attributes)
2592         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2593         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2594         * reduced_debug_output.cc
2595         (Output_reduced_debug_info_section::get_die_end): Remove
2596         DW_FORM_GNU_ref_index.  Add default case.
2597
2598 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2599
2600         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2601         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2602         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2603         DW_AT_high_pc as offset from DW_AT_low_pc.
2604
2605         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2606         * testsuite/Makefile.in: Regenerate.
2607         * testsuite/gdb_index_test_3.c: New test source file.
2608         * testsuite/gdb_index_test_3.sh: New test source file.
2609
2610 2012-04-25  Ian Lance Taylor  <iant@google.com>
2611
2612         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2613         pointer.
2614         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2615         as a class, not a struct.
2616         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2617         (Target_arm::apply_cortex_a8_workaround): Likewise.
2618         * gc.h: Declare Reloc_types as a struct, not a class.
2619         * object.h: Declare Symbols_data as a struct.
2620         * reloc.h: Declare Read_relocs_data as a struct.
2621         * target.h: Declare Relocate_info as a struct.
2622
2623 2012-04-24  David S. Miller  <davem@davemloft.net>
2624
2625         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2626         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2627         and R_SPARC_WPLT30.
2628
2629 2012-04-24  Cary Coutant  <ccoutant@google.com>
2630
2631         * incremental-dump.cc (find_input_containing_global): Replace
2632         magic number with symbolic constant.
2633         (dump_incremental_inputs): Update version number.
2634         * incremental.cc (Output_section_incremental_inputs): Update version
2635         number; import symbolic constants from Incremental_inputs_reader.
2636         (Incremental_inputs::create_data_sections): Align relocations
2637         section correctly for 64-bit targets.
2638         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2639         constants; add padding.
2640         (Output_section_incremental_inputs::write_header): Add assert for
2641         header_size.
2642         (Output_section_incremental_inputs::write_input_files): Add assert
2643         for input_entry_size.
2644         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2645         add assert for object_info_size, input_section_entry_size,
2646         global_sym_entry_size.
2647         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2648         for data structure sizes; use them.
2649         (Incremental_input_entry_reader): Import symbolic constants from
2650         Incremental_inputs_reader; use them.
2651
2652 2012-04-23  David S. Miller  <davem@davemloft.net>
2653
2654         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2655         and elf_flags_set_.
2656         (Target_sparc::Target_sparc): Initialize new fields.
2657         (Target_sparc::do_make_elf_object): New function.
2658         (Target_sparc::do_adjust_elf_header): New function.
2659
2660 2012-04-23  Cary Coutant  <ccoutant@google.com>
2661
2662         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2663         CU range table of gdb index.
2664
2665 2012-04-20  David S. Miller  <davem@davemloft.net>
2666
2667         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2668         instead of false.
2669
2670 2012-04-16  David S. Miller  <davem@davemloft.net>
2671
2672         * sparc.cc (Target_sparc::got_address): New function.
2673         (Sparc_relocate_functions::gdop_hix22): New function.
2674         (Sparc_relocate_functions::gdop_lox10): New function.
2675         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2676         relocs.
2677         (Target_sparc::Scan::local): Likewise if the global symbol is not
2678         preemptible and is not IFUNC.
2679         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2680         transformations for local and non-preemptible non-IFUNC global
2681         symbols.
2682
2683         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2684         writing out 64-bit part of ranges.
2685
2686         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2687         -fpic and -fpie respectively.
2688         * Makefile.in: Regenerate.
2689
2690         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2691         (Target_sparc::Target_sparc): Initialize new field.
2692         (Target_sparc::do_plt_section_for_global): New function.
2693         (Target_sparc::do_plt_section_for_local): New function.
2694         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2695         (Target_sparc::make_plt_section): New function, broken out of
2696         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2697         (Target_sparc::make_plt_entry): Call make_plt_section.
2698         (Target_sparc::make_local_ifunc_plt_entry): New function.
2699         (Target_sparc::rela_ifunc_section): New function.
2700         (Target_sparc::plt_section): Remove const.
2701         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2702         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2703         and ifunc_count_ fields.
2704         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2705         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2706         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2707         (Output_data_plt_sparc::rela_ifunc): New function.
2708         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2709         (Output_data_plt_sparc::has_ifunc_section): New function.
2710         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2711         (Output_data_plt_sparc::address_for_global): New function.
2712         (Output_data_plt_sparc::address_for_local): New function.
2713         (Output_data_plt_sparc::plt_index_to_offset): New function.
2714         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2715         and entry_count.
2716         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2717         entry_count.
2718         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2719         R_SPARC_JMP_IREL to switch.
2720         (Target_sparc::Scan::check_non_pic): Likewise.
2721         (Target_sparc::Scan::local): Handle IFUNC symbols.
2722         (Target_sparc::Scan::local): Likewise.
2723         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2724         and plt_address_for_local.
2725         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2726         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2727
2728         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2729         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2730         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2731         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2732         global relocs too.
2733         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2734         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2735         calls.
2736         * sparc.cc (Target_sparc::Scan::global): Likewise.
2737         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2738
2739 2012-04-16  Cary Coutant  <ccoutant@google.com>
2740
2741         * archive.cc (Library_base::should_include_member): Check for
2742         --export-dynamic-symbol.
2743         * options.h (class General_options): Add --export-dynamic-symbol.
2744         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2745         --export-dynamic-symbol.
2746         (Symbol_table::gc_mark_undef_symbols): Likewise.
2747         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2748
2749 2012-04-12  David S. Miller  <davem@davemloft.net>
2750
2751         * sparc.cc (Reloc::wdisp10): New relocation method.
2752         (Reloc::h34): Likewise.
2753         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2754         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2755         R_SPARC_WDISP10.
2756         (Target_sparc::Scan::local): Likewise.
2757         (Target_sparc::Scan::global): Likewise.
2758         (Target_sparc::Relocate::relocate): Likewise.
2759
2760 2012-04-09  Cary Coutant  <ccoutant@google.com>
2761
2762         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2763         low_pc == 0.
2764
2765 2012-04-06  Ian Lance Taylor  <iant@google.com>
2766
2767         * timer.cc: #include <unistd.h>.
2768
2769 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2770
2771         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2772         * config.in: Regenerate.
2773         * configure: Regenerate.
2774
2775 2012-04-05  Nick Clifton  <nickc@redhat.com>
2776
2777         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2778         (AM_LC_MESSAGES): Add.
2779         * aclocal.m4: Regenerate.
2780         * config.in: Regenerate.
2781         * configure: Regenerate.
2782
2783 2012-03-21  Cary Coutant  <ccoutant@google.com>
2784
2785         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2786         * Makefile.in: Regenerate.
2787         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2788         (Sized_elf_reloc_mapper::symbol_section): New function.
2789         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2790         (make_elf_reloc_mapper): New function.
2791         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2792         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2793         (Dwarf_abbrev_table::do_get_abbrev): New function.
2794         (Dwarf_ranges_table::read_ranges_table): New function.
2795         (Dwarf_ranges_table::read_range_list): New function.
2796         (Dwarf_pubnames_table::read_section): New function.
2797         (Dwarf_pubnames_table::read_header): New function.
2798         (Dwarf_pubnames_table::next_name): New function.
2799         (Dwarf_die::Dwarf_die): New function.
2800         (Dwarf_die::read_attributes): New function.
2801         (Dwarf_die::skip_attributes): New function.
2802         (Dwarf_die::set_name): New function.
2803         (Dwarf_die::set_linkage_name): New function.
2804         (Dwarf_die::attribute): New function.
2805         (Dwarf_die::string_attribute): New function.
2806         (Dwarf_die::int_attribute): New function.
2807         (Dwarf_die::uint_attribute): New function.
2808         (Dwarf_die::ref_attribute): New function.
2809         (Dwarf_die::child_offset): New function.
2810         (Dwarf_die::sibling_offset): New function.
2811         (Dwarf_info_reader::check_buffer): New function.
2812         (Dwarf_info_reader::parse): New function.
2813         (Dwarf_info_reader::do_parse): New function.
2814         (Dwarf_info_reader::do_read_string_table): New function.
2815         (Dwarf_info_reader::lookup_reloc): New function.
2816         (Dwarf_info_reader::get_string): New function.
2817         (Dwarf_info_reader::visit_compilation_unit): New function.
2818         (Dwarf_info_reader::visit_type_unit): New function.
2819         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2820         Sized_elf_reloc_mapper.
2821         (Sized_dwarf_line_info::symbol_section): Remove function.
2822         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2823         (Sized_dwarf_line_info::read_line_mappings): Remove object
2824         parameter, adjust callers.
2825         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2826         * dwarf_reader.h: Include <sys/types.h>.
2827         (class Track_relocs): Remove forward declaration.
2828         (class Elf_reloc_mapper): New class.
2829         (class Sized_elf_reloc_mapper): New class.
2830         (class Dwarf_abbrev_table): New class.
2831         (class Dwarf_range_list): New class.
2832         (class Dwarf_ranges_table): New class.
2833         (class Dwarf_pubnames_table): New class.
2834         (class Dwarf_die): New class.
2835         (class Dwarf_info_reader): New class.
2836         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2837         (Sized_dwarf_line_info::symbol_section): Remove member function.
2838         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2839         base class.
2840         * gdb-index.cc: New source file.
2841         * gdb-index.h: New source file.
2842         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2843         and .debug_types sections, call Layout::add_to_gdb_index.
2844         (Sized_relobj_incr::do_section_name): Implement.
2845         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2846         return type; Implement.
2847         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2848         return type.
2849         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2850         parameter list and return type.
2851         (Sized_incr_dynobj::do_section_contents): Likewise.
2852         * layout.cc: Include gdb-index.h.
2853         (Layout::Layout): Initialize gdb_index_data_.
2854         (Layout::init_fixed_output_section): Check for .gdb_index section.
2855         (Layout::add_to_gdb_index): New function. Instantiate.
2856         * layout.h: Add forward declaration for class Gdb_index.
2857         (Layout::add_to_gdb_index): New member function.
2858         (Layout::gdb_index_data_): New data member.
2859         * main.cc: Include gdb-index.h.
2860         (main): Print statistics for gdb index.
2861         * object.cc (Object::section_contents): Move code into
2862         do_section_contents.
2863         (need_decompressed_section): Check for sections needed when building
2864         gdb index.
2865         (build_compressed_section_map): Likewise.
2866         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2867         gdb index.
2868         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2869         sections; call Layout::add_to_gdb_index.
2870         (Sized_relobj_file::do_decompressed_section_contents): Call
2871         do_section_contents directly.
2872         * object.h (Object::do_section_contents): Adjust parameter list and
2873         return type.
2874         (Object::do_decompressed_section_contents): Call do_section_contents
2875         directly.
2876         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2877         return type.
2878         * options.h (class General_options): Add --gdb-index option.
2879         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2880         list and return type.
2881         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2882         * reloc.h (Track_relocs::checkpoint): New function.
2883         (Track_relocs::reset): New function.
2884
2885         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2886         New test cases.
2887         * testsuite/Makefile.in: Regenerate.
2888         * testsuite/gdb_index_test.cc: New test source file.
2889         * testsuite/gdb_index_test_1.sh: New test source file.
2890         * testsuite/gdb_index_test_2.sh: New test source file.
2891
2892 2012-03-19  Doug Kwan  <dougkwan@google.com>
2893
2894         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2895         (Target_arm::do_finalize_sections): Remove code which defines
2896         __exidx_start and __exidx_end.  Make symbol table parameter
2897         anonymous as it is not used.
2898         * gold.cc (queue_middle_tasks): Call target hook to define any
2899         target-specific symbols.
2900         * target.h (Target::define_standard_symbols): New method.
2901         (Target::do_define_standard_symbols): Same.
2902         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2903         * testsuite/Makefile.in: Regenerate.
2904         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2905         and __exidx_end.
2906         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2907         relocations are generated for __exidx_start and __exidx_end.
2908
2909 2012-03-16  Doug Kwan  <dougkwan@google.com>
2910
2911         * testsuite/Makefile.am: Disable test initpri3b.
2912         * testsuite/Makefile.in: Regenerate.
2913
2914 2012-03-15  Doug Kwan  <dougkwan@google.com>
2915
2916         * arm.cc (Target_arm::got_section): Make .got section read-only
2917         if -z now is given.
2918
2919 2012-03-15  Ian Lance Taylor  <iant@google.com>
2920
2921         PR gold/13850
2922         * layout.cc (Layout::make_output_section): Correctly mark
2923         SHT_INIT_ARRAY, et. al., as relro.
2924
2925 2012-03-14  Doug Kwan  <dougkwan@google.com>
2926
2927         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2928         dynamic relocations for protected symbols in shared objects.
2929
2930 2012-03-13  Ian Lance Taylor  <iant@google.com>
2931
2932         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2933         keep the larger alignment.
2934
2935 2012-03-12  Cary Coutant  <ccoutant@google.com>
2936
2937         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2938         handling of DW_LNE_define_file.
2939
2940 2012-03-12  Cary Coutant  <ccoutant@google.com>
2941
2942         * reduced_debug_output.cc
2943         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2944         codes to switch.
2945
2946 2012-02-29  Cary Coutant  <ccoutant@google.com>
2947
2948         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2949
2950 2012-02-29  Cary Coutant  <ccoutant@google.com>
2951
2952         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2953         Call Object::decompressed_section_contents.
2954         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2955         New dtor.
2956         (Sized_dwarf_line_info::buffer_start_): New data member.
2957         * merge.cc (Output_merge_data::do_add_input_section): Call
2958         Object::decompressed_section_contents.
2959         (Output_merge_string::do_add_input_section): Likewise.
2960         * object.cc (need_decompressed_section): New function.
2961         (build_compressed_section_map): Decompress sections needed later.
2962         (Sized_relobj_file::do_decompressed_section_contents): New function.
2963         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2964         * object.h (Object::decompressed_section_contents): New function.
2965         (Object::discard_decompressed_sections): New function.
2966         (Object::do_decompressed_section_contents): New function.
2967         (Object::do_discard_decompressed_sections): New function.
2968         (Compressed_section_info): New type.
2969         (Compressed_section_map): Include decompressed section contents.
2970         (Sized_relobj_file::do_decompressed_section_contents): New function.
2971         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2972
2973 2012-02-16  Cary Coutant  <ccoutant@google.com>
2974
2975         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2976         * testsuite/Makefile.in: Regenerate.
2977
2978 2012-02-14  Cary Coutant  <ccoutant@google.com>
2979
2980         * options.cc (General_options::finalize): Disallow -pie and -static.
2981
2982 2012-02-03  Doug Kwan  <dougkwan@google.com>
2983
2984         * arm.cc (Arm_relocate_functions::abs8,
2985         Arm_relocate_functions::abs16): Use
2986         Bits::has_signed_unsigned_overflow32.
2987         (Arm_relocate_functions::thm_abs8): Correct range of
2988         overflow check.
2989         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2990         in assertions.
2991
2992 2012-02-02  Doug Kwan  <dougkwan@google.com>
2993
2994         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2995         position independent outputs, not just shared objects.
2996
2997 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2998
2999         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3000         * configure: Regenerated.
3001
3002 2012-01-27  Ian Lance Taylor  <iant@google.com>
3003
3004         * reloc.h (Bits): New class with static functions, copied from
3005         namespace utils in arm.cc.
3006         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3007         instead.
3008
3009 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3010
3011         * incremental.cc (write_info_blocks): Correct relocation offset.
3012
3013 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3014
3015         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3016         (Relocate::tls_gd_to_le): Likewise.
3017
3018 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3019
3020         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3021
3022 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3023
3024         * configure.ac: Check if -mcmodel=medium works.
3025         * configure: Regenerated.
3026
3027 2012-01-24  Cary Coutant  <ccoutant@google.com>
3028
3029         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3030         definition and ...
3031         (read_unsigned_LEB_128_x): ... this new function.
3032         (read_signed_LEB_128): Replaced with inline definition and ...
3033         (read_signed_LEB_128_x): ... this new function.
3034         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3035         (read_unsigned_LEB_128): Add inline definition.
3036         (read_signed_LEB_128_x): New function.
3037         (read_signed_LEB_128): Add inline definition.
3038         * testsuite/Makefile.am (leb128_unittest): New unit test.
3039         * testsuite/Makefile.in: Regenerate.
3040         * testsuite/leb128_unittest.cc: New unit test.
3041
3042 2012-01-23  Ian Lance Taylor  <iant@google.com>
3043
3044         PR gold/13617
3045         * i386.cc (Target_i386::do_code_fill): When using a jmp
3046         instruction, pad with nop instructions.
3047         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3048
3049 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3050
3051         * x86_64.cc (gc_process_relocs): Add typename on types used in
3052         template.
3053         (scan_relocs): Likewise.
3054         (relocate_section): Likewise.
3055         (apply_relocation): Likewise.
3056
3057 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3058
3059         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3060         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3061         under x32.
3062
3063 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3064
3065         * x86_64.cc: Initial support for x32.
3066
3067 2012-01-03  Cary Coutant  <ccoutant@google.com>
3068
3069         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3070         Use abstract base class for GOT.
3071         * gold/output.h (class Output_data_got_base): New abstract base class.
3072         (class Output_data_got): Derive from new base class, adjust ctors.
3073         (Output_data_got::reserve_slot): Make virtual; rename to
3074         do_reserve_slot; Adjust callers.
3075         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3076         pointer to abstract base class.
3077         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3078
3079 2011-12-18  Ian Lance Taylor  <iant@google.com>
3080
3081         * object.h (Relobj::local_symbol_value): New function.
3082         (Relobj::local_plt_offset): New function.
3083         (Relobj::local_has_got_offset): New function.
3084         (Relobj::local_got_offset): New function.
3085         (Relobj::set_local_got_offset): New function.
3086         (Relobj::do_local_symbol_value): New pure virtual function.
3087         (Relobj::do_local_plt_offset): Likewise.
3088         (Relobj::do_local_has_got_offset): Likewise.
3089         (Relobj::do_local_got_offset): Likewise.
3090         (Relobj::do_set_local_got_offset): Likewise.
3091         (Sized_relobj::do_local_has_got_offset): Rename from
3092         local_has_got_offset.
3093         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3094         (Sized_relobj::do_set_local_got_offset): Rename from
3095         set_local_got_offset.
3096         (Sized_relobj_file::do_local_plt_offset): Rename from
3097         local_plt_offset.
3098         (Sized_relobj_file::do_local_symbol_value): New function.
3099         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3100         local_plt_offset.
3101         * output.cc (Output_data_got::Got_entry::write): Change object to
3102         Relobj.  Use local_symbol_value.
3103         (Output_data_got::add_global_with_rel): Change rel_dyn to
3104         Output_data_reloc_generic*.  Use add_global_generic.
3105         (Output_data_got::add_global_with_rela): Remove.  Change all
3106         callers to use add_global_with_rel.
3107         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3108         Output_data_reloc_generic*.  Use add_global_generic.
3109         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3110         callers to use add_global_pair_with_rel.
3111         (Output_data_got::add_local): Change object to Relobj*.
3112         (Output_data_got::add_local_plt): Likewise.
3113         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3114         change rel_dyn to Output_data_reloc_generic*.  Use
3115         add_local_generic.
3116         (Output_data_got::add_local_with_rela): Remove.  Change all
3117         callers to use all_local_with_rel.
3118         (Output_data_got::add_local_pair_with_rel): Change object to
3119         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3120         add_output_section_generic.
3121         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3122         callers to use add_local_pair_with_rel.
3123         (Output_data_got::reserve_local): Change object to Relobj*.
3124         * output.h: (class Output_data_reloc_generic): Add pure virtual
3125         declarations for add_global_generic, add_local_generic,
3126         add_output_section_generic.
3127         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3128         functions for Output_data_reloc_generic.  Update declarations for
3129         changes listed in output.cc.
3130         (class Output_data_got): Change template parameter to got_size.
3131         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3132         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3133         function.
3134         (Sized_relobj_incr::do_local_plt_offset): New function.
3135         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3136         add_global_generic.
3137
3138 2011-12-17  Cary Coutant  <ccoutant@google.com>
3139
3140         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3141         * resolve.cc (Symbol_table::resolve): Likewise.
3142         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3143         arrays.
3144         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3145
3146 2011-12-16  Ian Lance Taylor  <iant@google.com>
3147
3148         * output.h (Output_data_reloc_generic::add): Only call
3149         add_dynamic_reloc if this is a dynamic reloc section.
3150
3151 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3152
3153         PR gold/13505
3154         * target-reloc.h (apply_relocation): Replace <64, false> with
3155         <size, big_endian>.
3156
3157 2011-11-25  Nick Clifton  <nickc@redhat.com>
3158
3159         * po/it.po: New Italian translation.
3160
3161 2011-11-17  Sterling Augustine  <saugustine@google.com>
3162
3163         * script.cc (script_include_directive): Implement.
3164         (read_script_file): New local variables name and search_path. Update
3165         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3166         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3167         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3168
3169 2011-11-11  Sterling Augustine  <saugustine@google.com>
3170
3171         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3172         (file_or_sections_cmd): Likewise.
3173
3174 2011-11-11  Doug Kwan  <dougkwan@google.com>
3175
3176         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3177         if --just-symbols is given.
3178
3179 2011-11-10  Doug Kwan  <dougkwan@google.com>
3180
3181         PR gold/13362
3182         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3183         when processing data relocs.
3184         * reloc.h (Relocate_functions::rel_unaligned): New method.
3185         (Relocate_functions::pcrel_unaligned): Ditto.
3186         (Relocate_functions::rel32_unaligned): Ditto.
3187         (Relocate_functions::pcrel32_unaligned): Ditto.
3188
3189 2011-11-09  Doug Kwan  <dougkwan@google.com>
3190
3191         PR gold/13362
3192         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3193         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3194         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3195         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3196         (Relocate_functions::rel_unaligned): New.
3197         (Relocate_functions::rel32_unaligned): New.
3198         * target-reloc.h (relocate_for_relocatable): Add code to handle
3199         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3200         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3201         arm_unaligned_reloc_r): New targets.
3202         * testsuite/Makefile.in: Regenerate.
3203         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3204         linking.
3205
3206 2011-11-02  Ian Lance Taylor  <iant@google.com>
3207
3208         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3209         NATIVE_LINKER.
3210         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3211         * options.cc (General_options::finalize): Use library search path
3212         from configure script if specified.  If not native and no sysroot,
3213         only search TOOLLIBDIR.
3214         * options.h (Search_directory::Search_directory): Change name to
3215         const std::string&.
3216         (General_options::add_to_library_path_with_sysroot): Change arg to
3217         const std::string&.
3218         * configure, Makefile.in, config.in: Rebuild.
3219
3220 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3221
3222         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3223         we are working around the ARM1176 Erratum.
3224         * options.h (General_options::fix_arm1176): Add option.
3225         * testsuite/Makefile.am: Add testcases, and keep current ones
3226         working.
3227         * testsuite/Makefile.in: Regenerate.
3228         * testsuite/arm_fix_1176.s: New file.
3229         * testsuite/arm_fix_1176.sh: Likewise.
3230
3231 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3232
3233         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3234         may_use_blx_.
3235         (Target_arm::may_use_blx): Remove method.
3236         (Target_arm::set_may_use_blx): Likewise.
3237         (Target_arm::may_use_v4t_interworking): New method.
3238         (Target_arm::may_use_v5t_interworking): Likewise.
3239         (Target_arm::may_use_blx_): Remove member variable.
3240         (Arm_relocate_functions::arm_branch_common): Check for v5T
3241         interworking.
3242         (Arm_relocate_functions::thumb_branch_common): Likewise.
3243         (Reloc_stub::stub_type_for_reloc): Likewise.
3244         (Target_arm::do_finalize_sections): Correct interworking checks.
3245         * testsuite/Makefile.am: Add new tests.
3246         * testsuite/Makefile.in: Regenerate.
3247         * testsuite/arm_farcall_arm_arm.s: New test.
3248         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3249         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3250         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3251         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3252         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3253         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3254         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3255
3256 2011-10-31  Cary Coutant  <ccoutant@google.com>
3257
3258         PR gold/13023
3259         * expression.cc (Expression::eval_with_dot): Add
3260         is_section_dot_assignment parameter.
3261         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3262         absolute and assigning to dot within a section.
3263         * script-sections.cc
3264         (Output_section_element_assignment::set_section_addresses): Pass
3265         dot_section to set_if_absolute.
3266         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3267         as is_section_dot_assignment flag to eval_with_dot.
3268         (Output_section_element_dot_assignment::set_section_addresses):
3269         Likewise.
3270         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3271         parameter.  Also set value if relative to dot_section; set the
3272         symbol's output_section.
3273         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3274         parameter.  Adjust all callers.
3275         (Expression::eval_maybe_dot): Likewise.
3276         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3277         Adjust all callers.
3278         * testsuite/script_test_2.t: Test assignment of an absolute value
3279         to dot within an output section element.
3280
3281 2011-10-31  Cary Coutant  <ccoutant@google.com>
3282
3283         * options.h (class General_options): Add --[no-]gnu-unique options.
3284         * symtab.cc (Symbol_table::sized_write_globals): Convert
3285         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3286
3287 2011-10-31  Cary Coutant  <ccoutant@google.com>
3288
3289         PR gold/13359
3290         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3291         unnecessary assertion.
3292         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3293
3294 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3295
3296         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3297         gc_mark_symbol.
3298         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3299         gc_mark_symbol.
3300         Change to just keep the section associated with symbol.
3301         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3302         they are externally visible and --export-dynamic is turned on.
3303         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3304
3305 2011-10-19  Ian Lance Taylor  <iant@google.com>
3306
3307         PR gold/13163
3308         * script-sections.cc
3309         (Output_section_element_dot_assignment::needs_output_section): New
3310         function.
3311
3312 2011-10-19  Ian Lance Taylor  <iant@google.com>
3313
3314         PR gold/13204
3315         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3316         --section-start option was seen.
3317         * options.h (General_options::any_section_start): New function.
3318
3319 2011-10-18  David S. Miller  <davem@davemloft.net>
3320
3321         PR binutils/13301
3322         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3323         member to track relocation locations that have moved during TLS
3324         reloc optimizations.
3325         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3326         (Target_sparc::Relocate::relocate): Adjust view down by 4
3327         bytes if it matches reloc_adjust_addr_.
3328         (Target_sparc::Relocate::relocate_tls): Always move the
3329         __tls_get_addr call delay slot instruction forward 4 bytes when
3330         performing relaxation.
3331
3332 2011-10-18  Cary Coutant  <ccoutant@google.com>
3333
3334         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3335         (Output_file::map_no_anonymous): Check for non-zero
3336         return code from posix_fallocate.
3337
3338 2011-10-17  Cary Coutant  <ccoutant@google.com>
3339
3340         PR gold/13245
3341         * plugin.cc (is_visible_from_outside): Check for symbols
3342         referenced from dynamic objects.
3343         * resolve.cc (Symbol_table::resolve): Don't count references
3344         from dynamic objects as references from real ELF files.
3345         * testsuite/plugin_test_2.sh: Adjust expected result.
3346
3347 2011-10-17  Cary Coutant  <ccoutant@google.com>
3348
3349         * gold.cc: Include timer.h.
3350         (queue_middle_tasks): Stamp time.
3351         (queue_final_tasks): Likewise.
3352         * main.cc (main): Store timer in parameters.  Print timers
3353         for each pass.
3354         * parameters.cc (Parameters::Parameters): Initialize timer_.
3355         (Parameters::set_timer): New function.
3356         (set_parameters_timer): New function.
3357         * parameters.h (Parameters::set_timer): New function.
3358         (Parameters::timer): New function.
3359         (Parameters::timer_): New data member.
3360         (set_parameters_timer): New function.
3361         * timer.cc (Timer::stamp): New function.
3362         (Timer::get_pass_time): New function.
3363         * timer.h (Timer::stamp): New function.
3364         (Timer::get_pass_time): New function.
3365         (Timer::pass_times_): New data member.
3366
3367 2011-10-17  Cary Coutant  <ccoutant@google.com>
3368
3369         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3370         task for members of lib groups.
3371
3372 2011-10-17  Cary Coutant  <ccoutant@google.com>
3373
3374         PR gold/13288
3375         * fileread.cc (File_read::find_view): Add assert.
3376         (File_read::make_view): Move bounds check (replace with assert)...
3377         (File_read::find_or_make_view): ... to here.
3378
3379 2011-10-12  Cary Coutant  <ccoutant@google.com>
3380
3381         * output.cc (Output_file::open_base_file): Handle case where
3382         ::read returns less than requested size.
3383
3384 2011-10-10  Cary Coutant  <ccoutant@google.com>
3385
3386         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3387         Initialize defined_count_.
3388         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3389         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3390         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3391         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3392         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3393         * incremental.h (Sized_relobj_incr::defined_count_): New data
3394         member.
3395         (Sized_incr_dynobj::defined_count_): New data member.
3396         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3397         Return zeroes instead of internal error.
3398
3399 2011-10-10  Cary Coutant  <ccoutant@google.com>
3400
3401         PR gold/13249
3402         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3403         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3404         * output.h (class Output_reloc): Add use_plt_offset flag.
3405         (Output_reloc::type_): Adjust size of bit field.
3406         (Output_reloc::use_plt_offset_): New bit field.
3407         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3408         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3409         flag.  Adjust all callers.
3410         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3411         creating RELATIVE relocations.
3412
3413 2011-10-10  Nick Clifton  <nickc@redhat.com>
3414
3415         * po/es.po: Updated Spanish translation.
3416         * po/fi.po: Updated Finnish translation.
3417
3418 2011-10-03   Diego Novillo  <dnovillo@google.com>
3419
3420         * options.cc (parse_uint): Fix dereference of RETVAL.
3421
3422 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3423
3424         * layout.h (section_order_map_): New member.
3425         (get_section_order_map): New member function.
3426         * output.cc (Output_section::add_input_section): Check for patterns
3427         only when --section-ordering-file is specified.
3428         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3429         output_sections have been formed.
3430         * layout.cc (Layout_Layout): Initialize section_order_map_.
3431         * plugin.cc (update_section_order): Store order in order_map. Do not
3432         update the order.
3433         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3434         * testsuite/Makefile.in: Regenerate.
3435         * testsuite/plugin_section_order.c: New file.
3436         * testsuite/plugin_final_layout.cc: New file.
3437         * testsuite/plugin_final_layout.sh: New file.
3438
3439 2011-09-29  Cary Coutant  <ccoutant@google.com>
3440
3441         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3442         Check for NULL.
3443         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3444         symbols during incremental update.
3445         (Symbol_table::add_from_dynobj): Likewise.
3446
3447 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3448             Ian Lance Taylor  <iant@google.com>
3449
3450         * symtab.cc (Symbol_table::define_special_symbol): Always
3451         canonicalize version string.
3452
3453 2011-09-26  Cary Coutant  <ccoutant@google.com>
3454
3455         * gold.cc (queue_initial_tasks): Move option checks ...
3456         * options.cc (General_options::finalize): ... to here. Disable
3457         some options; make others fatal.
3458
3459 2011-09-26  Cary Coutant  <ccoutant@google.com>
3460
3461         gcc PR lto/47247
3462         * plugin.cc (get_symbols_v2): New function.
3463         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3464         (is_referenced_from_outside): New function.
3465         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3466         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3467         (get_symbols): Pass version parameter.
3468         (get_symbols_v2): New function.
3469         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3470         parameter.
3471         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3472         (onload): Add LDPT_GET_SYMBOLS_V2.
3473         (all_symbols_read_hook): Use get_symbols_v2; check for
3474         LDPR_PREVAILING_DEF_IRONLY_EXP.
3475         * testsuite/plugin_test_3.sh: Update expected results.
3476
3477 2011-09-23  Simon Baldwin  <simonb@google.com>
3478
3479         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3480         configuration options.
3481         * configure: Regenerate.
3482         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3483         * Makefile.in: Regenerate.
3484         * testsuite/Makefile.in: Regenerate.
3485
3486 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3487
3488         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3489
3490 2011-09-19  Cary Coutant  <ccoutant@google.com>
3491
3492         * incremental.cc (can_incremental_update): Fix typo in comment.
3493         * incremental.h (can_incremental_update): Likewise.
3494
3495 2011-09-18  Cary Coutant  <ccoutant@google.com>
3496
3497         * incremental.cc (can_incremental_update): New function.
3498         * incremental.h (can_incremental_update): New function.
3499         * layout.cc (Layout::init_fixed_output_section): Call it.
3500         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3501         * object.cc (Sized_relobj_file::do_layout): Call
3502         can_incremental_update.
3503
3504 2011-09-13  Cary Coutant  <ccoutant@google.com>
3505
3506         * configure.ac: Check for glibc support for gnu_indirect_function
3507         support with static linking, setting automake conditional
3508         IFUNC_STATIC.
3509         * Makefile.in: Regenerate.
3510         * configure: Regenerate.
3511
3512         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3513         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3514         for IFUNC_STATIC.
3515         * testsuite/Makefile.in: Regenerate.
3516
3517 2011-09-13  Cary Coutant  <ccoutant@google.com>
3518
3519         * incremental.cc (Sized_relobj_incr::do_layout): Call
3520         report_comdat_group for kept comdat sections.
3521         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3522         * testsuite/Makefile.in: Regenerate.
3523         * testsuite/incr_comdat_test_1.cc: New source file.
3524         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3525         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3526         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3527
3528 2011-09-13  Ian Lance Taylor  <iant@google.com>
3529
3530         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3531         variable external_symbols_offset.
3532
3533 2011-09-12  Ian Lance Taylor  <iant@google.com>
3534
3535         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3536         triggered if object has no symbols.
3537
3538 2011-09-09  David S. Miller  <davem@davemloft.net>
3539
3540         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3541         (Output_fill_debug_line::do_write): Likewise.
3542
3543 2011-08-29  Cary Coutant  <ccoutant@google.com>
3544
3545         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3546         casts to match formatting specs.
3547         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3548
3549 2011-08-26  Cary Coutant  <ccoutant@google.com>
3550
3551         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3552         remaining hole size when allocating.
3553         (Layout::make_output_section): Set fill methods for debug sections.
3554         * layout.h (Free_list::Free_list_node): Move from private to
3555         public.
3556         (Free_list::set_min_hole_size): New function.
3557         (Free_list::begin, Free_list::end): New functions.
3558         (Free_list::min_hole_): New data member.
3559         * output.cc: Include dwarf.h.
3560         (Output_fill_debug_info::do_minimum_hole_size): New function.
3561         (Output_fill_debug_info::do_write): New function.
3562         (Output_fill_debug_line::do_minimum_hole_size): New function.
3563         (Output_fill_debug_line::do_write): New function.
3564         (Output_section::Output_section): Initialize new data member.
3565         (Output_section::set_final_data_size): Ensure patch space is larger
3566         than minimum hole size.
3567         (Output_section::do_write): Fill holes in debug sections.
3568         * output.h (Output_fill): New class.
3569         (Output_fill_debug_info): New class.
3570         (Output_fill_debug_line): New class.
3571         (Output_section::set_free_space_fill): New function.
3572         (Output_section::free_space_fill_): New data member.
3573         * testsuite/Makefile.am (incremental_test_3): Add
3574         --incremental-patch option.
3575         (incremental_test_4): Likewise.
3576         (incremental_test_5): Likewise.
3577         (incremental_test_6): Likewise.
3578         (incremental_copy_test): Likewise.
3579         (incremental_common_test_1): Likewise.
3580         * testsuite/Makefile.in: Regenerate.
3581
3582 2011-08-26  Nick Clifton  <nickc@redhat.com>
3583
3584         * po/es.po: Updated Spanish translation.
3585
3586 2011-08-01  Cary Coutant  <ccoutant@google.com>
3587
3588         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3589         * gold/testsuite/Makefile.in: Regenerate.
3590         * gold/testsuite/justsyms_exec.c: New source file.
3591         * gold/testsuite/justsyms_lib.c: New source file.
3592
3593 2011-08-01  Cary Coutant  <ccoutant@google.com>
3594
3595         * layout.cc (Layout::set_segment_offsets): Don't realign text
3596         segment if -Ttext was specified.
3597         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3598         file type.
3599         * object.h (Sized_relobj_file::e_type): New function.
3600         (Sized_relobj_file::e_type_): New data member.
3601         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3602         base address for ET_EXEC files.
3603         * target.cc (Target::do_make_elf_object_implementation): Allow
3604         ET_EXEC files with --just-symbols option.
3605
3606 2011-07-28  Cary Coutant  <ccoutant@google.com>
3607
3608         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3609         Add thread_number parameter.
3610         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3611         * workqueue-threads.cc
3612         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3613         current thread if its thread number is greater than desired thread
3614         count.
3615         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3616         Add thread_number parameter.
3617         (Workqueue::should_cancel_thread): Likewise.
3618         (Workqueue::find_runnable_or_wait): Pass thread_number to
3619         should_cancel_thread.
3620         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3621         parameter.
3622
3623 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3624
3625         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3626         only after checking if it cannot be forced local.
3627         * symtab.h (is_externally_visible): Check if the symbol is not forced
3628         local.
3629
3630 2011-07-15  Ian Lance Taylor  <iant@google.com>
3631
3632         * options.h (class General_options): Add --print-output-format.
3633         Move -EL next to -EB, for  better --help output.
3634         * target-select.cc: Include <cstdio>, "options.h", and
3635         "parameters.h".
3636         (Target_selector::do_target_bfd_name): New function.
3637         (print_output_format): New function.
3638         * target-select.h (class Target_selector): Update declarations.
3639         (Target_selector::target_bfd_name): New function.
3640         (print_output_format): Declare.
3641         * main.cc: Include "target-select.h".
3642         (main): Handle --print-output-format.
3643         * gold.cc: Include "target-select.h".
3644         (queue_initial_tasks): Handle --print-output-format when there are
3645         no input files.
3646         * parameters.cc (parameters_force_valid_target): Give a better
3647         error message if -EB/-EL does not match target.
3648         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3649         function.
3650
3651 2011-07-15  Ian Lance Taylor  <iant@google.com>
3652
3653         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3654         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3655         (Output_data_plt_i386::do_write): Write address of .dynamic
3656         section to first entry in .got.plt section.
3657         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3658         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3659         Initialize layout_.
3660         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3661         section to first entry in .got.plt section.
3662         * layout.h (Layout::dynamic_section): New function.
3663
3664 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3665
3666         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3667         to claim_file call.
3668         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3669         input_section_position_, and input_section_glob_.
3670         (read_layout_from_file): Call function section_ordering_specified.
3671         * layout.h (is_section_ordering_specified): New function.
3672         (section_ordering_specified): New function.
3673         (section_ordering_specified_): New boolean member.
3674         * main.cc(main): Call load_plugins after layout object is defined.
3675         * output.cc (Output_section::add_input_section): Use
3676         function section_ordering_specified to check if section ordering is
3677         needed.
3678         * output.cc (Output_section::add_relaxed_input_section): Use
3679         function section_ordering_specified to check if section ordering is
3680         needed.
3681         (Output_section::update_section_layout): New function.
3682         (Output_section::sort_attached_input_sections): Check if input section
3683         must be reordered.
3684         * output.h (Output_section::update_section_layout): New function.
3685         * plugin.cc (get_section_count): New function.
3686         (get_section_type): New function.
3687         (get_section_name): New function.
3688         (get_section_contents): New function.
3689         (update_section_order): New function.
3690         (allow_section_ordering): New function.
3691         (Plugin::load): Add the new interfaces to the transfer vector.
3692         (Plugin_manager::load_plugins): New parameter.
3693         (Plugin_manager::all_symbols_read): New parameter.
3694         (Plugin_manager::claim_file): New parameter. Save the elf object for
3695         unclaimed objects.
3696         (Plugin_manager::get_elf_object): New function.
3697         (Plugin_manager::get_view): Change to directly use the bool to check
3698         if get_view is called from claim_file_hook.
3699         * plugin.h (input_objects): New function
3700         (Plugin__manager::load_plugins): New parameter.
3701         (Plugin_manager::claim_file): New parameter.
3702         (Plugin_manager::get_elf_object): New function.
3703         (Plugin_manager::in_claim_file_handler): New function.
3704         (Plugin_manager::in_claim_file_handler_): New member.
3705         (layout): New function.
3706         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3707         handler with an extra parameter. Make the elf object before calling
3708         claim_file handler.
3709         * testsuite/plugin_test.c (get_section_count): New function pointer.
3710         (get_section_type): New function pointer.
3711         (get_section_name): New function pointer.
3712         (get_section_contents): New function pointer.
3713         (update_section_order): New function pointer.
3714         (allow_section_ordering): New function pointer.
3715         (onload): Check if the new interfaces exist.
3716
3717 2011-07-13  Ian Lance Taylor  <iant@google.com>
3718
3719         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3720         relro section.
3721         * x86_64.cc (Target_x86_64::got_section): Likewise.
3722         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3723         (relro_now_test_SOURCES): New variable.
3724         (relro_now_test_DEPENDENCIES): New variable.
3725         (relro_now_test_LDFLAGS): New variable.
3726         (relro_now_test_LDADD): New variable.
3727         (relro_now_test.so): New target.
3728         * testsuite/Makefile.in: Rebuild.
3729
3730 2011-07-12  Ian Lance Taylor  <iant@google.com>
3731
3732         PR gold/12980
3733         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3734         GLOB_DAT relocation rather than a RELATIVE relocation for a
3735         protected symbol when creating a shared library.
3736         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3737         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3738         * testsuite/protected_main_1.cc (main): Test that protected
3739         function has same address.
3740
3741 2011-07-11  Ian Lance Taylor  <iant@google.com>
3742
3743         PR gold/12979
3744         * options.h (class General_options): Add -Bgroup.
3745         * options.cc (General_options::finalize): If -Bgroup is set,
3746         default to --unresolved-symbols=report-all.
3747         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3748         * target-reloc.h (issue_undefined_symbol_error): Handle
3749         --unresolved-symbols=report-all.
3750
3751 2011-07-08  Ian Lance Taylor  <iant@google.com>
3752
3753         PR gold/11985
3754         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3755         if linker script discards key sections.
3756         (Layout::create_dynamic_symtab): Likewise.
3757         (Layout::assign_local_dynsym_offsets): Likewise.
3758         (Layout::sized_create_version_sections): Likewise.
3759         (Layout::create_interp): Likewise.
3760         (Layout::finish_dynamic_section): Likewise.
3761         (Layout::set_dynamic_symbol_size): Likewise.
3762
3763 2011-07-08  Ian Lance Taylor  <iant@google.com>
3764
3765         PR gold/12386
3766         * options.h (class General_options): Add --unresolved-symbols.
3767         * target-reloc.h (issue_undefined_symbol_error): Check
3768         --unresolved-symbols.  Add comments.
3769
3770 2011-07-08  Ian Lance Taylor  <iant@google.com>
3771
3772         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3773         expression more complex.
3774
3775 2011-07-08  Ian Lance Taylor  <iant@google.com>
3776
3777         PR gold/11317
3778         * target-reloc.h (issue_undefined_symbol_error): New inline
3779         function, broken out of relocate_section.
3780         (relocate_section): Call issue_undefined_symbol_error.
3781         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3782         there is no TLS segment if we are about to issue an undefined
3783         symbol error.
3784         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3785
3786 2011-07-08  Ian Lance Taylor  <iant@google.com>
3787
3788         PR gold/12279
3789         * resolve.cc (Symbol_table::should_override): Add fromtype
3790         parameter.  Change all callers.  Give error when linking together
3791         TLS and non-TLS symbol.
3792         (Symbol_table::should_override_with_special): Add fromtype
3793         parameter.  Change all callers.
3794         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3795         there is no TLS segment if we have reported some errors.
3796         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3797
3798 2011-07-08  Ian Lance Taylor  <iant@google.com>
3799
3800         PR gold/12372
3801         * target.h (Target::plt_address_for_global): New function.
3802         (Target::plt_address_for_local): New function.
3803         (Target::plt_section_for_global): Remove.
3804         (Target::plt_section_for_local): Remove.
3805         (Target::do_plt_address_for_global): New virtual function.
3806         (Target::do_plt_address_for_local): New virtual function.
3807         (Target::do_plt_section_for_global): Remove.
3808         (Target::do_plt_section_for_local): Remove.
3809         (Target::register_global_plt_entry): Add Symbol_table and Layout
3810         parameters.
3811         * output.cc (Output_data_got::Got_entry::write): Use
3812         plt_address_for_global and plt_address_for_local.
3813         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3814         address of output section.
3815         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3816         got_irelative_, and irelative_count_ fields.  Update
3817         declarations.
3818         (Output_data_plt_i386::has_irelative_section): New function.
3819         (Output_data_plt_i386::entry_count): Add irelative_count_.
3820         (Output_data_plt_i386::set_final_data_size): Likewise.
3821         (class Target_i386): Add got_irelative_ and rel_irelative_
3822         fields.  Update declarations.
3823         (Target_i386::Target_i386): Initialize new fields.
3824         (Target_i386::do_plt_address_for_global): New function replacing
3825         do_plt_section_for_global.
3826         (Target_i386::do_plt_address_for_local): New function replacing
3827         do_plt_section_for_local.
3828         (Target_i386::got_section): Create got_irelative_.
3829         (Target_i386::rel_irelative_section): New function.
3830         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3831         fields.  Don't define __rel_iplt_{start,end}.
3832         (Output_data_plt_i386::add_entry): Add symtab and layout
3833         parameters.  Change all callers.  Use different PLT and GOT for
3834         IFUNC symbols.
3835         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3836         layout parameters.  Change all callers.  Use different PLT and
3837         GOT.
3838         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3839         (Output_data_plt_i386::rel_irelative): New function.
3840         (Output_data_plt_i386::address_for_global): New function.
3841         (Output_data_plt_i386::address_for_local): New function.
3842         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3843         IRELATIVE GOT when changing IFUNC GOT entries.
3844         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3845         reloc.
3846         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3847         if we didn't create an IRELATIVE GOT.
3848         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3849         plt_address_for_local.
3850         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3851         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3852         got_irelative_, and irelative_count_ fields.  Update
3853         declarations.
3854         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3855         Initialize new fields.  Remove symtab parameter.  Change all
3856         callers.
3857         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3858         irelative_count_.
3859         (Output_data_plt_x86_64::has_irelative_section): New function.
3860         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3861         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3862         fields.  Update declarations.
3863         (Target_x86_64::Target_x86_64): Initialize new fields.
3864         (Target_x86_64::do_plt_address_for_global): New function replacing
3865         do_plt_section_for_global.
3866         (Target_x86_64::do_plt_address_for_local): New function replacing
3867         do_plt_section_for_local.
3868         (Target_x86_64::got_section): Create got_irelative_.
3869         (Target_x86_64::rela_irelative_section): New function.
3870         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3871         all callers.  Don't create __rel_iplt_{start,end}.
3872         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3873         parameters.  Change all callers.  Use different PLT and GOT for
3874         IFUNC symbols.
3875         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3876         layout parameters.  Change all callers.  Use different PLT and
3877         GOT.
3878         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3879         parameters.  Change all callers.  Use different PLT and GOT for
3880         IFUNC symbols.
3881         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3882         (Output_data_plt_x86_64::rela_irelative): New function.
3883         (Output_data_plt_x86_64::address_for_global): New function.
3884         (Output_data_plt_x86_64::address_for_local): New function.
3885         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3886         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3887         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3888         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3889         parameters.
3890         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3891         reloc.
3892         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3893         symbols if we didn't create an IRELATIVE GOT.
3894         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3895         plt_address_for_local.
3896         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3897         * testsuite/ifuncvar1.c: New test file.
3898         * testsuite/ifuncvar2.c: New test file.
3899         * testsuite/ifuncvar3.c: New test file.
3900         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3901         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3902         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3903         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3904         * testsuite/Makefile.in: Rebuild.
3905
3906 2011-07-07  Cary Coutant  <ccoutant@google.com>
3907
3908         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3909         (two_file_test_1_ndebug.o): Likewise.
3910         (two_file_test_1b_ndebug.o): Likewise.
3911         (two_file_test_2_ndebug.o): Likewise.
3912         (two_file_test_main_ndebug.o): Likewise.
3913         (incremental_test_2): Link with no-debug versions.
3914
3915 2011-07-06  Cary Coutant  <ccoutant@google.com>
3916
3917         * gold/incremental.cc
3918         (Output_section_incremental_inputs::write_info_blocks): Check for
3919         hidden and internal symbols.
3920
3921 2011-07-06  Cary Coutant  <ccoutant@google.com>
3922
3923         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3924         Check disposition for startup file.
3925         (Incremental_inputs::report_command_line): Ignore
3926         --incremental-startup-unchanged option.
3927         * options.cc (General_options::parse_incremental_startup_unchanged):
3928         New function.
3929         (General_options::General_options): Initialize new data member.
3930         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3931         (General_options): Add --incremental-startup-unchanged option.
3932         (General_options::incremental_startup_disposition): New function.
3933         (General_options::incremental_startup_disposition_): New data member.
3934
3935 2011-07-06  Cary Coutant  <ccoutant@google.com>
3936
3937         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3938         input file index to Script_info ctor.
3939         (Sized_incremental_binary::do_file_has_changed): Find the
3940         command-line argument for files named in scripts.
3941         * incremental.h (Script_info::Script_info): New ctor
3942         with input file index.
3943         (Script_info::input_file_index): New function.
3944         (Script_info::input_file_index_): New data member.
3945         (Incremental_binary::get_library): Add const.
3946         (Incremental_binary::get_script_info): Add const.
3947         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3948         * testsuite/Makefile.am (incremental_test_5): New test case.
3949         (incremental_test_6): New test case.
3950         * testsuite/Makefile.in: Regenerate.
3951
3952 2011-07-06  Cary Coutant  <ccoutant@google.com>
3953
3954         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3955         debug output when command lines differ.
3956
3957 2011-07-06  Cary Coutant  <ccoutant@google.com>
3958
3959         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3960         --incremental-patch option.
3961         * layout.cc (Free_list::allocate): Extend allocation beyond original
3962         end if enabled.
3963         (Layout::make_output_section): Mark sections that should get
3964         patch space.
3965         * options.cc (parse_percent): New function.
3966         * options.h (parse_percent): New function.
3967         (DEFINE_percent): New macro.
3968         (General_options): Add --incremental-patch option.
3969         * output.cc (Output_section::Output_section): Initialize new data
3970         members.
3971         (Output_section::add_input_section): Print section name when out
3972         of patch space.
3973         (Output_section::add_output_section_data): Likewise.
3974         (Output_section::set_final_data_size): Add patch space when
3975         doing --incremental-full.
3976         (Output_section::do_reset_address_and_file_offset): Remove patch
3977         space.
3978         (Output_segment::set_section_list_addresses): Print debug output
3979         only if --incremental-update.
3980         * output.h (Output_section::set_is_patch_space_allowed): New function.
3981         (Output_section::is_patch_space_allowed_): New data member.
3982         (Output_section::patch_space_): New data member.
3983         * parameters.cc (Parameters::incremental_full): New function.
3984         * parameters.h (Parameters::incremental_full): New function
3985         * testsuite/Makefile.am (incremental_test_2): Add test for
3986         --incremental-patch option.
3987         * testsuite/Makefile.in: Regenerate.
3988         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3989         (t18): Remove function body.
3990
3991 2011-07-05  Doug Kwan  <dougkwan@google.com>
3992
3993         PR gold/12771
3994         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3995         Arm_Address type for relocation result.
3996         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3997         overflow check.
3998         (Arm_relocate_functions::abs32): Use unaligned access.
3999         (Arm_relocate_functions::rel32): Ditto.
4000         (Arm_relocate_functions::prel31): Ditto.
4001         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4002         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4003         static data relocations.
4004         * testsuite/Makefile.in: Regnerate.
4005         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4006
4007 2011-07-05  Ian Lance Taylor  <iant@google.com>
4008
4009         PR gold/12392
4010         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4011         symbols if necessary.
4012         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4013
4014 2011-07-05  Ian Lance Taylor  <iant@google.com>
4015
4016         PR gold/12952
4017         * resolve.cc (Symbol::override_base_with_special): Simply override
4018         version with special symbol version, ignoring previous version.
4019
4020 2011-07-05  Ian Lance Taylor  <iant@google.com>
4021
4022         * object.cc (Sized_relobj_file::include_section_group): Add
4023         information to comment about signature location.
4024
4025 2011-07-02  Ian Lance Taylor  <iant@google.com>
4026
4027         PR gold/12957
4028         * options.h (class General_options): Add -f and -F.
4029         * options.cc (General_options::finalize): Fatal error if -f/-F
4030         are used without -shared.
4031         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4032
4033 2011-07-02  Ian Lance Taylor  <iant@google.com>
4034
4035         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4036
4037 2011-07-01  Ian Lance Taylor  <iant@google.com>
4038
4039         PR gold/12525
4040         PR gold/12952
4041         * resolve.cc (Symbol::override_base_with_special): Don't override
4042         the version if the overriding symbol has a different name.
4043         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4044         all callers.  If we give an error about an undefined version,
4045         define the base version if necessary.
4046         * dynobj.h (class Versions): Update declaration.
4047         * testsuite/weak_alias_test_5.cc: New file.
4048         * testsuite/weak_alias_test.script: New file.
4049         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4050         and versioned_alias have the right value, and call t2.
4051         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4052         weak_alias_test_5.so.
4053         (weak_alias_test_LDADD): Likewise.
4054         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4055         * testsuite/Makefile.in: Rebuild.
4056
4057 2011-07-01  Ian Lance Taylor  <iant@google.com>
4058
4059         PR gold/12525
4060         * options.h (class General_options): Support -z notext.
4061         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4062         -Wl,-z,notext.
4063         (two_file_shared_nonpic.so): Likewise.
4064         (two_file_shared_mixed.so): Likewise.
4065         (two_file_shared_mixed_1.so): Likewise.
4066         (weak_undef_lib_nonpic.so): Likewise.
4067         (alt/weak_undef_lib_nonpic.so): Likewise.
4068         (tls_test_shared_nonpic.so): Likewise.
4069         * testsuite/Makefile.in: Rebuild.
4070
4071 2011-07-01  Ian Lance Taylor  <iant@google.com>
4072
4073         PR gold/12525
4074         * configure.ac: Test whether static linking works, setting
4075         the automake conditional HAVE_STATIC.
4076         * testsuite/Makefile.am: Disable tests using -static if
4077         HAVE_STATIC is not true.
4078         * configure, testsuite/Makefile.in: Rebuild.
4079
4080 2011-07-01  Ian Lance Taylor  <iant@google.com>
4081
4082         PR gold/12525
4083         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4084         Assert if we see DW_EH_PE_indirect.
4085         * target.h (Target::ehframe_datarel_base): New function.
4086         (Target::do_ehframe_datarel_base): New target function.
4087         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4088         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4089         function.
4090
4091 2011-07-01  Ian Lance Taylor  <iant@google.com>
4092
4093         PR gold/12571
4094         * options.h (class General_options): Add
4095         --ld-generated-unwind-info.
4096         * ehframe.cc (Fde::write): Add address parameter.  Change all
4097         callers.  If associated with PLT, fill in address and size.
4098         (Cie::set_output_offset): Only add merge mapping if there is an
4099         object.
4100         (Cie::write): Add address parameter.  Change all callers.
4101         (Eh_frame::add_ehframe_for_plt): New function.
4102         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4103         input_offset_ fields into union u_, with new plt field.
4104         (Fde::Fde): Adjust for new union field.
4105         (Fde::Fde) [Output_data version]: New constructor.
4106         (Fde::add_mapping): Only add merge mapping if there is an object.
4107         (class Cie): Update declarations.
4108         (class Eh_frame): Declare add_ehframe_for_plt.
4109         * layout.cc (Layout::layout_eh_frame): Break out code into
4110         make_eh_frame_section, and call it.
4111         (Layout::make_eh_frame_section): New function.
4112         (Layout::add_eh_frame_for_plt): New function.
4113         * layout.h (class Layout): Update declarations.
4114         * merge.cc (Merge_map::add_mapping): Add assertion.
4115         * i386.cc: Include "dwarf.h".
4116         (class Output_data_plt_i386): Make first_plt_entry,
4117         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4118         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4119         and plt_eh_frame_fde.
4120         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4121         boundary.  Call add_eh_frame_for_plt if appropriate.
4122         * x86_64.cc: Include "dwarf.h".
4123         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4124         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4125         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4126         and plt_eh_frame_fde.
4127         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4128         appropriate.
4129
4130 2011-06-29  Ian Lance Taylor  <iant@google.com>
4131
4132         PR gold/12629
4133         * object.cc (Sized_relobj_file::layout_section): Change shdr
4134         parameter to be const.
4135         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4136         out of do_layout.
4137         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4138         appropriate.  Call layout_eh_frame_section.
4139         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4140         sections.
4141         * object.h (class Sized_relobj_file): Update declarations.
4142
4143 2011-06-29  Ian Lance Taylor  <iant@google.com>
4144
4145         PR gold/12652
4146         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4147         modifier.
4148         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4149
4150 2011-06-29  Ian Lance Taylor  <iant@google.com>
4151
4152         PR gold/12675
4153         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4154         SHT_X86_64_UNWIND.
4155         * layout.cc (Layout::layout_eh_frame): Likewise.
4156
4157 2011-06-29  Ian Lance Taylor  <iant@google.com>
4158
4159         PR gold/12695
4160         * layout.cc (Layout::symtab_section_shndx): New function.
4161         * layout.h (class Layout): Declare symtab_section_shndx.
4162         * output.cc (Output_section::write_header): Call it.
4163
4164 2011-06-29  Ian Lance Taylor  <iant@google.com>
4165
4166         PR gold/12818
4167         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4168         symbols which are not used in a relocation.
4169
4170 2011-06-28  Ian Lance Taylor  <iant@google.com>
4171
4172         PR gold/12898
4173         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4174         script create indistinguishable segments.
4175         (Layout::set_segment_offsets): Use stable_sort when sorting
4176         segments.  Pass this to Compare_segments constructor.
4177         * layout.h (class Layout): Make segment_precedes non-static.
4178         (class Compare_segments): Change from struct to class.  Add
4179         layout_ field.  Add constructor.
4180         * script-sections.cc
4181         (Script_sections::attach_sections_using_phdrs_clause): Rename
4182         local orphan to is_orphan.  Don't report failure to put empty
4183         section in segment.  On attachment failure, report name of
4184         section, and attach to first PT_LOAD segment.
4185
4186 2011-06-28  Ian Lance Taylor  <iant@google.com>
4187
4188         PR gold/12934
4189         * target-select.cc (Target_selector::Target_selector): Add
4190         emulation parameter.  Change all callers.
4191         (select_target_by_bfd_name): Rename from select_target_by_name.
4192         Change all callers.
4193         (select_target_by_emulation): New function.
4194         (supported_emulation_names): New function.
4195         * target-select.h (class Target_selector): Add emulation_ field.
4196         Update declarations.
4197         (Target_selector::recognize_by_bfd_name): Rename from
4198         recognize_by_name.  Change all callers.
4199         (Target_selector::supported_bfd_names): Rename from
4200         supported_names.  Change all callers.
4201         (Target_selector::recognize_by_emulation): New function.
4202         (Target_selector::supported_emulations): New function.
4203         (Target_selector::emulation): New function.
4204         (Target_selector::do_recognize_by_bfd_name): Rename from
4205         do_recognize_by_name.  Change all callers.
4206         (Target_selector::do_supported_bfd_names): Rename from
4207         do_supported_names.  Change all callers.
4208         (Target_selector::do_recognize_by_emulation): New function.
4209         (Target_selector::do_supported_emulations): New function.
4210         (select_target_by_bfd_name): Change name in declaration.
4211         (select_target_by_emulation): Declare.
4212         (supported_emulation_names): Declare.
4213         * parameters.cc (parameters_force_valid_target): Try to find
4214         target based on emulation from -m option.
4215         * options.h (class General_options): Change doc string for -m.
4216         * options.cc (help): Print emulations.
4217         (General_options::parse_V): Likewise.
4218         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4219         Add emulation parameter.  Change all callers.
4220
4221 2011-06-28  Ian Lance Taylor  <iant@google.com>
4222
4223         * target.h (class Target): Add osabi_ field.
4224         (Target::osabi): New function.
4225         (Target::set_osabi): New function.
4226         (Target::Target): Initialize osabi_.
4227         (Target::do_adjust_elf_header): Make pure virtual.
4228         (Sized_target::do_adjust_elf_header): Declare.
4229         * target.cc (Sized_target::do_adjust_elf_header): New function.
4230         (class Sized_target): Instantiate all versions.
4231         * freebsd.h (class Target_freebsd): Remove.
4232         (Target_selector_freebsd::do_recognize): Call set_osabi on
4233         Target.
4234         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4235         (Target_selector_freebsd::set_osabi): Remove.
4236         * i386.cc (class Target_i386): Inherit from Sized_target rather
4237         than Target_freebsd.
4238         * x86_64.cc (class Target_x86_64): Likewise.
4239
4240 2011-06-28  Ian Lance Taylor  <iant@google.com>
4241
4242         * target.h (Target::can_check_for_function_pointers): Rewrite.
4243         Make non-virtual.
4244         (Target::can_icf_inline_merge_sections): Likewise.
4245         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4246         (Target::Target_info): Add can_icf_inline_merge_sections field.
4247         (Target::do_can_check_for_function_pointers): New virtual
4248         function.
4249         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4250         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4251         from can_check_for_function_pointers, move in file.
4252         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4253         section_may_have_icf_unsafe_poineters, move in file.
4254         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4255         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4256         Rename from can_check_for_function_pointers, move in file.
4257         (Target_i386::can_icf_inline_merge_sections): Remove.
4258         (Target_i386::i386_info): Initialize
4259         can_icf_inline_merge_sections.
4260         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4261         Initialize can_icf_inline_merge_sections.
4262         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4263         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4264         Rename from can_check_for_function_pointers, move in file.
4265         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4266         (Target_x86_64::x86_64_info): Initialize
4267         can_icf_inline_merge_sections.
4268         * testsuite/testfile.cc (Target_test::test_target_info):
4269         Likewise.
4270         * icf.cc (get_section_contents): Correct formatting.
4271
4272 2011-06-27  Ian Lance Taylor  <iant@google.com>
4273
4274         * symtab.cc (Symbol::versioned_name): New function.
4275         (Symbol_table::add_to_final_symtab): Use versioned_name when
4276         appropriate.
4277         (Symbol_table::sized_write_symbol): Likewise.
4278         * symtab.h (class Symbol): Declare versioned_name.
4279         * stringpool.h (class Stringpool_template): Add variant of add
4280         which takes a std::basic_string.
4281         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4282         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4283         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4284         (ver_test_12.o): New target.
4285         * testsuite/Makefile.in: Rebuild.
4286
4287 2011-06-27  Doug Kwan  <dougkwan@google.com>
4288
4289         * arm.cc (Arm_relocate_functions::thm_jump8,
4290         Arm_relocate_functions::thm_jump11): Use a wider signed
4291         type to compute offset.
4292         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4293         arm_thm_jump8.
4294         * testsuite/Makefile.in: Regenerate.
4295         * testsuite/arm_branch_in_range.sh: Check test results of
4296         arm_thm_jump11 and arm_thm_jump8.
4297         * testsuite/arm_thm_jump11.s: New test source file.
4298         * testsuite/arm_thm_jump11.t: New linker script.
4299         * testsuite/arm_thm_jump8.s: New test source file.
4300         * testsuite/arm_thm_jump8.t: New linker script.
4301
4302 2011-06-24  Ian Lance Taylor  <iant@google.com>
4303
4304         * layout.cc: Include "object.h".
4305         (ctors_sections_in_init_array): New static variable.
4306         (Layout::is_ctors_in_init_array): New function.
4307         (Layout::layout): Add entry to ctors_sections_in_init_array if
4308         appropriate.
4309         * layout.h (class Layout): Declare is_ctors_in_init_array.
4310         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4311         is_ctors_reverse_view is set.
4312         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4313         all callers.  Set is_ctors_reverse_view field of View_size.
4314         (Sized_relobj_file::reverse_words): New function.
4315         * object.h (Sized_relobj_file::View_size): Add
4316         is_ctors_reverse_view field.
4317         (class Sized_relobj_file): Update declarations.
4318         * testsuite/initpri3.c: New test.
4319         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4320         initpri3b.
4321         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4322         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4323         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4324         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4325         * testsuite/Makefile.in: Rebuild.
4326
4327 2011-06-24  Cary Coutant  <ccoutant@google.com>
4328
4329         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4330         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4331         (debug_msg_cdebug.err): New targets.
4332         * testsuite/Makefile.in: Regenerate.
4333         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4334         Fix checks for link with shared library.
4335
4336 2011-06-24  Doug Kwan  <dougkwan@google.com>
4337
4338         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4339         skip empty text sections.
4340         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4341
4342 2011-06-22  Ian Lance Taylor  <iant@google.com>
4343
4344         PR gold/12910
4345         * options.h (class General_options): Add --ctors-in-init-array.
4346         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4347         friends as SHT_PROGBITS for merging sections.
4348         (Layout::layout): Remove special handling of .init_array and
4349         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4350         and .dtors if ctors_in_init_array.
4351         (Layout::make_output_section): Force correct section types for
4352         .init_array and friends.  Don't sort if doing relocatable link,
4353         Don't sort .ctors and .dtors if ctors_in_init_array.
4354         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4355         (Layout::output_section_name): Add relobj parameter.  Change all
4356         callers.  Handle .ctors. and .dtors. in code rather than table.
4357         Handle .ctors and .dtors if ctors_in_init_array.
4358         (Layout::match_file_name): New function, moved from output.cc.
4359         * layout.h (class Layout): Update declarations.
4360         * output.cc: Include "layout.h".
4361         (Input_section_sort_entry::get_priority): New function.
4362         (Input_section_sort_entry::match_file_name): Just call
4363         Layout::match_file_name.
4364         (Output_section::Input_section_sort_init_fini_compare::operator()):
4365         Handle .ctors and .dtors.  Sort by explicit priority rather than
4366         by name.
4367         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4368         * testsuite/initpri2.c: New test.
4369         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4370         (check_PROGRAMS): Add initpri2.
4371         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4372         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4373         * configure, testsuite/Makefile.in: Rebuild.
4374
4375 2011-06-19  Ian Lance Taylor  <iant@google.com>
4376
4377         PR gold/12880
4378         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4379         .interp section to a PT_INTERP segment even if we have seen a
4380         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4381         clause in a linker script.
4382         (Layout::finalize): Don't create a .interp section if we've
4383         already create a PT_INTERP segment.
4384         (Layout::create_interp): Always call choose_output_section (revert
4385         patch of 2011-06-17).  Don't create PT_INTERP segment.
4386         * script-sections.cc
4387         (Script_sections::create_note_and_tls_segments): Add a .interp
4388         section to a PT_INTERP segment even if we have seen a
4389         --dynamic-linker option.
4390
4391 2011-06-18  Ian Lance Taylor  <iant@google.com>
4392
4393         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4394         merely because a non-PT_LOAD segment has a dynamic reloc.
4395
4396 2011-06-18  Ian Lance Taylor  <iant@google.com>
4397
4398         * layout.cc (Layout::finish_dynamic_section): Don't create
4399         DT_FLAGS entry if not needed.
4400
4401 2011-06-18  Ian Lance Taylor  <iant@google.com>
4402
4403         PR gold/12745
4404         * layout.cc (Layout::layout_eh_frame): Correct handling of
4405         writable .eh_frame section.
4406
4407 2011-06-17  Ian Lance Taylor  <iant@google.com>
4408
4409         PR gold/12893
4410         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4411         symbol is redefined with the exact same object and value.
4412
4413 2011-06-17  Ian Lance Taylor  <iant@google.com>
4414
4415         PR gold/12880
4416         * layout.h (class Layout): Add interp_segment_ field.
4417         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4418         (Layout::attach_allocated_section_to_segment): If making shared
4419         library, put .interp section in PT_INTERP segment.
4420         (Layout::finalize): Also call create_interp if -dynamic-linker
4421         option was used.
4422         (Layout::create_interp): Assert that there is no PT_INTERP
4423         segment.  If not using a SECTIONS clause, use make_output_section.
4424         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4425         * script-sections.cc
4426         (Script_sections::create_note_and_tls_segments): If making shared
4427         library, put .interp section in PT_INTERP segment.
4428
4429 2011-06-17  Ian Lance Taylor  <iant@google.com>
4430
4431         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4432         when making a shared library.
4433
4434 2011-06-17  Ian Lance Taylor  <iant@google.com>
4435
4436         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4437         parameter.  Change all callers.  Don't issue warning about PC32
4438         against locally defined symbol.
4439
4440 2011-06-16  Ian Lance Taylor  <iant@google.com>
4441
4442         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4443         occurs in same object.
4444
4445 2011-06-14  Alan Modra  <amodra@gmail.com>
4446
4447         * po/POTFILES.in: Regenerate.
4448
4449 2011-06-09  Ian Lance Taylor  <iant@google.com>
4450
4451         * script-sections.cc
4452         (Orphan_output_section::set_section_addresses): For a relocatable
4453         link set address to 0.
4454
4455 2011-06-09  Cary Coutant  <ccoutant@google.com>
4456
4457         PR gold/12804
4458         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4459         used with --compress-debug-sections.
4460         * gold/object.cc (Sized_relobj_file::do_layout): Report
4461         uncompressed size of compressed input sections.
4462
4463 2011-06-08  Cary Coutant  <ccoutant@google.com>
4464
4465         PR gold/12804
4466         * testsuite/two_file_test_2_v1.cc: Change initialization of
4467         v2 to keep it in .data.
4468
4469 2011-06-07  Cary Coutant  <ccoutant@google.com>
4470
4471         * common.cc (Symbol_table::do_allocate_commons_list): Call
4472         gold_fallback.
4473         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4474         (Errors::fallback): New function.
4475         (gold_fallback): New function.
4476         * errors.h (Errors::fallback): New function.
4477         * gold.cc (gold_exit): Change status parameter to enum; adjust
4478         all callers.
4479         (queue_initial_tasks): Call gold_fallback.
4480         * gold.h: Include cstdlib.
4481         (Exit_status): New enum type.
4482         (gold_exit): Change status parameter to enum.
4483         (gold_fallback): New function.
4484         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4485         (Layout::create_symtab_sections): Likewise.
4486         (Layout::create_shdrs): Likewise.
4487         * main.cc (main): Adjust call to gold_exit.
4488         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4489         (Output_data_got::add_got_entry_pair): Likewise.
4490         (Output_section::add_input_section): Likewise.
4491         (Output_section::add_output_section_data): Likewise.
4492         (Output_segment::set_section_list_addresses): Likewise.
4493         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4494
4495 2011-06-07  Cary Coutant  <ccoutant@google.com>
4496
4497         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4498         for incremental links.
4499         * output.cc (Output_segment::set_section_list_addresses): Remove
4500         FIXME and test for TLS or BSS.
4501
4502 2011-06-07  Cary Coutant  <ccoutant@google.com>
4503
4504         * testsuite/Makefile.am: Add incremental_copy_test,
4505         incremental_common_test_1.
4506         * testsuite/Makefile.in: Regenerate.
4507         * testsuite/common_test_1_v1.c: New source file.
4508         * testsuite/common_test_1_v2.c: New source file.
4509         * testsuite/copy_test_v1.cc: New source file.
4510
4511 2011-06-07  Cary Coutant  <ccoutant@google.com>
4512
4513         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4514         update, allocate common from bss section's free list.
4515         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4516         linker-defined symbols.
4517         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4518         Skip GOT and PLT entries that are no longer referenced.
4519         (Output_section_incremental_inputs::write_info_blocks): Mark
4520         linker-defined symbols.
4521         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4522         * output.cc (Output_section::allocate): New function.
4523         * output.h (Output_section::allocate): New function.
4524         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4525         linker-defined symbols.
4526         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4527         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4528         (Symbol::init_base_output_data): Likewise.
4529         (Symbol::init_base_output_segment): Likewise.
4530         (Symbol::init_base_constant): Likewise.
4531         (Sized_symbol::init_output_data): Likewise.
4532         (Sized_symbol::init_output_segment): Likewise.
4533         (Sized_symbol::init_constant): Likewise.
4534         (Symbol_table::do_define_in_output_data): Likewise.
4535         (Symbol_table::do_define_in_output_segment): Likewise.
4536         (Symbol_table::do_define_as_constant): Likewise.
4537         * symtab.h (Symbol::is_predefined): New function.
4538         (Symbol::init_base_output_data): Add is_predefined parameter.
4539         (Symbol::init_base_output_segment): Likewise.
4540         (Symbol::init_base_constant): Likewise.
4541         (Symbol::is_predefined_): New data member.
4542         (Sized_symbol::init_output_data): Add is_predefined parameter.
4543         (Sized_symbol::init_output_segment): Likewise.
4544         (Sized_symbol::init_constant): Likewise.
4545         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4546
4547 2011-06-07  Cary Coutant  <ccoutant@google.com>
4548
4549         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4550         instead of emit_copy_reloc.
4551         (Copy_relocs::emit_copy_reloc): Refactor.
4552         (Copy_relocs::make_copy_reloc): New function.
4553         (Copy_relocs::add_copy_reloc): Remove.
4554         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4555         section.
4556         (Copy_relocs::make_copy_reloc): New function.
4557         (Copy_relocs::add_copy_reloc): Remove.
4558         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4559         unchanged input files.
4560         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4561         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4562         Reserve BSS space for COPY relocations.
4563         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4564         (Output_section_incremental_inputs::write_info_blocks): Record
4565         whether a symbol is copied from a shared object.
4566         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4567         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4568         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4569         (Incremental_input_entry_reader::get_output_symbol_index): Add
4570         is_copy parameter.
4571         (Incremental_binary::emit_copy_relocs): New function.
4572         (Incremental_binary::do_emit_copy_relocs): New function.
4573         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4574         new data member.
4575         (Sized_incremental_binary::add_copy_reloc): New function.
4576         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4577         (Sized_incremental_binary::Copy_reloc): New struct.
4578         (Sized_incremental_binary::Copy_relocs): New typedef.
4579         (Sized_incremental_binary::copy_relocs_): New data member.
4580         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4581         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4582         * target.h (Sized_target::emit_copy_reloc): New function.
4583         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4584
4585 2011-06-02  Cary Coutant  <ccoutant@google.com>
4586
4587         PR gold/12163
4588         * gold/archive.cc (Archive::Archive): Initialize new data member.
4589         (Archive::include_all_members): Return if archive has already been
4590         included.
4591         * gold/archive.h (Archive::include_all_members_): New data member.
4592
4593 2011-06-02  Nick Clifton  <nickc@redhat.com>
4594
4595         * dynobj.h: Fix spelling mistake in comment.
4596         * output.cc: Likewise.
4597
4598 2011-05-31  Doug Kwan  <dougkwan@google.com>
4599             Asier Llano
4600
4601         PR gold/12826
4602         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4603         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4604         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4605         redundant arm_exidx_test.so.
4606         * testsuite/Makefile.in: Regenerate.
4607         (check_SCRIPTS): Add pr12826.sh
4608         (check_DATA): Add pr12826.stdout
4609         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4610         * testsuite/pr12826.sh: New file.
4611         * testsuite/pr12826_1.s: Ditto.
4612         * testsuite/pr12826_1.s: Ditto.
4613
4614 2011-05-30  Ian Lance Taylor  <iant@google.com>
4615
4616         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4617         sections.
4618
4619 2011-05-29  Ian Lance Taylor  <iant@google.com>
4620
4621         PR gold/12804
4622         * testsuite/Makefile.am: Use different file name for two_file_test
4623         temporary file for each incremental test.
4624         * testsuite/Makefile.in: Rebuild.
4625
4626 2011-05-29  Ian Lance Taylor  <iant@google.com>
4627
4628         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4629         binary input file is empty.
4630
4631 2011-05-27  Ian Lance Taylor  <iant@google.com>
4632
4633         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4634         (ver_test_9.so): Likewise.
4635         * testsuite/Makefile.in: Rebuild.
4636
4637 2011-05-26 Cary Coutant  <ccoutant@google.com>
4638
4639         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4640         * incremental.cc (Incremental_inputs::report_input_section): Fix
4641         comment, indentation.
4642         (Incremental_inputs::report_comdat_group): New function.
4643         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4644         of data for incremental input file entry.
4645         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4646         group count, COMDAT group signatures.
4647         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4648         an unchanged input file.
4649         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4650         Initialize new data member.
4651         (Incremental_object_entry::add_comdat_group): New function.
4652         (Incremental_object_entry::get_comdat_group_count): New function.
4653         (Incremental_object_entry::get_comdat_signature_key): New function.
4654         (Incremental_object_entry::groups_): New data member.
4655         (Incremental_inputs::report_comdat_group): New function.
4656         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4657         data for incremental input file entry.
4658         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4659         (Incremental_input_entry_reader::get_input_section): Adjust size of
4660         data for incremental input file entry.
4661         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4662         (Incremental_input_entry_reader::get_comdat_group_signature): New
4663         function.
4664         * object.cc (Sized_relobj::include_section_group): Report kept
4665         COMDAT groups for incremental links.
4666
4667 2011-05-24  David Meyer  <pdox@google.com>
4668
4669         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4670         with name parameter.  Add found_name parameter.
4671         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4672         * dirsearch.h (class Dirsearch): Update declaration.
4673
4674 2011-05-24  Ian Lance Taylor  <iant@google.com>
4675
4676         * archive.cc (Library_base::should_include_member): Pull in object
4677         from archive if it defines the entry symbol.
4678         * parameters.cc (Parameters::entry): New function.
4679         * parameters.h (class Parameters): Declare entry.
4680         * output.h (class Output_file_header): Remove entry_ field.
4681         * output.cc (Output_file_header::Output_file_header): Remove entry
4682         parameter.  Change all callers.
4683         (Output_file_header::entry): Use parameters->entry.
4684         * gold.cc (queue_middle_tasks): Likewise.
4685         * plugin.cc (Plugin_hook::run): Likewise.
4686
4687 2011-05-24 Cary Coutant  <ccoutant@google.com>
4688
4689         * gold.cc (queue_initial_tasks): Pass incremental base filename
4690         to Output_file::open_base_file; don't print error message.
4691         * incremental-dump.cc (main): Adjust call to
4692         Output_file::open_for_modification.
4693         * incremental-dump.cc (main): Likewise.
4694         * incremental.cc (Incremental_inputs::report_command_line):
4695         Ignore --incremental-base option when comparing command lines.
4696         Ignore parameter when given as separate argument.
4697         * options.h (class General_options): Add --incremental-base.
4698         * output.cc (Output_file::Output_file):
4699         (Output_file::open_base_file): Add base_name and writable parameters;
4700         read base file into new file; print error message here.
4701         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4702         callers.
4703         * output.h (Output_file::open_for_modification): Rename to...
4704         (Output_file::open_base_file): ...this; add base_name and
4705         writable parameters; adjust all callers.
4706         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4707         callers.
4708         * testsuite/Makefile.am (incremental_test_4): Test
4709         --incremental-base.
4710         * testsuite/Makefile.in: Regenerate.
4711
4712 2011-05-24 Cary Coutant  <ccoutant@google.com>
4713
4714         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4715         incremental_test_4.
4716         * testsuite/Makefile.in: Regenerate.
4717         * testsuite/two_file_test_1_v1.cc: New test source file.
4718         * testsuite/two_file_test_1b_v1.cc: New test source file.
4719         * testsuite/two_file_test_2_v1.cc: New test source file.
4720
4721 2011-05-24 Cary Coutant  <ccoutant@google.com>
4722
4723         * dynobj.h (Dynobj::do_dynobj): New function.
4724         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4725         flag and soname for shared objects.
4726         * incremental.cc (Incremental_inputs::report_object): Make
4727         either Incremental_object_entry or Incremental_dynobj_entry; add
4728         soname to string table.
4729         (Incremental_inputs::report_input_section): Add assertion.
4730         (Output_section_incremental_inputs::set_final_data_size): Adjust
4731         type of input file entry for shared libraries; adjust size of
4732         shared library info entry.
4733         (Output_section_incremental_inputs::write_input_files): Write
4734         as_needed flag for shared libraries.
4735         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4736         of input file entry for shared libraries; write soname.
4737         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4738         soname from incremental info.
4739         * incremental.h (enum Incremental_input_flags): Add
4740         INCREMENTAL_INPUT_AS_NEEDED.
4741         (Incremental_input_entry::Incremental_input_entry): Initialize new
4742         data member.
4743         (Incremental_input_entry::set_as_needed): New function.
4744         (Incremental_input_entry::as_needed): New function.
4745         (Incremental_input_entry::do_dynobj_entry): New function.
4746         (Incremental_input_entry::as_needed_): New data member.
4747         (Incremental_object_entry::Incremental_object_entry): Don't check
4748         for shared library.
4749         (Incremental_object_entry::do_type): Likewise.
4750         (class Incremental_dynobj_entry): New class.
4751         (Incremental_input_entry_reader::as_needed): New function.
4752         (Incremental_input_entry_reader::get_soname): New function.
4753         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4754         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4755         size of shared library info entry.
4756         * layout.cc (Layout::finish_dynamic_section): Don't test for
4757         incremental link when adding DT_NEEDED entries.
4758         * object.h (Object::Object): Initialize new data member.
4759         (Object::dynobj): New function.
4760         (Object::set_as_needed): New function.
4761         (Object::as_needed): New function.
4762         (Object::do_dynobj): New function.
4763         (Object::as_needed_): New data member.
4764
4765 2011-05-24 Cary Coutant  <ccoutant@google.com>
4766
4767         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4768         info; adjust display of GOT entries.
4769         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4770         vector of input objects; remove file_status_.
4771         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4772         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4773         got_plt reader; call target hooks to reserve GOT entries.
4774         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4775         of input file info header and GOT info entry.
4776         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4777         relocation info.
4778         (Got_plt_view_info::got_descriptor): Remove.
4779         (Got_plt_view_info::sym_index): New data member.
4780         (Got_plt_view_info::input_index): New data member.
4781         (Local_got_offset_visitor::visit): Write input file index.
4782         (Global_got_offset_visitor::visit): Write 0 for input file index.
4783         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4784         with sym_index and input_index.
4785         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4786         incremental info GOT entry; replace got_descriptor with input_index.
4787         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4788         map from input file index to object.
4789         (Sized_relobj_incr::do_layout): Replace direct data member reference
4790         with accessor function.
4791         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4792         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4793         Adjust size of input file info header.
4794         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4795         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4796         (Incremental_input_entry_reader::get_input_section): Adjust size of
4797         input file info header.
4798         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4799         of incremental info GOT entry.
4800         (Incremental_got_plt_reader::get_got_desc): Remove.
4801         (Incremental_got_plt_reader::get_got_symndx): New function.
4802         (Incremental_got_plt_reader::get_got_input_index): New function.
4803         (Sized_incremental_binary::Sized_incremental_binary): Remove
4804         file_status_; add input_objects_.
4805         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4806         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4807         (Sized_incremental_binary::file_is_unchanged): Remove.
4808         (Sized_incremental_binary::set_input_object): New function.
4809         (Sized_incremental_binary::input_object): New function.
4810         (Sized_incremental_binary::file_status_): Remove.
4811         (Sized_incremental_binary::input_objects_): New data member.
4812         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4813         references.
4814         (Sized_relobj_incr::invalid_address): Move to base class.
4815         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4816         class.
4817         (Sized_relobj_incr::do_output_section_offset): Likewise.
4818         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4819         (Sized_relobj_incr::section_offsets_): Likewise.
4820         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4821         function.
4822         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4823         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4824         with accessor function.
4825         (Sized_relobj_file::do_layout): Likewise.
4826         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4827         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4828         (Sized_relobj_file::compute_final_local_value): Replace refs to
4829         section_offsets_ with accessor function.
4830         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4831         * object.h (Relobj::Relobj): Initialize new data members.
4832         (Relobj::add_dyn_reloc): New function.
4833         (Relobj::first_dyn_reloc): New function.
4834         (Relobj::dyn_reloc_count): New function.
4835         (Relobj::first_dyn_reloc_): New data member.
4836         (Relobj::dyn_reloc_count_): New data member.
4837         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4838         references.
4839         (Sized_relobj::Address): New typedef.
4840         (Sized_relobj::invalid_address): Move here from child class.
4841         (Sized_relobj::Sized_relobj): Initialize new data members.
4842         (Sized_relobj::sized_relobj): New function.
4843         (Sized_relobj::is_output_section_offset_invalid): Move here from
4844         child class.
4845         (Sized_relobj::get_output_section_offset): Likewise.
4846         (Sized_relobj::local_has_got_offset): Likewise.
4847         (Sized_relobj::local_got_offset): Likewise.
4848         (Sized_relobj::set_local_got_offset): Likewise.
4849         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4850         (Sized_relobj::clear_got_offsets): New function.
4851         (Sized_relobj::section_offsets): Move here from child class.
4852         (Sized_relobj::do_output_section_offset): Likewise.
4853         (Sized_relobj::do_set_section_offset): Likewise.
4854         (Sized_relobj::Local_got_offsets): Likewise.
4855         (Sized_relobj::local_got_offsets_): Likewise.
4856         (Sized_relobj::section_offsets_): Likewise.
4857         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4858         references.
4859         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4860         class.
4861         (Sized_relobj_file::sized_relobj): New function
4862         (Sized_relobj_file::local_has_got_offset): Move to base class.
4863         (Sized_relobj_file::local_got_offset): Likewise.
4864         (Sized_relobj_file::set_local_got_offset): Likewise.
4865         (Sized_relobj_file::get_output_section_offset): Likewise.
4866         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4867         (Sized_relobj_file::do_output_section_offset): Likewise.
4868         (Sized_relobj_file::do_set_section_offset): Likewise.
4869         (Sized_relobj_file::Local_got_offsets): Likewise.
4870         (Sized_relobj_file::local_got_offsets_): Likewise.
4871         (Sized_relobj_file::section_offsets_): Likewise.
4872         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4873         (all constructors).
4874         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4875         (Output_reloc::get_symbol_index): Likewise.
4876         (Output_reloc::local_section_offset): Likewise.
4877         (Output_reloc::get_address): Likewise.
4878         (Output_reloc::symbol_value): Likewise.
4879         (Output_data_got::reserve_slot): Move to class definition.
4880         (Output_data_got::reserve_local): New function.
4881         (Output_data_got::reserve_slot_for_global): Remove.
4882         (Output_data_got::reserve_global): New function.
4883         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4884         (all constructors, two instantiations).
4885         (Output_reloc::get_relobj): New function (two instantiations).
4886         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4887         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4888         (Output_data_reloc::add_global): Adjust type of relobj.
4889         (Output_data_reloc::add_global_relative): Likewise.
4890         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4891         (Output_data_reloc::add_local): Likewise.
4892         (Output_data_reloc::add_local_relative): Likewise.
4893         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4894         (Output_data_reloc::add_local_section): Likewise.
4895         (Output_data_reloc::add_output_section): Likewise.
4896         (Output_data_reloc::add_absolute): Likewise.
4897         (Output_data_reloc::add_target_specific): Likewise.
4898         (Output_data_got::reserve_slot): Move definition here.
4899         (Output_data_got::reserve_local): New function.
4900         (Output_data_got::reserve_global): New function.
4901         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4902         section_offsets_ with accessor function.
4903         (Sized_relobj_file::write_sections): Likewise.
4904         (Sized_relobj_file::do_relocate_sections): Likewise.
4905         * target.h (Sized_target::reserve_local_got_entry): New function.
4906         (Sized_target::reserve_global_got_entry): New function.
4907         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4908         (Target_x86_64::reserve_global_got_entry): New function.
4909         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4910
4911 2011-05-23 Cary Coutant  <ccoutant@google.com>
4912
4913         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4914         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4915         bit when checking got_type.
4916         * incremental.cc (Sized_incremental_binary::setup_readers):
4917         Store symbol table and string table locations; initialize bit vector
4918         of file status flags.
4919         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4920         unchanged files.
4921         (Sized_incremental_binary::do_process_got_plt): New function.
4922         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4923         (Output_section_incremental_inputs::set_final_data_size): Record
4924         file index for each input file.
4925         (Output_section_incremental_inputs::write_got_plt): Store file index
4926         instead of input entry offset for each GOT entry.
4927         * incremental.h
4928         (Incremental_input_entry::Incremental_input_entry): Initialize new
4929         data member.
4930         (Incremental_input_entry::set_offset): Store file index.
4931         (Incremental_input_entry::get_file_index): New function.
4932         (Incremental_input_entry::file_index_): New data member.
4933         (Incremental_binary::process_got_plt): New function.
4934         (Incremental_binary::do_process_got_plt): New function.
4935         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4936         data members.
4937         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4938         (Sized_incremental_binary::set_file_is_unchanged): New function.
4939         (Sized_incremental_binary::file_is_unchanged): New function.
4940         (Sized_incremental_binary::do_process_got_plt): New function.
4941         (Sized_incremental_binary::file_status_): New data member.
4942         (Sized_incremental_binary::main_symtab_loc_): New data member.
4943         (Sized_incremental_binary::main_strtab_loc_): New data member.
4944         * output.cc (Output_data_got::Got_entry::write): Add case
4945         RESERVED_CODE.
4946         (Output_data_got::add_global): Call add_got_entry.
4947         (Output_data_got::add_global_plt): Likewise.
4948         (Output_data_got::add_global_with_rel): Likewise.
4949         (Output_data_got::add_global_with_rela): Likewise.
4950         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4951         (Output_data_got::add_global_pair_with_rela): Likewise.
4952         (Output_data_got::add_local): Call add_got_entry.
4953         (Output_data_got::add_local_plt): Likewise.
4954         (Output_data_got::add_local_with_rel): Likewise.
4955         (Output_data_got::add_local_with_rela): Likewise.
4956         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4957         (Output_data_got::add_local_pair_with_rela): Likewise.
4958         (Output_data_got::reserve_slot): New function.
4959         (Output_data_got::reserve_slot_for_global): New function.
4960         (Output_data_got::add_got_entry): New function.
4961         (Output_data_got::add_got_entry_pair): New function.
4962         (Output_section::add_output_section_data): Edit FIXME.
4963         * output.h
4964         (Output_section_data_build::Output_section_data_build): New
4965         constructor with size parameter.
4966         (Output_data_space::Output_data_space): Likewise.
4967         (Output_data_got::Output_data_got): Initialize new data member; new
4968         constructor with size parameter.
4969         (Output_data_got::add_constant): Call add_got_entry.
4970         (Output_data_got::reserve_slot): New function.
4971         (Output_data_got::reserve_slot_for_global): New function.
4972         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4973         (Output_data_got::add_got_entry): New function.
4974         (Output_data_got::add_got_entry_pair): New function.
4975         (Output_data_got::free_list_): New data member.
4976         * target.h (Sized_target::init_got_plt_for_update): New function.
4977         (Sized_target::register_global_plt_entry): New function.
4978         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4979         Initialize new data member; call init; add constructor with PLT count.
4980         (Output_data_plt_x86_64::init): New function.
4981         (Output_data_plt_x86_64::add_relocation): New function.
4982         (Output_data_plt_x86_64::reserve_slot): New function.
4983         (Output_data_plt_x86_64::free_list_): New data member.
4984         (Target_x86_64::init_got_plt_for_update): New function.
4985         (Target_x86_64::register_global_plt_entry): New function.
4986         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4987         incremental updates.
4988         (Output_data_plt_x86_64::add_relocation): New function.
4989         * testsuite/object_unittest.cc (Object_test): Set default options.
4990
4991 2011-05-16  Ian Lance Taylor  <iant@google.com>
4992
4993         * options.h (class General_options): Make -i a synonym for -r.
4994
4995 2011-05-16  Ian Lance Taylor  <iant@google.com>
4996
4997         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4998
4999 2011-05-10 Cary Coutant  <ccoutant@google.com>
5000
5001         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5002         strip_all (-s).
5003
5004 2011-05-06  Ian Lance Taylor  <iant@google.com>
5005
5006         * layout.cc (Layout::layout): If the output section flags change,
5007         update the ordering.
5008
5009 2011-04-25 Cary Coutant  <ccoutant@google.com>
5010
5011         * incremental-dump.cc (dump_incremental_inputs): Print local
5012         symbol info for each input file.
5013         * incremental.cc
5014         (Output_section_incremental_inputs::set_final_data_size): Add local
5015         symbol info to input file entries in incremental info.
5016         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5017         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5018         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5019         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5020         implementation.
5021         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5022         (Sized_incr_relobj::do_relocate): Write the local symbols.
5023         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5024         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5025         Adjust size of input file header.
5026         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5027         (Incremental_inputs_reader::get_local_symbol_count): New function.
5028         (Incremental_inputs_reader::get_input_section): Adjust size of input
5029         file header.
5030         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5031         (Sized_incr_relobj::This): New typedef.
5032         (Sized_incr_relobj::sym_size): New const data member.
5033         (Sized_incr_relobj::Local_symbol): New struct.
5034         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5035         (Sized_incr_relobj::do_local_symbol_offset): New function.
5036         (Sized_incr_relobj::local_symbol_count_): New data member.
5037         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5038         (Sized_incr_relobj::local_symbol_index_): New data member.
5039         (Sized_incr_relobj::local_symbol_offset_): New data member.
5040         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5041         (Sized_incr_relobj::local_symbols_): New data member.
5042         * object.h (Relobj::output_local_symbol_count): New function.
5043         (Relobj::local_symbol_offset): New function.
5044         (Relobj::do_output_local_symbol_count): New function.
5045         (Relobj::do_local_symbol_offset): New function.
5046         (Sized_relobj::do_output_local_symbol_count): New function.
5047         (Sized_relobj::do_local_symbol_offset): New function.
5048
5049 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5050
5051         * descriptors.cc (set_close_on_exec): New function.
5052         (Descriptors::open): Use set_close_on_exec.
5053         * output.cc (S_ISLNK): Define if not defined.
5054
5055 2011-04-22 Cary Coutant  <ccoutant@google.com>
5056
5057         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5058         global symbol map.
5059         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5060         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5061         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5062         relocations.
5063         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5064         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5065         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5066         * incremental.h
5067         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5068         function.
5069         (Incremental_binary::apply_incremental_relocs): New function.
5070         (Incremental_binary::do_apply_incremental_relocs): New function.
5071         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5072         data member.
5073         (Sized_incremental_binary::add_global_symbol): New function.
5074         (Sized_incremental_binary::global_symbol): New function.
5075         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5076         (Sized_incremental_binary::symbol_map_): New data member.
5077         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5078         * target.h (Sized_target::apply_relocation): New function.
5079         * target-reloc.h (apply_relocation): New function.
5080         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5081
5082 2011-04-22  Doug Kwan  <dougkwan@google.com>
5083
5084         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5085         flag of a SHT_ARM_EXIDX section.
5086         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5087         * testsuite/Makefile.in: Regenerate.
5088         * testsuite/arm_exidx_test.s: New file.
5089         * testsuite/arm_exidx_test.sh: Same.
5090
5091 2011-04-20 Cary Coutant  <ccoutant@google.com>
5092
5093         PR gold/12689
5094         * archive.h (Incremental_archive_entry::Archive_member):
5095         Initialize arg_serial_ (second constructor).
5096
5097 2011-04-17  Ian Lance Taylor  <iant@google.com>
5098
5099         * object.cc (Relocate_info::location): Simplify location string.
5100         * errors.cc (Errors::error_at_location): Don't print program
5101         name.
5102         (Errors::warning_at_location): Likewise.
5103         (Errors::undefined_symbol): Likewise.
5104         * testsuite/debug_msg.sh: Update accordingly.
5105
5106 2011-04-14 Cary Coutant  <ccoutant@google.com>
5107
5108         * gold/layout.cc (Layout::symtab_section_offset): New function.
5109         * gold/layout.h (Layout::symtab_section_offset): New function.
5110         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5111
5112 2011-04-12  Ian Lance Taylor  <iant@google.com>
5113
5114         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5115         with MREMAP_MAYMOVE.
5116         * output.h (class Output_file): Add map_is_allocated_ field.
5117         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5118         not available, provide stubs.  If mremap is not available, #define
5119         it to gold_mremap.
5120         (MREMAP_MAYMOVE): Define if not defined.
5121         (Output_file::Output_file): Initialize map_is_allocated_.
5122         (Output_file::resize): Check map_is_allocated_.
5123         (Output_file::map_anonymous): If mmap fails, use malloc.
5124         (Output_file::unmap): Don't do anything for an anonymous map.
5125         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5126         is not available, provide stubs.
5127         (File_read::View::~View): Use free rather than delete[].
5128         (File_read::make_view): Use malloc rather than new[].  If mmap
5129         fails, use malloc.
5130         (File_read::find_or_make_view): Use malloc rather than new[].
5131         * gold.h: Remove HAVE_REMAP code.
5132         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5133         exists.  Rename mremap to gold_mremap.  If mmap is not available
5134         don't do anything.
5135         * configure, config.in: Rebuild.
5136
5137 2011-04-11  Ian Lance Taylor  <iant@google.com>
5138
5139         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5140         initialize local variable v.
5141
5142 2011-04-11  Cary Coutant  <ccoutant@google.com>
5143
5144         * archive.cc (Archive::include_member): Adjust call to
5145         report_object.
5146         (Add_archive_symbols::run): Track argument serial numbers.
5147         (Lib_group::include_member): Likewise.
5148         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5149         * archive.h (Incremental_archive_entry::Archive_member):
5150         Initialize arg_serial_.
5151         (Archive_member::arg_serial_): New data member.
5152         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5153         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5154         incremental link.
5155         (Sized_dynobj::do_for_all_local_got_entries): New function.
5156         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5157         function.
5158         * fileread.cc (get_mtime): New function.
5159         * fileread.h (get_mtime): New function.
5160         * gold.cc (queue_initial_tasks): Check for incremental update.
5161         (process_incremental_input): New function.
5162         (queue_middle_tasks): Don't force valid target for incremental
5163         update.
5164         * incremental-dump.cc (find_input_containing_global): Adjust
5165         size of symbol info entry.
5166         (dump_incremental_inputs): Dump argument serial number and
5167         in_system_directory flag; bias shndx by 1; print symbol names
5168         when dumping per-file symbol lists; use new symbol info readers.
5169         * incremental.cc
5170         (Output_section_incremental_inputs:update_data_size): New function.
5171         (Sized_incremental_binary::setup_readers): Setup input readers
5172         for each input file; build maps for files added from libraries
5173         and scripts.
5174         (Sized_incremental_binary::check_input_args): New function.
5175         (Sized_incremental_binary::do_check_inputs): Build map of argument
5176         serial numbers to input arguments.
5177         (Sized_incremental_binary::do_file_has_changed): Rename
5178         do_file_is_unchanged to this; compare file modification times.
5179         (Sized_incremental_binary::do_init_layout): New function.
5180         (Sized_incremental_binary::do_reserve_layout): New function.
5181         (Sized_incremental_binary::do_get_input_reader): Remove.
5182         (Sized_incremental_binary::get_symtab_view): New function.
5183         (Incremental_checker::can_incrementally_link_output_file): Remove.
5184         (Incremental_inputs::report_command_line): Exclude --debug options.
5185         (Incremental_inputs::report_archive_begin): Add parameter; track
5186         argument serial numbers; don't put input file entry for archive
5187         before archive members.
5188         (Incremental_inputs::report_archive_end): Put input file entry
5189         for archive after archive members.
5190         (Incremental_inputs::report_object): Add parameter; track argument
5191         serial numbers and in_system_directory flag.
5192         (Incremental_inputs::report_script): Add parameter; track argument
5193         serial numbers.
5194         (Output_section_incremental_inputs::set_final_data_size): Adjust
5195         size of symbol info entry; check for forwarding symbols.
5196         (Output_section_incremental_inputs::write_input_files): Write
5197         in_system_directory flag and argument serial number.
5198         (Output_section_incremental_inputs::write_info_blocks): Map section
5199         indices between incremental info and original input file; store
5200         input section index for each symbol.
5201         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5202         change operator() to visit().
5203         (class Global_got_offset_visitor): Likewise.
5204         (class Global_symbol_visitor_got_plt):
5205         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5206         classes.
5207         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5208         (Sized_incr_relobj::do_read_symbols): New function.
5209         (Sized_incr_relobj::do_layout): New function.
5210         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5211         (Sized_incr_relobj::do_add_symbols): New function.
5212         (Sized_incr_relobj::do_should_include_member): New function.
5213         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5214         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5215         (Sized_incr_relobj::do_section_size): New function.
5216         (Sized_incr_relobj::do_section_name): New function.
5217         (Sized_incr_relobj::do_section_contents): New function.
5218         (Sized_incr_relobj::do_section_flags): New function.
5219         (Sized_incr_relobj::do_section_entsize): New function.
5220         (Sized_incr_relobj::do_section_address): New function.
5221         (Sized_incr_relobj::do_section_type): New function.
5222         (Sized_incr_relobj::do_section_link): New function.
5223         (Sized_incr_relobj::do_section_info): New function.
5224         (Sized_incr_relobj::do_section_addralign): New function.
5225         (Sized_incr_relobj::do_initialize_xindex): New function.
5226         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5227         (Sized_incr_relobj::do_read_relocs): New function.
5228         (Sized_incr_relobj::do_gc_process_relocs): New function.
5229         (Sized_incr_relobj::do_scan_relocs): New function.
5230         (Sized_incr_relobj::do_count_local_symbols): New function.
5231         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5232         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5233         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5234         (Sized_incr_relobj::do_relocate): New function.
5235         (Sized_incr_relobj::do_set_section_offset): New function.
5236         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5237         (Sized_incr_dynobj::do_read_symbols): New function.
5238         (Sized_incr_dynobj::do_layout): New function.
5239         (Sized_incr_dynobj::do_add_symbols): New function.
5240         (Sized_incr_dynobj::do_should_include_member): New function.
5241         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5242         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5243         (Sized_incr_dynobj::do_section_size): New function.
5244         (Sized_incr_dynobj::do_section_name): New function.
5245         (Sized_incr_dynobj::do_section_contents): New function.
5246         (Sized_incr_dynobj::do_section_flags): New function.
5247         (Sized_incr_dynobj::do_section_entsize): New function.
5248         (Sized_incr_dynobj::do_section_address): New function.
5249         (Sized_incr_dynobj::do_section_type): New function.
5250         (Sized_incr_dynobj::do_section_link): New function.
5251         (Sized_incr_dynobj::do_section_info): New function.
5252         (Sized_incr_dynobj::do_section_addralign): New function.
5253         (Sized_incr_dynobj::do_initialize_xindex): New function.
5254         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5255         (make_sized_incremental_object): New function.
5256         (Incremental_library::copy_unused_symbols): New function.
5257         (Incremental_library::do_for_all_unused_symbols): New function.
5258         * incremental.h (enum Incremental_input_flags): New type.
5259         (class Incremental_checker): Remove.
5260         (Incremental_input_entry::Incremental_input_entry): Add argument
5261         serial number.
5262         (Incremental_input_entry::arg_serial): New function.
5263         (Incremental_input_entry::set_is_in_system_directory): New function.
5264         (Incremental_input_entry::is_in_system_directory): New function.
5265         (Incremental_input_entry::arg_serial_): New data member.
5266         (Incremental_input_entry::is_in_system_directory_): New data member.
5267         (class Script_info): Move here from script.h.
5268         (Script_info::Script_info): Add filename parameter.
5269         (Script_info::filename): New function.
5270         (Script_info::filename_): New data member.
5271         (Incremental_script_entry::Incremental_script_entry): Add argument
5272         serial number.
5273         (Incremental_object_entry::Incremental_object_entry): Likewise.
5274         (Incremental_object_entry::add_input_section): Build list of input
5275         sections with map to original shndx.
5276         (Incremental_object_entry::get_input_section_index): New function.
5277         (Incremental_object_entry::shndx_): New data member.
5278         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5279         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5280         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5281         serial number.
5282         (Incremental_inputs::report_archive_begin): Likewise.
5283         (Incremental_inputs::report_object): Likewise.
5284         (Incremental_inputs::report_script): Likewise.
5285         (class Incremental_global_symbol_reader): New class.
5286         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5287         and store flags and input file type.
5288         (Incremental_input_entry_reader::arg_serial): New function.
5289         (Incremental_input_entry_reader::type): Extract type from flags.
5290         (Incremental_input_entry_reader::is_in_system_directory): New function.
5291         (Incremental_input_entry_reader::get_input_section_count): Call
5292         accessor function for type.
5293         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5294         function for type; adjust size of global symbol entry.
5295         (Incremental_input_entry_reader::get_global_symbol_count): Call
5296         accessor function for type.
5297         (Incremental_input_entry_reader::get_object_count): Likewise.
5298         (Incremental_input_entry_reader::get_object_offset): Likewise.
5299         (Incremental_input_entry_reader::get_member_count): Likewise.
5300         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5301         (Incremental_input_entry_reader::get_member_offset): Likewise.
5302         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5303         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5304         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5305         (Incremental_input_entry_reader::get_global_symbol_reader): New
5306         function.
5307         (Incremental_input_entry_reader::get_output_symbol_index): New
5308         function.
5309         (Incremental_input_entry_reader::type_): Remove.
5310         (Incremental_input_entry_reader::flags_): New data member.
5311         (Incremental_inputs_reader::input_file_offset): New function.
5312         (Incremental_inputs_reader::input_file_index): New function.
5313         (Incremental_inputs_reader::input_file): Call input_file_offset.
5314         (Incremental_inputs_reader::input_file_at_offset): New function.
5315         (Incremental_relocs_reader::get_r_type): Reformat.
5316         (Incremental_relocs_reader::get_r_shndx): Reformat.
5317         (Incremental_relocs_reader::get_r_offset): Reformat.
5318         (Incremental_relocs_reader::data): New function.
5319         (Incremental_binary::Incremental_binary): Initialize new data members.
5320         (Incremental_binary::check_inputs): Add cmdline parameter.
5321         (Incremental_binary::file_is_unchanged): Remove.
5322         (Input_reader::arg_serial): New function.
5323         (Input_reader::get_unused_symbol_count): New function.
5324         (Input_reader::get_unused_symbol): New function.
5325         (Input_reader::do_arg_serial): New function.
5326         (Input_reader::do_get_unused_symbol_count): New function.
5327         (Input_reader::do_get_unused_symbol): New function.
5328         (Incremental_binary::input_file_count): New function.
5329         (Incremental_binary::get_input_reader): Change signature to use
5330         index instead of filename.
5331         (Incremental_binary::file_has_changed): New function.
5332         (Incremental_binary::get_input_argument): New function.
5333         (Incremental_binary::get_library): New function.
5334         (Incremental_binary::get_script_info): New function.
5335         (Incremental_binary::init_layout): New function.
5336         (Incremental_binary::reserve_layout): New function.
5337         (Incremental_binary::output_file): New function.
5338         (Incremental_binary::do_check_inputs): New function.
5339         (Incremental_binary::do_file_is_unchanged): Remove.
5340         (Incremental_binary::do_file_has_changed): New function.
5341         (Incremental_binary::do_init_layout): New function.
5342         (Incremental_binary::do_reserve_layout): New function.
5343         (Incremental_binary::do_input_file_count): New function.
5344         (Incremental_binary::do_get_input_reader): Change signature.
5345         (Incremental_binary::input_args_map_): New data member.
5346         (Incremental_binary::library_map_): New data member.
5347         (Incremental_binary::script_map_): New data member.
5348         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5349         new data members.
5350         (Sized_incremental_binary::output_section): New function.
5351         (Sized_incremental_binary::inputs_reader): Add const.
5352         (Sized_incremental_binary::symtab_reader): Add const.
5353         (Sized_incremental_binary::relocs_reader): Add const.
5354         (Sized_incremental_binary::got_plt_reader): Add const.
5355         (Sized_incremental_binary::get_symtab_view): New function.
5356         (Sized_incremental_binary::Inputs_reader): New typedef.
5357         (Sized_incremental_binary::Input_entry_reader): New typedef.
5358         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5359         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5360         (Sized_incremental_binary::do_file_has_changed): New function.
5361         (Sized_incremental_binary::do_init_layout): New function.
5362         (Sized_incremental_binary::do_reserve_layout): New function.
5363         (Sized_input_reader::Inputs_reader): Remove.
5364         (Sized_input_reader::Input_entry_reader): Remove.
5365         (Sized_input_reader::do_arg_serial): New function.
5366         (Sized_input_reader::do_get_unused_symbol_count): New function.
5367         (Sized_input_reader::do_get_unused_symbol): New function.
5368         (Sized_incremental_binary::do_input_file_count): New function.
5369         (Sized_incremental_binary::do_get_input_reader): Change signature;
5370         use index instead of filename.
5371         (Sized_incremental_binary::section_map_): New data member.
5372         (Sized_incremental_binary::input_entry_readers_): New data member.
5373         (class Sized_incr_relobj): New class.
5374         (class Sized_incr_dynobj): New class.
5375         (make_sized_incremental_object): New function.
5376         (class Incremental_library): New class.
5377         * layout.cc (Free_list::num_lists): New static data member.
5378         (Free_list::num_nodes): New static data member.
5379         (Free_list::num_removes): New static data member.
5380         (Free_list::num_remove_visits): New static data member.
5381         (Free_list::num_allocates): New static data member.
5382         (Free_list::num_allocate_visits): New static data member.
5383         (Free_list::init): New function.
5384         (Free_list::remove): New function.
5385         (Free_list::allocate): New function.
5386         (Free_list::dump): New function.
5387         (Free_list::print_stats): New function.
5388         (Layout_task_runner::run): Resize output file for incremental updates.
5389         (Layout::Layout): Initialize new data members.
5390         (Layout::set_incremental_base): New function.
5391         (Layout::init_fixed_output_section): New function.
5392         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5393         incremental updates.
5394         (Layout::create_gold_note): Do not create gold note section for
5395         incremental updates.
5396         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5397         for incremental updates.
5398         (Layout::set_section_offsets): For incremental updates, allocate space
5399         from free list.
5400         (Layout::create_symtab_sections): Layout with offsets relative to
5401         start of section; for incremental updates, allocate space from free
5402         list.
5403         (Layout::create_shdrs): For incremental updates, allocate space from
5404         free list.
5405         (Layout::finish_dynamic_section): For incremental updates, do not
5406         check --as-needed (fixed in subsequent patch).
5407         * layout.h (class Free_list): New class.
5408         (Layout::set_incremental_base): New function.
5409         (Layout::incremental_base): New function.
5410         (Layout::init_fixed_output_section): New function.
5411         (Layout::allocate): New function.
5412         (Layout::incremental_base_): New data member.
5413         (Layout::free_list_): New data member.
5414         * main.cc (main): Print Free_list statistics.
5415         * object.cc (Relobj::finalize_incremental_relocs): Add
5416         clear_counts parameter; clear counts only when clear_counts is set.
5417         (Sized_relobj::Sized_relobj): Initialize new base class.
5418         (Sized_relobj::do_layout): Don't report special sections.
5419         (Sized_relobj::do_for_all_local_got_entries): New function.
5420         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5421         symtab_off to all symbol table offsets.
5422         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5423         * object.h (class Got_offset_list): Move to top of file.
5424         (Object::Object): Allow case where input_file == NULL.
5425         (Object::~Object): Likewise.
5426         (Object::input_file): Assert that input_file != NULL.
5427         (Object::lock): Allow case where input_file == NULL.
5428         (Object::unlock): Likewise.
5429         (Object::is_locked): Likewise.
5430         (Object::token): Likewise.
5431         (Object::release): Likewise.
5432         (Object::is_incremental): New function.
5433         (Object::get_mtime): New function.
5434         (Object::for_all_local_got_entries): New function.
5435         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5436         (Object::set_is_in_system_directory): New function.
5437         (Object::is_in_system_directory): New function.
5438         (Object::do_is_incremental): New function.
5439         (Object::do_get_mtime): New function.
5440         (Object::do_for_all_local_got_entries): New function.
5441         (Object::is_in_system_directory_): New data member.
5442         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5443         (class Sized_relobj_base): New class.
5444         (class Sized_relobj): Derive from Sized_relobj_base.
5445         (class Sized_relobj::Symbols): Redeclare from base class.
5446         (class Sized_relobj::local_got_offset_list): Remove.
5447         (class Sized_relobj::Output_sections): Redeclare from base class.
5448         (class Sized_relobj::do_for_all_local_got_entries): New function.
5449         (class Sized_relobj::write_local_symbols): Add offset parameter.
5450         (class Sized_relobj::local_symbol_offset_): Update comment.
5451         (class Sized_relobj::local_dynsym_offset_): Update comment.
5452         * options.cc (Input_arguments::add_file): Remove const.
5453         * options.h (Input_file_argument::Input_file_argument):
5454         Initialize arg_serial_ (all constructors).
5455         (Input_file_argument::set_arg_serial): New function.
5456         (Input_file_argument::arg_serial): New function.
5457         (Input_file_argument::arg_serial_): New data member.
5458         (Input_arguments::Input_arguments): Initialize file_count_.
5459         (Input_arguments::add_file): Remove const.
5460         (Input_arguments::number_of_input_files): New function.
5461         (Input_arguments::file_count_): New data member.
5462         (Command_line::number_of_input_files): Call
5463         Input_arguments::number_of_input_files.
5464         * output.cc (Output_segment_headers::Output_segment_headers):
5465         Set current size.
5466         (Output_section::Input_section::current_data_size): New function.
5467         (Output_section::Output_section): Initialize new data members.
5468         (Output_section::add_input_section): Don't do merge sections for
5469         an incremental link; allocate space from free list for an
5470         incremental update.
5471         (Output_section::add_output_section_data): Allocate space from
5472         free list for an incremental update.
5473         (Output_section::update_data_size): New function.
5474         (Output_section::set_fixed_layout): New function.
5475         (Output_section::reserve): New function.
5476         (Output_segment::set_section_addresses): Remove const.
5477         (Output_segment::set_section_list_addresses): Remove const; allocate
5478         space from free list for an incremental update.
5479         (Output_segment::set_offset): Adjust size of RELRO segment for an
5480         incremental update.
5481         * output.h (Output_data::current_data_size): Move here from
5482         child classes.
5483         (Output_data::pre_finalize_data_size): New function.
5484         (Output_data::update_data_size): New function.
5485         (Output_section_headers::update_data_size): new function.
5486         (Output_section_data_build::current_data_size): Move to Output_data.
5487         (Output_data_strtab::update_data_size): New function.
5488         (Output_section::current_data_size): Move to Output_data.
5489         (Output_section::set_fixed_layout): New function.
5490         (Output_section::has_fixed_layout): New function.
5491         (Output_section::reserve): New function.
5492         (Output_section::update_data_size): New function.
5493         (Output_section::has_fixed_layout_): New data member.
5494         (Output_section::free_list_): New data member.
5495         (Output_segment::set_section_addresses): Remove const.
5496         (Output_segment::set_section_list_addresses): Remove const.
5497         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5498         New function.
5499         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5500         New function.
5501         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5502         parameter when calling Add_symbols constructor; store argument
5503         serial number for members of a lib group.
5504         (Add_symbols::locks): Allow case where token == NULL.
5505         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5506         (Read_member::~Read_member): New function.
5507         (Read_member::is_runnable): New function.
5508         (Read_member::locks): New function.
5509         (Read_member::run): New function.
5510         (Check_script::~Check_script): New function.
5511         (Check_script::is_runnable): New function.
5512         (Check_script::locks): New function.
5513         (Check_script::run): New function.
5514         (Check_library::~Check_library): New function.
5515         (Check_library::is_runnable): New function.
5516         (Check_library::locks): New function.
5517         (Check_library::run): New function.
5518         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5519         (Add_symbols::library_): New data member.
5520         (class Read_member): New class.
5521         (class Check_script): New class.
5522         (class Check_library): New class.
5523         * reloc.cc (Read_relocs::is_runnable): Allow case where
5524         token == NULL.
5525         (Read_relocs::locks): Likewise.
5526         (Scan_relocs::locks): Likewise.
5527         (Relocate_task::locks): Likewise.
5528         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5529         to clear counters.
5530         (Sized_relobj::incremental_relocs_scan): Fix comment.
5531         (Sized_relobj::do_relocate): Pass output file offset to
5532         write_local_symbols.
5533         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5534         from class declaration.
5535         * script.cc (read_input_script): Allocate Script_info; pass
5536         argument serial number to report_script.
5537         * script.h (class Script_info): Move to incremental.h.
5538         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5539         * symtab.h (Symbol_table::add_from_incrobj): New function.
5540         (Symbol_table::set_file_offset): New function.
5541
5542 2011-04-05  Cary Coutant  <ccoutant@google.com>
5543
5544         * incremental-dump.cc (dump_incremental_inputs): Change signature
5545         to take a Sized_incremental_binary; change caller.  Use readers
5546         in Sized_incremental_binary.
5547         * incremental.cc
5548         (Sized_incremental_binary::find_incremental_inputs_sections):
5549         Rename do_find_incremental_inputs_sections to this.
5550         (Sized_incremental_binary::setup_readers): New function.
5551         (Sized_incremental_binary::do_check_inputs): Check
5552         has_incremental_info_ flag; move setup code to setup_readers;
5553         use input readers.
5554         (Sized_incremental_binary::do_file_is_unchanged): New function.
5555         (Sized_incremental_binary::do_get_input_reader): New function.
5556         * incremental.h (class Incremental_binary): Move to end of file.
5557         (Incremental_binary::file_is_unchanged): New function.
5558         (Incremental_binary::do_file_is_unchanged): New function.
5559         (Incremental_binary::Input_reader): New class.
5560         (Incremental_binary::get_input_reader): New function.
5561         (class Sized_incremental_binary): Move to end of file.
5562         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5563         input section reader classes.
5564         (Sized_incremental_binary::has_incremental_info): New function.
5565         (Sized_incremental_binary::inputs_reader): New function.
5566         (Sized_incremental_binary::symtab_reader): New function.
5567         (Sized_incremental_binary::relocs_reader): New function.
5568         (Sized_incremental_binary::got_plt_reader): New function.
5569         (Sized_incremental_binary::do_file_is_unchanged): New function.
5570         (Sized_incremental_binary::Sized_input_reader): New class.
5571         (Sized_incremental_binary::get_input_reader): New function.
5572         (Sized_incremental_binary::find_incremental_inputs_sections):
5573         Rename do_find_incremental_inputs_sections to this.
5574         (Sized_incremental_binary::setup_readers): New function.
5575         (Sized_incremental_binary::has_incremental_info_): New data member.
5576         (Sized_incremental_binary::inputs_reader_): New data member.
5577         (Sized_incremental_binary::symtab_reader_): New data member.
5578         (Sized_incremental_binary::relocs_reader_): New data member.
5579         (Sized_incremental_binary::got_plt_reader_): New data member.
5580         (Sized_incremental_binary::current_input_file_): New data member.
5581
5582 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5583
5584         PR gold/12640
5585         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5586         violation.
5587
5588 2011-03-30  Cary Coutant  <ccoutant@google.com>
5589
5590         * archive.cc (Archive::include_member): Adjust call to report_object.
5591         (Add_archive_symbols::run): Add script_info to call to
5592         report_archive_begin.
5593         (Lib_group::include_member): Adjust call to report_object.
5594         (Add_lib_group_symbols::run): Adjust call to report_object.
5595         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5596         blocks.  Add object count for script input files.
5597         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5598         script_info parameter; change all callers.
5599         (Incremental_inputs::report_object): Add script_info parameter;
5600         change all callers.
5601         (Incremental_inputs::report_script): Store backpointer to
5602         incremental info entry.
5603         (Output_section_incremental_inputs::set_final_data_size): Record
5604         additional information for scripts.
5605         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5606         * incremental.h (Incremental_script_entry::add_object): New function.
5607         (Incremental_script_entry::get_object_count): New function.
5608         (Incremental_script_entry::get_object): New function.
5609         (Incremental_script_entry::objects_): New data member; adjust
5610         constructor.
5611         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5612         (Incremental_inputs::report_object): Add script_info parameter.
5613         (Incremental_inputs_reader::get_object_count): New function.
5614         (Incremental_inputs_reader::get_object_offset): New function.
5615         * options.cc (Input_arguments::add_file): Return reference to
5616         new input argument.
5617         * options.h (Input_argument::set_script_info): New function.
5618         (Input_argument::script_info): New function.
5619         (Input_argument::script_info_): New data member; adjust all
5620         constructors.
5621         (Input_file_group::add_file): Return reference to new input argument.
5622         (Input_file_lib::add_file): Likewise.
5623         (Input_arguments::add_file): Likewise.
5624         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5625         * script.cc (Parser_closure::Parser_closure): Add script_info
5626         parameter; adjust all callers.
5627         (Parser_closure::script_info): New function.
5628         (Parser_closure::script_info_): New data member.
5629         (read_input_script): Report scripts earlier to incremental info.
5630         (script_add_file): Set script_info in Input_argument.
5631         (script_add_library): Likewise.
5632         * script.h (Script_options::Script_info): Rewrite class.
5633
5634 2011-03-29  Cary Coutant  <ccoutant@google.com>
5635
5636         * archive.cc (Library_base::should_include_member): Move
5637         method here from class Archive.
5638         (Archive::Archive): Initialize base class.
5639         (Archive::should_include_member): Move to base class.
5640         (Archive::do_for_all_unused_symbols): New function.
5641         (Add_archive_symbols::run): Remove redundant access to
5642         incremental_inputs.
5643         (Lib_group::Lib_group): Initialize base class.
5644         (Lib_group::do_filename): New function.
5645         (Lib_group::include_member): Pass pointer to Lib_group to
5646         report_object.
5647         (Lib_group::do_for_all_unused_symbols): New function.
5648         (Add_lib_group_symbols::run): Report archive information for
5649         incremental links.
5650         * archive.h (class Library_base): New base class.
5651         (class Archive): Derive from Library_base.
5652         (Archive::filename): Move to base class.
5653         (Archive::set_incremental_info): Likewise.
5654         (Archive::incremental_info): Likewise.
5655         (Archive::Should_include): Likewise.
5656         (Archive::should_include_member): Likewise.
5657         (Archive::Armap_entry): Remove.
5658         (Archive::Unused_symbol_iterator): Remove.
5659         (Archive::unused_symbols_begin): Remove.
5660         (Archive::unused_symbols_end): Remove.
5661         (Archive::do_filename): New function.
5662         (Archive::do_get_mtime): New function.
5663         (Archive::do_for_all_unused_symbols): New function.
5664         (Archive::task_): Move to base class.
5665         (Archive::incremental_info_): Likewise.
5666         (class Lib_group): Derive from Library_base.
5667         (Lib_group::do_filename): New function.
5668         (Lib_group::do_get_mtime): New function.
5669         (Lib_group::do_for_all_unused_symbols): New function.
5670         (Lib_group::task_): Move to base class.
5671         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5672         function.
5673         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5674         function.
5675         * incremental.cc (Incremental_inputs::report_archive_begin):
5676         Use Library_base; call library's get_mtime; add incremental inputs
5677         entry before members.
5678         (class Unused_symbol_visitor): New class.
5679         (Incremental_inputs::report_archive_end): Use Library_base; use
5680         visitor class to record unused symbols; don't add incremental inputs
5681         entry after members.
5682         (Incremental_inputs::report_object): Use Library_base.
5683         * incremental.h
5684         (Incremental_archive_entry::Incremental_archive_entry): Remove
5685         unused Archive parameter.
5686         (Incremental_inputs::report_archive_begin): Use Library_base.
5687         (Incremental_inputs::report_archive_end): Likewise.
5688         (Incremental_inputs::report_object): Likewise.
5689         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5690         function.
5691         * object.h (Object::for_all_global_symbols): New function.
5692         (Object::do_for_all_global_symbols): New function.
5693         (Sized_relobj::do_for_all_global_symbols): New function.
5694         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5695         function.
5696         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5697         function.
5698
5699 2011-03-27  Ian Lance Taylor  <iant@google.com>
5700
5701         * archive.cc (Archive::interpret_header): Return -1 if something
5702         goes wrong.  Change callers accordingly.
5703
5704 2011-03-25  Cary Coutant  <ccoutant@google.com>
5705
5706         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5707         * testsuite/Makefile.in: Regenerate.
5708
5709 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5710
5711         * plugin.cc (get_view): New.
5712         (Plugin::load): Pass get_view to the plugin.
5713         (Plugin_manager::get_view): New.
5714
5715 2011-03-21  Ian Lance Taylor  <iant@google.com>
5716
5717         * testsuite/final_layout.sh: Rewrite to not use dc.
5718         * testsuite/relro_test.sh: Fail if dc is not present.
5719
5720 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5721
5722         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5723         Change == to -eq.
5724         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5725         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5726         Change == to -eq.
5727         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5728         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5729
5730 2011-03-14  Ian Lance Taylor  <iant@google.com>
5731
5732         * script-sections.cc (Sort_output_sections::script_compare):
5733         Rename from is_before, change return type.
5734         (Sort_output_sections::operator()): Adjust accordingly.
5735
5736 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5737
5738         PR gold/12572
5739         * testsuite/odr_violation2.cc: Add comment to make all error line
5740         numbers double digits.
5741         * testsuite/debug_msg.sh: Adjust expected errors.
5742
5743 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5744
5745         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5746         but mark earlier ones as non-canonical
5747         (offset_to_iterator): Update search target and example
5748         (do_addr2line): Return extra lines in a vector*
5749         (format_file_lineno): Extract from do_addr2line
5750         (one_addr2line): Add vector* out-param
5751         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5752         when a lineno entry appeared last for its instruction
5753         (Dwarf_line_info): Add vector* out-param
5754         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5755         * symtab.cc (Odr_violation_compare): Include the lineno in the
5756         comparison again.
5757         (linenos_from_loc): New. Combine the canonical line for an
5758         address with its other lines.
5759         (True_if_intersect): New. Helper functor to make
5760         std::set_intersection a query.
5761         (detect_odr_violations): Compare sets of lines instead of just
5762         one line for each function. This became less deterministic, but
5763         has fewer false positives.
5764         * symtab.h: Declarations.
5765         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5766         mix an optimized and non-optimized object in the same binary
5767         (odr_violation2.so): Same.
5768         * testsuite/Makefile.in: Regenerate from Makefile.am.
5769         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5770         * testsuite/debug_msg.sh: Update line numbers and add
5771         assertions.
5772         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5773         non-optimized context.
5774         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5775         isn't inlined, and use OdrDerived in an optimized context.
5776         * testsuite/odr_header1.h: Defines OdrDerived, where
5777         optimization will change the
5778         first-instruction-in-the-destructor's file and line number.
5779         * testsuite/odr_header2.h: Defines OdrBase.
5780
5781 2011-03-09  Ian Lance Taylor  <iant@google.com>
5782
5783         * fileread.cc (File_read::clear_views): Don't delete the whole
5784         file view.
5785
5786 2011-03-08  Ian Lance Taylor  <iant@google.com>
5787
5788         PR gold/12525
5789         * fileread.cc: #include <climits>.
5790         (GOLD_IOV_MAX): Define.
5791         (File_read::read_multiple): Limit number of entries by iov_max.
5792         * fileread.h (class File_read): Always set max_readv_entries to
5793         128.
5794
5795 2011-03-07  Ian Lance Taylor  <iant@google.com>
5796
5797         PR gold/12525
5798         * options.h (class General_options): Add -dy and -dn.
5799
5800 2011-03-02  Cary Coutant  <ccoutant@google.com>
5801
5802         * testsuite/script_test_9.t: Add TLS segment.
5803
5804 2011-03-02  Simon Baldwin  <simonb@google.com>
5805
5806         * configure.ac: Add check for gnu_indirect_function support in
5807         the toolchain building binutils.
5808         * configure: Rebuild.
5809
5810 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5811
5812         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5813         plugin only symbols.
5814         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5815         in plugin files as not needed in the symbol table.
5816
5817 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5818
5819         * output.cc (Output_section::add_input_section): Delay fill
5820         generation for section ordering.
5821
5822 2011-02-09  Ian Lance Taylor  <iant@google.com>
5823
5824         PR gold/12316
5825         * object.h (class Sized_relobj): Remove clear_local_symbols.
5826         * reloc.cc (Sized_relobj::do_relocate): Don't call
5827         clear_local_symbols.
5828
5829 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5830
5831         * plugin.cc (is_visible_from_outside): Return true for symbols
5832         in the -u option.
5833
5834 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5835
5836         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5837         filename.
5838
5839 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5840
5841         * icf.h (is_section_foldable_candidate): Change type of parameter
5842         to std::string.
5843         * icf.cc (Icf::find_identical_sections): Change type of local variable
5844         section_name to be std::string.
5845         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5846
5847 2011-01-25  Ian Lance Taylor  <iant@google.com>
5848
5849         * script.cc (script_add_extern): Rewrite to use
5850         add_symbol_reference.
5851
5852 2011-01-25  Doug Kwan  <dougkwan@google.com>
5853
5854         * icf.cc (get_section_contents): Always lock section's object.
5855
5856 2011-01-24  Ian Lance Taylor  <iant@google.com>
5857
5858         * options.h (class General_options): Accept
5859         --no-detect-odr-violations.
5860
5861 2011-01-24  Ian Lance Taylor  <iant@google.com>
5862
5863         * version.cc (version_string): Bump to 1.11.
5864
5865 2011-01-24  Ian Lance Taylor  <iant@google.com>
5866
5867         * plugin.cc (class Plugin_rescan): Define new class.
5868         (Plugin_manager::claim_file): Set any_claimed_.
5869         (Plugin_manager::save_archive): New function.
5870         (Plugin_manager::save_input_group): New function.
5871         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5872         necessary.
5873         (Plugin_manager::new_undefined_symbol): New function.
5874         (Plugin_manager::rescan): New function.
5875         (Plugin_manager::rescannable_defines): New function.
5876         (Plugin_manager::add_input_file): Set any_added_.
5877         * plugin.h (class Plugin_manager): define new fields rescannable_,
5878         undefined_symbols_, any_claimed_, and any_added_.  Declare
5879         Plugin_rescan as friend.  Declare new functions.
5880         (Plugin_manager::Rescannable): Define type.
5881         (Plugin_manager::Rescannable_list): Define type.
5882         (Plugin_manager::Undefined_symbol_list): Define type.
5883         (Plugin_manager::Plugin_manager): Initialize new fields.
5884         * archive.cc (Archive::defines_symbol): New function.
5885         (Add_archive_symbols::run): Pass archive to plugins if any.
5886         * archive.h (class Archive): Declare defines_symbol.
5887         * readsyms.cc (Input_group::~Input_group): New function.
5888         (Finish_group::run): Pass input_group to plugins if any.
5889         * readsyms.h (class Input_group): Declare destructor.
5890         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5891         any.
5892
5893 2011-01-10  Ian Lance Taylor  <iant@google.com>
5894
5895         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5896         section as relro.
5897         (Layout::set_segment_offsets): Reset increase_relro before calling
5898         set_section_addresses a second time.
5899
5900 2011-01-04  Cary Coutant  <ccoutant@google.com>
5901
5902         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5903         sections before NOBITS sections.
5904
5905 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5906
5907         * version.cc (print_version): Update copyright to 2011.
5908
5909 2010-12-23  Cary Coutant  <ccoutant@google.com>
5910
5911         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5912         of OS to this->add.  Add OD parameter to second form of the function.
5913
5914 2010-12-20  Ian Lance Taylor  <iant@google.com>
5915
5916         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5917         second of two consecutive entries with same offset.
5918
5919 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5920
5921         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5922         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5923         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5924         to avoid unneeded links against $(LDADD).
5925         * testsuite/Makefile.in: Regenerate.
5926
5927 2010-12-15  Ian Lance Taylor  <iant@google.com>
5928
5929         PR gold/12324
5930         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5931         for R_X86_64_32 and R_X86_64_PC32.
5932         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5933         ver_matching_def_pic.o.
5934         (ver_matching_def_pic.o): New target.
5935
5936 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5937
5938         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5939         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5940         Move definition before File_read::View member definitions.
5941         (File_read::View::~View): Initialize and hold lock before
5942         updating current_mapped_bytes.
5943
5944 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5945
5946         * dwarf_reader.cc: Remove outdated comment.
5947         * gold-threads.cc: Fix typo in error message.
5948         * archive.cc: Fix typos in comments.
5949         * archive.h: Likewise.
5950         * arm-reloc-property.cc: Likewise.
5951         * arm-reloc-property.h: Likewise.
5952         * arm-reloc.def: Likewise.
5953         * arm.cc: Likewise.
5954         * attributes.h: Likewise.
5955         * cref.cc: Likewise.
5956         * ehframe.cc: Likewise.
5957         * fileread.h: Likewise.
5958         * gold.h: Likewise.
5959         * i386.cc: Likewise.
5960         * icf.cc: Likewise.
5961         * incremental.h: Likewise.
5962         * int_encoding.cc: Likewise.
5963         * layout.h: Likewise.
5964         * main.cc: Likewise.
5965         * merge.h: Likewise.
5966         * object.cc: Likewise.
5967         * object.h: Likewise.
5968         * options.cc: Likewise.
5969         * readsyms.cc: Likewise.
5970         * reduced_debug_output.cc: Likewise.
5971         * reloc.cc: Likewise.
5972         * script-sections.cc: Likewise.
5973         * sparc.cc: Likewise.
5974         * symtab.h: Likewise.
5975         * target-reloc.h: Likewise.
5976         * target.cc: Likewise.
5977         * target.h: Likewise.
5978         * timer.cc: Likewise.
5979         * timer.h: Likewise.
5980         * x86_64.cc: Likewise.
5981
5982 2010-12-09  Cary Coutant  <ccoutant@google.com>
5983
5984         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5985         stack.
5986         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5987         parameter; change all callers.
5988         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5989         * options.h (warn_execstack): New option.
5990
5991 2010-12-07  Doug Kwan  <dougkwan@google.com>
5992
5993         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5994         like function call relocations.
5995
5996 2010-12-07  Ian Lance Taylor  <iant@google.com>
5997
5998         * archive.cc (Archive::get_elf_object_for_member): Permit
5999         punconfigured to be NULL.
6000         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6001         (Archive::include_member): Pass NULL to get_elf_object_for_member
6002         if we searched for the archive and this is the first included
6003         object.
6004
6005 2010-12-01  Ian Lance Taylor  <iant@google.com>
6006
6007         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6008         track_relocs_type_ field.
6009         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6010         Set track_relocs_type_.
6011         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6012         contents when using RELA relocs.
6013         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6014         reloc_map_.
6015         * reloc.cc (Track_relocs::next_addend): New function.
6016         * reloc.h (class Track_relocs): Declare next_addend.
6017
6018 2010-12-01  Ian Lance Taylor  <iant@google.com>
6019
6020         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6021         virtual destructor.
6022
6023 2010-12-01  Ian Lance Taylor  <iant@google.com>
6024
6025         * README: Update compilers known to work and fail.
6026
6027 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6028
6029         * configure.in: For --enable-gold, handle value `default' instead of
6030         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6031         not the default.
6032         * configure: Regenerate.
6033
6034 2010-11-18  Doug Kwan  <dougkwan@google.com>
6035
6036         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6037         and right_alignment to be zero.  Store result alignment only if it is
6038         greater than existing alignment.
6039
6040 2010-11-16  Cary Coutant  <ccoutant@google.com>
6041
6042         PR gold/12220
6043         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6044         Check for ".zdebug_line".
6045
6046 2010-11-16  Doug Kwan  <dougkwan@google.com>
6047             Cary Coutant  <ccoutant@google.com>
6048
6049         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6050         by reference; adjust all callers.
6051         * output.cc (Output_segment::set_section_addresses): Adjust references
6052         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6053         list is empty.
6054         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6055         end at page boundary.
6056
6057 2010-11-16  Cary Coutant  <ccoutant@google.com>
6058
6059         PR gold/12220
6060         * layout.cc (Layout::choose_output_section): Transform names of
6061         compressed sections even when using a script with a SECTIONS clause.
6062         (Layout::output_section_name): Remove code to transform
6063         compressed debug section names.
6064         * output.cc (Output_section::add_input_section): Use uncompressed
6065         section size when tracking input sections.
6066
6067 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6068
6069         * symtab.h (Symbol::NON_PIC_REF): Remove.
6070         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6071         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6072         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6073         (Symbol::use_plt_offset): Take a flags argument and pass it
6074         directly to needs_dynamic_reloc.  Restrict check for undefined
6075         weak symbols to function calls.
6076         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6077         (Target_arm::Scan::global): Use it.
6078         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6079         (Target_arm::Relocate::relocate): Likewise.
6080         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6081         parameter with an r_type parameter.  Use get_reference_flags
6082         to get the flags.
6083         (Target_arm::Relocate::relocate): Update accordingly.
6084         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6085         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6086         (Target_i386::Scan::global): Likewise.
6087         (Target_i386::Relocate::relocate): Likewise.
6088         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6089         parameter with an r_type parameter.  Use get_reference_flags
6090         to get the flags.
6091         (Target_i386::Relocate::relocate): Update accordingly.
6092         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6093         (Target_powerpc::Scan::global): Use it.
6094         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6095         (Target_powerpc::Relocate::relocate): Likewise.
6096         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6097         (Target_sparc::Scan::global): Use it.
6098         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6099         (Target_sparc::Relocate::relocate): Likewise.
6100         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6101         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6102         (Target_x86_64::Scan::global): Likewise.
6103         (Target_x86_64::Relocate::relocate): Likewise.
6104
6105 2010-11-08  Doug Kwan  <dougkwan@google.com>
6106             Cary Coutant  <ccoutant@google.com>
6107
6108         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6109         (Arm_exidx_merge_section::section_contents_): New data member.
6110         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6111         (Arm_input_section::~Arm_input_section): De-allocate memory.
6112         (Arm_input_section::original_contents_): New data member.
6113         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6114         in parameters instead of calling Object::section_contents without
6115         locking.
6116         (Arm_output_section::group_section): New parameter TASK.  Pass it
6117         to callees that need locking objects.
6118         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6119         to lock EXIDX input sections.  Fix a formatting issue.  Call
6120         Arm_exidx_merged_section::build_contents to create merged section
6121         contents.
6122         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6123         to lock object of stub table owner.
6124         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6125         TEXT_SIZE to initialize data member TEXT_SIZE_.
6126         (Arm_exidx_input_section::addralign): Fix typo in comment.
6127         (Arm_exidx_input_section::text_size): New method.
6128         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6129         that require locking objects.  Lock objects before scanning for stubs
6130         and updating local symbols.
6131         (Arm_input_section<big_endian>::init): Copy contents of original
6132         input section.
6133         (Arm_input_section<big_endian>::do_write): Use saved contents of
6134         original input section instead of calling Object::section_contents
6135         without locking.
6136         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6137         size without calling Object::section_size().
6138         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6139         for size.  Allocate a buffer for merged EXIDX entries.
6140         (Arm_exidx_merged_section::build_contents): New method.
6141         (Arm_exidx_merged_section::do_write): Move merge section contents
6142         building code to Arm_exidx_merged_section::build_contetns.  Write
6143         out contetns in buffer instead of building it on the fly.
6144         (Arm_relobj::make_exidx_input_section): Also pass text section size
6145         to Arm_exidx_input_section constructor.
6146         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6147         (Arm_dynobj::do_read_symbols): Fix memory leak.
6148         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6149         * target.h: (class Task): Add forward declaration.
6150         (Target::relax): Add new parameter TASK and pass it to
6151         Target::do_relax().
6152         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6153
6154 2010-11-05  Cary Coutant  <ccoutant@google.com>
6155
6156         PR gold/10708
6157         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6158         object when reading from the file.
6159         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6160         second layout pass.
6161         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6162         when reading section contents.
6163         (get_section_contents): Likewise.
6164         (icf::find_identical_sections): Likewise.
6165         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6166         object when reading from the file.
6167         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6168         the object when doing deferred section layout.
6169
6170 2010-11-03  Nick Clifton  <nickc@redhat.com>
6171
6172         PR gold/12001
6173         * script.h (class Symbol_assignment: name): New member.  Returns
6174         the name of the symbol.
6175         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6176         Returns true if the given symbol name is on the list of
6177         assignments wating to be processed.
6178         * archive.cc (should_incldue_member): If the symbol is undefined,
6179         check to see if it is on the list of symbols pending assignment.
6180
6181 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6182
6183         * script-sections.cc (Script_sections::find_memory_region): Check
6184         for a NULL output section pointer.
6185
6186 2010-10-29  Doug Kwan  <dougkwan@google.com>
6187
6188         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6189         Output_section::add_relaxed_input_section.
6190         * output.cc (Output_section::add_relaxed_input_section): Add new
6191         arguments LAYOUT and NAME.  Set section order index.
6192         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6193         Copy section order index.
6194         * output.h (Output_section::add_relaxed_input_section): Add new
6195         arguments LAYOUT and NAME.
6196
6197 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6198
6199         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6200         NATIVE_OR_CROSS_LINKER.
6201         * testsuite/Makefile.in: Regenerate.
6202
6203 2010-10-20  Doug Kwan  <dougkwan@google.com>
6204
6205         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6206         without SHF_LINK_ORDER flags.
6207         * layout.cc (Layout::choose_output_section): Do not filter
6208         SHF_LINK_ORDER flag in a relocatable link.
6209
6210 2010-10-17  Cary Coutant  <ccoutant@google.com>
6211
6212         * output.h (Output_segment::set_section_addresses): Change function
6213         signature.  Update all callers.
6214         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6215         sections.
6216         (Output_segment::set_section_addresses): Align after last TLS
6217         section.  Add padding before last relro section instead of after.
6218
6219 2010-10-17  Doug Kwan  <dougkwan@google.com>
6220
6221         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6222         GOT output section to be writable.
6223
6224 2010-10-14  Cary Coutant  <ccoutant@google.com>
6225
6226         * debug.h (DEBUG_INCREMENTAL): New flag.
6227         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6228         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6229         mode.
6230         * incremental.cc (report_command_line): Ignore all forms of
6231         --incremental.
6232         * layout.cc (Layout::Layout): Check parameters for incremental link
6233         mode.
6234         * options.cc (General_options::parse_incremental): New function.
6235         (General_options::parse_no_incremental): New function.
6236         (General_options::parse_incremental_full): New function.
6237         (General_options::parse_incremental_update): New function.
6238         (General_options::incremental_mode_): New data member.
6239         (General_options::finalize): Check incremental_mode_.
6240         * options.h (General_options): Update help text for --incremental.
6241         Add --no-incremental, --incremental-full, --incremental-update.
6242         (General_options::Incremental_mode): New enum type.
6243         (General_options::incremental_mode): New function.
6244         (General_options::incremental_mode_): New data member.
6245         * parameters.cc (Parameters::incremental_mode_): New data member.
6246         (Parameters::set_options): Set incremental_mode_.
6247         (Parameters::set_incremental_full): New function.
6248         (Parameters::incremental): New function.
6249         (Parameters::incremental_update): New function.
6250         (set_parameters_incremental_full): New function.
6251         * parameters.h (Parameters::set_incremental_full): New function.
6252         (Parameters::incremental): New function.
6253         (Parameters::incremental_update): New function.
6254         (Parameters::incremental_mode_): New data member.
6255         (set_parameters_incremental_full): New function.
6256         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6257         incremental link mode.
6258         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6259         (Sized_relobj::do_relocate_sections): Likewise.
6260         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6261         option.
6262         * testsuite/Makefile.in: Regenerate.
6263         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6264
6265 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6266
6267         * script-sections.h (class Script_sections): Make
6268         Sections_elements typedef public.
6269         * script-sections.cc (class Sort_output_sections): Add elements_
6270         field.  Add constructor which sets it; change all callers.
6271         (Sort_output_sections::is_before): New function.
6272         (Sort_output_sections::operator()): Call is_before.
6273         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6274         conditional.
6275         * testsuite/script_test_10.sh: New test. Test script section
6276         order.
6277         * testsuite/script_test_10.t: Likewise.
6278         * testsuite/script_test_10.s: Likewise.
6279         * testsuite/Makefile.am: Wrap the cross linker tests and the
6280         common tests into NATIVE_OR_CROSS_LINKER.
6281         (check_SCRIPTS): Add script_test_10.sh.
6282         (check_DATA): Add script_test_10.stdout.
6283         (script_test_10.o, script_test_10): New targets.
6284         (script_test_10.stdout): New target.
6285         * configure, testsuite/Makefile.in: Regenerate.
6286
6287 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6288
6289         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6290         error for the deprecated relocations.
6291         (Target_arm::Scan::global): Likewise.
6292         (Target_arm::Relocate::relocate): Likewise.
6293
6294 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6295
6296         * fileread.cc (Input_file::find_file): Initialize *found_name
6297         and *namep when using the fallback search for case 4.
6298
6299 2010-10-11  Cary Coutant  <ccoutant@google.com>
6300
6301         * options.h (class General_options): Redefine -z lazy as an alias for
6302         the negation of -z now.
6303
6304 2010-10-11  Ian Lance Taylor  <iant@google.com>
6305
6306         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6307         binding.
6308
6309 2010-10-06  Nick Clifton  <nickc@redhat.com>
6310
6311         * script-sections.cc(class Memory_region): Remove
6312         current_lma_offset_ field.  Rename current_vma_offset_ to
6313         current_offset_.  Add last_section_ field.
6314         (Memory_region::get_current_vma_address): Rename to
6315         get_current_address.
6316         (Memory_region::get_current_lma_address): Delete.
6317         (Memory_region::increment_vma_offset): Rename to
6318         increment_offset.
6319         (Memory_region::increment_lma_offset): Delete.
6320         (Memory_region::attributes_compatible): New method.  Returns
6321         true if the provided section is compatible with the region.
6322         (Memory_region::get_last_section): New method.  Returns the last
6323         section to use the region.
6324         (Memory_region::set_last_section): New method.  Stores the last
6325         section to use the region.
6326         (Script_sections::block_in_region): New method.  Returns true if
6327         a block of memory is contained within a region.
6328         (Script_sections::find_memory_region): New method.  Locates a
6329         memory region to be used to set a VMA or LMA address.
6330         (Output_section_definition::set_section_addresses): Add code to
6331         check for addresses set by memory regions.
6332         (Output_segment::set_section_addresses): Remove memory region
6333         walking code.
6334         (Script_sections::create_segment): Add a warning if a header
6335         segment is created outside of any region.
6336         * script-sections.h (class Script_sections): Add prototypes for
6337         find_memory_region and block_in_region methods.
6338         * testsuite/memory_test.s: Use .long instead of .word.
6339         * testsuite/memory_test.t: Add some more output sections.
6340         * testsuite/memory_test.sh: Update expected output.
6341
6342 2010-10-02  Doug Kwan  <dougkwan@google.com>
6343
6344         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6345         defintion to symtab.h
6346         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6347         declaration to defintion.
6348
6349 2010-10-01  Nick Clifton  <nickc@redhat.com>
6350
6351         * expression.cc (eval): Replace dummy argument with NULL.
6352         (eval_maybe_dot): Check for a NULL result section pointer.
6353         (Symbol_expression::value): Likewise.
6354         (Dot_expression::value): Likewise.
6355         (BINARY_EXPRESSION): Likewise.
6356         (Max_expression::value): Likewise.
6357         (Min_expression::value): Likewise.
6358         (Absolute_expression::value): Likewise.
6359         (Addr_expression::value_from_output_section): Likewise.
6360         (Loaddddr_expression::value_from_output_section): Likewise.
6361         (Segment_start_expression::value): Likewise.
6362         * script-sections.cc
6363         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6364         argument with NULL.
6365         (Sections_elememt_dot_assignment::set_section_addresses):
6366         Likewise.
6367         (Output_data_expression::do_write_to_buffer): Likewise.
6368         (Output_section_definition::finalize_symbols): Likewise.
6369         (Output_section_definition::set_section_addresses): Likewise.
6370
6371 2010-09-30  Doug Kwan  <dougkwan@google.com>
6372
6373         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6374
6375 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6376
6377         * target.h (Target::can_icf_inline_merge_sections): New virtual
6378         function.
6379         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6380         virtual function.
6381         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6382         virtual function.
6383         * icf.cc (get_section_contents): Inline merge sections only when
6384         target allows it.
6385
6386 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6387
6388         * configure: Regenerate.
6389
6390 2010-09-17  Ian Lance Taylor  <iant@google.com>
6391
6392         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6393         * testsuite/Makefile.am (memory_test.o): New target.
6394         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6395         memory_test.t.
6396         * testsuite/Makefile.in: Rebuild.
6397
6398 2010-09-17  Doug Kwan  <dougkwan@google.com>
6399
6400         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6401         defintion if relocation uses GOT entries of the symbol.
6402         * testsuite/icf_safe_test.sh: Fix test.
6403         * testsuite/icf_safe_so_test.sh: Fix test.
6404
6405 2010-09-16  Cary Coutant  <ccoutant@google.com>
6406
6407         * script_sections.cc (class Memory_region): Remove "NULL" from
6408         vector initializations.
6409
6410 2010-09-15  Cary Coutant  <ccoutant@google.com>
6411
6412         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6413         Resolve forwarding symbols.
6414
6415 2010-09-15  Doug Kwan  <dougkwan@google.com>
6416
6417         * gold/testsuite/script_test_3.t: Add ARM special sections.
6418         * gold/testsuite/script_test_4.t: Same.
6419         * gold/testsuite/script_test_5.t: Same.
6420         * gold/testsuite/script_test_6.t: Same.
6421         * gold/testsuite/script_test_7.t: Same.
6422         * gold/testsuite/script_test_7.t: Same.
6423         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6424
6425 2010-09-14  Cary Coutant  <ccoutant@google.com>
6426
6427         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6428         (Target_x86_64::Relocate::relocate_tls): Replace check for
6429         saw_tls_block_reloc_ with test for executable section.
6430
6431 2010-09-12  Cary Coutant  <ccoutant@google.com>
6432
6433         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6434         position-independent executables to shared libraries need dynamic
6435         relocations.
6436         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6437         position-independent executables.
6438         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6439         * testsuite/Makefile.in: Regenerate.
6440
6441 2010-09-10  Nick Clifton  <nickc@redhat.com>
6442
6443         PR gold/11997
6444         * testsuite/memory_test.t: Discard any sections that are not
6445         needed.
6446
6447 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6448
6449         PR gold/11996
6450         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6451         "This::" to work around a bug in gcc 4.2.
6452
6453         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6454
6455 2010-09-09  Rafael Espindola  <espindola@google.com>
6456
6457         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6458         sections with different PF_X flags in the same segment.
6459         (Layout::find_first_load_seg): Search all segments to find the first
6460         one.
6461         * options.h (rosegment): New.
6462
6463 2010-09-08  Rafael Espindola  <espindola@google.com>
6464
6465         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6466
6467 2010-09-08  Doug Kwan  <dougkwan@google.com>
6468
6469         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6470         (Arm_relobj::do_relocate_sections): Add new parameter for output
6471         file to match the parent.
6472         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6473         of local symbols instead of input values.  Update code to track
6474         changes in gold::relocate_section.
6475         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6476         (Sized_relobj::compute_final_local_value_internal): New methods.
6477         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6478         body into private version of Sized_relobj::compute_final_local_value.
6479         Call the inline method.
6480         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6481         merged symbol value if there is one.
6482         (Symbol_value::has_output_value): New method defintiion.
6483         (Sized_relobj::Compute_final_local_value_status): New enum type.
6484         (Sized_relobj::compute_final_local_value): New methods.
6485         (Sized_relobj::compute_final_local_value_internal): New methods.
6486         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6487         and arm_cortex_a8.sh.
6488         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6489         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6490         New tests.
6491         * Makefile.in: Regenerate.
6492         * testsuite/arm_bl_out_of_range.s: Update test.
6493         * testsuite/thumb_bl_out_of_range.s: Ditto.
6494         * testsuite/thumb_blx_out_of_range.s: Ditto.
6495         * testsuite/arm_branch_out_of_range.sh: New file.
6496         * testsuite/arm_cortex_a8.sh: Ditto.
6497         * testsuite/arm_cortex_a8_b.s: Ditto.
6498         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6499         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6500         * testsuite/arm_cortex_a8_bl.s: Ditto.
6501         * testsuite/arm_cortex_a8_blx.s: Ditto.
6502         * testsuite/arm_cortex_a8_local.s: Ditto.
6503         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6504         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6505
6506 2010-09-08  Rafael Espindola  <espindola@google.com>
6507
6508         * Makefile.am (memory_test.stdout): Run readelf with -W.
6509         * Makefile.in: Regenerate.
6510         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6511         64 bit output.
6512
6513 2010-09-08  Rafael Espindola  <espindola@google.com>
6514
6515         * script-sections.cc (Script_sections::add_memory_region): Convert
6516         field precision to int.
6517         * script.cc (script_set_section_region, script_set_section_region):
6518         Convert field precision to int.
6519
6520 2010-09-08  Rafael Espindola  <espindola@google.com>
6521
6522         * arm.cc (do_finalize_sections): Create the __exidx_start and
6523         __exdix_end symbols even when the section is missing.
6524
6525 2010-09-08  Nick Clifton  <nickc@redhat.com>
6526
6527         * README: Remove claim that MEMORY is not supported.
6528         * expression.cc (script_exp_function_origin)
6529         (script_exp_function_length): Move from here to ...
6530         * script.cc: ... here.
6531         (script_set_section_region, script_add_memory)
6532         (script_parse_memory_attr, script_include_directive): New
6533         functions.
6534         * script-sections.cc
6535         (class Memory_region): New class.
6536         (class Output_section_definition): Add set_memory_region,
6537         set_section_vma, set_section_lma and get_section_name methods.
6538         (class Script_Sections): Add add_memory_region,
6539         find_memory_region, find_memory_region_origin,
6540         find_memory_region_length and set_memory_region methods.
6541         Have set_section_addresses method walk the list of set memory
6542         regions.
6543         Extend the print methos to display memory regions.
6544         * script-sections.h: Add prototypes for new methods.
6545         Add enum for MEMORY region attributes.
6546         * yyscript.y: Add support for parsing MEMORY regions.
6547         * script-c.h: Add prototypes for new functions.
6548         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6549         * testsuite/Makefile.in: Regenerate.
6550         * testsuite/memory_test.sh: New script.
6551         * testsuite/memory_test.s: New assembler source file.
6552         * testsuite/memory_test.t: New linker script.
6553
6554 2010-08-27  Doug Kwan  <dougkwan@google.com>
6555
6556         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6557         reference override an existing dynamic weak reference.
6558         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6559         * testsuite/Makefile.in: Regenerate.
6560         * testsuite/dyn_weak_ref.sh: New file.
6561         * testsuite/dyn_weak_ref_1.c: Ditto.
6562         * testsuite/dyn_weak_ref_2.c: Ditto.
6563
6564 2010-08-27  Ian Lance Taylor  <iant@google.com>
6565
6566         * incremental.h (class Incremental_input_entry): Add virtual
6567         destructor.
6568
6569 2010-08-27  Ian Lance Taylor  <iant@google.com>
6570
6571         * testsuite/start_lib_test_3.c: Mark t3 as used.
6572
6573 2010-08-27  Nick Clifton  <nickc@redhat.com>
6574
6575         * options.cc (version_script): Fix small typo in previous
6576         whitespace tidyup.
6577
6578 2010-08-25  Nick Clifton  <nickc@redhat.com>
6579
6580         * archive.cc: Formatting fixes: Remove whitespace between
6581         typename and following asterisk.  Remove whitespace between
6582         function name and opening parenthesis.
6583         * archive.h: Likewise.
6584         * arm.cc: Likewise.
6585         * attributes.cc: Likewise.
6586         * attributes.h: Likewise.
6587         * common.cc: Likewise.
6588         * copy-relocs.cc: Likewise.
6589         * dirsearch.h: Likewise.
6590         * dynobj.cc: Likewise.
6591         * ehframe.cc: Likewise.
6592         * ehframe.h: Likewise.
6593         * expression.cc: Likewise.
6594         * fileread.cc: Likewise.
6595         * fileread.h: Likewise.
6596         * gc.h: Likewise.
6597         * gold-threads.cc: Likewise.
6598         * gold.cc: Likewise.
6599         * i386.cc: Likewise.
6600         * icf.h: Likewise.
6601         * incremental-dump.cc: Likewise.
6602         * incremental.cc: Likewise.
6603         * layout.cc: Likewise.
6604         * layout.h: Likewise.
6605         * main.cc: Likewise.
6606         * merge.cc: Likewise.
6607         * merge.h: Likewise.
6608         * object.cc: Likewise.
6609         * object.h: Likewise.
6610         * options.cc: Likewise.
6611         * options.h: Likewise.
6612         * output.cc: Likewise.
6613         * output.h: Likewise.
6614         * plugin.cc: Likewise.
6615         * plugin.h: Likewise.
6616         * powerpc.cc: Likewise.
6617         * reloc.cc: Likewise.
6618         * script-c.h: Likewise.
6619         * script-sections.cc: Likewise.
6620         * script.cc: Likewise.
6621         * stringpool.cc: Likewise.
6622         * symtab.cc: Likewise.
6623         * symtab.h: Likewise.
6624         * target.cc: Likewise.
6625         * timer.cc: Likewise.
6626         * timer.h: Likewise.
6627         * version.cc: Likewise.
6628         * x86_64.cc: Likewise.
6629
6630 2010-08-24  Nick Clifton  <nickc@redhat.com>
6631
6632         PR 11899
6633         * layout.cc (segment_precedes): Sort segments by their physical
6634         addresses, if they have been set.
6635
6636 2010-08-23  Cary Coutant  <ccoutant@google.com>
6637
6638         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6639         symbols data.
6640         (Lib_group::include_member): Unlock object after deleting its
6641         symbols data.
6642         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6643         the bug fixed here.
6644
6645 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6646             Cary Coutant  <ccoutant@google.com>
6647
6648         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6649         constructor, and set_blocker.
6650         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6651         readsyms_blocker_.
6652         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6653         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6654         * testsuite/Makefile.am (start_lib_test): New test case.
6655         * testsuite/Makefile.in: Regenerate.
6656         * testsuite/start_lib_test_main.c: New file.
6657         * testsuite/start_lib_test_1.c: New file.
6658         * testsuite/start_lib_test_2.c: New file.
6659         * testsuite/start_lib_test_3.c: New file.
6660
6661 2010-08-19  Ian Lance Taylor  <iant@google.com>
6662
6663         * Makefile.in: Rebuild with automake 1.11.1.
6664         * aclocal.m4: Likewise.
6665         * testsuite/Makefile.in: Likewise.
6666
6667 2010-08-19  Ian Lance Taylor  <iant@google.com>
6668
6669         PR 10893
6670         * i386.cc (class Output_data_plt_i386): Update declarations.
6671         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6672         local_ifuncs_ fields.
6673         (Target_i386::do_plt_section_for_global): New function.
6674         (Target_i386::do_plt_section_for_local): New function.
6675         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6676         parameter; change all callers.  Initialize global_ifuncs_ and
6677         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6678         __rel_iplt_end.
6679         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6680         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6681         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6682         symbols.
6683         (Target_i386::make_plt_section): New function, broken out of
6684         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6685         (Target_i386::make_plt_entry): Call make_plt_section.
6686         (Target_i386::make_local_ifunc_plt_entry): New function.
6687         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6688         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6689         R_386_IRELATIVE to switch.
6690         (Target_i386::Scan::global): Likewise.
6691         (Target_i386::Relocate::relocate): Likewise.
6692         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6693         switch.
6694         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6695         (Target_x86_64::do_plt_section_for_global): New function.
6696         (Target_x86_64::do_plt_section_for_local): New function.
6697         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6698         parameter; change all callers.  If doing a static link define
6699         __rela_iplt_start and __rela_iplt_end.
6700         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6701         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6702         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6703         to point to .plt.
6704         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6705         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6706         switch.
6707         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6708         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6709         R_X86_64_IRELATIVE to switch.
6710         (Target_x86_64::Scan::global): Likewise.
6711         (Target_x86_64::Relocate::relocate): Likewise.
6712         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6713         switch.
6714         * target.h (class Target): Add plt_section_for_global and
6715         plt_section_for_local functions.  Add do_plt_section_for_global
6716         and do_plt_section_for_local virtual functions.
6717         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6718         clarifying comments.
6719         (Symbol::use_plt_offset): Handle IFUNC symbol.
6720         * object.cc (Sized_relobj::Sized_relobj): Initialize
6721         local_plt_offsets_.
6722         (Sized_relobj::local_has_plt_offset): New function.
6723         (Sized_relobj::local_plt_offset): New function.
6724         (Sized_relobj::set_local_plt_offset): New function.
6725         (Sized_relobj::do_count): Handle IFUNC symbol.
6726         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6727         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6728         is_ifunc_symbol functions.
6729         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6730         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6731         local_plt_offsets_ field.
6732         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6733         * output.h (class Output_section_data): Add non-const
6734         output_section function.
6735         (class Output_data_got): Update declarations.
6736         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6737         Add use_plt_offset parameter to global and local constructors.
6738         Change all callers.  Change local_sym_index_ field to 31 bits.
6739         Change GSYM_CODE and CONSTANT_CODE accordingly.
6740         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6741         doing a static link don't set sh_link field.
6742         (Output_data_got::Got_entry::write): Use PLT offset if
6743         appropriate.
6744         (Output_data_got::add_global_plt): New function.
6745         (Output_data_got::add_local_plt): New function.
6746         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6747         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6748         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6749         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6750         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6751         IFUNC conditional.
6752         * testsuite/ifunc-sel.h: New file.
6753         * testsuite/ifuncmain1.c: New file.
6754         * testsuite/ifuncmain1vis.c: New file.
6755         * testsuite/ifuncmod1.c: New file.
6756         * testsuite/ifuncdep2.c: New file.
6757         * testsuite/ifuncmain2.c: New file.
6758         * testsuite/ifuncmain3.c: New file.
6759         * testsuite/ifuncmod3.c: New file.
6760         * testsuite/ifuncmain4.c: New file.
6761         * testsuite/ifuncmain5.c: New file.
6762         * testsuite/ifuncmod5.c: New file.
6763         * testsuite/ifuncmain6pie.c: New file.
6764         * testsuite/ifuncmod6.c: New file.
6765         * testsuite/ifuncmain7.c: New file.
6766         * configure, testsuite/Makefile.in: Rebuild.
6767
6768 2010-08-18  Ian Lance Taylor  <iant@google.com>
6769
6770         * incremental.cc
6771         (Output_section_incremental_inputs::write_input_files): Add cast
6772         to avoid signed/unsigned comparison warning.
6773         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6774
6775 2010-08-12  Cary Coutant  <ccoutant@google.com>
6776
6777         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6778
6779 2010-08-13  Ian Lance Taylor  <iant@google.com>
6780
6781         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6782
6783 2010-08-12  Cary Coutant  <ccoutant@google.com>
6784             Doug Kwan  <dougkwan@google.com>
6785
6786         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6787         defintion overrides non-weak undef, remember that the original undef
6788         is not weak.
6789         * symtab.cc (Symbol_table::sized_write_global): For undef without
6790         an original weak binding, set binding to global in output.
6791         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6792         * testsuite/Makefile.in: Regenerate.
6793         * testsuite/strong_ref_weak_def.sh: New file.
6794         * testsuite/strong_ref_weak_def_1.c: Ditto.
6795         * testsuite/strong_ref_weak_def_2.c: Ditto.
6796
6797 2010-08-12  Cary Coutant  <ccoutant@google.com>
6798
6799         * testsuite/incremental_test.sh: Rewrite.
6800         * testsuite/incremental_test_1.c: Rewrite.
6801         * testsuite/incremental_test_2.c: Rewrite.
6802
6803 2010-08-12  Cary Coutant  <ccoutant@google.com>
6804
6805         * arm.cc (Target_arm::got_size): Add const.
6806         (Target_arm::got_entry_count): New function.
6807         (Target_arm::plt_entry_count): New function.
6808         (Target_arm::first_plt_entry_offset): New function.
6809         (Target_arm::plt_entry_size): New function.
6810         (Output_data_plt_arm::entry_count): New function.
6811         (Output_data_plt_arm::first_plt_entry_offset): New function.
6812         (Output_data_plt_arm::get_plt_entry_size): New function.
6813         * i386.cc (Target_i386::got_size): Add const.
6814         (Target_i386::got_entry_count): New function.
6815         (Target_i386::plt_entry_count): New function.
6816         (Target_i386::first_plt_entry_offset): New function.
6817         (Target_i386::plt_entry_size): New function.
6818         (Output_data_plt_i386::entry_count): New function.
6819         (Output_data_plt_i386::first_plt_entry_offset): New function.
6820         (Output_data_plt_i386::get_plt_entry_size): New function.
6821         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6822         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6823         * incremental.cc: Include target.h.
6824         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6825         parameter.  Adjust all callers.  Find incremental_got_plt section.
6826         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6827         section.
6828         (Output_section_incremental_inputs::set_final_data_size): Calculate
6829         size of incremental_got_plt section.
6830         (Output_section_incremental_inputs::do_write): Write the
6831         incremental_got_plt section.
6832         (Got_plt_view_info): New struct.
6833         (Local_got_offset_visitor): New class.
6834         (Global_got_offset_visitor): New class.
6835         (Global_symbol_visitor_got_plt): New class.
6836         (Output_section_incremental_inputs::write_got_plt): New function.
6837         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6838         Add parameter.  Adjust all callers.
6839         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6840         (Incremental_inputs::got_plt_section): New function.
6841         (Incremental_inputs::got_plt_section_): New data member.
6842         (Incremental_got_plt_reader): New class.
6843         * layout.cc (Layout::create_incremental_info_sections): Add the
6844         incremental_got_plt section.
6845         * object.h (Got_offset_list::get_list): New function.
6846         (Got offset_list::for_all_got_offsets): New function.
6847         (Sized_relobj::local_got_offset_list): New function.
6848         * powerpc.cc (Target_powerpc::got_size): Add const.
6849         (Target_powerpc::got_entry_count): New function.
6850         (Target_powerpc::plt_entry_count): New function.
6851         (Target_powerpc::first_plt_entry_offset): New function.
6852         (Target_powerpc::plt_entry_size): New function.
6853         (Output_data_plt_powerpc::entry_count): New function.
6854         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6855         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6856         * sparc.cc (Target_sparc::got_size): Add const.
6857         (Target_sparc::got_entry_count): New function.
6858         (Target_sparc::plt_entry_count): New function.
6859         (Target_sparc::first_plt_entry_offset): New function.
6860         (Target_sparc::plt_entry_size): New function.
6861         (Output_data_plt_sparc::entry_count): New function.
6862         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6863         (Output_data_plt_sparc::get_plt_entry_size): New function.
6864         * symtab.h (Symbol::got_offset_list): New function.
6865         (Symbol_table::for_all_symbols): New function.
6866         * target.h (Sized_target::got_entry_count): New function.
6867         (Sized_target::plt_entry_count): New function.
6868         (Sized_target::plt_entry_size): New function.
6869         * x86_64.cc (Target_x86_64::got_size): Add const.
6870         (Target_x86_64::got_entry_count): New function.
6871         (Target_x86_64::plt_entry_count): New function.
6872         (Target_x86_64::first_plt_entry_offset): New function.
6873         (Target_x86_64::plt_entry_size): New function.
6874         (Output_data_plt_x86_64::entry_count): New function.
6875         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6876         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6877
6878 2010-08-12  Cary Coutant  <ccoutant@google.com>
6879
6880         * archive.cc: Include incremental.h.
6881         (Archive::Archive): Initialize incremental_info_.
6882         (Archive::include_member): Record archive members in incremental info.
6883         (Add_archive_symbols::run): Record begin and end of an archive in
6884         incremental info.
6885         (Lib_group::include_member): Record objects in incremental info.
6886         * archive.h (Incremental_archive_entry): Forward declaration.
6887         (Archive::set_incremental_info): New member function.
6888         (Archive::incremental_info): New member function.
6889         (Archive::Unused_symbol_iterator): New class.
6890         (Archive::unused_symbols_begin): New member function.
6891         (Archive::unused_symbols_end): New member function.
6892         (Archive::incremental_info_): New data member.
6893         * incremental-dump.cc (find_input_containing_global): New function.
6894         (dump_incremental_inputs): Dump new incremental info sections.
6895         * incremental.cc: Include symtab.h.
6896         (Output_section_incremental_inputs): New class.
6897         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6898         new incremental info sections.
6899         (Sized_incremental_binary::do_check_inputs): Likewise.
6900         (Incremental_inputs::report_archive): Remove.
6901         (Incremental_inputs::report_archive_begin): New function.
6902         (Incremental_inputs::report_archive_end): New function.
6903         (Incremental_inputs::report_object): New function.
6904         (Incremental_inputs::finalize_inputs): Remove.
6905         (Incremental_inputs::report_input_section): New function.
6906         (Incremental_inputs::report_script): Rewrite.
6907         (Incremental_inputs::finalize): Do nothing but finalize string table.
6908         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6909         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6910         (Incremental_inputs::create_data_sections): New function.
6911         (Incremental_inputs::relocs_entsize): New function.
6912         (Output_section_incremental_inputs::set_final_data_size): New function.
6913         (Output_section_incremental_inputs::do_write): New function.
6914         (Output_section_incremental_inputs::write_header): New function.
6915         (Output_section_incremental_inputs::write_input_files): New function.
6916         (Output_section_incremental_inputs::write_info_blocks): New function.
6917         (Output_section_incremental_inputs::write_symtab): New function.
6918         * incremental.h (Incremental_script_entry): Forward declaration.
6919         (Incremental_object_entry): Forward declaration.
6920         (Incremental_archive_entry): Forward declaration.
6921         (Incremental_inputs): Forward declaration.
6922         (Incremental_inputs_header_data): Remove.
6923         (Incremental_inputs_header): Remove.
6924         (Incremental_inputs_header_write): Remove.
6925         (Incremental_inputs_entry_data): Remove.
6926         (Incremental_inputs_entry): Remove.
6927         (Incremental_inputs_entry_write): Remove.
6928         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6929         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6930         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6931         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6932         Likewise.
6933         (Incremental_input_entry): New class.
6934         (Incremental_script_entry): New class.
6935         (Incremental_object_entry): New class.
6936         (Incremental_archive_entry): New class.
6937         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6938         (Incremental_inputs::report_inputs): Remove.
6939         (Incremental_inputs::report_archive): Remove.
6940         (Incremental_inputs::report_archive_begin): New function.
6941         (Incremental_inputs::report_archive_end): New function.
6942         (Incremental_inputs::report_object): Change prototype.
6943         (Incremental_inputs::report_input_section): New function.
6944         (Incremental_inputs::report_script): Change prototype.
6945         (Incremental_inputs::get_reloc_count): New function.
6946         (Incremental_inputs::set_reloc_count): New function.
6947         (Incremental_inputs::create_data_sections): New function.
6948         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6949         (Incremental_inputs::inputs_section): New function.
6950         (Incremental_inputs::symtab_section): New function.
6951         (Incremental_inputs::relocs_section): New function.
6952         (Incremental_inputs::get_stringpool): Add const.
6953         (Incremental_inputs::command_line): Add const.
6954         (Incremental_inputs::inputs): Remove.
6955         (Incremental_inputs::command_line_key): New function.
6956         (Incremental_inputs::input_file_count): New function.
6957         (Incremental_inputs::input_files): New function.
6958         (Incremental_inputs::relocs_entsize): New function.
6959         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6960         (Incremental_inputs::finalize_inputs): Remove.
6961         (Incremental_inputs::Input_info): Remove.
6962         (Incremental_inputs::lock_): Remove.
6963         (Incremental_inputs::inputs_): Change type.
6964         (Incremental_inputs::inputs_map_): Remove.
6965         (Incremental_inputs::current_object_entry_): New data member.
6966         (Incremental_inputs::inputs_section_): New data member.
6967         (Incremental_inputs::symtab_section_): New data member.
6968         (Incremental_inputs::relocs_section_): New data member.
6969         (Incremental_inputs::reloc_count_): New data member.
6970         (Incremental_inputs_reader): New class.
6971         (Incremental_symtab_reader): New class.
6972         (Incremental_relocs_reader): New class.
6973         * layout.cc (Layout::finalize): Move finalization of incremental info
6974         and creation of incremental info sections to follow finalization of
6975         symbol table.  Set offsets for postprocessing sections.
6976         (Layout::create_incremental_info_sections): Call
6977         Incremental_inputs::create_data_sections.  Add incremental symtab
6978         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6979         sections to layout after input sections.
6980         * layout.h (struct Timespec): Forward declaration.
6981         (Layout::incremental_inputs): Add const.
6982         (Layout::create_incremental_info_sections): Add parameter.
6983         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6984         * object.cc: Include incremental.h.
6985         (Relobj::finalize_incremental_relocs): New function.
6986         (Sized_relobj::do_layout): Record input sections in incremental info.
6987         * object.h (Object::output_section): New function.
6988         (Object::output_section_offset): Moved from Relobj.
6989         (Object::get_incremental_reloc_base): New function.
6990         (Object::get_incremental_reloc_count): New function.
6991         (Object::do_output_section): New function.
6992         (Object::do_output_section_offset): Moved from Relobj.
6993         (Object::do_get_incremental_reloc_base): New function.
6994         (Object::do_get_incremental_reloc_count): New function.
6995         (Object::Object): Initialize new data members.
6996         (Relobj::output_section): Renamed do_output_section and moved to
6997         protected.
6998         (Relobj::output_section_offset): Moved to Object.
6999         (Relobj::do_get_incremental_reloc_base): New function.
7000         (Relobj::do_get_incremental_reloc_count): New function.
7001         (Relobj::allocate_incremental_reloc_counts): New function.
7002         (Relobj::count_incremental_reloc): New function.
7003         (Relobj::finalize_incremental_relocs): New function.
7004         (Relobj::next_incremental_reloc_index): New function.
7005         (Relobj::reloc_counts_): New data member.
7006         (Relobj::reloc_bases_): New data member.
7007         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7008         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7009         (Sized_relobj::incremental_relocs_scan): New function.
7010         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7011         (Sized_relobj::incremental_relocs_write): New function.
7012         (Sized_relobj::incremental_relocs_write_reltype): New function.
7013         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7014         incremental link.
7015         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7016         archives and object files elsewhere.
7017         (Add_symbols::run): Report object files here.
7018         (Finish_group::run): Report end of archive at end of group.
7019         * reloc.cc: Include layout.h, incremental.h.
7020         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7021         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7022         (Sized_relobj::incremental_relocs_scan): New function.
7023         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7024         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7025         (Sized_relobj::incremental_relocs_write): New function.
7026         (Sized_relobj::incremental_relocs_write_reltype): New function.
7027         * script.cc (read_input_script): Rewrite test for incremental link.
7028         Change call to Incremental_inputs::report_script.
7029         * symtab.h (Symbol_table::first_global_index): New function.
7030         (Symbol_table::output_count): New function.
7031
7032 2010-08-12  Doug Kwan  <dougkwan@google.com>
7033
7034         * arm.cc (Target_arm::merge_object_attributes): Check command line
7035         options --no-wchar-size-warning and --no-enum-size-warning.
7036         * options.h (General_options): Add ld-compatible options
7037         --no-enum-size-warning and --no-wchar-size-warning.
7038
7039 2010-08-04  Ian Lance Taylor  <iant@google.com>
7040
7041         * x86_64.cc (Target_x86_64::Scan::local): Use
7042         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7043         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7044         (Target_x86_64::Scan::global): Likewise.
7045         (Target_x86_64::Relocate::relocate): Likewise.
7046         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7047         Likewise.
7048
7049 2010-08-03  Cary Coutant  <ccoutant@google.com>
7050
7051         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7052         to reserve space in merged_strings vector. Keep total input size
7053         for stats.
7054         (Output_merge_string::do_print_merge_stats): Print total input size.
7055         * merge.h (Output_merge_string): Add input_size_ field.
7056         * stringpool.cc (Stringpool_template::string_length): Move
7057         implementations out of Stringpool_template class and place in
7058         stringpool.h.
7059         * stringpool.h (string_length): Move out of Stringpool_template.
7060
7061 2010-08-03  Ian Lance Taylor  <iant@google.com>
7062
7063         PR 11712
7064         * layout.cc (relaxation_loop_body): If address of load segment is
7065         set, adjust address to include headers if possible.
7066
7067 2010-08-03  Ian Lance Taylor  <iant@google.com>
7068
7069         * version.cc (version_string): Bump to 1.10.
7070
7071 2010-08-03  Ian Lance Taylor  <iant@google.com>
7072
7073         PR 11805
7074         * layout.h (enum Output_section_order): Define.
7075         (class Layout): Update declarations.
7076         * layout.cc (Layout::get_output_section): Add order parameter.
7077         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7078         is_first_non_relro parameters.  Change all callers.
7079         (Layout::choose_output_section): Likewise.
7080         (Layout::add_output_section_data): Likewise.
7081         (Layout::make_output_section): Likewise.  Set order.
7082         (Layout::default_section_order): New function.
7083         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7084         * output.cc (Output_section::Output_section): Initialize order_.
7085         Don't initialize deleted fields.
7086         (Output_segment::Output_segment): Don't initialize deleted
7087         fields.
7088         (Output_segment::add_output_section_to_load): New function
7089         replacing add_output_section.  Change all callers to call this or
7090         add_output_section_to_nonload.
7091         (Output_segment::add_output_section_to_nonload): New function.
7092         (Output_segment::remove_output_section): Rewrite.
7093         (Output_segment::add_initial_output_data): Likewise.
7094         (Output_segment::has_any_data_sections): Likewise.
7095         (Output_segment::is_first_section_relro): Likewise.
7096         (Output_segment::maximum_alignment): Likewise.
7097         (Output_segment::has_dynamic_reloc): New function replacing
7098         dynamic_reloc_count.  Change all callers.
7099         (Output_segment::has_dynamic_reloc_list): New function replacing
7100         dynamic_reloc_count_list.  Change all callers.
7101         (Output_segment::set_section_addresses): Rewrite.
7102         (Output_segment::set_offset): Rewrite.
7103         (Output_segment::find_first_and_last_list): Remove.
7104         (Output_segment::set_tls_offsets): Rewrite.
7105         (Output_segment::first_section_load_address): Likewise.
7106         (Output_segment::output_section_count): Likewise.
7107         (Output_segment::section_with_lowest_load_address): Likewise.
7108         (Output_segment::write_section_headers): Likewise.
7109         (Output_segment::print_sections_to_map): Likewise.
7110         * output.h (class Output_data): Remove dynamic_reloc_count_
7111         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7112         (Output_data::add_dynamic_reloc): Rewrite.
7113         (Output_data::has_dynamic_reloc): New function.
7114         (Output_data::dynamic_reloc_count): Remove.
7115         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7116         is_last_relro_, is_first_non_relro_, is_interp_,
7117         is_dynamic_linker_section_ fields.  Add order and set_order
7118         functions.  Remove is_relro_local, set_is_relro_local,
7119         is_last_relro, set_is_last_relro, is_first_non_relro,
7120         set_is_first_non_relro functions, is_interp, set_is_interp,
7121         is_dynamic_linker_section, and set_is_dynamic_linker_section
7122         functions.
7123         (class Output_segment): Change Output_data_list from std::list to
7124         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7125         output_bss_ fields.  Update declarations.
7126
7127 2010-08-02  Ian Lance Taylor  <iant@google.com>
7128
7129         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7130         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7131         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7132
7133 2010-08-02  Ian Lance Taylor  <iant@google.com>
7134
7135         PR 11855
7136         * script.cc (Script_options::Script_options): Initialize
7137         symbol_definitions_ and symbol_references_.
7138         (Script_options::add_symbol_assignment): Update
7139         symbol_definitions_ and symbol_references_.
7140         (Script_options::add_symbol_reference): New function.
7141         (script_symbol): New function.
7142         * script.h (class Script_options): Add symbol_definitions_ and
7143         symbol_references_ fields.
7144         (Script_options::referenced_const_iterator): New type.
7145         (Script_options::referenced_begin): New function.
7146         (Script_options::referenced_end): New function.
7147         (Script_options::is_referenced): New function.
7148         (Script_options::any_unreferenced): New function.
7149         * script-c.h (script_symbol): Declare.
7150         * yyscript.y (exp): Call script_symbol.
7151         * symtab.cc: Include "script.h".
7152         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7153         Change all callers.  Check symbols referenced by scripts.
7154         (Symbol_table::add_undefined_symbols_from_command_line): Add
7155         layout parameter.  Change all callers.
7156         (Symbol_table::do_add_undefined_symbols_from_command_line):
7157         Likewise.  Break out loop body.  Check symbols referenced by
7158         scripts.
7159         (Symbol_table::add_undefined_symbol_from_command_line): New
7160         function broken out of
7161         do_add_undefined_symbols_from_command_line.
7162         * symtab.h (class Symbol_table): Update declarations.
7163         * archive.cc: Include "layout.h".
7164         (Archive::should_include_member): Add layout parameter.  Change
7165         all callers.  Check for symbol mentioned in expression.
7166         * archive.h (class Archive): Update declaration.
7167         * object.cc (Sized_relobj::do_should_include_member): Add layout
7168         parameter.
7169         * object.h (Object::should_include_member): Add layout parameter.
7170         Change all callers.
7171         (Object::do_should_include_member): Add layout parameter.
7172         (class Sized_relobj): Update declaration.
7173         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7174         parameter.
7175         * dynobj.h (class Sized_dynobj): Update declaration.
7176         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7177         layout parameter.
7178         * plugin.h (class Sized_pluginobj): Update declaration.
7179
7180 2010-08-02  Ian Lance Taylor  <iant@google.com>
7181
7182         PR 11866
7183         * output.cc (Output_segment::set_offset): Search for the first and
7184         last sections rather than assuming that the list is in order.
7185         (Output_segment::find_first_and_last_list): New function.
7186         * output.h (class Output_segment): Update declarations.
7187         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7188         (relro_strip_test_SOURCES): New variable.
7189         (relro_strip_test_DEPENDENCIES): New variable.
7190         (relro_strip_test_LDFLAGS): New variable.
7191         (relro_strip_test_LDADD): New variable.
7192         (relro_strip_test.so): New target.
7193
7194 2010-08-02  Ian Lance Taylor  <iant@google.com>
7195
7196         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7197         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7198         (Target_i386::got_tlsdesc_section): New function.
7199         (Target_i386::got_section): Create space for GOT entries for
7200         TLSDESC relocations.
7201         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7202         R_386_TLS_GOTDESC.
7203         (Target_i386::Scan::global): Likewise.
7204         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7205         using TLSDESC GOT.
7206         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7207         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7208         (Target_x86_64::got_tlsdesc_section): New function.
7209         (Target_x86_64::got_section): Create space for GOT entries for
7210         TLSDESC relocations.
7211         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7212         R_386_TLS_GOTDESC.
7213         (Target_x86_64::Scan::global): Likewise.
7214         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7215         using TLSDESC GOT.
7216
7217 2010-08-02  Ian Lance Taylor  <iant@google.com>
7218
7219         * testsuite/final_layout.sh: Use dc to convert from hex to
7220         decimal.
7221
7222 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7223
7224         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7225         paramter to the call to gold::gc_process_relocs.
7226         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7227         paramter to the call to gold::gc_process_relocs.
7228         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7229         parameter to the call to gold::gc_process_relocs.
7230         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7231         template parameter to the call to gold::gc_process_relocs.
7232         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7233         paramter to the call to gold::gc_process_relocs.
7234         * gc.h (get_embedded_addend_size): New function.
7235         (gc_process_relocs): Save the size of the reloc for use by ICF.
7236         * icf.cc (get_section_contents): Get the addend from the text section
7237         for SHT_REL relocation sections.
7238         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7239         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7240         * int_encoding.h (read_from_pointer): New overloaded function.
7241         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7242         * testsuite/icf_sht_rel_addend_test.sh: New file.
7243         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7244         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7245
7246 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7247
7248         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7249         * Makefile.in: Regenerate.
7250         * testsuite/Makefile.in: Regenerate.
7251
7252 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7253
7254         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7255         * gold/testsuite/debug_msg.cc: Likewise.
7256         * gold/testsuite/odr_violation1.cc
7257         * gold/testsuite/odr_violation2.cc
7258
7259 2010-07-21  Cary Coutant  <ccoutant@google.com>
7260
7261         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7262         string, and length fields.
7263         (Output_merge_string::Merged_strings_list): New type.
7264         (Output_merge_string::Merged_strings_lists): New typedef.
7265         (Output_merge_string): Replace merged_strings_ with
7266         merged_strings_lists_.
7267         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7268         Merged_strings_list per input object and section.  Don't store pointer
7269         to the string.  Don't store length with each merged string entry.
7270         (Output_merge_string::finalize_merged_data): Loop over list of merged
7271         strings lists.  Recompute length of each merged string.
7272
7273 2010-07-15  Cary Coutant  <ccoutant@google.com>
7274
7275         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7276         here.
7277
7278 2010-07-14  Ian Lance Taylor  <iant@google.com>
7279
7280         * descriptors.cc (Descriptors::open): Report correct name in error
7281         message.
7282
7283 2010-07-13  Doug Kwan  <dougkwan@google.com>
7284
7285         * arm.cc (Arm_input_section::Arm_input_section): For a
7286         SHT_ARM_EXIDX section, always keeps the input sections.
7287         (Arm_input_section::set_exidx_section_link): New method.
7288         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7289         has_errors_ to false.
7290         (Arm_exidx_input_section::has_errors,
7291         Arm_exidx_input_section::set_has_errors): New methods.
7292         (Arm_exidx_input_section::has_errors_): New data member.
7293         (Arm_relobj::get_exidx_shndx_list): New method.
7294         (Arm_output_section::append_text_sections_to_list): Do not skip
7295         section without SHF_EXECINSTR.
7296         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7297         errors.
7298         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7299         section header.  Make error messages more verbose.  Check for
7300         a non-executable section linked to an EXIDX section.
7301         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7302         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7303         check that there is no deferred EXIDX section if we exit early.
7304         Instead of not making an EXIDX section in case of an error, make one
7305         and set the has_errors flag of it.
7306         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7307         in a relocatable link.
7308         (Target_arm::do_relax): Look for the EXIDX output section instead of
7309         assuming that it is called .ARM.exidx.
7310         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7311         section list.  Do not check for SHF_EXECINSTR section flags but
7312         skip any input section with errors.
7313         * output.cc (Output_section::Output_section): Initialize
7314         always_keeps_input_sections_ to false.
7315         (Output_section::add_input_section): Check for
7316         always_keeps_input_sections_.
7317         *  output.h (Output_section::always_keeps_input_sections,
7318         Output_section::set_always_keeps_input_sections): New methods.
7319         (Output_section::always_keeps_input_sections): New data member.
7320
7321 2010-07-13  Rafael Espindola  <espindola@google.com>
7322
7323         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7324         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7325
7326 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7327             Ian Lance Taylor  <iant@google.com>
7328
7329         * output.h (Output_section_lookup_maps::add_merge_section):
7330         Correct check of whether value was inserted.
7331         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7332         (Output_section_lookup_maps::add_relaxed_input_section):
7333         Likewise.
7334         * arm.cc (Target_arm::got_section): Remove used local os.
7335         * i386.cc (Target_i386::got_section): Likewise.
7336         * x86_64.cc (Target_x86_64::got_section): Likewise.
7337         * sparc.cc (Target_sparc::got_section): Likewise.
7338         (Target_sparc::relocate): Remove unused local have_got_offset.
7339         * powerpc.cc (Target_powerpc::relocate): Likewise.
7340
7341 2010-07-13  Ian Lance Taylor  <iant@google.com>
7342
7343         * compressed_output.cc (zlib_decompress): Fix signature in
7344         !HAVE_ZLIB_H case.
7345
7346         * archive.cc (Archive::include_member): Unlock an external member
7347         of a thin archive.  Don't bother to delete an object we know is
7348         NULL.
7349
7350 2010-07-12  Cary Coutant  <ccoutant@google.com>
7351
7352         * compressed_output.cc (zlib_decompress): New function.
7353         (get_uncompressed_size): New function.
7354         (decompress_input_section): New function.
7355         * compressed_output.h (get_uncompressed_size): New function.
7356         (decompress_input_section): New function.
7357         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7358         Handle compressed debug sections.
7359         * layout.cc (is_compressed_debug_section): New function.
7360         (Layout::output_section_name): Map compressed section names to
7361         canonical names.
7362         * layout.h (is_compressed_debug_section): New function.
7363         (is_debug_info_section): Recognize compressed debug sections.
7364         * merge.cc: Include compressed_output.h.
7365         (Output_merge_data::do_add_input_section): Handle compressed
7366         debug sections.
7367         (Output_merge_string::do_add_input_section): Handle compressed
7368         debug sections.
7369         * object.cc: Include compressed_output.h.
7370         (Sized_relobj::Sized_relobj): Initialize new data members.
7371         (build_compressed_section_map): New function.
7372         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7373         * object.h (Object::section_is_compressed): New method.
7374         (Object::do_section_is_compressed): New method.
7375         (Sized_relobj::Compressed_section_map): New type.
7376         (Sized_relobj::do_section_is_compressed): New method.
7377         (Sized_relobj::compressed_sections_): New data member.
7378         * output.cc (Output_section::add_input_section): Handle compressed
7379         debug sections.
7380         * reloc.cc: Include compressed_output.h.
7381         (Sized_relobj::write_sections): Handle compressed debug sections.
7382
7383 2010-07-08  Cary Coutant  <ccoutant@google.com>
7384
7385         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7386         weak when resolving to a dynamic def.
7387         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7388         for weak undef/dynamic def cases. Adjust callers.
7389         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7390         undef_binding_weak_.
7391         (Symbol_table::sized_write_globals): Adjust symbol binding.
7392         (Symbol_table::sized_write_symbol): Add binding parameter.
7393         * symtab.h (Symbol::set_undef_binding): New method.
7394         (Symbol::is_undef_binding_weak): New method.
7395         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7396         (Symbol_table::should_override): Add new parameter.
7397         (Symbol_table::sized_write_symbol): Add new parameter.
7398
7399         * testsuite/weak_undef_file1.cc: Add new test case.
7400         * testsuite/weak_undef_file2.cc: Fix header comment.
7401         * testsuite/weak_undef_test.cc: Add new test case.
7402
7403 2010-06-29  Doug Kwan  <dougkwan@google.com>
7404
7405         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7406         Initialize USE_SYMBOL_.
7407         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7408         definition.
7409         (Arm_reloc_property::uses_symbol_): New data member declaration.
7410         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7411         uses symbol value and symbol is undefined but not weakly undefined.
7412
7413 2010-06-28  Rafael Espindola  <espindola@google.com>
7414
7415         * plugin.cc (Plugin::load): Use dlerror.
7416
7417 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7418
7419         * symtab.cc (detect_odr_violations): When reporting an ODR
7420         violation, report an object where the symbol is defined.
7421
7422 2010-06-25  Doug Kwan  <dougkwan@google.com>
7423
7424         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7425         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7426         definition.
7427         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7428         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7429         target hook to detect function points.
7430         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7431         * icf.h (Icf::check_section_for_function_pointers): Change type of
7432         parameter SECTION_NAME to const reference to std::string.  Use
7433         target hook to determine if section may have unsafe pointers.
7434         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7435         method definition.
7436
7437 2010-06-21  Rafael Espindola  <espindola@google.com>
7438
7439         * fileread.cc (Input_file::find_fie): New
7440         (Input_file::open): Use Input_file::find_fie.
7441         * fileread.h (Input_file::find_fie): New
7442         * plugin.cc (set_extra_library_path): New.
7443         (Plugin::load): Add set_extra_library_path to the transfer vector.
7444         (Plugin_manager::set_extra_library_path): New.
7445         (Plugin_manager::add_input_file): Use the extra search path if set.
7446         (set_extra_library_path(): New.
7447         * plugin.h (Plugin_manager): Add set_extra_library_path and
7448         extra_search_path_.
7449
7450 2010-06-19  Cary Coutant  <ccoutant@google.com>
7451
7452         * layout.cc (gdb_sections): Add .debug_types.
7453         (lines_only_debug_sections): Likewise.
7454
7455 2010-06-18  Rafael Espindola  <espindola@google.com>
7456
7457         * plugin.cc (add_input_file,add_input_library)
7458         (Plugin_manager::add_input_file): Make filename arguments const.
7459         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7460         const.
7461
7462 2010-06-16  Doug Kwan  <dougkwan@google.com>
7463
7464         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7465         .ARM.attributes section if we have not merged any input
7466         attributes sections.
7467
7468 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7469
7470         * arm.cc: Allow combining objects with no EABI version
7471         information.
7472
7473 2010-06-15  Rafael Espindola  <espindola@google.com>
7474
7475         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7476
7477 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7478
7479         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7480         (struct iovec): Correct !HAVE_READV definition.
7481
7482 2010-06-10  Cary Coutant  <ccoutant@google.com>
7483
7484         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7485         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7486         reloc sections.
7487         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7488
7489         PR 11683
7490         * symtab.h (Symbol::is_placeholder): New member function.
7491         * target-reloc.h (relocate_section): Check for placeholder symbols.
7492
7493         * testsuite/Makefile.am (plugin_test_8): New test.
7494         (plugin_test_9): New test.
7495         * testsuite/Makefile.in: Regenerate.
7496
7497 2010-06-09  Nick Clifton  <nickc@redhat.com>
7498
7499         * yyscript.y (input_list_element): Allow strings prefixed with
7500         the '-' character.  Treat these as libraries.
7501         * script.cc (script_add_library): New function.  Adds a library
7502         specified by "-l<name>" found in an input script.
7503         * script-c.h: Add prototype for script_add_library.
7504
7505 2010-06-07  Doug Kwan  <dougkwan@google.com>
7506
7507         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7508         Restrict stub-group size to be within long conditional branch
7509         range when working around cortex-A8 erratum.
7510
7511 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7512
7513         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7514         #ifdef typo.
7515
7516 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7517
7518         PR gold/11658
7519         * output.cc
7520         (Output_section::Input_section_sort_entry::compare_section_ordering):
7521         Change to return non-zero correctly.
7522         (Output_section::Input_section_sort_section_order_index_compare
7523         ::operator()): Change to fix ambiguity in comparisons.
7524
7525 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7526
7527         * gold.h (is_wildcard_string): New function.
7528         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7529         (Layout::layout_eh_frame): Ditto.
7530         (Layout::find_section_order_index): New method.
7531         (Layout::read_layout_from_file): New method.
7532         * layout.h (Layout::find_section_order_index): New method.
7533         (Layout::read_layout_from_file): New method.
7534         (Layout::input_section_position_): New private member.
7535         (Layout::input_section_glob_): New private member.
7536         * main.cc (main): Call read_layout_from_file here.
7537         * options.h (--section-ordering-file): New option.
7538         * output.cc (Output_section::input_section_order_specified_): New
7539         member.
7540         (Output_section::Output_section): Initialize new member.
7541         (Output_section::add_input_section): Add new parameter.
7542         Keep input sections when --section-ordering-file is used.
7543         (Output_section::set_final_data_size): Sort input sections when
7544         section ordering file is specified.
7545         (Output_section::Input_section_sort_entry): Add new parameter.
7546         Check sorting type.
7547         (Output_section::Input_section_sort_entry::compare_section_ordering):
7548         New method.
7549         (Output_section::Input_section_sort_compare::operator()): Change to
7550         consider section_order_index.
7551         (Output_section::Input_section_sort_init_fini_compare::operator()):
7552         Change to consider section_order_index.
7553         (Output_section::Input_section_sort_section_order_index_compare
7554         ::operator()): New method.
7555         (Output_section::sort_attached_input_sections): Change to sort
7556         according to section order when specified.
7557         (Output_section::add_input_section<32, true>): Add new parameter.
7558         (Output_section::add_input_section<64, true>): Add new parameter.
7559         (Output_section::add_input_section<32, false>): Add new parameter.
7560         (Output_section::add_input_section<64, false>): Add new parameter.
7561         * output.h (Output_section::add_input_section): Add new parameter.
7562         (Output_section::input_section_order_specified): New
7563         method.
7564         (Output_section::set_input_section_order_specified): New method.
7565         (Input_section::Input_section): Initialize section_order_index_.
7566         (Input_section::section_order_index): New method.
7567         (Input_section::set_section_order_index): New method.
7568         (Input_section::section_order_index_): New member.
7569         (Input_section::Input_section_sort_section_order_index_compare): New
7570         struct.
7571         (Output_section::input_section_order_specified_): New member.
7572         * script-sections.cc (is_wildcard_string): Delete and move modified
7573         method to gold.h.
7574         (Output_section_element_input::Output_section_element_input): Modify
7575         call to is_wildcard_string.
7576         (Output_section_element_input::Input_section_pattern
7577         ::Input_section_pattern): Ditto.
7578         (Output_section_element_input::Output_section_element_input): Ditto.
7579         * testsuite/Makefile.am (final_layout): New test case.
7580         * testsuite/Makefile.in: Regenerate.
7581         * testsuite/final_layout.cc: New file.
7582         * testsuite/final_layout.sh: New file.
7583
7584 2010-06-01  Rafael Espindola  <espindola@google.com>
7585
7586         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7587
7588 2010-06-01  Rafael Espindola  <espindola@google.com>
7589
7590         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7591         visibility of symbols.
7592
7593 2010-05-27  Doug Kwan  <dougkwan@google.com>
7594
7595         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7596         from start of output section instead of address for a local symbol
7597         in a merged or relaxed section when doing a relocatable link.
7598
7599 2010-05-26  Rafael Espindola  <espindola@google.com>
7600
7601         PR 11604
7602         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7603         adding sections the garbage collector removed.
7604         * gold/testsuite/Makefile.am: Add test.
7605         * gold/testsuite/Makefile.in: Regenerate.
7606         * gold/testsuite/plugin_test_7.sh: New.
7607         * gold/testsuite/plugin_test_7_1.c: New.
7608         * gold/testsuite/plugin_test_7_2.c: New.
7609
7610 2010-05-26  Rafael Espindola  <espindola@google.com>
7611
7612         * script-sections.cc (Output_section_definition::set_section_addresses):
7613         Check for --section-start.
7614
7615 2010-05-26  Doug Kwan  <dougkwan@google.com>
7616
7617         * arm.cc (Arm_scan_relocatable_relocs): New class.
7618         (Target_arm::relocate_special_relocatable): New method.
7619         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7620         (Arm_relocate_functions::thumb_branch_common): Same.
7621         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7622         instead of Default_scan_relocatable_relocs.
7623         * target-reloc.h (relocate_for_relocatable): Let target handle
7624         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7625         * target.h (Sized_target::relocate_special_relocatable): New method.
7626
7627 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7628
7629         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7630
7631 2010-05-23  Doug Kwan  <dougkwan@google.com>
7632
7633         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7634         instead of a cast.
7635         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7636         with a direct branch, not a conditional branch, to a stub.
7637         * merge.cc (Output_merge_base::record_input_section): New method
7638         defintion.
7639         (Output_merge_data::do_add_input_section): Record input section if
7640         keeps-input-sections flag is set.
7641         (Output_merge_string::do_add_input_section): Ditto.
7642         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7643         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7644         INPUT_SECTIONS_.
7645         (Output_merge_base::keeps_input_sections,
7646         Output_merge_base::set_keeps_input_sections,
7647         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7648         method definitions.
7649         (Output_merge_base::Input_sections): New type declaration.
7650         (Output_merge_base::input_sections_begin,
7651         Output_merge_base::input_sections_end,
7652         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7653         (Output_merge_base::bool keeps_input_sections_,
7654         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7655         Output_merge_base::input_sections_): New data members.
7656         (Output_merge_data::do_set_keeps_input_sections): New method
7657         defintion.
7658         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7659         * output.cc (Output_section::Input_section::relobj): Move method
7660         defintion from class declaration to here and handle merge sections.
7661         (Output_section::Input_section::shndx): Ditto.
7662         (Output_section::Output_section): Remove initializations of removed
7663         data members and initialize new data member LOOKUP_MAPS_.
7664         (Output_section::add_input_section): Set keeps-input-sections flag
7665         for a newly created merge output section as appropriate.  Adjust code
7666         to use Output_section_lookup_maps class.
7667         (Output_section::add_relaxed_input_section): Adjst code for lookup
7668         maps code refactoring.
7669         (Output_section::add_merge_input_section): Add a new parameter
7670         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7671         class.  If adding input section to a newly created merge output
7672         section fails, remove the new merge section.
7673         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7674         Adjust code for use of the Output_section_lookup_maps class.
7675         (Output_section::find_merge_section): Ditto.
7676         (Output_section::build_lookup_maps): New method defintion.
7677         (Output_section::find_relaxed_input_section): Adjust code to use
7678         Output_section_lookup_maps class.
7679         (Output_section::get_input_sections): Export merge sections.  Adjust
7680         code to use Output_section_lookup_maps class.
7681         (Output_section:::add_script_input_section): Adjust code to use
7682         Output_section_lookup_maps class.  Update lookup maps for merge
7683         sections also.
7684         (Output_section::discard_states): Use Output_section_lookup_maps.
7685         (Output_section::restore_states): Same.
7686         * output.h (Merge_section_properties): Move class defintion out of
7687         Output_section.
7688         (Output_section_lookup_maps): New class.
7689         (Output_section::Input_section::is_merge_section): New method
7690         defintion.
7691         (Output_section::Input_section::relobj): Move defintion out of class
7692         defintion.  Declare method only.
7693         (Output_section::Input_section::shndx): Ditto.
7694         (Output_section::Input_section::output_merge_base): New method defintion.
7695         (Output_section::Input_section::u2_.pomb): New union field.
7696         (Output_section::Merge_section_by_properties_map,
7697         Output_section::Output_section_data_by_input_section_map,
7698         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7699         Remove types.
7700         (Output_section::add_merge_input_section): Add new parameter
7701         KEEPS_INPUT_SECTIONS.
7702         (Output_section::build_lookup_maps): New method declaration.
7703         (Output_section::merge_section_map_,
7704         Output_section::merge_section_by_properties_map_,
7705         Output_section::relaxed_input_section_map_,
7706         Output_section::is_relaxed_input_section_map_valid_): Remove data
7707         members.
7708         (Output_section::lookup_maps_): New data member.
7709
7710 2010-05-21  Doug Kwan  <dougkwan@google.com>
7711
7712         PR gold/11619
7713         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7714         avoid a compilation error.
7715
7716 2010-05-19  Rafael Espindola  <espindola@google.com>
7717
7718         * script-sections.cc (Output_section_definition::allocate_to_segment):
7719         Update the phdrs_list even when the output section is NULL.
7720         * testsuite/Makefile.am: Add test.
7721         * testsuite/Makefile.in: Regenerate.
7722         * testsuite/script_test_9.cc: New.
7723         * testsuite/script_test_9.sh: New.
7724         * testsuite/script_test_9.t: New.
7725
7726 2010-05-19  Doug Kwan  <dougkwan@google.com>
7727
7728         * arm.cc (Arm_input_section::original_size): New method.
7729         (Arm_input_section::do_addralign): Add a cast.
7730         (Arm_input_section::do_output_offset): Remove static cast.
7731         (Arm_input_section::original_addralign,
7732          Arm_input_section::original_size_): Change type to uint32_t.
7733         (Arm_input_section::init): Add safe casts for section alignment
7734         and size.
7735         (Arm_input_section::set_final_data_size): Do not set address and
7736         offset of stub table.
7737         (Arm_output_section::fix_exidx_coverage): Change use of of
7738         Output_section::Simple_input_section to that of
7739         Output_section::Input_section.
7740         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7741         except for the first pass.
7742         * output.cc (Output_section::get_input_sections): Change type of
7743         input_sections to std::list<Input_section>.
7744         (Output_section::add_script_input_section): Rename from
7745         Output_section::add_simple_input_section.  Change type of SIS
7746         parameter from Simple_input_section to Input_section.
7747         * output.h (Output_section::Simple_input_section): Remove class.
7748         (Output_section::Input_section): Change class visibility to public.
7749         (Output_section::Input_section::addralign): Use stored alignments
7750         for special input sections if set.
7751         (Output_section::Input_section::set_addralign): New method.
7752         (Output_section::get_input_sections): Change parameter type from
7753         list of Simple_input_section to list of Input_section.
7754         (Output_section::add_script_input_section): Rename from
7755         Output_section::add_simple_input_section. Change first parameter's
7756         type from Simple_input_section to Input_section and remove the
7757         second and third parameters.
7758         * script-sections.cc (Input_section::Input_section_list): Change
7759         type to list of Output_section::Input_section/
7760         (Input_section_info::Input_section_info): Change parameter type of
7761         INPUT_SECTION to Output_section::Input_section.
7762         (Input_section_info::input_section): Change return type.
7763         (Input_section_info::input_section_): Change type to
7764         Output_section::Input_section.
7765         (Output_section_element_input::set_section_addresses): Adjust code
7766         to use Output_section::Input_section instead of
7767         Output_section::Simple_input_section.  Adjust code for renaming
7768         of Output_section::add_simple_input_section.
7769         (Orphan_output_section::set_section_addresses): Ditto.
7770
7771 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7772
7773         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7774         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7775
7776 2010-05-18  Rafael Espindola  <espindola@google.com>
7777
7778         * options.cc (General_options::finalize): Handle -nostdlib.
7779         * options.h (nostdlib): New option.
7780         * script.cc (script_add_search_dir): Handle -nostdlib.
7781
7782 2010-05-12  Doug Kwan  <dougkwan@google.com>
7783
7784         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7785         attributes section only if there no attributes section after merging.
7786         (Target_arm::merge_object_attributes): Move value of
7787         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7788         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7789         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7790         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7791         and arm_attr_merge_7.stdout.
7792         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7793         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7794         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7795         arm_attr_merge_7b.o): New rules.
7796         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7797         arm_attr_merge_7
7798         * testsuite/Makefile.in: Regenerate.
7799         * testsuite/arm_attr_merge.sh: New file.
7800         * testsuite/arm_attr_merge_[67][ab].s: Same.
7801
7802 2010-05-05  Nick Clifton  <nickc@redhat.com>
7803
7804         * po/es.po: Updated Spanish translation.
7805
7806 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7807
7808         * Makefile.am (install-exec-local): Properly install gold as
7809         default cross linker.
7810         * Makefile.in: Regenerated.
7811
7812 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7813             Nick Clifton  <nickc@redhat.com>
7814
7815         * configure.ac (install_as_default): Define and set to false
7816         unless --enable-gold or --enable-gold=both/gold has been
7817         specified.
7818         * configure: Regenerate.
7819
7820         * Makefile.am (install-exec-local): Install the executable as
7821         'ld.gold'.  If install_as_default is true then also install it as
7822         'ld'.
7823         * Makefile.in: Regenerated.
7824
7825 2010-04-24  Ian Lance Taylor  <iant@google.com>
7826
7827         * layout.cc (Layout::layout_reloc): In relocatable link don't
7828         combine reloc sections for grouped sections.
7829
7830 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7831
7832         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7833         sections that are not ordinary to icf.
7834         * icf.cc (get_section_contents): Handle relocation pointing to section
7835         with no object or shndx information.
7836         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7837         * testsuite/Makefile.in: Regenerate.
7838         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7839         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7840
7841 2010-04-22  Ian Lance Taylor  <iant@google.com>
7842
7843         * expression.cc (Expression::Expression_eval_info): Add
7844         result_alignment_pointer field.
7845         (Expression::eval_with_dot): Add result_alignment_pointer
7846         parameter.  Change all callers.
7847         (Expression::eval_maybe_dot): Likewise.
7848         (class Binary_expression): Add alignment_pointer parameter to
7849         left_value and right_value.  Change all callers.
7850         (BINARY_EXPRESSION): Set result alignment.
7851         (class Trinary_expression): Add alignment_pointer parameter to
7852         arg2_value and arg3_value.  Change all callers.
7853         (Trinary_cond::value): Set result alignment.
7854         (Max_expression::value, Min_expression::value): Likewise.
7855         (Align_expression::value): Likewise.
7856         * script-sections.cc (class Sections_element): Add dot_alignment
7857         parameter to set_section_addresses virtual function.  Update
7858         instantiations.
7859         (class Output_section_element): Likewise.
7860         (Script_sections::create_segments): Add dot_alignment parameter.
7861         Change all callers.
7862         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7863         (Script_sections::set_phdrs_clause_addresses): Likewise.
7864         * script-sections.h: Update declarations.
7865         * script.h: Update declarations.
7866         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7867         min_p_align.
7868         * testsuite/script_test_3.t: Set large alignment.
7869         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7870         segment has expected alignment.
7871
7872 2010-04-22  Nick Clifton  <nickc@redhat.com>
7873
7874         * po/gold.pot: Updated by the Translation project.
7875         * po/vi.po: Updated Vietnamese translation.
7876
7877 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7878
7879         * testsuite/Makefile.am (check_PROGRAMS): Add
7880         icf_virtual_function_folding_test.
7881         * testsuite/Makefile.in: Regenerated.
7882
7883 2010-04-15  Andrew Haley  <aph@redhat.com>
7884
7885         * options.h (merge_exidx_entries): New option.
7886         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7887         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7888         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7889         (Target_arm::merge_exidx_entries): New function.
7890         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7891         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7892         to Arm_exidx_fixup constructor.
7893         Add new arg, merge_exidx_entries.
7894         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7895         Arm_output_section::fix_exidx_coverage.
7896
7897 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7898
7899         * icf.cc (get_section_contents): Check for preemptible functions.
7900         Ignore addend when appropriate.
7901         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7902         section folded.
7903         (add_from_relobj): Check for section folded.
7904         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7905         * symtab.h (should_add_dynsym_entry): Add new parameter.
7906         * target-reloc.h (scan_relocs): Check for section folded.
7907         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7908         Check reloc types for function pointers in shared objects.
7909         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7910         case.
7911         (icf_preemptible_functions_test): New test case.
7912         (icf_string_merge_test): New test case.
7913         * testsuite.Makefile.in: Regenerate.
7914         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7915         bar_glob.  Refactor code.
7916         * testsuite/icf_preemptible_functions_test.cc: New file.
7917         * testsuite/icf_preemptible_functions_test.sh: New file.
7918         * testsuite/icf_string_merge_test.cc: New file.
7919         * testsuite/icf_string_merge_test.sh: New file.
7920         * testsuite/icf_virtual_function_folding_test.cc: New file.
7921         * testsuite/icf_virtual_function_folding_test.sh: New file.
7922
7923 2010-04-14  Doug Kwan  <dougkwan@google.com>
7924
7925         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7926         for local symbol recounting if we remove a section due to ICF.
7927         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7928         there are no regular objects in input.
7929
7930 2010-04-13  Doug Kwan  <dougkwan@google.com>
7931
7932         * arm.cc (Arm_input_section::set_final_data_size): Compute
7933         accurate final data size instead of using current data size.
7934
7935 2010-04-09  Doug Kwan  <dougkwan@google.com>
7936
7937         * layout.cc (Layout::choose_output_section): Handle script section
7938         types.
7939         (Layout::make_output_section_for_script): Add section type parameter.
7940         Handle script section types.
7941         * layout.h (Layout::make_output_section_for_script): Add section
7942         type parameter.
7943         * output.cc (Output_section::Output_section): Initialize data member
7944         is_noload_.
7945         (Output_section::do_reset_address_and_file_offset): Do not set address
7946         to 0 if section is a NOLOAD section.
7947         * output.h (Output_section::is_noload): New method.
7948         (Output_section::set_is_noload): Ditto.
7949         (Output_section::is_noload_): New data member.
7950         * script-c.h (Script_section_type): New enum type.
7951         (struct Parser_output_section_header): Add new file section_type.
7952         * script-sections.cc (Sections_element::output_section_name): Add
7953         parameter for returning script section type.
7954         (Output_section_definition::output_section_name): Ditto.
7955         (Output_section_definition::section_type)P; New method.
7956         (Output_section_definiton::script_section_type_name): Ditto.
7957         (Output_section_definition::script_section_type_): New data member.
7958         (Output_section_definition::Output_section_definition): Initialize
7959         data member Output_section_definition::script_section_type_.
7960         (Output_section_definition::create_sections): Pass script section type
7961         to Layout::make_output_section_for_script.
7962         (Output_section_definition::output_section_name): Return script
7963         section type to caller.
7964         (Output_section_definition::set_section_address): Do not advance
7965         dot value and load address if section type is NOLOAD.  Set address
7966         of NOLOAD sections regardless of section flags.
7967         (Output_section_definition::print): Print section type if it is
7968         not SCRIPT_SECTION_TYPE_NONE.
7969         (Output_section_definition::section_type): New method.
7970         (Output_section_definition::script_section_type_name): Ditto.
7971         (Script_sections::output_section_name): Add new parameter
7972         PSECTION_TYPE for returning script section type.  Pass it to
7973         section elements.  Handle discard sections.
7974         (Sort_output_sections::operator()): Handle NOLOAD sections.
7975         * script-sections.h (Script_sections::Section_type): New enum type.
7976         (Script_sections::output_section_name): Add a new parameter for
7977         returning script section type.
7978         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7979         INFO and NOLOAD.
7980         * yyscript.y (union): Add new field SECTION_TYPE.
7981         (COPY, DSECT, INFO, NOLOAD): New tokens.
7982         (opt_address_and_section_type): Change type to output_section_header.
7983         (section_type): New non-terminal
7984         (section_header): Handle section type.
7985         (opt_address_and_section_type): Return section type value.
7986
7987 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7988
7989         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7990         * testsuite/plugin_common_test_2.c (foo): Likewise.
7991
7992 2010-04-08  Doug Kwan  <dougkwan@google.com>
7993
7994         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7995         Output_merge_data.
7996         * output.cc (Output_section::add_merge_input_section): Simplify
7997         code and return status of Output_merge_base::add_input_section.
7998         Update merge section map only if Output_merge_base::add_input_section
7999         returns true.
8000
8001 2010-04-07  Doug Kwan  <dougkwan@google.com>
8002
8003         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8004         if section is marked as containing instructions but has no mapping
8005         symbols.
8006         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8007         correct section index.
8008         (Arm_relobj::find_linked_text_section): Ditto.
8009
8010 2010-04-07  Cary Coutant  <ccoutant@google.com>
8011
8012         * archive.cc (include_member): Destroy Read_symbols_data object before
8013         releasing file.
8014         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8015         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8016         (Read_symbols_data::~Read_symbols_data) New destructor.
8017         (Section_relocs::Section_relocs) New constructor.
8018         (Section_relocs::~Section_relocs) New destructor.
8019         (Read_relocs_data::Read_relocs_data) New constructor.
8020         (Read_relocs_data::~Read_relocs_data) New destructor.
8021         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8022         pointers to NULL after deleting.
8023
8024 2010-04-07  Doug Kwan  <dougkwan@google.com>
8025
8026         * arm.cc: Replace "endianity" with "endianness" in comments.
8027         (Arm_exidx_cantunwind): Ditto.
8028         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8029         (Arm_relobj::merge_flags_and_attributes): New method.
8030         (Arm_relobj::merge_flags_and_attributes_): New data member.
8031         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8032         (Arm_relobj::scan_sections_for_stubs): Ditto.
8033         (Arm_relobj::do_read_symbols): Check to see if we really want to
8034         merge processor-specific flags and attributes.  Exit early if
8035         an object is empty except for section names and the undefined symbol.
8036         (Target_arm::do_finalize_sections): Move check for ELF format to
8037         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8038         attributes from a regular object only when we have determined that
8039         it is aapropriate.  Do not create an .ARM.attributes section in
8040         output if there is no regular input object.
8041         (Target_arm::merge_processor_specific_flags): Check
8042         --warn-mismatch before printing any error.
8043         (Target_arm::merge_object_attributes): Ditto.
8044         * gold.cc (queue_middle_tasks): Handle the case in which there is
8045         no regular object in input.
8046         * options.cc (General_options::parse_EB): New method.
8047         (General_options::parse_EL): Same.
8048         (General_options::General_options): Initialize endianness_.
8049         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8050         New options.
8051         (General_options::Endianness): New enum.
8052         (General_options::endianness): New method.
8053         (General_options::endianness_): New data member.
8054         * parameters.cc (Parameters::set_options): Check target endianness.
8055         (Parameters::set_target_once): Ditto.
8056         (Parameters::check_target_endianness): New method.
8057         (parameters_force_valid_target): If either -EL or -EB is specified,
8058         use it to define endianness of default target.
8059         * parameters.h (Parameters::check_target_endianness): New method
8060         declaration.
8061         * target.h (class Target): Change "endianity" to "endianness"
8062         in comments.
8063
8064 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8065
8066         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8067         * configure: Regenerate.
8068         * Makefile.in: Regenerate.
8069         * testsuite/Makefile.in: Regenerate.
8070
8071 2010-04-06  Cary Coutant  <ccoutant@google.com>
8072
8073         gcc PR lto/42757
8074         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8075         prevailing definitions of common symbols.
8076         * testsuite/plugin_test_6.sh: New test case.
8077         * testsuite/plugin_common_test_1.c: New test case.
8078         * testsuite/plugin_common_test_2.c: New test case.
8079         * testsuite/Makefile.am (plugin_test_6): New test case.
8080         * testsuite/Makefile.in: Regenerate.
8081
8082 2010-04-06  Nick Clifton  <nickc@redhat.com>
8083
8084         * po/vi.po: New Vietnamese translation.
8085
8086 2010-03-30  Doug Kwan  <dougkwan@google.com>
8087
8088         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8089
8090 2010-03-25  Doug Kwan  <dougkwan@google.com>
8091
8092         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8093         to avoid a conversion warning on a 32-bit host.
8094
8095 2010-03-24  Ian Lance Taylor  <iant@google.com>
8096
8097         * testsuite/script_test_3.t: Add a TLS segment.
8098         * testsuite/Makefile.am (check_PROGRAMS): Add
8099         tls_phdrs_script_test.
8100         (tls_phdrs_script_test_SOURCES): Define.
8101         (tls_phdrs_script_test_DEPENDENCIES): Define.
8102         (tls_phdrs_script_test_LDFLAGS): Define.
8103         (tls_phdrs_script_test_LDADD): Define.
8104         * testsuite/Makefile.in: Rebuild.
8105
8106 2010-03-23  Cary Coutant  <ccoutant@google.com>
8107
8108         * fileread.cc (find_or_make_view): Fix comment.
8109
8110 2010-03-23  Ian Lance Taylor  <iant@google.com>
8111
8112         * script-sections.cc (class Orphan_section_placement): Define
8113         PLACE_TLS and PLACE_TLS_BSS.
8114         (Orphan_section_placement::Orphan_section_placement): Initialize
8115         new places.
8116         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8117         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8118         (tls_script_test_SOURCES): Define.
8119         (tls_script_test_DEPENDENCIES): Define.
8120         (tls_script_test_LDFLAGS): Define.
8121         (tls_script_test_LDADD): Define.
8122         * testsuite/Makefile.in: Rebuild.
8123
8124 2010-03-22  Doug Kwan  <dougkwan@google.com>
8125
8126         * arm.cc (Arm_relocate_functions::abs8,
8127         Arm_relocate_functions::abs16): Use correct check for overflow
8128         specified in the ARM ELF specs.
8129         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8130         target of a BLX instruction specially.
8131         (Reloc_stub::stub_type_for_reloc): Ditto.
8132         (Relocate::relocate): Use symbolic names instead of numeric relocation
8133         codes to report error.
8134         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8135         workaround.
8136         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8137         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8138         thumb2_blx_out_of_range.stdout
8139         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8140         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8141         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8142         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8143         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8144         thumb2_blx_in_range, thumb2_blx_in_range.o,
8145         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8146         thumb2_blx_out_of_range.o): New rules.
8147         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8148         thumb2_blx_in_range and thumb2_blx_out_of_range.
8149         * testsuite/Makefile.in: Regenerate.
8150         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8151         * testsuite/thumb_blx_in_range.s: New file.
8152         * testsuite/thumb_blx_out_of_range.s: New file.
8153
8154 2010-03-22  Rafael Espindola  <espindola@google.com>
8155
8156         * archive.cc (Should_include): Move to archive.h.
8157         (should_include_member): Make it a member of Archive.
8158         (Lib_group): New.
8159         (Add_lib_group_symbols): New.
8160         * archive.h: Include options.h.
8161         (Archive_member): Moved from Archive.
8162         (Should_include): Moved from archive.cc.
8163         (Lib_group): New.
8164         (Add_lib_group_symbols): New.
8165         * dynobj.cc (do_should_include_member): New.
8166         * dynobj.h (do_should_include_member): New.
8167         * gold.cc (queue_initial_tasks): Update call to queue.
8168         * main.cc (main): Print lib group stats.
8169         * object.cc (do_should_include_member): New.
8170         * object.h: Include archive.h.
8171         (Object::should_include_member): New.
8172         (Object::do_should_include_member): New.
8173         (Sized_relobj::do_should_include_member): New.
8174         * options.cc (General_options::parse_start_lib): New.
8175         (General_options::parse_end_lib): New.
8176         (Input_arguments::add_file): Handle lib groups.
8177         (Input_arguments::start_group): Check we are not in a lib.
8178         (Input_arguments::start_lib): New.
8179         (Input_arguments::end_lib): New.
8180         * options.h (General_options): Add start_lib and end_lib.
8181         (Input_argument::lib_): New.
8182         (Input_argument::lib): New.
8183         (Input_argument::is_lib): New.
8184         (Input_file_lib): New.
8185         (Input_arguments::in_lib_): New.
8186         (Input_arguments::in_lib): New.
8187         (Input_arguments::start_lib): New.
8188         (Input_arguments::end_lib_): New.
8189         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8190         in unused members as preempted.
8191         (Sized_pluginobj::do_should_include_member): New.
8192         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8193         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8194         return the blocker.
8195         (Read_symbols::do_whole_lib_group): New.
8196         (Read_symbols::do_lib_group): New.
8197         (Read_symbols::do_read_symbols): Handle lib groups.
8198         (Read_symbols::get_name): Handle lib groups.
8199         * readsyms.h (Read_symbols): Add an archive member pointer.
8200         (Read_symbols::do_whole_lib_group): New.
8201         (Read_symbols::do_lib_group): New.
8202         (Read_symbols::member_): New.
8203         * script.cc (read_input_script): Update call to queue_soon.
8204
8205 2010-03-19  Doug Kwan  <dougkwan@google.com>
8206
8207         * arm.cc (Stub_table::Stub_table): Initialize new data members
8208         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8209         (Stub_table::add_reloc_stub): Assign stub offset and update
8210         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8211         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8212         New data members.
8213         (Stub_table::update_data_size_and_addralign): Use
8214         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8215         instead of going over all reloc stubs.
8216         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8217         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8218         Stringpool_template::offset_ to size of Stringpool_char.
8219         (Stringpool_template::new_key_offset): Remove code to initialize
8220         Stringpool_template::offset_.
8221         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8222         Stringpool_template::offset_ to zero.
8223
8224 2010-03-15  Doug Kwan  <dougkwan@google.com>
8225
8226         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8227         offset_.
8228         (Stringpool_template::new_key_offset): New method.
8229         (Stringpool_template::add_string): Assign offsets when adding new
8230         strings.
8231         (Stringpool_template::set_string_offsets): Do not set string offsets
8232         when not optimizing.
8233         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8234         member size_.
8235         (Chunked_vector::clear): Clear size_.
8236         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8237         (Chunked_vector::size): Return size_.
8238         (Chunked_vector::push_back): Use size_ to find insert position.
8239         (Chunked_vector::size_): New data member.
8240         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8241         (Stringpool_template::new_key_offset): New method declaration.
8242         (Stringpool_template::offset_): New data member.
8243
8244 2010-03-15   Rafael Espindola  <espindola@google.com>
8245
8246         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8247         Add_symbols' constructor.
8248         * readsyms.h (Add_symbols): Remove the input_group member.
8249
8250 2010-03-10  Ian Lance Taylor  <iant@google.com>
8251
8252         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8253         target to ask whether a reference to a symbol requires a stack
8254         split.
8255         * target.h (Target::is_call_to_non_split): New function.
8256         (Target::do_is_call_to_non_split): Declare virtual function.
8257         * target.cc: Include "symtab.h".
8258         (Target::do_is_call_to_non_split): New function.
8259         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8260
8261 2010-03-10  Cary Coutant  <ccoutant@google.com>
8262
8263         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8264         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8265         (File_read::open[2]): Add whole_file_view_ to list of views.
8266         (File_read::make_view): Remove test of whole_file_view_.
8267         (File_read::find_or_make_view): Create whole_file_view_ if
8268         necessary.
8269         (File_read::clear_views): Replace bool parameter with enum;
8270         adjust all callers.  Don't delete views with permanent data;
8271         do delete cached views and views from archives if
8272         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8273         if clearing the corresponding view.
8274         * fileread.h (File_read::Clear_views_mode): New enum.
8275         (File_read::View::is_permanent_view): New method.
8276         (File_read::clear_views): Replace bool parameter
8277         with enum; adjust all callers.
8278         * options.h (General_options): Change keep_files_mapped option;
8279         add map_whole_files.
8280         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8281         releasing the file.
8282         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8283         the file.
8284
8285 2010-03-10  David S. Miller  <davem@davemloft.net>
8286
8287         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8288
8289 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8290
8291         * icf.cc (get_section_contents): Add '@' marker after processing the
8292         merge reloc.
8293
8294 2010-03-08  Doug Kwan  <dougkwan@google.com>
8295
8296         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8297         due to a conversion warning.
8298         (Arm_relobj::update_output_local_symbol_count): Check for local
8299         symbol with unset output index.
8300
8301 2010-03-05  Ian Lance Taylor  <iant@google.com>
8302
8303         * options.h (class General_options): Add --spare-dynamic-tags.
8304         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8305         --spare-dynamic-tags.
8306
8307 2010-03-05  Ian Lance Taylor  <iant@google.com>
8308
8309         * incremental.cc: Include "libiberty.h".
8310
8311 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8312
8313         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8314         function, is_info_ member.
8315         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8316         (Versions::Versions): Update caller.
8317         (Versions::define_base_version): Likewise.
8318         (Versions::add_def): Likewise.
8319
8320 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8321
8322         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8323         (Scan::possible_function_pointer_reloc): New function.
8324         (Scan::local_reloc_may_be_function_pointer): Change to call
8325         possible_function_pointer_reloc.
8326         (Scan::global_reloc_may_be_function_pointer): Ditto.
8327         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8328         relocations in ".data.rel.ro._ZTV" section.
8329         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8330         * testsuite/icf_safe_so_test.cc: Ditto.
8331         * testsuite/icf_safe_test.cc: Ditto.
8332         * testsuite/icf_safe_test.sh: Ditto.
8333
8334 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8335             Ian Lance Taylor  <iant@google.com>
8336
8337         * target-reloc.h (relocate_section): Check the symbol table index
8338         for -1U before setting the local symbol index.
8339         (scan_relocatable_relocs): If copying the relocation, record that
8340         the local symbol is required.
8341         * object.h (Symbol_value::is_output_symtab_index_set): New
8342         function.
8343         (Symbol_value::may_be_discarded_from_output_symtab): New
8344         function.
8345         (Symbol_value::has_output_symtab_entry): New function.
8346         (Symbol_value::needs_output_symtab_entry): Remove.
8347         (Symbol_value::output_symtab_index): Make sure the symbol index is
8348         set.
8349         (Symbol_value::set_output_symtab_index): Make sure the symbol
8350         index is not set.  Make sure the new index is valid.
8351         (Symbol_value::set_must_have_output_symtab_entry): New function.
8352         (Symbol_value::has_output_dynsym_entry): New function.
8353         (Symbol_value::set_output_dynsym_index): Make sure the new index
8354         is valid.
8355         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8356         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8357         local symbol if permitted.
8358         (Sized_relobj::do_finalize_local_symbols): Call
8359         is_output_symtab_index_set rather than needs_output_symtab_entry.
8360         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8361         rather than needs_output_symtab_entry.  Call
8362         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8363         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8364         is_output_symtab_index_set rather than needs_output_symtab_entry.
8365         * testsuite/discard_locals_relocatable_test.c: New file.
8366         * testsuite/discard_locals_test.sh: Test -r.
8367         * testsuite/Makefile.am (check_DATA): Add
8368         discard_locals_relocatable_test1.syms,
8369         discard_local_relocatable_test2.syms.
8370         (MOSTLYCLEANFILES): Likewise.  Also add
8371         discard_locals_relocatable_test1.lout and
8372         discard_locals_relocatable_test2.out.
8373         (discard_locals_relocatable_test1.syms): New target.
8374         (discard_locals_relocatable_test.o): New target.
8375         (discard_locals_relocatable_test1.out): New target.
8376         (discard_locals_relocatable_test2.syms): New target.
8377         (discard_locals_relocatable_test2.out): New target.
8378         (various): Add missing ../ld-new dependencies.
8379         * testsuite/Makefile.in: Rebuild.
8380
8381 2010-03-03  Nick Clifton  <nickc@redhat.com>
8382
8383         * po/fi.po: New Finnish translation.
8384
8385 2010-03-01  Doug Kwan  <dougkwan@google.com>
8386
8387         * layout.cc (Layout::Layout): Force section types of .init_array*,
8388         .preinit_array* and .fini_array* sections.
8389         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8390         Fix check of return value of std::string::find.().
8391         (Output_section::Input_section_sort_compare::operator()): Remove
8392         comment about .init_array.
8393         (Output_section::Input_section_sort_init_fini_compare::operator()):
8394         New method.
8395         (Output_section::sort_attached_input_sections): Handle .init_array
8396         and .fini_array specially.
8397         * output.h (Output_section::Inut_section_sort_compare): Update
8398         comment.
8399         (Output_section::Input_section_sort_init_fini_compare): New struct.
8400
8401 2010-02-26  Doug Kwan  <dougkwan@google.com>
8402
8403         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8404         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8405         * testsuite/debug_msg.sh: Avoid matching source line number for
8406         use of global variable undef_int.
8407
8408 2010-02-26  Doug Kwan  <dougkwan@google.com>
8409
8410         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8411         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8412         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8413         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8414         * options.cc (General_options::General_options): Initialize member
8415         fix_v4bx_.
8416         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8417         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8418         and rm_no_fix_v4bx.stdout
8419         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8420         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8421         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8422         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8423         and arm_no_fix_v4bx.
8424         * Makefile.in: Regenerate.
8425         * testsuite/arm_fix_v4bx.s: New file.
8426         * testsuite/arm_fix_v4bx.sh: Ditto.
8427
8428 2010-02-24  Doug Kwan  <dougkwan@google.com>
8429
8430         * arm.cc (Target_arm::got_section): Make the .got section the first
8431         non RELRO section in the data segment.
8432         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8433         suffixes of section names.
8434
8435 2010-02-24  Doug Kwan  <dougkwan@google.com>
8436
8437         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8438         flags and attributes merging if an input file is a binary file.
8439         * fileread.cc (Input_file::open): Record format of original file.
8440         * fileread.h (Input_file::Format): New enum type.
8441         (Input_file::Input_file): Initialize data member format_.
8442         (Input_file::format): New method definition.
8443         (Input_file::format_):: New data member.
8444
8445 2010-02-24  Doug Kwan  <dougkwan@google.com>
8446
8447         * arm.cc (Arm_output_data_got): New class.
8448         (ARM_TCB_SIZE): New constant
8449         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8450         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8451         If user uses a script with a SECTIONS clause, issue only a warning
8452         for a misplaced EXIDX input section.  Otherwise, issue an error.
8453         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8454         garbage collection.
8455         (Target_arm::got_mode_index_entry): Handle static linking.
8456         (Target_arm::Scan::local): Ditto.
8457         (Target_arm::Scan::global): Ditto.
8458         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8459         all incorrectly implemented relocations.
8460         (Target_arm::fix_exidx_coverage): Pass layout to
8461         Arm_output_section::fix_exidx_coverage.
8462         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8463         from ".ARM.exidx." and ".ARM.extab.".
8464
8465 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8466
8467         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8468         section if it does not already exist.
8469         * attributes.cc (Attributes_section_data::Attributes_section_data):
8470         Don't crash if size is zero.
8471
8472 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8473             Ian Lance Taylor  <iant@google.com>
8474
8475         * gold.cc (queue_middle_tasks): If no input files were opened,
8476         exit.
8477         * workqueue.h (Task_function::Task_function): Assert that there is
8478         a blocker.
8479
8480 2010-02-22  Doug Kwan  <dougkwan@google.com>
8481
8482         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8483         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8484         types to avoid warnings due to different uint64_t implementations
8485         on different hosts.
8486
8487 2010-02-21  Doug Kwan  <dougkwan@google.com>
8488
8489         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8490         handling of the maximum backward branch offset.
8491         (Arm_relocate_functions::thumb_branch_common): Ditto.
8492         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8493         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8494         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8495         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8496         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8497         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8498         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8499         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8500         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8501         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8502         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8503         thumb2_bl_out_of_range.o): New rules.
8504         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8505         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8506         thumb2_bl_out_of_range
8507         * testsuite/Makefile.in: Regenerate.
8508         * testsuite/arm_bl_in_range.s: New file.
8509         * testsuite/arm_bl_out_of_range.s: Ditto.
8510         * testsuite/arm_branch_in_range.sh: Ditto.
8511         * testsuite/arm_branch_range.t: Ditto.
8512         * testsuite/thumb2_branch_range.t: Ditto.
8513         * testsuite/thumb_bl_in_range.s: Ditto.
8514         * testsuite/thumb_bl_out_of_range.s: Ditto.
8515         * testsuite/thumb_branch_range.t: Ditto.
8516
8517 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8518
8519         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8520         Add reloc offset information.
8521         * icf.cc (get_section_contents): Change iterators to point to the new
8522         vectors. Add reloc offset information to the contents.
8523         * icf.h (Icf::Sections_reachable_info): New typedef.
8524         (Icf::Sections_reachable_list): New typedef.
8525         (Icf::Offset_info): New typedef.
8526         (Icf::Reloc_info): New struct typedef.
8527         (Icf::Reloc_info_list): New typedef.
8528         (Icf::symbol_reloc_list): Delete method.
8529         (Icf::addend_reloc_list): Delete method.
8530         (Icf::section_reloc_list): Delete method.
8531         (Icf::reloc_info_list): New method.
8532         (Icf::reloc_info_list_): New member.
8533
8534 2010-02-19  Doug Kwan  <dougkwan@google.com>
8535
8536         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8537         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8538         * arm.cc (Arm_relocation_functions): New forward declaration.
8539         (Target_arm::Target_arm): Initialize new data members
8540         got_mod_index_offset_ and tls_base_symbol_defined_.
8541         (Target_arm::Relocate::relocate_tls): New method.
8542         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8543          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8544         New methods.
8545         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8546         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8547         (Target_arm::got_mod_index_offset_,
8548         Target_arm::tls_base_symbol_defined_): New data members.
8549         (Target_arm::Scan::local, Target::Scan::global,
8550         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8551         relocations.
8552
8553 2010-02-18  Doug Kwan  <dougkwan@google.com>
8554
8555         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8556         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8557         text section as a parameter becuase some broken tools may not set
8558         the link in section header.
8559         (Target_arm::has_got_section): New method.
8560         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8561         without any mapping symbol as data only.  Remove warning.
8562         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8563         link in its section header, try to discover the link by inspecting the
8564         REL31 relocation at the beginning of the section.
8565         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8566         in error message.
8567         (Target_arm::Scan::global): Treat any reference to the symbol
8568         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8569
8570 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8571
8572         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8573         (Scan::global_reloc_may_be_function_pointer): New function.
8574         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8575         (Scan::global_reloc_may_be_function_pointer): New function.
8576         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8577         (Scan::global_reloc_may_be_function_pointer): New function.
8578         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8579         (Scan::global_reloc_may_be_function_pointer): New function.
8580         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8581         (Scan::global_reloc_may_be_function_pointer): New function.
8582         (Scan::possible_function_pointer_reloc): New function.
8583         (Target_x86_64::can_check_for_function_pointers): New function.
8584         * gc.h (gc_process_relocs): Scan relocation types to determine if
8585         function pointers were taken for targets that support it.
8586         * icf.cc (Icf::find_identical_sections): Include functions for
8587         folding in safe ICF whose pointer is not taken.
8588         * icf.h (Secn_fptr_taken_set): New typedef.
8589         (fptr_section_id_): New member.
8590         (section_has_function_pointers): New function.
8591         (set_section_has_function_pointers): New function.
8592         (check_section_for_function_pointers): New function.
8593         * options.h: Fix comment for safe ICF option.
8594         * target.h (can_check_for_function_pointers): New function.
8595         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8596         Modify icf_safe_test for X86-64.
8597         * testsuite/Makefile.in: Regenerate.
8598         * testsuite/icf_safe_so_test.cc: New file.
8599         * testsuite/icf_safe_so_test.sh: New file.
8600         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8601         (main): Change to take pointer to function kept_func_3.
8602         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8603         folding is done correctly for X86-64.
8604
8605 2010-02-12  David S. Miller  <davem@davemloft.net>
8606
8607         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8608         is_symbolless parameter.
8609         (Output_reloc<SHT_REL>::is_symbolless): New.
8610         (Output_reloc<SHT_REL>::is_symbolless_): New.
8611         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8612         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8613         (Output_reloc<SHT_RELA>::is_symbolless): New.
8614         (Output_data_reloc::add_global): Handle is_symbolless.
8615         (Output_data_reloc::add_global_relative): Likewise.
8616         (Output_data_reloc::add_local): Likewise.
8617         (Output_data_reloc::add_local_relative): Likewise.
8618         (Output_data_reloc::add_symbolless_global_addend): New.
8619         (Output_data_reloc::add_symbolless_local_addend): New.
8620         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8621         is_symbolless.
8622         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8623         instead of ->is_relative_
8624         (Output_reloc::write): Likewise.
8625         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8626         (Output_reloc::write_rel): Simplify.
8627
8628         * sparc.cc (Target_sparc::Scan::local): Use
8629         ->add_symbolless_local_addend as needed.
8630         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8631         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8632         based upon relocation offset.
8633
8634 2010-02-11  Doug Kwan  <dougkwan@google.com>
8635
8636         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8637         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8638         beginning of function.
8639         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8640         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8641         parameter is_32bit in calls to should_apply_static_reloc.
8642         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8643         (check_DATA): Add arm_abs_global.stdout.
8644         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8645         arm_abs_global.stdout): New rules.
8646         (MOSTLLYCLEANFILES): Add arm_abs_global
8647         * Makefile.in: Regenerate.
8648         * testsuite/arm_abs_global.s: New file.
8649         * testsuite/arm_abs_global.sh: Ditto.
8650         * testsuite/arm_abs_lib.s: Ditto.
8651
8652 2010-02-11  Ian Lance Taylor  <iant@google.com>
8653
8654         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8655         Read_relocs task.
8656         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8657         Allocate_commons_task first.
8658         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8659         task, rather than symtab_lock_.
8660         (Gc_process_relocs::~Gc_process_relocs): New function.
8661         (Gc_process_relocs::is_runnable): Check this_blocker_.
8662         (Gc_process_relocs::locks): Use next_blocker_ rather than
8663         blocker_.
8664         (Scan_relocs::~Scan_relocs): New function.
8665         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8666         symtab_lock_.
8667         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8668         next_blocker_.
8669         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8670         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8671         constructor accordingly.
8672         (class Gc_process_relocs): Likewise.
8673         (class Scan_relocs): Likewise.
8674         * common.h (class Allocate_commons_task): Remove symtab_lock_
8675         field, and corresponding constructor parameter.
8676         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8677         symtab_lock_.
8678         (Allocate_commons_task::locks): Likewise.
8679
8680 2010-02-11  Ian Lance Taylor  <iant@google.com>
8681
8682         * gold-threads.h (class Once): Define.
8683         (class Initialize_lock): Rewrite as child of Once.
8684         * gold-threads.cc (class Once_initialize): Define.
8685         (once_pointer_control): New static variable.
8686         (once_pointer, once_arg): New static variables.
8687         (c_run_once): New static function.
8688         (Once::Once, Once::run_once, Once::internal_run): New functions.
8689         (class Initialize_lock_once): Remove.
8690         (initialize_lock_control): Remove.
8691         (initialize_lock_pointer): Remove.
8692         (initialize_lock_once): Remove.
8693         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8694         (Initialize_lock::initialize): Rewrite.
8695         (Initialize_lock::do_run_once): New function.
8696         * archive.cc (Archive::interpret_header): Only clear name if it is
8697         not already empty.
8698         * fileread.cc: Include "gold-threads.h"
8699         (file_counts_lock): New static variable.
8700         (file_counts_initialize_lock): Likewise.
8701         (File_read::release): Only increment counts when using --stats.
8702         Use a lock around the increment.
8703         * parameters.cc (class Set_parameters_target_once): Define.
8704         (set_parameters_target_once): New static variable.
8705         (Parameters::Parameters): Move here from parameters.h.
8706         (Parameters::set_target): Rewrite.
8707         (Parameters::set_target_once): New function.
8708         (Parameters::clear_target): Move here and rewrite.
8709         * parameters.h (class Parameters): Update declarations.  Add
8710         set_parameters_target_once_ field.
8711         (Parameters::Parameters): Move to parameters.cc.
8712         (Parameters::clear_target): Likewise.
8713         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8714         task.
8715         (Start_group::~Start_group): New function.
8716         (Start_group::is_runnable): New function.
8717         (Start_group::locks, Start_group::run): New functions.
8718         (Finish_group::run): Change saw_undefined to size_t.
8719         * readsyms.h (class Start_group): Define.
8720         (class Finish_group): Change saw_undefined_ field to size_t.
8721         (Finish_group::Finish_group): Remove saw_undefined and
8722         this_blocker parameters.  Change all callers.
8723         (Finish_group::set_saw_undefined): New function.
8724         (Finish_group::set_blocker): New function.
8725         * symtab.h (class Symbol_table): Change saw_undefined to return
8726         size_t.  Change saw_undefined_ field to size_t.
8727         * target-select.cc (Set_target_once::do_run_once): New function.
8728         (Target_selector::Target_selector): Initialize set_target_once_
8729         field.  Don't initialize lock_ and initialize_lock_ fields.
8730         (Target_selector::instantiate_target): Rewrite.
8731         (Target_selector::set_target): New function.
8732         * target-select.h (class Set_target_once): Define.
8733         (class Target_selector): Update declarations.  Make
8734         Set_target_once a friend.  Remove lock_ and initialize_lock_
8735         fields.  Add set_target_once_ field.
8736
8737 2010-02-10  Ian Lance Taylor  <iant@google.com>
8738
8739         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8740         queueing any tasks.
8741         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8742         (queue_middle_tasks): Add all blockers before queueing any tasks.
8743         (queue_final_tasks): Likewise.
8744         * token.h (Task_token::add_blockers): New function.
8745         * object.h (Input_objects::number_of_relobjs): New function.
8746
8747 2010-02-10  Ian Lance Taylor  <iant@google.com>
8748
8749         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8750         shared, not if not position independent.
8751         * x86_64.cc (Relocate::relocate_tls): Likewise.
8752         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8753         (tls_pie_pic_test): New target.
8754         * testsuite/Makefile.in: Rebuild.
8755
8756         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8757         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8758         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8759         * testsuite/Makefile.in: Rebuild.
8760
8761 2010-02-09  David S. Miller  <davem@davemloft.net>
8762
8763         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8764         R_SPARC_RELATIVE using ->add_local_relative().
8765         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8766
8767         * output.h (Output_data_dynamic::add_section_size): New method
8768         that takes two Output_data objects.
8769         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8770         entry param.  Handle it in initializers.
8771         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8772         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8773         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8774         arg.
8775         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8776         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8777         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8778         for dynrel_includes_plt.
8779         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8780         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8781         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8782         before .rela.plt
8783         (Target_sparc::do_finalize_sections): Update to pass true for
8784         dynrel_includes_plt.
8785         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8786         output before .rela.plt
8787         (Target_powerpc::do_finalize_sections): Update to pass true for
8788         dynrel_includes_plt when 32-bit.
8789
8790 2010-02-08  Doug Kwan  <dougkwan@google.com>
8791
8792         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8793         method.
8794         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8795         Arm_relobj::scan_section_for_cortex_a8_stubs,
8796         Arm_relobj::do_relocation_section): Instead of calling
8797         Output_section::output_address, use faster
8798         Arm_relobj::simple_input_section_output_address.
8799
8800 2010-02-08  David S. Miller  <davem@davemloft.net>
8801
8802         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8803         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8804         relocation helper function.
8805
8806         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8807         just like R_SPARC_GOT{10,13,22}.
8808         (Target_sparc::Scan::local): Likewise.
8809         (Target_sparc::Relocate:relocate): Likewise.
8810
8811 2010-02-06  Ian Lance Taylor  <iant@google.com>
8812
8813         * configure.ac: Rewrite targetobjs duplicate removal code to use
8814         only shell constructs.
8815         * configure: Rebuild.
8816
8817 2010-02-05  Doug Kwan  <dougkwan@google.com>
8818
8819         PR 11247
8820         * arm.cc (Arm_relobj::section_is_scannable): New method.
8821         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8822         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8823
8824 2010-02-04  Doug Kwan  <dougkwan@google.com>
8825
8826         PR 11247
8827         * arm-reloc-property.cc (cstdio): Include.
8828         * configure.ac (targetobjs): Remove duplicates.
8829         * configure: Regenerate.
8830         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8831         big and little endian version for a given address size.
8832
8833 2010-02-03  Doug Kwan  <dougkwan@google.com>
8834
8835         * arm-reloc-property.cc
8836         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8837         definition.
8838         * arm-reloc-property.h
8839         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8840         New method definition.
8841         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8842         declaration.
8843         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8844         overflow to N.
8845         (GOT_PREL): Change implemented to Y.
8846         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8847         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8848         (Arm_relocate_functions::movw_abs_nc): Remove method.
8849         (Arm_relocate_functions::movt_abs): Ditto.
8850         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8851         (Arm_relocate_functions::thm_movt_abs): Ditto.
8852         (Arm_relocate_functions::movw_rel_nc): Ditto.
8853         (Arm_relocate_functions::movw_rel): Ditto.
8854         (Arm_relocate_functions::movt_rel): Ditto.
8855         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8856         (Arm_relocate_functions:thm_movw_rel): Ditto.
8857         (Arm_relocate_functions:thm_movt_rel): Ditto.
8858         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8859         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8860         New method definitions.
8861         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8862         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8863         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8864         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8865         (Target_arm::Relocate::relocate): Check for non-static or
8866         unimplemented relocation code and exit early.  Change calls to
8867         Target_arm::reloc_uses_thumb_bit and
8868         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8869         instead.  Refactor code to handle similar relocations to increase
8870         code sharing.  Remove check for unsupported relocation code in switch
8871         statement.
8872         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8873         relocation property table to find out size.  Change error message to
8874         print out the name of a relocation code instead of the numeric value.
8875         (Target_arm::scan_reloc_for_stub): Use relocation property table
8876         instead of calling Target_arm::reloc_uses_thumb_bit().
8877
8878 2010-02-02  Doug Kwan  <dougkwan@google.com>
8879
8880         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8881         types of relaxed input section.
8882
8883 2010-02-02  Doug Kwan  <dougkwan@google.com>
8884
8885         * Makefile.am (HFILES): Add arm-reloc-property.h.
8886         (DEFFILES): New.
8887         (TARGETSOURCES): Add arm-reloc-property.cc
8888         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8889         (libgold_a_SOURCES): $(DEFFILES)
8890         * Makefile.in: Regenerate.
8891         * arm-reloc-property.cc: New file.
8892         * arm-reloc-property.h: New file.
8893         * arm-reloc.def: New file.
8894         * arm.cc: Update comments.
8895         (arm-reloc-property.h): New included header.
8896         (arm_reloc_property_table): New global variable.
8897         (Target_arm::do_select_as_default_target): New method definition.
8898         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8899         arm-reloc-property to targ_extra_obj.
8900         * parameters.cc (set_parameters_target): Call
8901         Target::select_as_default_target().
8902         * target.h (Target::select_as_default_target): New method definition.
8903         (Target::do_select_as_default_target): Same.
8904
8905 2010-02-01  Doug Kwan  <dougkwan@google.com>
8906
8907         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8908         first_output_text_section_.
8909         (Arm_exidx_fixup::first_output_text_section): New method definition.
8910         (Arm_exidx_fixup::first_output_text_section_): New data member.
8911         (Arm_exidx_fixup::process_exidx_section): Record the first text
8912         output section seen.
8913         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8914         and entsize in output section header.
8915
8916 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8917
8918         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8919         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8920         (Arm_relocate_functions::thm_alu11): New Method.
8921         (Arm_relocate_functions::thm_pc8): New Method.
8922         (Arm_relocate_functions::thm_pc12): New Method.
8923         (Target_arm::Scan::local): Handle the relocations.
8924         (Target_arm::Scan::global): Likewise.
8925         (Target_arm::Relocate::relocate): Likewise.
8926         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8927
8928 2010-01-29  Doug Kwan  <dougkwan@google.com>
8929
8930         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8931         of relocation types as ld.
8932
8933 2010-01-29  Doug Kwan  <dougkwan@google.com>
8934
8935         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8936         to public.
8937         (Arm_relocate_functions::thumb_branch_common): Ditto.
8938         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8939         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8940         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8941         Arm_relocate_functions::jump24): Remove.
8942         (Target_arm::Relocate::relocate): Adjust code to call
8943         Arm_relocation_functions::arm_branch_common and
8944         Arm_relocation_functions::thumb_branch_common instead of their removed
8945         wrappers.  Merge switch-cases together to reduce source code size.
8946
8947 2010-01-29  Doug Kwan  <dougkwan@google.com>
8948
8949         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8950         output_local_symbol_count_needs_update_.
8951         (Arm_relobj::output_local_symbol_count_needs_update,
8952          Arm_relobj::set_output_local_symbol_count_needs_update,
8953          Arm_relobj::update_output_local_symbol_count): New methods.
8954         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8955         member.
8956         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8957         of pointed function as in a R_ARM_PREL31 relocation.
8958         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8959         for output local symbol count updating.
8960         (Target_arm::do_relax): Update output local symbol counts in objects
8961         if necessary.
8962         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8963
8964 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8965
8966         * arm.cc: Added support for the ARM relocations:
8967         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8968         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8969         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8970         movw_prel_nc).
8971         (Arm_relocate_functions::movw_rel): New method.
8972         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8973         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8974         thm_movw_prel_nc).
8975         (Arm_relocate_functions::thm_movw_rel): New method.
8976         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8977         thm_movt_prel).
8978         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8979         relocations.
8980         (Target_arm::Scan::global): Likewise.
8981         (Target_arm::Relocate::relocate): Likewise.
8982         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8983         Likewise.
8984
8985 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8986
8987         * arm.cc: Added support for ARM group relocations.
8988         (Target_arm::reloc_needs_sym_origin): New method.
8989         (Arm_relocate_functions::calc_grp_kn): New method.
8990         (Arm_relocate_functions::calc_grp_residual): New method.
8991         (Arm_relocate_functions::calc_grp_gn): New method.
8992         (Arm_relocate_functions::arm_grp_alu): New Method.
8993         (Arm_relocate_functions::arm_grp_ldr): New Method.
8994         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8995         (Arm_relocate_functions::arm_grp_ldc): New Method.
8996         (Target_arm::Scan::local): Handle the ARM group relocations.
8997         (Target_arm::Scan::global): Likewise.
8998         (Target_arm::Relocate::relocate): Likewise.
8999         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9000         Likewise.
9001
9002 2010-01-26  Doug Kwan  <dougkwan@google.com>
9003
9004         * arm.cc (set): Include.
9005         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9006         pointer type.
9007         (Arm_output_section::Text_section_list): New type.
9008         (Arm_output_section::append_text_sections_to_list): New method.
9009         (Arm_output_section::fix_exidx_coverage): Ditto.
9010         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9011         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9012         Relobj::set_section_offset() instead of
9013         Sized_relobj::invalidate_section_offset().
9014         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9015         parameter for section headers. Ignore relocation sections for
9016         unallocated sections and EXIDX sections.
9017         (Target_arm::fix_exidx_coverage): New method.
9018         (Target_arm::output_section_address_less_than): New type.
9019         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9020         linked text section instead of the EXIDX section.
9021         (Arm_output_section::create_stub_group): Add an assertion to check
9022         that this is not an EXIDX output section.
9023         (Arm_output_section::append_text_sections_to_list): New method.
9024         (Arm_output_section::fix_exidx_coverage): Ditto.
9025         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9026         Arm_relobj::section_needs_reloc_stub_scanning.
9027         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9028         first pass.
9029         (Target_arm::fix_exidx_coverage): New method.
9030         * object.h (Relobj::set_output_section): New method.
9031         (Sized_relobj::invalidate_section_offset): Remove method.
9032         (Sized_relobj::do_invalidate_section_offset): Remove method.
9033         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9034
9035 2010-01-25  Doug Kwan  <dougkwan@google.com>
9036
9037         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9038         Fix warning due to signed and unsigned comparison on a 32-bit host.
9039
9040 2010-01-22  Doug Kwan  <dougkwan@google.com>
9041
9042         * arm.cc (Target_arm::do_relax): Record an output section for section
9043         offset adjustment it contains any stub table that has changed.
9044         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9045         offsets in an output section if necessary.
9046         * output.cc (Output_section::Output_section): Initialize
9047         section_offsets_need_adjustments_.
9048         (Output_section::add_input_section_for_script): Renamed to
9049         Output_section::add_simple_input_section.
9050         (Output_section::save_states): Add a comment.
9051         (Output_section::discard_states): New method defintion.
9052         (Output_section::adjust_section_offsets): Same.
9053         * output.h (Output_section::add_input_section_for_script): Renamed to
9054         Output_section::add_simple_input_section.
9055         (Output_section::discard_states): New method declaration.
9056         (Output_section::adjust_section_offsets): Same.
9057         (Output_section::section_offsets_need_adjustment,
9058         Output_section::set_section_offsets_need_adjustment): New method
9059         definitions.
9060         (Output_section::section_offsets_need_adjustment_): New data member.
9061         * script-sections.cc
9062         (Output_section_element_input::set_section_address): Adjust code for
9063         renaming of Output_section::add_input_section_for_script.
9064         (Orphan_output_section::set_section_address): Same.
9065
9066 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9067
9068         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9069         Fix_v4bx enum values .
9070         * gold/options.h (General_options): New option definitions.
9071         (General_options::fix_v4bx): New method.
9072         (General_options::Fix_v4bx): New enum.
9073         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9074         (General_options::parse_fix_v4bx_interworking): New method.
9075
9076 2010-01-22  Doug Kwan  <dougkwan@google.com>
9077
9078         * arm.cc (Arm_exidx_fixup): New class.
9079
9080 2010-01-21  Doug Kwan  <dougkwan@google.com>
9081
9082         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9083         classes.
9084         (Arm_exidx_section_offset_map): New type.
9085
9086 2010-01-21  Doug Kwan  <dougkwan@google.com>
9087
9088         * arm.cc (Arm_exidx_input_section): New class.
9089         (Arm_relobj::exidx_input_section_by_link,
9090         Arm_relobj::exidx_input_section_by_shndx,
9091         Arm_relobj::make_exidx_input_section): New methods.
9092         (read_arm_attributes_section): Remove.
9093         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9094         information about them.
9095         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9096         to here.
9097
9098 2010-01-20  Doug Kwan  <dougkwan@google.com>
9099
9100         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9101         Input_section_specifier to Section_id.
9102         (Target_arm::new_arm_input_section: Adjust code for change of key
9103         type.
9104         (Target_arm::find_arm_input_section): Ditto.
9105         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9106         (Section_id): Remove.
9107         (Garbage_collection::Section_id_hash): Remove.
9108         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9109         (Section_id): Remove.
9110         (Icf::Section_id_hash): Remove.
9111         * object.h (Section_id, Const_section_id, Section_id_hash,
9112         Const_section_id_hash): New type definitions.
9113         * output.cc (Output_section::add_relaxed_input_section): Change to
9114         use Const_section_id instead of Input_section_specifier as key type.
9115         (Output_section::add_merge_input_section): Ditto.
9116         (Output_section::build_relaxation_map): Change to use Section_id
9117         instead of Input_section_specifier as key type.
9118         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9119         Ditto.
9120         (Output_section::convert_input_sections_to_relaxed_sections): Change
9121         to use Const_section_id instead of Input_section_specifier as key type.
9122         (Output_section::find_merge_section): Ditto.
9123         (Output_section::find_relaxed_input_section): Ditto.
9124         * output.h (Input_section_specifier): Remove class.
9125         (Output_section::Output_section_data_by_input_section_map): Change
9126         key type to Const_section_id.
9127         (Output_section::Output_relaxed_input_section_by_input_section_map):
9128         Ditto.
9129         (Output_section::Relaxation_map): Change key type to Section_id.
9130
9131 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9132
9133         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9134         (class Arm_v4bx_stub): New class.
9135         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9136         (Stub_factory::make_arm_v4bx_stub): New method.
9137         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9138         (Stub_table::empty): Handle v4bx stubs.
9139         (Stub_table::add_arm_v4bx_stub): New method.
9140         (Stub_table::find_arm_v4bx_stub): New method.
9141         (Arm_relocate_functions::v4bx): New method.
9142         (Target_arm::fix_v4bx): New method.
9143         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9144         (Stub_table::relocate_stubs): Likewise.
9145         (Stub_table::do_write): Likewise.
9146         (Stub_table::update_data_size_and_addralign): Likewise.
9147         (Stub_table::finalize_stubs):  Likewise.
9148         (Target_arm::Scan::local): Likewise.
9149         (Target_arm::Scan::global): Likewise.
9150         (Target_arm::do_finalize_sections): Likewise.
9151         (Target_arm::Relocate::relocate): Likewise.
9152         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9153         Likewise.
9154         (Target_arm::scan_reloc_for_stub): Likewise.
9155         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9156
9157 2010-01-19  Ian Lance Taylor  <iant@google.com>
9158
9159         * output.cc (Output_section_headers::do_sized_write): Write large
9160         segment count to sh_info field.
9161         (Output_file_header::do_sized_write): For large segment count,
9162         write PN_XNUM to e_phnum field.
9163
9164 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9165
9166         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9167         (Arm_relocate_functions::thm_jump8): New function.
9168         (Arm_relocate_functions::thm_jump11): New function.
9169         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9170         R_ARM_THM_JUMP11.
9171         (Target_arm::Scan::global): Likewise.
9172         (Target_arm::Relocate::relocate): Likewise.
9173         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9174         Likewise.
9175
9176 2010-01-14  Doug Kwan  <dougkwan@google.com>
9177
9178         * arm.cc (map, utility): Include headers.
9179         (Target_arm::apply_cortex_a8_workaround): New method.
9180         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9181         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9182         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9183         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9184         the --[no-]fix-cortex-a8 command line options.
9185         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9186         (Target_arm::relocate_stub): Use addend in instruction template.
9187         * options.h (DEFINE_bool): Set the user-set flag.
9188         (General_options): Add --[no-]-fix-cortex options.
9189         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9190         : Update fast look-up map after conversion.
9191
9192 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9193
9194         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9195         in the first pass of do_layout.
9196
9197 2010-01-13  Doug Kwan  <dougkwan@google.com>
9198
9199         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9200         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9201         apparent compiler problem of not folding static constant integral
9202         data members of elfcpp::Elf_sizes<32>.
9203
9204 2010-01-13  Doug Kwan  <dougkwan@google.com>
9205
9206         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9207         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9208         Arm_relobj::scan_section_for_cortex_a8_erratum,
9209         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9210         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9211         sections to scan for relocation stubs into a new method
9212         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9213         relocation and Cortex-A8 stub scanning.
9214         (Target_arm::do_relax): Force stubs to be after stubbed sections
9215         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9216         the beginning of a new relaxation pass.  Update a comment.
9217         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9218
9219 2010-01-12  Ian Lance Taylor  <iant@google.com>
9220
9221         * target-reloc.h (visibility_error): New inline function.
9222         (relocate_section): Call visibility_error.
9223         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9224         (MOSTLYCLEANFILES): Likewise.
9225         (protected_4_pic.o, protected_3.err): New targets.
9226         * testsuite/protected_4.cc: New file.
9227
9228 2010-01-12  Doug Kwan  <dougkwan@google.com>
9229
9230         * arm.cc (Cortex_a8_reloc): New class.
9231         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9232         and cortex_a8_relocs_info_.
9233         (Target_arm::fix_cortex_a8): New method definition.
9234         (Target_arm::Cortex_a8_relocs_info): New type.
9235         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9236         New data member declarations.
9237         (Target_arm::scan_reloc_for_stub): Record information about
9238         relocations for THUMB branches that might be exempted from the
9239         Cortex-A8 workaround.
9240         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9241         at the beginning of a relaxation pass.
9242
9243 2010-01-12  Doug Kwan  <dougkwan@google.com>
9244
9245         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9246         (Arm_relobj::Mapping_symbol_position,
9247          Arm_reloj::Mapping_symbol_position_less,
9248          Arm_relobj::Mapping_symbols_info): New types.
9249         (Target_arm::is_mapping_symbol_name): New method definition.
9250         (Arm_relobj::do_count_local_symbols): Save information about mapping
9251         symbols.
9252
9253 2010-01-11  Doug Kwan  <dougkwan@google.com>
9254
9255         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9256         Arm_relocate_functions::thumb32_branch_upper,
9257         Arm_relocate_functions::thumb32_branch_lower,
9258         Arm_relocate_functions::thumb32_cond_branch_offset,
9259         Arm_relocate_functions::thumb32_cond_branch_upper,
9260         Arm_relocate_functions::thumb32_cond_branch_lower,
9261         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9262         branch offset encoding.
9263         (Arm_relocate_functions::thumb_branch_common): Use new branch
9264         offset encoding methods to avoid code duplication.
9265         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9266         (Stub_addend_reader::operator()): Use new branch encoding method
9267         to avoid code duplication.
9268
9269 2010-01-11  Doug Kwan  <dougkwan@google.com>
9270
9271         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9272         (Target_arm::do_finalize_sections): Define special EXIDX section
9273         symbols only if referenced.
9274         * gc.h (Garbage_collection::add_reference): New method.
9275         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9276         code duplication.
9277
9278 2010-01-11  Ian Lance Taylor  <iant@google.com>
9279
9280         * script.cc (Version_script_info::build_expression_list_lookup):
9281         Change complaing about duplicate wildcard match from error to
9282         warning.
9283
9284         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9285         of 2009-12-30.
9286         (Version_script_info::Version_script_info): Initialize globs_,
9287         default_version_, default_is_global_, and exact_.  Don't
9288         initialize globals_ or locals_.
9289         (Version_script_info::build_lookup_tables): Build local symbols
9290         first.
9291         (Version_script_info::unquote): New function.
9292         (Version_script_info::add_exact_match): New function.
9293         (Version_script_info::build_expression_list_lookup): Remove lookup
9294         parameter.  Add is_global parameter.  Change all callers.  Handle
9295         wildcard pattern specially.  Unquote pattern.  Call
9296         add_exact_match.
9297         (Version_script_info::get_name_to_match): New function.
9298         (Version_script_info::get_symbol_version): New function.
9299         (Version_script_info::get_symbol_version_helper): Remove.
9300         (Version_script_info::check_unmatched_names): Call unquote.
9301         * script.h (class Version_script_info): Change get_symbol_version
9302         to be non-inline and add is_global parameter; change all callers.
9303         Rewrite symbol_is_local.  Update declarations.  Define struct
9304         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9305         Remove globals_ and locals_ members.  Add exact_, globs_,
9306         default_version_, is_global_.
9307         (Version_script_info::Glob): Remove pattern, add expression and
9308         is_global.  Update constructor.  Change all callers.
9309         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9310         default version.
9311         (Versions::symbol_section_contents): If a symbol is undefined, or
9312         defined in a dynamic object, set the version index to
9313         VER_NDX_LOCAL.
9314         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9315         symbol_is_local.
9316         (Symbol_table::add_from_pluginobj): Likewise.
9317         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9318
9319 2010-01-11  Doug Kwan  <dougkwan@google.com>
9320
9321         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9322         (incremental_dump_LDADD): Add linking option for libintl.
9323         * Makefile.in: Regenerate.
9324
9325 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9326
9327         PR gold/11144
9328         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9329         instead of -Ds.
9330         * testsuite/Makefile.in: Regenerated.
9331
9332 2010-01-10  Doug Kwan  <dougkwan@google.com>
9333
9334         * options.h (DEFINE_var): Use parentheses around argument varname__
9335         in macro body to avoid any unintended subsequent substitutions.
9336
9337 2010-01-10  Ian Lance Taylor  <iant@google.com>
9338
9339         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9340         candidates before doing symbol resolution.
9341
9342         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9343         ODR candidates if only one is weak.
9344
9345 2010-01-08  Ian Lance Taylor  <iant@google.com>
9346
9347         * script.cc (Version_script_info::build_expression_list_lookup):
9348         Don't warn about ambiguous version, just record the ambiguity.
9349         (Version_script_info::get_symbol_version_helper): Give error if
9350         version is ambiguous.
9351
9352 2010-01-08  Doug Kwan  <dougkwan@google.com>
9353
9354         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9355         prev_data_size_ and prev_addralign_.  Remove initializer for
9356         deleted data member has_been_changed_.
9357         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9358         to determine if the table is empty.
9359         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9360         Remove.
9361         (Stub_table::add_reloc_stub): Define method in class definition
9362         instead of just declaring it there.
9363         (Stub_table::add_cortex_a8_stub): New method definition.
9364         (Stub_table::update_data_size_and_addralign): Ditto.
9365         (Stub_table::finalize_stubs): Ditto.
9366         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9367         (Stub_table::do_addralign_): Return address alignment in the
9368         (Stub_table::do_reset_address_and_file_offset): Define method in
9369         class definition instead of declaring it there.  Set current data
9370         size to be the data size of the previous pass.
9371         (Stub_table::set_final_data_size): Use current data size as the
9372         final data size.
9373         (Stub_table::relocate_stub): Change parameter type of stub from
9374         Reloc_stub pointer to Stub pointer.
9375         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9376         (Stub_table::Cortex_a8_stub_list): New typedef.
9377         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9378          Stub_table::prev_addralign_): New data member.
9379         (Arm_relobj::Arm_relobj): Initialize data member
9380         section_has_cortex_a8_workaround_.
9381         (Arm_relobj::section_has_cortex_a8_workaround,
9382          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9383          definitions.
9384         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9385         declarations.
9386         (Target_arm::relocate_stub): Change parameter type of stub from
9387         Reloc_stub pointer to Stub pointer.
9388         (Insn_template::size, Insn_template::alignment): Handle
9389         THUMB16_SPECIAL_TYPE.
9390         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9391          Stub_table::update_data_size_and_addralign,
9392          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9393         definitions.
9394         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9395         (Stub_table::do_write): Ditto.
9396         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9397
9398 2010-01-08  Ian Lance Taylor  <iant@google.com>
9399
9400         PR 11108
9401         * symtab.h (class Symbol): Remove fields is_target_special_ and
9402         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9403         (Symbol::is_defined_in_discarded_section): New function.
9404         (Symbol::set_is_defined_in_discarded_section): New function.
9405         (Symbol::has_plt_offset): Rewrite.
9406         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9407         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9408         Don't initialize is_target_special_ or has_plt_offset_.
9409         Initialize is_defined_in_discarded_section_.
9410         (Symbol_table::add_from_relobj): If appropriate, set
9411         is_defined_in_discarded_section.
9412         * resolve.cc (Symbol::override_base_with_special): Don't test
9413         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9414         * target-reloc.h (relocate_section): Do special handling for
9415         symbols defined in discarded sections for global symbols as well
9416         as local symbols.
9417
9418 2010-01-08  Ian Lance Taylor  <iant@google.com>
9419
9420         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9421         the SHT_SYMTAB case.
9422
9423 2010-01-08  Ian Lance Taylor  <iant@google.com>
9424
9425         * object.cc (Sized_relobj::do_layout): Don't get confused if
9426         layout_eh_frame returns NULL.
9427
9428 2010-01-08  Ian Lance Taylor  <iant@google.com>
9429
9430         PR 11084
9431         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9432         dynamic symbol table, use the normal symbol table.
9433         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9434         symbol table.
9435
9436 2010-01-08  Ian Lance Taylor  <iant@google.com>
9437
9438         PR 11072
9439         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9440         sections.
9441
9442 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9443
9444         * version.cc (print_version): Change to "Copyright 2010".
9445
9446 2010-01-08  Ian Lance Taylor  <iant@google.com>
9447
9448         PR 10287
9449         PR 11063
9450         * i386.cc (class Target_i386): Change return type of plt_section
9451         to be non-const.
9452         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9453         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9454         tls_desc_rel_ field.
9455         (Output_data_plt_i386::rel_tls_desc): New function.
9456         (Target_i386::rel_tls_desc_section): New function.
9457         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9458         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9459         R_386_TLS_DESC reloc in rel_tls_desc_section.
9460         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9461         Define struct Tlsdesc_info.
9462         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9463         (Target_x86_64::do_reloc_symbol_index): New function.
9464         (Target_x86_64::add_tlsdesc_info): New function.
9465         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9466         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9467         tlsdesc_rel_ field.
9468         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9469         all callers.
9470         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9471         (Target_x86_64::rela_tlsdesc_section): New function.
9472         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9473         handling.
9474         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9475         (Target_x86_64::do_reloc_addend): New function.
9476         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9477         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9478         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9479         (Output_reloc::type): New function.
9480         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9481         (Output_reloc::is_target_specific): New function.
9482         (Output_reloc::target_arg): New function.
9483         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9484         absolute relocs and target specific relocs.
9485         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9486         add_target_specific.
9487         (class Output_data_reloc) [SHT_RELA]: Likewise.
9488         * output.cc (Output_reloc::Output_reloc): Add four new versions
9489         for absolute relocs and target specific relocs.
9490         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9491         (Output_reloc::get_symbol_index): Likewise.
9492         (Output_reloc::local_section_offset): Check that local_sym_index_
9493         is not TARGET_CODE or 0.
9494         (Output_reloc::symbol_value): Likewise.
9495         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9496         reloc.
9497         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9498         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9499         functions.
9500         * layout.cc (add_target_dynamic_tags): Use output section for
9501         DT_PLTRELSZ and DT_JMPREL.
9502
9503 2010-01-07  Ian Lance Taylor  <iant@google.com>
9504
9505         PR 11061
9506         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9507         function.
9508         (class Output_data_reloc_generic): Define.
9509         (class Output_data_reloc_base): Change base class to
9510         Output_data_reloc_generic.  Change add() method to call
9511         bump_relative_reloc_count for a relative reloc.  Remove
9512         sort_relocs_ field.
9513         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9514         to sort_relocs().
9515         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9516         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9517         appropriate.
9518         * layout.h (class Layout): Update declaration.
9519
9520 2010-01-07  Ian Lance Taylor  <iant@google.com>
9521
9522         * output.h (class Output_data): Add const version of
9523         output_section and do_output_section.
9524         (class Output_section_data): Add const version of
9525         do_output_section.
9526         (class Output_section): Likewise.
9527         * layout.cc (Layout::add_target_dynamic_tags): New function.
9528         * layout.h (class Layout): Update declarations.
9529         * arm.cc (Target_arm::do_finalize_sections): Use
9530         add_target_dynamic_tags.
9531         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9532         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9533         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9534         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9535
9536 2010-01-07  Ian Lance Taylor  <iant@google.com>
9537
9538         PR 11042
9539         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9540         object as needed.
9541
9542 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9543             Ian Lance Taylor  <iant@google.com>
9544
9545         PR 11019
9546         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9547         Xindex::read_symtab_xindex.
9548
9549 2010-01-07  Doug Kwan  <dougkwan@google.com>
9550
9551         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9552         (Insn_template::thumb16_bcond_insn): New method declaration.
9553         (Insn_template): Fix spelling.
9554         (Stub::thumb16_special): New method declaration.
9555         (Stub::do_write): Define virtual method which was previously pure
9556         virtual.
9557         (Stub::do_thumb16_special): New method declaration.
9558         (Stub::do_fixed_endian_write): New template member.
9559         (Reloc_stub::do_write): Remove.
9560         (Reloc_stub::do_fixed_endian_write): Remove.
9561         (Cortex_a8_stub): New class definition.
9562         (Stub_factory::make_cortex_a8_stub): New method definition.
9563         (Stub_factory::Stub_factory): Add missing static storage class
9564         qualifier for elf32_arm_stub_a8_veneer_blx.
9565
9566 2010-01-07  Ian Lance Taylor  <iant@google.com>
9567
9568         PR 10980
9569         * options.h (class General_options): Add --warn-unresolved-symbols
9570         and --error-unresolved-symbols.
9571         * errors.cc (Errors::undefined_symbol): Implement
9572         --warn-unresolved-symbols.
9573
9574         * options.h (class General_options): Add -z text and -z textoff.
9575         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9576
9577 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9578
9579         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9580         (Garbage_collection::cident_sections): New function.
9581         (Garbage_collection::add_cident_section): New function.
9582         (Garbage_collection::cident_sections_): New member.
9583         (gc_process_relocs): Add references to sections whose names are C
9584         identifiers.
9585         * gold.h (cident_section_start_prefix): New constant.
9586         (cident_section_stop_prefix): New constant.
9587         (is_cident): New function.
9588         * layout.cc (Layout::define_section_symbols): Replace string constants
9589         with the newly defined constants.
9590         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9591         C identifiers.
9592         * testsuite/Makefile.am: Add gc_orphan_section_test.
9593         * testsuite/Makefile.in: Regenerate.
9594         * testsuite/gc_orphan_section_test.cc: New file.
9595         * testsuite/gc_orphan_section_test.sh: New file.
9596
9597 2010-01-06  Ian Lance Taylor  <iant@google.com>
9598
9599         PR 10980
9600         * options.h (class General_options): Add --warn-shared-textrel.
9601         * layout.cc (Layout::finish_dynamic_section): Implement
9602         --warn-shared-textrel.
9603
9604         PR 10980
9605         * options.h (class General_options): Add --warn-multiple-gp.
9606
9607 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9608
9609         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9610         $(THREADSLIB) and $(LIBDL).
9611         * Makefile.in: Rebuild.
9612
9613 2010-01-06  Ian Lance Taylor  <iant@google.com>
9614
9615         PR 10980
9616         * options.cc (General_options::parse_section_start): New function.
9617         (General_options::section_start): New function.
9618         (General_options::General_options): Initialize all members.
9619         * options.h: Include <map>
9620         (class General_options): Add --section-start.  Add section_starts_
9621         member.
9622         * layout.cc (Layout::attach_allocated_section_to_segment): If
9623         --section-start was used, set the address of the segment.  Remove
9624         local sort_sections.
9625         (Layout::relaxation_loop_body): If the address of the load segment
9626         has been set by --section-start, don't use it.
9627         * output.h (Output_segment::update_flags_for_output_section): New
9628         function.
9629         * output.cc (Output_segment::add_output_section): Call
9630         update_flags_for_output_section.
9631
9632 2010-01-05  Ian Lance Taylor  <iant@google.com>
9633
9634         PR 10980
9635         * options.h (class General_options): Add --undefined-version.
9636         * script.cc (struct Version_expression): Add was_matched_by_symbol
9637         field.
9638         (Version_script_info::matched_symbol): New function.
9639         (Version_script_info::get_symbol_version_helper): Call
9640         matched_symbol.
9641         (Version_script_info::check_unmatched_names): New function.
9642         * script.h (class Version_script_info): Update declarations.
9643         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9644
9645         * options.h (class General_options): Use DEFINE_bool_alias for
9646         allow_multiple_definition.
9647         * resolve.cc (Symbol_table::should_override): Don't test
9648         allow_multiple_definition.
9649
9650         PR 10980
9651         * options.h (class General_options): Add --cref.
9652         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9653         until after printing cref table.
9654         * cref.cc: Include "symtab.h".
9655         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9656         (Cref_table_compare::operator()): New function.
9657         (Cref_inputs::gather_cref): New function.
9658         (filecol): New static const.
9659         (Cref_inputs::print_cref): New function.
9660         (Cref::print_cref): New function.
9661         * cref.h: Include <cstdio>.
9662         (class Cref): Update declarations.
9663         * mapfile.h (Mapfile::file): New function.
9664         * object.h (class Object): Define Symbols.  Declare virtual
9665         do_get_global_symbols.
9666         (Object::get_global_symbols): New function.
9667         * object.cc (Input_objects::add_object): Pass object to cref_ if
9668         --cref.
9669         (Input_objects::archive_start): Likewise.
9670         (Input_objects::archive_stop): Likewise.
9671         (Input_objects::print_cref): New function.
9672         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9673         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9674         --cref.
9675         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9676         function.
9677         * plugin.h (class Sized_pluginobj): Update declarations.
9678
9679 2010-01-05  Ian Lance Taylor  <iant@google.com>
9680
9681         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9682         to is_default_version.  Rename insdef to insdefault.
9683         (Symbol_table::add_from_relobj): Rename def to is_default_version
9684         and local to is_forced_local.
9685         (Symbol_table::add_from_pluginobj): Likewise.
9686         (Symbol_table::add_from_dynobj): Likewise.
9687         (Symbol_table::define_special_symbol): Rename insdef to
9688         insdefault.
9689
9690 2010-01-04  Ian Lance Taylor  <iant@google.com>
9691
9692         PR 10980
9693         * options.h (class General_options): Add
9694         --allow-multiple-definition and -z muldefs.
9695         * resolve.cc (Symbol_table::should_override): Don't warn about a
9696         multiple symbol definition if --allow-multiple-definition or -z
9697         muldefs.
9698
9699         PR 10980
9700         * options.h (class General_options): Add --add-needed and
9701         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9702         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9703         error if --copy-dt-needed-entries aka --add-needed is used and
9704         would cause a change in behaviour.
9705
9706         PR 10980
9707         * options.h (class General_options): Add -G as a short version of
9708         --shared.  Add no-op options -assert, -g, and -i.
9709
9710 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9711
9712         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9713         check for .text or .gnu.linkonce.t sections.
9714         * icf.cc (Icf::find_identical_sections): Ditto.
9715         Change the detection for mangled function name within the section
9716         name.
9717         * icf.h (is_section_foldable_candidate): New function.
9718
9719 2009-12-30  Ian Lance Taylor  <iant@google.com>
9720
9721         PR 10980
9722         * options.h (class General_options): Permit two dashes with
9723         --retain-symbols-file.
9724
9725 2009-12-30  Ian Lance Taylor  <iant@google.com>
9726
9727         PR 10979
9728         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9729         don't put the file header and segment headers in the text
9730         segment.
9731
9732         PR 10979
9733         * common.cc (Sort_commons::operator()): Stabilize sort when both
9734         entries are NULL.
9735         (Symbol_table::do_allocate_commons_list): When allocating common
9736         symbols, skip a symbol which is no longer common.
9737         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9738         an object before checking its type.
9739         * testsuite/common_test_2.c: New file.
9740         * testsuite/common_test_3.c: New file.
9741         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9742         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9743         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9744         (common_test_2_pic.o, common_test_2.so): New targets.
9745         (common_test_3_pic.o, common_test_3.so): New targets.
9746         * testsuite/Makefile.in: Rebuild.
9747
9748         PR 10979
9749         * script.cc (read_input_script): If we see a new SECTIONS clause,
9750         and we have added an input section, give an error.
9751         * layout.h (class Layout): Add have_added_input_section function.
9752         Add have_added_input_section_ field.
9753         * layout.cc (Layout::Layout): Initialize
9754         have_added_input_section_.
9755         (Layout::layout): Set have_added_input_section_.
9756         (Layout::layout_eh_frame): Likewise.
9757
9758 2009-12-30  Ian Lance Taylor  <iant@google.com>
9759
9760         PR 10931
9761         * options.h (class General_options): Add --sort-common option.
9762         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9763         * common.cc (Sort_common): Add sort_order parameter to
9764         constructor.  Add sort_order_ field.
9765         (Sort_commons::operator): Check sort_order_.
9766         (Symbol_table::allocate_commons): Determine the sort order.
9767         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9768         Change all callers.
9769         (Symbol_table::do_allocate_commons_list): Likewise.
9770
9771 2009-12-30  Ian Lance Taylor  <iant@google.com>
9772
9773         PR 10916
9774         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9775         symbols from this object, don't change the visibility of an
9776         undefined symbol.
9777         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9778
9779 2009-12-30  Ian Lance Taylor  <iant@google.com>
9780
9781         PR 10861
9782         * script.h (class Version_script_info): Define Language enum.
9783         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9784         new fields globals_, locals_, and is_finalized_.
9785         * script.cc: Various formatting fixes.
9786         (class Parser_closure): Change language_stack_ from a vector of
9787         std::string to one of Version_script_info::Language.  Adjust all
9788         uses accordingly.
9789         (class Lazy_demangler): Remove.
9790         (struct Version_expression): Change language from std::string to
9791         Version_script_info::Language.
9792         (Version_script_info::Version_script_info): New function.
9793         (Version_script_info::~Version_script_info): Don't call clear.
9794         (Version_script_info::finalize): New function.
9795         (Version_script_info::build_lookup_tables): New function.
9796         (Version_script_info::build_expression_list_lookup): New
9797         function.
9798         (Version_script_info::get_symbol_version_helper): Rewrite to use
9799         lookup tables.
9800         (Version_script_info::print_expression_list): Adjust to use
9801         Version_script_info::Language.
9802         (script_push_lex_into_version_mode): Check that the version script
9803         has not been finalized.
9804         (version_script_push_lang): Change language string to
9805         Version_script_info::Language.
9806         * options.cc (Command_line::version_script): New function.
9807         * options.h (class General_options): Add finalize_dynamic_list
9808         function.  Change version_script from declaration to definition.
9809         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9810         * testsuite/version_script.map: Remove duplicate def of foo.
9811         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9812         version_script.map.
9813         * testsuite/Makefile.in: Rebuild.
9814
9815 2009-12-30  Ian Lance Taylor  <iant@google.com>
9816
9817         PR 10843
9818         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9819         if the input symbol index is 0, make the output symbol index 0.
9820
9821 2009-12-30  Ian Lance Taylor  <iant@google.com>
9822
9823         PR 10670
9824         * options.h (class General_options): Add -x/--discard-all.
9825         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9826         --discard-all.  If the local symbol needs a dynamic entry, check
9827         that before handling --discard-locals.
9828
9829 2009-12-30  Ian Lance Taylor  <iant@google.com>
9830
9831         PR 10450
9832         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9833         flags to PF_R.
9834         (Output_segment::add_output_section): Don't change the flags if
9835         the type is PT_TLS.
9836
9837         PR 10450
9838         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9839         GNU hash table if they need a dynamic value.  Otherwise, don't add
9840         them if they are defined in a dynamic object or are forced local.
9841
9842 2009-12-29  Ian Lance Taylor  <iant@google.com>
9843
9844         PR 10450
9845         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9846         .gnu.hash table for a 32-bit target.
9847
9848         PR 10450
9849         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9850         regular and a dynamic object only needs a dynamic symbol table
9851         entry if it is externally visible.
9852
9853         PR 10450
9854         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9855         constructor.  Add global_offset_table_ field.
9856         (Target_i386::got_section): Set global_offset_table_.
9857         (Target_i386::do_finalize_sections): Set global_offset_table_
9858         size.
9859         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9860         in constructor.  Add global_offset_table_ field.
9861         (Target_x86_64::got_section): Set global_offset_table_.
9862         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9863         size.
9864
9865         * layout.cc (Layout::Layout): Initialize increase_relro_.
9866         (Layout::get_output_section): Add is_relro, is_last_relro, and
9867         is_first_non_relro parameters.  Change all callers.
9868         (Layout::choose_output_section): Likewise.
9869         (Layout::add_output_section_data): Likewise.
9870         (Layout::make_output_section): Likewise.
9871         (Layout::set_segment_offsets): Clear increase_relro when using a
9872         linker script.
9873         * layout.h (class Layout): Add increase_relro method.  Add
9874         increase_relro_ field.  Update declarations.
9875         * output.cc (Output_section::Output_section): Initialize
9876         is_last_relro_ and is_first_non_relro_.
9877         (Output_segment::add_output_section): Group relro sections is
9878         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9879         (Output_segment::maximum_alignment): Remove relro handling.
9880         (Output_segment::set_section_addresses): Add increase_relro
9881         parameter.  Change all callers.  Add initial alignment to align
9882         relro sections on separate page.  Remove old relro handling.
9883         (Output_segment::set_section_list_addresses): Remove in_relro
9884         parameter.  Change all callers.
9885         (Output_segment::set_offset): Add increase parameter.  Change all
9886         callers.  Remove old relro handling.
9887         * output.h (class Output_section): Add new methods: is_last_relro,
9888         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9889         Add is_last_relro_ and is_first_non_relro_ fields.
9890         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9891         Create separate .got.plt section.  Call increase_relro.
9892         * x86_64.cc (Target_x86_64::got_section): Likewise.
9893         * testsuite/relro_script_test.t: Add .got.plt.
9894
9895         PR 10450
9896         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9897         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9898         (Layout::finalize): Call set_dynamic_symbol_size.
9899         (Layout::set_dynamic_symbol_size): New function.
9900         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9901         set_dynamic_symbol_size.
9902
9903         PR 10450
9904         * output.h (class Output_section): Add is_entsize_zero_ field.
9905         * output.cc (Output_section::Output_section): Initialize
9906         is_entsize_zero_.
9907         (Output_section::set_entsize): If two different entsizes are
9908         requested, force it to zero.
9909         (Output_section::add_input_section): Set flags for .debug_str
9910         before updating section flags.  Set entsize.
9911         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9912         and SHF_STRING if all input sections have those flags.
9913
9914 2009-12-29   Rafael Espindola  <espindola@google.com>
9915
9916         * main.cc (main): Fix the sys time reporting.
9917         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9918         reporting.
9919
9920 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9921
9922         * options.cc (General_options::parse_version): Allow -v to exit
9923         without an error if there is nothing to link.
9924
9925 2009-12-29  Ian Lance Taylor  <iant@google.com>
9926
9927         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9928         using a version of gcc before 4.1.
9929         * configure: Rebuild.
9930
9931 2009-12-28  Chris Demetriou  <cgd@google.com>
9932
9933         * attributes.cc (Output_attributes_section_data::do_write): Use
9934         std::vector::front rather than std::vector::data.
9935
9936 2009-12-28  Ian Lance Taylor  <iant@google.com>
9937
9938         * symtab.h (class Symbol_table): Add enum Defined.
9939         * resolve.cc (Symbol_table::should_override): Add defined
9940         parameter.  Change all callers.  Test whether object is NULL
9941         before calling a method on it.
9942         (Symbol_table::report_resolve_problem): Add defined parameter.
9943         Change all callers.
9944         (Symbol_table::should_override_with_special): Likewise.
9945         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9946         parameter.  Change all callers.
9947         (Symbol_table::do_define_in_output_data): Likewise.
9948         (Symbol_table::define_in_output_segment): Likewise.
9949         (Symbol_table::do_define_in_output_segment): Likewise.
9950         (Symbol_table::define_as_constant): Likewise.
9951         (Symbol_table::do_define_as_constant): Likewise.
9952         * script.h (class Symbol_assignment): Add is_defsym parameter to
9953         constructor; change all callers.
9954         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9955         parameter.  Change all callers.  Add is_defsym_ field.
9956         (class Parser_closure): Add parsing_defsym parameter to
9957         constructor; change all callers.  Add parsing_defsym accessor
9958         function.  Add parsing_defsym_ field.
9959
9960 2009-12-28  Ian Lance Taylor  <iant@google.com>
9961
9962         * gold.cc (queue_middle_tasks): Fix formatting.
9963         * object.cc (Relobj::is_section_name_included): Likewise.
9964
9965 2009-12-23  Ian Lance Taylor  <iant@google.com>
9966
9967         * i386.cc (Target_i386::do_calls_non_split): Recognize
9968         -fsplit-stack prologue for a function with a static chain.
9969         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9970         -fsplit-stack prologue when using %r11.
9971
9972 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9973
9974         * options.cc (General_options::parse_version): Make -v continue and do
9975         the link like GNU ld does.
9976
9977 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9978
9979         * Makefile.am (CCFILES): Add timer.cc.
9980         (HFILES): Add timer.h.
9981         * configure.ac: Check for sysconf and times.
9982         * main.cc: include timer.h.
9983         (main): Use Timer instead of get_run_time.
9984         * timer.cc: New.
9985         * timer.h: New.
9986         * workqueue.cc: include timer.h.
9987         (Workqueue::find_and_run_task):
9988         Report user, sys and wall time.
9989         * Makefile.in: Regenerate.
9990         * config.in: Regenerate.
9991         * configure: Regenerate.
9992
9993 2009-12-16  Doug Kwan  <dougkwan@google.com>
9994
9995         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9996         sections.
9997         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9998         relaxed input sections.
9999         * output.cc (Output_section::find_relaxed_input_section): Change
10000         return type to Output_relaxed_input_section pointer.  Adjust code
10001         for new type of relaxed_input_section_map_.
10002         * output.h (Output_section::find_relaxed_input_section): Change
10003         return type to Output_relaxed_input_section pointer.
10004         (Output_section::Output_relaxed_input_section_by_input_section_map):
10005         New type.
10006         (Output_section::relaxed_input_section_map_): Change type to
10007         Output_section::Output_relaxed_input_section_by_input_section_map.
10008         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10009         input section.
10010
10011 2009-12-15  Ian Lance Taylor  <iant@google.com>
10012
10013         * layout.cc (Layout::create_shstrtab): Only write out after input
10014         sections if we are compressing debug sections.
10015
10016 2009-12-15  Ian Lance Taylor  <iant@google.com>
10017
10018         * archive.cc (Archive::add_symbols): Only look up a symbol without
10019         a version if there is, in fact, a version.
10020
10021 2009-12-14  Ian Lance Taylor  <iant@google.com>
10022
10023         Revert -Wshadow changes, all changes from:
10024         2009-12-11  Doug Kwan  <dougkwan@google.com>
10025         2009-12-11  Nick Clifton  <nickc@redhat.com>
10026         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10027
10028 2009-12-11  Doug Kwan  <dougkwan@google.com>
10029
10030         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10031         due to -Wshadow.
10032         * attributes.cc (Object_attribute::size): Ditto.
10033         (Attributes_section_data::size): Ditto.
10034         (Attributes_section_data::Attributes_section_data): Ditto.
10035         (Output_attributes_section_data::do_write): Ditto.
10036         * attributes.h (Object_attribute::set_type): Ditto.
10037         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10038
10039 2009-12-11  Nick Clifton  <nickc@redhat.com>
10040
10041         * archive.cc: Fix shadowed variable warnings.
10042         * arm.cc: Likewise.
10043         * compressed_output.cc: Likewise.
10044         * compressed_output.h: Likewise.
10045         * configure: Likewise.
10046         * dwarf_reader.cc: Likewise.
10047         * dynobj.cc: Likewise.
10048         * dynobj.h: Likewise.
10049         * ehframe.cc: Likewise.
10050         * ehframe.h: Likewise.
10051         * errors.cc: Likewise.
10052         * expression.cc: Likewise.
10053         * fileread.cc: Likewise.
10054         * fileread.h: Likewise.
10055         * freebsd.h: Likewise.
10056         * i386.cc: Likewise.
10057         * icf.cc: Likewise.
10058         * incremental.h: Likewise.
10059         * layout.cc: Likewise.
10060         * layout.h: Likewise.
10061         * mapfile.cc: Likewise.
10062         * merge.cc: Likewise.
10063         * merge.h: Likewise.
10064         * object.cc: Likewise.
10065         * object.h: Likewise.
10066         * options.h: Likewise.
10067         * output.cc: Likewise.
10068         * output.h: Likewise.
10069         * parameters.cc: Likewise.
10070         * plugin.cc: Likewise.
10071         * powerpc.cc: Likewise.
10072         * reduced_debug_output.cc: Likewise.
10073         * reduced_debug_output.h: Likewise.
10074         * reloc.cc: Likewise.
10075         * reloc.h: Likewise.
10076         * resolve.cc: Likewise.
10077         * script-sections.cc: Likewise.
10078         * script.cc: Likewise.
10079         * script.h: Likewise.
10080         * sparc.cc: Likewise.
10081         * symtab.cc: Likewise.
10082         * symtab.h: Likewise.
10083         * target-select.cc: Likewise.
10084         * target-select.h: Likewise.
10085         * token.h: Likewise.
10086         * workqueue.cc: Likewise.
10087         * workqueue.h: Likewise.
10088         * x86_64.cc: Likewise.
10089
10090 2009-12-10  Doug Kwan  <dougkwan@google.com>
10091
10092         * arm.cc (attributes.h): New include.
10093         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10094         (Arm_relobj::~Arm_relobj): Delete object pointed by
10095         attributes_section_data_.
10096         (Arm_relobj::attributes_section_data): New method definition.
10097         (Arm_relobj::attributes_section_data_): New data member declaration.
10098         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10099         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10100         attributes_section_data_.
10101         (Arm_dynobj::attributes_section_data): New method definition.
10102         (Arm_dynobj::attributes_section_data_): New data member declaration.
10103         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10104         initialization value of may_use_blx_ to false.
10105         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10106         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10107         object attributes to compute results instead of hard-coding.
10108         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10109         Target_arm::get_secondary_compatible_arch,
10110         Target_arm::set_secondary_compatible_arch
10111         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10112         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10113         New method declarations.
10114         (Target_arm::get_aeabi_object_attribute): New method definition.
10115         (Target_arm::attributes_section_data_): New data member declaration.
10116         (read_arm_attributes_section): New template definition.
10117         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10118         (Arm_dynobj::do_read_symbols): Ditto.
10119         (Target_arm::do_finalize_sections): Merge attributes sections from
10120         input.  Check for BLX use after attributes section merging.
10121         Fix __exidx_start and __exidx_end visibility.  Create an
10122         .ARM.attributes section if necessary.
10123         (Target_arm::get_secondary_compatible_arch,
10124         Target_arm::set_secondary_compatible_arch,
10125         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10126         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10127         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10128         New method definitions.
10129
10130 2009-12-09  Ian Lance Taylor  <iant@google.com>
10131
10132         * plugin.cc (Plugin::load): Don't cast from void* to a function
10133         pointer.
10134
10135 2009-12-09  Ian Lance Taylor  <iant@google.com>
10136
10137         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10138         information fields.
10139
10140 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10141
10142         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10143         Replace two_file_shared_1.so with two_file_shared_2.so.
10144         * testsuite/Makefile.in: Regenerated.
10145
10146 2009-12-08  Doug Kwan  <dougkwan@google.com>
10147
10148         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10149         (HFILES): Add attributes.h and int_encoding.h.
10150         * Makefile.in: Regenerate.
10151         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10152         function definitions to int_encoding.cc
10153         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10154         prototypes to int_encoding.h
10155         * reduced_debug_output.cc (int_encoding.h): New include.
10156         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10157         function definitions to int_encoding.cc
10158         (insert_into_vector, read_from_pointer): Move template definitions to
10159         int_encoding.h
10160         * attributes.cc: New file.
10161         * attributes.h: New file.
10162         * int_encoding.cc: New file.
10163         * int_encoding.h: New file.
10164
10165 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10166
10167         PR gold/11055
10168         * incremental-dump.cc (dump_incremental_inputs): New.
10169         (main): Use dump_incremental_inputs.
10170
10171 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10172
10173         PR gold/10893
10174         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10175         checking elfcpp::STT_FUNC.
10176         (Target_i386::Relocate::relocate): Likewise.
10177         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10178
10179         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10180         symbols from shared libraries into normal FUNC symbols.
10181
10182         * symtab.h (Symbol): Add is_func and use it.
10183
10184 2009-12-05  Doug Kwan  <dougkwan@google.com>
10185
10186         * arm.cc (Target_arm::arm_info): Initialize new fields
10187         attributes_section and attributes_vendor.
10188         * i386.cc (Target_i386::i386_info): Same.
10189         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10190         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10191         fields attributes_section and attributes_vendor.
10192         * sparc.cc (Target_sparc::sparc_info): Same.
10193         * target.h (Target::attributes_section, Target::attributes_vendor,
10194         Target::is_attributes_section, Target::attribute_arg_type,
10195         Target::attributes_order): New method definitions.
10196         (Target::Target_info::attributes_section,
10197         Target::Target_info::attributes_vendor): New fields.
10198         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10199         virtual method definitions.
10200         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10201         attributes_section and attributes_vendor.
10202         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10203
10204 2009-12-05  Doug Kwan  <dougkwan@google.com>
10205
10206         * arm.cc: Update comments about interworking and stub generation.
10207         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10208         considered as non-PIC.
10209         (Arm_relocate_functions::base_abs): Fix formatting.
10210         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10211         of function to use GOT entry address instead of offset.
10212         (Target_arm::Scan::global): Issue an error if a symbol would need a
10213         PLT does not get one because it is untyped.  Remove code to create
10214         dynamic symbols for relative branches.
10215         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10216         takes unsigned integer instead of boolean.
10217
10218 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10219
10220         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10221         (two_file_test_LDADD): Likewise.
10222         (common_test_1_LDADD): Likewise.
10223         (exception_test_LDADD) Likewise.
10224         (weak_test_LDADD): Likewise.
10225         (many_sections_test_LDADD): Likewise.
10226         (initpri1_LDADD): Likewise.
10227         (script_test_1_LDADD): Likewise.
10228         (script_test_2_LDADD): Likewise.
10229         (justsyms_LDADD): Likewise.
10230         (binary_test_LDADD): Likewise.
10231         (large_LDADD): Likewise.
10232         * testsuite/Makefile.in: Regenerated.
10233
10234 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10235
10236         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10237         (Symbol_table::override_with_special): Likewise.
10238         (Symbol_table::add_from_object): Likewise.
10239
10240 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10241
10242         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10243         Don't set the data_offset twice.
10244
10245 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10246
10247         * testsuite/Makefile.in: Regenerate.
10248
10249 2009-12-03  Doug Kwan  <dougkwan@google.com>
10250
10251         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10252         (Target_arm::do_finalize_sections): Add parameter for symbol table
10253         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10254         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10255         parameter for symbol table pointer.
10256         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10257         an additional parameter for a pointer to symbol table.
10258         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10259         parameter for a symbol table pointer.
10260         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10261         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10262         Ditto.
10263         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10264         parameter for a symbol table pointer.
10265
10266 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10267
10268         * incremental.cc (Incremental_inputs_header)
10269         (Incremental_inputs_header_write, Incremental_inputs_entry)
10270         (Incremental_inputs_entry_write): Move ...
10271         * incremental.h (Incremental_inputs_header)
10272         (Incremental_inputs_header_write, Incremental_inputs_entry)
10273         (Incremental_inputs_entry_write): here.
10274
10275 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10276
10277         * incremental.cc (make_sized_incremental_binary): Set the target.
10278         Error if it is incompatible.
10279         * output.h (Output_file): Add filename method.
10280
10281 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10282
10283         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10284         from the get_* methods.
10285
10286 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10287
10288         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10289         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10290         Write 0 for the data_offset of scripts.
10291
10292 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10293
10294         * testsuite/Makefile.am: Add the incremental_test.sh test.
10295         * testsuite/incremental_test.sh: New.
10296         * testsuite/incremental_test_1.c: New.
10297         * testsuite/incremental_test_2.c: New.
10298
10299 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10300
10301         * incremental-dump.cc (main): Fix typos.
10302
10303 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10304
10305         PR gold/11025
10306         * incremental-dump.cc (main): Use llu to print 64 bit values.
10307
10308 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10309             H.J. Lu  <hongjiu.lu@intel.com>
10310
10311         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10312         $(LIBDL).
10313         (incremental_dump_LDADD): Likewise.
10314         * Makefile.in: Regenerated.
10315
10316 2009-11-25  Doug Kwan  <dougkwan@google.com>
10317
10318         Revert:
10319
10320         2009-11-25  Doug Kwan  <dougkwan@google.com>
10321
10322                 * arm.cc (Target_arm::Target_arm): Move method definition
10323                 outside of class definition.  Add code to handle
10324                 --target1-rel, --target1-abs and --target2= options.
10325                 (Target_arm::get_reloc_reloc_type): Change method to be
10326                 non-static and const.
10327                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10328                 New data member declaration.
10329                 (Target_arm::Scan::local, Target_arm::Scan::global,
10330                 Target_arm::Relocate::relocate,
10331                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10332                 Adjust call to Target_arm::get_real_reloc_type.
10333                 (Target_arm::get_real_reloc_type): Use command line options
10334                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10335                 * options.h (--target1-rel, --target1-abs, --target2): New
10336                 ARM-only options.
10337
10338 2009-11-25  Doug Kwan  <dougkwan@google.com>
10339
10340         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10341         class definition.  Add code to handle --target1-rel, --target1-abs
10342         and --target2= options.
10343         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10344         and const.
10345         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10346         member declaration.
10347         (Target_arm::Scan::local, Target_arm::Scan::global,
10348         Target_arm::Relocate::relocate,
10349         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10350         call to Target_arm::get_real_reloc_type.
10351         (Target_arm::get_real_reloc_type): Use command line options to
10352         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10353         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10354         options.
10355
10356 2009-11-25  Doug Kwan  <dougkwan@google.com>
10357
10358         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10359         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10360         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10361         formatting.
10362         (Arm_relocate_functions::thm_call): Replace body with a call to
10363         Arm_relocate_functions::thumb_branch_common.
10364         (Arm_relocate_functions::thm_jump24,
10365         Arm_relocate_functions::thm_xpc22): New method definitions.
10366         (Arm_relocate_functions::thumb_branch_common): New method definition.
10367         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10368         operator.
10369         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10370         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10371
10372 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10373
10374         * Makefile.am: Build incremental-dump
10375         * Makefile.in: Regenerate.
10376         * incremental-dump.cc: New.
10377         * incremental.cc (Incremental_inputs_header_data,
10378         Incremental_inputs_entry_data): Move to incremental.h
10379         * incremental.h: (Incremental_inputs_header_data,
10380         Incremental_inputs_entry_data): Move from incremental.cc
10381
10382 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10383
10384         * incremental.cc (Incremental_inputs_header,
10385         Incremental_inputs_header_write, Incremental_inputs_entry,
10386         Incremental_inputs_entry_write): Add a typedef with the data type.
10387
10388 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10389
10390         * incremental.cc (Incremental_inputs_header,
10391         Incremental_inputs_header_write, Incremental_inputs_entry,
10392         Incremental_inputs_entry_write): Update comment about which
10393         type has the filed descriptions.
10394
10395 2009-11-15  Doug Kwan  <dougkwan@google.com>
10396
10397         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10398         (Arm_relocate_functions::arm_branch_common): Change method defintion
10399         in class definition to a method declaration and update list of formal
10400         parameters.
10401         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10402         Arm_relocation_functions::jump24): Adjust call to
10403         Arm_relocate_functions::arm_branch_common.  Update list of formal
10404         parameters.
10405         (Arm_relocate_functions::xpc25): New method definition.
10406         (Arm_relocate_functions::arm_branch_common): Move method defintion
10407         out from class definition.  Use stubs for mode-switching and extending
10408         branch ranges.
10409         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10410         specially.  Change code to enable use of stubs in ARM branches.
10411
10412 2009-11-10  Doug Kwan  <dougkwan@google.com>
10413
10414         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10415         in method declaration.
10416         (Target_arm::relocate_stub): New method declaration.
10417         (Target_arm::default_target): Change to return a pointer instead of
10418         a const reference.
10419         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10420         Target_arm::default_target.
10421         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10422         method definition.
10423         (Target_arm::relocate_section): Adjust view.
10424         (Target_arm::relocate_stub): New method definition.
10425
10426 2009-11-10  Doug Kwan  <dougkwan@google.com>
10427
10428         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10429         a format warning.
10430         * incremental.cc (open_incremental_binary): Initialized local
10431         variables to avoid warnings.
10432         * object.cc (make_elf_object): Ditto.
10433         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10434         a format warning.
10435
10436 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10437
10438         PR gold/10930
10439         * testsuite/plugin_test.c: Include "config.h".
10440
10441 2009-11-09  Doug Kwan  <dougkwan@google.com>
10442
10443         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10444         (arm_symbol_value): Remove.
10445         (Arm_relocate_functions::arm_branch_common,
10446         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10447         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10448         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10449         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10450         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10451         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10452         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10453         Arm_relocate_functions::thm_mobw_abs_nc,
10454         Arm_relocate_functions::thm_mov_abs,
10455         Arm_relocate_functions::movw_prel_nc,
10456         Arm_relocate_functions::thm_movt_abs,
10457         Arm_relocate_functions::movt_prel,
10458         Arm_relocate_functions::thm_movw_prel_nc,
10459         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10460         (Target_arm::Relocate::relocate): Only decompose address into two
10461         parts if relocation type uses the thumb-bit and pass the actual
10462         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10463         calls to methods in Arm_relocate_functions for this change.
10464
10465 2009-11-08  Ian Lance Taylor  <iant@google.com>
10466
10467         PR 10925
10468         * reloc.cc: Instantiate
10469         Sized_relobj::initialize_input_to_output_maps and
10470         Sized_relobj:free_input_to_output_maps.
10471
10472 2009-11-06  Ian Lance Taylor  <iant@google.com>
10473
10474         PR 10876
10475         * defstd.cc (in_segment): Set only_if_ref true for "end".
10476
10477 2009-11-06  Doug Kwan  <dougkwan@google.com>
10478
10479         * arm.cc (class Reloc_stub): Correct a comment.
10480         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10481         (Target_arm::scan_section_for_stubs): New method declaration.
10482         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10483         Change methods from private to protected.
10484         (Target_arm::do_may_relax): New method definition.
10485         (Target_arm::do_relax, Target_arm::group_sections,
10486         Target_arm::scan_reloc_for_stub,
10487         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10488         (Target_arm::arm_input_section_map_): New data member declaration.
10489         (Target_arm::scan_reloc_for_stub,
10490         Target_arm::scan_reloc_section_for_stubs,
10491         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10492         Target_arm::do_relax): New method definitions.
10493
10494 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10495
10496         * configure.ac: Check for (struct stat)::st_mtim
10497         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10498         * config.in: Regenerate.
10499         * configure: Regenerate.
10500
10501 2009-11-05  Ian Lance Taylor  <iant@google.com>
10502
10503         PR 10910
10504         * output.cc (Output_segment::add_output_section): Add missing
10505         return statement.
10506
10507 2009-11-04  Ian Lance Taylor  <iant@google.com>
10508
10509         PR 10880
10510         * object.h (class Object): Add is_needed and set_is_needed
10511         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10512         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10513         defined in a dynamic object and referenced by a regular object,
10514         set is_needed for the dynamic object.
10515         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10516         if the file is marked with as_needed and it is not needed.
10517
10518 2009-11-04  Ian Lance Taylor  <iant@google.com>
10519
10520         PR 10887
10521         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10522         tags if data is discarded by linker script.
10523         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10524         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10525         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10526         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10527
10528 2009-11-04  Ian Lance Taylor  <iant@google.com>
10529
10530         * layout.cc (Layout::get_output_section): Add is_interp and
10531         is_dynamic_linker_section parameters.  Change all callers.
10532         (Layout::choose_output_section): Likewise.
10533         (Layout::make_output_section): Likewise.
10534         (Layout::add_output_section_data): Add is_dynamic_linker_section
10535         parameter.  Change all callers.
10536         * layout.h (class Layout): Update declarations.
10537         * output.h (class Output_section): Add is_interp, set_is_interp,
10538         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10539         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10540         generate_code_fills_at_write_ to a bitfield.
10541         * output.cc (Output_section::Output_sections): Initialize new
10542         fields.
10543         (Output_segment::add_output_section): Add do_sort parameter.
10544         Change all callers.
10545
10546 2009-11-03  Ian Lance Taylor  <iant@google.com>
10547
10548         PR 10860
10549         * options.h (class General_options): Add --warn-common.
10550         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10551         merging two common symbols.
10552         (Symbol_table::should_override): Handle --warn-common when merging
10553         a common symbol with a defined symbol.  Use report_resolve_problem
10554         for multiple definitions.
10555         (Symbol_table::report_resolve_problem): New function.
10556         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10557
10558 2009-11-03  Doug Kwan  <dougkwan@google.com>
10559
10560         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10561         stub_factory_.
10562         (Target_arm::stub_factory): New method definition.
10563         (Target_arm::new_arm_input_section,
10564         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10565         Target_arm::reloc_uses_thumb_bit): New method declarations.
10566         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10567         New type definitions.
10568         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10569         member declarations.
10570         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10571         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10572         New method definitions.
10573
10574 2009-11-03  Ian Lance Taylor  <iant@google.com>
10575
10576         * options.h (class General_options): Add --warn_constructors.
10577
10578 2009-11-03  Ian Lance Taylor  <iant@google.com>
10579
10580         PR 10893
10581         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10582         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10583
10584 2009-11-03  Ian Lance Taylor  <iant@google.com>
10585
10586         PR 10895
10587         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10588         --msgid-bugs-address.
10589         (install-pdf): New target.
10590         (install-data_yes): Look up one directory to find mkinstalldirs.
10591
10592 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10593
10594         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10595         tree.
10596
10597 2009-10-30  Doug Kwan  <dougkwan@google.com>
10598
10599         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10600
10601 2009-10-30  Doug Kwan  <dougkwan@google.com>
10602
10603         * arm.cc (Stub_addend_reader): New struct template definition
10604         and partial specializations.
10605         (Stub_addend_reader::operator()): New method definition for a
10606         partially specialized template.
10607
10608 2009-10-30  Doug Kwan  <dougkwan@google.com>
10609
10610         * arm.cc (Arm_relobj::processor_specific_flags): New method
10611         definition.
10612         (Arm_relobj::do_read_symbols): New method declaration.
10613         (Arm_relobj::processor_specific_flags_): New data member declaration.
10614         (Arm_dynobj): New class definition.
10615         (Target_arm::do_finalize_sections): Add input_objects parameter.
10616         (Target_arm::do_adjust_elf_header): New method declaration.
10617         (Target_arm::are_eabi_versions_compatible,
10618         (Target_arm::merge_processor_specific_flags): New method declaration.
10619         (Target_arm::do_make_elf_object): New overloaded method definitions
10620         and declaration.
10621         (Arm_relobj::do_read_symbols): New method definition.
10622         (Arm_dynobj::do_read_symbols): Ditto.
10623         (Target_arm::do_finalize_sections): Add input_objects parameters.
10624         Merge processor-specific flags from all input objects.
10625         (Target_arm::are_eabi_versions_compatible,
10626         Target_arm::merge_processor_specific_flags,
10627         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10628         New method definitions.
10629         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10630         Input_objects pointer type parameter.
10631         * layout.cc (Layout::finalize): Pass input objects to target's.
10632         finalize_sections function.
10633         * output.cc (Output_file_header::do_sized_write): Set ELF file
10634         header's processor-specific flags.
10635         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10636         Input_objects pointer type parameter.
10637         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10638         * target.h (Input_objects): New forward class declaration.
10639         (Target::processor_specific_flags,
10640         Target::are_processor_specific_flags_sect): New method definitions.
10641         (Target::finalize_sections): Add input_objects parameter.
10642         (Target::Target): Initialize processor_specific_flags_ and
10643         are_processor_specific_flags_set_.
10644         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10645         parameter.
10646         (Target::set_processor_specific_flags): New method definition.
10647         (Target::processor_specific_flags_,
10648         Target::are_processor_specific_flags_set_): New data member
10649         declarations.
10650         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10651         Input_objects pointer type parameter.
10652
10653 2009-10-30  Doug Kwan  <dougkwan@google.com>
10654
10655         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10656
10657 2009-10-28  Ian Lance Taylor  <iant@google.com>
10658
10659         * object.h (class Relobj): Drop options parameter from
10660         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10661         do_scan_relocs, do_relocate.  Change all callers.
10662         (class Sized_relobj): Drop options parameters from
10663         do_gc_process_relocs, do_scan_relocs, do_relocate,
10664         do_relocate_sections, relocate_sections, emit_relocs_scan,
10665         emit_relocs_scan_reltype.  Change all callers.
10666         (struct Relocate_info): Remove options field and all references to
10667         it.
10668         * reloc.h (class Read_relocs): Remove options constructor
10669         parameter and options_ field.  Change all callers.
10670         (class Gc_process_relocs, class Scan_relocs): Likewise.
10671         (class Relocate_task): Likewise.
10672         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10673         all callers.
10674         (scan_relocatable_relocs): Likewise.
10675         * target.h (class Sized_target): Remove options parameter from
10676         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10677         all callers.
10678         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10679         callers.
10680         * arm.cc: Update functions to remove options parameters.
10681         * i386.cc: Likewise.
10682         * powerpc.cc: Likewise.
10683         * sparc.cc: Likewise.
10684         * x86_64.cc: Likewise.
10685         * testsuite/testfile.cc: Likewise.
10686
10687 2009-10-28  Doug Kwan  <dougkwan@google.com>
10688
10689         * arm.cc (Arm_relobj): New class definition.
10690         (Arm_relobj::scan_sections_for_stubs,
10691         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10692         New method definitions.
10693
10694 2009-10-28  Cary Coutant  <ccoutant@google.com>
10695
10696         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10697         (Plugin::cleanup_done_): New member.
10698         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10699         (Plugin_manager::cleanup_done_): Remove.
10700         (Plugin_manager::add_input_file): Edit error message.
10701         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10702         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10703
10704 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10705
10706         * fileread.cc: (File_read::View::~View): Use the new
10707         data_ownership_ filed.
10708         (File_read::~File_read): Dispose the new whole_file_view_.
10709         (File_read::open): Mmap the whole file if needed.
10710         (File_read::open): Use whole_file_view_ instead of contents_.
10711         (File_read::find_view): Use whole_file_view_ if applicable.
10712         (File_read::do_read): Use whole_file_view_ instead of contents_.
10713         (File_read::make_view): Use whole_file_view_ instead of contents_,
10714         update File_read::View::View call.
10715         (File_read::find_or_make_view): Update File_read::View::View
10716         call.
10717         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10718         remove contents_
10719         (File_read::View::Data_ownership): New enum.
10720         (File_read::View::View): Replace bool mapped_ with Data_ownership
10721         argument.
10722         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10723         (File_read::View::data_ownership_): New field.
10724         (File_read::contents_): Remove (replaced by whole_file_view_).
10725         (File_read::whole_file_view_): New field.
10726         * options.h (class General_options): Add --keep-files-mapped.
10727
10728 2009-10-27  Cary Coutant  <ccoutant@google.com>
10729
10730         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10731         * testsuite/Makefile.am (plugin_test_5): New test case.
10732         * testsuite/Makefile.in: Regenerate.
10733
10734 2009-10-25  Doug Kwan  <dougkwan@google.com>
10735
10736         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10737         from private to protected to allow access by child class.
10738         (Sized_relobj::do_relocate_sections): New method declaration.
10739         (Sized_relobj::relocate_sections): Virtualize.
10740         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10741         Sized_relobj::relocate_sections.  Instantiate template explicitly
10742         for different target sizes and endianity.
10743
10744 2009-10-24  Doug Kwan  <dougkwan@google.com>
10745
10746         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10747         (Arm_input_section::as_arm_input_section): New method.
10748         (Arm_output_section): New class definition.
10749         (Arm_output_section::create_stub_group,
10750         Arm_output_section::group_sections): New method definitions.
10751
10752 2009-10-22  Doug Kwan  <dougkwan@google.com>
10753
10754         * arm.cc (Arm_input_section): New class definition.
10755         (Arm_input_section::init, Arm_input_section:do_write,
10756         Arm_input_section::set_final_data_size,
10757         Arm_input_section::do_reset_address_and_file_offset): New method
10758         definitions.
10759
10760 2009-10-21  Doug Kwan  <dougkwan@google.com>
10761
10762         * arm.cc (Stub_table, Arm_input_section): New forward class
10763         declarations.
10764         (Stub_table): New class defintion.
10765         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10766         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10767         New method definition.
10768
10769 2009-10-21  Doug Kwan  <dougkwan@google.com>
10770
10771         * arm.cc: Update copyright comments.
10772         (Target_arm): New forward class template declaration.
10773         (Arm_address): New type.
10774         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10775         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10776         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10777         constants.
10778         (Insn_template): Same.
10779         (DEF_STUBS): New macro.
10780         (Stub_type): New enum type.
10781         (Stub_template): New class definition.
10782         (Stub): Same.
10783         (Reloc_stub): Same.
10784         (Stub_factory): Same.
10785         (Target_arm::Target_arm): Initialize may_use_blx_ and
10786         should_force_pic_veneer_.
10787         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10788         Target_arm::should_force_pic_veneer,
10789         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10790         Target_arm::using_thumb_only, Target_arm:;default_target): New
10791         method defintions.
10792         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10793         New data member declarations.
10794         (Insn_template::size, Insn_template::alignment): New method defintions.
10795         (Stub_template::Stub_template): New method definition.
10796         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10797         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10798         (Stub_factory::Stub_factory): New method definition.
10799         * gold.h (string_hash): New template.
10800         * output.h (Input_section_specifier::hash_value): Use
10801         gold::string_hash.
10802         (Input_section_specifier::string_hash): Remove.
10803         * stringpool.cc (Stringpool_template::string_hash): Use
10804         gold::string_hash.
10805
10806 2009-10-20  Doug Kwan  <dougkwan@google.com>
10807
10808         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10809         symbols of relaxed input sections.
10810         * output.h (Output_section::find_relaxed_input_section): Make
10811         method public.
10812
10813 2009-10-16  Doug Kwan  <dougkwan@google.com>
10814
10815         * dynobj.cc (Versions::Versions): Initialize version_script_.
10816         Only insert base version symbol definition for a shared object
10817         if version script defines any version versions.
10818         (Versions::define_base_version): New method definition.
10819         (Versions::add_def): Check that base version is not needed.
10820         (Versions::add_need): Define base version lazily.
10821         * dynobj.h (Versions::define_base_version): New method declaration.
10822         (Versions::needs_base_version_): New data member declaration.
10823         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10824         (check_DATA): Add no_version_test.stdout.
10825         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10826         New make rules.
10827         * testsuite/Makefile.in: Regenerate.
10828         * testsuite/no_version_test.c: New file.
10829         * testsuite/no_version_test.sh: Ditto.
10830
10831 2009-10-16  Doug Kwan  <dougkwan@google.com>
10832
10833         * expression.cc (class Segment_start_expression): New class definition.
10834         (Segment_start_expression::value): New method definition.
10835         (script_exp_function_segment_start): Return a new
10836         Segment_start_expression.
10837         * gold/script-c.h (script_saw_segment_start_expression): New function
10838         prototype.
10839         * script-sections.cc (Script_sections::Script_sections): Initialize
10840         SAW_SEGMENT_START_EXPRESSION_ to false.
10841         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10842         and -Tbbs options to specify section addresses if given in
10843         command line and no SEGMENT_START expression is seen in a script.
10844         * script-sections.h (Script_sections::saw_segment_start_expression,
10845         Script_sections::set_saw_segment_start_expression): New method
10846         definition.
10847         (Script_sections::saw_segment_start_expression_): New data member
10848         declaration.
10849         * script.cc (script_saw_segment_start_expression): New function.
10850         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10851         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10852         script_test_7.sh and script_test_8.sh.
10853         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10854         script_test_8.stdout.
10855         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10856         (script_test_6, script_test_6.stdout, script_test_7,
10857         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10858         * Makefile.in: Regenerate.
10859         * testsuite/script_test_6.sh: New file.
10860         * testsuite/script_test_6.t: Same.
10861         * testsuite/script_test_7.sh: Same.
10862         * testsuite/script_test_7.t: Same.
10863         * testsuite/script_test_8.sh: Same.
10864
10865 2009-10-16  Doug Kwan  <dougkwan@google.com>
10866
10867         * output.cc (Output_segment::set_section_list_address): Cast
10868         expressions to unsigned long long type to avoid format warnings.
10869
10870 2009-10-15  Ian Lance Taylor  <iant@google.com>
10871
10872         * script.cc (Script_options::add_symbol_assignment): Always add a
10873         dot assignment to script_sections_.
10874         * script-sections.cc (Script_sections::add_dot_assignment):
10875         Initialize if necessary.
10876
10877         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10878         program headers with no load segment if there is a linker script.
10879
10880         * layout.cc (Layout::set_segment_offsets): Align the file offset
10881         to the segment aligment for -N or -n with no load segment.
10882         * output.cc (Output_segment::add_output_section): Don't crash if
10883         the first section is a TLS section.
10884         (Output_segment::set_section_list_addresses): Print an error
10885         message if the address moves backward in a linker script.
10886         * script-sections.cc
10887         (Output_section_element_input::set_section_addresses): Don't
10888         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10889         (Orphan_output_section::set_section_addresses): Likewise.
10890
10891 2009-10-15  Doug Kwan  <dougkwan@google.com>
10892
10893         * layout.cc (Layout::finish_dynamic_section): Generate tags
10894         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10895         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10896         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10897
10898 2009-10-14  Ian Lance Taylor  <iant@google.com>
10899
10900         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10901         fields.
10902         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10903         data_shdr fields of relinfo.
10904         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10905         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10906         R_386_TLS_LDO_32, adjust based on section flags.
10907         (Target_i386::Relocate::fix_up_ldo): Remove.
10908
10909 2009-10-13  Ian Lance Taylor  <iant@google.com>
10910
10911         Add support for -pie.
10912         * options.h (class General_options): Add -pie and
10913         --pic-executable.
10914         (General_options::output_is_position_independent): Test -pie.
10915         (General_options::output_is_executable): Return true if not shared
10916         and not relocatable.
10917         (General_options::output_is_pie): Remove.
10918         * options.cc (General_options::finalize): Reject incompatible uses
10919         of -pie.
10920         * gold.cc (queue_middle_tasks): A -pie link is not static.
10921         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10922         * symtab.cc (Symbol::final_value_is_known): Return false if
10923         output_is_position_independent.
10924         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10925         output_is_position_independent.
10926         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10927         output_is_position_independent.
10928         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10929         output_is_position_independent.
10930         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10931         two_file_pie_test.
10932         (basic_pie_test.o, basic_pie_test): New targets.
10933         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10934         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10935         (two_file_pie_test): New target.
10936         * testsuite/Makefile.in: Rebuild.
10937         * README: Remove note saying that -pie is not supported.
10938
10939 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10940
10941         * options.h (class General_options): Add -init and -fini.
10942         * layout.cc (Layout::finish_dynamic_section): Emit
10943         given init and fini functions.
10944
10945 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10946
10947         * gc.h (gc_process_relocs): Check if icf is enabled using new
10948         function.
10949         * gold.cc (queue_initial_tasks): Likewise.
10950         (queue_middle_tasks): Likewise.
10951         * object.cc (do_layout): Likewise.
10952         * symtab.cc (is_section_folded): Likewise.
10953         * main.cc (main): Likewise.
10954         * reloc.cc (Read_relocs::run): Likewise.
10955         (Sized_relobj::do_scan_relocs): Likewise.
10956         * icf.cc (is_function_ctor_or_dtor): New function.
10957         (Icf::find_identical_sections): Check if function is ctor or dtor when
10958         safe icf is chosen.
10959         * options.h (General_options::icf): Change option to be an enum.
10960         (Icf_status): New enum.
10961         (icf_enabled): New method.
10962         (icf_safe_folding): New method.
10963         (set_icf_status): New method.
10964         (icf_status_): New variable.
10965         * (options.cc) (General_options::finalize): Set icf_status_.
10966         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10967         icf_test and icf_keep_unique_test to use the --icf enum flag.
10968         * testsuite/icf_safe_test.sh: New file.
10969         * testsuite/icf_safe_test.cc: New file.
10970
10971 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10972
10973         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10974         includes to gc.h and icf.h.
10975         * arm.cc: Include gc.h.
10976         * gold.cc: Likewise.
10977         * i386.cc: Likewise.
10978         * powerpc.cc: Likewise.
10979         * sparc.cc: Likewise.
10980         * x86_64.cc: Likewise.
10981         * gc.h: Include icf.h.
10982
10983 2009-10-11  Ian Lance Taylor  <iant@google.com>
10984
10985         * plugin.cc: Include "gold.h" before other header files.
10986
10987 2009-10-10  Chris Demetriou  <cgd@google.com>
10988
10989         * options.h (Input_file_argument::Input_file_type): New enum.
10990         (Input_file_argument::is_lib_): Replace with...
10991         (Input_file_argument::type_): New member.
10992         (Input_file_argument::Input_file_argument): Take Input_file_type
10993         'type' rather than boolean 'is_lib' as second argument.
10994         (Input_file_argument::is_lib): Use type_.
10995         (Input_file_argument::is_searched_file): New function.
10996         (Input_file_argument::may_need_search): Handle is_searched_file.
10997         * options.cc (General_options::parse_library): Support -l:filename.
10998         (General_options::parse_just_symbols): Update for Input_file_argument
10999         changes.
11000         (Command_line::process): Likewise.
11001         * archive.cc (Archive::get_file_and_offset): Likewise.
11002         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11003         * script.cc (read_script_file, script_add_file): Likewise.
11004         * fileread.cc (Input_file::Input_file): Likewise.
11005         (Input_file::will_search_for): Handle is_searched_file.
11006         (Input_file::open): Likewise.
11007         * readsyms.cc (Read_symbols::get_name): Likewise.
11008         * testsuite/Makefile.am (searched_file_test): New test.
11009         * testsuite/Makefile.in: Regenerate.
11010         * testsuite/searched_file_test.cc: New file.
11011         * testsuite/searched_file_test_lib.cc: New file.
11012
11013 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11014             Ian Lance Taylor  <iant@google.com>
11015
11016         * descriptor.cc: Include <cstdio> and "binary-io.h".
11017         (Descriptors::open): Open the files in binary mode always.
11018         * script.cc (Lex::get_token): Treat \r as whitespace.
11019
11020 2009-10-09  Ian Lance Taylor  <iant@google.com>
11021
11022         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11023
11024 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11025             Ian Lance Taylor  <iant@google.com>
11026
11027         * configure.ac: Check for readv function also.
11028         * fileread.cc (readv): Define if not HAVE_READV.
11029         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11030         does not exist.
11031         * config.in: Regenerate.
11032         * configure: Regenerate.
11033
11034 2009-10-09  Doug Kwan  <dougkwan@google.com>
11035
11036         * layout.cc (Layout::make_output_section): Call target hook to make
11037         ordinary output section.
11038         (Layout::finalize): Adjust parameter list of call the
11039         Target::may_relax().
11040         * layout.h (class Layout::section_list): New method.
11041         * merge.h (Output_merge_base::entsize): Change visibility to public.
11042         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11043         New methods.
11044         (Output_merge_string::do_is_string): New method.
11045         * object.cc (Sized_relobj::do_setup): renamed from
11046         Sized_relobj::set_up.
11047         * object.h (Sized_relobj::adjust_shndx,
11048         Sized_relobj::initializ_input_to_output_maps,
11049         Sized_relobj::free_input_to_output_maps): Change visibilities to
11050         protected.
11051         (Sized_relobj::setup): Virtualize.
11052         (Sized_relobj::do_setup): New method declaration.
11053         (Sized_relobj::invalidate_section_offset,
11054         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11055         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11056         * options.cc (parse_int): New function.
11057         * options.h (parse_int): New declaration.
11058         (DEFINE_int): New macro.
11059         (stub_group_size): New option.
11060         * output.cc (Output_section::Output_section): Initialize memebers
11061         merge_section_map_, merge_section_by_properties_map_,
11062         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11063         (Output_section::add_input_section): Handled deferred code-fill
11064         generation and remove an old comment.
11065         (Output_section::add_relaxed_input_section): New method definition.
11066         (Output_section::add_merge_input_section): Use merge section by
11067         properties map to speed to search.  Update merge section maps
11068         as appropriate.
11069         (Output_section::build_relaxation_map): New method definition.
11070         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11071         Same.
11072         (Output_section::relax_input_section): Renamed to
11073         Output_section::convert_input_sections_to_relaxed_sections and change
11074         interface to take a vector of pointers to relaxed sections.
11075         (Output_section::find_merge_section,
11076         Output_section::find_relaxed_input_section): New method definitions.
11077         (Output_section::is_input_address_mapped,
11078         Output_section::output_offset, Output_section::output_address):
11079         Use output section data maps to speed up searching.
11080         (Output_section::find_starting_output_address): Add comments.
11081         (Output_section::do_write,
11082         Output_section::write_to_postprocessing_buffer): Do code-fill
11083         generation as appropriate.
11084         (Output_section::get_input_sections): Invalidate relaxed input section
11085         map.
11086         (Output_section::restore_states): Adjust type of checkpoint .
11087         Invalidate relaxed input section map.
11088         * output.h (Output_merge_base): New class declaration.
11089         (Input_section_specifier): New class defintion.
11090         (class Output_relaxed_input_section) Change base class to
11091         Output_section_data_build.
11092         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11093         base class initializer.
11094         (Output_section::add_relaxed_input_section): New method declaration.
11095         (Output_section::Input_section): Change visibility to protected.
11096         (Output_section::Input_section::relobj,
11097         Output_section::Input_section::shndx): Handle relaxed input sections.
11098         Output_section::input_sections) Change visibility to protected.  Also
11099         define overload to return a non-const pointer.
11100         (Output_section::Merge_section_properties): New class defintion.
11101         (Output_section::Merge_section_by_properties_map,
11102         Output_section::Output_section_data_by_input_section_map,
11103         Output_section::Relaxation_map): New types.
11104         (Output_section::relax_input_section): Rename method to
11105         Output_section::convert_input_sections_to_relaxed_sections and change
11106         interface to take a vector of relaxed section pointers.
11107         (Output_section::find_merge_section,
11108         Output_section::find_relaxed_input_section,
11109         Output_section::build_relaxation_map,
11110         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11111         New method declarations.
11112         (Output_section::merge_section_map_
11113         Output_section::merge_section_by_properties_map_,
11114         Output_section::relaxed_input_section_map_,
11115         Output_section::is_relaxed_input_section_map_valid_,
11116         Output_section::generate_code_fills_at_write_): New data members.
11117         * script-sections.cc
11118         (Output_section_element_input::set_section_addresses): Call
11119         current_data_size and addralign methods of relaxed input sections.
11120         (Orphan_output_section::set_section_addresses): Call current_data_size
11121         and addralign methods of relaxed input sections.
11122         * symtab.cc (Symbol_table::compute_final_value): Extract template
11123         from the body of Symbol_table::sized_finalize_symbol.
11124         (Symbol_table::sized_finalized_symbol): Call
11125         Symbol_table::compute_final_value.
11126         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11127         (Symbol_table::compute_final_value): New templated method declaration.
11128         * target.cc (Target::do_make_output_section): New method defintion.
11129         * target.h (Target::make_output_section): New method declaration.
11130         (Target::relax): Add more parameters for input objects, symbol table
11131         and layout.  Adjust call to do_relax.
11132         (Target::do_make_output_section): New method declaration.
11133         (Target::do_relax): Add parameters for input objects, symbol table
11134         and layout.
11135
11136 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11137
11138         * pread.c: Include stdio.h.
11139
11140 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11141
11142         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11143         defined.
11144
11145 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11146
11147         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11148         Change read_shndx type to unsigned int.
11149         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11150         int.
11151         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11152         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11153         Change read_shndx type to unsigned int.
11154         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11155         int.
11156         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11157         * layout.cc (Layout::create_symtab_sections): Cast the result of
11158         local_symcount * symsize to off_t in the gold_assert.
11159
11160 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11161
11162         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11163         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11164         R_ARM_BASE_ABS.
11165         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11166         (Arm_relocate_functions::thm_abs5): New function.
11167         (Arm_relocate_functions::abs12): New function.
11168         (Arm_relocate_functions::abs16): New function.
11169         (Arm_relocate_functions::base_abs): New function.
11170         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11171         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11172         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11173         R_ARM_BASE_ABS.
11174         (Scan::global): Likewise.
11175         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11176         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11177         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11178         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11179         R_ARM_BASE_ABS.
11180
11181 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11182
11183         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11184         (Arm_relocate_functions::movt_prel): New function.
11185         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11186         (Arm_relocate_functions::thm_movt_prel): New function.
11187         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11188         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11189         (Scan::global, Relocate::relocate): Likewise.
11190         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11191
11192 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11193
11194         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11195         Incremental_checker.
11196         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11197         unsigned int.
11198         (class Incremental_inputs_header): New class.
11199         (Incremental_inputs_header_writer): Edit comment.
11200         (Incremental_inputs_entry): New class.
11201         (Incremental_inputs_entry_writer): Edit comment.
11202         (Sized_incremental_binary::do_find_incremental_inputs_section):
11203         Add *strtab_shndx parameter, fill it.
11204         (Sized_incremental_binary::do_check_inputs): New method.
11205         (Incremental_checker::can_incrementally_link_output_file): Use
11206         Sized_incremental_binary::check_inputs.
11207         (Incremental_inputs::report_command_line): Save command line in
11208         command_line_.
11209         * incremental.h:
11210         (Incremental_binary::find_incremental_inputs_section): New
11211         method.
11212         (Incremental_binary::do_find_incremental_inputs_section): Add
11213         strtab_shndx parameter.
11214         (Incremental_binary::do_check_inputs): New pure virtual method.
11215         (Sized_incremental_binary::do_check_inputs): Declare.
11216         (Incremental_checker::Incremental_checker): Add incremental_inputs
11217         parameter, use it to initialize incremental_inputs_.
11218         (Incremental_checker::incremental_inputs_): New field.
11219         (Incremental_checker::command_line): New method.
11220         (Incremental_checker::inputs): New method.
11221         (Incremental_checker::command_line_): New field.
11222
11223 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11224
11225         * incremental.cc: Include <cstdarg> and "target-select.h".
11226         (vexplain_no_incremental): New function.
11227         (explain_no_incremental): New function.
11228         (Incremental_binary::error): New method.
11229         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11230         method.
11231         (make_sized_incremental_binary): New function.
11232         (open_incremental_binary): New function.
11233         (can_incrementally_link_file): Add checks if output is ELF and has
11234         inputs section.
11235         * incremental.h: Include "elfcpp_file.h" and "output.h".
11236         (Incremental_binary): New class.
11237         (Sized_incremental_binary): New class.
11238         (open_incremental_binary): Declare.
11239         * object.cc (is_elf_object): Use
11240         elfcpp::Elf_recognizer::is_elf_file.
11241         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11242         * output.h (Output_file::filesize): New method.
11243
11244 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11245
11246         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11247         New function.
11248         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11249         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11250         function.
11251         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11252         function.
11253         (Arm_relocate_functions::movw_abs_nc): New function.
11254         (Arm_relocate_functions::movt_abs): New function.
11255         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11256         (Arm_relocate_functions::thm_movt_abs): New function.
11257         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11258         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11259         (Scan::global): Likewise.
11260         (Relocate::relocate): Likewise.
11261         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11262
11263 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11264
11265         * arm.cc (Arm_relocate_functions::got_prel) New function.
11266         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11267         (Relocate::relocate): Likewise.
11268         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11269
11270 2009-10-06  Ian Lance Taylor  <iant@google.com>
11271
11272         * options.h (class General_options): Define
11273         split_stack_adjust_size parameter.
11274         * object.h (class Object): Add uses_split_stack_ and
11275         has_no_split_stack_ fields.  Add uses_split_stack and
11276         has_no_split_stack accessor functions.  Declare
11277         handle_split_stack_section.
11278         (class Reloc_symbol_changes): Define.
11279         (class Sized_relobj): Define Function_offsets.  Declare
11280         split_stack_adjust, split_stack_adjust_reltype, and
11281         find_functions.
11282         * object.cc (Object::handle_split_stack_section): New function.
11283         (Sized_relobj::do_layout): Call handle_split_stack_section.
11284         * dynobj.cc (Sized_dynobj::do_layout): Call
11285         handle_split_stack_section.
11286         * reloc.cc (Sized_relobj::relocate_sections): Call
11287         split_stack_adjust for executable sections in split_stack
11288         objects.  Pass reloc_map to relocate_section.
11289         (Sized_relobj::split_stack_adjust): New function.
11290         (Sized_relobj::split_stack_adjust_reltype): New function.
11291         (Sized_relobj::find_functions): New function.
11292         * target-reloc.h: Include "object.h".
11293         (relocate_section): Add reloc_symbol_changes parameter.  Change
11294         all callers.
11295         * target.h (class Target): Add calls_non_split method.  Declare
11296         do_calls_non_split virtual method.  Declare match_view and
11297         set_view_to_nop.
11298         * target.cc: Include "elfcpp.h".
11299         (Target::do_calls_non_split): New function.
11300         (Target::match_view): New function.
11301         (Target::set_view_to_nop): New function.
11302         * gold.cc (queue_middle_tasks): Give an error if mixing
11303         split-stack and non-split-stack objects with -r.
11304         * i386.cc (Target_i386::relocate_section): Add
11305         reloc_symbol_changes parameter.
11306         (Target_i386::do_calls_non_split): New function.
11307         * x86_64.cc (Target_x86_64::relocate_section): Add
11308         reloc_symbol_changes parameter.
11309         (Target_x86_64::do_calls_non_split): New function.
11310         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11311         parameter.
11312         * powerpc.cc (Target_powerpc::relocate_section): Add
11313         reloc_symbol_changes parameter.
11314         * sparc.cc (Target_sparc::relocate_section): Add
11315         reloc_symbol_changes parameter.
11316         * configure.ac: Call AM_CONDITIONAL for the default target.
11317         * configure: Rebuild.
11318         * testsuite/Makefile.am (TEST_AS): New variable.
11319         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11320         (check_DATA): Add split_i386 and split_x86_64 files.
11321         (SPLIT_DEFSYMS): Define.
11322         (split_i386_[1234n].o): New targets.
11323         (split_i386_[124]): New targets.
11324         (split_i386_[1234r].stdout): New targets.
11325         (split_x86_64_[1234n].o): New targets.
11326         (split_x86_64_[124]): New targets.
11327         (split_x86_64_[1234r].stdout): New targets.
11328         (MOSTLYCLEANFILES): Add new executables.
11329         * testsuite/split_i386.sh: New file.
11330         * testsuite/split_x86_64.sh: New file.
11331         * testsuite/split_i386_1.s: New file.
11332         * testsuite/split_i386_2.s: New file.
11333         * testsuite/split_i386_3.s: New file.
11334         * testsuite/split_i386_4.s: New file.
11335         * testsuite/split_i386_n.s: New file.
11336         * testsuite/split_x86_64_1.s: New file.
11337         * testsuite/split_x86_64_2.s: New file.
11338         * testsuite/split_x86_64_3.s: New file.
11339         * testsuite/split_x86_64_4.s: New file.
11340         * testsuite/split_x86_64_n.s: New file.
11341         * testsuite/testfile.cc (Target_test): Update relocation_section
11342         function.
11343         * testsuite/Makefile.in: Rebuild.
11344
11345 2009-10-06  Ian Lance Taylor  <iant@google.com>
11346
11347         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11348         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11349         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11350         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11351         the address on ldo_addrs_.
11352         (Target_i386::Relocate::fix_up_ldo): New function.
11353
11354 2009-10-06   Rafael Espindola  <espindola@google.com>
11355
11356         * plugin.cc (add_input_library): New.
11357         (Plugin::load): Add add_input_library to tv.
11358         (Plugin_manager::add_input_file): Add the is_lib argument.
11359         (add_input_file): Update call to Plugin_manager::add_input_file.
11360         (add_input_library): New.
11361         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11362
11363 2009-09-30  Doug Kwan  <dougkwan@google.com>
11364
11365         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11366         symbol and call Symbol::may_need_copy_reloc to determine if
11367         a copy reloc is needed.
11368         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11369         nocopyreloc is given in command line.
11370         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11371         given in command line.
11372         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11373         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11374         of the removed Target_i386::may_need_copy_reloc.
11375         * options.h (copyreloc): New option with default value false.
11376         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11377         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11378         instead of the removed Target_powerpc::may_need_copy_reloc.
11379         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11380         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11381         instead of the removed Target_sparc::may_need_copy_reloc.
11382         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11383         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11384         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11385         instead of the removed Target_x86_64::may_need_copy_reloc.
11386
11387 2009-09-30  Ian Lance Taylor  <iant@google.com>
11388
11389         * object.h (class Object): Remove target_ field, and target,
11390         sized_target, and set_target methods.
11391         (Object::sized_target): Remove.
11392         (class Sized_relobj): Update declarations.  Remove sized_target.
11393         * object.cc (Sized_relobj::setup): Remove target parameter.
11394         Change all callers.
11395         (Input_objects::add_object): Don't do anything with the target.
11396         (make_elf_sized_object): Add punconfigured parameter.  Change all
11397         callers.  Set or test parameter target.
11398         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11399         Change all callers.
11400         * parameters.cc (Parameters::set_target): Change parameter type to
11401         be non-const.
11402         (Parameters::default_target): Remove.
11403         (set_parameters_target): Change parameter type to be non-const.
11404         (parameters_force_valid_target): New function.
11405         (parameters_clear_target): New function.
11406         * parameters.h (class Parameters): Update declarations.  Remove
11407         default_target method.  Add sized_target and clear_target
11408         methods.  Change target_ to be non-const.
11409         (set_parameters_target): Update declaration.
11410         (parameters_force_valid_target): Declare.
11411         (parameters_clear_target): Declare.
11412         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11413         as NULL if we aren't searching.
11414         (Add_symbols::run): Don't check for compatible target.
11415         * fileread.cc (Input_file::open_binary): Call
11416         parameters_force_valid_target.
11417         * gold.cc (queue_middle_tasks): Likewise.
11418         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11419         set_target on object.
11420         * dynobj.h (class Sized_dynobj): Update declarations.
11421         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11422         make_elf_object returns NULL.
11423         (Archive::include_member): Don't check whether object target is
11424         compatible.
11425         * output.cc (Output_section::add_input_section): Get target from
11426         parameters.
11427         (Output_section::relax_input_section): Likewise.
11428         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11429         parameters.
11430         (Sized_relobj::do_scan_relocs): Likewise.
11431         (Sized_relobj::relocate_sections): Likewise.
11432         * resolve.cc (Symbol_table::resolve): Likewise.
11433         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11434         parameter.  Change all callers.
11435         (Symbol_table::add_from_object): Get target from parameters.
11436         (Symbol_table::add_from_relobj): Don't check object target.
11437         (Symbol_table::add_from_dynobj): Likewise.
11438         (Symbol_table::define_special_symbol): Get target from
11439         parameters.
11440         * symtab.h (class Symbol_table): Update declaration.
11441         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11442         parameter.  Change all callers.  Clear parameter target.
11443         (Binary_test): Test target here.
11444         * testsuite/object_unittest.cc (gold_testsuite): Remove
11445         target_test_pointer parameter.  Change all callers.
11446         (Object_test): Test target here.
11447
11448 2009-09-26  Ian Lance Taylor  <iant@google.com>
11449
11450         * testsuite/initpri1.c: Don't try to use constructor priorities if
11451         compiling with gcc before 4.3.
11452
11453 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11454
11455         * testsuite/retain_symbols_file_test.sh (check_present): Change
11456         output file name to retain_symbols_file_test.stdout.
11457         (check_absent): Likewise.
11458
11459 2009-09-18  Craig Silverstein  <csilvers@google.com>
11460
11461         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11462         * options.cc: Include <cerrno> and <fstream>.
11463         (General_options::finalize): Parse -retain-symbols-file tag.
11464         * options.h: New flag.
11465         (General_options): New method should_retain_symbol, new
11466         variable symbols_to_retain.
11467         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11468         should_retain_symbol map.
11469         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11470         * testsuite/Makefile.in: Regenerate.
11471         * testsuite/retain_symbols_file_test.sh: New file.
11472
11473 2009-09-18  Nick Clifton  <nickc@redhat.com>
11474
11475         * po/es.po: Updated Spanish translation.
11476
11477 2009-09-17  Doug Kwan  <dougkwan@google.com>
11478
11479         * debug.h (DEBUG_RELAXATION): New constant.
11480         (DEBUG_ALL): Add DEBUG_RELAXATION.
11481         (debug_string_to_enum): Add relaxation debug option.
11482         * layout.cc
11483         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11484         Layout::Relaxation_debug_check::read_sections,
11485         Layout::Relaxation_debug_check::read_sections): New method definitions.
11486         (Layout::Layout): Initialize data members
11487         record_output_section_data_from_scrips_,
11488         script_output_section_data_list_ and relaxation_debug_check_.
11489         (Layout::save_segments, Layout::restore_segments,
11490         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11491         Layout::relaxation_loop_body): New method definitions.
11492         (Layout::finalize): Support relaxation.  Move section layout code to
11493         Layout::relaxation_loop_body.
11494         (Layout::set_asection_address_from_script): Move code for orphan
11495         section placement out.
11496         (Layout::place_orphan_sections_in_script): New method definition.
11497         * layout.h (Output_segment_headers, Output_file_header):
11498         New forward class declarations.
11499         (Layout::~Layout): Define.
11500         (Layout::new_output_section_data_from_script): New method definition.
11501         (Layout::place_orphan_sections_in_script): New method declaration.
11502         (Layout::Segment_states): New type declaration.
11503         (Layout::save_segments, Layout::restore_segments,
11504         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11505         Layout::relaxation_loop_body): New method declarations.
11506         (Layout::Output_section_data_list): New type declaration.
11507         (Layout::Relaxation_debug_check): New class definition.
11508         (Layout::record_output_section_data_from_script_,
11509         Layout::script_output_section_data_list_, Layout::segment_states_,
11510         Layout::relaxation_debug_check_): New data members.
11511         * output.cc: (Output_section_headers::do_size): New method definition.
11512         (Output_section_headers::Output_section_headers): Move size
11513         computation to Output_section_headers::do_size.
11514         (Output_segment_headers::do_size): New method definition.
11515         (Output_file_header::Output_file_header): Move size computation to
11516         Output_file_header::do_size and call it.
11517         (Output_file_header::do_size): New method definition.
11518         (Output_data_group::Output_data_group): Adjust call to
11519         Output_section_data.
11520         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11521         (Output_symtab_xindex::do_write): Add array bound check.
11522         (Output_section::Input_section::print_to_mapfile): Handle
11523         RELAXED_INPUT_SECTION_CODE.
11524         (Output_section::Output_section): Initialize data member checkpoint_.
11525         (Output_section::~Output_section): Delete checkpoint object pointed
11526         by checkpoint_.
11527         (Output_section::add_input_section): Always add an Input_section if
11528         relaxing.
11529         (Output_section::add_merge_input_section): Add assert.
11530         (Output_section::relax_input_section): New method definition.
11531         (Output_section::set_final_data_size): Set load address to zero for
11532         an unallocated section.
11533         (Output_section::do_address_and_file_offset_have_reset_values):
11534         New method definition.
11535         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11536         Handle relaxed input section.
11537         (Output_section::sort_attached_input_sections): Checkpoint input
11538         section list lazily.
11539         (Output_section::get_input_sections): Change type of input_sections to
11540         list of Simple_input_section pointers.  Checkpoint input section list
11541         lazily.  Also handle relaxed input sections.
11542         (Output_section::add_input_section_for_script): Take a reference to
11543         a Simple_input_section object instead of Relobj pointer and section
11544         index as parameter.  Handle relaxed input sections.
11545         (Output_section::save_states, Output_section::restore_states): New
11546         method definitions.
11547         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11548         (Output_data::is_data_size_fixed): New method definition.
11549         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11550         if it is fixed.
11551         (Output_data::address_and_file_offset_have_reset_values): New method
11552         definition.
11553         (Output_data::do_address_and_file_offset_have_reset_values): New method
11554         definition.
11555         (Output_data::set_data_size): Check that data size is not fixed.
11556         (Output_data::fix_data_size): New method definition.
11557         (Output_data::is_data_size_fixed_): New data member.
11558         (Output_section_headers::set_final_data_size): New method definition.
11559         (Output_section_headers::do_size): New method declaration.
11560         (Output_segment_headers::set_final_data_size): New method definition.
11561         (Output_segment_headers::do_size): New method declaration.
11562         (Output_file_header::set_final_data_size)::New method definition.
11563         (Output_file_header::do_size)::New method declaration.
11564         (Output_section_data::Output_section_data): Add new parameter
11565         is_data_size_fixed and use it to fix data size.
11566         (Output_data_const::Output_data_const): Adjust call to base class
11567         constructor and fix data size.
11568         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11569         base class constructor and fix data size.
11570         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11571         base class constructor and fix data size.
11572         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11573         class constructor and fix data size.
11574         (Output_data_group::set_final_data_size): New method definition.
11575         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11576         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11577         class constructor and fix data size.
11578         (Output_relaxed_input_section): New class definition.
11579         (Output_section::Simple_input_section): New class definition.
11580         (Output_section::get_input_sections): Adjust parameter list.
11581         (Output_section::add_input_section_for_script): Same.
11582         (Output_section::save_states, Output_section::restore_states,
11583         Output_section::do_address_and_file_offset_have_reset_values,
11584         (Output_section::Input_section::Input_section): Handle
11585         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11586         Output_relaxed_input_section.
11587         (Output_section::Input_section::is_input_section,
11588         Output_section::Input_section::set_output_section): Handle relaxed
11589         input section.
11590         (Output_section::Input_section::is_relaxed_input_section,
11591         Output_section::Input_section::output_section_data,
11592         Output_section::Input_section::relaxed_input_section): New method
11593         definitions.
11594         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11595         value.
11596         (Output_section::Input_section::u1_): Update comments.
11597         (Output_section::Input_section::u2_): Add new union member poris.
11598         (Output_section::Checkpoint_output_section): New classs definition.
11599         (Output_section::relax_input_section): New method declaration.
11600         (Output_section::checkpoint_): New data member.
11601         (Output_segment): Update comments.
11602         (Output_segment::Output_segment): Un-privatize copy constructor.
11603         (Output_segment::operator=): Un-privatize.
11604         * script-sections.cc (Output_section_element::Input_section_list):
11605         Change element type to Output_section::Simple_input_section.
11606         (Output_section_element_dot_assignment::set_section_addresses):
11607         Register output section data for relaxation clean up.
11608         (Output_data_exression::Output_data_expression): Adjust call to base
11609         constructor to fix data size.
11610         (Output_section_element_data::set_section_addresses): Register
11611         Output_data_expression object for relaxation clean up.
11612         (struct Input_section_info): Replace Relobj pointer and section index
11613         pair with Output_section::Simple_input_section and Convert struct to a
11614         class.
11615         (Input_section_sorter::operator()): Adjust access to
11616         Input_section_info data member to use accessors.
11617         (Output_section_element_input::set_section_addresses): Use layout
11618         parameter.  Adjust code to use Output_section::Simple_input_section
11619         and Input_secction_info classes.  Register filler for relaxation
11620         clean up.
11621         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11622         and section index pair with Output_section::Simple_input_section
11623         class.  Adjust code accordingly.
11624         (Phdrs_element::release_segment): New method definition.
11625         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11626         segment list.
11627         (Script_sections::release_segments): New method definition.
11628         * gold/script-sections.h (Script_sections::release_segments): New
11629         method declaration.
11630         * gold/target.h (Target::may_relax, Target::relax,
11631         Target::do_may_relax, Target::do_relax): New method definitions.
11632
11633 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11634
11635         * arm.cc (has_signed_unsigned_overflow): New function.
11636         (Arm_relocate_functions::abs8): New function.
11637         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11638         (Target_arm::Scan::global): Likewise.
11639         (Target_arm::relocate::relocate): Likewise.
11640         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11641         Likewise.
11642
11643 2009-09-16  Cary Coutant  <ccoutant@google.com>
11644
11645         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11646         * testsuite/Makefile.in: Regenerate.
11647
11648 2009-09-11  Nick Clifton  <nickc@redhat.com>
11649
11650         * po/gold.pot: Updated by the Translation project.
11651
11652 2009-09-08  Cary Coutant  <ccoutant@google.com>
11653
11654         * output.cc (Output_file::open): Add execute permission to empty file.
11655         * testsuite/Makefile.am (permission_test): New test.
11656         * testsuite/Makefile.in: Regenerate.
11657
11658 2009-09-02  Ian Lance Taylor  <iant@google.com>
11659
11660         * output.cc (Output_file::resize): Call map_no_anonymous rather
11661         than map.
11662
11663 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11664
11665         * gold.cc: Include "incremental.h".
11666         (queue_initial_tasks): Call Incremental_checker methods.
11667         * incremental.cc: Include "output.h".
11668         (Incremental_checker::can_incrementally_link_output_file): New
11669         method.
11670         * incremental.h (Incremental_checker): New class.
11671
11672         * output.cc (Output_file::open_for_modification): New method.
11673         (Output_file::map_anonymous): Changed return type to bool.  Record
11674         map in base_ field.
11675         (Output_file::map_no_anonymous): New method, broken out of map.
11676         (Output_file::map): Use map_no_anonymous and map_anonymous.
11677         * output.h (class Output_file): Update declarations.
11678
11679 2009-08-24  Cary Coutant  <ccoutant@google.com>
11680
11681         * options.h (Command_line::Pre_options): New class.
11682         (Command_line::pre_options): New member.
11683         * options.cc (gold::options::ready_to_register): New variable.
11684         (One_option::register_option): Do nothing if not registering options.
11685         Assert if same short option registered twice.
11686         (General_options::General_options): Turn off option registration when
11687         done constructing.
11688         (Command_line::Pre_options::Pre_options): New constructor.
11689
11690 2009-08-24  Cary Coutant  <ccoutant@google.com>
11691
11692         * options.h (General_options::no_keep_memory): Remove incorrect
11693         short option.
11694
11695 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11696
11697         * Makefile.am (am__skiplex, am__skipyacc): New.
11698         * Makefile.in: Regenerate.
11699
11700 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11701
11702         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11703         (INCLUDES): ... this.
11704         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11705         (AM_CPPFLAGS): Renamed from ...
11706         (INCLUDE): ... this.
11707         * Makefile.in, testsuite/Makefile.in: Regenerate.
11708
11709         * Makefile.in: Regenerate.
11710         * aclocal.m4: Likewise.
11711         * config.in: Likewise.
11712         * configure: Likewise.
11713         * testsuite/Makefile.in: Likewise.
11714
11715         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11716         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11717         * Makefile.in: Regenerate.
11718         * testsuite/Makefile.in: Regenerate.
11719
11720 2009-08-19  Cary Coutant  <ccoutant@google.com>
11721
11722         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11723         symbols in shared libraries overridden by hidden or internal symbols
11724         in the main program.
11725
11726 2009-08-19  Chris Demetriou  <cgd@google.com>
11727
11728         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11729         checking source file names in error messages.
11730
11731 2009-08-18  Doug Kwan  <dougkwan@google.com>
11732
11733         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11734         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11735         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11736         an elfcpp::Ehdr as parameter.
11737         * object.cc (Object::set_target): Remove the version that looks up
11738         a target and sets it.
11739         (Sized_relobj::setup): Take a Target object instead of
11740         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11741         (make_elf_sized_object): Find target and ask target to
11742         make an ELF object.
11743         * object.h: (Object::set_target): Remove the version that looks up
11744         a target and sets it.
11745         (Sized_relobj::setup): Take a Target object instead of
11746         an elfcpp:Ehdr as parameter.
11747         * target.cc: Include dynobj.h.
11748         (Target::do_make_elf_object_implementation): New.
11749         (Target::do_make_elf_object): New.
11750         * target.h (Target::make_elf_object): New template declaration.
11751         (Target::do_make_elf_object): New method declarations.
11752         (Target::do_make_elf_object_implementation): New template declaration.
11753
11754 2009-08-14  Ian Lance Taylor  <iant@google.com>
11755
11756         * gold.h (FUNCTION_NAME): Define.
11757         (gold_unreachable): Use FUNCTION_NAME.
11758
11759 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11760
11761         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11762         symbol in the --keep-unique list is not found.
11763
11764 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11765
11766         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11767         been maked as --keep-unique.
11768         (Icf::unfold_section): New function.
11769         * icf.h (Icf::unfold_section): New function.
11770         * options.h (General_options::keep_unique): New option.
11771         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11772         * testsuite/Makefile.in: Regenerate.
11773         * testsuite/icf_keep_unique_test.sh: New file.
11774         * testsuite/icf_keep_unique_test.cc: New file.
11775
11776 2009-08-12  Cary Coutant  <ccoutant@google.com>
11777
11778         PR 10471
11779         * resolve.cc (Symbol_table::resolve): Check for references from
11780         dynamic objects to hidden and internal symbols.
11781         * testsuite/Makefile.am (hidden_test.sh): New test.
11782         * testsuite/Makefile.in: Regenerate.
11783         * testsuite/hidden_test.sh: New script.
11784         * testsuite/hidden_test_1.c: New test source.
11785         * testsuite/hidden_test_main.c: New test source.
11786
11787 2009-08-11  Doug Kwan  <dougkwan@google.com>
11788
11789         * arm.cc: Update comments.
11790         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11791         segment to locate the .ARM.exidx section if present.
11792
11793 2009-08-09  Doug Kwan  <dougkwan@google.com>
11794
11795         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11796         patch.
11797
11798 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11799         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11800         compiler warnings.
11801
11802 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11803
11804         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11805         valid tls_segment only for non-debug-section relocations.
11806         * testsuite/Makefile.am: Add gc_tls_test.
11807         * testsuite/Makefile.in: Regenerate.
11808         * testsuite/gc_tls_test.cc: New file.
11809         * testsuite/gc_tls_test.sh: New file.
11810
11811 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11812
11813         * icf.cc: New file.
11814         * icf.h: New file.
11815         * Makefile.am (CCFILES): Add icf.cc.
11816         (HFILES): Add icf.h
11817         * Makefile.in: Regenerate.
11818         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11819         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11820         section, symbol and addend information for the relocs.
11821         * gold.cc (queue_middle_tasks): Call identical code folding.
11822         * gold.h: Add defines for multimap.
11823         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11824         to the call of finalize_local_symbols.
11825         * main.cc (main): Create object of class Icf.
11826         * object.cc (Sized_relobj::do_layout): Allow this function to be
11827         called twice during icf.
11828         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11829         to sections marked as identical by icf.
11830         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11831         when available.
11832         (Sized_relobj::do_section_entsize): New function.
11833         * object.h (Object::section_entsize): New function.
11834         (Object::do_section_entsize): New pure virtual function.
11835         (Relobj::finalize_local_symbols): Add new parameter.
11836         (Relobj::do_section_entsize): New function.
11837         * options.h (General_options::icf): New option.
11838         (General_options::icf_iterations): New option.
11839         (General_options::print_icf_sections): New option.
11840         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11841         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11842         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11843         icf.
11844         * symtab.cc (Symbol_table::is_section_folded): New function.
11845         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11846         to sections marked as identical by icf.
11847         * symtab.h (Symbol_table::set_icf): New function.
11848         (Symbol_table::icf): New function.
11849         (Symbol_table::is_section_folded): New function.
11850         (Symbol_table::icf_): New data member.
11851         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11852         * testsuite/Makefile.am: Add commands to build icf_test.
11853         * testsuite/Makefile.in: Regenerate.
11854         * testsuite/icf_test.sh: New file.
11855         * testsuite/icf_test.cc: New file.
11856
11857 2009-07-24  Chris Demetriou  <cgd@google.com>
11858
11859         * layout.cc (is_compressible_debug_section): Fix incorrect
11860         comment about compressed section names.
11861
11862 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11863
11864         PR 10419
11865         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11866
11867 2009-07-16  Ian Lance Taylor  <iant@google.com>
11868
11869         PR 10400
11870         * layout.h: #include <map>.
11871         (class Kept_section): Change from struct to class.  Add accessors
11872         and setters.  Add section size to Comdat_group mapping.  Change
11873         Comdat_group to std::map.  Add is_comdat_ field.  Add
11874         linkonce_size field in union.
11875         (class Layout): Update declaration of find_or_add_kept_section.
11876         Don't declare find_kept_object.
11877         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11878         parameter.  Add object, shndx, is_comdat, and is_group_name
11879         parameters.  Change all callers.  Adjust for new Kept_section.
11880         (Layout::find_kept_object): Remove.
11881         * object.cc (Sized_relobj::include_section_group): Update use of
11882         Kept_section.  Rename secnum to shndx.  Only record
11883         Kept_comdat_section if sections are the same size.
11884         (Sized_relobj::include_linkonce_section): Update use of
11885         Kept_section.  Only record Kept_comdat_section if sections are the
11886         same size.  Set size of linkonce section.
11887         (Sized_relobj::map_to_kept_section): Update call to
11888         get_kept_comdat_section.
11889         * object.h (class Sized_relobj): Rename fields in
11890         Kept_comdat_section to drop trailing underscores; change object
11891         field to Relobj*.  Change Kept_comdat_section_table to store
11892         struct rather than pointer.
11893         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11894         Add kept_object and kept_shndx parameters.  Change all callers.
11895         (Sized_relobj::get_kept_comdat_section): Change return type to
11896         bool.  Add kept_object and kept_shndx parameters.  Change all
11897         callers.
11898         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11899         Layout::find_or_add_kept_section.
11900
11901 2009-07-09  Ian Lance Taylor  <iant@google.com>
11902
11903         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11904         Reserve space in the hash table.
11905
11906 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11907
11908         * fileread.cc (File_read::get_mtime): New method.
11909         * fileread.h (Timespec): New structure.
11910         (File_read::get_mtime): New method.
11911         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11912         Renamed from timestamp_nsec.
11913         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11914         Elf_Xword.
11915         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11916         timestamp_nsec.
11917         (Incremental_inputs::report_archive): Save mtime; style fix.
11918         (Incremental_inputs::report_obejct): Save mtime; style fix.
11919         (Incremental_inputs::report_script): Save mtime; style fix.
11920         (Incremental_inputs::finalize_inputs): Style fix.
11921         (Incremental_inputs::finalize): Style fix.
11922         (Incremental_inputs::create_input_section_data): Store inputs
11923         mtime.
11924         * incremental.h (Incremental_inputs::report_script): Add mtime
11925         argument.
11926         (Incremental_inputs::Input_info::Input_info): Intialize only one
11927         union member.
11928         (Incremental_inputs::Input_info::archive): Move to nameless
11929         union.
11930         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11931         (Incremental_inputs::Input_info::script): Move to nameless union.
11932         (Incremental_inputs::mtime): New field.
11933         * script.cc (read_input_script): Pass file mtime to
11934         Incremental_input.
11935         * script.h (Script_info::inputs): Style fix.
11936
11937 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11938
11939         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11940         instead of 32.
11941
11942 2009-06-24  Ian Lance Taylor  <iant@google.com>
11943
11944         PR 10156
11945         * layout.cc (Layout::choose_output_section): If we find an
11946         existing section, update the flags.
11947         (Layout::create_notes): New function, broken out of
11948         Layout::finalize.
11949         (Layout::finalize): Don't create note sections.
11950         (Layout::create_note): Don't crash if linker script discards
11951         section.
11952         (Layout::create_gold_note): Likewise.
11953         (Layout::create_build_id): Likewise.  Don't set
11954         after_input_sections on the section.
11955         (Layout::create_executable_stack_info): Remove target parameter.
11956         Change caller.
11957         * layout.h (class Layout): Declare create_notes.  Update
11958         declaration of create_executable_stack_info.
11959         * gold.cc (queue_middle_tasks): Call create_notes.
11960         * output.cc (Output_section::update_flags_for_input_section): Move
11961         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11962         invalid.
11963         * output.h (Output_data::mark_address_invalid): New function.
11964         (class Output_section): Only declare, not define,
11965         update_flags_for_input_section.  Remove set_flags.
11966
11967 2009-06-24  Ian Lance Taylor  <iant@google.com>
11968
11969         * script-sections.cc (Output_section_definition::
11970         set_section_addresses): Rename shadowing local load_address to
11971         laddr.
11972
11973 2009-06-24  Ian Lance Taylor  <iant@google.com>
11974
11975         PR 10244
11976         * reloc.cc (relocate_sections): Skip empty relocation sections.
11977
11978 2009-06-23  Ian Lance Taylor  <iant@google.com>
11979
11980         PR 10156
11981         * layout.cc (Layout::create_note): Use choose_output_section
11982         rather than make_output_section.
11983
11984 2009-06-23  Ian Lance Taylor  <iant@google.com>
11985
11986         PR 10237
11987         * options.cc (General_options::parse_V): Set printed_version_.
11988         (General_options::General_options): Initialize printed_version_.
11989         * options.h (class General_options): Add printed_version_ field.
11990         * gold.cc (queue_initial_tasks): If there are no input files,
11991         don't give a fatal error if we printed the version information.
11992         (queue_middle_tasks): If using -r with a shared object, give a
11993         fatal error rather than an ordinary error.
11994
11995 2009-06-23  Ian Lance Taylor  <iant@google.com>
11996
11997         PR 10219
11998         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11999         (Layout::make_output_section): Set have_stabstr_section_ if we see
12000         a .stab*str section.
12001         (Layout::finalize): Call link_stabs_sections.
12002         (Layout::link_stabs_sections): New file.
12003         * layout.h (class Layout): Add have_stabstr_section_ field.
12004         Declare link_stabs_sections.
12005
12006 2009-06-23  Doug Kwan  <dougkwan@google.com>
12007
12008         * Makefile.am (libgold_a_LIBADD): New.
12009         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12010         * Makefile.in: Regenerate.
12011         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12012         * configure: Regenerate.
12013         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12014         * fileread.cc: Include sys/state.h
12015         * gold.h: Declare memmem and strndup if found missing.
12016         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12017
12018 2009-06-23  Ian Lance Taylor  <iant@google.com>
12019
12020         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12021         * configure: Rebuild.
12022
12023 2009-06-23  Ian Lance Taylor  <iant@google.com>
12024
12025         PR 10147
12026         * object.cc (Object::section_contents): Don't try to get a view if
12027         the section has length zero.
12028         (Object::handle_gnu_warning_section): If the section is empty, use
12029         the name of the section as the warning.
12030
12031 2009-06-23  Ian Lance Taylor  <iant@google.com>
12032
12033         PR 10133
12034         * stringpool.h (class Stringpool_template): Add optimize_ field.
12035         (Stringpool_template::set_optimize): New function.
12036         * stringpool.cc (Stringpool_template::Stringpool_template):
12037         Initialize optimize_ field.
12038         (Stringpool_template::set_string_offsets): Test local optimize
12039         fild rather than parameter.
12040         * layout.cc (Layout::Layout): Call set_optimize on the section
12041         name stringpool.
12042
12043 2009-06-22  Ian Lance Taylor  <iant@google.com>
12044
12045         PR 10030
12046         * yyscript.y: Parse TARGET.
12047         * script.cc (script_set_target): New function.
12048         * script-c.h (script_set_target): Declare.
12049         * options.cc (General_options::string_to_object_format): Rename
12050         from string_to_object_format in anonymous namespace.  Change
12051         callers.
12052         * options.h (class General_options): Declare
12053         string_to_object_format.
12054
12055 2009-06-22  Ian Lance Taylor  <iant@google.com>
12056
12057         * script-sections.cc (Script_sections::create_segments): Don't put
12058         program headers in a PT_LOAD segment if -n or -N.
12059
12060 2009-06-22  Ian Lance Taylor  <iant@google.com>
12061
12062         PR 10141
12063         * options.h (class General_options): Add -z lazy and -z now.  Sort
12064         -z options into alphabetical order.
12065         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12066
12067 2009-06-21  Ian Lance Taylor  <iant@google.com>
12068
12069         * layout.cc (Layout::make_output_section): Call
12070         Target::new_output_section.
12071         (Layout::attach_allocated_section_to_segment): Put large section
12072         sections in a separate load segment with the large segment flag
12073         set.
12074         (Layout::segment_precedes): Sort large data segments after other
12075         load segments.
12076         (align_file_offset): New static function.
12077         (Layout::set_segment_offsets): Use align_file_offset.
12078         * output.h (class Output_section): Add is_small_section_ and
12079         is_large_section_ fields.
12080         (Output_section::is_small_section): New function.
12081         (Output_section::set_is_small_section):  New function.
12082         (Output_section::is_large_section): New function.
12083         (Output_section::set_is_large_section): New function.
12084         (Output_section::is_large_data_section): New function.
12085         (class Output_segment): Add is_large_data_segment_ field.
12086         (Output_segment::is_large_data_segment): New function.
12087         (Output_segment::set_is_large_data_segment): New function.
12088         * output.cc (Output_section::Output_section): Initialize new
12089         fields.
12090         (Output_segment::Output_segment): Likewise.
12091         (Output_segment::add_output_section): Add assertion that large
12092         data sections always go in large data segments.  Force small data
12093         sections to the end of the list of data sections.  Force small BSS
12094         sections to the start of the list of BSS sections.  For large BSS
12095         sections to the end of the list of BSS sections.
12096         * symtab.h (class Symbol): Declare is_common_shndx.
12097         (Symbol::is_defined): Check Symbol::is_common_shndx.
12098         (Symbol::is_common): Likewise.
12099         (class Symbol_table): Define enum Commons_section_type.  Update
12100         declarations.  Add small_commons_ and large_commons_ fields.
12101         * symtab.cc (Symbol::is_common_shndx): New function.
12102         (Symbol_table::Symbol_table): Initialize new fields.
12103         (Symbol_table::add_from_object): Put small and large common
12104         symbols in the right list.
12105         (Symbol_table::sized_finalized_symbol): Check
12106         Symbol::is_common_shndx.
12107         (Symbol_table::sized_write_globals): Likewise.
12108         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12109         common symbol lists.  Don't call do_allocate_commons_list if the
12110         list is empty.
12111         (Symbol_table::do_allocate_commons_list): Remove is_tls
12112         parameter.  Add comons_section_type parameter.  Change all
12113         callers.  Handle small and large common symbols.
12114         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12115         Symbol::is_common_shndx.
12116         * resolve.cc (symbol_to_bits): Likewise.
12117         * target.h (Target::small_common_shndx): New function.
12118         (Target::small_common_section_flags): New function.
12119         (Target::large_common_shndx): New function.
12120         (Target::large_common_section_flags): New function.
12121         (Target::new_output_section): New function.
12122         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12123         small_common_section_flags, and large_common_section_flags
12124         fields.
12125         (Target::do_new_output_section): New virtual function.
12126         * arm.cc (Target_arm::arm_info): Initialize new fields.
12127         * i386.cc (Target_i386::i386_info): Likewise.
12128         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12129         Likewise.
12130         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12131         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12132         (Target_x86_64::do_new_output_section): New function.
12133         * configure.ac: Define conditional MCMODEL_MEDIUM.
12134         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12135         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12136         (large_LDFLAGS): Define.
12137         * testsuite/large.c: New file.
12138         * testsuite/testfile.cc (Target_test::test_target_info):
12139         Initialize new fields.
12140         * configure, testsuite/Makefile.in: Rebuild.
12141
12142 2009-06-05  Doug Kwan  <dougkwan@google.com>
12143
12144         * Makefile.am (CCFILES): Add target.cc.
12145         * Makefile.in: Regenerate.
12146         * i386.cc (class Target_i386): Define new virtual method to
12147         override do_is_local_label_name in parent.
12148         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12149         local symbols if --discard-locals or -X is given.
12150         * options.h (class General_options): Declare new options
12151         '--discard-locals' and '-X' for discarding locals.
12152         * target.h (class Target): Define new methods is_local_label_name.
12153         Declare new virtual method do_is_local_label_name.
12154         * target.cc: New file.
12155         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12156         (check_SCRIPTS): Add discard_locals_test.sh.
12157         (check_DATA): Add discard_local_tests.syms.
12158         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12159         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12160         * testsuite/Makefile.in: Regenerate.
12161         * testsuite/discard_locals_test.c: New file.
12162         * testsuite/discard_locals_test.sh: Same.
12163
12164 2009-06-05  Doug Kwan  <dougkwan@google.com>
12165
12166         * object.cc (Sized_relobj::Sized_relobj): Initialize
12167         discarded_eh_frame_shndx_ to -1U.
12168         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12169         section.
12170         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12171         a discarded .eh_frame section.
12172         (Sized_relobj::do_finalize_local_symbols): Ditto.
12173         * object.h (class Sized_relobj): Declare new member
12174         discarded_eh_frame_shndx_.
12175         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12176         (local_labels_test.o, local_labels_test): New rules.
12177         * testsuite/Makefile.in: Regenerate.
12178
12179 2009-06-04  Doug Kwan  <dougkwan@google.com>
12180
12181         * layout.cc (Layout::section_name_mapping): Add mapping for
12182         special ARM sections.
12183
12184 2009-06-03  Doug Kwan  <dougkwan@google.com>
12185
12186         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12187         (utils::has_overflow): Same.
12188
12189 2009-06-03  Ian Lance Taylor  <iant@google.com>
12190
12191         * layout.cc (Layout::section_name_mapping): New array, replacing
12192         Layout::linkonce_mapping.
12193         (Layout::section_name_mapping_count): New variable, replacing
12194         Layout::linkonce_mapping_count.
12195         (Layout::linkonce_output_name): Remove.
12196         (Layout::output_section_name): Rewrite.
12197         * layout.h (class Layout): Rename Linkonce_mapping to
12198         Section_name_mapping, linkonce_mapping to section_name_mapping,
12199         linkonce_mapping_count to section_name_mapping_count.  Don't
12200         declare linkonce_output_name.
12201
12202 2009-06-03  Doug Kwan  <dougkwan@google.com>
12203
12204         * gold/arm.cc (namespace utils): New.
12205         (Target_arm::reloc_is_non_pic): Define new method.
12206         (class Arm_relocate_functions): New.
12207         (Target_arm::Relocate::relocate): Handle relocation types used by
12208         Android.
12209
12210 2009-06-03  Ian Lance Taylor  <iant@google.com>
12211
12212         * arm.cc (Target_arm::scan::global): Use || instead of |.
12213
12214 2009-06-02  Doug Kwan  <dougkwan@google.com>
12215
12216         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12217         issued_non_pic_error_.
12218         (class Target_arm::Scan): Declare new method check_non_pic.
12219         Define new method symbol_needs_plt_entry.
12220         Declare new data member issued_non_pic_error_.
12221         (class Target_arm::Relocate): Declare new method
12222         should_apply_static_reloc.
12223         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12224         (Target_arm::Scan::check_non_pic): Define new method.
12225         (Target_arm::Scan::local): Handle a small subset of reloc types used
12226         by Android.
12227         (Target_arm::Scan::local): Same.
12228         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12229
12230 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12231
12232         * incremental.cc (Incremental_inputs::report_command_line): Filter
12233         out --incremental-* options.
12234
12235 2009-05-29  Doug Kwan  <dougkwan@google.com>
12236
12237         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12238         template class.
12239         (class Target_arm): Update comment.
12240         (Target_arm::Target_arm): Initialize new data members GOT_,
12241         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12242         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12243         and Target_arm::rel_dyn_section.
12244         Declare new_enum Target_arm::Got_type.
12245         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12246         and DYNBSS_.
12247         Update commments for member do_dynsym_value.
12248         (Target_arm::got_size, Target_arm::plt_section,
12249         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12250         new methods inside class defintion.
12251         (Target_arm::got_section): Define new method.
12252         (Target_arm::rel_dyn_section): Same.
12253         (Output_data_plt_arm): New template class.
12254         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12255         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12256         (Output_data_plt_arm::add_entry): Same.
12257         (Output_data_plt_arm::first_plt_entry): Define new
12258         static data member for PLT instruction template.
12259         (Output_data_plt_arm::plt_entry): Same.
12260         (Output_data_plt_arm::do_write): Define new method.
12261         (Target_arm::make_plt_entry): Same.
12262         (Target_arm::do_finalize_sections): Same.
12263         (Target_arm::do_dynsym_value): Same.
12264
12265 2009-05-28  Doug Kwan  <dougkwan@google.com>
12266
12267         * Makefile.am (TARGETSOURCES): Add arm.cc.
12268         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12269         * Makefile.in: Regenerate.
12270         * arm.cc: New file.
12271         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12272
12273 2009-05-26  Doug Kwan  <dougkwan@google.com>
12274
12275         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12276         (General_options::check_excluded_libs): Strip off directories in
12277         archive name before matching like GNU ld does.
12278         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12279         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12280         (exclude_libs_test_LDFLAGS): Add linker option
12281         -Wl,--exclude-libs,libexclude_libs_test_3
12282         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12283         an explicit archive without using -l.
12284         (alt/libexclude_libs_test_3.a): New make rule.
12285         * testsuite/Makefile.in: Regenerate.
12286         * testsuite/exclude_libs_test.c : Declare lib3_default().
12287         (main): Call it.
12288         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12289         * exclude_libs_test_3.c: New file.
12290
12291 2009-05-26  Nick Clifton  <nickc@redhat.com>
12292
12293         * po/id.po: New Indonesian translation.
12294         * po/gold.pot: Updated template file.
12295
12296 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12297
12298         * testsuite/Makefile.am: Add -ffunction-sections to compile
12299         gc_comdat_test files.  Add -Wl,--gc-sections to build
12300         gc_comdat_test.
12301         * testsuite/Makefile.in: Regenerate.
12302         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12303
12304 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12305
12306         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12307         kept comdat section was garbage collected.
12308         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12309         * testsuite/Makefile.in: Regenerate.
12310         * testsuite/gc_comdat_test.sh: New file.
12311         * testsuite/gc_comdat_test_1.cc: New file.
12312         * testsuite/gc_comdat_test_2.cc: New file.
12313
12314 2009-05-19  Doug Kwan  <dougkwan@google.com>
12315
12316         * archive.cc (Archive::Archive): Move constructor from archive.h
12317         to here.  Initialize no_export_.
12318         (Archive::get_elf_object_for_member): Set no_export flag of object.
12319         * archive.h (Archive::Archive): Move constructor body to
12320         archive.cc.
12321         (Archive::no_export): New method.
12322         (Archive::no_export_): New field.
12323         * object.h (Object::Object): Initialize no_export_ to false.
12324         (Object::no_export, Object::set_no_export): New methods.
12325         (Object::no_export_): New field.
12326         * options.cc (General_options::parse_exclude_libs): New method.
12327         (General_options::check_excluded_libs) Same.
12328         * options.h (exclude_libs): New option.
12329         (General_options::check_excluded_libs): New method declaration.
12330         (General_options::excluded_libs_): New field.
12331         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12332         default or protected visibility if an object has no-export flag set.
12333         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12334         (check_SCRIPTS): Add exclude_libs_test.sh.
12335         (check_DATA): Add exclude_libs_test.syms.
12336         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12337         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12338         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12339         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12340         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12341         libexclude_libs_test_2.a): New rules.
12342         * testsuite/Makefile.in: Regenerate.
12343         * testsuite/exclude_libs_test.c: New file.
12344         * testsuite/exclude_libs_test.sh: Ditto.
12345         * testsuite/exclude_libs_test_1.c: Ditto.
12346         * testsuite/exclude_libs_test_2.c: Ditto.
12347
12348 2009-05-15  Ian Lance Taylor  <iant@google.com>
12349
12350         * configure.ac: Check for declarations for cases where libiberty.h
12351         checks HAVE_DECL_xxx.
12352         * configure, config.in: Rebuild.
12353
12354 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12355
12356         * gold.h (Incremental_argument_list): Remove (invalid) forward
12357         declaration.
12358         * incremental.cc (Incremental_inputs::report_achive): New method.
12359         (Incremental_inputs::report_object): New method.
12360         (Incremental_inputs::report_script): New method.
12361         (Incremental_inputs::finalize_inputs): New method.
12362         (Incremental_inputs::finalize): Call finalize_inputs().
12363         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12364         Create inputs entries.
12365         * incremental.h (Incremental_input_type): New enum.
12366         (Incremental_inputs::Incremental_input): Initialize new fields.
12367         (Incremental_inputs::report_inputs): New method.
12368         (Incremental_inputs::report_achive): New method.
12369         (Incremental_inputs::report_object): New method.
12370         (Incremental_inputs::report_script): New method.
12371         (Incremental_inputs::finalize_inputs): New method.
12372         (Incremental_inputs::Input_info): New struct.
12373         (Incremental_inputs::Input_info_map): New typedef.
12374         (Incremental_inputs::lock_): New field.
12375         (Incremental_inputs::Inputs_): New field.
12376         (Incremental_inputs::Inputs_map): New field.
12377         * main.cc (main): Call Incremental_input::report_inputs.
12378         * options.h (Input_argument_list): Typedef moved from
12379         Input_arguments.
12380         (Input_file_group::Files): Remove, use ::Input_argument_list.
12381         (Input_file_group::Input_argument_list): Remove, use
12382         ::Input_argument_list.
12383         * plugin.cc (Plugin_manager::add_input_file): Add error in
12384         incremental build.
12385         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12386         functions.
12387         * script.cc (read_input_script): Call
12388         Incremental_input::report_script.
12389         * script.h (Script_info): New class.
12390
12391 2009-04-27  Ian Lance Taylor  <iant@google.com>
12392
12393         * x86_64.cc (do_adjust_output_section): Set entsize to
12394         plt_entry_size.
12395
12396 2009-04-23  Elliott Hughes  <enh@google.com>
12397
12398         * output.cc (Output_file::close): After short writes, continue
12399         writing from the correct offset in the buffer being written.
12400
12401 2009-04-23  Chris Demetriou  <cgd@google.com>
12402
12403         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12404         * configure: Regenerate.
12405         * config.in: Regenerate.
12406         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12407         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12408
12409 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12410
12411         * incremental.cc (Incremental_inputs_header_data): Renamed from
12412         Incremental_input_header_data.
12413         (Incremental_inputs_header_data::data_size): New field.
12414         (Incremental_inputs_header_data::put_input_file_count): Renamed
12415         from input_file_count.
12416         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12417         from command_line_offset.
12418         (Incremental_inputs_header_data::put_reserved): Renamed from
12419         put_reserved.
12420         (Incremental_inputs_entry_data): Renamed from
12421         Incremental_input_entry_data.
12422         (Incremental_inputs_entry_data::data_size): New field.
12423         (Incremental_inputs::report_command_line): New method.
12424         (Incremental_inputs::finalize): New method.
12425         (Incremental_inputs::create_incremental_inputs_data): New method.
12426         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12427         * incremental.h: New file.
12428         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12429         (Layout::finalize): Create incremental inputs section in
12430         incremental builds.
12431         (Layout::create_incremental_info_sections): New method.
12432         * layout.h (Layout::incremental_inputs): New method.
12433         (Layout::create_incremental_info_sections): New method.
12434         (Layout::incremental_inputs_): New field.
12435         * main.cc (main): Notify Incremental_input of the command line.
12436
12437 2009-04-01  Ian Lance Taylor  <iant@google.com>
12438             Mikolaj Zalewski  <mikolajz@google.com>
12439
12440         * gold.h (reserve_unordered_map): Define, three versions, one for
12441         each version of Unordered_map.
12442         * layout.cc (Layout::Layout): Remove options parameter.  Add
12443         number_of_input_files parameter.  Don't initialize options_.
12444         Initialize number_of_input_files_ and resized_signatures_.  Move
12445         sections_are_attached_.
12446         (Layout::layout_group): Reserve space for group_signatures_.
12447         (Layout::find_or_add_kept_section): Change name parameter to be a
12448         reference.  Resize signatures_ map when it gets large enough.
12449         (Layout::layout_eh_frame): Use parameters->options() instead of
12450         this->options_.
12451         (Layout::make_output_section): Likewise.
12452         (Layout::attach_allocated_section_to_segment): Likewise.
12453         (Layout::finalize, Layout::create_executable_stack): Likewise.
12454         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12455         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12456         * layout.h (class Layout): Update declarations.  Remove options_
12457         field.  Add number_of_input_files_ and resized_signatures_
12458         fields.  Move sections_are_attached_ field.
12459         * main.cc (main): Pass number of input files to Layout
12460         constructor.  Don't pass options.
12461
12462 2009-03-30  Ian Lance Taylor  <iant@google.com>
12463
12464         * ffsll.c (ffsll): Correct implementation.
12465
12466 2009-03-27  Ian Lance Taylor  <iant@google.com>
12467
12468         * ffsll.c: New file.
12469         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12470         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12471         * ftruncate.c (ftruncate): Declare before definition.
12472         * mremap.c (mremap): Likewise.
12473         * pread.c (pread): Likewise.
12474         * configure, Makefile.in, config.in: Rebuild.
12475
12476         * mremap.c: New file.
12477         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12478         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12479         (mremap): Declare if HAVE_MREMAP is not defined.
12480         * configure, Makefile.in, config.in: Rebuild.
12481
12482 2009-03-27  Cary Coutant  <ccoutant@google.com>
12483
12484         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12485         position independent.
12486         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12487         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12488
12489 2009-03-24  Cary Coutant  <ccoutant@google.com>
12490
12491         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12492         an executable.
12493         (needs_dynamic_reloc): Likewise.
12494
12495 2009-03-24  Ian Lance Taylor  <iant@google.com>
12496
12497         * yyscript.y (file_cmd): Recognize EXTERN.
12498         (extern_name_list, extern_name_list_body): New nonterminals.
12499         * script.cc (script_add_extern): Define.
12500         * script-c.h (script_add_extern): Declare.
12501
12502 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12503
12504         * object.cc (is_elf_object): Define.
12505         * object.h (is_elf_object): Declare.
12506         * archive.cc (Archive::get_elf_object_for_member): Call
12507         is_elf_object.
12508         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12509
12510 2009-03-24  Elliott Hughes  <enh@google.com>
12511
12512         * output.cc (Output_file::map_anonymous): Define.
12513         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12514         try an anonymous one.  Report the size if the mmap fails.
12515         * output.h (class Output_file): Declare map_anonymous.
12516
12517 2009-03-24  Ian Lance Taylor  <iant@google.com>
12518
12519         * target-select.cc (instantiate_target): Don't acquire the lock if
12520         the instantiated_target_ field has already been set.
12521
12522 2009-03-23  Ian Lance Taylor  <iant@google.com>
12523
12524         * gold-threads.h (class Initialize_lock): Define.
12525         * gold-threads.cc (class Initialize_lock_once): Define.
12526         (initialize_lock_control): New static variable.
12527         (initialize_lock_pointer): New static variable.
12528         (initialize_lock_once): New static function.
12529         (Initialize_lock::Initialize_lock): Define.
12530         (Initialize_lock::initialize): Define.
12531         * target-select.h: Include "gold-threads.h".
12532         (class Target_selector): Add lock_ and initialize_lock_ fields.
12533         Don't define instantiate_target, just declare it.
12534         * target-select.cc (Target_selector::Target_selector): Initialize
12535         new fields.
12536         (Target_selector::instantiate_target): Define.
12537         * descriptors.h: Include "gold-threads.h".
12538         (class Descriptors): Add initialize_lock_ field.
12539         * descriptors.cc (Descriptors::Descriptors): Initialize new
12540         field.
12541         (Descriptors::open): Use initialize_lock_ field
12542         * errors.h (class Errors): Add initialize_lock_ field.
12543         * errors.cc (Errors::Errors): Initialize new field.
12544         (Errors::initialize_lock): Use initialize_lock_ field.
12545         * powerpc.cc (class Target_selector_powerpc): Remove
12546         instantiated_target_ field.  In do_recognize call
12547         instantiate_target rather than do_instantiate_target.  In
12548         do_instantiate_target just allocate a new target.
12549         * sparc.cc (class Target_selector_sparc): Likewise.
12550
12551         * freebsd.h: New file.
12552         * i386.cc: Include "freebsd.h".
12553         (Target_i386): Derive from Target_freebsd rather than
12554         Sized_target.
12555         (Target_selector_i386): Derive from Target_selector_freebsd rather
12556         than Target_selector.
12557         * x86_64.cc: Include "freebsd.h".
12558         (Target_x86_64): Derive from Target_freebsd rather than
12559         Sized_target.
12560         (Target_selector_x86_64): Derive from Target_selector_freebsd
12561         rather than Target_selector.
12562         * target.h (class Target): Add adjust_elf_header and
12563         do_adjust_elf_header.
12564         * output.cc (Output_file_header:: do_sized_write): Call target
12565         adjust_elf_header routine.
12566         * configure.tgt: Set targ_osabi.
12567         * configure.ac: Define GOLD_DEFAULT_OSABI.
12568         * parameters.cc (Parameters::default_target): Pass
12569         GOLD_DEFAULT_OSABI to select_target.
12570         * target-select.h (class Target_selector): Make instantiate_target
12571         protected rather than private.
12572         * Makefile.am (HFILES): Add freebsd.h.
12573         * configure, Makefile.in, config.in: Rebuild.
12574
12575         * merge.cc (do_add_input_section): Correct pend value.  Change
12576         message about last entry not being null terminated from error to
12577         warning.
12578
12579 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12580
12581         * incremental.cc: New file.
12582         * Makefile.am (CCFILES): Add incremental.cc.
12583         * Makefile.in: Rebuild.
12584
12585 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12586
12587         * layout.cc (Layout::output_section_name): Preserve names
12588         of '.note.' sections.
12589
12590 2009-03-19  Ian Lance Taylor  <iant@google.com>
12591
12592         * descriptors.cc (Descriptors::open): Check that the options are
12593         valid before using them.
12594
12595 2009-03-18  Ian Lance Taylor  <iant@google.com>
12596
12597         * script-sections.h: Include <list>.
12598         (class Script_sections): Change Sections_elements from std::vector
12599         to std::list.  Typedef public Elements_iterator.  Add
12600         orphan_section_placement_, data_segment_align_start_, and
12601         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12602         field.
12603         * script-sections.cc (class Orphan_section_placement): New class.
12604         (class Sections_element): Add virtual functions is_relro and
12605         orphan_section_init.  Remove virtual function place_orphan_here.
12606         (class Output_section_definition): Add is_relro and
12607         orphan_section_init.  Remove place_orphan_here.
12608         (class Orphan_output_section): Likewise.
12609         (Script_sections::Script_sections): Update for field changes.
12610         (Script_sections::data_segment_align): Set saw_data_segment_align_
12611         and data_segment_align_start_, not data_segment_align_index.
12612         (Script_sections::data_segment_relro_end): Check
12613         saw_data_segment_align_.  Use data_segment_align_start_ rather
12614         than data_segment_align_index_.
12615         (Script_sections::place_orphan): Rewrite to use
12616         Orphan_section_placement.
12617
12618 2009-03-17  Ian Lance Taylor  <iant@google.com>
12619
12620         * archive.cc (Archive::add_symbols): Check for a version attached
12621         to the symbol name in the archive map.
12622         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12623         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12624         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12625         (ver_test_11.a): New target.
12626         * testsuite/Makefile.in: Rebuild.
12627
12628         * configure.ac: Check for chsize and posix_fallocate.  Replace
12629         ftruncate.
12630         * ftruncate.c: New file, from gnulib.
12631         * output.cc (posix_fallocate): Define dummy version if not
12632         HAVE_POSIX_FALLOCATE.
12633         (Output_file::map): Call posix_fallocate rather than lseek and
12634         write.
12635         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12636         * configure, Makefile.in, config.in: Rebuild.
12637
12638 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12639
12640         * layout.h (Layout::create_note): Add section_name parameter.
12641         * layout.cc (Layout::create_note): Likewise.
12642         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12643
12644 2009-03-17  Ian Lance Taylor  <iant@google.com>
12645
12646         * descriptors.cc: Include "options.h".
12647         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12648         (Descriptors::open): Always use O_CLOEXEC when opening a new
12649         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12650         then set FD_CLOEXEC.
12651
12652         * sparc.cc (class Target_sparc): Add has_got_section.
12653         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12654         make sure we have a GOT section.
12655
12656         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12657         (Target_sparc::Scan::local): Likewise.
12658         (Target_sparc::Scan::global): Likewise.
12659         (Target_sparc::Relocate::relocate): Likewise.
12660         (Target_sparc::Relocate::relocate_tls): Likewise.
12661
12662         * symtab.cc (Symbol_table::define_default_version): New function,
12663         broken out of add_from_object.
12664         (Symbol_table::add_from_object): Call define_default_version.
12665         (Symbol_table::define_special_symbol): Add resolve_oldsym
12666         parameter.  Change all callers.  If the version for a symbol comes
12667         from a version script, resolve it with the symbol with the same
12668         name with no version.  Also add the symbol without a version if
12669         appropriate.
12670         (do_define_in_output_data): If resolving with oldsym, don't delete
12671         sym.
12672         (do_define_in_output_segment): Likewise.
12673         (do_define_as_constant): Likewise.
12674         * symtab.h (class Symbol_table): Update declarations.
12675
12676 2009-03-13  Ian Lance Taylor  <iant@google.com>
12677
12678         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12679         (Read_symbols::requeue): New function.
12680         (Read_symbols::do_read_symbols): If make_elf_object fails because
12681         the target type is not configured, and the file was searched for,
12682         issue a warning and retry with the next directory.
12683         (Add_symbols::run): If the file has an incompatible format, and
12684         it was searched for, requeue the Read_symbols task.  On error,
12685         release the object.
12686         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12687         dirindex parameter to constructor.  Change all callers.  Declare
12688         incompatible_warning and requeue.
12689         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12690         input_argument_ and input_group_ fields.  Add them to
12691         constructor.  Change all callers.
12692         (class Read_script): Add dirindex_ field.  Add it to constructor.
12693         Change all callers.
12694         * archive.cc (Archive::setup): Remove input_objects parameter.
12695         Change all callers.
12696         (Archive::get_file_and_offset): Likewise.
12697         (Archive::read_all_symbols): Likewise.
12698         (Archive::read_symbols): Likewise.
12699         (Archive::get_elf_object_for_member): Remove input_objects
12700         parameter.  Add punconfigured parameter.  Change all callers.
12701         (Archive::add_symbols): Change return type to bool.  Check return
12702         value of include_member.
12703         (Archive::include_all_members): Likewise.
12704         (Archive::include_member): Change return type to bool.  Return
12705         false if first included object has incompatible target.  Set
12706         included_member_ field.
12707         (Add_archive_symbols::run): If add_symbols returns false, requeue
12708         Read_symbols task.
12709         * archive.h (class Archive): Add included_member_ field.
12710         Initialize it in constructor.  Add input_file and searched_for
12711         methods.  Update declarations.
12712         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12713         input_argument_ fields.  Add them to constructor.  Change all
12714         callers.
12715         * script.cc: Include "target-select.h".
12716         (class Parser_closure): Add skip_on_incompatible_target_ and
12717         found_incompatible_target_ fields.  Add
12718         skip_on_incompatible_target parameter to constructor.  Change all
12719         callers.  Add methods skip_on_incompatible_target,
12720         clear_skip_on_incompatible_target, found_incompatible_target, and
12721         set_found_incompatible_target.
12722         (read_input_script): Add dirindex parameter.  Change all callers.
12723         If parser finds an incompatible target, requeue Read_symbols
12724         task.
12725         (script_set_symbol): Clear skip_on_incompatible_target in
12726         closure.
12727         (script_add_assertion, script_parse_option): Likewise.
12728         (script_start_sections, script_add_phdr): Likewise.
12729         (script_check_output_format): New function.
12730         * script.h (read_input_script): Update declaration.
12731         * script-c.h (script_check_output_format): Declare.
12732         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12733         (ignore_cmd): Remove OUTPUT_FORMAT.
12734         * fileread.cc (Input_file::Input_file): Add explicit this.
12735         (Input_file::will_search_for): New function.
12736         (Input_file::open): Add pindex parameter.  Change all callers.
12737         * fileread.h (class Input_file): Add input_file_argument method.
12738         Declare will_search_for.  Update declarations.
12739         * object.cc (make_elf_object): Add punconfigured parameter.
12740         Change all callers.
12741         * object.h (class Object): Make input_file public.  Add
12742         searched_for method.
12743         (make_elf_object): Update declaration.
12744         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12745         restart search.
12746         * dirsearch.h (class Dirsearch): Update declaration.
12747         * options.h (class General_options): Add --warn-search-mismatch.
12748         * parameters.cc (Parameters::is_compatible_target): New function.
12749         * parameters.h (class Parameters): Declare is_compatible_target.
12750         * workqueue.cc (Workqueue::add_blocker): New function.
12751         * workqueue.h (class Workqueue): Declare add_blocker.
12752
12753         * fileread.cc (Input_file::open): Remove options parameter.
12754         Change all callers.
12755         (Input_file::open_binary): Likewise.
12756         * script.cc (read_input_script): Likewise.
12757         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12758         options parameter from constructor.  Change all callers.
12759         (class Read_script): Likewise.
12760         * fileread.h (class Input_file): Update declarations.
12761         * script.h (read_input_script): Update declaration.
12762
12763 2009-03-10  Nick Clifton  <nickc@redhat.com>
12764
12765         * po/es.po: New Spanish translation.
12766
12767 2009-03-06  Cary Coutant  <ccoutant@google.com>
12768
12769         * options.cc (parse_short_option): Keep dash_z from registering itself.
12770
12771 2009-03-03  Ian Lance Taylor  <iant@google.com>
12772
12773         PR 9918
12774         * target-reloc.h (relocate_section): Pass output_section to
12775         relocate.
12776         * i386.cc (Target_i386::should_apply_static_reloc): Add
12777         output_section parameter.  Change all callers.
12778         (Target_i386::Relocate::relocate): Add output_section parameter.
12779         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12780         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12781         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12782         * testsuite/two_file_shared.sh: New script.
12783         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12784         (check_DATA): Add two_file_shared.dbg.
12785         (two_file_shared.dbg): New target.
12786         * testsuite/Makefile.in: Rebuild.
12787
12788 2009-03-01  Ian Lance Taylor  <iant@google.com>
12789
12790         * configure.ac: Check for byteswap.h.
12791         * configure: Rebuild.
12792         * config.in: Rebuild.
12793
12794 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12795
12796         * layout.cc (Layout::find_or_add_kept_section): New function.
12797         (Layout::add_comdat): Removed.
12798         * layout.h (struct Kept_section): Move out of class Layout.
12799         Remove trailing underscores from field names.  Add group_sections
12800         field.  Rename group_ field to is_group.  Change all uses.
12801         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12802         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12803         comdat_groups_ field.
12804         (Sized_relobj::include_section_group): Use
12805         find_or_add_kept_section and Kept_section::group_sections.
12806         (Sized_relobj::include_linkonce_section): Likewise.
12807         * object.cc (class Sized_relobj): Don't define Comdat_group or
12808         Comdat_group_table.  Remove find_comdat_group and
12809         add_comdat_group.  Remove comdat_groups_ field.
12810         * plugin.cc (include_comdat_group): Use
12811         Layout::find_or_add_kept_section.
12812
12813 2009-02-28  Ian Lance Taylor  <iant@google.com>
12814
12815         * README: --gc-sections and map files are now supported.  Document
12816         some build requirements.
12817
12818         PR 6992
12819         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12820         relocatable link set the value of the section symbol to zero.
12821         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12822         relocatable link don't include the section address in the local
12823         symbol value.
12824
12825 2009-02-27  Ian Lance Taylor  <iant@google.com>
12826
12827         PR 6811
12828         * options.h (class Search_directory): Add is_system_directory.
12829         (class General_options): Declare is_in_system_directory.
12830         * options.cc (get_relative_sysroot): Make static.
12831         (get_default_sysroot): Make static.
12832         (General_optoins::is_in_system_directory): New function.
12833         * fileread.cc (Input_file::is_in_system_directory): New function.
12834         * fileread.h (class Input_file): Declare is_in_system_directory.
12835         * object.h (class Object): Add is_in_system_directory.
12836         (class Input_objects): Remove system_library_directory_ field.
12837         * object.cc (Input_objects::add_object): Don't set
12838         system_library_directory_.
12839         (input_objects::found_in_system_library_directory): Remove.
12840         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12841         parameter.  Change all callers.
12842         (Symbol_table::sized_write_globals): Likewise.
12843         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12844         Call Object::is_in_system_directory.
12845         * symtab.h (class Symbol_table): Update declarations.
12846
12847         PR 5990
12848         * descriptors.h (Open_descriptor): Add is_on_stack field.
12849         * descriptors.cc (Descriptors::open): If the descriptor is on the
12850         top of the stack, remove it.  Initialize is_on_stack field.
12851         (Descriptors::release): Only add pod to stack if it is not on the
12852         stack already.
12853         (Descriptors::close_some_descriptor): Clear stack_next and
12854         is_on_stack fields.
12855
12856         PR 7091
12857         * output.cc (Output_section::find_starting_output_address): Rename
12858         from starting_output_address; add PADDR parameter; change return
12859         type.
12860         * output.h (class Output_section): Declare
12861         find_starting_output_address instead of starting_output_address.
12862         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12863         section symbol for which we can't find a merge section.
12864
12865         PR 9836
12866         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12867         hidden or internal, force the symbol to be local.
12868         * resolve.cc (Symbol::override_visibility): Define.
12869         (Symbol::override_base): Use override_visibility.
12870         (Symbol_table::resolve): Likewise.
12871         (Symbol::override_base_with_special): Likewise.
12872         (Symbol_table::override_with_special): If the visibility is hidden
12873         or internal, force the symbol to be local.
12874         * symtab.h (class Symbol): Add set_visibility and
12875         override_visibility.
12876         * testsuite/ver_test_1.sh: New file.
12877         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12878         (check_DATA): Add ver_test_1.syms.
12879         (ver_test_1.syms): New target.
12880         * testsuite/Makefile.in: Rebuild.
12881
12882 2009-02-25  Cary Coutant  <ccoutant@google.com>
12883
12884         * layout.cc (Layout::choose_output_section): Don't rename sections
12885         when using a linker script that has a SECTIONS clause.
12886         * Makefile.in: Regenerate.
12887
12888         * testsuite/Makefile.am (script_test_5.sh): New test case.
12889         * testsuite/Makefile.in: Regenerate.
12890         * testsuite/script_test_5.cc: New file.
12891         * testsuite/script_test_5.sh: New file.
12892         * testsuite/script_test_5.t: New file.
12893
12894 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12895
12896         * archive.cc (Archive::include_member): Update calls to add_symbols.
12897         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12898         the Layout argument.
12899         * dynobj.h (do_add_symbols): Add the Layout argument.
12900         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12901         Layout argument.
12902         * object.h (Object::add_symbols): Add the Layout argument.
12903         (Object::do_add_symbols): Add the Layout argument.
12904         (Sized_relobj::do_add_symbols): Add the Layout argument.
12905         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12906         Unify the two versions.
12907         (Add_plugin_symbols): Remove.
12908         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12909         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12910         (Add_plugin_symbols): Remove.
12911         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12912         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12913         (Add_symbols::run): Make it work with Pulginobj.
12914
12915 2009-02-06  Ian Lance Taylor  <iant@google.com>
12916
12917         * object.cc (Sized_relobj::do_layout): Make info message start
12918         with lower case letter.
12919
12920 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12921
12922         * binary.cc: Fix file comment.
12923
12924         * options.h (enum Incremental_disposition): Define.
12925         (class General_options): Add new options: --incremental,
12926         --incremental_changed, --incremental_unchanged,
12927         --incremental_unknown.  Add incremental_disposition_ and
12928         implicit_incremental_ fields.
12929         (General_options::incremental_disposition): New function.
12930         (class Position_dependent_options): Add incremental_disposition
12931         option.
12932         (Position_dependent_options::copy_from_options): Set incremental
12933         dispositions.
12934         * options.cc (General_options::parse_incremental_changed): New
12935         function.
12936         (General_options::parse_incremental_unchanged): New function.
12937         (General_options::parse_incremental_unknown): New function.
12938         (General_options::General_options): Initialize new fields
12939         incremental_disposition_ and implicit_incremental_.
12940         (General_options::finalize): Check for uasge of --incremental-*
12941         without --incremental.
12942
12943 2009-02-06  Chris Demetriou  <cgd@google.com>
12944
12945         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12946         pointer and to report location as the file name associated with
12947         the symbol.
12948         (gold_undefined_symbol_at_location): New function to replace the
12949         old gold_undefined_symbol functionality.
12950         * target-reloc.h (relocate_section): Update to use
12951         gold_undefined_symbol_at_location.
12952         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12953         Call gold_undefined_symbol function rather than gold_error.
12954         * errors.h (Errors::undefined_symbol): Take location as a
12955         string, rather than calculating it from a relocation.
12956         * errors.cc (Errors::fatal): Print "fatal error:" before the
12957         formatted message.
12958         (Errors::error, Errors::error_at_location): Print "error: "
12959         before the formatted message.
12960         (Errors::undefined_symbol): Take location as a string, rather
12961         than calculating it from a relocation.
12962         (gold_undefined_symbol_at_location): New function akin to
12963         old gold_undefined_symbol, calculates location from relocation.
12964         (gold_undefined_symbol): Change to take only a Symbol pointer
12965         and to report location as the file name associated with the symbol.
12966         * testsuite/debug_msg.sh: Update for changed error messages.
12967         * testsuite/undef_symbol.sh: Likewise.
12968
12969 2009-02-04  Duncan Sands  <baldrick@free.fr>
12970
12971         PR 9812
12972         * reduced_debug_output.h
12973         (Output_reduced_debug_abbrev_section::failed): Use format for
12974         gold_warning.
12975         (Output_reduced_debug_info_section::faild): Likewise.
12976
12977 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12978
12979         * script.cc (Lazy_demangler): New class.
12980         (Version_script_info::get_symbol_version_helper): Demangle a
12981         symbol only once.
12982
12983 2009-01-29  Cary Coutant  <ccoutant@google.com>
12984
12985         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12986         to __tls_get_addr.
12987         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12988
12989 2009-01-28  Ian Lance Taylor  <iant@google.com>
12990
12991         * version.cc (version_string): Bump to 1.9.
12992
12993         * gold.h: Include <cstring> and <stdint.h>.
12994         * version.cc: Include <cstdio>.
12995         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12996         warning.
12997         * reduced_debug_output.cc (insert_into_vector): Rename from
12998         Insert_into_vector; change all callers.  Use Swap_unaligned to
12999         avoid aliasing issue; remove union since it is unnecessary.
13000
13001 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13002
13003         * Makefile.am (CCFILES): Add gc.cc.
13004         (HFILES): Add gc.h.
13005         * Makefile.in: Regenerate.
13006         * gold.cc (Gc_runner): New class.
13007         (queue_initial_tasks): Call garbage collection related tasks
13008         when corresponding options are invoked.
13009         (queue_middle_gc_tasks): New function.
13010         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13011         processed early before laying out sections during garbage collection.
13012         * gold.h (queue_middle_gc_tasks): New function.
13013         (is_prefix_of): Move from "layout.cc".
13014         * i386.cc (Target_i386::gc_process_relocs): New function.
13015         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13016         * main.cc (main): Create object of class "Garbage_collection".
13017         * object.cc (Relobj::copy_symbols_data): New function.
13018         (Relobj::is_section_name_included): New function.
13019         (Sized_relobj::do_layout): Allow this function to be called twice
13020         during garbage collection and defer layout of section during the
13021         first call.
13022         * object.h (Relobj::get_symbols_data): New function.
13023         (Relobj::is_section_name_included): New function.
13024         (Relobj::copy_symbols_data): New function.
13025         (Relobj::set_symbols_data): New function.
13026         (Relobj::get_relocs_data): New function.
13027         (Relobj::set_relocs_data): New function.
13028         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13029         (Relobj::gc_process_relocs): New function.
13030         (Relobj::do_gc_process_relocs): New pure virtual function.
13031         (Relobj::sd_): New data member.
13032         (Sized_relobj::is_output_section_offset_invalid): New function.
13033         (Sized_relobj::do_gc_process_relocs): New function.
13034         * options.h (General_options::gc_sections): Modify to not be a no-op.
13035         (General_options::print_gc_sections): New option.
13036         * plugin.cc (Plugin_finish::run): Remove function call to
13037         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13038         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13039         * reloc.cc (Read_relocs::run): Add task to process relocs and
13040         determine unreferenced sections when doing garbage collection.
13041         (Gc_process_relocs): New class.
13042         (Sized_relobj::do_gc_process_relocs): New function.
13043         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13044         sections that are garbage collected.
13045         * reloc.h (Gc_process_relocs): New class.
13046         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13047         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13048         symbols whose corresponding sections are garbage collected.
13049         (Symbol_table::Symbol_table): Add new parameter for the garbage
13050         collection object.
13051         (Symbol_table::gc_mark_undef_symbols): New function.
13052         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13053         (Symbol_table::gc_mark_dyn_syms): New function.
13054         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13055         as garbage.
13056         (Symbol_table::add_from_object): Likewise.
13057         (Symbol_table::add_from_relobj): When building shared objects, do not
13058         treat externally visible symbols as garbage.
13059         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13060         table information for static and relocatable links.
13061         * symtab.h (Symbol_table::set_gc): New function.
13062         (Symbol_table::gc): New function.
13063         (Symbol_table::gc_mark_undef_symbols): New function.
13064         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13065         (Symbol_table::gc_mark_dyn_syms): New function.
13066         (Symbol_table::gc_): New data member.
13067         * target.h (Sized_target::gc_process_relocs): New pure virtual
13068         function.
13069         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13070         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13071
13072 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13073
13074         * options.h (General_options::gc_sections): Define as a no-op for now.
13075         (General_options::no_keep_memory): Ditto.
13076         (General_options::Bshareable): Define.
13077         * options.cc (General_options::finalize): Honor -Bshareable.
13078
13079 2009-01-20  Andreas Schwab  <schwab@suse.de>
13080
13081         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13082         read the value in the contents, since we don't use it.  Use the
13083         template endianness when writing.
13084         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13085
13086 2009-01-19  Andreas Schwab  <schwab@suse.de>
13087
13088         * configure.tgt (powerpc64-*): Fix targ_obj.
13089
13090 2009-01-15  Ian Lance Taylor  <iant@google.com>
13091
13092         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13093         local symbols when stripping all symbols.
13094
13095 2009-01-14  Cary Coutant  <ccoutant@google.com>
13096
13097         * output.cc (Output_reloc): Add explicit instantiations.
13098
13099 2009-01-14  Cary Coutant  <ccoutant@google.com>
13100
13101         * archive.cc (Archive::get_elf_object_for_member): Remove call
13102         to File_read::claim_for_plugin.
13103         * descriptors.cc (Descriptors::open): Remove reference to
13104         is_claimed.
13105         (Descriptors::claim_for_plugin): Remove.
13106         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13107         (Descriptors::is_claimed): Remove.
13108         (claim_descriptor_for_plugin): Remove.
13109         * fileread.cc (File_read::claim_for_plugin): Remove.
13110         * fileread.h (File_read::claim_for_plugin): Remove.
13111         (File_read::descriptor): Reopen descriptor if necessary.
13112         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13113         (Plugin_manager::all_symbols_read): Add task parameter. Change
13114         all callers.
13115         (Plugin_manager::get_input_file): New function.
13116         (Plugin_manager::release_input_file): New function.
13117         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13118         corresponding data member.
13119         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13120         and pass to base constructor. Change all callers.
13121         (get_input_file, release_input_file): New functions.
13122         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13123         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13124         (Plugin_manager::all_symbols_read): Add task parameter.
13125         (Plugin_manager::get_input_file): New function.
13126         (Plugin_manager::release_input_file): New function.
13127         (Plugin_manager::task_): New data member.
13128         (Pluginobj::Pluginobj): Add filesize parameter.
13129         (Pluginobj::filename): New function.
13130         (Pluginobj::descriptor): New function.
13131         (Pluginobj::filesize): New function.
13132         (Pluginobj::filesize_): New data member.
13133         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13134         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13135         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13136
13137         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13138         with archive libraries.
13139         * testsuite/Makefile.in: Regenerate.
13140         * testsuite/plugin_test.c (struct sym_info): New type.
13141         (get_input_file, release_input_file): New static variables.
13142         (onload): Capture new transfer vector entries.
13143         (claim_file_hook): Stop reading at end of file according to filesize.
13144         Factor out parsing of readelf output into separate function.
13145         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13146         APIs and get the source file name from the symbol table.  Convert
13147         source file name to corresponding object file name.  Print info
13148         message when adding new input files.
13149         (parse_readelf_line): New function.
13150         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13151         * testsuite/plugin_test_2.sh: Likewise.
13152         * testsuite/plugin_test_3.sh: Likewise.
13153         * testsuite/plugin_test_4.sh: New test case.
13154
13155 2009-01-07  Ian Lance Taylor  <iant@google.com>
13156
13157         * version.cc (version_string): Bump to 1.8.
13158
13159 2008-12-23  Cary Coutant  <ccoutant@google.com>
13160
13161         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13162         * plugin.cc (Plugin_manager::finish): Rename as
13163         layout_deferred_objects.  Move cleanup to separate function.
13164         (Plugin_manager::cleanup): New function.
13165         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13166         separately.
13167         * plugin.h (Plugin_manager::finish): Rename as
13168         layout_deferred_objects.
13169         (Plugin_manager::cleanup): New function.
13170         (Plugin_manager::cleanup_done): New field.
13171
13172 2008-12-23  Cary Coutant  <ccoutant@google.com>
13173
13174         * plugin.cc (is_visible_from_outside): New function.
13175         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13176         so we don't return "IR only" status for exported symbols or -r links.
13177
13178         * testsuite/Makefile.am (plugin_test_3): New test case.
13179         * testsuite/Makefile.in: Regenerate.
13180         * testsuite/plugin_test_3.sh: New file.
13181
13182 2008-12-22  Cary Coutant  <ccoutant@google.com>
13183
13184         * object.cc (Sized_relobj::layout_section): New function.
13185         (Sized_relobj::do_layout): Defer layout of input sections until after
13186         plugin has provided replacement files.
13187         (Sized_relobj::do_layout_deferred_sections): New function.
13188         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13189         (Relobj::layout_deferred_sections): New function.
13190         (Relobj::do_layout_deferred_sections): New function.
13191         (Sized_relobj::do_layout_deferred_sections): New function.
13192         (Sized_relobj::layout_section): New function.
13193         (Sized_relobj::Deferred_layout): New structure.
13194         (Sized_relobj::deferred_layout_): New field.
13195         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13196         Change all callers.  Layout deferred sections.
13197         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13198         references.
13199         (Plugin_hook::run): Move code from do_plugin_hook inline.
13200         (Plugin_hook::do_plugin_hook): Remove.
13201         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13202         (Plugin_manager::finish): Renamed, was cleanup.
13203         (Plugin_manager::should_defer_layout): New function.
13204         (Plugin_manager::add_deferred_layout_object): New function.
13205         (Plugin_manager::Deferred_layout_list): New type.
13206         (Plugin_manager::deferred_layout_objects_): New field.
13207         (Plugin_hook::do_plugin_hook): Remove.
13208
13209 2008-12-17  Ian Lance Taylor  <iant@google.com>
13210
13211         * options.h (class General_options): Add --no case for
13212         --export-dynamic.
13213
13214 2008-12-16  Cary Coutant  <ccoutant@google.com>
13215
13216         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13217         vector.
13218         (Plugin_manager::claim_file): Create plugin object even if
13219         plugin did not call the add_symbols callback.
13220         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13221         asking for more symbols than were added.
13222         * testsuite/Makefile.am (plugin_test_1): Add test case with
13223         no global symbols.
13224         (empty.syms): New target.
13225         * testsuite/Makefile.in: Regenerate.
13226         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13227         message. Don't call add_symbols if no globals.
13228         (all_symbols_read_hook): Don't provide replacement for empty
13229         claimed file.
13230
13231 2008-12-12  Ian Lance Taylor  <iant@google.com>
13232
13233         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13234         r_type == 0 for a local symbol with r_sym == 0.
13235         (scan_relocatable_relocs): Pass r_sym to
13236         local_non_section_strategy.
13237         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13238         r_sym parameter.
13239
13240         * configure.ac: Update test for TLS descriptors: they are
13241         supported as of glibc 2.9.
13242         * configure: Rebuild.
13243
13244 2008-12-11  Ian Lance Taylor  <iant@google.com>
13245
13246         PR 7091
13247         * target-reloc.h (Default_scan_relocatable_relocs): For each
13248         function, map r_type == 0 to RELOC_DISCARD.
13249
13250 2008-12-10  Cary Coutant  <ccoutant@google.com>
13251
13252         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13253         object to override a kept COMDAT group from a plugin object.
13254
13255 2008-12-09  Ian Lance Taylor  <iant@google.com>
13256
13257         PR 7088
13258         * yyscript.y (file_cmd): Handle INPUT.
13259
13260         * testsuite/initpri1.c: Change all declarations to be full
13261         prototypes by adding void, to avoid compiler warnings.
13262
13263 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13264
13265         * options.cc (General_options::parse_plugin_opt): New.
13266         (General_options::add_plugin): The argument now is just the filename.
13267         (General_options::add_plugin_option): New.
13268         * options.h (plugin_opt): New.
13269         (add_plugin): Change argument name.
13270         (add_plugin_option): New.
13271         * plugin.cc (Plugin::load): Don't parse the plugin option.
13272         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13273         (Plugin::add_option): New.
13274         (Plugin::args_): Change type.
13275         (Plugin::filename_): New.
13276         (Plugin_manager::add_plugin_option): New.
13277         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13278         * testsuite/Makefile.in: Regenerate.
13279
13280 2008-12-05  Cary Coutant  <ccoutant@google.com>
13281
13282         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13283         Handle --strip-lto-sections option.
13284         * options.h (strip_lto_sections): New option.
13285
13286 2008-12-01  Cary Coutant  <ccoutant@google.com>
13287
13288         * plugin.cc (ld_plugin_message): Change format parameter to const.
13289         Fix mismatch between new[] and delete.
13290
13291 2008-11-14  Cary Coutant  <ccoutant@google.com>
13292
13293         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13294         instead of -1U.
13295
13296 2008-11-05  Craig Silverstein  <csilvers@google.com>
13297
13298         * options.cc (General_options::parse_dynamic_list): New function.
13299         * options.h (General_options): New flags dynamic_list,
13300         dynamic_list_data, dynamic_list_cpp_new, and
13301         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13302         (General_options::in_dynamic_list): New function.
13303         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13304         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13305         (Lex::can_continue_name): Likewise.
13306         (yylex): Likewise.
13307         (read_script_file): New parameter script_options.
13308         (read_dynamic_list): New function.
13309         (Script_options::define_dynamic_list): New function.
13310         (dynamic_list_keyword_parsecodes): New variable.
13311         (dynamic_list_keywords): New variable.
13312         * script.h (Script_options::define_dynamic_list): New function
13313         prototype.
13314         (read_dynamic_list): New function prototype.
13315         * symtab.cc (strprefix): New macro.
13316         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13317         dynamic_list_data, dynamic_list_cpp_new, and
13318         dynamic_list_cpp_typeinfo.
13319         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13320         (dynamic_list_expr): New rule.
13321         (dynamic_list_nodes): Likewise.
13322         (dynamic_list_node): Likewise.
13323         * testsuite/Makefile.am (dynamic_list): New test.
13324         * testsuite/Makefile.in: Regenerated.
13325         * testsuite/dynamic_list.t: New file.
13326         * testsuite/dynamic_list.sh: New file.
13327
13328 2008-11-05  Craig Silverstein  <csilvers@google.com>
13329
13330         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13331         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13332         (t11_last): Likewise.
13333         * testsuite/ver_test_6.c (main): Likewise.
13334
13335 2008-10-07  Cary Coutant  <ccoutant@google.com>
13336
13337         * options.c (General_options::finalize): Add check for -static and
13338         -shared.
13339         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13340         is not empty.
13341
13342 2008-10-02  Cary Coutant  <ccoutant@google.com>
13343
13344         * plugin.cc (make_sized_plugin_object): Fix conditional
13345         compilation to work when not all targets are enabled.
13346
13347 2008-09-29  Cary Coutant  <ccoutant@google.com>
13348
13349         * archive.cc (Archive::get_file_and_offset): Use filename instead
13350         of name to get library path.
13351         (Archive::include_member): Unlock external member of a thin archive.
13352
13353         * testsuite/Makefile.am (TEST_AR): New variable.
13354         (thin_archive_test_1): New test.
13355         (thin_archive_test_2): New test.
13356         * testsuite/Makefile.in: Regenerate.
13357         * testsuite/thin_archive_main.cc: New file.
13358         * testsuite/thin_archive_test_1.cc: New file.
13359         * testsuite/thin_archive_test_2.cc: New file.
13360         * testsuite/thin_archive_test_3.cc: New file.
13361         * testsuite/thin_archive_test_4.cc: New file.
13362
13363 2008-09-29  Cary Coutant  <ccoutant@google.com>
13364
13365         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13366         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13367         instead of -1U.
13368         (Sized_relobj::do_finalize_local_symbols): Likewise.
13369         (Sized_relobj::map_to_kept_section): Likewise.
13370         * object.h (Sized_relobj::invalid_address): New constant.
13371         (Sized_relobj::do_output_section_offset): Check for invalid_address
13372         and return -1ULL.
13373         * output.cc (Output_reloc::local_section_offset): Use constant
13374         invalid_address instead of -1U.
13375         (Output_reloc::get_address): Likewise.
13376         (Output_section::output_address): Change -1U to -1ULL.
13377         * output.h (Output_reloc::invalid_address): New constant.
13378         * reloc.cc (Sized_relobj::write_sections): Use constant
13379         invalid_address instead of -1U.
13380         (Sized_relobj::relocate_sections): Likewise.
13381         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13382         values for merge sections.
13383         * target-reloc.h (relocate_for_relocatable): Use constant
13384         invalid_address instead of -1U.
13385
13386 2008-09-19  Cary Coutant  <ccoutant@google.com>
13387
13388         Add plugin functionality for link-time optimization (LTO).
13389         * configure.ac (plugins): Add --enable-plugins option.
13390         * configure: Regenerate.
13391         * config.in: Regenerate.
13392         * Makefile.am (LIBDL): New variable.
13393         (CCFILES): Add plugin.cc.
13394         (HFILES): Add plugin.h.
13395         (ldadd_var): Add LIBDL.
13396         * Makefile.in: Regenerate.
13397
13398         * archive.cc: Include "plugin.h".
13399         (Archive::setup): Don't preread archive symbols when using a plugin.
13400         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13401         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13402         files.
13403         (Archive::include_member): Add symbols from plugin objects.
13404         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13405         * descriptors.cc (Descriptors::open): Check for file descriptors
13406         abandoned by plugins.
13407         (Descriptors::claim_for_plugin): New function.
13408         * descriptors.h (Descriptors::claim_for_plugin): New function.
13409         (Open_descriptor::is_claimed): New field.
13410         (claim_descriptor_for_plugin): New function.
13411         * fileread.cc (File_read::claim_for_plugin): New function.
13412         * fileread.h (File_read::claim_for_plugin): New function.
13413         (File_read::descriptor): New function.
13414         * gold.cc: Include "plugin.h".
13415         (queue_initial_tasks): Add task to call plugin hooks for generating
13416         new object files.
13417         * main.cc: Include "plugin.h".
13418         (main): Load plugin libraries.
13419         * object.h (Pluginobj): Declare.
13420         (Object::pluginobj): New function.
13421         (Object::do_pluginobj): New function.
13422         (Object::set_target): New function.
13423         * options.cc: Include "plugin.h".
13424         (General_options::parse_plugin): New function.
13425         (General_options::General_options): Initialize plugins_ field.
13426         (General_options::add_plugin): New function.
13427         * options.h (Plugin_manager): Declare.
13428         (General_options): Add --plugin option.
13429         (General_options::has_plugins): New function.
13430         (General_options::plugins): New function.
13431         (General_options::add_plugin): New function.
13432         (General_options::plugins_): New field.
13433         * plugin.cc: New file.
13434         * plugin.h: New file.
13435         * readsyms.cc: Include "plugin.h".
13436         (Read_symbols::do_read_symbols): Check for archive before checking
13437         for ELF file.  Call plugin hooks to claim files.
13438         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13439         from a real object file; force override when processing replacement
13440         files.
13441         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13442         (Symbol::init_base_object): Likewise.
13443         (Symbol::init_base_output_data): Likewise.
13444         (Symbol::init_base_output_segment): Likewise.
13445         (Symbol::init_base_constant): Likewise.
13446         (Symbol::init_base_undefined): Likewise.
13447         (Symbol::output_section): Assert that object is not a plugin.
13448         (Symbol_table::add_from_pluginobj): New function.
13449         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13450         undefined.
13451         (Symbol_table::sized_write_globals): Likewise.
13452         (Symbol_table::add_from_pluginobj): Instantiate template.
13453         * symtab.h (Sized_pluginobj): Declare.
13454         (Symbol::in_real_elf): New function.
13455         (Symbol::set_in_real_elf): New function.
13456         (Symbol::in_real_elf_): New field.
13457         (Symbol_table::add_from_pluginobj): New function.
13458
13459         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13460         (LIBDL): New variable.
13461         (LDADD): Add LIBDL.
13462         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13463         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13464         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13465         (MOSTLYCLEANFILES): Likewise.
13466         * testsuite/Makefile.in: Regenerate.
13467         * testsuite/plugin_test.c: New file.
13468         * testsuite/plugin_test_1.sh: New file.
13469         * testsuite/plugin_test_2.sh: New file.
13470
13471 2008-09-16  Ian Lance Taylor  <iant@google.com>
13472
13473         * target-reloc.h (relocate_section): Check whether a symbol is
13474         defined by the ABI before reporting an undefined symbol error.
13475         * target.h (Target::is_defined_by_abi): Make parameter const.
13476         (Target::do_is_defined_by_abi): Likewise.
13477         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13478         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13479         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13480         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13481         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13482         * testsuite/Makefile.in: Rebuild.
13483
13484         * fileread.cc (make_view): Add casts to avoid warning.
13485
13486 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13487
13488         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13489         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13490
13491 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13492
13493         * options.h (General_options::output_is_executable): New.
13494         (General_options::output_is_pie): New.
13495         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13496         for shared libraries.
13497         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13498
13499 2008-09-11  Chris Demetriou  <cgd@google.com>
13500
13501         * options.h (origin): New -z option.
13502         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13503         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13504         in DT_FLAGS_1.
13505
13506 2008-09-05  Cary Coutant  <ccoutant@google.com>
13507
13508         * fileread.cc (File_read::make_view): Add check for attempt to map
13509         beyond end of file.
13510
13511 2008-09-05  Cary Coutant  <ccoutant@google.com>
13512
13513         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13514         explicit instantiations.
13515
13516 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13517
13518         PR gold/6858
13519         * options.cc (General_options::finalize): Allow undefined symbols
13520         in shlibs if linking -shared.
13521
13522         PR gold/6859
13523         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13524         symbols as not needing a dynsym entry.
13525
13526 2008-08-20  Craig Silverstein  <csilvers@google.com>
13527
13528         * fileread.cc (File_read::open): Do not lock the file unless it
13529         was successfully opened.
13530
13531 2008-08-14  Cary Coutant  <ccoutant@google.com>
13532
13533         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13534         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13535         * testsuite/tls_test.cc (struct int128): 128-bit struct
13536         for testing TLS relocs with non-zero addend.
13537         (v12): New TLS variable.
13538         (t12): New test.
13539         (t_last): Add check for v12.
13540         * testsuite/tls_test.h (t12): New function.
13541         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13542
13543 2008-08-13  Ian Lance Taylor  <iant@google.com>
13544
13545         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13546         set tls_segment_ or relro_segment_.
13547         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13548         when appropriate.
13549         * output.h (Output_section::clear_is_relro): New function.
13550         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13551         sections specially even when output_data_ is empty.
13552         (Output_segment::maximum_alignment): When first section is relro,
13553         only force alignment for PT_LOAD segments.
13554         * script.cc (script_data_segment_align): New function.
13555         (script_data_segment_relro_end): New function.
13556         * script-c.h (script_data_segment_align): Declare.
13557         (script_data_segment_relro_end): Declare.
13558         * script-sections.h (class Script_sections): Declare
13559         data_segment_align and data_segment_relro_end.  Add fields
13560         segment_align_index_ and saw_relro_end_.
13561         * script-sections.cc (class Sections_element): Add set_is_relro
13562         virtual function.  Add new bool* parameter to place_orphan_here.
13563         Add get_output_section virtual function.
13564         (class Output_section_definition): Add set_is_relro.  Add new
13565         bool* parameter to place_orphan_here.  Add get_output_section.
13566         Add is_relro_ field.
13567         (Output_section_definition::Output_section_definition): Initialize
13568         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13569         and is_relro_ fields.
13570         (Output_section_definition::place_orphan_here): Add is_relro
13571         parameter.
13572         (Output_section_definition::set_section_addresses): Set relro for
13573         output section.
13574         (Output_section_definition::alternate_constraint): Likewise.
13575         (class Orphan_output_section): Add new bool* parameter to
13576         place_orphan_here.  Add get_output_section.
13577         (Orphan_output_section::place_orphan_here): Add is_relro
13578         parameter.
13579         (Script_sections::Script_sections): Initialize
13580         data_segment_align_index_ and saw_relro_end_.
13581         (Script_sections::data_segment_align): New function.
13582         (Script_sections::data_segment_relro_end): New function.
13583         (Script_sections::place_orphan): Set or clear is_relro.
13584         (Script_sections::set_section_addresses): Force alignment of first
13585         TLS section.
13586         * yyscript.y (exp): Call script_data_segment_align and
13587         script_data_segment_relro_end.
13588         * testsuite/relro_script_test.t: New file.
13589         * testsuite/relro_test.cc (using_script): Declare.
13590         (t1, t2): Test using_script.
13591         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13592         (relro_script_test_SOURCES): Define.
13593         (relro_script_test_DEPENDENCIES): Define.
13594         (relro_script_test_LDFLAGS): Define.
13595         (relro_script_test_LDADD): Define.
13596         (relro_script_test.so): New target.
13597         * testsuite/Makefile.in: Rebuild.
13598
13599 2008-08-06  Cary Coutant <ccoutant@google.com>
13600
13601         * archive.cc (Archive::total_archives, Archive::total_members)
13602         (Archive::total_members_loaded): New variables.
13603         (Archive::setup): Add parameter.  Add option to preread
13604         archive symbols.
13605         (Archive::read_armap): Add counter.
13606         (Archive::get_file_and_offset): New function.
13607         (Archive::get_elf_object_for_member): New function.
13608         (Archive::read_all_symbols): New function.
13609         (Archive::read_symbols): New function.
13610         (Archive::add_symbols): Add counters.
13611         (Archive::include_all_members): Use armap to find members if it's
13612         already built.
13613         (Archive::include_member): Skip reading symbols if already read.
13614         Factored code into Archive::get_file_and_offset and
13615         Archive::get_elf_object_for_member.  Changed call to
13616         Mapfile::report_include_archive_member.
13617         (Archive::print_stats): New function.
13618         * archive.h: Declare Object and Read_symbols_data classes.
13619         (Archive::Archive): Add initializers for new members.
13620         (Archive::setup): Add parameter.
13621         (Archive::print_stats): New function.
13622         (Archive::total_archives, Archive::total_members)
13623         (Archive::total_members_loaded): New variables.
13624         (Archive::get_file_and_offset): New function.
13625         (Archive::get_elf_object_for_member): New function.
13626         (Archive::read_all_symbols): New function.
13627         (Archive::read_symbols): New function.
13628         (Archive::Archive_member): New class.
13629         (Archive::members_): New member.
13630         (Archive::num_members_): New member.
13631         * main.cc: Include archive.h.
13632         (main): Call Archive::print_stats.
13633         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13634         archive parameter; member_name is now the fully-decorated name.
13635         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13636         * options.h: (General_options): Add --preread-archive-symbols option.
13637         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13638         Archive::setup.
13639
13640 2008-08-04  Ian Lance Taylor  <iant@google.com>
13641
13642         * symtab.h (Symbol::use_plt_offset): New function.
13643         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13644         * powerpc.cc (Relocate::relocate): Likewise.
13645         * sparc.cc (Relocate::relocate): Likewise.
13646         * x86_64.cc (Relocate::relocate): Likewise.
13647         * testsuite/weak_plt.sh: New test.
13648         * testsuite/weak_plt_main.cc: New test.
13649         * testsuite/weak_plt_shared.cc: New test.
13650         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13651         (check_PROGRAMS): Add weak_plt.
13652         (check_DATA): Add weak_plt_shared.so.
13653         (weak_plt_main_pic.o, weak_plt): New targets.
13654         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13655         * testsuite/Makefile.in: Rebuild.
13656
13657         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13658         gcctestdir/ld.
13659         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13660         * testsuite/Makefile.in: Rebuild.
13661
13662 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13663
13664         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13665         * Makefile.in: Regenerate.
13666         * po/POTFILES.in: Regenerate.
13667
13668 2008-07-29  Ian Lance Taylor  <iant@google.com>
13669
13670         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13671         symbols before other symbols.
13672         * testsuite/script_test_2.cc (test_addr): Declare.
13673         (test_addr_alias): Declare.
13674         (main): Check that test_addr and test_addr_alias have the right
13675         values.
13676         * testsuite/script_test_2.t: Define test_addr_alias and
13677         test_addr.
13678
13679 2008-07-24  Ian Lance Taylor  <iant@google.com>
13680
13681         PR 5990
13682         * descriptors.cc: New file.
13683         * descriptors.h: New file.
13684         * gold-threads.h (class Hold_optional_lock): New class.
13685         * fileread.cc: Include "descriptors.h".
13686         (File_read::~File_read): Release descriptor rather than closing
13687         it.
13688         (File_read::open) [file]: Call open_descriptor rather than open.
13689         Set is_descriptor_opened_.
13690         (File_read::open) [memory]: Assert that descriptor is not open.
13691         (File_read::reopen_descriptor): New function.
13692         (File_read::release): Release descriptor.
13693         (File_read::do_read): Make non-const.  Reopen descriptor.
13694         (File_read::read): Make non-const.
13695         (File_read::make_view): Reopen descriptor.
13696         (File_read::do_readv): Likewise.
13697         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13698         Update declarations.
13699         * layout.cc: Include "descriptors.h".
13700         (Layout::create_build_id): Use open_descriptor rather than open.
13701         * output.cc: Include "descriptors.h".
13702         (Output_file::open): Use open_descriptor rather than open.
13703         * archive.cc (Archive::const_iterator): Change Archive to be
13704         non-const.
13705         (Archive::begin, Archive::end): Make non-const.
13706         (Archive::count_members): Likewise.
13707         * archive.h (class Archive): Update declarations.
13708         * object.h (Object::read): Make non-const.
13709         * Makefile.am (CCFILES): Add descriptors.cc.
13710         (HFILES): Add descriptors.h.
13711         * Makefile.in: Rebuild.
13712
13713         PR 6716
13714         * gold.h: Always include <clocale>.  Add Solaris workarounds
13715         following code in binutils/sysdep.h.
13716
13717         PR 6048
13718         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13719         this->eh_frame_hdr_ is NULL before using it.
13720
13721         * dynobj.cc (Versions::Versions): Update comment.
13722
13723         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13724         the base version name.
13725
13726         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13727         array size plus one.
13728         (Stringpool_template::set_string_offsets): Subtract one from key
13729         before using it as an array index.
13730         (Stringpool_template::get_offset_with_length): Likewise.
13731         (Stringpool_template::write_to_buffer): Likewise.
13732         * stringpool.h (Stringpool_template::get_offset_from_key):
13733         Likewise.
13734
13735 2008-07-23  Ian Lance Taylor  <iant@google.com>
13736
13737         PR 6658
13738         * object.h (Merged_symbol_value::value): Do our best to handle a
13739         negative addend.
13740
13741         PR 6647
13742         * script.cc (Version_script_info::get_versions): Don't add empty
13743         version tag to return value.
13744         (Version_script_info::get_symbol_version_helper): Change return
13745         type to bool.  Add pversion parameter.  Change all callers.
13746         (script_register_vers_node): Don't require a non-NULL tag.
13747         * script.h (class Version_script_info): Update declarations.
13748         (Version_script_info::get_symbol_version): Change return type to
13749         bool.  Add version parameter.  Change all callers.
13750         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13751         handling.  Handle an empty version from a version script.
13752         (Symbol_table::define_special_symbol): Likewise.
13753         * testsuite/ver_test_10.script: New file.
13754         * testsuite/ver_test_10.sh: New file.
13755         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13756         (check_DATA): Add ver_test_10.syms.
13757         (ver_test_10.syms, ver_test_10.so): New target.
13758         * testsuite/Makefile.in: Rebuild.
13759
13760 2008-07-23  Simon Baldwin  <simonb@google.com>
13761
13762         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13763         to zero for undefined symbols from dynamic libraries.
13764
13765 2008-07-23  Ian Lance Taylor  <iant@google.com>
13766
13767         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13768         Change all callers.
13769         * symtab.h (class Symbol_table): Update declaration.
13770         * testsuite/ver_test_9.cc: New file.
13771         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13772         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13773         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13774         (ver_test_9.so, ver_test_9.o): New targets.
13775         * testsuite/Makefile.in: Rebuild.
13776
13777 2008-07-22  Ian Lance Taylor  <iant@google.com>
13778
13779         * options.h (class General_options): Define --check-sections.
13780         * layout.cc (Layout::set_segment_offsets): Handle
13781         --check-sections.
13782
13783         * options.h (class General_options): Define -n/--nmagic and
13784         -N/--omagic.
13785         * options.cc (General_options::finalize): For -n/--nmagic or
13786         -N/--omagic, set -static.
13787         * layout.cc (Layout::attach_allocated_section_to_segment): If
13788         -N/--omagic, don't put read-only and read-write sections in
13789         different segments.
13790         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13791         finding a read-only segment.
13792         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13793         don't set the minimum segment alignment to the common page size,
13794         and don't set the file offset to the address modulo the page size.
13795         * script-sections.cc (Script_sections::create_segments): If
13796         -n/--omagic, don't put read-only and read-write sections in
13797         different segments.
13798
13799         * cref.cc: New file.
13800         * cref.h: New file.
13801         * options.h (class General_options): Add --print-symbol-counts.
13802         * main.cc (main): Issue defined symbol report if requested.
13803         * archive.cc (Archive::interpret_header): Make into a const member
13804         function.
13805         (Archive::add_symbols): Call Input_objects::archive_start and
13806         archive_stop.
13807         (Archive::const_iterator): Define new class.
13808         (Archive::begin, Archive::end): New functions.
13809         (Archive::include_all_members): Rewrite to use iterator.
13810         (Archive::count_members): New function.
13811         * archive.h (class Archive): Update declarations.
13812         (Archive::filename): New function.
13813         * object.cc: Include "cref.h".
13814         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13815         (Sized_relobj::do_get_global_symbol_counts): New function.
13816         (Input_objects::add_object): Add object to cross-referencer.
13817         (Input_objects::archive_start): New function.
13818         (Input_objects::archive_stop): New function.
13819         (Input_objects::print_symbol_counts): New function.
13820         * object.h: Declare Cref and Archive.
13821         (Object::get_global_symbol_counts): New function.
13822         (Object::do_get_global_symbol_counts): New pure virtual function.
13823         (class Sized_relobj): Add defined_count_ field.  Update
13824         declarations.
13825         (class Input_objects): Add cref_ field.  Update constructor.
13826         Update declarations.
13827         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13828         defined_count_.
13829         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13830         symbol counts.
13831         (Sized_dynobj::do_get_global_symbol_counts): New function.
13832         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13833         defined_count_.  Update declarations.  Define Symbols typedef.
13834         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13835         parameter.  Change all callers.
13836         (Symbol_table::add_from_dynobj): Add sympointers and defined
13837         parameters.  Change all callers.
13838         * symtab.h (class Symbol_table): Update declarations.
13839         * Makefile.am (CCFILES): Add cref.cc.
13840         (HFILES): Add cref.h.
13841         * Makefile.in: Rebuild.
13842
13843 2008-07-22  Simon Baldwin  <simonb@google.com>
13844
13845         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13846         to zero when writing undefined symbols.
13847
13848 2008-07-22  Ian Lance Taylor  <iant@google.com>
13849
13850         * output.cc (Output_section::add_input_section): Don't try to
13851         merge empty merge sections.
13852
13853 2008-07-21  Craig Silverstein  <csilvers@google.com>
13854
13855         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13856         Include symbol version in error message.
13857
13858 2008-07-20  Chris Demetriou  <cgd@google.com>
13859
13860         * configure.ac (gold_cv_c_random_seed): New configured variable.
13861         (RANDOM_SEED_CFLAGS): New substituted variable.
13862         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13863         * configure: Rebuild.
13864         * Makefile.in: Likewise.
13865         * testsuite/Makefile.in: Likewise.
13866
13867 2008-07-18  Ian Lance Taylor  <iant@google.com>
13868
13869         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13870         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13871         * testsuite/ver_test_main.cc (main): Call t4.
13872         (t4, t4_2a): Define.
13873         * testsuite/ver_test_2.cc (t4_2): Define.
13874         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13875         * testsuite/ver_test_4.cc (t4_2a): Define.
13876         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13877         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13878
13879 2008-07-17  Ian Lance Taylor  <iant@google.com>
13880
13881         * dynobj.cc (Versions::add_def): If we give an error about a
13882         missing version, go ahead and create the version anyhow.
13883
13884 2008-07-10  Ian Lance Taylor  <iant@google.com>
13885
13886         Handle output sections with more than 0x7fffffff bytes.
13887         * object.h (class Relobj): Change map_to_output_ to
13888         output_sections_, and just keep a section pointer.  Change all
13889         uses.  Move comdat group support to Sized_relobj.
13890         (Relobj::is_section_specially_mapped): Remove.
13891         (Relobj::output_section): Remove poff parameter.  Change all
13892         callers.
13893         (Relobj::output_section_offset): New function.
13894         (Relobj::set_section_offset): Rewrite.
13895         (Relobj::map_to_output): Remove.
13896         (Relobj::output_sections): New function.
13897         (Relobj::do_output_section_offset): New pure virtual function.
13898         (Relobj::do_set_section_offset): Likewise.
13899         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13900         group support from Relobj.  Update declarations.
13901         (Sized_relobj::get_output_section_offset): New function.
13902         (Sized_relobj::do_output_section_offset): New function.
13903         (Sized_relobj::do_set_section_offset): New function.
13904         * object.cc (Relobj::output_section_address): Remove.
13905         (Sized_relobj::Sized_relobj): Initialize new fields.
13906         (Sized_relobj::include_section_group): Cast find_kept_object to
13907         Sized_relobj.
13908         (Sized_relobj::include_linkonce_section): Likewise.
13909         (Sized_relobj::do_layout): Use separate arrays for output section
13910         and output offset.
13911         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13912         output_sections.
13913         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13914         output_sections and section_offsets.
13915         (Sized_relobj::write_local_symbols): Likewise.
13916         (map_to_kept_section): Compute output address directly.
13917         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13918         output_sections and section_offsets.
13919         (Sized_relobj::write_sections): Likewise.
13920         (Sized_relobj::relocate_sections): Likewise.
13921         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13922         * output.h (class Output_reloc): Update declarations.  Change
13923         u2_.relobj to Sized_relobj*.
13924         (class Output_data_reloc): Change add functions to use
13925         Sized_relobj*.
13926         * output.cc (Output_reloc::Output_reloc): Change relobj to
13927         Sized_relobj*.
13928         (Output_reloc::local_section_offset): Change return type to
13929         Elf_Addr.  Use get_output_section_offset.
13930         (Output_reloc::get_address): Likewise.
13931         (Output_section::is_input_address_mapped): Don't call
13932         is_section_specially_mapped.
13933         (Output_section::output_offset): Likewise.
13934         (Output_section::output_address): Likewise.
13935         (Output_section::starting_output_address): Likewise.
13936         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13937         parameter to Sized_relobj*.
13938         (Copy_relocs::need_copy_reloc): Likewise.
13939         (Copy_relocs::save): Likewise.
13940         * copy-relocs.h (class Copy_relocs): Update declarations.
13941         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13942         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13943         * target-reloc.h (relocate_for_relocatable): Change
13944         offset_in_output_section type to Elf_Addr.  Change code that uses
13945         it as well.
13946         * layout.cc (Layout::layout): Always set *off.
13947         * mapfile.cc (Mapfile::print_input_section): Use
13948         output_section_offset.
13949         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13950         Sized_relobj*.
13951         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13952         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13953         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13954
13955 2008-07-03  Ian Lance Taylor  <iant@google.com>
13956
13957         * layout.cc (Layout::include_section): Do not discard unrecognized
13958         SHT_STRTAB sections.
13959
13960 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13961
13962         * script.cc (Lex::can_continue_name): Make '?' allowable in
13963         version-script names.
13964         * testsuite/version_script.map: Change glob pattern to use '?'
13965
13966 2008-06-30  Manish Singh  <yosh@gimp.org>
13967
13968         PR 6585
13969         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13970         Correct typo.
13971
13972 2008-06-30  Ian Lance Taylor  <iant@google.com>
13973
13974         PR 6660
13975         PR 6682
13976         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13977         versions]: Don't try to read the value in the contents, since we
13978         don't use it.  Use the template endianness when writing.
13979
13980 2008-06-25  Cary Coutant  <ccoutant@google.com>
13981
13982         * fileread.cc (File_read::make_view): Assert on zero-length view.
13983         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13984         symbol table when there are no symbols to read.
13985
13986 2008-06-23  Craig Silverstein  <csilvers@google.com>
13987
13988         * version.cc (version_string): Bump to 1.7
13989
13990 2008-06-18  Craig Silverstein  <csilvers@google.com>
13991
13992         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13993         constant 0xFFFF to type Valtype.
13994         (Powerpc_relocate_functions::rel16_ha): Likewise.
13995
13996 2008-06-17  Ian Lance Taylor  <iant@google.com>
13997
13998         * output.h (Output_section::Input_section): Initialize p2align_ to
13999         zero for Output_section_data constructors.
14000         (Output_section::Input_section::addralign): If not an input
14001         section, return the alignment of the Output_section_data.
14002         * testsuite/copy_test.cc: New file.
14003         * testsuite/copy_test_1.cc: New file.
14004         * testsuite/copy_test_2.cc: New file.
14005         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14006         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14007         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14008         (copy_test_1_pic.o, copy_test_1.so): New targets.
14009         (copy_test_2_pic.o, copy_test_2.so): New targets.
14010         * testsuite/Makefile.in: Rebuild.
14011
14012         * script-sections.cc (Script_sections::place_orphan): Initialize
14013         local variable exact.
14014
14015 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14016
14017         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14018
14019 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14020             David S. Miller  <davem@davemloft.net>
14021
14022         * powerpc.cc: New file.
14023         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14024         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14025         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14026         * Makefile.in: Rebuild.
14027
14028 2008-06-09  Ian Lance Taylor  <iant@google.com>
14029
14030         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14031         <exception>.
14032         (throwing, orig_terminate): New static variables.
14033         (terminate_handler): New static function.
14034         (t2): Set terminate handler.
14035
14036 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14037
14038         PR 6584
14039         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14040         alignment.
14041
14042 2008-05-30  Cary Coutant  <ccoutant@google.com>
14043
14044         * archive.cc (Archive::include_all_members) Correct to step
14045         over symbol table and extended name table in thin archives.
14046
14047 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14048
14049         PR 6407
14050         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14051         calculation.
14052
14053 2008-05-28  Caleb Howe  <cshowe@google.com>
14054
14055         * reduced_debug_output.cc: New file.
14056         * reduced_debug_output.h: New file.
14057         * options.h (class General_options): Add --strip-debug-non-line.
14058         * options.cc (General_options::finalize): Add strip_debug_non_line
14059         to the strip heirarchy.
14060         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14061         fields.
14062         * layout.cc: Include "reduced_debug_output.h".
14063         (Layout::Layout): Initialize new fields.
14064         (line_only_debug_sections): New static array.
14065         (is_lines_only_debug_sections): New static inline function.
14066         (Layout::include_section): Handle --strip-debug-non-line.
14067         (Layout::make_output_section): If --strip-debug-non-line, build
14068         new output sections for .debug_abbrev and .debug_info.
14069         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14070         gold.  Warn about possible overflow.
14071         (read_signed_LEB_128): Likewise.
14072         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14073         (read_signed_LEB_128): Declare.
14074         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14075         (HFILES): Add reduced_debug_output.h.
14076         * Makefile.in: Rebuild.
14077
14078 2008-05-21  Ian Lance Taylor  <iant@google.com>
14079
14080         * mapfile.cc: New file.
14081         * mapfile.h: New file.
14082         * options.h (class General_options): Add -M/--print-map and -Map.
14083         * options.cc (General_options::finalize): Make -M equivalent to
14084         -Map -.
14085         * main.cc: Include <cstdio> and "mapfile.h".
14086         (main): Open mapfile if requested.
14087         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14088         constructor.  Change caller.
14089         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14090         (queue_middle_tasks): Likewise.
14091         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14092         declarations.
14093         * archive.cc: Include "mapfile.h".
14094         (Archive::add_symbols): Add mapfile parameter.  Change all
14095         callers.  Pass mapfile, symbol, and reason to include_member.
14096         (Archive::include_all_members): Add mapfile parameter.  Change all
14097         callers.
14098         (Archive::include_member): Add mapfile, sym, and why parameters.
14099         Change all callers.  Report inclusion to map file.
14100         * archive.h: Include "fileread.h".
14101         (class Archive): Update declarations.
14102         (Archive::file): New const method.
14103         (class Add_archive_symbols): Add mapfile_ field.  Update
14104         constructor.  Change all callers.
14105         * readsyms.h (class Read_symbols): Likewise.
14106         (class Finish_group): Likewise.
14107         (class Read_script): Likewise.
14108         * common.cc: Include "mapfile.h".
14109         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14110         all callers.
14111         (Symbol_table::do_allocate_commons): Likewise.
14112         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14113         symbol allocation to mapfile.
14114         * common.h (class Allocate_commons_task): Add mapfile_ field.
14115         Update constructor.  Change all callers.
14116         * symtab.h (class Symbol_table): Update declarations.
14117         * layout.cc: Include "mapfile.h".
14118         (Layout_task_runner::run): Print information to mapfile.
14119         (Layout::create_gold_note): Change Output_data_fixed_space to
14120         Output_data_zero_fill.
14121         (Layout::create_build_id): Likewise.
14122         (Layout::print_to_mapfile): New function.
14123         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14124         constructor.  Change caller.
14125         (class Layout): Declare print_to_mapfile.
14126         * output.cc (Output_section::Input_section::print_to_mapfile): New
14127         function.
14128         (Output_section::add_input_section): If producing a map, always
14129         add to input_sections_ list.
14130         (Output_section::do_print_to_mapfile): New function.
14131         (Output_segment::print_sections_to_mapfile): New function.
14132         (Output_segment::print_section_list_to_mapfile): New function.
14133         * output.h: Include "mapfile.h".
14134         (Output_data::print_to_mapfile): New function.
14135         (Output_data::do_print_to_mapfile): New virtual function.
14136         (Output_segment_headers::do_print_to_mapfile): New function.
14137         (Output_file_header::do_print_to_mapfile): New function.
14138         (Output_data_const::do_print_to_mapfile): New function.
14139         (class Output_data_const_buffer): Add map_name_ field.  Update
14140         constructor.  Change all callers.  Add do_print_to_mapfile
14141         function.
14142         (class Output_data_fixed_space): Likewise.
14143         (class Output_data_space): Likewise.
14144         (class Output_data_zero_fill): New class.
14145         (Output_data_strtab::do_print_to_mapfile): New function.
14146         (Output_data_reloc_base::do_print_to_mapfile): New function.
14147         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14148         (Output_data_group::do_print_to_mapfile): New function.
14149         (Output_data_got::do_print_to_mapfile): New function.
14150         (Output_data_dynamic::do_print_to_mapfile): New function.
14151         (Output_symtab_xindex::do_print_to_mapfile): New function.
14152         (class Output_section): Declare do_print_to_mapflie.  Declare
14153         print_to_mapfile in Input_section.
14154         (class Output_segment): Declare new functions.
14155         * object.h (Sized_relobj::symbol_count): New function.
14156         * script-sections.cc
14157         (Output_section_element_dot_assignment::set_section_addresses):
14158         Change Output_data_fixed_space to Output_data_zero_fill.
14159         (Output_data_expression::do_print_to_mapfile): New function.
14160         * script.cc (read_input_script): Add mapfile parameter.  Change
14161         all callers.
14162         * script.h (read_input_script): Update declaration.
14163         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14164         (Eh_frame::do_print_to_mapfile): New function.
14165         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14166         (Output_merge_string::do_print_to_mapfile): New function.
14167         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14168         function.
14169         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14170         function.
14171         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14172         function.
14173         * Makefile.am (CCFILES): Add mapfile.cc.
14174         (HFILES): Add mapfile.h.
14175         * Makefile.in: Rebuild.
14176
14177 2008-05-19  Ian Lance Taylor  <iant@google.com>
14178
14179         * options.h (class General_options): Add -z relro.
14180         * layout.cc (Layout::Layout): Initialize relro_segment_.
14181         (Layout::add_output_section_data): Return the output section.
14182         (Layout::make_output_section): Rcognize relro sections and mark
14183         them appropriately.
14184         (Layout::attach_allocated_section_to_segment): Put relro sections
14185         in a PT_GNU_RELRO segment.
14186         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14187         section as relro.
14188         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14189         PT_TLS segments.
14190         (Layout::linkonce_mapping): Map d.rel.ro.local to
14191         .data.rel.ro.local.
14192         (Layout::output_section_name): Us .data.rel.ro.local for any
14193         section which begins with that.
14194         * layout.h (class Layout): Update add_output_section_data
14195         declaration.  Add relro_segment_ field.
14196         * output.cc (Output_section::Output_section): Initialize is_relro_
14197         and is_relro_local_ fields.
14198         (Output_segment::add_output_section): Group relro sections.
14199         (Output_segment::is_first_section_relro): New function.
14200         (Output_segment::maximum_alignment): If there is a relro section,
14201         align the segment to the common page size.
14202         (Output_segment::set_section_addresses): Track whether we are
14203         looking at relro sections.  If the last section is a relro
14204         section, align to the common page size.
14205         (Output_segment::set_section_list_addresses): Add in_relro
14206         parameter.  Change all callers.  Align to the page size when
14207         moving from relro to non-relro section.
14208         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14209         segment.
14210         * output.h (class Output_section): Add is_relro_ and
14211         is_relro_local_ fields.
14212         (Output_section::is_relro): New function.
14213         (Output_section::set_is_relro): New function.
14214         (Output_section::is_relro_local): New function.
14215         (Output_section::set_is_relro_local): New function.
14216         (class Output_segment): Update declarations.
14217         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14218         * sparc.cc (Target_sparc::got_section): Likewise.
14219         * x86_64.cc (Target_x86_64::got_section): Likewise.
14220         * testsuite/relro_test_main.cc: New file.
14221         * testsuite/relro_test.cc: New file.
14222         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14223         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14224         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14225         (relro_test.so, relro_test_pic.o): New targets.
14226         * testsuite/Makefile.in: Rebuild.
14227
14228 2008-05-16  Ian Lance Taylor  <iant@google.com>
14229
14230         * output.cc (Output_segment::add_output_section): Remove front
14231         parameter.
14232         * output.h (class Output_segment): Remove
14233         add_initial_output_section and overloaded add_output_section.
14234         Update declaration of remaining add_output_section.
14235         * layout.cc (Layout::create_interp): Call add_output_section
14236         rather than add_initial_output_section.
14237         (Layout::finish_dynamic_section): Likewise.
14238
14239         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14240         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14241         know the dynamic type.
14242         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14243         field.  Initialize it in constructor.
14244         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14245         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14246         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14247         reloc.
14248
14249         * output.cc (Output_reloc::get_address): Change return type to
14250         Elf_Addr.
14251         * output.h (class Output_reloc): Update get_address declaration.
14252         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14253         for section addresses.
14254
14255 2008-05-09  Ian Lance Taylor  <iant@google.com>
14256
14257         PR 6493
14258         * gold.cc (gold_nomem): Use return value of write.
14259
14260 2008-05-08  Ian Lance Taylor  <iant@google.com>
14261
14262         * symtab.c (Symbol::init_base_output_data): Add version
14263         parameter.  Change all callers.
14264         (Symbol::init_base_output_segment): Likewise.
14265         (Symbol::init_base_constant): Likewise.
14266         (Symbol::init_base_undefined): Likewise.
14267         (Sized_symbol::init_output_data): Likewise.
14268         (Sized_symbol::init_output_segment): Likewise.
14269         (Sized_symbol::init_constant): Likewise.
14270         (Sized_symbol::init_undefined): Likewise.
14271         (Symbol_table::do_define_in_output_data): If the new symbol has a
14272         version, mark it as the default.
14273         (Symbol_table::do_define_in_output_segment): Likewise.
14274         (Symbol_table::do_define_as_constant): Likewise.
14275         * symtab.h (class Symbol): Update declarations.
14276         (class Sized_symbol): Likewise.
14277         * resolve.cc (Symbol::override_version): New function.
14278         (Symbol::override_base): Call override_version.
14279         (Symbol::override_base_with_special): Likewise.
14280         * testsuite/ver_script_8.script: New file.
14281         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14282         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14283         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14284         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14285
14286 2008-05-06  Ian Lance Taylor  <iant@google.com>
14287
14288         PR 6049
14289         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14290         functions.
14291         (class General_options): Remove existing --undefined, and add
14292         --no-undefined instead.  Add new --undefined as synonym for -u.
14293         * archive.cc (Archive::add_symbols): Check whether symbol was
14294         named with -u.
14295         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14296         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14297         all uses.  Add IS_UNDEFINED.  Update declarations to split
14298         different versions of init_base.  Declare init_base_undefined.
14299         (Symbol::is_defined): Handle IS_UNDEFINED.
14300         (Symbol::is_undefined): Likewise.
14301         (Symbol::is_weak_undefined): Call is_undefined.
14302         (Symbol::is_absolute): Handle IS_CONSTANT.
14303         (class Sized_symbol): Update declarations to split different
14304         versions of init.  Declare init_undefined.
14305         (class Symbol_table): Declare new functions.
14306         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14307         Change all callers.
14308         (Symbol::init_base_output_data): Likewise.
14309         (Symbol::init_base_output_segment): Likewise.
14310         (Symbol::init_base_constant): Likewise.
14311         (Symbol::init_base_undefined): New function.
14312         (Sized_symbol::init_object): Rename from init.  Change all
14313         callers.
14314         (Sized_symbol::init_output_data): Likewise.
14315         (Sized_symbol::init_output_segment): Likewise.
14316         (Sized_symbol::init_constant): Likewise.
14317         (Sized_symbol::init_undefined): New function.
14318         (Symbol_table::add_undefined_symbols_from_command_line): New
14319         function.
14320         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14321         function.
14322         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14323         (Symbol::output_section): Likewise.
14324         (Symbol::set_output_section): Likewise.
14325         (Symbol_table::sized_finalize_symbol): Likewise.
14326         (Symbol_table::sized_write_globals): Likewise.
14327         * resolve.cc (Symbol_table::should_override): Likewise.
14328         (Symbol::override_base_with_special): Likewise.
14329
14330         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14331         symbol, change it to have default visibility.
14332         * testsuite/protected_1.cc: New file.
14333         * testsuite/protected_2.cc: New file.
14334         * testsuite/protected_3.cc: New file.
14335         * testsuite/protected_main_1.cc: New file.
14336         * testsuite/protected_main_2.cc: New file.
14337         * testsuite/protected_main_3.cc: New file.
14338         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14339         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14340         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14341         (protected_1.so): New target.
14342         (protected_1_pic.o, protected_2_pic.o): New targets.
14343         (protected_3_pic.o): New target.
14344         (check_PROGRAMS): Add protected_2.
14345         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14346         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14347         * testsuite/Makefile.in: Rebuild.
14348
14349         * options.h (DEFINE_var): Add set_user_set_##varname__.
14350         (DEFINE_bool_alias): New macro.
14351         (class General_options): Define -Bstatic using DEFINE_bool_alias
14352         rather than DEFINE_special.  Add --undefined as an alias for -z
14353         defs.
14354         * options.cc (General_options::parse_Bstatic): Remove.
14355
14356         * options.h (class General_options): Add --fatal-warnings.
14357         * main.cc (main): Implement --fatal-warnings.
14358         * errors.h (Errors::warning_count): New function.
14359
14360         * options.h (class General_options): Add -Bsymbolic-functions.
14361         * symtab.h (Symbol::is_preemptible): Check for
14362         -Bsymbolic-functions.
14363
14364 2008-05-05  Ian Lance Taylor  <iant@google.com>
14365
14366         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14367         as noVARNAME rather than no-VARNAME.
14368         (class General_options): Add option -z combreloc.
14369         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14370         get_address.
14371         (Output_reloc::sort_before) [SHT_REL]: New function.
14372         (Output_reloc::sort_before) [SHT_RELA]: New function.
14373         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14374         Sort_relocs_comparison.
14375         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14376         parameter.  Change all callers.
14377         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14378         sort_relocs parameter.  Change all callers.
14379         * output.cc (Output_reloc::get_address): New function, broken out
14380         of write_rel.
14381         (Output_reloc::write_rel): Call it.
14382         (Output_reloc::compare): New function.
14383         (Output_data_reloc_base::do_write): Optionally sort relocs.
14384
14385         * configure.ac: If targ_extra_obj is set, link it in.
14386         * configure.tgt: Initialize all variables.
14387         (x86_64*): Set targ_extra_obj and targ_extra_size.
14388         * configure: Rebuild.
14389
14390         * object.cc (Sized_relobj::include_section_group): Adjust section
14391         indexes read from group data.  Build vector to pass to
14392         layout_group.
14393         * layout.cc (Layout::layout_group): Add flags and shndxes
14394         parameters.  Remove contents parameter.  Change caller.  Update
14395         explicit instantiations.
14396         * layout.h (class Layout): Update layout_group declaration.
14397         * output.cc (Output_data_group::Output_data_group): Add flags and
14398         input_shndxes parameters.  Remove contents parameter.  Change
14399         caller.
14400         (Output_data_group::do_write): Change input_sections_ to
14401         input_shndxes_.
14402         * output.h (class Output_data_group): Update constructor
14403         declaration.  Rename input_sections_ to input_shndxes_.
14404         * testsuite/many_sections_test.cc: Add template.
14405
14406 2008-04-30  Cary Coutant  <ccoutant@google.com>
14407
14408         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14409
14410         * layout.cc (Layout::include_section): Refactored check for debug
14411         info section.
14412         (Layout::add_comdat): Add new parameters.  Change type
14413         of signature parameter.  Add object and shndx to signatures table.
14414         (Layout::find_kept_object): New function.
14415         * layout.h: Include <cstring>.
14416         (Layout::is_debug_info_section): New function.
14417         (Layout::add_comdat): Add new parameters.
14418         (Layout::find_kept_object): New function.
14419         (Layout::Kept_section): New struct.
14420         (Layout::Signatures): Change type of map range.
14421         * object.cc (Relobj::output_section_address): New function.
14422         (Sized_relobj::include_section_group): Add new parameters.  Change
14423         calls to Layout::add_comdat.  Change to build table of kept comdat
14424         groups and table mapping discarded sections to kept sections.
14425         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14426         (Sized_relobj::do_layout): Change calls to include_section_group and
14427         include_linkonce_section.
14428         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14429         value to zero when section is discarded.
14430         (Sized_relobj::map_to_kept_section): New function.
14431         * object.h (Relobj::output_section_address): New function.
14432         (Relobj::Comdat_group): New type.
14433         (Relobj::find_comdat_group): New function.
14434         (Relobj::Comdat_group_table): New type.
14435         (Relobj::Kept_comdat_section): New type.
14436         (Relobj::Kept_comdat_section_table): New type.
14437         (Relobj::add_comdat_group): New function.
14438         (Relobj::set_kept_comdat_section): New function.
14439         (Relobj::get_kept_comdat_section): New function.
14440         (Relobj::comdat_groups_): New field.
14441         (Relobj::kept_comdat_sections_): New field.
14442         (Symbol_value::input_value): Update comment.
14443         (Sized_relobj::map_to_kept_section) New function.
14444         (Sized_relobj::include_linkonce_section): Add new parameter.
14445         * target-reloc.h (Comdat_behavior): New type.
14446         (get_comdat_behavior): New function.
14447         (relocate_section): Add code to map a discarded section to the
14448         corresponding kept section when applying a relocation.
14449
14450 2008-04-30  Craig Silverstein  <csilvers@google.com>
14451
14452         * dwarf_reader.cc (next_generation_count): New static var.
14453         (Addr2line_cache_entry): New struct.
14454         (addr2line_cache): New static var.
14455         (Dwarf_line_info::one_addr2line): Added caching.
14456         (Dwarf_line_info::clear_addr2line_cache): New function.
14457         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14458         cache-size parameter.
14459         (Dwarf_line_info::one_addr2line_cache): New function.
14460         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14461         new cache-size argument to one_addr2line(), and clear cache.
14462
14463 2008-04-28  Cary Coutant  <ccoutant@google.com>
14464
14465         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14466         R_386_PC8 relocations.
14467
14468 2008-04-23  Ian Lance Taylor  <iant@google.com>
14469
14470         * object.cc (Sized_relobj::include_section_group): Check for
14471         invalid section group.
14472
14473         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14474         header size.
14475
14476         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14477         than read for file header.
14478         * archive.cc (Archive::include_member): Likewise.
14479
14480 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14481
14482         * aclocal.m4: Regenerate.
14483         * configure: Regenerate.
14484
14485 2008-04-19  Ian Lance Taylor  <iant@google.com>
14486
14487         * version.cc (version_string): Bump to 1.6.
14488
14489         * testsuite/Makefile.am (many_sections_r_test): New target.
14490         (many_sections_r_test_SOURCES): Remove.
14491         (many_sections_r_test_DEPENDENCIES): Remove.
14492         (many_sections_r_test_LDFLAGS): Remove.
14493         (many_sections_r_test_LDADD): Remove.
14494
14495         * object.cc (Sized_relobj::do_add_symbols): Always pass
14496         local_symbol_count_ to add_from_relobj.
14497
14498         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14499         every thousand variables.
14500         * testsuite/Makefile.in: Rebuild.
14501
14502         * object.cc (Xindex::initialize_symtab_xindex): New function.
14503         (Xindex::read_symtab_xindex): New function.
14504         (Xindex::sym_xindex_to_shndx): New function.
14505         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14506         available.
14507         (Sized_relobj::do_initialize_xindex): New function.
14508         (Sized_relobj::do_read_symbols): Adjust section links.
14509         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14510         parameter.  Change all callers.
14511         (Sized_relobj::include_section_group): Adjust section links and
14512         symbol section indexes.
14513         (Sized_relobj::do_layout): Adjust section links.
14514         (Sized_relobj::do_count_local_symbols): Adjust section links and
14515         symbol section indexes.
14516         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14517         ordinary and special symbols.
14518         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14519         dynsym_xindex parameters.  Change all callers.  Adjust section
14520         links.  Use SHN_XINDEX when needed.
14521         (Sized_relobj::get_symbol_location_info): Adjust section links.
14522         Don't get fooled by special symbols.
14523         * object.h (class Xindex): Define.
14524         (class Object): Add xindex_ parameter.  Declare virtual functoin
14525         do_initialize_xindex.
14526         (Object::adjust_sym_shndx): New function.
14527         (Object::set_xindex): New protected function.
14528         (class Symbol_value): Add is_ordinary_shndx_ field.
14529         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14530         (Symbol_value::value): Assert ordinary section.
14531         (Symbol_value::initialize_input_to_output_map): Likewise.
14532         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14533         Change all callers.
14534         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14535         all callers.
14536         (class Sized_relobj): Update declarations.
14537         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14538         parameter.  Change all callers.
14539         (Sized_relobj::adjust_shndx): New function.
14540         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14541         field.
14542         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14543         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14544         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14545         (Sized_dynobj::read_dynsym_section): Adjust section links.
14546         (Sized_dynobj::read_dynamic): Likewise.
14547         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14548         section links.
14549         (Sized_dynobj::do_initialize_xindex): New function.
14550         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14551         do_initialize_xindex.
14552         (Sized_dynobj::adjust_shndx): New function.
14553         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14554         dynsym_xindex_ fields.
14555         (Layout::finalize): Add a call to set_section_indexes before
14556         creating the symtab sections.
14557         (Layout::set_section_indexes): Don't do anything if the section
14558         already has a section index.
14559         (Layout::create_symtab_sections): Add shnum parameter.  Change
14560         caller.  Create .symtab_shndx section if needed.
14561         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14562         caller.
14563         (Layout::allocated_output_section_count): New function.
14564         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14565         needed.
14566         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14567         fields.  Update declarations.
14568         (Layout::symtab_xindex): New function.
14569         (Layout::dynsym_xindex): New function.
14570         (class Write_symbols_task): Add layout_ field.
14571         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14572         Change caller.
14573         * output.cc (Output_section_headers::Output_section_headers): Add
14574         shstrtab_section parameter.  Change all callers.
14575         (Output_section_headers::do_sized_write): Store overflow values
14576         for section count and section string table section index in
14577         section header zero.
14578         (Output_file_header::do_sized_write): Check for overflow of
14579         section count and section string table section index.
14580         (Output_symtab_xindex::do_write): New function.
14581         (Output_symtab_xindex::endian_do_write): New function.
14582         * output.h (class Output_section_headers): Add shstrtab_section_.
14583         Update declarations.
14584         (class Output_symtab_xindex): Define.
14585         (Output_section::has_out_shndx): New function.
14586         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14587         field.
14588         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14589         Change all callers.
14590         (Sized_symbol::init): Likewise.
14591         (Symbol::output_section): Check for ordinary symbol.
14592         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14593         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14594         callers.
14595         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14596         Change all callers.  Simplify handling of symbols from sections
14597         not included in the link.
14598         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14599         distinction.
14600         (Weak_alias_sorter::operator()): Assert that symbols are
14601         ordinary.
14602         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14603         distinction.
14604         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14605         parameters.  Change all callers.
14606         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14607         symbol distinction.  Use SHN_XINDEX when needed.
14608         (Symbol_table::write_section_symbol): Add symtab_xindex
14609         parameter.  Change all callers.
14610         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14611         SHN_XINDEX when needed.
14612         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14613         declarations.
14614         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14615         (Symbol::is_defined): Check is_ordinary.
14616         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14617         (Symbol::is_absolute, Symbol::is_common): Likewise.
14618         (class Sized_symbol): Update declarations.
14619         (class Symbol_table): Update declarations.
14620         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14621         parameters.  Change all callers.
14622         (Sized_symbol::override): Likewise.
14623         (Symbol_table::override): Likewise.
14624         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14625         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14626         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14627         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14628         to be in an ordinary section.
14629         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14630         object and is_ordinary parameters.  Change all callers.
14631         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14632         Change all callers.  Don't add undefined or non-ordinary symbols
14633         to reloc_map_.
14634         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14635         Change all callers.
14636         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14637         declarations.
14638         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14639         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14640         (Sized_relobj::relocate_sections): Likewise.
14641         * target-reloc.h (scan_relocs): Adjust section symbol index.
14642         (scan_relocatable_relocs): Likewise.
14643         * i386.cc (Scan::local): Check for ordinary symbols.
14644         * sparc.cc (Scan::local): Likewise.
14645         * x86_64.cc (Scan::local): Likewise.
14646         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14647         to symbol_section_and_value.
14648         * testsuite/many_sections_test.cc: New file.
14649         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14650         (check_PROGRAMS): Add many_sections_test.
14651         (many_sections_test_SOURCES): Define.
14652         (many_sections_test_DEPENDENCIES): Define.
14653         (many_sections_test_LDFLAGS): Define.
14654         (BUILT_SOURCES): Add many_sections_define.h.
14655         (many_sections_define.h): New target.
14656         (BUILT_SOURCES): Add many_sections_check.h.
14657         (many_sections_check.h): New target.
14658         (check_PROGRAMS): Add many_sections_r_test.
14659         (many_sections_r_test_SOURCES): Define.
14660         (many_sections_r_test_DEPENDENCIES): Define.
14661         (many_sections_r_test_LDFLAGS): Define.
14662         (many_sections_r_test_LDADD): Define.
14663         (many_sections_r_test.o): New target.
14664         * testsuite/Makefile.in: Rebuild.
14665
14666 2008-04-17  Cary Coutant  <ccoutant@google.com>
14667
14668         * errors.cc (Errors::info): New function.
14669         (gold_info): New function.
14670         * errors.h (Errors::info): New function.
14671         * gold.h (gold_info): New function.
14672         * object.cc (Input_objects::add_object): Print trace output.
14673         * options.cc (options::parse_set): New function.
14674         (General_options::parse_wrap): Deleted.
14675         (General_options::General_options): Deleted initializer.
14676         * options.h (options::String_set): New typedef.
14677         (options::parse_set): New function.
14678         (DEFINE_set): New macro.
14679         (General_options::wrap): Changed to use DEFINE_set. Changed
14680         callers of any_wrap_symbols and is_wrap_symbol.
14681         (General_options::trace, General_options::trace_symbol):
14682         New options.
14683         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14684         (General_options::wrap_symbols_): Deleted.
14685         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14686
14687 2008-04-17  David S. Miller  <davem@davemloft.net>
14688
14689         * options.cc (General_options::parse_V): New function.
14690         * options.h: Add entries for -V and -Qy.
14691
14692 2008-04-17  Ian Lance Taylor  <iant@google.com>
14693
14694         * common.cc (Symbol_table::allocate_commons): Remove options
14695         parameter.  Change caller.
14696         (Symbol_table::do_allocate_commons): Remove options parameter.
14697         Change caller.  Just call do_allocate_commons_list twice.
14698         (Symbol_table::do_allocate_commons_list): New function, broken out
14699         of do_allocate_commons.
14700         * common.h (class Allocate_commons_task): Remove options_ field.
14701         Update constructor.
14702         * symtab.cc (Symbol_table::Symbol_table): Initialize
14703         tls_commons_.
14704         (Symbol_table::add_from_object): Put TLS common symbols on
14705         tls_commons_ list.
14706         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14707         which are IN_OUTPUT_DATA.
14708         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14709         allocate_commons and do_allocate_commons declarations.  Declare
14710         do_allocate_commons_list.
14711         * gold.cc (queue_middle_tasks): Update creation of
14712         Allocate_commons_task to not pass options.
14713         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14714         (TLS_TEST_C_FLAGS): New variable.
14715         (tls_test_c_pic.o): New target.
14716         (tls_test_shared.so): Link in tls_test_c_pic.o.
14717         (tls_test_c_pic_ie.o): New target.
14718         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14719         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14720         (tls_test_c.o): New target.
14721         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14722         (tls_pic_test_LDADD): Likewise.
14723         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14724         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14725         (tls_test_c_gnu2.o): New target.
14726         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14727         tls_test_c_gnu2.o.
14728         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14729         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14730         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14731         * testsuite/tls_test.cc: Include "config.h".
14732         (t_last): Call t11_last.
14733         * testsuite/tls_test.h (t11, t11_last): Declare.
14734         * testsuite/tls_test_c.c: New file.
14735         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14736         * configure.ac: Check for OpenMP support.
14737         * configure, config.in, Makefile.in: Rebuild.
14738         * testsuite/Makefile.in: Rebuild.
14739
14740 2008-04-16  Cary Coutant  <ccoutant@google.com>
14741
14742         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14743         (Target_i386::tls_base_symbol_defined_): New field.
14744         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14745         (Target_i386::Scan::global): Likewise.
14746         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14747         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14748         (Target_x86_64::tls_base_symbol_defined_): New field.
14749         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14750         (Target_x86_64::Scan::global): Likewise.
14751
14752 2008-04-16  Cary Coutant  <ccoutant@google.com>
14753
14754         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14755         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14756         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14757         building shared libraries.
14758         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14759         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14760         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14761         * testsuite/Makefile.in: Rebuild.
14762         * testsuite/weak_undef.h: New file.
14763         * testsuite/weak_undef_file1.cc: Add extra test cases.
14764         * testsuite/weak_undef_file2.cc: Likewise.
14765         * testsuite/weak_undef_test.cc: Likewise.
14766
14767 2008-04-16  David S. Miller  <davem@davemloft.net>
14768
14769         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14770         Add issued_non_pic_error_ field.  Declare check_non_pic.
14771         (Target_sparc::Scan::check_non_pic): New function.
14772         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14773         (Target_sparc::Scan::global): Likewise.
14774
14775         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14776         * configure: Rebuild.
14777
14778         * options.h (DEFINE_enable): New macro.
14779         (new_dtags): New enable option.
14780         (initfirst, interpose, loadfltr, nodefaultlib,
14781         nodelete, nodlopen, nodump): New -z options.
14782         * layout.cc (Layout:finish_dynamic_section): If new
14783         dtags enabled, emit DT_RUNPATH.  Also, emit a
14784         DT_FLAGS_1 containing any specified -z flags.
14785
14786 2008-04-16  Ian Lance Taylor  <iant@google.com>
14787
14788         * copy-relocs.cc: New file.
14789         * copy-relocs.h: New file.
14790         * reloc.cc: Remove Copy_relocs code.
14791         * reloc.h: Likewise.
14792         * reloc-types.h (struct Reloc_types) [both versions]: Add
14793         get_reloc_addend_noerror.
14794         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14795         variants of add_global which take an addend which must be zero.
14796         * i386.cc: Include "copy-relocs.h".
14797         (class Target_i386): Change type of copy_relocs_ to variable,
14798         update initializer.
14799         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14800         Change all callers.
14801         (Target_i386::do_finalize_sections): Change handling of
14802         copy_relocs_.
14803         * sparc.cc: Include "copy-relocs.h".
14804         (class Target_sparc): Change type of copy_relocs_ to variable,
14805         update initializer.
14806         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14807         Change all callers.
14808         (Target_sparc::do_finalize_sections): Change handling of
14809         copy_relocs_.
14810         * x86_64.cc: Include "copy-relocs.h".
14811         (class Target_x86_64): Change type of copy_relocs_ to variable,
14812         update initializer.
14813         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14814         class.  Change all callers.
14815         (Target_x86_64::do_finalize_sections): Change handling of
14816         copy_relocs_.
14817         * Makefile.am (CCFILES): Add copy-relocs.cc.
14818         (HFILES): Add copy-relocs.h.
14819
14820         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14821
14822         * testsuite/script_test_4.sh: Permit leading zeroes.
14823
14824 2008-04-15  Ian Lance Taylor  <iant@google.com>
14825
14826         * script-sections.cc (Script_sections::create_segments): Use
14827         header_size_adjustment even when there is enough room for the
14828         headers.
14829         * testsuite/script_test_4.sh: New file.
14830         * testsuite/script_test_4.t: New file.
14831         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14832         (check_DATA): Add script_test_4.stdout.
14833         (MOSTLYCLEANFILES): Likewise.
14834         (script_test_4): New target.
14835         (script_test_4.stdout): New target.
14836         * testsuite/Makefile.in: Rebuild.
14837
14838         * sparc.cc: Add definitions for Output_data_plt_sparc class
14839         constants.
14840
14841 2008-04-14  David S. Miller  <davem@davemloft.net>
14842
14843         * sparc.cc: New file.
14844         * Makefile.am (TARGETSOURCES): Add sparc.cc
14845         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14846         * configure.tgt: Document targ_extra_size and
14847         targ_extra_big_endian.  Add entries for sparc-* and
14848         sparc64-*.
14849         * configure.ac: Handle targ_extra_size and
14850         targ_extra_big_endian.
14851         * Makefile.in: Rebuild.
14852         * configure: Likewise.
14853         * po/POTFILES.in: Likewise.
14854         * po/gold.pot: Likewise.
14855
14856 2008-04-14  Ian Lance Taylor  <iant@google.com>
14857
14858         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14859         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14860         in the name/type/flags to section mapping.  Don't call
14861         allocate_output_section.
14862         (Layout::choose_output_section): Change parameter from adjust_name
14863         to is_input_section.  Don't permit input sections after sections
14864         are attached to segments.  Don't call allocate_output_section.
14865         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14866         not write_enable_output_section.
14867         (Layout::make_output_section): Don't push to
14868         unattached_section_list_ nor call attach_to_segment.  Call
14869         attach_section_to_segment if sections are attached.
14870         (Layout::attach_sections_to_segments): New function.
14871         (Layout::attach_section_to_segment): New function.
14872         (Layout::attach_allocated_section_to_segment): Rename from
14873         attach_to_segment.  Remove flags parameter.
14874         (Layout::allocate_output_section): Remove function.
14875         (Layout::write_enable_output_section): Remove function.
14876         * layout.h (class Layout): Update for above changes.  Add new
14877         field sections_are_attached_.
14878         * output.h (Output_section::update_flags_for_input_section): New
14879         function.
14880         * output.cc (Output_section::add_input_section): Call
14881         update_flags_for_input_section.
14882         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14883
14884 2008-04-11  Cary Coutant  <ccoutant@google.com>
14885
14886         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14887         thought unnecessary.
14888         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14889
14890 2008-04-11  Ian Lance Taylor  <iant@google.com>
14891
14892         * output.h (class Output_section_data): Remove inline definition
14893         of set_addralign.
14894         * output.cc (Output_section_data::set_addralign): New function.
14895
14896 2008-04-11  Cary Coutant  <ccoutant@google.com>
14897
14898         Add support for TLS descriptors for i386 and x86_64.
14899         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14900         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14901         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14902         GOT_TYPE_TLS_DESC.
14903         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14904         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14905         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14906         relocations.
14907         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14908         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14909         Fix problem with initial-exec relocations.
14910         (Target_i386::Relocate::relocate_tls): Likewise.
14911         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14912         relaxation.
14913         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14914         support for section-plus-offset dynamic table entries.
14915         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14916         (Output_data_dynamic::Dynamic_entry): Add support for
14917         section-plus-offset dynamic table entries.
14918         (Output_data_dynamic::Classification): Likewise.
14919         (Output_data_dynamic::classification_): Renamed offset_.
14920         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14921         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14922         (Target_x86_64::make_plt_section): New function.
14923         (Target_x86_64::reserve_tlsdesc_entries): New function.
14924         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14925         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14926         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14927         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14928         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14929         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14930         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14931         add extra PLT entry for TLS descriptors.
14932         (Output_data_plt_x86_64::got_): New field.
14933         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14934         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14935         fields.
14936         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14937         descriptors.
14938         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14939         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14940         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14941         R_386_TLS_DESC_CALL relocations.
14942         (Target_x86_64::Scan::global): Likewise.
14943         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14944         for TLS descriptors.
14945         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14946         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14947         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14948         GD-to-IE relaxation.
14949         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14950         and TLS_DESCRIPTORS.
14951         * Makefile.in: Rebuild.
14952         * configure: Rebuild.
14953         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14954         (tls_test_shared2.so): New target.
14955         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14956         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14957         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14958         (tls_shared_gd_to_ie_test_LDADD): New variable.
14959         (tls_shared_gnu2_gd_to_ie_test): New target.
14960         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14961         New targets.
14962         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14963         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14964         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14965         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14966         (tls_shared_gnu2_test): New target.
14967         (tls_test_gnu2_shared.so): New target.
14968         (tls_shared_gnu2_test_SOURCES): New variable.
14969         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14970         (tls_shared_gnu2_test_LDFLAGS): New variable.
14971         (tls_shared_gnu2_test_LDADD): New variable.
14972         * testsuite/Makefile.in: Rebuild.
14973         * testsuite/Makefile.
14974
14975 2008-04-11  Ian Lance Taylor  <iant@google.com>
14976
14977         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14978         justsyms.t.
14979         * testsuite/Makefile.in: Rebuild.
14980
14981         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14982         long.
14983         * testsuite/script_test_2.cc (main): Adjust test.
14984
14985 2008-04-11  David S. Miller  <davem@davemloft.net>
14986             Ian Lance Taylor  <iant@google.com>
14987
14988         * options.h (General_options): Add entries for '-Y' and
14989         '-relax'.
14990         * options.cc (General_options:finalize): If -Y was used, add those
14991         entries to the library path instead of the default "/lib" and
14992         "/usr/lib".
14993
14994 2008-04-11  David S. Miller  <davem@davemloft.net>
14995
14996         * testsuite/justsyms.t: Start at 0x100.
14997         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14998         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14999         long.
15000         * testsuite/script_test_2.cc: Adjust string and section length
15001         checks.
15002
15003 2008-04-09  Ian Lance Taylor  <iant@google.com>
15004
15005         PR gold/5996
15006         * script-sections.cc (Sections_element::allocate_to_segment): Add
15007         orphan parameter.
15008         (Output_section_definition::allocate_to_segment): Likewise.
15009         (Orphan_output_section::allocate_to_segment): Likewise.
15010         (Script_sections::attach_sections_using_phdrs_clause): Don't
15011         propagate non-PT_LOAD segments to orphan sections.
15012         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15013         readelf rather than objdump.
15014         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15015         .interp section and PT_INTERP segment are the same size.
15016         * testsuite/Makefile.in: Rebuild.
15017
15018         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15019         aliases for symbols defined in the same object.
15020         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15021         (weak_alias_test_SOURCES): New variable.
15022         (weak_alias_test_DEPENDENCIES): New variable.
15023         (weak_alias_test_LDFLAGS): New variable.
15024         (weak_alias_test_LDADD): New variable.
15025         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15026         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15027         (weak_alias_test_3.o): New target.
15028         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15029         * testsuite/weak_alias_test_main.cc: New file.
15030         * testsuite/weak_alias_test_1.cc: New file.
15031         * testsuite/weak_alias_test_2.cc: New file.
15032         * testsuite/weak_alias_test_3.cc: New file.
15033
15034 2008-04-08  Ian Lance Taylor  <iant@google.com>
15035
15036         * options.h (class General_options): Add --noinhibit-exec option.
15037         * main.cc (main): Check --noinhibit-exec.
15038
15039         * options.h (class General_options): Define --wrap as a special
15040         option.  Add wrap_symbols_ field.
15041         (General_options::any_wrap_symbols): New function.
15042         (General_options::is_wrap_symbol): New function.
15043         * options.cc (General_options::parse_wrap): New function.
15044         (General_options::General_options): Initialize wrap_symbols_.
15045         * symtab.cc (Symbol_table::wrap_symbol): New function.
15046         (Symbol_table::add_from_object): Handle --wrap.
15047         * symtab.h (class Symbol_table): Declare wrap_symbol.
15048         * target.h (Target::wrap_char): New function.
15049         (Target::Target_info): Add wrap_char field.
15050         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15051         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15052         * testsuite/testfile.cc (Target_test::test_target_info):
15053         Likewise.
15054
15055         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15056         there is one.
15057
15058         * layout.h (class Layout): Add added_eh_frame_data_ field.
15059         * layout.cc (Layout::Layout): Initialize new field.
15060         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15061         output section until we find a section we merged successfully.
15062         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15063         that the size be non-zero.
15064
15065         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15066         qualifier.
15067
15068 2008-04-08  Craig Silverstein  <csilvers@google.com>
15069
15070         * configure.ac: Export new conditional variable HAVE_ZLIB.
15071         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15072         on HAVE_ZLIB.
15073         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15074         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15075
15076 2008-04-07  Ian Lance Taylor  <iant@google.com>
15077
15078         * version.cc (version_string): Set to "1.5".
15079
15080         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15081         Add issued_non_pic_error_ field.  Declare check_non_pic.
15082         (Target_x86_64::Scan::check_non_pic): New function.
15083         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15084         (Target_x86_64::Scan::global): Likewise.
15085
15086         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15087         addend parameter.  Change caller.  Handle merge sections.
15088         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15089         Address to Addend.  Don't add in the result of
15090         local_section_offset, pass down the addend and use the returned
15091         value.
15092         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15093         Update declarations of local_section_offset and symbol_value.
15094         * testsuite/two_file_test_1.cc (t18): New function.
15095         * testsuite/two_file_test_2.cc (f18): New function.
15096         * testsuite/two_file_test_main.cc (main): Call t18.
15097         * testsuite/two_file_test.h (t18, f18): Declare.
15098
15099         * configure.ac: Don't test for objdump, c++filt, or readelf.
15100         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15101         conditionals.
15102         (TEST_READELF): New variable.
15103         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15104         (check_PROGRAMS): Add two_file_strip_test.
15105         (two_file_strip_test): New target.
15106         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15107         (two_file_same_shared_strip_test_SOURCES): New variable.
15108         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15109         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15110         (two_file_same_shared_strip_test_LDADD): New variable.
15111         (two_file_shared_strip.so): New target.
15112         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15113         (ver_test_5.syms, ver_test_7.syms): Likewise.
15114         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15115         (strip_test_3.stdout): Use TEST_OBJDUMP.
15116         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15117
15118 2008-04-04  Cary Coutant  <ccoutant@google.com>
15119
15120         * symtab.h (Symbol::is_weak_undefined): New function.
15121         (Symbol::is_strong_undefined): New function.
15122         (Symbol::is_absolute): New function.
15123         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15124         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15125         absolute symbols.
15126         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15127         (weak_undef_test): New target.
15128         * testsuite/Makefile.in: Rebuild.
15129         * testsuite/weak_undef_file1.cc: New file.
15130         * testsuite/weak_undef_file2.cc: New file.
15131         * testsuite/weak_undef_test.cc: New file.
15132
15133 2008-04-03  Craig Silverstein  <csilvers@google.com>
15134
15135         * compressed_output.h (class Output_compressed_section): Use
15136         unsigned buffer.
15137         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15138         add zlib header.
15139         (zlib_compressed_suffix): Removed.
15140         (Output_compressed_section::set_final_data_size): Use unsigned
15141         buffers.
15142         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15143         Fix linker invocation.
15144         (flagstest_o_specialfile_and_compress_debug_sections):
15145         Likewise.
15146         * testsuite/Makefile.in: Regenerated.
15147
15148 2008-04-02  David S. Miller  <davem@davemloft.net>
15149
15150         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15151         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15152
15153 2008-04-02  Craig Silverstein  <csilvers@google.com>
15154
15155         * TODO: New file.
15156
15157 2008-04-02  Ian Lance Taylor  <iant@google.com>
15158
15159         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15160         parameters.  Update for new key type to views_.  Change all
15161         callers.
15162         (File_read::read): Adjust for byteshift in returned view.
15163         (File_read::add_view): New function, broken out of
15164         find_and_make_view.
15165         (File_read::make_view): New function, broken out of
15166         find_and_make_view.
15167         (File_read::find_or_make_view): Add offset and aligned
15168         parameters.  Rewrite accordingly.  Change all callers.
15169         (File_read::get_view): Add offset and aligned parameters.  Adjust
15170         for byteshift in return value.
15171         (File_read::get_lasting_view): Likewise.
15172         * fileread.h (class File_read): Update declarations.
15173         (class File_read::View): Add byteshift_ field.  Add byteshift to
15174         constructor.  Add byteshift method.
15175         * archive.h (Archive::clear_uncached_views): New function.
15176         (Archive::get_view): Add aligned parameter.  Change all callers.
15177         * object.h (Object::get_view): Add aligned parameter.  Change all
15178         callers.
15179         (Object::get_lasting_view): Likewise.
15180
15181         * fileread.cc (File_read::release): Don't call clear_views if
15182         there are multiple objects.
15183         * fileread.h (File_read::clear_uncached_views): New function.
15184         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15185         on the archive.
15186
15187 2008-03-31  Cary Coutant  <ccoutant@google.com>
15188
15189         Add thin archive support.
15190         * archive.cc (Archive::armagt): New const.
15191         (Archive::setup): Remove task parameter and calls to unlock.
15192         (Archive::unlock_nested_archives): New function.
15193         (Archive::read_header): Add nested_off parameter. Change
15194         all callers.
15195         (Archive::interpret_header): Likewise.
15196         (Archive::include_all_members): Change to handle thin
15197         archives.
15198         (Archive::include_member): Likewise.
15199         * archive.h (Archive::Archive): Add new parameters and
15200         initializers.
15201         (Archive::armagt): New const.
15202         (Archive::setup): Remove task parameter.
15203         (Archive::unlock_nested_archives): New function.
15204         (Archive::read_header): Add nested_off parameter.
15205         (Archive::interpret_header): Likewise.
15206         (Archive::Nested_archive_table): New typedef.
15207         (Archive::is_thin_archive_): New field.
15208         (Archive::nested_archives_): New field.
15209         (Archive::options_): New field.
15210         (Archive::dirpath_): New field.
15211         (Archive::task_): New field.
15212         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15213         for thin archives.  Pass additional parameters to
15214         Archive::Archive.  Unlock the archive file after calling
15215         Archive::setup.
15216
15217 2008-03-29  Ian Lance Taylor  <iant@google.com>
15218
15219         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15220         version symbol to be local.
15221         * testsuite/ver_test_4.sh: New file.
15222         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15223         (check_DATA): Add ver_test_4.syms.
15224         (ver_test_4.syms): New target.
15225         * testsuite/Makefile.in: Rebuild.
15226
15227         * output.cc
15228         (Output_section::Input_section_sort_entry::has_priority): New
15229         function.
15230         (Output_section::Input_section_sort_entry::match_file_name): New
15231         function.
15232         (Output_section::Input_section_sort_entry::match_section_name):
15233         Remove.
15234         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15235         Remove.
15236         (Output_section::Input_section_sort_entry::match_section_file):
15237         Remove.
15238         (Output_section::Input_section_sort_compare::operator()): Rewrite
15239         using new Input_section_sort_entry functions.  Sort crtbegin and
15240         crtend first.  Sort sections with no priority before sections with
15241         a priority.
15242         * testsuite/initpri1.c (d3): Check j != 4.
15243         (cd5): New constructor/destructor function.
15244         (main): Check j != 2.
15245
15246         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15247         new symbol when resolving, don't call set_is_default.
15248         * testsuite/ver_test_7.cc: New file.
15249         * testsuite/ver_test_7.sh: New file.
15250         * testsuite/Makefile.am (ver_test_7.so): New target.
15251         (ver_test_7.o): New target.
15252         (check_SCRIPTS): Add ver_test_7.sh.
15253         (check_DATA): Add ver_test_7.syms.
15254         (ver_test_7.syms): New target.
15255
15256 2008-03-28  Ian Lance Taylor  <iant@google.com>
15257
15258         * layout.cc (Layout::layout): If we see an input section with a
15259         name that needs sorting, set the must_sort flag for the output
15260         section.
15261         (Layout::make_output_section): If the name of the output section
15262         indicates that it might require sorting, set the may_sort flag.
15263         * output.h (Output_section::may_sort_attached_input_sections): New
15264         function.
15265         (Output_section::set_may_sort_attached_input_sections): New
15266         function.
15267         (Output_section::must_sort_attached_input_sections): New
15268         function.
15269         (Output_section::set_must_sort_attached_input_sections): New
15270         function.
15271         (class Output_section): Declare Input_section_sort_entry.  Define
15272         Input_section_sort_compare.  Declare
15273         sort_attached_input_sections.  Add new fields:
15274         may_sort_attached_input_sections_,
15275         must_sort_attached_input_sections_,
15276         attached_input_sections_are_sorted_.
15277         * output.cc (Output_section::Output_section): Initialize new
15278         fields.
15279         (Output_section::add_input_section): Add an entry to
15280         input_sections_ if may_sort or must_sort are true.
15281         (Output_section::set_final_data_size): Call
15282         sort_attached_input_sections if necessary.
15283         (Output_section::Input_section_sort_entry): Define new class.
15284         (Output_section::Input_section_sort_compare::operator()): New
15285         function.
15286         (Output_section::sort_attached_input_sections): New function.
15287         * configure.ac: Check whether the compiler supports constructor
15288         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15289         * testsuite/initpri1.c: New file.
15290         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15291         CONSTRUCTOR_PRIORITY.
15292         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15293         (initpri1_LDFLAGS): New variable.
15294         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15295
15296 2008-03-27  Ian Lance Taylor  <iant@google.com>
15297
15298         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15299         * testsuite/common_test_1.c: New file.
15300         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15301         (common_test_1_SOURCES): New variable.
15302         (common_test_1_DEPENDENCIES): New variable.
15303         (common_test_1_LDFLAGS): New variable.
15304
15305         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15306         and commons_ correctly when NAME/VERSION does not override
15307         NAME/NULL.
15308         * testsuite/ver_test_6.c: New file.
15309         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15310         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15311         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15312
15313 2008-03-26  Ian Lance Taylor  <iant@google.com>
15314
15315         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15316         of an undefined symbol from a version script.
15317         * testsuite/Makefile.am (ver_test_5.so): New target.
15318         (ver_test_5.o): New target.
15319         (check_SCRIPTS): Add ver_test_5.sh.
15320         (check_DATA): Add ver_test_5.syms.
15321         (ver_test_5.syms): New target.
15322         * testsuite/ver_test_5.cc: New file.
15323         * testsuite/ver_test_5.script: New file.
15324         * testsuite/ver_test_5.sh: New file.
15325         * Makefile.in, testsuite/Makefile.in: Rebuild.
15326
15327         PR gold/5986
15328         Fix problems building gold with gcc 4.3.0.
15329         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15330         (gold_error_at_location, gold_warning_at_location): Use it.
15331         * configure.ac: Check whether we can compile and use a template
15332         function with a printf attribute.
15333         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15334         when jumping over bytes.
15335         * object.cc: Instantiate Object::read_section_data.
15336         * debug.h: Include <cstring>
15337         * dwarf_reader.cc: Include <algorithm>
15338         * main.cc: Include <cstring>.
15339         * options.cc: Include <cstring>.
15340         * output.cc: Include <cstring>.
15341         * script.cc: Include <cstring>.
15342         * script.h: Include <string>.
15343         * symtab.cc: Include <cstring> and <algorithm>.
15344         * target-select.cc: Include <cstring>.
15345         * version.cc: Include <string>.
15346         * testsuite/testmain.cc: Include <cstdlib>.
15347         * configure, config.in: Rebuild.
15348
15349 2008-03-25  Ian Lance Taylor  <iant@google.com>
15350
15351         * options.cc: Include "../bfd/bfdver.h".
15352         (options::help): Print bug reporting address.
15353
15354         * version.cc (print_version): Adjust output for current value of
15355         BFD_VERSION_STRING.
15356
15357         * NEWS: New file.
15358
15359         * options.cc (options::help): Print list of supported targets.
15360         * target-select.h: Include <vector>.
15361         (class Target_selector): Make machine_, size_, and is_big_endian_
15362         fields const.  Add bfd_name_ and instantiated_target_ fields.
15363         (Target_selector::Target_selector): Add bfd_name parameter.
15364         (Target_selector::recognize): Make non-virtual, call
15365         do_recognize.
15366         (Target_selector::recognize_by_name): Make non-virtual, call
15367         do_recognize_by_name.
15368         (Target_selector::supported_names): New function.
15369         (Target_selector::bfd_name): New function.
15370         (Target_selector::do_instantiate_target): New pure virtual
15371         function.
15372         (Target_selector::do_recognize): New virtual function.
15373         (Target_selector::do_recognize_by_name): New virtual function.
15374         (Target_selector::instantiate_target): New private function.
15375         (supported_target_names): Declare.
15376         * target-select.cc (Target_selector::Target_selector): Update for
15377         new parameter and fields.
15378         (select_target_by_name): Check that the name matches before
15379         calling recognize_by_name.
15380         (supported_target_names): New function.
15381         * i386.cc (class Target_selector_i386): Update Target_selector
15382         constructor call.  Remove recognize and recognize_by_name.  Add
15383         do_instantiate_target.
15384         * x86_64.cc (class Target_selector_x86_64): Likewise.
15385         * testsuite/testfile.cc (class Target_selector_test): Update for
15386         changes to Target_selector.
15387
15388         * README: Rewrite, with some notes on unsupported features.
15389
15390 2008-03-24  Cary Coutant  <ccoutant@google.com>
15391
15392         * i386.cc (Target_i386::Got_type): New enum declaration.
15393         (Target_i386::Scan::local): Updated callers of Output_data_got
15394         member functions.
15395         (Target_i386::Scan::global): Likewise.
15396         (Target_i386::Relocate::relocate): Likewise.
15397         (Target_i386::Relocate::relocate_tls): Likewise.
15398         * object.h (Got_offset_list): New class.
15399         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15400         (Sized_relobj::local_got_offset): Likewise.
15401         (Sized_relobj::set_local_got_offset): Likewise.
15402         (Sized_relobj::local_has_tls_got_offset): Removed.
15403         (Sized_relobj::local_tls_got_offset): Removed.
15404         (Sized_relobj::set_local_tls_got_offset): Removed.
15405         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15406         * output.cc (Output_data_got::add_global): Added got_type parameter.
15407         (Output_data_got::add_global_with_rel): Likewise.
15408         (Output_data_got::add_global_with_rela): Likewise.
15409         (Output_data_got::add_global_pair_with_rel): New function.
15410         (Output_data_got::add_global_pair_with_rela): New function.
15411         (Output_data_got::add_local): Added got_type parameter.
15412         (Output_data_got::add_local_with_rel): Likewise.
15413         (Output_data_got::add_local_with_rela): Likewise.
15414         (Output_data_got::add_local_pair_with_rel): New function.
15415         (Output_data_got::add_local_pair_with_rela): New function.
15416         (Output_data_got::add_global_tls): Removed.
15417         (Output_data_got::add_global_tls_with_rel): Removed.
15418         (Output_data_got::add_global_tls_with_rela): Removed.
15419         (Output_data_got::add_local_tls): Removed.
15420         (Output_data_got::add_local_tls_with_rel): Removed.
15421         (Output_data_got::add_local_tls_with_rela): Removed.
15422         * output.h (Output_data_got::add_global): Added got_type parameter.
15423         (Output_data_got::add_global_with_rel): Likewise.
15424         (Output_data_got::add_global_with_rela): Likewise.
15425         (Output_data_got::add_global_pair_with_rel): New function.
15426         (Output_data_got::add_global_pair_with_rela): New function.
15427         (Output_data_got::add_local): Added got_type parameter.
15428         (Output_data_got::add_local_with_rel): Likewise.
15429         (Output_data_got::add_local_with_rela): Likewise.
15430         (Output_data_got::add_local_pair_with_rel): New function.
15431         (Output_data_got::add_local_pair_with_rela): New function.
15432         (Output_data_got::add_global_tls): Removed.
15433         (Output_data_got::add_global_tls_with_rel): Removed.
15434         (Output_data_got::add_global_tls_with_rela): Removed.
15435         (Output_data_got::add_local_tls): Removed.
15436         (Output_data_got::add_local_tls_with_rel): Removed.
15437         (Output_data_got::add_local_tls_with_rela): Removed.
15438         * resolve.cc (Symbol::override_base_with_special): Removed
15439         reference to has_got_offset_ field.
15440         * symtab.cc (Symbol::init_fields): Replaced initialization
15441         of got_offset_ with got_offsets_.  Removed initialization
15442         of has_got_offset_
15443         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15444         (Symbol::got_offset): Likewise.
15445         (Symbol::set_got_offset): Likewise.
15446         (Symbol::has_tls_got_offset): Removed.
15447         (Symbol::tls_got_offset): Removed.
15448         (Symbol::set_tls_got_offset): Removed.
15449         (Symbol::got_offset_): Removed.
15450         (Symbol::tls_mod_got_offset_): Removed.
15451         (Symbol::tls_pair_got_offset_): Removed.
15452         (Symbol::got_offsets_): New field.
15453         (Symbol::has_got_offset): Removed.
15454         (Symbol::has_tls_mod_got_offset): Removed.
15455         (Symbol::has_tls_pair_got_offset): Removed.
15456         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15457         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15458         member functions.
15459         (Target_x86_64::Scan::global): Likewise.
15460         (Target_x86_64::Relocate::relocate): Likewise.
15461         (Target_x86_64::Relocate::relocate_tls): Likewise.
15462
15463 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15464
15465         * yyscript.y: Fix spelling error in comment.
15466
15467 2008-03-24  Ian Lance Taylor  <iant@google.com>
15468
15469         * options.h (class General_options): Define build_id option.
15470         * layout.h (class Layout): Declare write_build_id, create_note,
15471         create_build_id.  Add build_id_note_ member.
15472         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15473         "libiberty.h", "md5.h", "sha1.h".
15474         (Layout::Layout): Initialize eh_frame_data_,
15475         eh_frame_hdr_section_, and build_id_note_.
15476         (Layout::finalize): Call create_build_id.
15477         (Layout::create_note): New function, broken out of
15478         Layout::create_gold_note.
15479         (Layout::create_gold_note): Call create_note.
15480         (Layout::create_build_id): New function.
15481         (Layout::write_build_id): New function.
15482         (Close_task_runner::run): Call write_build_id.
15483
15484         * x86_64.cc: Correct license to GPLv3.
15485
15486 2008-03-23  Ian Lance Taylor  <iant@google.com>
15487
15488         * options.cc: Include "demangle.h".
15489         (parse_optional_string): New function.
15490         (parse_long_option): Handle takes_optional_argument.
15491         (parse_short_option): Update dash_z initializer.  Handle
15492         takes_optional_argument.
15493         (General_options::General_options): Initialize do_demangle_.
15494         (General_options::finalize): Set do_demangle_.  Handle demangling
15495         style.
15496         * options.h (parse_optional_string): Declare.
15497         (struct One_option): Add optional_arg field.  Update constructor.
15498         Update call constructor calls.  Add takes_optional_argument
15499         function.
15500         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15501         (DEFINE_optional_string): Define.
15502         (General_options::demangle): Change from DEFINE_bool to
15503         DEFINE_optional_string.
15504         (General_options::no_demangle): New function.
15505         (General_options::do_demangle): New function.
15506         (General_options::set_do_demangle): New function.
15507         (General_options::execstack_status_): Move definition to end of
15508         class definition.
15509         (General_options::static_): Likewise.
15510         (General_options::do_demangle_): New field.
15511         * object.cc (big_endian>::get_symbol_location_info): Call
15512         Options::do_demangle, not Options::demangle.
15513         * symtab.cc (demangle): Likewise.
15514
15515 2008-03-22  Ian Lance Taylor  <iant@google.com>
15516
15517         * gold.h: Include <cstddef> and <sys/types.h>
15518         * options.h: Include <cstring>.
15519
15520 2008-03-21  Ian Lance Taylor  <iant@google.com>
15521
15522         * Added source code to GNU binutils.
15523 \f
15524 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15525
15526 Copying and distribution of this file, with or without modification,
15527 are permitted in any medium without royalty provided the copyright
15528 notice and this notice are preserved.
15529
15530 Local Variables:
15531 mode: change-log
15532 left-margin: 8
15533 fill-column: 74
15534 version-control: never
15535 End: