Add missing gold/ChangeLog entry.
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-02-05  Cary Coutant  <ccoutant@google.com>
2     
3         Fix problems with the --dynamic-list option.
4
5         PR gold/13577
6         * options.cc (General_options::parse_dynamic_list):
7         Set have_dynamic_list_.
8         (General_options::General_options): Initialize have_dynamic_list_.
9         (General_options::finalize): Turn off -Bsymbolic and
10         -Bsymbolic-functions if --dynamic-list provided.
11         * options.h (General_options::have_dynamic_list): New function.
12         (General_options::have_dynamic_list_): New data member.
13         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
14         correctly.
15    
16         PR gold/16530
17         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
18         in --dynamic-list, mark it.
19    
20         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
21         (dynamic_list_2): New test case.
22         * testsuite/Makefile.in: Regenerate.
23         * testsuite/dynamic_list_2.cc: New file.
24         * testsuite/dynamic_list_2.t: New file.
25         * testsuite/dynamic_list_lib1.cc: New file.
26         * testsuite/dynamic_list_lib2.cc: New file.
27         * testsuite/gc_dynamic_list_test.c: New file.
28         * testsuite/gc_dynamic_list_test.sh: New file.
29         * testsuite/gc_dynamic_list_test.t: New file.
30
31 2014-01-28  Cary Coutant  <ccoutant@google.com>
32
33         Add .gdb_index version 7 support.
34
35         * gold/dwarf_reader.cc: include <utility> (for make_pair).
36         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
37         debug sections.
38         (Dwarf_ranges_table::read_ranges_table): Likewise.
39         (Dwarf_pubnames_table::read_section): Check for GNU-style
40         sections, and for compressed debug sections.
41         (Dwarf_pubnames_table::read_header): Compute end address of table.
42         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
43         for end of list by offset, not by offset == 0.
44         (Dwarf_info_reader::do_read_string_table): Check for compressed
45         debug sections.
46         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
47         Initialize new data members.
48         (Dwarf_pubnames_table::next_name): return flag_byte.
49         (Dwarf_pubnames_table::end_of_table_): New data member.
50         (Dwarf_pubnames_table::is_gnu_style_): New data member.
51         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
52         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
53         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
54         read skeleton type unit DIEs.
55         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
56         (Gdb_index::do_write): Write flag_byte.
57         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
58         (Gdb_index::Cu_vector): Store flags along with cu indexes.
59         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
60         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
61
62 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
63
64         * version.cc (print_version): Update copyright year to 2014.
65
66 2013-12-19  Dimitry Andric  <dimitry@andric.com>
67
68         * stringpool.cc (Stringpool_template::reserve): Add
69         HAVE_UNORDERED_MAP case.
70         * stringpool.cc (Stringpool_template::print_stats): Likewise.
71
72 2013-12-18  Cary Coutant  <ccoutant@google.com>
73
74         * configure.ac: Check for <unordered_set> and <unordered_map>.
75         * config.in: Regenerate.
76         * configure: Regenerate.
77         * system.h: Use <unordered_set> and <unordered_map> if available.
78
79 2013-12-10  Roland McGrath  <mcgrathr@google.com>
80
81         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
82         with $(INSTALL_PROGRAM_ENV).
83         * Makefile.in: Regenerate.
84
85 2013-11-22  Cary Coutant  <ccoutant@google.com>
86
87         * configure.ac: Add check for which library is needed for
88         dlopen.
89         * configure: Regenerate.
90
91 2013-11-22  Cary Coutant  <ccoutant@google.com>
92
93         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
94         assembler.
95         * testsuite/Makefile.in: Regenerate.
96
97 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
98
99         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
100         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
101         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
102         (Target_x86_64<size>::Scan::local): Likewise.
103         (Target_x86_64<size>::Scan::global): Likewise.
104         (Target_x86_64<size>::Relocate::relocate): Likewise.
105         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
106         Likewise.
107         (Target_x86_64<size>::Scan::check_non_pic(): Handle
108         R_X86_64_PC32_BND.
109
110         * testsuite/Makefile.am (check_PROGRAMS): Add
111         exception_x86_64_bnd_test.
112         (exception_x86_64_bnd_test_SOURCES): New macro.
113         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
114         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
115         (exception_x86_64_bnd_test_LDADD): Likewise.
116         (exception_x86_64_bnd_1.o): New rule.
117         (exception_x86_64_bnd_2.o): Likewise.
118         * testsuite/Makefile.in: Regenerated.
119
120 2013-11-15  Alan Modra  <amodra@gmail.com>
121
122         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
123         accessor.
124         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
125         Only call ppc64_local_entry_offset for 64-bit.  Restrict
126         symval_for_branch lookup to ELFv1.
127         (Stub_table::add_plt_call_entry): Use unsigned int off.
128         (Output_data_glink::Address, invalid_address): New.
129         (Output_data_glink::add_eh_frame): Move out of line.  Add
130         support for ELFv2.
131         (Output_data_glink::add_global_entry, find_global_entry,
132         global_entry_address): New functions.
133         (Output_data_glink::global_entry_stubs_, end_branch_table_,
134         ge_size): New variables.
135         (Output_data_glink::set_final_data_size): Add global entry
136         stub sizing.
137         (Output_data_glink::do_write): Write global entry stubs.
138         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
139         parameter.  Return true for ELFv2.  Adjust callers.
140         (Target_powerpc::Scan::local, global): Restrict opd lookup to
141         ELFv1.  Similarly for ifunc and dynamic relocation processing
142         specific to ELFv1.  Recognize that symbols are defined on
143         their plt entries for ELFv2.
144         (Target_powerpc::symval_for_branch): Assert if called for
145         ELFv2 or ppc32.
146         (Target_powerpc::Relocate::relocate): Use global entry plt
147         stub for symbol value if such exists on ELFv2.
148         (Target_powerpc::Relocate::relocate): Don't call
149         symval_for_branch when ELFv2.  Do adjust for local entry
150         offset when ELFv2.
151         (Target_powerpc::do_dynsym_value): Set symbols to global entry
152         plt stub for ELFv2.
153         (Target_powerpc::do_plt_address_for_global): Similarly.
154
155 2013-11-14  Cary Coutant  <ccoutant@google.com>
156
157         Revert patch -- this did not fix the problem, and there is
158         no race there.
159
160         2013-11-14  Cary Coutant  <ccoutant@google.com>
161
162             PR gold/14860
163             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
164             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
165             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
166             updating fde_offsets_.
167             (Eh_frame_hdr::lock_): New data member.
168
169 2013-11-14  Cary Coutant  <ccoutant@google.com>
170
171         * dwp.cc (Dwo_file_entry): New type.
172         (File_list): Use Dwo_file_entry.
173         (Dwo_file::verify): New function.
174         (Dwo_file::verify_dwo_list): New function.
175         (Dwo_file::sized_verify_dwo_list): New function.
176         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
177         list.
178         (Dwp_options): New enum type.
179         (dwp_options): Add --verify-only.
180         (usage): Likewise.
181         (main): Likewise.
182         * dwp.h (gold_info): Add declaration.
183
184 2013-11-14  Cary Coutant  <ccoutant@google.com>
185
186         PR gold/14860
187         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
188         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
189         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
190         updating fde_offsets_.
191         (Eh_frame_hdr::lock_): New data member.
192
193 2013-11-06  Cary Coutant  <ccoutant@google.com>
194
195         PR gold/15758
196         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
197         before reloc sections.
198
199 2013-11-04  Alan Modra  <amodra@gmail.com>
200
201         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
202         (Symbol::needs_dynamic_reloc): Test new flag.
203         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
204         (Target_powerpc::Scan::get_reference_flags): Add target param.
205         Return FUNC_DESC_ABI for 64-bit ELFv1.
206         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
207         call.
208         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
209         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
210
211 2013-10-31  Cary Coutant  <ccoutant@google.com>
212
213         Restore support for dwp v2 DWARF package file format.
214
215         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
216         tu_length parameter.  Adjust all callers.
217         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
218         * dwp.cc: Include dwarf.h.
219         (Section_bounds): New struct type.
220         (Unit_set): New struct type.
221         (Dwo_file::Dwo_file): Initialize new data member.
222         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
223         Combine and rename to...
224         (Dwo_file::read_unit_index): ...this.
225         (Dwo_file::sized_read_compunit_index)
226         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
227         (Dwo_file::sized_read_unit_index): ...this.
228         (Dwo_file::copy_section): Remove section_name, is_str_offsets
229         parameters; add section_id parameter.
230         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
231         (Dwo_file::add_unit_set): ...this.
232         (Dwo_file::shndx_map_): Remove.
233         (Dwo_file::sect_offsets_): New data member.
234         (Dwp_output_file::Dwp_output_file): Initialize new data members.
235         (Dwp_output_file::add_section): Rename to...
236         (Dwp_output_file::add_contribution): ...this.
237         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
238         (Dwp_output_file::add_tu_set): Likewise.
239         (Dwp_output_file::Contribution): New type.
240         (Dwp_output_file::Section::contributions): New data member.
241         (Dwp_output_file::Cu_or_tu_set): Remove.
242         (Dwp_output_file::Section::Section): New ctor.
243         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
244         (Dwp_output_file::Dwp_index::Section_table): New type.
245         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
246         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
247         parameter.
248         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
249         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
250         (Dwp_output_file::Dwp_index::section_table): New member function.
251         (Dwp_output_file::Dwp_index::section_table_end): New member function.
252         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
253         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
254         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
255         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
256         (Dwp_output_file::Dwp_index::section_table_): New data member.
257         (Dwp_output_file::Dwp_index::section_mask_): New data member.
258         (Dwp_output_file::add_output_section): New member function.
259         (Dwp_output_file::write_new_section): New member function.
260         (Dwp_output_file::write_contributions): New member function.
261         (Dwp_output_file::section_id_map_): New data member.
262         (class Dwo_id_info_reader): Remove.
263         (class Unit_reader): New class.
264         (get_dwarf_section_name): New function.
265         (Dwo_file::read_executable): Adjust initializations of class data.
266         (Dwo_file::read): Add support for v2 package file format.
267         (Dwo_file::read_unit_index): Likewise.
268         (Dwo_file::sized_read_unit_index): Likewise.
269         (Dwo_file::copy_section): Likewise.
270         (Dwo_file::add_unit_set): Likewise.
271         (Dwp_output_file::add_output_section): Likewise.
272         (Dwp_output_file::add_contribution): Likewise.
273         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
274         for empty slot.
275         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
276         file format.
277         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
278         slot.
279         (Dwp_output_file::initialize): Remove unused function.
280         (Dwp_output_file::finalize): Add support for v2 package file format.
281         (Dwp_output_file::write_index): Likewise.
282         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
283         function prototype.
284
285 2013-10-31  Cary Coutant  <ccoutant@google.com>
286
287         * configure.ac: Fix check for -fmerge-constants.
288         * configure.ac: Regenerate.
289
290 2013-10-30  Roland McGrath  <mcgrathr@google.com>
291
292         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
293         Correct 9-byte nop sequence to match what the assembler generates.
294
295 2013-10-30  Alan Modra  <amodra@gmail.com>
296
297         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
298         ppc64_local_entry_offset, ppc64_local_entry_offset,
299         do_read_symbols): New functions.
300         (Powerpc_relobj::e_flags_, st_other_): New vars.
301         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
302         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
303         (Powerpc_relobj::e_flags_): New var.
304         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
305         and adjust for ELFv2.
306         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
307         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
308         (Powerpc_dynobj::do_find_special_sections): Likewise.
309         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
310         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
311         to ELFv2 local entry.
312         (Target_powerpc::do_relax): No thread safe barriers needed for
313         ELFv2.
314         (Output_data_plt_powerpc::initial_plt_entry_size_,
315         plt_entry_size): Delete.  Replace all uses with
316         first_plt_entry_offset() and plt_entry_size().
317         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
318         reserved_size parm.  Update callers.
319         (Output_data_plt_powerpc::entry_count): Update.
320         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
321         and use Target_powerpc::first_plt_entry_offset().
322         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
323         rename to plt_entry_size.
324         (Output_data_plt_powerpc::add_ifunc_entry,
325         add_local_ifunc_entry): Adjust reloc for ELFv2.
326         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
327         (glink_eh_frame_fde_64v2): New.
328         (Stub_table::plt_call_size): Support ELFv2 sizing.
329         (Output_data_glink::add_eh_frame): Use the new FDE.
330         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
331         (Stub_table::do_write): Write ELFv2 stubs and glink.
332         (Target_powerpc::Relocate::relocate): Replaces nop after call
333         with ld 2,24(1) and adjust local offset destination for ELFv2.
334
335 2013-10-30  Alan Modra  <amodra@gmail.com>
336
337         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
338         (Target_powerpc::Scan::global, local): Likewise.
339         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
340         on all ppc64 @h and @ha relocs.
341
342 2013-10-14  Alan Modra  <amodra@gmail.com>
343
344         * output.h (Output_data_got::add_constant): Tidy.
345         (Output_data_got::add_constant_pair): New function.
346         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
347         methods used so as to first call reserve_ent().
348
349 2013-10-11  Roland McGrath  <mcgrathr@google.com>
350
351         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
352         add_got_entry and add_got_entry_pair.
353
354         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
355         (HAVE_PUBNAMES): Likewise.
356         * configure: Regenerate.
357
358         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
359         * testsuite/Makefile.in: Regenerate.
360
361         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
362         Remove const from declaration.
363         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
364         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
365         * output.h (Output_file_header): Remove const from member target_
366         and corresponding constructor argument.
367         * output.cc (Output_file_header::Output_file_header): Update prototype.
368         (Output_file_header::do_sized_write): Use this->target_ in place
369         of parameters()->target().
370
371         * testsuite/undef_symbol.cc (Foo::get_a): New method.
372
373         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
374         * configure: Regenerate.
375         * Makefile.in: Regenerate.
376         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
377         * testsuite/merge_string_literals_2.c: Likewise.
378         * testsuite/Makefile.am
379         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
380         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
381         literal -fmerge-constants.
382         * testsuite/Makefile.in: Regenerate.
383
384         * i386.cc (Target_i386): Remove unused member dynbss_.
385         * arm.cc (Target_arm): Likewise.
386         * powerpc.cc (Target_powerpc): Likewise.
387         * sparc.cc (Target_sparc): Likewise.
388         * tilegx.cc (Target_tilegx): Likewise.
389         * x86_64.cc (Target_x86_64): Likewise.
390         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
391         type_signature_, type_offset_.
392         * plugin.h (Plugin_hook): Remove unused member layout_.
393         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
394         mapfile_.
395         (Read_member): Remove unused members input_objects_, symtab_,
396         mapfile_, layout_.
397         (Check_library): Remove unused member symtab_.
398         * archive.h (Lib_group): Remove unused member lib_.
399         * archive.cc (Lib_group::Lib_group): Update initializer.
400         * incremental.h (Incremental_binary): Remove unused member target_.
401         (Incremental_script_entry): Removed unused member script_.
402         * layout.h (Write_symbols_task): Remove unused member input_objects_.
403         * icf.h (Icf): Remove unused member num_tracked_relocs.
404
405         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
406         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
407         its only use.
408         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
409
410         * archive.h: Use struct rather than class for forward declaration
411         of Read_symbols_data.
412
413 2013-10-07  Cary Coutant  <ccoutant@google.com>
414
415         PR gold/16010
416         * testsuite/Makefile.am (icf_test): Fix dependencies.
417         (icf_safe_test): Likewise.
418         (icf_safe_so_test): Likewise.
419         (large_symbol_alignment): Add empty _LDADD rule.
420         * testsuite/Makefile.in: Regenerate.
421
422 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
423
424         PR gold/15927
425         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
426         relocation for R_X86_64_32 on x32.
427
428 2013-08-27  Roland McGrath  <mcgrathr@google.com>
429
430         * output.cc (Output_segment::set_section_addresses): Take new
431         Target* argument.  If target->isolate_execinstr() and the segment
432         is executable and starts at a target->abi_pagesize() boundary,
433         pad its end out to a target->abi_pagesize() boundary with code fill.
434         * output.h (Output_segment::set_section_addresses): Update decl.
435         * layout.h (Layout::check_output_data_for_reset_values): Take new
436         argument RELAX_OUTPUTS.
437         (Layout): New member relax_output_list_.
438         (Layout::add_relax_output): New method.
439         * layout.cc (Layout::Layout): Update constructor.
440         (Layout::reset_relax_output): New method.
441         (Layout::clean_up_after_relaxation): Call it.
442         (Layout::prepare_for_relaxation): Update caller.
443         (Layout::set_segment_offsets): Update callers of set_section_addresses.
444         Call reset_relax_output before re-processing segments for
445         isolate_execinstr case.
446         (Layout::write_data): Handle relax_output_list_.
447         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
448         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
449
450 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
451
452         PR binutils/15834
453         * object.h: Fix typos.
454
455 2013-08-16  Roland McGrath  <mcgrathr@google.com>
456
457         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
458         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
459
460 2013-08-07  Cary Coutant  <ccoutant@google.com>
461
462         Revert support for v2 DWP files:
463
464         2013-03-01  Cary Coutant  <ccoutant@google.com>
465
466             Add dwp support for v2 DWARF package file format.
467             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
468             tu_length parameter.  Adjust all callers.
469             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
470             * dwp.cc: Include dwarf.h.
471             (Section_bounds): New struct type.
472             (Unit_set): New struct type.
473             (Dwo_file::Dwo_file): Initialize new data member.
474             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
475             Combine and rename to...
476             (Dwo_file::read_unit_index): ...this.
477             (Dwo_file::sized_read_compunit_index)
478             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
479             (Dwo_file::sized_read_unit_index): ...this.
480             (Dwo_file::copy_section): Remove section_name, is_str_offsets
481             parameters; add section_id parameter.
482             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
483             (Dwo_file::add_unit_set): ...this.
484             (Dwo_file::shndx_map_): Remove.
485             (Dwo_file::sect_offsets_): New data member.
486             (Dwp_output_file::Dwp_output_file): Initialize new data members.
487             (Dwp_output_file::add_section): Rename to...
488             (Dwp_output_file::add_contribution): ...this.
489             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
490             (Dwp_output_file::add_tu_set): Likewise.
491             (Dwp_output_file::Contribution): New type.
492             (Dwp_output_file::Section::contributions): New data member.
493             (Dwp_output_file::Cu_or_tu_set): Remove.
494             (Dwp_output_file::Section::Section): New ctor.
495             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
496             (Dwp_output_file::Dwp_index::Section_table): New type.
497             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
498             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
499             parameter.
500             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
501             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
502             (Dwp_output_file::Dwp_index::section_table): New member function.
503             (Dwp_output_file::Dwp_index::section_table_end): New member function.
504             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
505             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
506             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
507             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
508             (Dwp_output_file::Dwp_index::section_table_): New data member.
509             (Dwp_output_file::Dwp_index::section_mask_): New data member.
510             (Dwp_output_file::add_output_section): New member function.
511             (Dwp_output_file::write_new_section): New member function.
512             (Dwp_output_file::write_contributions): New member function.
513             (Dwp_output_file::section_id_map_): New data member.
514             (class Dwo_id_info_reader): Remove.
515             (class Unit_reader): New class.
516             (get_dwarf_section_name): New function.
517             (Dwo_file::read_executable): Adjust initializations of class data.
518             (Dwo_file::read): Add support for v2 package file format.
519             (Dwo_file::read_unit_index): Likewise.
520             (Dwo_file::sized_read_unit_index): Likewise.
521             (Dwo_file::copy_section): Likewise.
522             (Dwo_file::add_unit_set): Likewise.
523             (Dwp_output_file::add_output_section): Likewise.
524             (Dwp_output_file::add_contribution): Likewise.
525             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
526             for empty slot.
527             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
528             file format.
529             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
530             slot.
531             (Dwp_output_file::initialize): Remove unused function.
532             (Dwp_output_file::finalize): Add support for v2 package file format.
533             (Dwp_output_file::write_index): Likewise.
534             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
535             function prototype.
536
537 2013-07-31  Cary Coutant  <ccoutant@google.com>
538
539         * object.cc (Sized_relobj::do_output_section_address): New function.
540         (Sized_relobj): Instantiate explicitly.
541         * object.h (Object::output_section_address): New function.
542         (Object::do_output_section_address): New function.
543         (Sized_relobj::do_output_section_address): New function.
544         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
545
546 2013-07-30  Cary Coutant  <ccoutant@google.com>
547             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
548
549         * parameters.cc (Parameters::entry): Return target-specific entry
550         symbol name.
551         * target.h (Target::entry_symbol_name): New function.
552         (Target_info::entry_symbol_name): New data member.
553
554         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
555         * i386.cc (Target_i386::i386_info): Likewise.
556         (Target_i386_nacl::i386_nacl_info): Likewise.
557         * sparc.cc (Target_sparc::sparc_info): Likewise.
558         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
559         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
560         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
561         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
562
563 2013-07-22  Sterling Augustine  <saugustine@google.com>
564
565         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
566         Convert parameter shndx to local variable. Add parameters symtab
567         and symtab_size.  Scan over section names.  Find relocation
568         section corresponding to current section.  Create and initialize
569         reloc_mapper_ and reloc_type_.
570         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
571         unit_length to off_t.  Initialize member unit_length_.  Fill in field
572         cu_offset_.
573         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
574         Initialize new fields unit_length_ and cu_offset_.
575         (Dwarf_pubnames_table::read_section): Update prototype.
576         (Dwarf_pubnames_table::cu_offset): New member function.
577         (Dwarf_pubnames_table::subsection_size): Likewise.
578         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
579         New fields.
580         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
581         member functions public.
582         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
583         Update comment.  Rework logic.  Move repeated parts to...
584         (Gdb_index_info_reader::read_pubtable): ...here. New function.
585         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
586         pubtypes_table_, and stmt_list_offset.
587         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
588         Gdb_index::find_pubtype_offset,
589         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
590         (Gdb_index::pubnames_read): Update prototype and rework logic.
591         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
592         Forward declare.
593         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
594         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
595         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
596         Gdb_index::map_pubtable_to_dies):
597         Declare functions.
598         (Gdb_index::pubnames_read): Update declaration.
599         (Gdb_index::Pubname_offset_map): New type.
600         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
601         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
602         Gdb_index::stmt_list_offset): Declare.
603         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
604         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
605         Gdb_index::pubtypes_offset_): Remove.
606
607 2013-07-19  Roland McGrath  <mcgrathr@google.com>
608
609         * options.h (General_options): Add -Trodata-segment option.
610         * parameters.cc (Parameters::check_rodata_segment): New function.
611         (Parameters::set_target_once): Call it.
612         * parameters.h (Parameters): Declare it (private member function).
613         * layout.cc (load_seg_unusable_for_headers): New function, broken
614         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
615         then validate rodata segment rather than text segment.
616         (relaxation_loop_body): Call that.
617         (is_text_segment): New function.  Don't admit a non-executable
618         segment if TARGET->isolate_execinstr().
619         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
620
621 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
622
623         PR gold/15070
624         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
625         * nacl.h (Sniff_file::View::View): Request aligned view.
626
627 2013-07-11  Cary Coutant  <ccoutant@google.com>
628
629         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
630         correct BRLT entry size.
631
632 2013-07-03  Alan Modra  <amodra@gmail.com>
633
634         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
635         comment.
636
637 2013-07-01  Cary Coutant  <ccoutant@google.com>
638
639         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
640         reloc_type_.
641         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
642         (Dwarf_ranges_table::lookup_reloc): New function.
643         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
644         reloc_type_.
645         (Dwarf_ranges_table::lookup_reloc): New function.
646         (Dwarf_ranges_table::reloc_type_): New data member.
647
648 2013-06-27  Jing Yu  <jingyu@google.com>
649
650         PR gold/15662
651         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
652         function.
653         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
654         (Target_powerpc::do_relax): Call the above.
655
656 2013-06-27  Cary Coutant  <ccoutant@google.com>
657
658         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
659         on garbage collected .opd section.
660
661 2013-06-27  Alan Modra  <amodra@gmail.com>
662
663         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
664         is non-zero.
665         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
666         (Target_powerpc::do_function_location): Likewise for loc->shndx.
667
668 2013-06-14  Cary Coutant  <ccoutant@google.com>
669
670         * resolve.cc (Symbol::override_base): Don't override st_type
671         from plugin placeholder symbols.
672         (Symbol_table::resolve): Likewise.
673         (Symbol_table::should_override): Don't complain about TLS mismatch
674         if the TO symbol is a plugin placeholder.
675         * testsuite/Makefile.am (plugin_test_tls): New test.
676         * testsuite/Makefile.in: Regenerate.
677         * testsuite/plugin_test_tls.sh: New test script.
678         * testsuite/two_file_test_2_tls.cc: New test source.
679         * testsuite/two_file_test_tls.cc: New test source.
680
681 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
682
683         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
684         the maximum segment alignment is larger than the page size.
685         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
686         correctly aligns the symbols with large alignemnt.
687         * testsuite/Makefile.in: Regenerate.
688         * testsuite/large_symbol_alignment.cc: New file.
689
690 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
691             Sriraman Tallam  <tmsriram@google.com>
692
693         * options.h (sort_section): New option.
694         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
695         Rename from Input_section_sort_section_name_special_ordering_compare.
696         (Input_section_sort_section_name_compare): New struct.
697         * output.cc (Output_section::Input_section_sort_section_name_compare::
698         operator()): New function.
699         (Output_section::sort_attached_input_sections): Use new sort function
700         for .text if --sort-section=name is specified.
701         * layout.cc (Layout::make_output_section):
702         Add sorting by name when --sort-section=name is specified.
703         * testsuite/Makefile.am (text_section_grouping): Test option
704         --sort-section=name.
705         * testsuite/Makefile.in: Regenerate.
706         * testsuite/section_sorting_name.cc: New file.
707         * testsuite/section_sorting_name.sh: New file.
708
709 2013-05-21  Cary Coutant  <ccoutant@google.com>
710
711         * symtab.h (Symbol::is_cxx_vtable): New function.
712         * target-reloc.h (relocate_section): Check for vtable symbol.
713         * testsuite/Makefile.am (missing_key_func.sh): New test case.
714         * testsuite/Makefile.in: Regenerate.
715         * testsuite/missing_key_func.cc: New test source.
716         * testsuite/missing_key_func.sh: New test script.
717
718 2013-05-21  Cary Coutant  <ccoutant@google.com>
719
720         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
721         type of enclosing symbol.
722         (Relocate_info::location): Check symbol type when describing symbol.
723         * object.h (Symbol_location_info): Remove unused line_number;
724         add enclosing_symbol_type.
725         * testsuite/debug_msg.sh: Adjust expected output.
726
727 2013-05-13  Cary Coutant  <ccoutant@google.com>
728
729         * configure.ac: Export DEFAULT_TARGET.
730         * configure: Regenerate.
731         * Makefile.in: Regenerate.
732         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
733         * testsuite/Makefile.in: Regenerate.
734         * testsuite/debug_msg.sh: Delete duplicate tests.
735         Don't check undef_int error message match for powerpc where the
736         source file and line number aren't available.
737
738 2013-05-10  Roland McGrath  <mcgrathr@google.com>
739
740         * options.h (General_options): Add --rosegment-gap option.
741         * options.cc (finalize): --rosegment-gap implies --rosegment.
742         * layout.cc (set_segment_offsets): Let user option override
743         target->rosegment_gap().
744
745 2013-05-10  Roland McGrath  <mcgrathr@google.com>
746
747         * options.h (General_options): Remove leading space from help
748         messages for -nostdlib and --rosegment.
749
750 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
751
752         PR ld/15365
753         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
754
755 2013-05-03  Alan Modra  <amodra@gmail.com>
756
757         * merge.cc (Output_merge_string::do_add_input_section): Correct
758         scan for number of strings.  Rename vars to avoid shadowing.
759         Include missing terminator in input_size_.
760
761 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
762
763         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
764         Restore empty string handling.
765
766 2013-05-01  Cary Coutant  <ccoutant@google.com>
767
768         * stringpool.cc (Stringpool_template::new_key_offset): Fix
769         uninitialized warning.
770
771 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
772
773         * output.cc (Output_section::add_merge_input_section): Allow
774         to merge sections if the alignment is more than character size.
775         * merge.h (Output_merge_string::Output_merge_string): Remove
776         assert.
777         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
778         only not-null strings. Check the alignment of strings.
779         * stringpool.h
780         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
781         alignment as the argument.
782         (Stringpool_template<Stringpool_char>::addralign_): New class member.
783         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
784         Align non-zero length strings according to the addralign_.
785         (Stringpool_template<Stringpool_char>::set_string_offsets):
786         Updating offsets according to the given alignment.
787         * testsuite/Makefile.am (text_section_grouping): Test if string
788         literals are getting merged.
789         * testsuite/Makefile.in: Regenerate.
790         * testsuite/merge_string_literals_1.c: New file.
791         * testsuite/merge_string_literals_2.c: Ditto.
792         * testsuite/merge_string_literals.sh: Ditto.
793
794 2013-04-26  Ian Lance Taylor  <iant@google.com>
795
796         * target-reloc.h (relocate_section): If the reloc offset is out of
797         range, pass VIEW as NULL to relocate.relocate.
798         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
799         * i386.cc (Target_i386::Relocate::relocate): Likewise.
800         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
801         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
802         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
803         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
804
805 2013-04-26  Geoff Pike  <gpike@chromium.org>
806
807         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
808         * layout.cc (Hash_task): New class.
809         (Layout::queue_build_id_tasks): New function.
810         (Layout::write_build_id): Handle single-thread portion of build ID
811         computation.  (In some cases, all of it is single-threaded.)  Replace
812         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
813         functionality in fewer lines of code.
814         * layout.h (Layout::queue_build_id_tasks): New function declaration.
815         * options.h (General_options): make "--build-id" default to tree
816         rather than sha1.  Add two new options related to --build-id=tree:
817         --build-id-chunk-size-for-treehash and
818         --build-id-min-file-size-for-treehash.
819         * Makefile.am: add testing of --build-id=tree and related new options
820         (these tests will be invoked by "make check").
821         * Makefile.in: Regenerate.
822
823 2013-04-25  Alan Modra  <amodra@gmail.com>
824
825         * configure.tgt: Add powerpcle and powerpc64le.
826
827 2013-04-22  Alan Modra  <amodra@gmail.com>
828
829         PR gold/15355
830         * layout.cc (Layout::segment_precedes): Allow more than one
831         segment with the same type and flags.
832
833 2013-04-15  Cary Coutant  <ccoutant@google.com>
834
835         * layout.cc (Layout::set_relocatable_section_offsets): Don't
836         allocate space in file for BSS sections.
837
838 2013-04-15  Cary Coutant  <ccoutant@google.com>
839
840         * script-sections.cc (Orphan_output_section): Reset address
841         to zero after each orphaned section for relocatable links.
842
843 2013-04-15  Cary Coutant  <ccoutant@google.com>
844
845         * symtab.cc (Symbol_table::sized_write_globals): Subtract
846         section starting address for relocatable link.
847         * testsuite/Makefile.am (script_test_11): New test.
848         * testsuite/Makefile.in: Regenerate.
849         * testsuite/script_test_11.c: New source file.
850         * testsuite/script_test_11.t: New linker script.
851
852 2013-04-13  Alan Modra  <amodra@gmail.com>
853
854         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
855         owner when sections are not adjacent and exceed group size.
856         (Target_powerpc::group_sections): Handle corner case.
857         (Target_powerpc::Branch_info::make_stub): Handle case where
858         stub table doesn't exist due to branches in non-exec sections.
859         (Target_powerpc::Relocate::relocate): Likewise.
860
861 2013-04-11  Alan Modra  <amodra@gmail.com>
862
863         PR gold/15354
864         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
865         .branch_lt to match bfd ld.  Adjust comments throughout file.
866
867 2013-04-04  Ian Lance Taylor  <iant@google.com>
868
869         GCC PR c++/56840
870         * object.cc (do_layout_deferred_sections): Handle .eh_frame
871         sections before checking whether they are included in the link.
872
873 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
874
875         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
876         object before calling the plugin claim_file handler.  Pass the elf
877         object of the archive to the plugin. Delete the elf object if the
878         plugin claims the file.
879
880 2013-03-21  Alan Modra  <amodra@gmail.com>
881
882         * layout.cc (Layout::set_segment_offsets): Accept writable .text
883         segment when omagic.
884
885 2013-03-21  Alan Modra  <amodra@gmail.com>
886
887         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
888         comparison warning.
889         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
890         uninitialized" warning.
891
892 2013-03-20  Alan Modra  <amodra@gmail.com>
893
894         * symtab.h (Symbol::clear_version): New function.
895         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
896         is_needed by weak references.  Clear version for symbols defined
897         in as-needed objects that are not needed.
898
899 2013-03-15  Alan Modra  <amodra@gmail.com>
900
901         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
902         static and public.  Add report_err param.  Return false for data refs.
903         (Target_powerpc::rela_dyn_section): New overloaded function.
904         (Target_powerpc::plt_, iplt_): Elucidate.
905         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
906         (Output_data_plt_powerpc::do_write): Don't write .iplt.
907         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
908         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
909         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
910         push_branch and make_plt_entry for ifunc syms when
911         reloc_needs_plt_for_ifunc.
912         (Target_powerpc::Relocate::relocate): Don't use plt entry value
913         for ifunc unless reloc_needs_plt_for_ifunc.
914
915 2013-03-15  Alan Modra  <amodra@gmail.com>
916
917         * gc.h (gc_process_relocs): Don't look through function descriptors.
918         * icf.cc (get_section_contents): Do so here instead.
919
920 2013-03-13  Alan Modra  <amodra@gmail.com>
921
922         * powerpc.cc (is_branch_reloc): Forward declare.
923         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
924         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
925         false for 64-bit, true for 32-bit non-branch relocs.
926         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
927         * testsuite/Makefile.am (icf_test): Use linker map file instead of
928         nm output.
929         (icf_safe_test): Generate linker map file as well as nm output.
930         (icf_safe_so_test): Likewise.
931         * testsuite/Makefile.in: Regenerate.
932         * testsuite/icf_test.sh: Parse linker map file to determine
933         section folding.
934         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
935         * testsuite/icf_safe_so_test.sh: Likewise.
936         (X86_32_or_ARM_specific_safe_fold): Merge into..
937         (arch_specific_safe_fold): ..this.
938         (X86_64_specific_safe_fold): Delete unused function.
939
940 2013-03-12  Alan Modra  <amodra@gmail.com>
941
942         * gc.h (gc_process_relocs): Look through function descriptors
943         to determine shndx, symvalue and addend used by ICF.  Tidy
944         variable duplication.
945
946 2013-03-11  Alan Modra  <amodra@gmail.com>
947
948         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
949         * layout.cc (Layout_task_runner::run): ..to here.
950         * symtab.h (struct Symbol_location): Extract from..
951         (class Symbol_table): ..here.
952         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
953         * target.h (class Target): Add function_location and
954         do_function_location functions.
955         (class Sized_target): Add do_function_location.
956         * object.h (class Sized_relobj_file): Move find_shdr..
957         (class Object): ..to here.
958         * object.cc: Likewise.  Update to suit.  Instantiate.
959         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
960         * powerpc.cc (class Powerpc_dynobj): New.
961         (Target_powerpc::do_function_location): New function.
962         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
963         (Powerpc_dynobj::do_read_symbols): New function.
964         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
965
966 2013-03-08  Ian Lance Taylor  <iant@google.com>
967
968         * options.cc (General_options::string_to_object_format): Accept
969         "default".
970
971 2013-03-08  Alan Modra  <amodra@gmail.com>
972
973         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
974         pointer to Post_fde.
975         (struct Post_fde): Move definition to here..
976         * ehframe.cc (struct Post_fde): ..from here.
977         (Cie::write): Don't alloc Post_fde.
978         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
979
980 2013-03-07  Alan Modra  <amodra@gmail.com>
981
982         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
983         relocation referencing .LC0.
984         * testsuite/discard_locals_test.sh: Remove FIXMEs.
985
986 2013-03-07  Alan Modra  <amodra@gmail.com>
987
988         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
989         always_inline.  Add assembly for powerpc to avoid GOT.
990
991 2013-03-07  Alan Modra  <amodra@gmail.com>
992
993         * testsuite/script_test_10.sh: Don't test .bss section
994         header number.
995
996 2013-03-06  Alan Modra  <amodra@gmail.com>
997
998         * powerpc.cc (class Powerpc_relobj): Move some member functions.
999         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1000         all callers.  Handle folded sections.
1001         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1002         to Powerpc_relobj.
1003         (Global_symbol_visitor_opd::operator()): Likewise.
1004
1005 2013-03-04  Alan Modra  <amodra@gmail.com>
1006
1007         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1008         * testsuite/Makefile.in: Regenerate.
1009
1010 2013-03-01  Cary Coutant  <ccoutant@google.com>
1011
1012         Add dwp support for v2 DWARF package file format.
1013         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1014         tu_length parameter.  Adjust all callers.
1015         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1016         * dwp.cc: Include dwarf.h.
1017         (Section_bounds): New struct type.
1018         (Unit_set): New struct type.
1019         (Dwo_file::Dwo_file): Initialize new data member.
1020         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1021         Combine and rename to...
1022         (Dwo_file::read_unit_index): ...this.
1023         (Dwo_file::sized_read_compunit_index)
1024         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1025         (Dwo_file::sized_read_unit_index): ...this.
1026         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1027         parameters; add section_id parameter.
1028         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1029         (Dwo_file::add_unit_set): ...this.
1030         (Dwo_file::shndx_map_): Remove.
1031         (Dwo_file::sect_offsets_): New data member.
1032         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1033         (Dwp_output_file::add_section): Rename to...
1034         (Dwp_output_file::add_contribution): ...this.
1035         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1036         (Dwp_output_file::add_tu_set): Likewise.
1037         (Dwp_output_file::Contribution): New type.
1038         (Dwp_output_file::Section::contributions): New data member.
1039         (Dwp_output_file::Cu_or_tu_set): Remove.
1040         (Dwp_output_file::Section::Section): New ctor.
1041         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1042         (Dwp_output_file::Dwp_index::Section_table): New type.
1043         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1044         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1045         parameter.
1046         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1047         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1048         (Dwp_output_file::Dwp_index::section_table): New member function.
1049         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1050         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1051         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1052         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1053         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1054         (Dwp_output_file::Dwp_index::section_table_): New data member.
1055         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1056         (Dwp_output_file::add_output_section): New member function.
1057         (Dwp_output_file::write_new_section): New member function.
1058         (Dwp_output_file::write_contributions): New member function.
1059         (Dwp_output_file::section_id_map_): New data member.
1060         (class Dwo_id_info_reader): Remove.
1061         (class Unit_reader): New class.
1062         (get_dwarf_section_name): New function.
1063         (Dwo_file::read_executable): Adjust initializations of class data.
1064         (Dwo_file::read): Add support for v2 package file format.
1065         (Dwo_file::read_unit_index): Likewise.
1066         (Dwo_file::sized_read_unit_index): Likewise.
1067         (Dwo_file::copy_section): Likewise.
1068         (Dwo_file::add_unit_set): Likewise.
1069         (Dwp_output_file::add_output_section): Likewise.
1070         (Dwp_output_file::add_contribution): Likewise.
1071         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1072         for empty slot.
1073         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1074         file format.
1075         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1076         slot.
1077         (Dwp_output_file::initialize): Remove unused function.
1078         (Dwp_output_file::finalize): Add support for v2 package file format.
1079         (Dwp_output_file::write_index): Likewise.
1080         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1081         function prototype.
1082
1083 2013-03-01  Cary Coutant  <ccoutant@google.com>
1084
1085         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1086         function into class definition in header file.
1087         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1088         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1089         New function.
1090         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1091
1092 2013-02-28  Alan Modra  <amodra@gmail.com>
1093
1094         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1095         * target.cc (Target::do_plt_fde_location): New function.
1096         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1097         accessor function, and constructor param.
1098         (struct Post_fde, Post_fdes): Declare.
1099         (Cie::write): Add post_fdes param.
1100         * ehframe.cc (Fde::write): Use plt_fde_location.
1101         (struct Post_fde): Define.
1102         (Cie::write): Stash FDEs added post merge mapping.
1103         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1104         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1105         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1106         other FDEs.
1107         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1108         (Target_powerpc::has_glink): New function.
1109         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1110         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1111         glink_eh_frame_fde_32, default_fde): New data.
1112         (Stub_table::eh_frame_added_): New var.
1113         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1114         Make const.
1115         (Stub_table::add_eh_frame): New function.
1116         (Output_data_glink::add_eh_frame): New function.
1117         (Target_powerpc::make_glink_section): Call add_eh_frame.
1118
1119 2013-02-15  Ian Lance Taylor  <iant@google.com>
1120
1121         * options.h (DEFINE_uint64_alias): Define.
1122         (class General_options): Add -Ttext-segment as an alias for
1123         -Ttext.
1124
1125 2013-02-15  Alan Modra  <amodra@gmail.com>
1126
1127         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1128         (Stub_table::do_write): ..here, two places.
1129         (Stub_table::plt_call_size): Use it here too.
1130
1131 2013-02-11  Ian Lance Taylor  <iant@google.com>
1132
1133         * descriptors.cc (Descriptors::close_all): New function.
1134         * descriptors.h (class Descriptors): Declare close_all.
1135         (close_all_descriptors): New inline function.
1136         * plugin.cc: Include "descriptors.h".
1137         (Plugin_manager::cleanup): Call close_all_descriptors.
1138
1139 2013-02-06  Alan Modra  <amodra@gmail.com>
1140
1141         * README: Update coding style link.
1142
1143 2013-01-28  Cary Coutant  <ccoutant@google.com>
1144
1145         * dwp.cc (File_list): New typedef.
1146         (Dwo_name_info_reader): New class.
1147         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1148         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1149         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1150         (Dwo_file::read_executable): New function.
1151         (Dwo_file::read): Move common setup code to ...
1152         (Dwo_file::make_object): ... here.
1153         (dwp_options): Add --exec/-e.
1154         (usage): Likewise.
1155         (main): Likewise.
1156
1157 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1158
1159         * layout.cc (Layout::layout): Check for option text_reorder.
1160         (Layout::make_output_section): Ditto.
1161         * options.h (text_reorder): New option.
1162         * output.cc (Input_section_sort_compare): Remove special ordering
1163         of section names.
1164         (Output_section::
1165          Input_section_sort_section_name_special_ordering_compare::
1166          operator()): New function.
1167         (Output_section::sort_attached_input_sections): Use new sort function
1168         for .text.
1169         * output.h (Input_section_sort_section_name_special_ordering_compare):
1170         New struct.
1171         * testsuite/Makefile.am (text_section_grouping): Test option
1172         --no-text-reorder
1173         * testsuite/Makefile.in: Regenerate.
1174         * testsuite/text_section_grouping.sh: Check order of functions without
1175         default text reordering.
1176
1177 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1178
1179         * options.h (General_options): Change default to true for new_dtags.
1180
1181 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1182
1183         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1184         when enable_new_dtags is false.  Only add DT_RUNPATH when
1185         enable_new_dtags is true.
1186
1187 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1188
1189         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1190         used in declaration and definition consistent.
1191         (Target_powerpc::symval_for_branch): Ditto.
1192
1193 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1194
1195         * testsuite/plugin_final_layout.cc: Fix comment.
1196
1197 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1198
1199         * layout.cc (Layout::layout): Do not do default sorting for
1200         text sections when section ordering is specified.
1201         (make_output_section): Ditto.
1202         * testsuite/plugin_final_layout.cc: Name the function sections
1203         to catch reordering issues.
1204
1205 2013-01-15  Alan Modra  <amodra@gmail.com>
1206
1207         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1208         plt-thread-safe.
1209
1210 2013-01-15  Alan Modra  <amodra@gmail.com>
1211
1212         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1213         * testsuite/Makefile.in: Regenerate.
1214
1215 2013-01-14  Alan Modra  <amodra@gmail.com>
1216
1217         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1218         * testsuite/Makefile.in: Regenerate.
1219
1220 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1221
1222         PR bfd/14430
1223         Fix mingw gold build with plugins enabled
1224         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1225         * configure.ac: Export DLOPEN_LIBS and add headers check.
1226         * plugin.cc: Handle non-dlfcn case.
1227         * Makefile.in: Regenerate.
1228         * config.in: Regenerate.
1229         * configure: Regenerate.
1230         * testsuite/Makefile.in: Regenerate.
1231
1232 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1233
1234         * output.h (sort_attached_input_sections): Change to be public.
1235         * script-sections.cc
1236         (Output_section_definition::set_section_addresses): Sort
1237         attached input sections according to section order before linker
1238         script assigns section addresses.
1239         (Orphan_output_section::set_section_addresses): Sort
1240         attached input sections according to section order before linker
1241         script assigns section addresses.
1242         * Makefile.am (final_layout.sh): Use a simple linker script to
1243         check if section ordering still works.
1244         * Makefile.in: Regenerate.
1245
1246 2013-01-09  Ben Cheng  <bccheng@google.com>
1247
1248         * arm.cc (Target_arm::attributes_accept_div): New function.
1249         (Target_arm::attributes_forbid_div): New function.
1250         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1251         attribute using the same new functions as what bfd/elf32_arm.c
1252         does.
1253
1254 2013-01-07  Cary Coutant  <ccoutant@google.com>
1255
1256         PR gold/14993
1257         * output.cc (Output_section::add_input_section): For incremental
1258         updates, don't track input sections that are allocated from patch
1259         space.
1260
1261 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1262             Ian Lance Taylor  <iant@google.com>
1263
1264         PR gold/14897
1265         * configure.ac (--enable-ld): Removed.
1266         (install_as_default): Set to yes only for --enable-gold=default
1267         or --disable-ld.
1268         * configure: Regenerated.
1269
1270 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1271
1272         * options.h (General_options): Add -fuse-ld= for GCC linker
1273         option compatibility.
1274
1275 2013-01-04  Cary Coutant  <ccoutant@google.com>
1276
1277         * configure.ac: Fix typo restoring CXXFLAGS.
1278         * configure: Regenerate.
1279
1280 2013-01-04  Cary Coutant  <ccoutant@google.com>
1281
1282         * testsuite/Makefile.am (CXXLINK_S): New macro.
1283         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1284         * testsuite/Makefile.in: Regenerate.
1285
1286 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1287
1288         * version.cc (print_version): Update copyright year to 2013.
1289
1290 2012-12-20  Ian Lance Taylor  <iant@google.com>
1291
1292         * layout.cc (Layout::special_ordering_of_input_section): New
1293         function.
1294         (Layout::layout): If input section requires special ordering, must
1295         sort input sections.
1296         (Layout::make_output_section): May sort .text input sections.
1297         (Layout::is_section_name_prefix_grouped): Remove.
1298         * layout.h (class Layout): Declare
1299         special_ordering_of_input_section.  Don't declare
1300         is_section_name_prefix_grouped.
1301         * output.cc (Output_section::add_input_section): Revert last
1302         change.
1303         (Output_section::Input_section_sort::match_file_name): Don't crash
1304         if called on output section data.
1305         (Output_section::Input_section_sort_compare): Sort based on
1306         special ordering.
1307         (Output_section::Input_section_sort_section_order_index_compare):
1308         Revert last patch.
1309         (Output_section::sort_attached_input_sections): Likewise.
1310
1311 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1312
1313         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1314         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1315         * output.cc (Output_section::add_input_section): Check if section
1316         name contains special prefix.  Keep input sections to sort such
1317         sections.
1318         (Output_section::Input_section_sort_section_order_index_compare
1319          ::operator()): Group sections according to prefixes.
1320         (Output_section::sort_attached_input_sections): Add condition to
1321         Input_section_entry constructor call.
1322         * testsuite/Makefile.am (text_section_grouping): New test.
1323         * testsuite/Makefile.in: Regenerate.
1324         * testsuite/text_section_grouping.cc: New file.
1325         * testsuite/text_section_grouping.sh: New file.
1326
1327 2012-12-17  Nick Clifton  <nickc@redhat.com>
1328
1329         * Makefile.am: Add copyright notice.
1330         * NEWS: Likewise.
1331         * README: Likewise.
1332         * configure.ac: Likewise.
1333         * ftruncate.c: Likewise.
1334         * Makefile.in: Regenerate.
1335
1336 2012-12-14  Cary Coutant  <ccoutant@google.com>
1337
1338         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1339         --no-as-needed flag.
1340         (exception_separate_shared_12_test): Likewise.
1341         (incremental_copy_test): Likewise.
1342         * testsuite/Makefile.in: Regenerate.
1343
1344 2012-12-14  Cary Coutant  <ccoutant@google.com>
1345
1346         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1347         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1348
1349 2012-12-12  Alan Modra  <amodra@gmail.com>
1350
1351         * powerpc.cc (class Track_tls): New.
1352         (class Relocate, class Scan): Inherit Track_tls.
1353         (Target_powerpc::Scan::local, global): Track tls optimization
1354         and avoid creating plt entry for __tls_get_addr if all uses
1355         are optimized away.
1356         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1357
1358 2012-12-12  Alan Modra  <amodra@gmail.com>
1359
1360         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1361         Replace no_toc_optimize with toc_optimize.
1362         * output.h (Output_section::input_sections): Provide non-const variant.
1363         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1364         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1365         accessors.
1366         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1367         (class Sort_toc_sections): New.
1368         (Target_powerpc::do_finalize_sections): Sort toc sections.
1369         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1370
1371 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1372
1373         * testsuite/binary_unittest.cc (read_all): New function.
1374         (Sized_binary_test): Use it instead of ::read.
1375         * fileread.cc (do_read): Don't assume pread always reads the whole
1376         amount in a single call.
1377
1378 2012-12-10  Alan Modra  <amodra@gmail.com>
1379
1380         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1381         Set EM_PPC64 or EM_PPC here.
1382         (Target_selector_powerpc::do_recognize): Delete.
1383
1384 2012-12-10  Alan Modra  <amodra@gmail.com>
1385
1386         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1387         stub_table_.
1388         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1389
1390 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1391
1392         * testsuite/binary_unittest.cc (Sized_binary_test):
1393         Use open_descriptor rather than ::open.
1394
1395 2012-12-07  Alan Modra  <amodra@gmail.com>
1396
1397         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1398         typedef and invalid_address constant.
1399         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1400         instantiate constants.
1401
1402 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1403
1404         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1405         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1406         * aclocal.m4: Regenerate.
1407         * configure: Regenerate.
1408         * Makefile.in: Regenerate.
1409         * testsuite/Makefile.in: Regenerate.
1410
1411 2012-12-07  Alan Modra  <amodra@gmail.com>
1412
1413         * options.h (General_options): Add no_toc_optimize.
1414         * powerpc.cc (ok_lo_toc_insn): New function.
1415         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1416
1417 2012-12-06  Alan Modra  <amodra@gmail.com>
1418
1419         * options.h (General_options): Add plt_align, plt_static_chain,
1420         plt_thread_safe.  Update stub_group_size help text.
1421         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1422         for new plt_thread_safe_ var.
1423         (use_plt_offset): Correct comments.
1424         (Target_powerpc::do_relax): Look for thread creation symbols to
1425         determine default plt_thread_safe value.  Clear plt call stubs
1426         as well as branch stubs each iteration.
1427         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1428         insn constants.
1429         (l, hi, ha, write_insn): Move earlier.
1430         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1431         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1432         plt stubs too.
1433         (Stub_table::update_size): Adjust.
1434         (Stub_table::prev_size, set_prev_size): Delete.
1435         (Stub_table::stub_align): Let --plt-align affect result.
1436         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1437         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1438         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1439         (Stub_table::do_write): Support more stub variants.
1440
1441 2012-12-04  Alan Modra  <amodra@gmail.com>
1442
1443         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1444         (Target_powerpc::do_define_standard_symbols): New function.
1445
1446 2012-12-03  Alan Modra  <amodra@gmail.com>
1447
1448         * output.h: Formatting, whitespace.
1449
1450 2012-12-03  Alan Modra  <amodra@gmail.com>
1451
1452         * layout.h (Layout::get_executable_sections): Declare.
1453         * layout.cc (Layout::get_executable_sections): New function.
1454         * arm.cc (Target_arm::group_sections): Use it.
1455         (Arm_output_section::group_sections): Delete now redundant test.
1456         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1457         param to handle relative relocs.
1458         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1459         (Output_data_reloc::add_absolute): Adjust.
1460         (Output_data_reloc::add_relative): New function.
1461         (Output_data::reset_data_size): New function.
1462         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1463         (Output_section::set_addralign): New function.
1464         (Output_section::checkpoint_set_addralign): New function.
1465         (Output_section::clear_section_offsets_need_adjustment): New function.
1466         (Output_section::input_sections): Make public.
1467         * powerpc.cc (class Output_data_brlt_powerpc): New.
1468         (class Stub_table, class Stub_control): New.
1469         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1470         stub_table_, set_stub_table, stub_table): New vectors and accessor
1471         functions.
1472         (Target_powerpc::do_may_relax, do_relax, push_branch,
1473         new_stub_table, stub_tables, brlt_section, group_sections,
1474         add_branch_lookup_table, find_branch_lookup_table,
1475         write_branch_lookup_table, make_brlt_section): New functions.
1476         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1477         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1478         branch_info_): New vars.
1479         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1480         make call stubs here.
1481         (Output_data_glink): Remove all call stub handling from this class.
1482         (Target_powerpc::Scan::local, global): Save interesting branch
1483         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1484         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1485         functions on final link.
1486         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1487         Handle long branch destinations too.
1488         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1489         do_plt_address_for_local): Adjust lookup of plt call stubs.
1490
1491 2012-11-30  Alan Modra  <amodra@gmail.com>
1492
1493         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1494         relocs against protected symbols when building 32-bit shared libs.
1495
1496 2012-11-30  Alan Modra  <amodra@gmail.com>
1497
1498         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1499         param.  Call got_section() to make .got.  Update all callers
1500         and their callers and so on.
1501
1502 2012-11-30  Alan Modra  <amodra@gmail.com>
1503
1504         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1505         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1506         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1507         value if it already exists.
1508
1509 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1510
1511         PR gold/14858
1512         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1513
1514 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1515
1516         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1517         than bfc instruction for data sandboxing.
1518
1519 2012-11-08  Alan Modra  <amodra@gmail.com>
1520
1521         * po/POTFILES.in: Regenerate.
1522
1523 2012-11-05  Alan Modra  <amodra@gmail.com>
1524
1525         * configure.ac: Apply 2012-09-10 change to config.in here.
1526         * configure: Regenerate.
1527
1528 2012-11-05  Alan Modra  <amodra@gmail.com>
1529
1530         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1531         (struct Opd_ent): Use "Address" rather than "Offset".
1532         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1533         (Target_powerpc::got_section): Make public.
1534         (Target_powerpc::scan_relocs): Move code setting symbols..
1535         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1536         Create _SDA_BASE_ only when referenced.
1537
1538 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1539
1540         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1541         from last change.
1542
1543 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1544
1545         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1546         for offset_in_output_section parameter.
1547         (Sized_target::relocate_special_relocatable): Likewise.
1548         * arm.cc (Target_arm::relocate_relocs): Likewise.
1549         (Target_arm::relocate_special_relocatable): Likewise.
1550         * i386.cc (Target_i386::relocate_relocs): Likewise.
1551         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1552         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1553         * target-reloc.h (relocate_relocs): Likewise.
1554         * testsuite/testfile.cc (Target_test): Likewise.
1555         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1556         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1557
1558         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1559         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1560
1561         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1562         parameter, which is unused in the [!F_SETFD] case.
1563
1564         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1565         SYMNDX to off_t before comparing it to this->data_size().
1566         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1567         * incremental.cc (Output_section_incremental_inputs::do_write):
1568         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1569
1570         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1571
1572 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1573
1574         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1575         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1576         in EABI_VER5.
1577
1578 2012-10-29  Cary Coutant  <ccoutant@google.com>
1579
1580         * dwp.cc (usage): Add file and exit status parameters;
1581         add --help and --version options.
1582         (print_version): New function.
1583         (main): Add --help and --version options.
1584
1585 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1586
1587         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1588         final_layout_sequence.txt.
1589         * testsuite/Makefile.in: Regenerated.
1590
1591 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1592
1593         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1594         COMPILE generated by automake.
1595         (LINK1): Likewise.
1596         (CXXCOMPILE1): Likewise.
1597         (CXXLINK1): Likewise.
1598         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1599         (LINK): Likewise.
1600         (CXXCOMPILE): Likewise.
1601         (CXXLINK): Likewise.
1602         * testsuite/Makefile.in: Regenerated.
1603
1604 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1605
1606         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1607         on bad fwrite return.
1608
1609 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1610
1611         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1612         on val.
1613
1614 2012-10-23  Cary Coutant  <ccoutant@google.com>
1615
1616         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1617         * testsuite/Makefile.in: Regenerate.
1618         * testsuite/dwp_test.h: New source file.
1619         * testsuite/dwp_test_1.cc: New source file.
1620         * testsuite/dwp_test_1.s: New source file.
1621         * testsuite/dwp_test_1.sh: New source file.
1622         * testsuite/dwp_test_1b.cc: New source file.
1623         * testsuite/dwp_test_1b.s: New source file.
1624         * testsuite/dwp_test_2.cc: New source file.
1625         * testsuite/dwp_test_2.s: New source file.
1626         * testsuite/dwp_test_2.sh: New source file.
1627         * testsuite/dwp_test_main.cc: New source file.
1628         * testsuite/dwp_test_main.s: New source file.
1629
1630 2012-10-23  Cary Coutant  <ccoutant@google.com>
1631
1632         * dwp.h: New header file.
1633         * dwp.cc: New source file.
1634         * gold.h: Move shared declarations to system.h.
1635         * system.h: New header file.
1636         * Makefile.am: Add dwp.
1637         * Makefile.in: Regenerate.
1638
1639 2012-10-23  Cary Coutant  <ccoutant@google.com>
1640
1641         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1642         Dwarf_info_reader::read_from_pointer.
1643         (Dwarf_pubnames_table::read_header): Likewise.
1644         (Dwarf_pubnames_table::next_name): Likewise.
1645         (Dwarf_die::read_attributes): Likewise.
1646         (Dwarf_die::skip_attributes): Likewise.
1647         (Dwarf_info_reader::read_from_pointer): New function template.
1648         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1649         (Dwarf_pubnames_table): Likewise.
1650         (Dwarf_info_reader::read_from_pointer): New function template.
1651         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1652         Dwarf_pubnames_table ctor.
1653
1654 2012-10-23  Cary Coutant  <ccoutant@google.com>
1655
1656         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1657         abbrev_shndx.
1658         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1659         abbrev_shndx_.
1660         (Dwarf_info_reader::set_abbrev_shndx): New method.
1661         (Dwarf_info_reader::abbrev_shndx_): New data member.
1662
1663 2012-10-23  Cary Coutant  <ccoutant@google.com>
1664
1665         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1666         from object, not parameters.
1667         (Dwarf_info_reader::parse): Likewise.
1668         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1669         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1670         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1671         methods.
1672
1673 2012-10-23  Cary Coutant  <ccoutant@google.com>
1674
1675         * fileread.cc (Input_file::Input_file): New constructor.
1676         * fileread.h (class Input_file): Add new constructor.
1677
1678 2012-10-18  Alan Modra  <amodra@gmail.com>
1679
1680         PR gold/14727
1681         * object.cc (Relobj::is_section_name_included): Also match
1682         .sdata personality section.
1683
1684 2012-10-18  Alan Modra  <amodra@gmail.com>
1685
1686         * target-reloc.h (class Default_comdat_behavior): New, package up..
1687         (get_comdat_behaviour): ..this.
1688         (relocate_section): Add Relocate_comdat_behavior template arg,
1689         adjust code to suit.
1690         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1691         (Target_arm::scan_reloc_section): Likewise.
1692         * i386.cc (Target_i386::relocate_section): Likewise.
1693         * sparc.cc (Target_sparc::relocate_section): Likewise.
1694         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1695         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1696         * powerpc.cc (class Relocate_comdat_behavior): New.
1697         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1698         gold::relocate_section with new template arg.
1699
1700 2012-10-18  Alan Modra  <amodra@gmail.com>
1701
1702         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1703         dynamic relocs for GOT_TPREL got entries, without symbol if
1704         resolving locally.
1705         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1706         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1707         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1708
1709 2012-10-17  Alan Modra  <amodra@gmail.com>
1710
1711         PR gold/14726
1712         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1713
1714 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1715
1716         * layout.cc (Layout::include_section): Keep sections marked
1717         SHF_EXCLUDE when doing relocatable links.
1718
1719 2012-10-16  Alan Modra  <amodra@gmail.com>
1720
1721         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1722         (Target_powerpc::do_finalize_sections): Call it.
1723         (Output_data_save_res): New class and supporting functions.
1724         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1725         normal symbols defined in object files.
1726
1727 2012-10-12  Alan Modra  <amodra@gmail.com>
1728
1729         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1730         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1731         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1732         section if scan_opd_relocs not yet called.
1733         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1734
1735 2012-10-12  Alan Modra  <amodra@gmail.com>
1736
1737         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1738         add_local_ifunc_entry): Revert last change.
1739         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1740
1741 2012-10-05  Alan Modra  <amodra@gmail.com>
1742
1743         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1744         do_plt_address_for_global): New functions.
1745         (Output_data_got_powerpc::do_write): Don't segfault when linking
1746         statically.
1747         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1748         add_local_ifunc_entry): Return true on adding entry..
1749         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1750         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1751         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1752         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1753         set up symbols here.
1754         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1755         syms here.  Do so even when no .iplt.  Don't segfault when linking
1756         statically.
1757         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1758         new variants without reloc param.
1759         (Glink_sym_ent::Glink_sym_ent): Likewise.
1760         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1761         reloc when refs will resolve to plt call stub.
1762         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1763         R_PPC_PLTREL24 to resolve locally.
1764         (Target_powerpc::Scan::global): Correct ifunc handling.
1765         (Target_powerpc::Relocate::relocate): Correct local sym glink
1766         lookup.  Don't destroy "value" when we have a plt call stub,
1767         and when checking plt call validity.
1768         (Target_powerpc::do_dynsym_value): Simplify.
1769
1770 2012-10-05  Alan Modra  <amodra@gmail.com>
1771
1772         * i386.cc (Output_data_plt_i386::address_for_global,
1773         address_for_local): Add plt offset to returned value.  Adjust uses.
1774         * sparc.cc (Output_data_plt_sparc::address_for_global,
1775         address_for_local): Likewise.
1776         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1777         address_for_local): Likewise.
1778         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1779         address_for_local): Likewise.
1780         * target.h (Target::plt_address_for_global, plt_address_for_local):
1781         Update comment.
1782         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1783         (Output_data_got::Got_entry::write): Nor here.
1784         * output.h: Comment fix.
1785
1786 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1787
1788         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1789         global_offset_table_ value for larget got.
1790         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1791
1792 2012-09-29  Alan Modra  <amodra@gmail.com>
1793
1794         * powerpc.cc (Target_powerpc::iplt_): New output section.
1795         (Target_powerpc::iplt_section, make_iplt_section,
1796         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1797         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1798         Target_powerpc::plt_entry_count): Count iplt entries too.
1799         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1800         reloc section in constructor.  New params.
1801         (Target_powerpc::make_plt_section): Create reloc section here instead.
1802         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1803         functions.
1804         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1805         (Output_data_glink::add_entry, find_entry): New functions to
1806         deal with local syms.
1807         (Glink_sym_ent): Add support for local syms.
1808         (Output_data_glink::do_write): Handle ifunc plt entries.
1809         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1810         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1811         (Target_powerpc::Relocate::relocate): Likewise.
1812         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1813
1814 2012-09-25  Alan Modra  <amodra@gmail.com>
1815
1816         * object.h (Sized_relobj_file::adjust_local_symbol,
1817         do_adjust_local_symbol): New functions.
1818         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1819         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1820         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1821         and irregular opd entry spacing.
1822         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1823         (Global_symbol_visitor_opd): New functor.
1824         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1825         on deleted opd entries.
1826
1827 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1828
1829         * tilegx.cc: New file.
1830         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1831         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1832         * configure.tgt: Add entries for tilegx*.
1833         * configure.ac: Likewise.
1834         * Makefile.in: Rebuild.
1835         * configure: Likewise.
1836         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1837         tilegx.
1838
1839 2012-09-13  Alan Modra  <amodra@gmail.com>
1840
1841         * target-reloc.h (scan_relocs): Call scan.local for relocs
1842         against symbols in discarded sections.  Pass is_discarded
1843         param.
1844         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1845         Add is_discarded param.
1846         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1847         is_discarded to flag opd entry as discarded.  Don't emit dyn
1848         relocs on such entries.
1849         (Target_powerpc::Scan::global): Similarly detect and handle
1850         such opd entries.
1851         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1852         opd_ent_.  Update all uses.
1853         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1854         (Target_powerpc::relocate_section): Zero out discarded opd
1855         entry relocs.
1856
1857 2012-09-12  Ian Lance Taylor  <iant@google.com>
1858
1859         PR gold/14570
1860         * output.cc: Rename Output_data_got template parameter from size
1861         to got_size for all functions.  Compile all variants of
1862         Output_data_got.
1863         (Output_data_got::Got_entry::write): Correct use of size for
1864         symbol value.  Use local_is_tls rather than casting to
1865         Sized_relobj_file.
1866         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1867         (class Sized_relobj_file): Add do_local_is_tls.
1868         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1869
1870 2012-09-11  Alan Modra  <amodra@gmail.com>
1871
1872         PR gold/14566
1873         * layout.cc (Layout::set_segment_offsets): When using
1874         common-page-size alignment, ensure we are on a new max-page-size
1875         page.
1876         * output.cc (Output_segment::set_section_addresses): Use
1877         abi_pagesize, not common_pagesize for relro boundary.
1878         (Output_segment::set_offset): Likewise.
1879
1880 2012-09-11  Alan Modra  <amodra@gmail.com>
1881
1882         * output.h (Output_data_got::add_global_tls, add_local_tls,
1883         add_local_tls_pair): New functions.
1884         (Output_data_got::add_local_pair_with_rel): Remove second
1885         reloc param.  Expand comment.
1886         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1887         use_plt_or_tls_offset_, similarly for constructor param.
1888         (Output_data_got::Got_entry::write): Add got_index param.
1889         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1890         add_local_tls_pair): New functions.
1891         (Output_data_got::Got_entry::write): Handle tls symbols
1892         with use_plt_or_tls_offset_ set specially.
1893         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1894         (Output_data_got::do_write): Replace iterator with index, pass
1895         index to entry write function.
1896         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1897         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1898         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1899         call.
1900         * i386.cc (Target_i386::Scan::local): Likewise.
1901         * sparc.cc (Target_sparc::Scan::local): Likewise.
1902         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1903         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1904         do_tls_offset_for_global): New functions.
1905         (Target_powerpc::Scan::local): Correct TLS relocations and got
1906         entry values.
1907         (Target_powerpc::Scan::global): Don't emit unnecessary
1908         dynamic relocations on TLS GOT entries.
1909
1910 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1911
1912         * config.in: Disable sanity check for kfreebsd.
1913
1914 2012-09-10  Sterling Augustine  <saugustine@google.com>
1915
1916         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1917         (Gdb_index::pubtypes_read): New parameter.
1918         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1919         to calls.
1920         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1921         pubtypes_object_.
1922
1923 2012-09-09  Alan Modra  <amodra@gmail.com>
1924
1925         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1926         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1927         * gc.h (gc_process_relocs): Call target gc_add_reference.
1928         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1929         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1930         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1931         unnecessary cast.
1932         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1933         to cater for when we don't need code offset.  Update use.
1934         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1935         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1936         set_opd_valid): New functions.
1937         (Target_powerpc::do_gc_add_reference): New function.
1938         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1939         stashed refs.
1940         (Target_powerpc::do_gc_mark_symbol): New function.
1941
1942 2012-09-06  Cary Coutant  <ccoutant@google.com>
1943
1944         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1945         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1946         (Dwarf_die::skip_attributes): Likewise.
1947         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1948         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1949         (main): Call it.
1950         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1951
1952 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1953
1954         * testsuite/script_test_3.t: Add .got.plt output section
1955         statement.
1956         * testsuite/script_test_4.t: Likewise.
1957
1958 2012-09-05  Alan Modra  <amodra@gmail.com>
1959
1960         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1961         update all uses and lose "enum" when using type.
1962
1963 2012-09-05  Alan Modra  <amodra@gmail.com>
1964
1965         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1966         * configure: Regenerate.
1967         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1968         (plugin_final_layout.stdout): Likewise.
1969         (memory_test): Set page sizes to 0x1000.
1970         * testsuite/Makefile.in: Regenerate.
1971         * testsuite/discard_locals_test.sh: Add FIXME comment.
1972         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1973         * testsuite/pr14265.t: Add .got output section statement.
1974         * testsuite/script_test_2.t: Likewise.
1975         * testsuite/script_test_3.t: Likewise.
1976         * testsuite/script_test_4.t: Likewise.
1977         * testsuite/script_test_5.t: Likewise.
1978         * testsuite/script_test_6.t: Likewise.
1979         * testsuite/script_test_7.t: Likewise.
1980         * testsuite/script_test_9.t: Likewise.
1981
1982 2012-09-05  Alan Modra  <amodra@gmail.com>
1983
1984         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1985         (Powerpc_relocate_functions::Status): New typedef.
1986         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1987         (Target_powerpc::Scan::local): Handle REL64.
1988         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1989         for REL32 and REL64.
1990         (Target_powerpc::symval_for_branch): New function, extracted from..
1991         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1992         checks.  Report overflow errors.
1993
1994 2012-09-05  Alan Modra  <amodra@gmail.com>
1995
1996         * object.h (Sized_relobj_file::emit_relocs): Delete.
1997         (Sized_relobj_file::emit_relocs_reltype): Delete.
1998         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1999         relocate_relocs for --emit-relocs.
2000         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2001         * output.h: Update comment.
2002         (Output_segment::first_section): New function.
2003         (Output_segment::first_section_load_address): Use first_section.
2004         * output.cc (Output_segment::first_section): New function extracted..
2005         (Output_segment::first_section_load_address): ..from here.  Delete.
2006         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2007         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2008         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2009         adjust call to target.h function.
2010         * i386.cc (Target_i386): Likewise.
2011         * sparc.cc (Target_sparc): Likewise.
2012         * x86_64.cc (Target_x86_64): Likewise.
2013         * powerpc.cc (Target_powerpc): Likewise.
2014         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2015         first tls section has section symbol for optimised local dynamic
2016         output relocs.
2017         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2018         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2019         optimised tls code.
2020         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2021         Rename to relocate_relocs.  Update error message.
2022
2023 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2024
2025         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2026         --just-symbols.
2027
2028 2012-08-31  Alan Modra  <amodra@gmail.com>
2029
2030         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2031         (Powerpc_relobj::toc_base_offset): New stub function.
2032         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2033         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2034         (Target_powerpc::Relocate::enum skip_tls): New.
2035         (Target_powerpc::call_tls_get_addr_): New var.
2036         (Target_powerpc::is_branch_reloc): Move to file scope.
2037         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2038         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2039         New functions.
2040         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2041         (powerpc_info): Correct common_pagesize for ppc64.
2042         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2043         (Powerpc_relocate_functions): Add overflow check enums and functions.
2044         Add non-shift version of rela, rela_ua.  Delete all rel public
2045         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2046         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2047         addr16_ha3, addr14 functions.
2048         (Output_data_got_powerpc::add_constant_pair): New function.
2049         (Output_data_got_powerpc::got_base_offset): Likewise.
2050         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2051         (instruction constants): Sort, add some more.
2052         (Output_data_glink::do_write): Add and use Address typedef.  Use
2053         object->toc_base_offset() stub for 64-bit.
2054         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2055         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2056         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2057         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2058         Always treat .opd relocs as against locally defined symbol.
2059         Correct condition for RELATIVE relocs.
2060         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2061         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2062         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2063         calculations.  Handle TLS relocs, and more.  Add overflow
2064         checking and adjust for Powerpc_relocate_functions changes.
2065         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2066         Reinstate --emit-relocs code with FIXME.
2067
2068 2012-08-30  Alan Modra  <amodra@gmail.com>
2069
2070         * layout.cc (Layout::set_segment_offsets): Set p_align to
2071         abi_pagesize, not common_pagesize.
2072         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2073         to determine whether file header can go in segment.
2074
2075 2012-08-30  Alan Modra  <amodra@gmail.com>
2076
2077         * output.h (Output_reloc::Output_reloc <output section>): Add
2078         is_relative param.  Adjust calls.
2079         (Output_reloc::add_output_section_relative): New functions.
2080         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2081         is_relative.
2082         (Output_reloc::symbol_value): Handle SECTION_CODE.
2083
2084 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2085
2086         * gold.cc (queue_middle_tasks): Call layout again when unique
2087         segments for sections is desired.
2088         * layout.cc (Layout::Layout): Initialize new members.
2089         (Layout::get_output_section_flags): New function.
2090         (Layout::choose_output_section): Call get_output_section_flags.
2091         (Layout::layout): Make output section for mapping to a unique segment.
2092         (Layout::insert_section_segment_map): New function.
2093         (Layout::attach_allocated_section_to_segment): Make unique segment for
2094         output sections marked so.
2095         (Layout::segment_precedes): Check for unique segments when sorting.
2096         * layout.h (Layout::Unique_segment_info): New struct.
2097         (Layout::Section_segment_map): New typedef.
2098         (Layout::insert_section_segment_map): New function.
2099         (Layout::get_output_section_flags): New function.
2100         (Layout::is_unique_segment_for_sections_specified): New function.
2101         (Layout::set_unique_segment_for_sections_specified): New function.
2102         (Layout::unique_segment_for_sections_specified_): New member.
2103         (Layout::section_segment_map_): New member.
2104         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2105         Rename is_gc_pass_one to is_pass_one.
2106         Rename is_gc_pass_two to is_pass_two.
2107         Rename is_gc_or_icf to is_two_pass.
2108         Check for which pass based on whether symbols data is present.
2109         Make it two pass when unique segments for sections is desired.
2110         * output.cc (Output_section::Output_section): Initialize new
2111         members.
2112         * output.h (Output_section::is_unique_segment): New function.
2113         (Output_section::set_is_unique_segment): New function.
2114         (Output_section::is_unique_segment_): New member.
2115         (Output_section::extra_segment_flags): New function.
2116         (Output_section::set_extra_segment_flags): New function.
2117         (Output_section::extra_segment_flags_): New member.
2118         (Output_section::segment_alignment): New function.
2119         (Output_section::set_segment_alignment): New function.
2120         (Output_section::segment_alignment_): New member.
2121         (Output_segment::Output_segment): Initialize is_unique_segment_.
2122         (Output_segment::is_unique_segment): New function.
2123         (Output_segment::set_is_unique_segment): New function.
2124         (Output_segment::is_unique_segment_): New member.
2125         * plugin.cc (allow_unique_segment_for_sections): New function.
2126         (unique_segment_for_sections): New function.
2127         (Plugin::load): Add new functions to transfer vector.
2128         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2129         * Makefile.in: Regenerate.
2130         * testsuite/plugin_final_layout.sh: Check if unique segment
2131         functionality works.
2132         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2133         are available.
2134         (allow_unique_segment_for_sections): New global.
2135         (unique_segment_for_sections): New global.
2136         (claim_file_hook): Call allow_unique_segment_for_sections.
2137         (all_symbols_read_hook): Call unique_segment_for_sections.
2138
2139 2012-08-22  Cary Coutant  <ccoutant@google.com>
2140
2141         * layout.cc (Layout::include_section): Don't assert on GROUP
2142         sections with --emit-relocs.
2143
2144 2012-08-21  Cary Coutant  <ccoutant@google.com>
2145
2146         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2147         if --export-dynamic-symbol names an undef symbol.
2148
2149 2012-08-18  Alan Modra  <amodra@gmail.com>
2150
2151         * powerpc.cc: Formatting and white space.
2152         (Powerpc_relobj): Rename got2_section_ to special_.
2153         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2154         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2155         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2156         (Target_powerpc): Add Address typedef and invalid_address.  Use
2157         throughout.
2158         (Target_powerpc::is_branch_reloc): New function.
2159         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2160         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2161         for dst_mask, value and addend.
2162         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2163         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2164         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2165         uint16_t for 24-bit offset.  Use get_output_section_offset and
2166         check return.
2167         (Target_powerpc::Scan::local): Handle more relocs.
2168         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2169         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2170         Plug in toc restoring insn after plt calls.  Translate branches
2171         to function descriptor symbols to corresponding entry point.
2172         (Target_powerpc::relocate_for_relocatable): Check return from
2173         get_output_section_offset.
2174         * symtab.h: Comment typo.
2175
2176 2012-08-14  Ian Lance Taylor  <iant@google.com>
2177
2178         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2179         unsupported_relocal_local to call unsupported_reloc_global.
2180
2181 2012-08-14  Nick Clifton  <nickc@redhat.com>
2182
2183         PR ld/14265
2184         * script-sections.cc (Sections_element::output_section_name): Add
2185         keep return parameter.
2186         (Output_section_element::match_name): Add keep return parameter.
2187         Return the value of the keep_ member.
2188         * script-sections.h (class Output_section): Update
2189         output_section_name prototype.
2190         * layout.cc (Layout::keep_input_section): New public member
2191         function.
2192         (Layout::choose_output_section): Pass keep parameter to
2193         output_section_name.
2194         * layout.h (class Layout): Add keep_input_section.
2195         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2196         sections.
2197         * testsuite/Makefile.am: Add a test.
2198         * testsuite/Makefile.in: Regenerate.
2199         * testsuite/pr14265.c: Source file for the test.
2200         * testsuite/pr14265.t: Linker script for the test.
2201         * testsuite/pr14265.sh: Shell script for the test.
2202
2203 2012-08-14  Alan Modra  <amodra@gmail.com>
2204
2205         * target.h (Target::output_section_name): New function.
2206         (Target::do_output_section_name): New function.
2207         * layout.cc (Layout::choose_output_section): Call the above.
2208         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2209
2210 2012-08-14  Alan Modra  <amodra@gmail.com>
2211
2212         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2213         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2214         for replace_constant call.
2215         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2216         (Output_data_glink::do_print_to_mapfile): New function.
2217         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2218         (Target_powerpc::Relocate::relocate): Likewise.
2219
2220 2012-08-14  Alan Modra  <amodra@gmail.com>
2221
2222         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2223         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2224         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2225         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2226         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2227         here.
2228         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2229         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2230         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2231         here.
2232         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2233         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2234
2235 2012-08-12  Alan Modra  <amodra@gmail.com>
2236
2237         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2238         (glink insn constants): Use uint32_t.
2239         (Output_data_glink::add_entry): Use insert, not [] operator.
2240
2241 2012-08-11  Alan Modra  <amodra@gmail.com>
2242
2243         * object.h (Sized_relobj_file::find_shdr): New function.
2244         (Sized_relobj_file::find_special_sections): New function.
2245         * object.cc (Sized_relobj_file::find_shdr): New function.
2246         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2247         (Sized_relobj_file::find_special_sections): New function, split out..
2248         (Sized_relobj_file::do_read_symbols): ..from here.
2249         * output.h (Output_data_got::replace_constant): New function.
2250         (Output_data_got::num_entries): New function.
2251         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2252         (Output_data_got::got_offset): Protected rather than private.
2253         (Output_data_got::replace_got_entry): New function.
2254         * output.cc (Output_data_got::replace_got_entry): New function.
2255         * powerpc.cc (class Powerpc_relobj): New.
2256         (class Powerpc_relocate_functions): Delete all psymval variants or
2257         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2258         Implement _ha functions using corresponding _hi function.
2259         (Powerpc_relobj::find_special_sections): New function.
2260         (Target_powerpc::do_make_elf_object): New function.
2261         (class Output_data_got_powerpc): New.
2262         (class Output_data_glink): New.
2263         (class Powerpc_scan_relocatable_reloc): New.
2264         Many more changes througout file.
2265
2266 2012-08-09  Nick Clifton  <nickc@redhat.com>
2267
2268         * po/vi.po: Updated Vietnamese translation.
2269
2270 2012-08-07  Ian Lance Taylor  <iant@google.com>
2271
2272         * layout.cc (Layout::add_target_dynamic_tags): If
2273         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2274         plt_rel.
2275
2276 2012-07-30  Nick Clifton  <nickc@redhat.com>
2277
2278         * po/gold.pot: Updated template.
2279         * po/es.po: Updated Spanish translation.
2280
2281 2012-07-18  Cary Coutant  <ccoutant@google.com>
2282
2283         PR gold/14344
2284         * configure.ac: Add check for -gpubnames support.
2285         * configure: Regenerate.
2286         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2287         support; force -gno-pubnames.
2288         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2289         support.
2290         (gdb_index_test_4): New test.
2291         * testsuite/Makefile.in: Regenerate.
2292         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2293         * testsuite/gdb_index_test_2.sh: Likewise.
2294         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2295         * testsuite/gdb_index_test_4.sh: New script.
2296         * testsuite/gdb_index_test_comm.sh: New script with common code;
2297         don't look for space after colon.
2298
2299 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2300
2301         * gold.cc (queue_middle_tasks): Update function order only after
2302         deferred objects due to plugins are processed.
2303
2304 2012-07-11  Ian Lance Taylor  <iant@google.com>
2305
2306         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2307         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2308         (Target_arm::scan_reloc_for_stub): Likewise.
2309         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2310         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2311         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2312         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2313         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2314
2315 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2316             Ian Lance Taylor  <iant@google.com>
2317
2318         PR gold/14309
2319         * configure.ac: Test whether std::tr1::hash<off_t> works.
2320         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2321         needed.
2322         * output.h (class Output_fill): Add virtual destructor.
2323         * configure, config.in: Rebuild.
2324
2325 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2326
2327         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2328
2329 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2330
2331         * plugin.cc (Plugin::load): Handle position independent executables.
2332
2333 2012-06-06  Cary Coutant  <ccoutant@google.com>
2334
2335         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2336         add .debug_macro.
2337         (lines_only_debug_sections): Likewise.
2338         (gdb_fast_lookup_sections): New static array.
2339         (is_gdb_debug_section): Rename formal parameter.
2340         (is_lines_only_debug_section): Likewise.
2341         (is_gdb_fast_lookup_section): New function.
2342         (Layout::include_section): Check for ".zdebug_" prefix; pass
2343         section name suffix to is_gdb_debug_section, et al.; check for
2344         fast-lookup sections when building .gdb_index.
2345         * options.h (--strip-debug-gdb): Update GDB version number.
2346
2347 2012-06-06  Cary Coutant  <ccoutant@google.com>
2348
2349         * configure.ac: Add check for fallocate.
2350         * configure: Regenerate.
2351         * config.in: Regenerate.
2352
2353         * options.h (class General_options): Add --mmap-output-file and
2354         --posix-fallocate options.
2355         * output.cc: (posix_fallocate): Remove; replace with...
2356         (gold_fallocate): New function.
2357         (Output_file::map_no_anonymous): Call gold_fallocate.
2358         (Output_file::map): Check --mmap-output-file option.
2359
2360 2012-06-05  Jing Yu  <jingyu@google.com>
2361
2362         * gold.h (textdomain): Add do {} to empty while(0).
2363         (bindtextdomain): Likewise.
2364
2365 2012-06-04  Cary Coutant  <ccoutant@google.com>
2366
2367         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2368         has_dynsym_index.
2369
2370 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2371
2372         * symtab.cc (Symbol_table::define_special_symbol):
2373         Initialize *poldsym to prevent uninitialized variable errors.
2374
2375 2012-05-23  Cary Coutant  <ccoutant@google.com>
2376
2377         * layout.cc (Layout::section_name_mapping): Add rules to handle
2378         exact match on .data.rel.ro.local or .data.rel.ro.
2379         (Layout::output_section_name): Check for exact matches.
2380
2381 2012-05-23  Cary Coutant  <ccoutant@google.com>
2382
2383         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2384         more carefully.
2385
2386 2012-05-22  Cary Coutant  <ccoutant@google.com>
2387
2388         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2389         object before exporting symbol.
2390
2391 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2392
2393         * testsuite/tls_test.cc: Include "config.h" first.
2394         * testsuite/tls_test_c.c: Likewise.
2395
2396 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2397             Nick Clifton  <nickc@redhat.com>
2398
2399         PR 14072
2400         * configure.in: Add check that sysdep.h has been included before
2401         any system header files.
2402         * configure: Regenerate.
2403         * config.in: Regenerate.
2404
2405 2012-05-14  Cary Coutant  <ccoutant@google.com>
2406
2407         * layout.cc (Layout::make_output_section): Mark .tdata section
2408         as RELRO.
2409         * testsuite/relro_test.cc: Add a TLS variable.
2410
2411 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2412
2413         PR gold/14091
2414         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2415         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2416         R_X86_64_64.
2417
2418 2012-05-08  Cary Coutant  <ccoutant@google.com>
2419
2420         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2421         (lines_only_debug_sections): Likewise.
2422
2423 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2424
2425         * nacl.cc: New file.
2426         * nacl.h: New file.
2427         * Makefile.am (CCFILES, HFILES): Add them.
2428         * Makefile.in: Regenerate.
2429         * i386.cc (Output_data_plt_i386_nacl): New class.
2430         (Output_data_plt_i386_nacl_exec): New class.
2431         (Output_data_plt_i386_nacl_dyn): New class.
2432         (Target_i386_nacl): New class.
2433         (Target_selector_i386_nacl): New class.
2434         (target_selector_i386): Use it instead of Target_selector_i386.
2435         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2436         (Target_x86_64_nacl): New class.
2437         (Target_selector_x86_64_nacl): New class.
2438         (target_selector_x86_64, target_selector_x32): Use it instead of
2439         Target_selector_x86_64.
2440         * arm.cc (Output_data_plt_arm_nacl): New class.
2441         (Target_arm_nacl): New class.
2442         (Target_selector_arm_nacl): New class.
2443         (target_selector_arm, target_selector_armbe): Use it instead of
2444         Target_selector_arm.
2445
2446         * target-select.cc (select_target): Take new Input_file* and off_t
2447         arguments, pass them on to recognize method of selector.
2448         * object.cc (make_elf_sized_object): Update caller.
2449         * parameters.cc (parameters_force_valid_target): Likewise.
2450         * incremental.cc (make_sized_incremental_binary): Likewise.
2451         * target-select.h: Update decl.
2452         (Target_selector::recognize): Take new Input_file* argument,
2453         pass it on to do_recognize.
2454         (Target_selector::do_recognize): Take new Input_file* argument.
2455         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2456         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2457         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2458         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2459
2460         * target.h (Target::Target_info): New members isolate_execinstr
2461         and rosegment_gap.
2462         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2463         * arm.cc (Target_arm::arm_info): Update initializer.
2464         * i386.cc (Target_i386::i386_info): Likewise.
2465         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2466         * sparc.cc (Target_sparc::sparc_info): Likewise.
2467         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2468         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2469         * layout.cc (Layout::attach_allocated_section_to_segment):
2470         Take new const Target* argument.  If target->isolate_execinstr(), act
2471         like --rosegment.
2472         (Layout::find_first_load_seg): Take new const Target* argument;
2473         if target->isolate_execinstr(), reject PF_X segments.
2474         (Layout::relaxation_loop_body): Update caller.
2475         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2476         reset file offset to zero when we hit LOAD_SEG, and then do a second
2477         loop over the segments before LOAD_SEG to reassign offsets after
2478         addresses have been determined.  Handle target->rosegment_gap().
2479         (Layout::attach_section_to_segment): Take new const Target* argument;
2480         pass it to attach_allocated_section_to_segment.
2481         (Layout::make_output_section): Update caller.
2482         (Layout::attach_sections_to_segments): Take new const Target* argument;
2483         pass it to attach_section_to_segment.
2484         * gold.cc (queue_middle_tasks): Update caller.
2485         * layout.h (Layout): Update method decls with new arguments.
2486
2487         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2488         Target_info pointer to use.
2489         (Target_arm::do_make_data_plt): New virtual method.
2490         (Target_arm::make_data_plt): New method that calls it.
2491         (Target_arm::make_plt_entry): Use it.
2492         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2493         for the section alignment.
2494         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2495         method.
2496         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2497         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2498         method.
2499         (Output_data_plt_arm::get_plt_entry_size): Call it.
2500         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2501         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2502         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2503         method.
2504         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2505         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2506         method instead of sizeof(plt_entry).
2507         (Output_data_plt_arm::add_entry): Likewise.
2508         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2509         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2510         than static method.
2511         (Target_arm::plt_entry_size): Likewise.
2512         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2513         Move to ...
2514         (Output_data_plt_arm_standard): ... here, new class.
2515         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2516         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2517         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2518
2519         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2520         Take additional argument for the PLT entry size.
2521         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2522         Use get_plt_entry_size method rather than plt_entry_size variable.
2523         (Output_data_plt_x86_64::reserve_slot): Likewise.
2524         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2525         (Output_data_plt_x86_64::add_entry): Likewise.
2526         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2527         (Output_data_plt_x86_64::address_for_global): Likewise.
2528         (Output_data_plt_x86_64::address_for_local): Likewise.
2529         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2530         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2531         Make method non-static.
2532         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2533         method.
2534         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2535         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2536         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2537         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2538         virtual method.
2539         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2540         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2541         virtual method.
2542         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2543         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2544         virtual method.
2545         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2546         (Output_data_plt_x86_64::plt_entry_size)
2547         (Output_data_plt_x86_64::first_plt_entry)
2548         (Output_data_plt_x86_64::plt_entry)
2549         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2550         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2551         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2552         (Output_data_plt_x86_64_standard): ... here, new class.
2553         (Target_x86_64::Target_x86_64): Take optional argument for the
2554         Target_info pointer to use.
2555         (Target_x86_64::do_make_data_plt): New virtual method.
2556         (Target_x86_64::make_data_plt): New method to call it.
2557         (Target_x86_64::init_got_plt_for_update): Use that.
2558         Call this->plt_->add_eh_frame method here.
2559         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2560         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2561         rather than static method.
2562         (Target_x86_64::plt_entry_size): Likewise.
2563         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2564         rather than plt_entry_size variable.  Move guts of PLT filling to...
2565         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2566         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2567         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2568
2569         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2570         additional argument for the section alignment.
2571         Don't do add_eh_frame_for_plt here.
2572         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2573         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2574         variable.
2575         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2576         method.
2577         (Output_data_plt_i386::get_plt_entry_size): Call it.
2578         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2579         (Output_data_plt_i386::add_eh_frame): New method to call it.
2580         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2581         method.
2582         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2583         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2584         method.
2585         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2586         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2587         method instead of plt_entry_size.
2588         (Output_data_plt_i386::plt_entry_size)
2589         (Output_data_plt_i386::plt_eh_frame_fde_size)
2590         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2591         (Output_data_plt_i386_standard): ... here, new class.
2592         (Output_data_plt_i386_exec): New class.
2593         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2594         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2595         (Output_data_plt_i386::exec_plt_entry): Move to ...
2596         (Output_data_plt_i386_exec::plt_entry): ... here.
2597         (Output_data_plt_i386_dyn): New class.
2598         (Output_data_plt_i386::first_plt_entry): Move to ...
2599         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2600         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2601         (Output_data_plt_i386_dyn::plt_entry): ... here.
2602         (Target_i386::Target_i386): Take optional argument for the Target_info
2603         pointer to use.
2604         (Target_i386::do_make_data_plt): New virtual method.
2605         (Target_i386::make_data_plt): New method to call it.
2606         (Target_i386::make_plt_section): Use that.
2607         Call this->plt_->add_eh_frame method here.
2608         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2609         rather than plt_entry_size variable.
2610         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2611         (Output_data_plt_i386::address_for_local): Likewise.
2612         (Output_data_plt_i386::do_write): Likewise.
2613         Move guts of PLT filling to...
2614         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2615         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2616         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2617         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2618
2619 2012-05-01  Cary Coutant  <ccoutant@google.com>
2620
2621         * dwarf_reader.cc (Dwarf_die::read_attributes)
2622         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2623         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2624         * reduced_debug_output.cc
2625         (Output_reduced_debug_info_section::get_die_end): Remove
2626         DW_FORM_GNU_ref_index.  Add default case.
2627
2628 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2629
2630         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2631         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2632         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2633         DW_AT_high_pc as offset from DW_AT_low_pc.
2634
2635         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2636         * testsuite/Makefile.in: Regenerate.
2637         * testsuite/gdb_index_test_3.c: New test source file.
2638         * testsuite/gdb_index_test_3.sh: New test source file.
2639
2640 2012-04-25  Ian Lance Taylor  <iant@google.com>
2641
2642         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2643         pointer.
2644         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2645         as a class, not a struct.
2646         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2647         (Target_arm::apply_cortex_a8_workaround): Likewise.
2648         * gc.h: Declare Reloc_types as a struct, not a class.
2649         * object.h: Declare Symbols_data as a struct.
2650         * reloc.h: Declare Read_relocs_data as a struct.
2651         * target.h: Declare Relocate_info as a struct.
2652
2653 2012-04-24  David S. Miller  <davem@davemloft.net>
2654
2655         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2656         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2657         and R_SPARC_WPLT30.
2658
2659 2012-04-24  Cary Coutant  <ccoutant@google.com>
2660
2661         * incremental-dump.cc (find_input_containing_global): Replace
2662         magic number with symbolic constant.
2663         (dump_incremental_inputs): Update version number.
2664         * incremental.cc (Output_section_incremental_inputs): Update version
2665         number; import symbolic constants from Incremental_inputs_reader.
2666         (Incremental_inputs::create_data_sections): Align relocations
2667         section correctly for 64-bit targets.
2668         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2669         constants; add padding.
2670         (Output_section_incremental_inputs::write_header): Add assert for
2671         header_size.
2672         (Output_section_incremental_inputs::write_input_files): Add assert
2673         for input_entry_size.
2674         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2675         add assert for object_info_size, input_section_entry_size,
2676         global_sym_entry_size.
2677         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2678         for data structure sizes; use them.
2679         (Incremental_input_entry_reader): Import symbolic constants from
2680         Incremental_inputs_reader; use them.
2681
2682 2012-04-23  David S. Miller  <davem@davemloft.net>
2683
2684         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2685         and elf_flags_set_.
2686         (Target_sparc::Target_sparc): Initialize new fields.
2687         (Target_sparc::do_make_elf_object): New function.
2688         (Target_sparc::do_adjust_elf_header): New function.
2689
2690 2012-04-23  Cary Coutant  <ccoutant@google.com>
2691
2692         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2693         CU range table of gdb index.
2694
2695 2012-04-20  David S. Miller  <davem@davemloft.net>
2696
2697         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2698         instead of false.
2699
2700 2012-04-16  David S. Miller  <davem@davemloft.net>
2701
2702         * sparc.cc (Target_sparc::got_address): New function.
2703         (Sparc_relocate_functions::gdop_hix22): New function.
2704         (Sparc_relocate_functions::gdop_lox10): New function.
2705         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2706         relocs.
2707         (Target_sparc::Scan::local): Likewise if the global symbol is not
2708         preemptible and is not IFUNC.
2709         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2710         transformations for local and non-preemptible non-IFUNC global
2711         symbols.
2712
2713         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2714         writing out 64-bit part of ranges.
2715
2716         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2717         -fpic and -fpie respectively.
2718         * Makefile.in: Regenerate.
2719
2720         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2721         (Target_sparc::Target_sparc): Initialize new field.
2722         (Target_sparc::do_plt_section_for_global): New function.
2723         (Target_sparc::do_plt_section_for_local): New function.
2724         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2725         (Target_sparc::make_plt_section): New function, broken out of
2726         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2727         (Target_sparc::make_plt_entry): Call make_plt_section.
2728         (Target_sparc::make_local_ifunc_plt_entry): New function.
2729         (Target_sparc::rela_ifunc_section): New function.
2730         (Target_sparc::plt_section): Remove const.
2731         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2732         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2733         and ifunc_count_ fields.
2734         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2735         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2736         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2737         (Output_data_plt_sparc::rela_ifunc): New function.
2738         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2739         (Output_data_plt_sparc::has_ifunc_section): New function.
2740         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2741         (Output_data_plt_sparc::address_for_global): New function.
2742         (Output_data_plt_sparc::address_for_local): New function.
2743         (Output_data_plt_sparc::plt_index_to_offset): New function.
2744         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2745         and entry_count.
2746         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2747         entry_count.
2748         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2749         R_SPARC_JMP_IREL to switch.
2750         (Target_sparc::Scan::check_non_pic): Likewise.
2751         (Target_sparc::Scan::local): Handle IFUNC symbols.
2752         (Target_sparc::Scan::local): Likewise.
2753         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2754         and plt_address_for_local.
2755         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2756         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2757
2758         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2759         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2760         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2761         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2762         global relocs too.
2763         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2764         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2765         calls.
2766         * sparc.cc (Target_sparc::Scan::global): Likewise.
2767         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2768
2769 2012-04-16  Cary Coutant  <ccoutant@google.com>
2770
2771         * archive.cc (Library_base::should_include_member): Check for
2772         --export-dynamic-symbol.
2773         * options.h (class General_options): Add --export-dynamic-symbol.
2774         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2775         --export-dynamic-symbol.
2776         (Symbol_table::gc_mark_undef_symbols): Likewise.
2777         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2778
2779 2012-04-12  David S. Miller  <davem@davemloft.net>
2780
2781         * sparc.cc (Reloc::wdisp10): New relocation method.
2782         (Reloc::h34): Likewise.
2783         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2784         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2785         R_SPARC_WDISP10.
2786         (Target_sparc::Scan::local): Likewise.
2787         (Target_sparc::Scan::global): Likewise.
2788         (Target_sparc::Relocate::relocate): Likewise.
2789
2790 2012-04-09  Cary Coutant  <ccoutant@google.com>
2791
2792         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2793         low_pc == 0.
2794
2795 2012-04-06  Ian Lance Taylor  <iant@google.com>
2796
2797         * timer.cc: #include <unistd.h>.
2798
2799 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2800
2801         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2802         * config.in: Regenerate.
2803         * configure: Regenerate.
2804
2805 2012-04-05  Nick Clifton  <nickc@redhat.com>
2806
2807         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2808         (AM_LC_MESSAGES): Add.
2809         * aclocal.m4: Regenerate.
2810         * config.in: Regenerate.
2811         * configure: Regenerate.
2812
2813 2012-03-21  Cary Coutant  <ccoutant@google.com>
2814
2815         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2816         * Makefile.in: Regenerate.
2817         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2818         (Sized_elf_reloc_mapper::symbol_section): New function.
2819         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2820         (make_elf_reloc_mapper): New function.
2821         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2822         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2823         (Dwarf_abbrev_table::do_get_abbrev): New function.
2824         (Dwarf_ranges_table::read_ranges_table): New function.
2825         (Dwarf_ranges_table::read_range_list): New function.
2826         (Dwarf_pubnames_table::read_section): New function.
2827         (Dwarf_pubnames_table::read_header): New function.
2828         (Dwarf_pubnames_table::next_name): New function.
2829         (Dwarf_die::Dwarf_die): New function.
2830         (Dwarf_die::read_attributes): New function.
2831         (Dwarf_die::skip_attributes): New function.
2832         (Dwarf_die::set_name): New function.
2833         (Dwarf_die::set_linkage_name): New function.
2834         (Dwarf_die::attribute): New function.
2835         (Dwarf_die::string_attribute): New function.
2836         (Dwarf_die::int_attribute): New function.
2837         (Dwarf_die::uint_attribute): New function.
2838         (Dwarf_die::ref_attribute): New function.
2839         (Dwarf_die::child_offset): New function.
2840         (Dwarf_die::sibling_offset): New function.
2841         (Dwarf_info_reader::check_buffer): New function.
2842         (Dwarf_info_reader::parse): New function.
2843         (Dwarf_info_reader::do_parse): New function.
2844         (Dwarf_info_reader::do_read_string_table): New function.
2845         (Dwarf_info_reader::lookup_reloc): New function.
2846         (Dwarf_info_reader::get_string): New function.
2847         (Dwarf_info_reader::visit_compilation_unit): New function.
2848         (Dwarf_info_reader::visit_type_unit): New function.
2849         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2850         Sized_elf_reloc_mapper.
2851         (Sized_dwarf_line_info::symbol_section): Remove function.
2852         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2853         (Sized_dwarf_line_info::read_line_mappings): Remove object
2854         parameter, adjust callers.
2855         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2856         * dwarf_reader.h: Include <sys/types.h>.
2857         (class Track_relocs): Remove forward declaration.
2858         (class Elf_reloc_mapper): New class.
2859         (class Sized_elf_reloc_mapper): New class.
2860         (class Dwarf_abbrev_table): New class.
2861         (class Dwarf_range_list): New class.
2862         (class Dwarf_ranges_table): New class.
2863         (class Dwarf_pubnames_table): New class.
2864         (class Dwarf_die): New class.
2865         (class Dwarf_info_reader): New class.
2866         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2867         (Sized_dwarf_line_info::symbol_section): Remove member function.
2868         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2869         base class.
2870         * gdb-index.cc: New source file.
2871         * gdb-index.h: New source file.
2872         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2873         and .debug_types sections, call Layout::add_to_gdb_index.
2874         (Sized_relobj_incr::do_section_name): Implement.
2875         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2876         return type; Implement.
2877         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2878         return type.
2879         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2880         parameter list and return type.
2881         (Sized_incr_dynobj::do_section_contents): Likewise.
2882         * layout.cc: Include gdb-index.h.
2883         (Layout::Layout): Initialize gdb_index_data_.
2884         (Layout::init_fixed_output_section): Check for .gdb_index section.
2885         (Layout::add_to_gdb_index): New function. Instantiate.
2886         * layout.h: Add forward declaration for class Gdb_index.
2887         (Layout::add_to_gdb_index): New member function.
2888         (Layout::gdb_index_data_): New data member.
2889         * main.cc: Include gdb-index.h.
2890         (main): Print statistics for gdb index.
2891         * object.cc (Object::section_contents): Move code into
2892         do_section_contents.
2893         (need_decompressed_section): Check for sections needed when building
2894         gdb index.
2895         (build_compressed_section_map): Likewise.
2896         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2897         gdb index.
2898         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2899         sections; call Layout::add_to_gdb_index.
2900         (Sized_relobj_file::do_decompressed_section_contents): Call
2901         do_section_contents directly.
2902         * object.h (Object::do_section_contents): Adjust parameter list and
2903         return type.
2904         (Object::do_decompressed_section_contents): Call do_section_contents
2905         directly.
2906         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2907         return type.
2908         * options.h (class General_options): Add --gdb-index option.
2909         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2910         list and return type.
2911         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2912         * reloc.h (Track_relocs::checkpoint): New function.
2913         (Track_relocs::reset): New function.
2914
2915         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2916         New test cases.
2917         * testsuite/Makefile.in: Regenerate.
2918         * testsuite/gdb_index_test.cc: New test source file.
2919         * testsuite/gdb_index_test_1.sh: New test source file.
2920         * testsuite/gdb_index_test_2.sh: New test source file.
2921
2922 2012-03-19  Doug Kwan  <dougkwan@google.com>
2923
2924         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2925         (Target_arm::do_finalize_sections): Remove code which defines
2926         __exidx_start and __exidx_end.  Make symbol table parameter
2927         anonymous as it is not used.
2928         * gold.cc (queue_middle_tasks): Call target hook to define any
2929         target-specific symbols.
2930         * target.h (Target::define_standard_symbols): New method.
2931         (Target::do_define_standard_symbols): Same.
2932         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2933         * testsuite/Makefile.in: Regenerate.
2934         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2935         and __exidx_end.
2936         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2937         relocations are generated for __exidx_start and __exidx_end.
2938
2939 2012-03-16  Doug Kwan  <dougkwan@google.com>
2940
2941         * testsuite/Makefile.am: Disable test initpri3b.
2942         * testsuite/Makefile.in: Regenerate.
2943
2944 2012-03-15  Doug Kwan  <dougkwan@google.com>
2945
2946         * arm.cc (Target_arm::got_section): Make .got section read-only
2947         if -z now is given.
2948
2949 2012-03-15  Ian Lance Taylor  <iant@google.com>
2950
2951         PR gold/13850
2952         * layout.cc (Layout::make_output_section): Correctly mark
2953         SHT_INIT_ARRAY, et. al., as relro.
2954
2955 2012-03-14  Doug Kwan  <dougkwan@google.com>
2956
2957         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2958         dynamic relocations for protected symbols in shared objects.
2959
2960 2012-03-13  Ian Lance Taylor  <iant@google.com>
2961
2962         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2963         keep the larger alignment.
2964
2965 2012-03-12  Cary Coutant  <ccoutant@google.com>
2966
2967         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2968         handling of DW_LNE_define_file.
2969
2970 2012-03-12  Cary Coutant  <ccoutant@google.com>
2971
2972         * reduced_debug_output.cc
2973         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2974         codes to switch.
2975
2976 2012-02-29  Cary Coutant  <ccoutant@google.com>
2977
2978         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2979
2980 2012-02-29  Cary Coutant  <ccoutant@google.com>
2981
2982         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2983         Call Object::decompressed_section_contents.
2984         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2985         New dtor.
2986         (Sized_dwarf_line_info::buffer_start_): New data member.
2987         * merge.cc (Output_merge_data::do_add_input_section): Call
2988         Object::decompressed_section_contents.
2989         (Output_merge_string::do_add_input_section): Likewise.
2990         * object.cc (need_decompressed_section): New function.
2991         (build_compressed_section_map): Decompress sections needed later.
2992         (Sized_relobj_file::do_decompressed_section_contents): New function.
2993         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2994         * object.h (Object::decompressed_section_contents): New function.
2995         (Object::discard_decompressed_sections): New function.
2996         (Object::do_decompressed_section_contents): New function.
2997         (Object::do_discard_decompressed_sections): New function.
2998         (Compressed_section_info): New type.
2999         (Compressed_section_map): Include decompressed section contents.
3000         (Sized_relobj_file::do_decompressed_section_contents): New function.
3001         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3002
3003 2012-02-16  Cary Coutant  <ccoutant@google.com>
3004
3005         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3006         * testsuite/Makefile.in: Regenerate.
3007
3008 2012-02-14  Cary Coutant  <ccoutant@google.com>
3009
3010         * options.cc (General_options::finalize): Disallow -pie and -static.
3011
3012 2012-02-03  Doug Kwan  <dougkwan@google.com>
3013
3014         * arm.cc (Arm_relocate_functions::abs8,
3015         Arm_relocate_functions::abs16): Use
3016         Bits::has_signed_unsigned_overflow32.
3017         (Arm_relocate_functions::thm_abs8): Correct range of
3018         overflow check.
3019         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3020         in assertions.
3021
3022 2012-02-02  Doug Kwan  <dougkwan@google.com>
3023
3024         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3025         position independent outputs, not just shared objects.
3026
3027 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3028
3029         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3030         * configure: Regenerated.
3031
3032 2012-01-27  Ian Lance Taylor  <iant@google.com>
3033
3034         * reloc.h (Bits): New class with static functions, copied from
3035         namespace utils in arm.cc.
3036         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3037         instead.
3038
3039 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3040
3041         * incremental.cc (write_info_blocks): Correct relocation offset.
3042
3043 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3044
3045         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3046         (Relocate::tls_gd_to_le): Likewise.
3047
3048 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3049
3050         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3051
3052 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3053
3054         * configure.ac: Check if -mcmodel=medium works.
3055         * configure: Regenerated.
3056
3057 2012-01-24  Cary Coutant  <ccoutant@google.com>
3058
3059         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3060         definition and ...
3061         (read_unsigned_LEB_128_x): ... this new function.
3062         (read_signed_LEB_128): Replaced with inline definition and ...
3063         (read_signed_LEB_128_x): ... this new function.
3064         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3065         (read_unsigned_LEB_128): Add inline definition.
3066         (read_signed_LEB_128_x): New function.
3067         (read_signed_LEB_128): Add inline definition.
3068         * testsuite/Makefile.am (leb128_unittest): New unit test.
3069         * testsuite/Makefile.in: Regenerate.
3070         * testsuite/leb128_unittest.cc: New unit test.
3071
3072 2012-01-23  Ian Lance Taylor  <iant@google.com>
3073
3074         PR gold/13617
3075         * i386.cc (Target_i386::do_code_fill): When using a jmp
3076         instruction, pad with nop instructions.
3077         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3078
3079 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3080
3081         * x86_64.cc (gc_process_relocs): Add typename on types used in
3082         template.
3083         (scan_relocs): Likewise.
3084         (relocate_section): Likewise.
3085         (apply_relocation): Likewise.
3086
3087 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3088
3089         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3090         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3091         under x32.
3092
3093 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3094
3095         * x86_64.cc: Initial support for x32.
3096
3097 2012-01-03  Cary Coutant  <ccoutant@google.com>
3098
3099         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3100         Use abstract base class for GOT.
3101         * gold/output.h (class Output_data_got_base): New abstract base class.
3102         (class Output_data_got): Derive from new base class, adjust ctors.
3103         (Output_data_got::reserve_slot): Make virtual; rename to
3104         do_reserve_slot; Adjust callers.
3105         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3106         pointer to abstract base class.
3107         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3108
3109 2011-12-18  Ian Lance Taylor  <iant@google.com>
3110
3111         * object.h (Relobj::local_symbol_value): New function.
3112         (Relobj::local_plt_offset): New function.
3113         (Relobj::local_has_got_offset): New function.
3114         (Relobj::local_got_offset): New function.
3115         (Relobj::set_local_got_offset): New function.
3116         (Relobj::do_local_symbol_value): New pure virtual function.
3117         (Relobj::do_local_plt_offset): Likewise.
3118         (Relobj::do_local_has_got_offset): Likewise.
3119         (Relobj::do_local_got_offset): Likewise.
3120         (Relobj::do_set_local_got_offset): Likewise.
3121         (Sized_relobj::do_local_has_got_offset): Rename from
3122         local_has_got_offset.
3123         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3124         (Sized_relobj::do_set_local_got_offset): Rename from
3125         set_local_got_offset.
3126         (Sized_relobj_file::do_local_plt_offset): Rename from
3127         local_plt_offset.
3128         (Sized_relobj_file::do_local_symbol_value): New function.
3129         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3130         local_plt_offset.
3131         * output.cc (Output_data_got::Got_entry::write): Change object to
3132         Relobj.  Use local_symbol_value.
3133         (Output_data_got::add_global_with_rel): Change rel_dyn to
3134         Output_data_reloc_generic*.  Use add_global_generic.
3135         (Output_data_got::add_global_with_rela): Remove.  Change all
3136         callers to use add_global_with_rel.
3137         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3138         Output_data_reloc_generic*.  Use add_global_generic.
3139         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3140         callers to use add_global_pair_with_rel.
3141         (Output_data_got::add_local): Change object to Relobj*.
3142         (Output_data_got::add_local_plt): Likewise.
3143         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3144         change rel_dyn to Output_data_reloc_generic*.  Use
3145         add_local_generic.
3146         (Output_data_got::add_local_with_rela): Remove.  Change all
3147         callers to use all_local_with_rel.
3148         (Output_data_got::add_local_pair_with_rel): Change object to
3149         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3150         add_output_section_generic.
3151         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3152         callers to use add_local_pair_with_rel.
3153         (Output_data_got::reserve_local): Change object to Relobj*.
3154         * output.h: (class Output_data_reloc_generic): Add pure virtual
3155         declarations for add_global_generic, add_local_generic,
3156         add_output_section_generic.
3157         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3158         functions for Output_data_reloc_generic.  Update declarations for
3159         changes listed in output.cc.
3160         (class Output_data_got): Change template parameter to got_size.
3161         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3162         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3163         function.
3164         (Sized_relobj_incr::do_local_plt_offset): New function.
3165         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3166         add_global_generic.
3167
3168 2011-12-17  Cary Coutant  <ccoutant@google.com>
3169
3170         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3171         * resolve.cc (Symbol_table::resolve): Likewise.
3172         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3173         arrays.
3174         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3175
3176 2011-12-16  Ian Lance Taylor  <iant@google.com>
3177
3178         * output.h (Output_data_reloc_generic::add): Only call
3179         add_dynamic_reloc if this is a dynamic reloc section.
3180
3181 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3182
3183         PR gold/13505
3184         * target-reloc.h (apply_relocation): Replace <64, false> with
3185         <size, big_endian>.
3186
3187 2011-11-25  Nick Clifton  <nickc@redhat.com>
3188
3189         * po/it.po: New Italian translation.
3190
3191 2011-11-17  Sterling Augustine  <saugustine@google.com>
3192
3193         * script.cc (script_include_directive): Implement.
3194         (read_script_file): New local variables name and search_path. Update
3195         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3196         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3197         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3198
3199 2011-11-11  Sterling Augustine  <saugustine@google.com>
3200
3201         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3202         (file_or_sections_cmd): Likewise.
3203
3204 2011-11-11  Doug Kwan  <dougkwan@google.com>
3205
3206         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3207         if --just-symbols is given.
3208
3209 2011-11-10  Doug Kwan  <dougkwan@google.com>
3210
3211         PR gold/13362
3212         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3213         when processing data relocs.
3214         * reloc.h (Relocate_functions::rel_unaligned): New method.
3215         (Relocate_functions::pcrel_unaligned): Ditto.
3216         (Relocate_functions::rel32_unaligned): Ditto.
3217         (Relocate_functions::pcrel32_unaligned): Ditto.
3218
3219 2011-11-09  Doug Kwan  <dougkwan@google.com>
3220
3221         PR gold/13362
3222         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3223         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3224         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3225         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3226         (Relocate_functions::rel_unaligned): New.
3227         (Relocate_functions::rel32_unaligned): New.
3228         * target-reloc.h (relocate_for_relocatable): Add code to handle
3229         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3230         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3231         arm_unaligned_reloc_r): New targets.
3232         * testsuite/Makefile.in: Regenerate.
3233         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3234         linking.
3235
3236 2011-11-02  Ian Lance Taylor  <iant@google.com>
3237
3238         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3239         NATIVE_LINKER.
3240         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3241         * options.cc (General_options::finalize): Use library search path
3242         from configure script if specified.  If not native and no sysroot,
3243         only search TOOLLIBDIR.
3244         * options.h (Search_directory::Search_directory): Change name to
3245         const std::string&.
3246         (General_options::add_to_library_path_with_sysroot): Change arg to
3247         const std::string&.
3248         * configure, Makefile.in, config.in: Rebuild.
3249
3250 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3251
3252         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3253         we are working around the ARM1176 Erratum.
3254         * options.h (General_options::fix_arm1176): Add option.
3255         * testsuite/Makefile.am: Add testcases, and keep current ones
3256         working.
3257         * testsuite/Makefile.in: Regenerate.
3258         * testsuite/arm_fix_1176.s: New file.
3259         * testsuite/arm_fix_1176.sh: Likewise.
3260
3261 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3262
3263         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3264         may_use_blx_.
3265         (Target_arm::may_use_blx): Remove method.
3266         (Target_arm::set_may_use_blx): Likewise.
3267         (Target_arm::may_use_v4t_interworking): New method.
3268         (Target_arm::may_use_v5t_interworking): Likewise.
3269         (Target_arm::may_use_blx_): Remove member variable.
3270         (Arm_relocate_functions::arm_branch_common): Check for v5T
3271         interworking.
3272         (Arm_relocate_functions::thumb_branch_common): Likewise.
3273         (Reloc_stub::stub_type_for_reloc): Likewise.
3274         (Target_arm::do_finalize_sections): Correct interworking checks.
3275         * testsuite/Makefile.am: Add new tests.
3276         * testsuite/Makefile.in: Regenerate.
3277         * testsuite/arm_farcall_arm_arm.s: New test.
3278         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3279         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3280         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3281         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3282         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3283         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3284         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3285
3286 2011-10-31  Cary Coutant  <ccoutant@google.com>
3287
3288         PR gold/13023
3289         * expression.cc (Expression::eval_with_dot): Add
3290         is_section_dot_assignment parameter.
3291         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3292         absolute and assigning to dot within a section.
3293         * script-sections.cc
3294         (Output_section_element_assignment::set_section_addresses): Pass
3295         dot_section to set_if_absolute.
3296         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3297         as is_section_dot_assignment flag to eval_with_dot.
3298         (Output_section_element_dot_assignment::set_section_addresses):
3299         Likewise.
3300         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3301         parameter.  Also set value if relative to dot_section; set the
3302         symbol's output_section.
3303         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3304         parameter.  Adjust all callers.
3305         (Expression::eval_maybe_dot): Likewise.
3306         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3307         Adjust all callers.
3308         * testsuite/script_test_2.t: Test assignment of an absolute value
3309         to dot within an output section element.
3310
3311 2011-10-31  Cary Coutant  <ccoutant@google.com>
3312
3313         * options.h (class General_options): Add --[no-]gnu-unique options.
3314         * symtab.cc (Symbol_table::sized_write_globals): Convert
3315         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3316
3317 2011-10-31  Cary Coutant  <ccoutant@google.com>
3318
3319         PR gold/13359
3320         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3321         unnecessary assertion.
3322         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3323
3324 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3325
3326         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3327         gc_mark_symbol.
3328         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3329         gc_mark_symbol.
3330         Change to just keep the section associated with symbol.
3331         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3332         they are externally visible and --export-dynamic is turned on.
3333         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3334
3335 2011-10-19  Ian Lance Taylor  <iant@google.com>
3336
3337         PR gold/13163
3338         * script-sections.cc
3339         (Output_section_element_dot_assignment::needs_output_section): New
3340         function.
3341
3342 2011-10-19  Ian Lance Taylor  <iant@google.com>
3343
3344         PR gold/13204
3345         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3346         --section-start option was seen.
3347         * options.h (General_options::any_section_start): New function.
3348
3349 2011-10-18  David S. Miller  <davem@davemloft.net>
3350
3351         PR binutils/13301
3352         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3353         member to track relocation locations that have moved during TLS
3354         reloc optimizations.
3355         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3356         (Target_sparc::Relocate::relocate): Adjust view down by 4
3357         bytes if it matches reloc_adjust_addr_.
3358         (Target_sparc::Relocate::relocate_tls): Always move the
3359         __tls_get_addr call delay slot instruction forward 4 bytes when
3360         performing relaxation.
3361
3362 2011-10-18  Cary Coutant  <ccoutant@google.com>
3363
3364         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3365         (Output_file::map_no_anonymous): Check for non-zero
3366         return code from posix_fallocate.
3367
3368 2011-10-17  Cary Coutant  <ccoutant@google.com>
3369
3370         PR gold/13245
3371         * plugin.cc (is_visible_from_outside): Check for symbols
3372         referenced from dynamic objects.
3373         * resolve.cc (Symbol_table::resolve): Don't count references
3374         from dynamic objects as references from real ELF files.
3375         * testsuite/plugin_test_2.sh: Adjust expected result.
3376
3377 2011-10-17  Cary Coutant  <ccoutant@google.com>
3378
3379         * gold.cc: Include timer.h.
3380         (queue_middle_tasks): Stamp time.
3381         (queue_final_tasks): Likewise.
3382         * main.cc (main): Store timer in parameters.  Print timers
3383         for each pass.
3384         * parameters.cc (Parameters::Parameters): Initialize timer_.
3385         (Parameters::set_timer): New function.
3386         (set_parameters_timer): New function.
3387         * parameters.h (Parameters::set_timer): New function.
3388         (Parameters::timer): New function.
3389         (Parameters::timer_): New data member.
3390         (set_parameters_timer): New function.
3391         * timer.cc (Timer::stamp): New function.
3392         (Timer::get_pass_time): New function.
3393         * timer.h (Timer::stamp): New function.
3394         (Timer::get_pass_time): New function.
3395         (Timer::pass_times_): New data member.
3396
3397 2011-10-17  Cary Coutant  <ccoutant@google.com>
3398
3399         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3400         task for members of lib groups.
3401
3402 2011-10-17  Cary Coutant  <ccoutant@google.com>
3403
3404         PR gold/13288
3405         * fileread.cc (File_read::find_view): Add assert.
3406         (File_read::make_view): Move bounds check (replace with assert)...
3407         (File_read::find_or_make_view): ... to here.
3408
3409 2011-10-12  Cary Coutant  <ccoutant@google.com>
3410
3411         * output.cc (Output_file::open_base_file): Handle case where
3412         ::read returns less than requested size.
3413
3414 2011-10-10  Cary Coutant  <ccoutant@google.com>
3415
3416         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3417         Initialize defined_count_.
3418         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3419         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3420         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3421         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3422         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3423         * incremental.h (Sized_relobj_incr::defined_count_): New data
3424         member.
3425         (Sized_incr_dynobj::defined_count_): New data member.
3426         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3427         Return zeroes instead of internal error.
3428
3429 2011-10-10  Cary Coutant  <ccoutant@google.com>
3430
3431         PR gold/13249
3432         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3433         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3434         * output.h (class Output_reloc): Add use_plt_offset flag.
3435         (Output_reloc::type_): Adjust size of bit field.
3436         (Output_reloc::use_plt_offset_): New bit field.
3437         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3438         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3439         flag.  Adjust all callers.
3440         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3441         creating RELATIVE relocations.
3442
3443 2011-10-10  Nick Clifton  <nickc@redhat.com>
3444
3445         * po/es.po: Updated Spanish translation.
3446         * po/fi.po: Updated Finnish translation.
3447
3448 2011-10-03   Diego Novillo  <dnovillo@google.com>
3449
3450         * options.cc (parse_uint): Fix dereference of RETVAL.
3451
3452 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3453
3454         * layout.h (section_order_map_): New member.
3455         (get_section_order_map): New member function.
3456         * output.cc (Output_section::add_input_section): Check for patterns
3457         only when --section-ordering-file is specified.
3458         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3459         output_sections have been formed.
3460         * layout.cc (Layout_Layout): Initialize section_order_map_.
3461         * plugin.cc (update_section_order): Store order in order_map. Do not
3462         update the order.
3463         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3464         * testsuite/Makefile.in: Regenerate.
3465         * testsuite/plugin_section_order.c: New file.
3466         * testsuite/plugin_final_layout.cc: New file.
3467         * testsuite/plugin_final_layout.sh: New file.
3468
3469 2011-09-29  Cary Coutant  <ccoutant@google.com>
3470
3471         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3472         Check for NULL.
3473         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3474         symbols during incremental update.
3475         (Symbol_table::add_from_dynobj): Likewise.
3476
3477 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3478             Ian Lance Taylor  <iant@google.com>
3479
3480         * symtab.cc (Symbol_table::define_special_symbol): Always
3481         canonicalize version string.
3482
3483 2011-09-26  Cary Coutant  <ccoutant@google.com>
3484
3485         * gold.cc (queue_initial_tasks): Move option checks ...
3486         * options.cc (General_options::finalize): ... to here. Disable
3487         some options; make others fatal.
3488
3489 2011-09-26  Cary Coutant  <ccoutant@google.com>
3490
3491         gcc PR lto/47247
3492         * plugin.cc (get_symbols_v2): New function.
3493         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3494         (is_referenced_from_outside): New function.
3495         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3496         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3497         (get_symbols): Pass version parameter.
3498         (get_symbols_v2): New function.
3499         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3500         parameter.
3501         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3502         (onload): Add LDPT_GET_SYMBOLS_V2.
3503         (all_symbols_read_hook): Use get_symbols_v2; check for
3504         LDPR_PREVAILING_DEF_IRONLY_EXP.
3505         * testsuite/plugin_test_3.sh: Update expected results.
3506
3507 2011-09-23  Simon Baldwin  <simonb@google.com>
3508
3509         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3510         configuration options.
3511         * configure: Regenerate.
3512         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3513         * Makefile.in: Regenerate.
3514         * testsuite/Makefile.in: Regenerate.
3515
3516 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3517
3518         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3519
3520 2011-09-19  Cary Coutant  <ccoutant@google.com>
3521
3522         * incremental.cc (can_incremental_update): Fix typo in comment.
3523         * incremental.h (can_incremental_update): Likewise.
3524
3525 2011-09-18  Cary Coutant  <ccoutant@google.com>
3526
3527         * incremental.cc (can_incremental_update): New function.
3528         * incremental.h (can_incremental_update): New function.
3529         * layout.cc (Layout::init_fixed_output_section): Call it.
3530         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3531         * object.cc (Sized_relobj_file::do_layout): Call
3532         can_incremental_update.
3533
3534 2011-09-13  Cary Coutant  <ccoutant@google.com>
3535
3536         * configure.ac: Check for glibc support for gnu_indirect_function
3537         support with static linking, setting automake conditional
3538         IFUNC_STATIC.
3539         * Makefile.in: Regenerate.
3540         * configure: Regenerate.
3541
3542         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3543         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3544         for IFUNC_STATIC.
3545         * testsuite/Makefile.in: Regenerate.
3546
3547 2011-09-13  Cary Coutant  <ccoutant@google.com>
3548
3549         * incremental.cc (Sized_relobj_incr::do_layout): Call
3550         report_comdat_group for kept comdat sections.
3551         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3552         * testsuite/Makefile.in: Regenerate.
3553         * testsuite/incr_comdat_test_1.cc: New source file.
3554         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3555         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3556         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3557
3558 2011-09-13  Ian Lance Taylor  <iant@google.com>
3559
3560         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3561         variable external_symbols_offset.
3562
3563 2011-09-12  Ian Lance Taylor  <iant@google.com>
3564
3565         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3566         triggered if object has no symbols.
3567
3568 2011-09-09  David S. Miller  <davem@davemloft.net>
3569
3570         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3571         (Output_fill_debug_line::do_write): Likewise.
3572
3573 2011-08-29  Cary Coutant  <ccoutant@google.com>
3574
3575         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3576         casts to match formatting specs.
3577         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3578
3579 2011-08-26  Cary Coutant  <ccoutant@google.com>
3580
3581         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3582         remaining hole size when allocating.
3583         (Layout::make_output_section): Set fill methods for debug sections.
3584         * layout.h (Free_list::Free_list_node): Move from private to
3585         public.
3586         (Free_list::set_min_hole_size): New function.
3587         (Free_list::begin, Free_list::end): New functions.
3588         (Free_list::min_hole_): New data member.
3589         * output.cc: Include dwarf.h.
3590         (Output_fill_debug_info::do_minimum_hole_size): New function.
3591         (Output_fill_debug_info::do_write): New function.
3592         (Output_fill_debug_line::do_minimum_hole_size): New function.
3593         (Output_fill_debug_line::do_write): New function.
3594         (Output_section::Output_section): Initialize new data member.
3595         (Output_section::set_final_data_size): Ensure patch space is larger
3596         than minimum hole size.
3597         (Output_section::do_write): Fill holes in debug sections.
3598         * output.h (Output_fill): New class.
3599         (Output_fill_debug_info): New class.
3600         (Output_fill_debug_line): New class.
3601         (Output_section::set_free_space_fill): New function.
3602         (Output_section::free_space_fill_): New data member.
3603         * testsuite/Makefile.am (incremental_test_3): Add
3604         --incremental-patch option.
3605         (incremental_test_4): Likewise.
3606         (incremental_test_5): Likewise.
3607         (incremental_test_6): Likewise.
3608         (incremental_copy_test): Likewise.
3609         (incremental_common_test_1): Likewise.
3610         * testsuite/Makefile.in: Regenerate.
3611
3612 2011-08-26  Nick Clifton  <nickc@redhat.com>
3613
3614         * po/es.po: Updated Spanish translation.
3615
3616 2011-08-01  Cary Coutant  <ccoutant@google.com>
3617
3618         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3619         * gold/testsuite/Makefile.in: Regenerate.
3620         * gold/testsuite/justsyms_exec.c: New source file.
3621         * gold/testsuite/justsyms_lib.c: New source file.
3622
3623 2011-08-01  Cary Coutant  <ccoutant@google.com>
3624
3625         * layout.cc (Layout::set_segment_offsets): Don't realign text
3626         segment if -Ttext was specified.
3627         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3628         file type.
3629         * object.h (Sized_relobj_file::e_type): New function.
3630         (Sized_relobj_file::e_type_): New data member.
3631         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3632         base address for ET_EXEC files.
3633         * target.cc (Target::do_make_elf_object_implementation): Allow
3634         ET_EXEC files with --just-symbols option.
3635
3636 2011-07-28  Cary Coutant  <ccoutant@google.com>
3637
3638         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3639         Add thread_number parameter.
3640         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3641         * workqueue-threads.cc
3642         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3643         current thread if its thread number is greater than desired thread
3644         count.
3645         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3646         Add thread_number parameter.
3647         (Workqueue::should_cancel_thread): Likewise.
3648         (Workqueue::find_runnable_or_wait): Pass thread_number to
3649         should_cancel_thread.
3650         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3651         parameter.
3652
3653 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3654
3655         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3656         only after checking if it cannot be forced local.
3657         * symtab.h (is_externally_visible): Check if the symbol is not forced
3658         local.
3659
3660 2011-07-15  Ian Lance Taylor  <iant@google.com>
3661
3662         * options.h (class General_options): Add --print-output-format.
3663         Move -EL next to -EB, for  better --help output.
3664         * target-select.cc: Include <cstdio>, "options.h", and
3665         "parameters.h".
3666         (Target_selector::do_target_bfd_name): New function.
3667         (print_output_format): New function.
3668         * target-select.h (class Target_selector): Update declarations.
3669         (Target_selector::target_bfd_name): New function.
3670         (print_output_format): Declare.
3671         * main.cc: Include "target-select.h".
3672         (main): Handle --print-output-format.
3673         * gold.cc: Include "target-select.h".
3674         (queue_initial_tasks): Handle --print-output-format when there are
3675         no input files.
3676         * parameters.cc (parameters_force_valid_target): Give a better
3677         error message if -EB/-EL does not match target.
3678         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3679         function.
3680
3681 2011-07-15  Ian Lance Taylor  <iant@google.com>
3682
3683         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3684         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3685         (Output_data_plt_i386::do_write): Write address of .dynamic
3686         section to first entry in .got.plt section.
3687         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3688         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3689         Initialize layout_.
3690         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3691         section to first entry in .got.plt section.
3692         * layout.h (Layout::dynamic_section): New function.
3693
3694 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3695
3696         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3697         to claim_file call.
3698         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3699         input_section_position_, and input_section_glob_.
3700         (read_layout_from_file): Call function section_ordering_specified.
3701         * layout.h (is_section_ordering_specified): New function.
3702         (section_ordering_specified): New function.
3703         (section_ordering_specified_): New boolean member.
3704         * main.cc(main): Call load_plugins after layout object is defined.
3705         * output.cc (Output_section::add_input_section): Use
3706         function section_ordering_specified to check if section ordering is
3707         needed.
3708         * output.cc (Output_section::add_relaxed_input_section): Use
3709         function section_ordering_specified to check if section ordering is
3710         needed.
3711         (Output_section::update_section_layout): New function.
3712         (Output_section::sort_attached_input_sections): Check if input section
3713         must be reordered.
3714         * output.h (Output_section::update_section_layout): New function.
3715         * plugin.cc (get_section_count): New function.
3716         (get_section_type): New function.
3717         (get_section_name): New function.
3718         (get_section_contents): New function.
3719         (update_section_order): New function.
3720         (allow_section_ordering): New function.
3721         (Plugin::load): Add the new interfaces to the transfer vector.
3722         (Plugin_manager::load_plugins): New parameter.
3723         (Plugin_manager::all_symbols_read): New parameter.
3724         (Plugin_manager::claim_file): New parameter. Save the elf object for
3725         unclaimed objects.
3726         (Plugin_manager::get_elf_object): New function.
3727         (Plugin_manager::get_view): Change to directly use the bool to check
3728         if get_view is called from claim_file_hook.
3729         * plugin.h (input_objects): New function
3730         (Plugin__manager::load_plugins): New parameter.
3731         (Plugin_manager::claim_file): New parameter.
3732         (Plugin_manager::get_elf_object): New function.
3733         (Plugin_manager::in_claim_file_handler): New function.
3734         (Plugin_manager::in_claim_file_handler_): New member.
3735         (layout): New function.
3736         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3737         handler with an extra parameter. Make the elf object before calling
3738         claim_file handler.
3739         * testsuite/plugin_test.c (get_section_count): New function pointer.
3740         (get_section_type): New function pointer.
3741         (get_section_name): New function pointer.
3742         (get_section_contents): New function pointer.
3743         (update_section_order): New function pointer.
3744         (allow_section_ordering): New function pointer.
3745         (onload): Check if the new interfaces exist.
3746
3747 2011-07-13  Ian Lance Taylor  <iant@google.com>
3748
3749         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3750         relro section.
3751         * x86_64.cc (Target_x86_64::got_section): Likewise.
3752         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3753         (relro_now_test_SOURCES): New variable.
3754         (relro_now_test_DEPENDENCIES): New variable.
3755         (relro_now_test_LDFLAGS): New variable.
3756         (relro_now_test_LDADD): New variable.
3757         (relro_now_test.so): New target.
3758         * testsuite/Makefile.in: Rebuild.
3759
3760 2011-07-12  Ian Lance Taylor  <iant@google.com>
3761
3762         PR gold/12980
3763         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3764         GLOB_DAT relocation rather than a RELATIVE relocation for a
3765         protected symbol when creating a shared library.
3766         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3767         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3768         * testsuite/protected_main_1.cc (main): Test that protected
3769         function has same address.
3770
3771 2011-07-11  Ian Lance Taylor  <iant@google.com>
3772
3773         PR gold/12979
3774         * options.h (class General_options): Add -Bgroup.
3775         * options.cc (General_options::finalize): If -Bgroup is set,
3776         default to --unresolved-symbols=report-all.
3777         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3778         * target-reloc.h (issue_undefined_symbol_error): Handle
3779         --unresolved-symbols=report-all.
3780
3781 2011-07-08  Ian Lance Taylor  <iant@google.com>
3782
3783         PR gold/11985
3784         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3785         if linker script discards key sections.
3786         (Layout::create_dynamic_symtab): Likewise.
3787         (Layout::assign_local_dynsym_offsets): Likewise.
3788         (Layout::sized_create_version_sections): Likewise.
3789         (Layout::create_interp): Likewise.
3790         (Layout::finish_dynamic_section): Likewise.
3791         (Layout::set_dynamic_symbol_size): Likewise.
3792
3793 2011-07-08  Ian Lance Taylor  <iant@google.com>
3794
3795         PR gold/12386
3796         * options.h (class General_options): Add --unresolved-symbols.
3797         * target-reloc.h (issue_undefined_symbol_error): Check
3798         --unresolved-symbols.  Add comments.
3799
3800 2011-07-08  Ian Lance Taylor  <iant@google.com>
3801
3802         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3803         expression more complex.
3804
3805 2011-07-08  Ian Lance Taylor  <iant@google.com>
3806
3807         PR gold/11317
3808         * target-reloc.h (issue_undefined_symbol_error): New inline
3809         function, broken out of relocate_section.
3810         (relocate_section): Call issue_undefined_symbol_error.
3811         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3812         there is no TLS segment if we are about to issue an undefined
3813         symbol error.
3814         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3815
3816 2011-07-08  Ian Lance Taylor  <iant@google.com>
3817
3818         PR gold/12279
3819         * resolve.cc (Symbol_table::should_override): Add fromtype
3820         parameter.  Change all callers.  Give error when linking together
3821         TLS and non-TLS symbol.
3822         (Symbol_table::should_override_with_special): Add fromtype
3823         parameter.  Change all callers.
3824         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3825         there is no TLS segment if we have reported some errors.
3826         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3827
3828 2011-07-08  Ian Lance Taylor  <iant@google.com>
3829
3830         PR gold/12372
3831         * target.h (Target::plt_address_for_global): New function.
3832         (Target::plt_address_for_local): New function.
3833         (Target::plt_section_for_global): Remove.
3834         (Target::plt_section_for_local): Remove.
3835         (Target::do_plt_address_for_global): New virtual function.
3836         (Target::do_plt_address_for_local): New virtual function.
3837         (Target::do_plt_section_for_global): Remove.
3838         (Target::do_plt_section_for_local): Remove.
3839         (Target::register_global_plt_entry): Add Symbol_table and Layout
3840         parameters.
3841         * output.cc (Output_data_got::Got_entry::write): Use
3842         plt_address_for_global and plt_address_for_local.
3843         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3844         address of output section.
3845         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3846         got_irelative_, and irelative_count_ fields.  Update
3847         declarations.
3848         (Output_data_plt_i386::has_irelative_section): New function.
3849         (Output_data_plt_i386::entry_count): Add irelative_count_.
3850         (Output_data_plt_i386::set_final_data_size): Likewise.
3851         (class Target_i386): Add got_irelative_ and rel_irelative_
3852         fields.  Update declarations.
3853         (Target_i386::Target_i386): Initialize new fields.
3854         (Target_i386::do_plt_address_for_global): New function replacing
3855         do_plt_section_for_global.
3856         (Target_i386::do_plt_address_for_local): New function replacing
3857         do_plt_section_for_local.
3858         (Target_i386::got_section): Create got_irelative_.
3859         (Target_i386::rel_irelative_section): New function.
3860         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3861         fields.  Don't define __rel_iplt_{start,end}.
3862         (Output_data_plt_i386::add_entry): Add symtab and layout
3863         parameters.  Change all callers.  Use different PLT and GOT for
3864         IFUNC symbols.
3865         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3866         layout parameters.  Change all callers.  Use different PLT and
3867         GOT.
3868         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3869         (Output_data_plt_i386::rel_irelative): New function.
3870         (Output_data_plt_i386::address_for_global): New function.
3871         (Output_data_plt_i386::address_for_local): New function.
3872         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3873         IRELATIVE GOT when changing IFUNC GOT entries.
3874         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3875         reloc.
3876         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3877         if we didn't create an IRELATIVE GOT.
3878         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3879         plt_address_for_local.
3880         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3881         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3882         got_irelative_, and irelative_count_ fields.  Update
3883         declarations.
3884         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3885         Initialize new fields.  Remove symtab parameter.  Change all
3886         callers.
3887         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3888         irelative_count_.
3889         (Output_data_plt_x86_64::has_irelative_section): New function.
3890         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3891         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3892         fields.  Update declarations.
3893         (Target_x86_64::Target_x86_64): Initialize new fields.
3894         (Target_x86_64::do_plt_address_for_global): New function replacing
3895         do_plt_section_for_global.
3896         (Target_x86_64::do_plt_address_for_local): New function replacing
3897         do_plt_section_for_local.
3898         (Target_x86_64::got_section): Create got_irelative_.
3899         (Target_x86_64::rela_irelative_section): New function.
3900         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3901         all callers.  Don't create __rel_iplt_{start,end}.
3902         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3903         parameters.  Change all callers.  Use different PLT and GOT for
3904         IFUNC symbols.
3905         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3906         layout parameters.  Change all callers.  Use different PLT and
3907         GOT.
3908         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3909         parameters.  Change all callers.  Use different PLT and GOT for
3910         IFUNC symbols.
3911         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3912         (Output_data_plt_x86_64::rela_irelative): New function.
3913         (Output_data_plt_x86_64::address_for_global): New function.
3914         (Output_data_plt_x86_64::address_for_local): New function.
3915         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3916         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3917         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3918         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3919         parameters.
3920         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3921         reloc.
3922         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3923         symbols if we didn't create an IRELATIVE GOT.
3924         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3925         plt_address_for_local.
3926         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3927         * testsuite/ifuncvar1.c: New test file.
3928         * testsuite/ifuncvar2.c: New test file.
3929         * testsuite/ifuncvar3.c: New test file.
3930         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3931         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3932         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3933         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3934         * testsuite/Makefile.in: Rebuild.
3935
3936 2011-07-07  Cary Coutant  <ccoutant@google.com>
3937
3938         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3939         (two_file_test_1_ndebug.o): Likewise.
3940         (two_file_test_1b_ndebug.o): Likewise.
3941         (two_file_test_2_ndebug.o): Likewise.
3942         (two_file_test_main_ndebug.o): Likewise.
3943         (incremental_test_2): Link with no-debug versions.
3944
3945 2011-07-06  Cary Coutant  <ccoutant@google.com>
3946
3947         * gold/incremental.cc
3948         (Output_section_incremental_inputs::write_info_blocks): Check for
3949         hidden and internal symbols.
3950
3951 2011-07-06  Cary Coutant  <ccoutant@google.com>
3952
3953         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3954         Check disposition for startup file.
3955         (Incremental_inputs::report_command_line): Ignore
3956         --incremental-startup-unchanged option.
3957         * options.cc (General_options::parse_incremental_startup_unchanged):
3958         New function.
3959         (General_options::General_options): Initialize new data member.
3960         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3961         (General_options): Add --incremental-startup-unchanged option.
3962         (General_options::incremental_startup_disposition): New function.
3963         (General_options::incremental_startup_disposition_): New data member.
3964
3965 2011-07-06  Cary Coutant  <ccoutant@google.com>
3966
3967         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3968         input file index to Script_info ctor.
3969         (Sized_incremental_binary::do_file_has_changed): Find the
3970         command-line argument for files named in scripts.
3971         * incremental.h (Script_info::Script_info): New ctor
3972         with input file index.
3973         (Script_info::input_file_index): New function.
3974         (Script_info::input_file_index_): New data member.
3975         (Incremental_binary::get_library): Add const.
3976         (Incremental_binary::get_script_info): Add const.
3977         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3978         * testsuite/Makefile.am (incremental_test_5): New test case.
3979         (incremental_test_6): New test case.
3980         * testsuite/Makefile.in: Regenerate.
3981
3982 2011-07-06  Cary Coutant  <ccoutant@google.com>
3983
3984         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3985         debug output when command lines differ.
3986
3987 2011-07-06  Cary Coutant  <ccoutant@google.com>
3988
3989         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3990         --incremental-patch option.
3991         * layout.cc (Free_list::allocate): Extend allocation beyond original
3992         end if enabled.
3993         (Layout::make_output_section): Mark sections that should get
3994         patch space.
3995         * options.cc (parse_percent): New function.
3996         * options.h (parse_percent): New function.
3997         (DEFINE_percent): New macro.
3998         (General_options): Add --incremental-patch option.
3999         * output.cc (Output_section::Output_section): Initialize new data
4000         members.
4001         (Output_section::add_input_section): Print section name when out
4002         of patch space.
4003         (Output_section::add_output_section_data): Likewise.
4004         (Output_section::set_final_data_size): Add patch space when
4005         doing --incremental-full.
4006         (Output_section::do_reset_address_and_file_offset): Remove patch
4007         space.
4008         (Output_segment::set_section_list_addresses): Print debug output
4009         only if --incremental-update.
4010         * output.h (Output_section::set_is_patch_space_allowed): New function.
4011         (Output_section::is_patch_space_allowed_): New data member.
4012         (Output_section::patch_space_): New data member.
4013         * parameters.cc (Parameters::incremental_full): New function.
4014         * parameters.h (Parameters::incremental_full): New function
4015         * testsuite/Makefile.am (incremental_test_2): Add test for
4016         --incremental-patch option.
4017         * testsuite/Makefile.in: Regenerate.
4018         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4019         (t18): Remove function body.
4020
4021 2011-07-05  Doug Kwan  <dougkwan@google.com>
4022
4023         PR gold/12771
4024         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4025         Arm_Address type for relocation result.
4026         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4027         overflow check.
4028         (Arm_relocate_functions::abs32): Use unaligned access.
4029         (Arm_relocate_functions::rel32): Ditto.
4030         (Arm_relocate_functions::prel31): Ditto.
4031         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4032         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4033         static data relocations.
4034         * testsuite/Makefile.in: Regnerate.
4035         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4036
4037 2011-07-05  Ian Lance Taylor  <iant@google.com>
4038
4039         PR gold/12392
4040         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4041         symbols if necessary.
4042         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4043
4044 2011-07-05  Ian Lance Taylor  <iant@google.com>
4045
4046         PR gold/12952
4047         * resolve.cc (Symbol::override_base_with_special): Simply override
4048         version with special symbol version, ignoring previous version.
4049
4050 2011-07-05  Ian Lance Taylor  <iant@google.com>
4051
4052         * object.cc (Sized_relobj_file::include_section_group): Add
4053         information to comment about signature location.
4054
4055 2011-07-02  Ian Lance Taylor  <iant@google.com>
4056
4057         PR gold/12957
4058         * options.h (class General_options): Add -f and -F.
4059         * options.cc (General_options::finalize): Fatal error if -f/-F
4060         are used without -shared.
4061         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4062
4063 2011-07-02  Ian Lance Taylor  <iant@google.com>
4064
4065         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4066
4067 2011-07-01  Ian Lance Taylor  <iant@google.com>
4068
4069         PR gold/12525
4070         PR gold/12952
4071         * resolve.cc (Symbol::override_base_with_special): Don't override
4072         the version if the overriding symbol has a different name.
4073         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4074         all callers.  If we give an error about an undefined version,
4075         define the base version if necessary.
4076         * dynobj.h (class Versions): Update declaration.
4077         * testsuite/weak_alias_test_5.cc: New file.
4078         * testsuite/weak_alias_test.script: New file.
4079         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4080         and versioned_alias have the right value, and call t2.
4081         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4082         weak_alias_test_5.so.
4083         (weak_alias_test_LDADD): Likewise.
4084         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4085         * testsuite/Makefile.in: Rebuild.
4086
4087 2011-07-01  Ian Lance Taylor  <iant@google.com>
4088
4089         PR gold/12525
4090         * options.h (class General_options): Support -z notext.
4091         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4092         -Wl,-z,notext.
4093         (two_file_shared_nonpic.so): Likewise.
4094         (two_file_shared_mixed.so): Likewise.
4095         (two_file_shared_mixed_1.so): Likewise.
4096         (weak_undef_lib_nonpic.so): Likewise.
4097         (alt/weak_undef_lib_nonpic.so): Likewise.
4098         (tls_test_shared_nonpic.so): Likewise.
4099         * testsuite/Makefile.in: Rebuild.
4100
4101 2011-07-01  Ian Lance Taylor  <iant@google.com>
4102
4103         PR gold/12525
4104         * configure.ac: Test whether static linking works, setting
4105         the automake conditional HAVE_STATIC.
4106         * testsuite/Makefile.am: Disable tests using -static if
4107         HAVE_STATIC is not true.
4108         * configure, testsuite/Makefile.in: Rebuild.
4109
4110 2011-07-01  Ian Lance Taylor  <iant@google.com>
4111
4112         PR gold/12525
4113         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4114         Assert if we see DW_EH_PE_indirect.
4115         * target.h (Target::ehframe_datarel_base): New function.
4116         (Target::do_ehframe_datarel_base): New target function.
4117         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4118         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4119         function.
4120
4121 2011-07-01  Ian Lance Taylor  <iant@google.com>
4122
4123         PR gold/12571
4124         * options.h (class General_options): Add
4125         --ld-generated-unwind-info.
4126         * ehframe.cc (Fde::write): Add address parameter.  Change all
4127         callers.  If associated with PLT, fill in address and size.
4128         (Cie::set_output_offset): Only add merge mapping if there is an
4129         object.
4130         (Cie::write): Add address parameter.  Change all callers.
4131         (Eh_frame::add_ehframe_for_plt): New function.
4132         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4133         input_offset_ fields into union u_, with new plt field.
4134         (Fde::Fde): Adjust for new union field.
4135         (Fde::Fde) [Output_data version]: New constructor.
4136         (Fde::add_mapping): Only add merge mapping if there is an object.
4137         (class Cie): Update declarations.
4138         (class Eh_frame): Declare add_ehframe_for_plt.
4139         * layout.cc (Layout::layout_eh_frame): Break out code into
4140         make_eh_frame_section, and call it.
4141         (Layout::make_eh_frame_section): New function.
4142         (Layout::add_eh_frame_for_plt): New function.
4143         * layout.h (class Layout): Update declarations.
4144         * merge.cc (Merge_map::add_mapping): Add assertion.
4145         * i386.cc: Include "dwarf.h".
4146         (class Output_data_plt_i386): Make first_plt_entry,
4147         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4148         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4149         and plt_eh_frame_fde.
4150         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4151         boundary.  Call add_eh_frame_for_plt if appropriate.
4152         * x86_64.cc: Include "dwarf.h".
4153         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4154         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4155         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4156         and plt_eh_frame_fde.
4157         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4158         appropriate.
4159
4160 2011-06-29  Ian Lance Taylor  <iant@google.com>
4161
4162         PR gold/12629
4163         * object.cc (Sized_relobj_file::layout_section): Change shdr
4164         parameter to be const.
4165         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4166         out of do_layout.
4167         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4168         appropriate.  Call layout_eh_frame_section.
4169         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4170         sections.
4171         * object.h (class Sized_relobj_file): Update declarations.
4172
4173 2011-06-29  Ian Lance Taylor  <iant@google.com>
4174
4175         PR gold/12652
4176         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4177         modifier.
4178         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4179
4180 2011-06-29  Ian Lance Taylor  <iant@google.com>
4181
4182         PR gold/12675
4183         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4184         SHT_X86_64_UNWIND.
4185         * layout.cc (Layout::layout_eh_frame): Likewise.
4186
4187 2011-06-29  Ian Lance Taylor  <iant@google.com>
4188
4189         PR gold/12695
4190         * layout.cc (Layout::symtab_section_shndx): New function.
4191         * layout.h (class Layout): Declare symtab_section_shndx.
4192         * output.cc (Output_section::write_header): Call it.
4193
4194 2011-06-29  Ian Lance Taylor  <iant@google.com>
4195
4196         PR gold/12818
4197         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4198         symbols which are not used in a relocation.
4199
4200 2011-06-28  Ian Lance Taylor  <iant@google.com>
4201
4202         PR gold/12898
4203         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4204         script create indistinguishable segments.
4205         (Layout::set_segment_offsets): Use stable_sort when sorting
4206         segments.  Pass this to Compare_segments constructor.
4207         * layout.h (class Layout): Make segment_precedes non-static.
4208         (class Compare_segments): Change from struct to class.  Add
4209         layout_ field.  Add constructor.
4210         * script-sections.cc
4211         (Script_sections::attach_sections_using_phdrs_clause): Rename
4212         local orphan to is_orphan.  Don't report failure to put empty
4213         section in segment.  On attachment failure, report name of
4214         section, and attach to first PT_LOAD segment.
4215
4216 2011-06-28  Ian Lance Taylor  <iant@google.com>
4217
4218         PR gold/12934
4219         * target-select.cc (Target_selector::Target_selector): Add
4220         emulation parameter.  Change all callers.
4221         (select_target_by_bfd_name): Rename from select_target_by_name.
4222         Change all callers.
4223         (select_target_by_emulation): New function.
4224         (supported_emulation_names): New function.
4225         * target-select.h (class Target_selector): Add emulation_ field.
4226         Update declarations.
4227         (Target_selector::recognize_by_bfd_name): Rename from
4228         recognize_by_name.  Change all callers.
4229         (Target_selector::supported_bfd_names): Rename from
4230         supported_names.  Change all callers.
4231         (Target_selector::recognize_by_emulation): New function.
4232         (Target_selector::supported_emulations): New function.
4233         (Target_selector::emulation): New function.
4234         (Target_selector::do_recognize_by_bfd_name): Rename from
4235         do_recognize_by_name.  Change all callers.
4236         (Target_selector::do_supported_bfd_names): Rename from
4237         do_supported_names.  Change all callers.
4238         (Target_selector::do_recognize_by_emulation): New function.
4239         (Target_selector::do_supported_emulations): New function.
4240         (select_target_by_bfd_name): Change name in declaration.
4241         (select_target_by_emulation): Declare.
4242         (supported_emulation_names): Declare.
4243         * parameters.cc (parameters_force_valid_target): Try to find
4244         target based on emulation from -m option.
4245         * options.h (class General_options): Change doc string for -m.
4246         * options.cc (help): Print emulations.
4247         (General_options::parse_V): Likewise.
4248         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4249         Add emulation parameter.  Change all callers.
4250
4251 2011-06-28  Ian Lance Taylor  <iant@google.com>
4252
4253         * target.h (class Target): Add osabi_ field.
4254         (Target::osabi): New function.
4255         (Target::set_osabi): New function.
4256         (Target::Target): Initialize osabi_.
4257         (Target::do_adjust_elf_header): Make pure virtual.
4258         (Sized_target::do_adjust_elf_header): Declare.
4259         * target.cc (Sized_target::do_adjust_elf_header): New function.
4260         (class Sized_target): Instantiate all versions.
4261         * freebsd.h (class Target_freebsd): Remove.
4262         (Target_selector_freebsd::do_recognize): Call set_osabi on
4263         Target.
4264         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4265         (Target_selector_freebsd::set_osabi): Remove.
4266         * i386.cc (class Target_i386): Inherit from Sized_target rather
4267         than Target_freebsd.
4268         * x86_64.cc (class Target_x86_64): Likewise.
4269
4270 2011-06-28  Ian Lance Taylor  <iant@google.com>
4271
4272         * target.h (Target::can_check_for_function_pointers): Rewrite.
4273         Make non-virtual.
4274         (Target::can_icf_inline_merge_sections): Likewise.
4275         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4276         (Target::Target_info): Add can_icf_inline_merge_sections field.
4277         (Target::do_can_check_for_function_pointers): New virtual
4278         function.
4279         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4280         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4281         from can_check_for_function_pointers, move in file.
4282         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4283         section_may_have_icf_unsafe_poineters, move in file.
4284         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4285         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4286         Rename from can_check_for_function_pointers, move in file.
4287         (Target_i386::can_icf_inline_merge_sections): Remove.
4288         (Target_i386::i386_info): Initialize
4289         can_icf_inline_merge_sections.
4290         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4291         Initialize can_icf_inline_merge_sections.
4292         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4293         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4294         Rename from can_check_for_function_pointers, move in file.
4295         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4296         (Target_x86_64::x86_64_info): Initialize
4297         can_icf_inline_merge_sections.
4298         * testsuite/testfile.cc (Target_test::test_target_info):
4299         Likewise.
4300         * icf.cc (get_section_contents): Correct formatting.
4301
4302 2011-06-27  Ian Lance Taylor  <iant@google.com>
4303
4304         * symtab.cc (Symbol::versioned_name): New function.
4305         (Symbol_table::add_to_final_symtab): Use versioned_name when
4306         appropriate.
4307         (Symbol_table::sized_write_symbol): Likewise.
4308         * symtab.h (class Symbol): Declare versioned_name.
4309         * stringpool.h (class Stringpool_template): Add variant of add
4310         which takes a std::basic_string.
4311         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4312         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4313         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4314         (ver_test_12.o): New target.
4315         * testsuite/Makefile.in: Rebuild.
4316
4317 2011-06-27  Doug Kwan  <dougkwan@google.com>
4318
4319         * arm.cc (Arm_relocate_functions::thm_jump8,
4320         Arm_relocate_functions::thm_jump11): Use a wider signed
4321         type to compute offset.
4322         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4323         arm_thm_jump8.
4324         * testsuite/Makefile.in: Regenerate.
4325         * testsuite/arm_branch_in_range.sh: Check test results of
4326         arm_thm_jump11 and arm_thm_jump8.
4327         * testsuite/arm_thm_jump11.s: New test source file.
4328         * testsuite/arm_thm_jump11.t: New linker script.
4329         * testsuite/arm_thm_jump8.s: New test source file.
4330         * testsuite/arm_thm_jump8.t: New linker script.
4331
4332 2011-06-24  Ian Lance Taylor  <iant@google.com>
4333
4334         * layout.cc: Include "object.h".
4335         (ctors_sections_in_init_array): New static variable.
4336         (Layout::is_ctors_in_init_array): New function.
4337         (Layout::layout): Add entry to ctors_sections_in_init_array if
4338         appropriate.
4339         * layout.h (class Layout): Declare is_ctors_in_init_array.
4340         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4341         is_ctors_reverse_view is set.
4342         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4343         all callers.  Set is_ctors_reverse_view field of View_size.
4344         (Sized_relobj_file::reverse_words): New function.
4345         * object.h (Sized_relobj_file::View_size): Add
4346         is_ctors_reverse_view field.
4347         (class Sized_relobj_file): Update declarations.
4348         * testsuite/initpri3.c: New test.
4349         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4350         initpri3b.
4351         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4352         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4353         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4354         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4355         * testsuite/Makefile.in: Rebuild.
4356
4357 2011-06-24  Cary Coutant  <ccoutant@google.com>
4358
4359         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4360         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4361         (debug_msg_cdebug.err): New targets.
4362         * testsuite/Makefile.in: Regenerate.
4363         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4364         Fix checks for link with shared library.
4365
4366 2011-06-24  Doug Kwan  <dougkwan@google.com>
4367
4368         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4369         skip empty text sections.
4370         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4371
4372 2011-06-22  Ian Lance Taylor  <iant@google.com>
4373
4374         PR gold/12910
4375         * options.h (class General_options): Add --ctors-in-init-array.
4376         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4377         friends as SHT_PROGBITS for merging sections.
4378         (Layout::layout): Remove special handling of .init_array and
4379         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4380         and .dtors if ctors_in_init_array.
4381         (Layout::make_output_section): Force correct section types for
4382         .init_array and friends.  Don't sort if doing relocatable link,
4383         Don't sort .ctors and .dtors if ctors_in_init_array.
4384         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4385         (Layout::output_section_name): Add relobj parameter.  Change all
4386         callers.  Handle .ctors. and .dtors. in code rather than table.
4387         Handle .ctors and .dtors if ctors_in_init_array.
4388         (Layout::match_file_name): New function, moved from output.cc.
4389         * layout.h (class Layout): Update declarations.
4390         * output.cc: Include "layout.h".
4391         (Input_section_sort_entry::get_priority): New function.
4392         (Input_section_sort_entry::match_file_name): Just call
4393         Layout::match_file_name.
4394         (Output_section::Input_section_sort_init_fini_compare::operator()):
4395         Handle .ctors and .dtors.  Sort by explicit priority rather than
4396         by name.
4397         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4398         * testsuite/initpri2.c: New test.
4399         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4400         (check_PROGRAMS): Add initpri2.
4401         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4402         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4403         * configure, testsuite/Makefile.in: Rebuild.
4404
4405 2011-06-19  Ian Lance Taylor  <iant@google.com>
4406
4407         PR gold/12880
4408         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4409         .interp section to a PT_INTERP segment even if we have seen a
4410         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4411         clause in a linker script.
4412         (Layout::finalize): Don't create a .interp section if we've
4413         already create a PT_INTERP segment.
4414         (Layout::create_interp): Always call choose_output_section (revert
4415         patch of 2011-06-17).  Don't create PT_INTERP segment.
4416         * script-sections.cc
4417         (Script_sections::create_note_and_tls_segments): Add a .interp
4418         section to a PT_INTERP segment even if we have seen a
4419         --dynamic-linker option.
4420
4421 2011-06-18  Ian Lance Taylor  <iant@google.com>
4422
4423         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4424         merely because a non-PT_LOAD segment has a dynamic reloc.
4425
4426 2011-06-18  Ian Lance Taylor  <iant@google.com>
4427
4428         * layout.cc (Layout::finish_dynamic_section): Don't create
4429         DT_FLAGS entry if not needed.
4430
4431 2011-06-18  Ian Lance Taylor  <iant@google.com>
4432
4433         PR gold/12745
4434         * layout.cc (Layout::layout_eh_frame): Correct handling of
4435         writable .eh_frame section.
4436
4437 2011-06-17  Ian Lance Taylor  <iant@google.com>
4438
4439         PR gold/12893
4440         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4441         symbol is redefined with the exact same object and value.
4442
4443 2011-06-17  Ian Lance Taylor  <iant@google.com>
4444
4445         PR gold/12880
4446         * layout.h (class Layout): Add interp_segment_ field.
4447         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4448         (Layout::attach_allocated_section_to_segment): If making shared
4449         library, put .interp section in PT_INTERP segment.
4450         (Layout::finalize): Also call create_interp if -dynamic-linker
4451         option was used.
4452         (Layout::create_interp): Assert that there is no PT_INTERP
4453         segment.  If not using a SECTIONS clause, use make_output_section.
4454         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4455         * script-sections.cc
4456         (Script_sections::create_note_and_tls_segments): If making shared
4457         library, put .interp section in PT_INTERP segment.
4458
4459 2011-06-17  Ian Lance Taylor  <iant@google.com>
4460
4461         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4462         when making a shared library.
4463
4464 2011-06-17  Ian Lance Taylor  <iant@google.com>
4465
4466         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4467         parameter.  Change all callers.  Don't issue warning about PC32
4468         against locally defined symbol.
4469
4470 2011-06-16  Ian Lance Taylor  <iant@google.com>
4471
4472         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4473         occurs in same object.
4474
4475 2011-06-14  Alan Modra  <amodra@gmail.com>
4476
4477         * po/POTFILES.in: Regenerate.
4478
4479 2011-06-09  Ian Lance Taylor  <iant@google.com>
4480
4481         * script-sections.cc
4482         (Orphan_output_section::set_section_addresses): For a relocatable
4483         link set address to 0.
4484
4485 2011-06-09  Cary Coutant  <ccoutant@google.com>
4486
4487         PR gold/12804
4488         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4489         used with --compress-debug-sections.
4490         * gold/object.cc (Sized_relobj_file::do_layout): Report
4491         uncompressed size of compressed input sections.
4492
4493 2011-06-08  Cary Coutant  <ccoutant@google.com>
4494
4495         PR gold/12804
4496         * testsuite/two_file_test_2_v1.cc: Change initialization of
4497         v2 to keep it in .data.
4498
4499 2011-06-07  Cary Coutant  <ccoutant@google.com>
4500
4501         * common.cc (Symbol_table::do_allocate_commons_list): Call
4502         gold_fallback.
4503         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4504         (Errors::fallback): New function.
4505         (gold_fallback): New function.
4506         * errors.h (Errors::fallback): New function.
4507         * gold.cc (gold_exit): Change status parameter to enum; adjust
4508         all callers.
4509         (queue_initial_tasks): Call gold_fallback.
4510         * gold.h: Include cstdlib.
4511         (Exit_status): New enum type.
4512         (gold_exit): Change status parameter to enum.
4513         (gold_fallback): New function.
4514         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4515         (Layout::create_symtab_sections): Likewise.
4516         (Layout::create_shdrs): Likewise.
4517         * main.cc (main): Adjust call to gold_exit.
4518         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4519         (Output_data_got::add_got_entry_pair): Likewise.
4520         (Output_section::add_input_section): Likewise.
4521         (Output_section::add_output_section_data): Likewise.
4522         (Output_segment::set_section_list_addresses): Likewise.
4523         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4524
4525 2011-06-07  Cary Coutant  <ccoutant@google.com>
4526
4527         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4528         for incremental links.
4529         * output.cc (Output_segment::set_section_list_addresses): Remove
4530         FIXME and test for TLS or BSS.
4531
4532 2011-06-07  Cary Coutant  <ccoutant@google.com>
4533
4534         * testsuite/Makefile.am: Add incremental_copy_test,
4535         incremental_common_test_1.
4536         * testsuite/Makefile.in: Regenerate.
4537         * testsuite/common_test_1_v1.c: New source file.
4538         * testsuite/common_test_1_v2.c: New source file.
4539         * testsuite/copy_test_v1.cc: New source file.
4540
4541 2011-06-07  Cary Coutant  <ccoutant@google.com>
4542
4543         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4544         update, allocate common from bss section's free list.
4545         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4546         linker-defined symbols.
4547         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4548         Skip GOT and PLT entries that are no longer referenced.
4549         (Output_section_incremental_inputs::write_info_blocks): Mark
4550         linker-defined symbols.
4551         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4552         * output.cc (Output_section::allocate): New function.
4553         * output.h (Output_section::allocate): New function.
4554         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4555         linker-defined symbols.
4556         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4557         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4558         (Symbol::init_base_output_data): Likewise.
4559         (Symbol::init_base_output_segment): Likewise.
4560         (Symbol::init_base_constant): Likewise.
4561         (Sized_symbol::init_output_data): Likewise.
4562         (Sized_symbol::init_output_segment): Likewise.
4563         (Sized_symbol::init_constant): Likewise.
4564         (Symbol_table::do_define_in_output_data): Likewise.
4565         (Symbol_table::do_define_in_output_segment): Likewise.
4566         (Symbol_table::do_define_as_constant): Likewise.
4567         * symtab.h (Symbol::is_predefined): New function.
4568         (Symbol::init_base_output_data): Add is_predefined parameter.
4569         (Symbol::init_base_output_segment): Likewise.
4570         (Symbol::init_base_constant): Likewise.
4571         (Symbol::is_predefined_): New data member.
4572         (Sized_symbol::init_output_data): Add is_predefined parameter.
4573         (Sized_symbol::init_output_segment): Likewise.
4574         (Sized_symbol::init_constant): Likewise.
4575         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4576
4577 2011-06-07  Cary Coutant  <ccoutant@google.com>
4578
4579         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4580         instead of emit_copy_reloc.
4581         (Copy_relocs::emit_copy_reloc): Refactor.
4582         (Copy_relocs::make_copy_reloc): New function.
4583         (Copy_relocs::add_copy_reloc): Remove.
4584         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4585         section.
4586         (Copy_relocs::make_copy_reloc): New function.
4587         (Copy_relocs::add_copy_reloc): Remove.
4588         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4589         unchanged input files.
4590         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4591         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4592         Reserve BSS space for COPY relocations.
4593         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4594         (Output_section_incremental_inputs::write_info_blocks): Record
4595         whether a symbol is copied from a shared object.
4596         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4597         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4598         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4599         (Incremental_input_entry_reader::get_output_symbol_index): Add
4600         is_copy parameter.
4601         (Incremental_binary::emit_copy_relocs): New function.
4602         (Incremental_binary::do_emit_copy_relocs): New function.
4603         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4604         new data member.
4605         (Sized_incremental_binary::add_copy_reloc): New function.
4606         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4607         (Sized_incremental_binary::Copy_reloc): New struct.
4608         (Sized_incremental_binary::Copy_relocs): New typedef.
4609         (Sized_incremental_binary::copy_relocs_): New data member.
4610         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4611         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4612         * target.h (Sized_target::emit_copy_reloc): New function.
4613         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4614
4615 2011-06-02  Cary Coutant  <ccoutant@google.com>
4616
4617         PR gold/12163
4618         * gold/archive.cc (Archive::Archive): Initialize new data member.
4619         (Archive::include_all_members): Return if archive has already been
4620         included.
4621         * gold/archive.h (Archive::include_all_members_): New data member.
4622
4623 2011-06-02  Nick Clifton  <nickc@redhat.com>
4624
4625         * dynobj.h: Fix spelling mistake in comment.
4626         * output.cc: Likewise.
4627
4628 2011-05-31  Doug Kwan  <dougkwan@google.com>
4629             Asier Llano
4630
4631         PR gold/12826
4632         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4633         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4634         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4635         redundant arm_exidx_test.so.
4636         * testsuite/Makefile.in: Regenerate.
4637         (check_SCRIPTS): Add pr12826.sh
4638         (check_DATA): Add pr12826.stdout
4639         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4640         * testsuite/pr12826.sh: New file.
4641         * testsuite/pr12826_1.s: Ditto.
4642         * testsuite/pr12826_1.s: Ditto.
4643
4644 2011-05-30  Ian Lance Taylor  <iant@google.com>
4645
4646         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4647         sections.
4648
4649 2011-05-29  Ian Lance Taylor  <iant@google.com>
4650
4651         PR gold/12804
4652         * testsuite/Makefile.am: Use different file name for two_file_test
4653         temporary file for each incremental test.
4654         * testsuite/Makefile.in: Rebuild.
4655
4656 2011-05-29  Ian Lance Taylor  <iant@google.com>
4657
4658         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4659         binary input file is empty.
4660
4661 2011-05-27  Ian Lance Taylor  <iant@google.com>
4662
4663         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4664         (ver_test_9.so): Likewise.
4665         * testsuite/Makefile.in: Rebuild.
4666
4667 2011-05-26 Cary Coutant  <ccoutant@google.com>
4668
4669         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4670         * incremental.cc (Incremental_inputs::report_input_section): Fix
4671         comment, indentation.
4672         (Incremental_inputs::report_comdat_group): New function.
4673         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4674         of data for incremental input file entry.
4675         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4676         group count, COMDAT group signatures.
4677         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4678         an unchanged input file.
4679         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4680         Initialize new data member.
4681         (Incremental_object_entry::add_comdat_group): New function.
4682         (Incremental_object_entry::get_comdat_group_count): New function.
4683         (Incremental_object_entry::get_comdat_signature_key): New function.
4684         (Incremental_object_entry::groups_): New data member.
4685         (Incremental_inputs::report_comdat_group): New function.
4686         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4687         data for incremental input file entry.
4688         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4689         (Incremental_input_entry_reader::get_input_section): Adjust size of
4690         data for incremental input file entry.
4691         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4692         (Incremental_input_entry_reader::get_comdat_group_signature): New
4693         function.
4694         * object.cc (Sized_relobj::include_section_group): Report kept
4695         COMDAT groups for incremental links.
4696
4697 2011-05-24  David Meyer  <pdox@google.com>
4698
4699         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4700         with name parameter.  Add found_name parameter.
4701         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4702         * dirsearch.h (class Dirsearch): Update declaration.
4703
4704 2011-05-24  Ian Lance Taylor  <iant@google.com>
4705
4706         * archive.cc (Library_base::should_include_member): Pull in object
4707         from archive if it defines the entry symbol.
4708         * parameters.cc (Parameters::entry): New function.
4709         * parameters.h (class Parameters): Declare entry.
4710         * output.h (class Output_file_header): Remove entry_ field.
4711         * output.cc (Output_file_header::Output_file_header): Remove entry
4712         parameter.  Change all callers.
4713         (Output_file_header::entry): Use parameters->entry.
4714         * gold.cc (queue_middle_tasks): Likewise.
4715         * plugin.cc (Plugin_hook::run): Likewise.
4716
4717 2011-05-24 Cary Coutant  <ccoutant@google.com>
4718
4719         * gold.cc (queue_initial_tasks): Pass incremental base filename
4720         to Output_file::open_base_file; don't print error message.
4721         * incremental-dump.cc (main): Adjust call to
4722         Output_file::open_for_modification.
4723         * incremental-dump.cc (main): Likewise.
4724         * incremental.cc (Incremental_inputs::report_command_line):
4725         Ignore --incremental-base option when comparing command lines.
4726         Ignore parameter when given as separate argument.
4727         * options.h (class General_options): Add --incremental-base.
4728         * output.cc (Output_file::Output_file):
4729         (Output_file::open_base_file): Add base_name and writable parameters;
4730         read base file into new file; print error message here.
4731         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4732         callers.
4733         * output.h (Output_file::open_for_modification): Rename to...
4734         (Output_file::open_base_file): ...this; add base_name and
4735         writable parameters; adjust all callers.
4736         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4737         callers.
4738         * testsuite/Makefile.am (incremental_test_4): Test
4739         --incremental-base.
4740         * testsuite/Makefile.in: Regenerate.
4741
4742 2011-05-24 Cary Coutant  <ccoutant@google.com>
4743
4744         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4745         incremental_test_4.
4746         * testsuite/Makefile.in: Regenerate.
4747         * testsuite/two_file_test_1_v1.cc: New test source file.
4748         * testsuite/two_file_test_1b_v1.cc: New test source file.
4749         * testsuite/two_file_test_2_v1.cc: New test source file.
4750
4751 2011-05-24 Cary Coutant  <ccoutant@google.com>
4752
4753         * dynobj.h (Dynobj::do_dynobj): New function.
4754         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4755         flag and soname for shared objects.
4756         * incremental.cc (Incremental_inputs::report_object): Make
4757         either Incremental_object_entry or Incremental_dynobj_entry; add
4758         soname to string table.
4759         (Incremental_inputs::report_input_section): Add assertion.
4760         (Output_section_incremental_inputs::set_final_data_size): Adjust
4761         type of input file entry for shared libraries; adjust size of
4762         shared library info entry.
4763         (Output_section_incremental_inputs::write_input_files): Write
4764         as_needed flag for shared libraries.
4765         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4766         of input file entry for shared libraries; write soname.
4767         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4768         soname from incremental info.
4769         * incremental.h (enum Incremental_input_flags): Add
4770         INCREMENTAL_INPUT_AS_NEEDED.
4771         (Incremental_input_entry::Incremental_input_entry): Initialize new
4772         data member.
4773         (Incremental_input_entry::set_as_needed): New function.
4774         (Incremental_input_entry::as_needed): New function.
4775         (Incremental_input_entry::do_dynobj_entry): New function.
4776         (Incremental_input_entry::as_needed_): New data member.
4777         (Incremental_object_entry::Incremental_object_entry): Don't check
4778         for shared library.
4779         (Incremental_object_entry::do_type): Likewise.
4780         (class Incremental_dynobj_entry): New class.
4781         (Incremental_input_entry_reader::as_needed): New function.
4782         (Incremental_input_entry_reader::get_soname): New function.
4783         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4784         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4785         size of shared library info entry.
4786         * layout.cc (Layout::finish_dynamic_section): Don't test for
4787         incremental link when adding DT_NEEDED entries.
4788         * object.h (Object::Object): Initialize new data member.
4789         (Object::dynobj): New function.
4790         (Object::set_as_needed): New function.
4791         (Object::as_needed): New function.
4792         (Object::do_dynobj): New function.
4793         (Object::as_needed_): New data member.
4794
4795 2011-05-24 Cary Coutant  <ccoutant@google.com>
4796
4797         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4798         info; adjust display of GOT entries.
4799         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4800         vector of input objects; remove file_status_.
4801         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4802         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4803         got_plt reader; call target hooks to reserve GOT entries.
4804         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4805         of input file info header and GOT info entry.
4806         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4807         relocation info.
4808         (Got_plt_view_info::got_descriptor): Remove.
4809         (Got_plt_view_info::sym_index): New data member.
4810         (Got_plt_view_info::input_index): New data member.
4811         (Local_got_offset_visitor::visit): Write input file index.
4812         (Global_got_offset_visitor::visit): Write 0 for input file index.
4813         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4814         with sym_index and input_index.
4815         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4816         incremental info GOT entry; replace got_descriptor with input_index.
4817         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4818         map from input file index to object.
4819         (Sized_relobj_incr::do_layout): Replace direct data member reference
4820         with accessor function.
4821         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4822         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4823         Adjust size of input file info header.
4824         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4825         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4826         (Incremental_input_entry_reader::get_input_section): Adjust size of
4827         input file info header.
4828         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4829         of incremental info GOT entry.
4830         (Incremental_got_plt_reader::get_got_desc): Remove.
4831         (Incremental_got_plt_reader::get_got_symndx): New function.
4832         (Incremental_got_plt_reader::get_got_input_index): New function.
4833         (Sized_incremental_binary::Sized_incremental_binary): Remove
4834         file_status_; add input_objects_.
4835         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4836         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4837         (Sized_incremental_binary::file_is_unchanged): Remove.
4838         (Sized_incremental_binary::set_input_object): New function.
4839         (Sized_incremental_binary::input_object): New function.
4840         (Sized_incremental_binary::file_status_): Remove.
4841         (Sized_incremental_binary::input_objects_): New data member.
4842         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4843         references.
4844         (Sized_relobj_incr::invalid_address): Move to base class.
4845         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4846         class.
4847         (Sized_relobj_incr::do_output_section_offset): Likewise.
4848         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4849         (Sized_relobj_incr::section_offsets_): Likewise.
4850         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4851         function.
4852         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4853         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4854         with accessor function.
4855         (Sized_relobj_file::do_layout): Likewise.
4856         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4857         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4858         (Sized_relobj_file::compute_final_local_value): Replace refs to
4859         section_offsets_ with accessor function.
4860         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4861         * object.h (Relobj::Relobj): Initialize new data members.
4862         (Relobj::add_dyn_reloc): New function.
4863         (Relobj::first_dyn_reloc): New function.
4864         (Relobj::dyn_reloc_count): New function.
4865         (Relobj::first_dyn_reloc_): New data member.
4866         (Relobj::dyn_reloc_count_): New data member.
4867         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4868         references.
4869         (Sized_relobj::Address): New typedef.
4870         (Sized_relobj::invalid_address): Move here from child class.
4871         (Sized_relobj::Sized_relobj): Initialize new data members.
4872         (Sized_relobj::sized_relobj): New function.
4873         (Sized_relobj::is_output_section_offset_invalid): Move here from
4874         child class.
4875         (Sized_relobj::get_output_section_offset): Likewise.
4876         (Sized_relobj::local_has_got_offset): Likewise.
4877         (Sized_relobj::local_got_offset): Likewise.
4878         (Sized_relobj::set_local_got_offset): Likewise.
4879         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4880         (Sized_relobj::clear_got_offsets): New function.
4881         (Sized_relobj::section_offsets): Move here from child class.
4882         (Sized_relobj::do_output_section_offset): Likewise.
4883         (Sized_relobj::do_set_section_offset): Likewise.
4884         (Sized_relobj::Local_got_offsets): Likewise.
4885         (Sized_relobj::local_got_offsets_): Likewise.
4886         (Sized_relobj::section_offsets_): Likewise.
4887         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4888         references.
4889         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4890         class.
4891         (Sized_relobj_file::sized_relobj): New function
4892         (Sized_relobj_file::local_has_got_offset): Move to base class.
4893         (Sized_relobj_file::local_got_offset): Likewise.
4894         (Sized_relobj_file::set_local_got_offset): Likewise.
4895         (Sized_relobj_file::get_output_section_offset): Likewise.
4896         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4897         (Sized_relobj_file::do_output_section_offset): Likewise.
4898         (Sized_relobj_file::do_set_section_offset): Likewise.
4899         (Sized_relobj_file::Local_got_offsets): Likewise.
4900         (Sized_relobj_file::local_got_offsets_): Likewise.
4901         (Sized_relobj_file::section_offsets_): Likewise.
4902         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4903         (all constructors).
4904         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4905         (Output_reloc::get_symbol_index): Likewise.
4906         (Output_reloc::local_section_offset): Likewise.
4907         (Output_reloc::get_address): Likewise.
4908         (Output_reloc::symbol_value): Likewise.
4909         (Output_data_got::reserve_slot): Move to class definition.
4910         (Output_data_got::reserve_local): New function.
4911         (Output_data_got::reserve_slot_for_global): Remove.
4912         (Output_data_got::reserve_global): New function.
4913         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4914         (all constructors, two instantiations).
4915         (Output_reloc::get_relobj): New function (two instantiations).
4916         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4917         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4918         (Output_data_reloc::add_global): Adjust type of relobj.
4919         (Output_data_reloc::add_global_relative): Likewise.
4920         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4921         (Output_data_reloc::add_local): Likewise.
4922         (Output_data_reloc::add_local_relative): Likewise.
4923         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4924         (Output_data_reloc::add_local_section): Likewise.
4925         (Output_data_reloc::add_output_section): Likewise.
4926         (Output_data_reloc::add_absolute): Likewise.
4927         (Output_data_reloc::add_target_specific): Likewise.
4928         (Output_data_got::reserve_slot): Move definition here.
4929         (Output_data_got::reserve_local): New function.
4930         (Output_data_got::reserve_global): New function.
4931         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4932         section_offsets_ with accessor function.
4933         (Sized_relobj_file::write_sections): Likewise.
4934         (Sized_relobj_file::do_relocate_sections): Likewise.
4935         * target.h (Sized_target::reserve_local_got_entry): New function.
4936         (Sized_target::reserve_global_got_entry): New function.
4937         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4938         (Target_x86_64::reserve_global_got_entry): New function.
4939         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4940
4941 2011-05-23 Cary Coutant  <ccoutant@google.com>
4942
4943         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4944         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4945         bit when checking got_type.
4946         * incremental.cc (Sized_incremental_binary::setup_readers):
4947         Store symbol table and string table locations; initialize bit vector
4948         of file status flags.
4949         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4950         unchanged files.
4951         (Sized_incremental_binary::do_process_got_plt): New function.
4952         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4953         (Output_section_incremental_inputs::set_final_data_size): Record
4954         file index for each input file.
4955         (Output_section_incremental_inputs::write_got_plt): Store file index
4956         instead of input entry offset for each GOT entry.
4957         * incremental.h
4958         (Incremental_input_entry::Incremental_input_entry): Initialize new
4959         data member.
4960         (Incremental_input_entry::set_offset): Store file index.
4961         (Incremental_input_entry::get_file_index): New function.
4962         (Incremental_input_entry::file_index_): New data member.
4963         (Incremental_binary::process_got_plt): New function.
4964         (Incremental_binary::do_process_got_plt): New function.
4965         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4966         data members.
4967         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4968         (Sized_incremental_binary::set_file_is_unchanged): New function.
4969         (Sized_incremental_binary::file_is_unchanged): New function.
4970         (Sized_incremental_binary::do_process_got_plt): New function.
4971         (Sized_incremental_binary::file_status_): New data member.
4972         (Sized_incremental_binary::main_symtab_loc_): New data member.
4973         (Sized_incremental_binary::main_strtab_loc_): New data member.
4974         * output.cc (Output_data_got::Got_entry::write): Add case
4975         RESERVED_CODE.
4976         (Output_data_got::add_global): Call add_got_entry.
4977         (Output_data_got::add_global_plt): Likewise.
4978         (Output_data_got::add_global_with_rel): Likewise.
4979         (Output_data_got::add_global_with_rela): Likewise.
4980         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4981         (Output_data_got::add_global_pair_with_rela): Likewise.
4982         (Output_data_got::add_local): Call add_got_entry.
4983         (Output_data_got::add_local_plt): Likewise.
4984         (Output_data_got::add_local_with_rel): Likewise.
4985         (Output_data_got::add_local_with_rela): Likewise.
4986         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4987         (Output_data_got::add_local_pair_with_rela): Likewise.
4988         (Output_data_got::reserve_slot): New function.
4989         (Output_data_got::reserve_slot_for_global): New function.
4990         (Output_data_got::add_got_entry): New function.
4991         (Output_data_got::add_got_entry_pair): New function.
4992         (Output_section::add_output_section_data): Edit FIXME.
4993         * output.h
4994         (Output_section_data_build::Output_section_data_build): New
4995         constructor with size parameter.
4996         (Output_data_space::Output_data_space): Likewise.
4997         (Output_data_got::Output_data_got): Initialize new data member; new
4998         constructor with size parameter.
4999         (Output_data_got::add_constant): Call add_got_entry.
5000         (Output_data_got::reserve_slot): New function.
5001         (Output_data_got::reserve_slot_for_global): New function.
5002         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5003         (Output_data_got::add_got_entry): New function.
5004         (Output_data_got::add_got_entry_pair): New function.
5005         (Output_data_got::free_list_): New data member.
5006         * target.h (Sized_target::init_got_plt_for_update): New function.
5007         (Sized_target::register_global_plt_entry): New function.
5008         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5009         Initialize new data member; call init; add constructor with PLT count.
5010         (Output_data_plt_x86_64::init): New function.
5011         (Output_data_plt_x86_64::add_relocation): New function.
5012         (Output_data_plt_x86_64::reserve_slot): New function.
5013         (Output_data_plt_x86_64::free_list_): New data member.
5014         (Target_x86_64::init_got_plt_for_update): New function.
5015         (Target_x86_64::register_global_plt_entry): New function.
5016         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5017         incremental updates.
5018         (Output_data_plt_x86_64::add_relocation): New function.
5019         * testsuite/object_unittest.cc (Object_test): Set default options.
5020
5021 2011-05-16  Ian Lance Taylor  <iant@google.com>
5022
5023         * options.h (class General_options): Make -i a synonym for -r.
5024
5025 2011-05-16  Ian Lance Taylor  <iant@google.com>
5026
5027         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5028
5029 2011-05-10 Cary Coutant  <ccoutant@google.com>
5030
5031         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5032         strip_all (-s).
5033
5034 2011-05-06  Ian Lance Taylor  <iant@google.com>
5035
5036         * layout.cc (Layout::layout): If the output section flags change,
5037         update the ordering.
5038
5039 2011-04-25 Cary Coutant  <ccoutant@google.com>
5040
5041         * incremental-dump.cc (dump_incremental_inputs): Print local
5042         symbol info for each input file.
5043         * incremental.cc
5044         (Output_section_incremental_inputs::set_final_data_size): Add local
5045         symbol info to input file entries in incremental info.
5046         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5047         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5048         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5049         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5050         implementation.
5051         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5052         (Sized_incr_relobj::do_relocate): Write the local symbols.
5053         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5054         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5055         Adjust size of input file header.
5056         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5057         (Incremental_inputs_reader::get_local_symbol_count): New function.
5058         (Incremental_inputs_reader::get_input_section): Adjust size of input
5059         file header.
5060         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5061         (Sized_incr_relobj::This): New typedef.
5062         (Sized_incr_relobj::sym_size): New const data member.
5063         (Sized_incr_relobj::Local_symbol): New struct.
5064         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5065         (Sized_incr_relobj::do_local_symbol_offset): New function.
5066         (Sized_incr_relobj::local_symbol_count_): New data member.
5067         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5068         (Sized_incr_relobj::local_symbol_index_): New data member.
5069         (Sized_incr_relobj::local_symbol_offset_): New data member.
5070         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5071         (Sized_incr_relobj::local_symbols_): New data member.
5072         * object.h (Relobj::output_local_symbol_count): New function.
5073         (Relobj::local_symbol_offset): New function.
5074         (Relobj::do_output_local_symbol_count): New function.
5075         (Relobj::do_local_symbol_offset): New function.
5076         (Sized_relobj::do_output_local_symbol_count): New function.
5077         (Sized_relobj::do_local_symbol_offset): New function.
5078
5079 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5080
5081         * descriptors.cc (set_close_on_exec): New function.
5082         (Descriptors::open): Use set_close_on_exec.
5083         * output.cc (S_ISLNK): Define if not defined.
5084
5085 2011-04-22 Cary Coutant  <ccoutant@google.com>
5086
5087         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5088         global symbol map.
5089         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5090         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5091         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5092         relocations.
5093         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5094         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5095         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5096         * incremental.h
5097         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5098         function.
5099         (Incremental_binary::apply_incremental_relocs): New function.
5100         (Incremental_binary::do_apply_incremental_relocs): New function.
5101         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5102         data member.
5103         (Sized_incremental_binary::add_global_symbol): New function.
5104         (Sized_incremental_binary::global_symbol): New function.
5105         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5106         (Sized_incremental_binary::symbol_map_): New data member.
5107         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5108         * target.h (Sized_target::apply_relocation): New function.
5109         * target-reloc.h (apply_relocation): New function.
5110         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5111
5112 2011-04-22  Doug Kwan  <dougkwan@google.com>
5113
5114         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5115         flag of a SHT_ARM_EXIDX section.
5116         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5117         * testsuite/Makefile.in: Regenerate.
5118         * testsuite/arm_exidx_test.s: New file.
5119         * testsuite/arm_exidx_test.sh: Same.
5120
5121 2011-04-20 Cary Coutant  <ccoutant@google.com>
5122
5123         PR gold/12689
5124         * archive.h (Incremental_archive_entry::Archive_member):
5125         Initialize arg_serial_ (second constructor).
5126
5127 2011-04-17  Ian Lance Taylor  <iant@google.com>
5128
5129         * object.cc (Relocate_info::location): Simplify location string.
5130         * errors.cc (Errors::error_at_location): Don't print program
5131         name.
5132         (Errors::warning_at_location): Likewise.
5133         (Errors::undefined_symbol): Likewise.
5134         * testsuite/debug_msg.sh: Update accordingly.
5135
5136 2011-04-14 Cary Coutant  <ccoutant@google.com>
5137
5138         * gold/layout.cc (Layout::symtab_section_offset): New function.
5139         * gold/layout.h (Layout::symtab_section_offset): New function.
5140         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5141
5142 2011-04-12  Ian Lance Taylor  <iant@google.com>
5143
5144         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5145         with MREMAP_MAYMOVE.
5146         * output.h (class Output_file): Add map_is_allocated_ field.
5147         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5148         not available, provide stubs.  If mremap is not available, #define
5149         it to gold_mremap.
5150         (MREMAP_MAYMOVE): Define if not defined.
5151         (Output_file::Output_file): Initialize map_is_allocated_.
5152         (Output_file::resize): Check map_is_allocated_.
5153         (Output_file::map_anonymous): If mmap fails, use malloc.
5154         (Output_file::unmap): Don't do anything for an anonymous map.
5155         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5156         is not available, provide stubs.
5157         (File_read::View::~View): Use free rather than delete[].
5158         (File_read::make_view): Use malloc rather than new[].  If mmap
5159         fails, use malloc.
5160         (File_read::find_or_make_view): Use malloc rather than new[].
5161         * gold.h: Remove HAVE_REMAP code.
5162         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5163         exists.  Rename mremap to gold_mremap.  If mmap is not available
5164         don't do anything.
5165         * configure, config.in: Rebuild.
5166
5167 2011-04-11  Ian Lance Taylor  <iant@google.com>
5168
5169         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5170         initialize local variable v.
5171
5172 2011-04-11  Cary Coutant  <ccoutant@google.com>
5173
5174         * archive.cc (Archive::include_member): Adjust call to
5175         report_object.
5176         (Add_archive_symbols::run): Track argument serial numbers.
5177         (Lib_group::include_member): Likewise.
5178         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5179         * archive.h (Incremental_archive_entry::Archive_member):
5180         Initialize arg_serial_.
5181         (Archive_member::arg_serial_): New data member.
5182         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5183         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5184         incremental link.
5185         (Sized_dynobj::do_for_all_local_got_entries): New function.
5186         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5187         function.
5188         * fileread.cc (get_mtime): New function.
5189         * fileread.h (get_mtime): New function.
5190         * gold.cc (queue_initial_tasks): Check for incremental update.
5191         (process_incremental_input): New function.
5192         (queue_middle_tasks): Don't force valid target for incremental
5193         update.
5194         * incremental-dump.cc (find_input_containing_global): Adjust
5195         size of symbol info entry.
5196         (dump_incremental_inputs): Dump argument serial number and
5197         in_system_directory flag; bias shndx by 1; print symbol names
5198         when dumping per-file symbol lists; use new symbol info readers.
5199         * incremental.cc
5200         (Output_section_incremental_inputs:update_data_size): New function.
5201         (Sized_incremental_binary::setup_readers): Setup input readers
5202         for each input file; build maps for files added from libraries
5203         and scripts.
5204         (Sized_incremental_binary::check_input_args): New function.
5205         (Sized_incremental_binary::do_check_inputs): Build map of argument
5206         serial numbers to input arguments.
5207         (Sized_incremental_binary::do_file_has_changed): Rename
5208         do_file_is_unchanged to this; compare file modification times.
5209         (Sized_incremental_binary::do_init_layout): New function.
5210         (Sized_incremental_binary::do_reserve_layout): New function.
5211         (Sized_incremental_binary::do_get_input_reader): Remove.
5212         (Sized_incremental_binary::get_symtab_view): New function.
5213         (Incremental_checker::can_incrementally_link_output_file): Remove.
5214         (Incremental_inputs::report_command_line): Exclude --debug options.
5215         (Incremental_inputs::report_archive_begin): Add parameter; track
5216         argument serial numbers; don't put input file entry for archive
5217         before archive members.
5218         (Incremental_inputs::report_archive_end): Put input file entry
5219         for archive after archive members.
5220         (Incremental_inputs::report_object): Add parameter; track argument
5221         serial numbers and in_system_directory flag.
5222         (Incremental_inputs::report_script): Add parameter; track argument
5223         serial numbers.
5224         (Output_section_incremental_inputs::set_final_data_size): Adjust
5225         size of symbol info entry; check for forwarding symbols.
5226         (Output_section_incremental_inputs::write_input_files): Write
5227         in_system_directory flag and argument serial number.
5228         (Output_section_incremental_inputs::write_info_blocks): Map section
5229         indices between incremental info and original input file; store
5230         input section index for each symbol.
5231         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5232         change operator() to visit().
5233         (class Global_got_offset_visitor): Likewise.
5234         (class Global_symbol_visitor_got_plt):
5235         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5236         classes.
5237         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5238         (Sized_incr_relobj::do_read_symbols): New function.
5239         (Sized_incr_relobj::do_layout): New function.
5240         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5241         (Sized_incr_relobj::do_add_symbols): New function.
5242         (Sized_incr_relobj::do_should_include_member): New function.
5243         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5244         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5245         (Sized_incr_relobj::do_section_size): New function.
5246         (Sized_incr_relobj::do_section_name): New function.
5247         (Sized_incr_relobj::do_section_contents): New function.
5248         (Sized_incr_relobj::do_section_flags): New function.
5249         (Sized_incr_relobj::do_section_entsize): New function.
5250         (Sized_incr_relobj::do_section_address): New function.
5251         (Sized_incr_relobj::do_section_type): New function.
5252         (Sized_incr_relobj::do_section_link): New function.
5253         (Sized_incr_relobj::do_section_info): New function.
5254         (Sized_incr_relobj::do_section_addralign): New function.
5255         (Sized_incr_relobj::do_initialize_xindex): New function.
5256         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5257         (Sized_incr_relobj::do_read_relocs): New function.
5258         (Sized_incr_relobj::do_gc_process_relocs): New function.
5259         (Sized_incr_relobj::do_scan_relocs): New function.
5260         (Sized_incr_relobj::do_count_local_symbols): New function.
5261         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5262         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5263         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5264         (Sized_incr_relobj::do_relocate): New function.
5265         (Sized_incr_relobj::do_set_section_offset): New function.
5266         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5267         (Sized_incr_dynobj::do_read_symbols): New function.
5268         (Sized_incr_dynobj::do_layout): New function.
5269         (Sized_incr_dynobj::do_add_symbols): New function.
5270         (Sized_incr_dynobj::do_should_include_member): New function.
5271         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5272         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5273         (Sized_incr_dynobj::do_section_size): New function.
5274         (Sized_incr_dynobj::do_section_name): New function.
5275         (Sized_incr_dynobj::do_section_contents): New function.
5276         (Sized_incr_dynobj::do_section_flags): New function.
5277         (Sized_incr_dynobj::do_section_entsize): New function.
5278         (Sized_incr_dynobj::do_section_address): New function.
5279         (Sized_incr_dynobj::do_section_type): New function.
5280         (Sized_incr_dynobj::do_section_link): New function.
5281         (Sized_incr_dynobj::do_section_info): New function.
5282         (Sized_incr_dynobj::do_section_addralign): New function.
5283         (Sized_incr_dynobj::do_initialize_xindex): New function.
5284         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5285         (make_sized_incremental_object): New function.
5286         (Incremental_library::copy_unused_symbols): New function.
5287         (Incremental_library::do_for_all_unused_symbols): New function.
5288         * incremental.h (enum Incremental_input_flags): New type.
5289         (class Incremental_checker): Remove.
5290         (Incremental_input_entry::Incremental_input_entry): Add argument
5291         serial number.
5292         (Incremental_input_entry::arg_serial): New function.
5293         (Incremental_input_entry::set_is_in_system_directory): New function.
5294         (Incremental_input_entry::is_in_system_directory): New function.
5295         (Incremental_input_entry::arg_serial_): New data member.
5296         (Incremental_input_entry::is_in_system_directory_): New data member.
5297         (class Script_info): Move here from script.h.
5298         (Script_info::Script_info): Add filename parameter.
5299         (Script_info::filename): New function.
5300         (Script_info::filename_): New data member.
5301         (Incremental_script_entry::Incremental_script_entry): Add argument
5302         serial number.
5303         (Incremental_object_entry::Incremental_object_entry): Likewise.
5304         (Incremental_object_entry::add_input_section): Build list of input
5305         sections with map to original shndx.
5306         (Incremental_object_entry::get_input_section_index): New function.
5307         (Incremental_object_entry::shndx_): New data member.
5308         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5309         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5310         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5311         serial number.
5312         (Incremental_inputs::report_archive_begin): Likewise.
5313         (Incremental_inputs::report_object): Likewise.
5314         (Incremental_inputs::report_script): Likewise.
5315         (class Incremental_global_symbol_reader): New class.
5316         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5317         and store flags and input file type.
5318         (Incremental_input_entry_reader::arg_serial): New function.
5319         (Incremental_input_entry_reader::type): Extract type from flags.
5320         (Incremental_input_entry_reader::is_in_system_directory): New function.
5321         (Incremental_input_entry_reader::get_input_section_count): Call
5322         accessor function for type.
5323         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5324         function for type; adjust size of global symbol entry.
5325         (Incremental_input_entry_reader::get_global_symbol_count): Call
5326         accessor function for type.
5327         (Incremental_input_entry_reader::get_object_count): Likewise.
5328         (Incremental_input_entry_reader::get_object_offset): Likewise.
5329         (Incremental_input_entry_reader::get_member_count): Likewise.
5330         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5331         (Incremental_input_entry_reader::get_member_offset): Likewise.
5332         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5333         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5334         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5335         (Incremental_input_entry_reader::get_global_symbol_reader): New
5336         function.
5337         (Incremental_input_entry_reader::get_output_symbol_index): New
5338         function.
5339         (Incremental_input_entry_reader::type_): Remove.
5340         (Incremental_input_entry_reader::flags_): New data member.
5341         (Incremental_inputs_reader::input_file_offset): New function.
5342         (Incremental_inputs_reader::input_file_index): New function.
5343         (Incremental_inputs_reader::input_file): Call input_file_offset.
5344         (Incremental_inputs_reader::input_file_at_offset): New function.
5345         (Incremental_relocs_reader::get_r_type): Reformat.
5346         (Incremental_relocs_reader::get_r_shndx): Reformat.
5347         (Incremental_relocs_reader::get_r_offset): Reformat.
5348         (Incremental_relocs_reader::data): New function.
5349         (Incremental_binary::Incremental_binary): Initialize new data members.
5350         (Incremental_binary::check_inputs): Add cmdline parameter.
5351         (Incremental_binary::file_is_unchanged): Remove.
5352         (Input_reader::arg_serial): New function.
5353         (Input_reader::get_unused_symbol_count): New function.
5354         (Input_reader::get_unused_symbol): New function.
5355         (Input_reader::do_arg_serial): New function.
5356         (Input_reader::do_get_unused_symbol_count): New function.
5357         (Input_reader::do_get_unused_symbol): New function.
5358         (Incremental_binary::input_file_count): New function.
5359         (Incremental_binary::get_input_reader): Change signature to use
5360         index instead of filename.
5361         (Incremental_binary::file_has_changed): New function.
5362         (Incremental_binary::get_input_argument): New function.
5363         (Incremental_binary::get_library): New function.
5364         (Incremental_binary::get_script_info): New function.
5365         (Incremental_binary::init_layout): New function.
5366         (Incremental_binary::reserve_layout): New function.
5367         (Incremental_binary::output_file): New function.
5368         (Incremental_binary::do_check_inputs): New function.
5369         (Incremental_binary::do_file_is_unchanged): Remove.
5370         (Incremental_binary::do_file_has_changed): New function.
5371         (Incremental_binary::do_init_layout): New function.
5372         (Incremental_binary::do_reserve_layout): New function.
5373         (Incremental_binary::do_input_file_count): New function.
5374         (Incremental_binary::do_get_input_reader): Change signature.
5375         (Incremental_binary::input_args_map_): New data member.
5376         (Incremental_binary::library_map_): New data member.
5377         (Incremental_binary::script_map_): New data member.
5378         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5379         new data members.
5380         (Sized_incremental_binary::output_section): New function.
5381         (Sized_incremental_binary::inputs_reader): Add const.
5382         (Sized_incremental_binary::symtab_reader): Add const.
5383         (Sized_incremental_binary::relocs_reader): Add const.
5384         (Sized_incremental_binary::got_plt_reader): Add const.
5385         (Sized_incremental_binary::get_symtab_view): New function.
5386         (Sized_incremental_binary::Inputs_reader): New typedef.
5387         (Sized_incremental_binary::Input_entry_reader): New typedef.
5388         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5389         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5390         (Sized_incremental_binary::do_file_has_changed): New function.
5391         (Sized_incremental_binary::do_init_layout): New function.
5392         (Sized_incremental_binary::do_reserve_layout): New function.
5393         (Sized_input_reader::Inputs_reader): Remove.
5394         (Sized_input_reader::Input_entry_reader): Remove.
5395         (Sized_input_reader::do_arg_serial): New function.
5396         (Sized_input_reader::do_get_unused_symbol_count): New function.
5397         (Sized_input_reader::do_get_unused_symbol): New function.
5398         (Sized_incremental_binary::do_input_file_count): New function.
5399         (Sized_incremental_binary::do_get_input_reader): Change signature;
5400         use index instead of filename.
5401         (Sized_incremental_binary::section_map_): New data member.
5402         (Sized_incremental_binary::input_entry_readers_): New data member.
5403         (class Sized_incr_relobj): New class.
5404         (class Sized_incr_dynobj): New class.
5405         (make_sized_incremental_object): New function.
5406         (class Incremental_library): New class.
5407         * layout.cc (Free_list::num_lists): New static data member.
5408         (Free_list::num_nodes): New static data member.
5409         (Free_list::num_removes): New static data member.
5410         (Free_list::num_remove_visits): New static data member.
5411         (Free_list::num_allocates): New static data member.
5412         (Free_list::num_allocate_visits): New static data member.
5413         (Free_list::init): New function.
5414         (Free_list::remove): New function.
5415         (Free_list::allocate): New function.
5416         (Free_list::dump): New function.
5417         (Free_list::print_stats): New function.
5418         (Layout_task_runner::run): Resize output file for incremental updates.
5419         (Layout::Layout): Initialize new data members.
5420         (Layout::set_incremental_base): New function.
5421         (Layout::init_fixed_output_section): New function.
5422         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5423         incremental updates.
5424         (Layout::create_gold_note): Do not create gold note section for
5425         incremental updates.
5426         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5427         for incremental updates.
5428         (Layout::set_section_offsets): For incremental updates, allocate space
5429         from free list.
5430         (Layout::create_symtab_sections): Layout with offsets relative to
5431         start of section; for incremental updates, allocate space from free
5432         list.
5433         (Layout::create_shdrs): For incremental updates, allocate space from
5434         free list.
5435         (Layout::finish_dynamic_section): For incremental updates, do not
5436         check --as-needed (fixed in subsequent patch).
5437         * layout.h (class Free_list): New class.
5438         (Layout::set_incremental_base): New function.
5439         (Layout::incremental_base): New function.
5440         (Layout::init_fixed_output_section): New function.
5441         (Layout::allocate): New function.
5442         (Layout::incremental_base_): New data member.
5443         (Layout::free_list_): New data member.
5444         * main.cc (main): Print Free_list statistics.
5445         * object.cc (Relobj::finalize_incremental_relocs): Add
5446         clear_counts parameter; clear counts only when clear_counts is set.
5447         (Sized_relobj::Sized_relobj): Initialize new base class.
5448         (Sized_relobj::do_layout): Don't report special sections.
5449         (Sized_relobj::do_for_all_local_got_entries): New function.
5450         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5451         symtab_off to all symbol table offsets.
5452         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5453         * object.h (class Got_offset_list): Move to top of file.
5454         (Object::Object): Allow case where input_file == NULL.
5455         (Object::~Object): Likewise.
5456         (Object::input_file): Assert that input_file != NULL.
5457         (Object::lock): Allow case where input_file == NULL.
5458         (Object::unlock): Likewise.
5459         (Object::is_locked): Likewise.
5460         (Object::token): Likewise.
5461         (Object::release): Likewise.
5462         (Object::is_incremental): New function.
5463         (Object::get_mtime): New function.
5464         (Object::for_all_local_got_entries): New function.
5465         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5466         (Object::set_is_in_system_directory): New function.
5467         (Object::is_in_system_directory): New function.
5468         (Object::do_is_incremental): New function.
5469         (Object::do_get_mtime): New function.
5470         (Object::do_for_all_local_got_entries): New function.
5471         (Object::is_in_system_directory_): New data member.
5472         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5473         (class Sized_relobj_base): New class.
5474         (class Sized_relobj): Derive from Sized_relobj_base.
5475         (class Sized_relobj::Symbols): Redeclare from base class.
5476         (class Sized_relobj::local_got_offset_list): Remove.
5477         (class Sized_relobj::Output_sections): Redeclare from base class.
5478         (class Sized_relobj::do_for_all_local_got_entries): New function.
5479         (class Sized_relobj::write_local_symbols): Add offset parameter.
5480         (class Sized_relobj::local_symbol_offset_): Update comment.
5481         (class Sized_relobj::local_dynsym_offset_): Update comment.
5482         * options.cc (Input_arguments::add_file): Remove const.
5483         * options.h (Input_file_argument::Input_file_argument):
5484         Initialize arg_serial_ (all constructors).
5485         (Input_file_argument::set_arg_serial): New function.
5486         (Input_file_argument::arg_serial): New function.
5487         (Input_file_argument::arg_serial_): New data member.
5488         (Input_arguments::Input_arguments): Initialize file_count_.
5489         (Input_arguments::add_file): Remove const.
5490         (Input_arguments::number_of_input_files): New function.
5491         (Input_arguments::file_count_): New data member.
5492         (Command_line::number_of_input_files): Call
5493         Input_arguments::number_of_input_files.
5494         * output.cc (Output_segment_headers::Output_segment_headers):
5495         Set current size.
5496         (Output_section::Input_section::current_data_size): New function.
5497         (Output_section::Output_section): Initialize new data members.
5498         (Output_section::add_input_section): Don't do merge sections for
5499         an incremental link; allocate space from free list for an
5500         incremental update.
5501         (Output_section::add_output_section_data): Allocate space from
5502         free list for an incremental update.
5503         (Output_section::update_data_size): New function.
5504         (Output_section::set_fixed_layout): New function.
5505         (Output_section::reserve): New function.
5506         (Output_segment::set_section_addresses): Remove const.
5507         (Output_segment::set_section_list_addresses): Remove const; allocate
5508         space from free list for an incremental update.
5509         (Output_segment::set_offset): Adjust size of RELRO segment for an
5510         incremental update.
5511         * output.h (Output_data::current_data_size): Move here from
5512         child classes.
5513         (Output_data::pre_finalize_data_size): New function.
5514         (Output_data::update_data_size): New function.
5515         (Output_section_headers::update_data_size): new function.
5516         (Output_section_data_build::current_data_size): Move to Output_data.
5517         (Output_data_strtab::update_data_size): New function.
5518         (Output_section::current_data_size): Move to Output_data.
5519         (Output_section::set_fixed_layout): New function.
5520         (Output_section::has_fixed_layout): New function.
5521         (Output_section::reserve): New function.
5522         (Output_section::update_data_size): New function.
5523         (Output_section::has_fixed_layout_): New data member.
5524         (Output_section::free_list_): New data member.
5525         (Output_segment::set_section_addresses): Remove const.
5526         (Output_segment::set_section_list_addresses): Remove const.
5527         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5528         New function.
5529         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5530         New function.
5531         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5532         parameter when calling Add_symbols constructor; store argument
5533         serial number for members of a lib group.
5534         (Add_symbols::locks): Allow case where token == NULL.
5535         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5536         (Read_member::~Read_member): New function.
5537         (Read_member::is_runnable): New function.
5538         (Read_member::locks): New function.
5539         (Read_member::run): New function.
5540         (Check_script::~Check_script): New function.
5541         (Check_script::is_runnable): New function.
5542         (Check_script::locks): New function.
5543         (Check_script::run): New function.
5544         (Check_library::~Check_library): New function.
5545         (Check_library::is_runnable): New function.
5546         (Check_library::locks): New function.
5547         (Check_library::run): New function.
5548         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5549         (Add_symbols::library_): New data member.
5550         (class Read_member): New class.
5551         (class Check_script): New class.
5552         (class Check_library): New class.
5553         * reloc.cc (Read_relocs::is_runnable): Allow case where
5554         token == NULL.
5555         (Read_relocs::locks): Likewise.
5556         (Scan_relocs::locks): Likewise.
5557         (Relocate_task::locks): Likewise.
5558         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5559         to clear counters.
5560         (Sized_relobj::incremental_relocs_scan): Fix comment.
5561         (Sized_relobj::do_relocate): Pass output file offset to
5562         write_local_symbols.
5563         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5564         from class declaration.
5565         * script.cc (read_input_script): Allocate Script_info; pass
5566         argument serial number to report_script.
5567         * script.h (class Script_info): Move to incremental.h.
5568         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5569         * symtab.h (Symbol_table::add_from_incrobj): New function.
5570         (Symbol_table::set_file_offset): New function.
5571
5572 2011-04-05  Cary Coutant  <ccoutant@google.com>
5573
5574         * incremental-dump.cc (dump_incremental_inputs): Change signature
5575         to take a Sized_incremental_binary; change caller.  Use readers
5576         in Sized_incremental_binary.
5577         * incremental.cc
5578         (Sized_incremental_binary::find_incremental_inputs_sections):
5579         Rename do_find_incremental_inputs_sections to this.
5580         (Sized_incremental_binary::setup_readers): New function.
5581         (Sized_incremental_binary::do_check_inputs): Check
5582         has_incremental_info_ flag; move setup code to setup_readers;
5583         use input readers.
5584         (Sized_incremental_binary::do_file_is_unchanged): New function.
5585         (Sized_incremental_binary::do_get_input_reader): New function.
5586         * incremental.h (class Incremental_binary): Move to end of file.
5587         (Incremental_binary::file_is_unchanged): New function.
5588         (Incremental_binary::do_file_is_unchanged): New function.
5589         (Incremental_binary::Input_reader): New class.
5590         (Incremental_binary::get_input_reader): New function.
5591         (class Sized_incremental_binary): Move to end of file.
5592         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5593         input section reader classes.
5594         (Sized_incremental_binary::has_incremental_info): New function.
5595         (Sized_incremental_binary::inputs_reader): New function.
5596         (Sized_incremental_binary::symtab_reader): New function.
5597         (Sized_incremental_binary::relocs_reader): New function.
5598         (Sized_incremental_binary::got_plt_reader): New function.
5599         (Sized_incremental_binary::do_file_is_unchanged): New function.
5600         (Sized_incremental_binary::Sized_input_reader): New class.
5601         (Sized_incremental_binary::get_input_reader): New function.
5602         (Sized_incremental_binary::find_incremental_inputs_sections):
5603         Rename do_find_incremental_inputs_sections to this.
5604         (Sized_incremental_binary::setup_readers): New function.
5605         (Sized_incremental_binary::has_incremental_info_): New data member.
5606         (Sized_incremental_binary::inputs_reader_): New data member.
5607         (Sized_incremental_binary::symtab_reader_): New data member.
5608         (Sized_incremental_binary::relocs_reader_): New data member.
5609         (Sized_incremental_binary::got_plt_reader_): New data member.
5610         (Sized_incremental_binary::current_input_file_): New data member.
5611
5612 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5613
5614         PR gold/12640
5615         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5616         violation.
5617
5618 2011-03-30  Cary Coutant  <ccoutant@google.com>
5619
5620         * archive.cc (Archive::include_member): Adjust call to report_object.
5621         (Add_archive_symbols::run): Add script_info to call to
5622         report_archive_begin.
5623         (Lib_group::include_member): Adjust call to report_object.
5624         (Add_lib_group_symbols::run): Adjust call to report_object.
5625         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5626         blocks.  Add object count for script input files.
5627         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5628         script_info parameter; change all callers.
5629         (Incremental_inputs::report_object): Add script_info parameter;
5630         change all callers.
5631         (Incremental_inputs::report_script): Store backpointer to
5632         incremental info entry.
5633         (Output_section_incremental_inputs::set_final_data_size): Record
5634         additional information for scripts.
5635         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5636         * incremental.h (Incremental_script_entry::add_object): New function.
5637         (Incremental_script_entry::get_object_count): New function.
5638         (Incremental_script_entry::get_object): New function.
5639         (Incremental_script_entry::objects_): New data member; adjust
5640         constructor.
5641         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5642         (Incremental_inputs::report_object): Add script_info parameter.
5643         (Incremental_inputs_reader::get_object_count): New function.
5644         (Incremental_inputs_reader::get_object_offset): New function.
5645         * options.cc (Input_arguments::add_file): Return reference to
5646         new input argument.
5647         * options.h (Input_argument::set_script_info): New function.
5648         (Input_argument::script_info): New function.
5649         (Input_argument::script_info_): New data member; adjust all
5650         constructors.
5651         (Input_file_group::add_file): Return reference to new input argument.
5652         (Input_file_lib::add_file): Likewise.
5653         (Input_arguments::add_file): Likewise.
5654         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5655         * script.cc (Parser_closure::Parser_closure): Add script_info
5656         parameter; adjust all callers.
5657         (Parser_closure::script_info): New function.
5658         (Parser_closure::script_info_): New data member.
5659         (read_input_script): Report scripts earlier to incremental info.
5660         (script_add_file): Set script_info in Input_argument.
5661         (script_add_library): Likewise.
5662         * script.h (Script_options::Script_info): Rewrite class.
5663
5664 2011-03-29  Cary Coutant  <ccoutant@google.com>
5665
5666         * archive.cc (Library_base::should_include_member): Move
5667         method here from class Archive.
5668         (Archive::Archive): Initialize base class.
5669         (Archive::should_include_member): Move to base class.
5670         (Archive::do_for_all_unused_symbols): New function.
5671         (Add_archive_symbols::run): Remove redundant access to
5672         incremental_inputs.
5673         (Lib_group::Lib_group): Initialize base class.
5674         (Lib_group::do_filename): New function.
5675         (Lib_group::include_member): Pass pointer to Lib_group to
5676         report_object.
5677         (Lib_group::do_for_all_unused_symbols): New function.
5678         (Add_lib_group_symbols::run): Report archive information for
5679         incremental links.
5680         * archive.h (class Library_base): New base class.
5681         (class Archive): Derive from Library_base.
5682         (Archive::filename): Move to base class.
5683         (Archive::set_incremental_info): Likewise.
5684         (Archive::incremental_info): Likewise.
5685         (Archive::Should_include): Likewise.
5686         (Archive::should_include_member): Likewise.
5687         (Archive::Armap_entry): Remove.
5688         (Archive::Unused_symbol_iterator): Remove.
5689         (Archive::unused_symbols_begin): Remove.
5690         (Archive::unused_symbols_end): Remove.
5691         (Archive::do_filename): New function.
5692         (Archive::do_get_mtime): New function.
5693         (Archive::do_for_all_unused_symbols): New function.
5694         (Archive::task_): Move to base class.
5695         (Archive::incremental_info_): Likewise.
5696         (class Lib_group): Derive from Library_base.
5697         (Lib_group::do_filename): New function.
5698         (Lib_group::do_get_mtime): New function.
5699         (Lib_group::do_for_all_unused_symbols): New function.
5700         (Lib_group::task_): Move to base class.
5701         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5702         function.
5703         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5704         function.
5705         * incremental.cc (Incremental_inputs::report_archive_begin):
5706         Use Library_base; call library's get_mtime; add incremental inputs
5707         entry before members.
5708         (class Unused_symbol_visitor): New class.
5709         (Incremental_inputs::report_archive_end): Use Library_base; use
5710         visitor class to record unused symbols; don't add incremental inputs
5711         entry after members.
5712         (Incremental_inputs::report_object): Use Library_base.
5713         * incremental.h
5714         (Incremental_archive_entry::Incremental_archive_entry): Remove
5715         unused Archive parameter.
5716         (Incremental_inputs::report_archive_begin): Use Library_base.
5717         (Incremental_inputs::report_archive_end): Likewise.
5718         (Incremental_inputs::report_object): Likewise.
5719         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5720         function.
5721         * object.h (Object::for_all_global_symbols): New function.
5722         (Object::do_for_all_global_symbols): New function.
5723         (Sized_relobj::do_for_all_global_symbols): New function.
5724         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5725         function.
5726         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5727         function.
5728
5729 2011-03-27  Ian Lance Taylor  <iant@google.com>
5730
5731         * archive.cc (Archive::interpret_header): Return -1 if something
5732         goes wrong.  Change callers accordingly.
5733
5734 2011-03-25  Cary Coutant  <ccoutant@google.com>
5735
5736         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5737         * testsuite/Makefile.in: Regenerate.
5738
5739 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5740
5741         * plugin.cc (get_view): New.
5742         (Plugin::load): Pass get_view to the plugin.
5743         (Plugin_manager::get_view): New.
5744
5745 2011-03-21  Ian Lance Taylor  <iant@google.com>
5746
5747         * testsuite/final_layout.sh: Rewrite to not use dc.
5748         * testsuite/relro_test.sh: Fail if dc is not present.
5749
5750 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5751
5752         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5753         Change == to -eq.
5754         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5755         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5756         Change == to -eq.
5757         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5758         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5759
5760 2011-03-14  Ian Lance Taylor  <iant@google.com>
5761
5762         * script-sections.cc (Sort_output_sections::script_compare):
5763         Rename from is_before, change return type.
5764         (Sort_output_sections::operator()): Adjust accordingly.
5765
5766 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5767
5768         PR gold/12572
5769         * testsuite/odr_violation2.cc: Add comment to make all error line
5770         numbers double digits.
5771         * testsuite/debug_msg.sh: Adjust expected errors.
5772
5773 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5774
5775         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5776         but mark earlier ones as non-canonical
5777         (offset_to_iterator): Update search target and example
5778         (do_addr2line): Return extra lines in a vector*
5779         (format_file_lineno): Extract from do_addr2line
5780         (one_addr2line): Add vector* out-param
5781         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5782         when a lineno entry appeared last for its instruction
5783         (Dwarf_line_info): Add vector* out-param
5784         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5785         * symtab.cc (Odr_violation_compare): Include the lineno in the
5786         comparison again.
5787         (linenos_from_loc): New. Combine the canonical line for an
5788         address with its other lines.
5789         (True_if_intersect): New. Helper functor to make
5790         std::set_intersection a query.
5791         (detect_odr_violations): Compare sets of lines instead of just
5792         one line for each function. This became less deterministic, but
5793         has fewer false positives.
5794         * symtab.h: Declarations.
5795         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5796         mix an optimized and non-optimized object in the same binary
5797         (odr_violation2.so): Same.
5798         * testsuite/Makefile.in: Regenerate from Makefile.am.
5799         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5800         * testsuite/debug_msg.sh: Update line numbers and add
5801         assertions.
5802         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5803         non-optimized context.
5804         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5805         isn't inlined, and use OdrDerived in an optimized context.
5806         * testsuite/odr_header1.h: Defines OdrDerived, where
5807         optimization will change the
5808         first-instruction-in-the-destructor's file and line number.
5809         * testsuite/odr_header2.h: Defines OdrBase.
5810
5811 2011-03-09  Ian Lance Taylor  <iant@google.com>
5812
5813         * fileread.cc (File_read::clear_views): Don't delete the whole
5814         file view.
5815
5816 2011-03-08  Ian Lance Taylor  <iant@google.com>
5817
5818         PR gold/12525
5819         * fileread.cc: #include <climits>.
5820         (GOLD_IOV_MAX): Define.
5821         (File_read::read_multiple): Limit number of entries by iov_max.
5822         * fileread.h (class File_read): Always set max_readv_entries to
5823         128.
5824
5825 2011-03-07  Ian Lance Taylor  <iant@google.com>
5826
5827         PR gold/12525
5828         * options.h (class General_options): Add -dy and -dn.
5829
5830 2011-03-02  Cary Coutant  <ccoutant@google.com>
5831
5832         * testsuite/script_test_9.t: Add TLS segment.
5833
5834 2011-03-02  Simon Baldwin  <simonb@google.com>
5835
5836         * configure.ac: Add check for gnu_indirect_function support in
5837         the toolchain building binutils.
5838         * configure: Rebuild.
5839
5840 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5841
5842         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5843         plugin only symbols.
5844         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5845         in plugin files as not needed in the symbol table.
5846
5847 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5848
5849         * output.cc (Output_section::add_input_section): Delay fill
5850         generation for section ordering.
5851
5852 2011-02-09  Ian Lance Taylor  <iant@google.com>
5853
5854         PR gold/12316
5855         * object.h (class Sized_relobj): Remove clear_local_symbols.
5856         * reloc.cc (Sized_relobj::do_relocate): Don't call
5857         clear_local_symbols.
5858
5859 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5860
5861         * plugin.cc (is_visible_from_outside): Return true for symbols
5862         in the -u option.
5863
5864 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5865
5866         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5867         filename.
5868
5869 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5870
5871         * icf.h (is_section_foldable_candidate): Change type of parameter
5872         to std::string.
5873         * icf.cc (Icf::find_identical_sections): Change type of local variable
5874         section_name to be std::string.
5875         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5876
5877 2011-01-25  Ian Lance Taylor  <iant@google.com>
5878
5879         * script.cc (script_add_extern): Rewrite to use
5880         add_symbol_reference.
5881
5882 2011-01-25  Doug Kwan  <dougkwan@google.com>
5883
5884         * icf.cc (get_section_contents): Always lock section's object.
5885
5886 2011-01-24  Ian Lance Taylor  <iant@google.com>
5887
5888         * options.h (class General_options): Accept
5889         --no-detect-odr-violations.
5890
5891 2011-01-24  Ian Lance Taylor  <iant@google.com>
5892
5893         * version.cc (version_string): Bump to 1.11.
5894
5895 2011-01-24  Ian Lance Taylor  <iant@google.com>
5896
5897         * plugin.cc (class Plugin_rescan): Define new class.
5898         (Plugin_manager::claim_file): Set any_claimed_.
5899         (Plugin_manager::save_archive): New function.
5900         (Plugin_manager::save_input_group): New function.
5901         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5902         necessary.
5903         (Plugin_manager::new_undefined_symbol): New function.
5904         (Plugin_manager::rescan): New function.
5905         (Plugin_manager::rescannable_defines): New function.
5906         (Plugin_manager::add_input_file): Set any_added_.
5907         * plugin.h (class Plugin_manager): define new fields rescannable_,
5908         undefined_symbols_, any_claimed_, and any_added_.  Declare
5909         Plugin_rescan as friend.  Declare new functions.
5910         (Plugin_manager::Rescannable): Define type.
5911         (Plugin_manager::Rescannable_list): Define type.
5912         (Plugin_manager::Undefined_symbol_list): Define type.
5913         (Plugin_manager::Plugin_manager): Initialize new fields.
5914         * archive.cc (Archive::defines_symbol): New function.
5915         (Add_archive_symbols::run): Pass archive to plugins if any.
5916         * archive.h (class Archive): Declare defines_symbol.
5917         * readsyms.cc (Input_group::~Input_group): New function.
5918         (Finish_group::run): Pass input_group to plugins if any.
5919         * readsyms.h (class Input_group): Declare destructor.
5920         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5921         any.
5922
5923 2011-01-10  Ian Lance Taylor  <iant@google.com>
5924
5925         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5926         section as relro.
5927         (Layout::set_segment_offsets): Reset increase_relro before calling
5928         set_section_addresses a second time.
5929
5930 2011-01-04  Cary Coutant  <ccoutant@google.com>
5931
5932         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5933         sections before NOBITS sections.
5934
5935 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5936
5937         * version.cc (print_version): Update copyright to 2011.
5938
5939 2010-12-23  Cary Coutant  <ccoutant@google.com>
5940
5941         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5942         of OS to this->add.  Add OD parameter to second form of the function.
5943
5944 2010-12-20  Ian Lance Taylor  <iant@google.com>
5945
5946         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5947         second of two consecutive entries with same offset.
5948
5949 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5950
5951         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5952         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5953         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5954         to avoid unneeded links against $(LDADD).
5955         * testsuite/Makefile.in: Regenerate.
5956
5957 2010-12-15  Ian Lance Taylor  <iant@google.com>
5958
5959         PR gold/12324
5960         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5961         for R_X86_64_32 and R_X86_64_PC32.
5962         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5963         ver_matching_def_pic.o.
5964         (ver_matching_def_pic.o): New target.
5965
5966 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5967
5968         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5969         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5970         Move definition before File_read::View member definitions.
5971         (File_read::View::~View): Initialize and hold lock before
5972         updating current_mapped_bytes.
5973
5974 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5975
5976         * dwarf_reader.cc: Remove outdated comment.
5977         * gold-threads.cc: Fix typo in error message.
5978         * archive.cc: Fix typos in comments.
5979         * archive.h: Likewise.
5980         * arm-reloc-property.cc: Likewise.
5981         * arm-reloc-property.h: Likewise.
5982         * arm-reloc.def: Likewise.
5983         * arm.cc: Likewise.
5984         * attributes.h: Likewise.
5985         * cref.cc: Likewise.
5986         * ehframe.cc: Likewise.
5987         * fileread.h: Likewise.
5988         * gold.h: Likewise.
5989         * i386.cc: Likewise.
5990         * icf.cc: Likewise.
5991         * incremental.h: Likewise.
5992         * int_encoding.cc: Likewise.
5993         * layout.h: Likewise.
5994         * main.cc: Likewise.
5995         * merge.h: Likewise.
5996         * object.cc: Likewise.
5997         * object.h: Likewise.
5998         * options.cc: Likewise.
5999         * readsyms.cc: Likewise.
6000         * reduced_debug_output.cc: Likewise.
6001         * reloc.cc: Likewise.
6002         * script-sections.cc: Likewise.
6003         * sparc.cc: Likewise.
6004         * symtab.h: Likewise.
6005         * target-reloc.h: Likewise.
6006         * target.cc: Likewise.
6007         * target.h: Likewise.
6008         * timer.cc: Likewise.
6009         * timer.h: Likewise.
6010         * x86_64.cc: Likewise.
6011
6012 2010-12-09  Cary Coutant  <ccoutant@google.com>
6013
6014         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6015         stack.
6016         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6017         parameter; change all callers.
6018         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6019         * options.h (warn_execstack): New option.
6020
6021 2010-12-07  Doug Kwan  <dougkwan@google.com>
6022
6023         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6024         like function call relocations.
6025
6026 2010-12-07  Ian Lance Taylor  <iant@google.com>
6027
6028         * archive.cc (Archive::get_elf_object_for_member): Permit
6029         punconfigured to be NULL.
6030         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6031         (Archive::include_member): Pass NULL to get_elf_object_for_member
6032         if we searched for the archive and this is the first included
6033         object.
6034
6035 2010-12-01  Ian Lance Taylor  <iant@google.com>
6036
6037         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6038         track_relocs_type_ field.
6039         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6040         Set track_relocs_type_.
6041         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6042         contents when using RELA relocs.
6043         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6044         reloc_map_.
6045         * reloc.cc (Track_relocs::next_addend): New function.
6046         * reloc.h (class Track_relocs): Declare next_addend.
6047
6048 2010-12-01  Ian Lance Taylor  <iant@google.com>
6049
6050         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6051         virtual destructor.
6052
6053 2010-12-01  Ian Lance Taylor  <iant@google.com>
6054
6055         * README: Update compilers known to work and fail.
6056
6057 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6058
6059         * configure.in: For --enable-gold, handle value `default' instead of
6060         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6061         not the default.
6062         * configure: Regenerate.
6063
6064 2010-11-18  Doug Kwan  <dougkwan@google.com>
6065
6066         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6067         and right_alignment to be zero.  Store result alignment only if it is
6068         greater than existing alignment.
6069
6070 2010-11-16  Cary Coutant  <ccoutant@google.com>
6071
6072         PR gold/12220
6073         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6074         Check for ".zdebug_line".
6075
6076 2010-11-16  Doug Kwan  <dougkwan@google.com>
6077             Cary Coutant  <ccoutant@google.com>
6078
6079         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6080         by reference; adjust all callers.
6081         * output.cc (Output_segment::set_section_addresses): Adjust references
6082         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6083         list is empty.
6084         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6085         end at page boundary.
6086
6087 2010-11-16  Cary Coutant  <ccoutant@google.com>
6088
6089         PR gold/12220
6090         * layout.cc (Layout::choose_output_section): Transform names of
6091         compressed sections even when using a script with a SECTIONS clause.
6092         (Layout::output_section_name): Remove code to transform
6093         compressed debug section names.
6094         * output.cc (Output_section::add_input_section): Use uncompressed
6095         section size when tracking input sections.
6096
6097 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6098
6099         * symtab.h (Symbol::NON_PIC_REF): Remove.
6100         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6101         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6102         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6103         (Symbol::use_plt_offset): Take a flags argument and pass it
6104         directly to needs_dynamic_reloc.  Restrict check for undefined
6105         weak symbols to function calls.
6106         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6107         (Target_arm::Scan::global): Use it.
6108         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6109         (Target_arm::Relocate::relocate): Likewise.
6110         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6111         parameter with an r_type parameter.  Use get_reference_flags
6112         to get the flags.
6113         (Target_arm::Relocate::relocate): Update accordingly.
6114         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6115         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6116         (Target_i386::Scan::global): Likewise.
6117         (Target_i386::Relocate::relocate): Likewise.
6118         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6119         parameter with an r_type parameter.  Use get_reference_flags
6120         to get the flags.
6121         (Target_i386::Relocate::relocate): Update accordingly.
6122         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6123         (Target_powerpc::Scan::global): Use it.
6124         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6125         (Target_powerpc::Relocate::relocate): Likewise.
6126         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6127         (Target_sparc::Scan::global): Use it.
6128         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6129         (Target_sparc::Relocate::relocate): Likewise.
6130         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6131         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6132         (Target_x86_64::Scan::global): Likewise.
6133         (Target_x86_64::Relocate::relocate): Likewise.
6134
6135 2010-11-08  Doug Kwan  <dougkwan@google.com>
6136             Cary Coutant  <ccoutant@google.com>
6137
6138         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6139         (Arm_exidx_merge_section::section_contents_): New data member.
6140         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6141         (Arm_input_section::~Arm_input_section): De-allocate memory.
6142         (Arm_input_section::original_contents_): New data member.
6143         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6144         in parameters instead of calling Object::section_contents without
6145         locking.
6146         (Arm_output_section::group_section): New parameter TASK.  Pass it
6147         to callees that need locking objects.
6148         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6149         to lock EXIDX input sections.  Fix a formatting issue.  Call
6150         Arm_exidx_merged_section::build_contents to create merged section
6151         contents.
6152         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6153         to lock object of stub table owner.
6154         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6155         TEXT_SIZE to initialize data member TEXT_SIZE_.
6156         (Arm_exidx_input_section::addralign): Fix typo in comment.
6157         (Arm_exidx_input_section::text_size): New method.
6158         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6159         that require locking objects.  Lock objects before scanning for stubs
6160         and updating local symbols.
6161         (Arm_input_section<big_endian>::init): Copy contents of original
6162         input section.
6163         (Arm_input_section<big_endian>::do_write): Use saved contents of
6164         original input section instead of calling Object::section_contents
6165         without locking.
6166         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6167         size without calling Object::section_size().
6168         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6169         for size.  Allocate a buffer for merged EXIDX entries.
6170         (Arm_exidx_merged_section::build_contents): New method.
6171         (Arm_exidx_merged_section::do_write): Move merge section contents
6172         building code to Arm_exidx_merged_section::build_contetns.  Write
6173         out contetns in buffer instead of building it on the fly.
6174         (Arm_relobj::make_exidx_input_section): Also pass text section size
6175         to Arm_exidx_input_section constructor.
6176         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6177         (Arm_dynobj::do_read_symbols): Fix memory leak.
6178         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6179         * target.h: (class Task): Add forward declaration.
6180         (Target::relax): Add new parameter TASK and pass it to
6181         Target::do_relax().
6182         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6183
6184 2010-11-05  Cary Coutant  <ccoutant@google.com>
6185
6186         PR gold/10708
6187         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6188         object when reading from the file.
6189         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6190         second layout pass.
6191         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6192         when reading section contents.
6193         (get_section_contents): Likewise.
6194         (icf::find_identical_sections): Likewise.
6195         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6196         object when reading from the file.
6197         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6198         the object when doing deferred section layout.
6199
6200 2010-11-03  Nick Clifton  <nickc@redhat.com>
6201
6202         PR gold/12001
6203         * script.h (class Symbol_assignment: name): New member.  Returns
6204         the name of the symbol.
6205         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6206         Returns true if the given symbol name is on the list of
6207         assignments wating to be processed.
6208         * archive.cc (should_incldue_member): If the symbol is undefined,
6209         check to see if it is on the list of symbols pending assignment.
6210
6211 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6212
6213         * script-sections.cc (Script_sections::find_memory_region): Check
6214         for a NULL output section pointer.
6215
6216 2010-10-29  Doug Kwan  <dougkwan@google.com>
6217
6218         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6219         Output_section::add_relaxed_input_section.
6220         * output.cc (Output_section::add_relaxed_input_section): Add new
6221         arguments LAYOUT and NAME.  Set section order index.
6222         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6223         Copy section order index.
6224         * output.h (Output_section::add_relaxed_input_section): Add new
6225         arguments LAYOUT and NAME.
6226
6227 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6228
6229         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6230         NATIVE_OR_CROSS_LINKER.
6231         * testsuite/Makefile.in: Regenerate.
6232
6233 2010-10-20  Doug Kwan  <dougkwan@google.com>
6234
6235         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6236         without SHF_LINK_ORDER flags.
6237         * layout.cc (Layout::choose_output_section): Do not filter
6238         SHF_LINK_ORDER flag in a relocatable link.
6239
6240 2010-10-17  Cary Coutant  <ccoutant@google.com>
6241
6242         * output.h (Output_segment::set_section_addresses): Change function
6243         signature.  Update all callers.
6244         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6245         sections.
6246         (Output_segment::set_section_addresses): Align after last TLS
6247         section.  Add padding before last relro section instead of after.
6248
6249 2010-10-17  Doug Kwan  <dougkwan@google.com>
6250
6251         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6252         GOT output section to be writable.
6253
6254 2010-10-14  Cary Coutant  <ccoutant@google.com>
6255
6256         * debug.h (DEBUG_INCREMENTAL): New flag.
6257         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6258         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6259         mode.
6260         * incremental.cc (report_command_line): Ignore all forms of
6261         --incremental.
6262         * layout.cc (Layout::Layout): Check parameters for incremental link
6263         mode.
6264         * options.cc (General_options::parse_incremental): New function.
6265         (General_options::parse_no_incremental): New function.
6266         (General_options::parse_incremental_full): New function.
6267         (General_options::parse_incremental_update): New function.
6268         (General_options::incremental_mode_): New data member.
6269         (General_options::finalize): Check incremental_mode_.
6270         * options.h (General_options): Update help text for --incremental.
6271         Add --no-incremental, --incremental-full, --incremental-update.
6272         (General_options::Incremental_mode): New enum type.
6273         (General_options::incremental_mode): New function.
6274         (General_options::incremental_mode_): New data member.
6275         * parameters.cc (Parameters::incremental_mode_): New data member.
6276         (Parameters::set_options): Set incremental_mode_.
6277         (Parameters::set_incremental_full): New function.
6278         (Parameters::incremental): New function.
6279         (Parameters::incremental_update): New function.
6280         (set_parameters_incremental_full): New function.
6281         * parameters.h (Parameters::set_incremental_full): New function.
6282         (Parameters::incremental): New function.
6283         (Parameters::incremental_update): New function.
6284         (Parameters::incremental_mode_): New data member.
6285         (set_parameters_incremental_full): New function.
6286         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6287         incremental link mode.
6288         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6289         (Sized_relobj::do_relocate_sections): Likewise.
6290         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6291         option.
6292         * testsuite/Makefile.in: Regenerate.
6293         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6294
6295 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6296
6297         * script-sections.h (class Script_sections): Make
6298         Sections_elements typedef public.
6299         * script-sections.cc (class Sort_output_sections): Add elements_
6300         field.  Add constructor which sets it; change all callers.
6301         (Sort_output_sections::is_before): New function.
6302         (Sort_output_sections::operator()): Call is_before.
6303         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6304         conditional.
6305         * testsuite/script_test_10.sh: New test. Test script section
6306         order.
6307         * testsuite/script_test_10.t: Likewise.
6308         * testsuite/script_test_10.s: Likewise.
6309         * testsuite/Makefile.am: Wrap the cross linker tests and the
6310         common tests into NATIVE_OR_CROSS_LINKER.
6311         (check_SCRIPTS): Add script_test_10.sh.
6312         (check_DATA): Add script_test_10.stdout.
6313         (script_test_10.o, script_test_10): New targets.
6314         (script_test_10.stdout): New target.
6315         * configure, testsuite/Makefile.in: Regenerate.
6316
6317 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6318
6319         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6320         error for the deprecated relocations.
6321         (Target_arm::Scan::global): Likewise.
6322         (Target_arm::Relocate::relocate): Likewise.
6323
6324 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6325
6326         * fileread.cc (Input_file::find_file): Initialize *found_name
6327         and *namep when using the fallback search for case 4.
6328
6329 2010-10-11  Cary Coutant  <ccoutant@google.com>
6330
6331         * options.h (class General_options): Redefine -z lazy as an alias for
6332         the negation of -z now.
6333
6334 2010-10-11  Ian Lance Taylor  <iant@google.com>
6335
6336         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6337         binding.
6338
6339 2010-10-06  Nick Clifton  <nickc@redhat.com>
6340
6341         * script-sections.cc(class Memory_region): Remove
6342         current_lma_offset_ field.  Rename current_vma_offset_ to
6343         current_offset_.  Add last_section_ field.
6344         (Memory_region::get_current_vma_address): Rename to
6345         get_current_address.
6346         (Memory_region::get_current_lma_address): Delete.
6347         (Memory_region::increment_vma_offset): Rename to
6348         increment_offset.
6349         (Memory_region::increment_lma_offset): Delete.
6350         (Memory_region::attributes_compatible): New method.  Returns
6351         true if the provided section is compatible with the region.
6352         (Memory_region::get_last_section): New method.  Returns the last
6353         section to use the region.
6354         (Memory_region::set_last_section): New method.  Stores the last
6355         section to use the region.
6356         (Script_sections::block_in_region): New method.  Returns true if
6357         a block of memory is contained within a region.
6358         (Script_sections::find_memory_region): New method.  Locates a
6359         memory region to be used to set a VMA or LMA address.
6360         (Output_section_definition::set_section_addresses): Add code to
6361         check for addresses set by memory regions.
6362         (Output_segment::set_section_addresses): Remove memory region
6363         walking code.
6364         (Script_sections::create_segment): Add a warning if a header
6365         segment is created outside of any region.
6366         * script-sections.h (class Script_sections): Add prototypes for
6367         find_memory_region and block_in_region methods.
6368         * testsuite/memory_test.s: Use .long instead of .word.
6369         * testsuite/memory_test.t: Add some more output sections.
6370         * testsuite/memory_test.sh: Update expected output.
6371
6372 2010-10-02  Doug Kwan  <dougkwan@google.com>
6373
6374         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6375         defintion to symtab.h
6376         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6377         declaration to defintion.
6378
6379 2010-10-01  Nick Clifton  <nickc@redhat.com>
6380
6381         * expression.cc (eval): Replace dummy argument with NULL.
6382         (eval_maybe_dot): Check for a NULL result section pointer.
6383         (Symbol_expression::value): Likewise.
6384         (Dot_expression::value): Likewise.
6385         (BINARY_EXPRESSION): Likewise.
6386         (Max_expression::value): Likewise.
6387         (Min_expression::value): Likewise.
6388         (Absolute_expression::value): Likewise.
6389         (Addr_expression::value_from_output_section): Likewise.
6390         (Loaddddr_expression::value_from_output_section): Likewise.
6391         (Segment_start_expression::value): Likewise.
6392         * script-sections.cc
6393         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6394         argument with NULL.
6395         (Sections_elememt_dot_assignment::set_section_addresses):
6396         Likewise.
6397         (Output_data_expression::do_write_to_buffer): Likewise.
6398         (Output_section_definition::finalize_symbols): Likewise.
6399         (Output_section_definition::set_section_addresses): Likewise.
6400
6401 2010-09-30  Doug Kwan  <dougkwan@google.com>
6402
6403         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6404
6405 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6406
6407         * target.h (Target::can_icf_inline_merge_sections): New virtual
6408         function.
6409         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6410         virtual function.
6411         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6412         virtual function.
6413         * icf.cc (get_section_contents): Inline merge sections only when
6414         target allows it.
6415
6416 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6417
6418         * configure: Regenerate.
6419
6420 2010-09-17  Ian Lance Taylor  <iant@google.com>
6421
6422         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6423         * testsuite/Makefile.am (memory_test.o): New target.
6424         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6425         memory_test.t.
6426         * testsuite/Makefile.in: Rebuild.
6427
6428 2010-09-17  Doug Kwan  <dougkwan@google.com>
6429
6430         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6431         defintion if relocation uses GOT entries of the symbol.
6432         * testsuite/icf_safe_test.sh: Fix test.
6433         * testsuite/icf_safe_so_test.sh: Fix test.
6434
6435 2010-09-16  Cary Coutant  <ccoutant@google.com>
6436
6437         * script_sections.cc (class Memory_region): Remove "NULL" from
6438         vector initializations.
6439
6440 2010-09-15  Cary Coutant  <ccoutant@google.com>
6441
6442         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6443         Resolve forwarding symbols.
6444
6445 2010-09-15  Doug Kwan  <dougkwan@google.com>
6446
6447         * gold/testsuite/script_test_3.t: Add ARM special sections.
6448         * gold/testsuite/script_test_4.t: Same.
6449         * gold/testsuite/script_test_5.t: Same.
6450         * gold/testsuite/script_test_6.t: Same.
6451         * gold/testsuite/script_test_7.t: Same.
6452         * gold/testsuite/script_test_7.t: Same.
6453         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6454
6455 2010-09-14  Cary Coutant  <ccoutant@google.com>
6456
6457         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6458         (Target_x86_64::Relocate::relocate_tls): Replace check for
6459         saw_tls_block_reloc_ with test for executable section.
6460
6461 2010-09-12  Cary Coutant  <ccoutant@google.com>
6462
6463         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6464         position-independent executables to shared libraries need dynamic
6465         relocations.
6466         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6467         position-independent executables.
6468         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6469         * testsuite/Makefile.in: Regenerate.
6470
6471 2010-09-10  Nick Clifton  <nickc@redhat.com>
6472
6473         PR gold/11997
6474         * testsuite/memory_test.t: Discard any sections that are not
6475         needed.
6476
6477 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6478
6479         PR gold/11996
6480         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6481         "This::" to work around a bug in gcc 4.2.
6482
6483         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6484
6485 2010-09-09  Rafael Espindola  <espindola@google.com>
6486
6487         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6488         sections with different PF_X flags in the same segment.
6489         (Layout::find_first_load_seg): Search all segments to find the first
6490         one.
6491         * options.h (rosegment): New.
6492
6493 2010-09-08  Rafael Espindola  <espindola@google.com>
6494
6495         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6496
6497 2010-09-08  Doug Kwan  <dougkwan@google.com>
6498
6499         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6500         (Arm_relobj::do_relocate_sections): Add new parameter for output
6501         file to match the parent.
6502         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6503         of local symbols instead of input values.  Update code to track
6504         changes in gold::relocate_section.
6505         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6506         (Sized_relobj::compute_final_local_value_internal): New methods.
6507         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6508         body into private version of Sized_relobj::compute_final_local_value.
6509         Call the inline method.
6510         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6511         merged symbol value if there is one.
6512         (Symbol_value::has_output_value): New method defintiion.
6513         (Sized_relobj::Compute_final_local_value_status): New enum type.
6514         (Sized_relobj::compute_final_local_value): New methods.
6515         (Sized_relobj::compute_final_local_value_internal): New methods.
6516         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6517         and arm_cortex_a8.sh.
6518         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6519         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6520         New tests.
6521         * Makefile.in: Regenerate.
6522         * testsuite/arm_bl_out_of_range.s: Update test.
6523         * testsuite/thumb_bl_out_of_range.s: Ditto.
6524         * testsuite/thumb_blx_out_of_range.s: Ditto.
6525         * testsuite/arm_branch_out_of_range.sh: New file.
6526         * testsuite/arm_cortex_a8.sh: Ditto.
6527         * testsuite/arm_cortex_a8_b.s: Ditto.
6528         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6529         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6530         * testsuite/arm_cortex_a8_bl.s: Ditto.
6531         * testsuite/arm_cortex_a8_blx.s: Ditto.
6532         * testsuite/arm_cortex_a8_local.s: Ditto.
6533         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6534         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6535
6536 2010-09-08  Rafael Espindola  <espindola@google.com>
6537
6538         * Makefile.am (memory_test.stdout): Run readelf with -W.
6539         * Makefile.in: Regenerate.
6540         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6541         64 bit output.
6542
6543 2010-09-08  Rafael Espindola  <espindola@google.com>
6544
6545         * script-sections.cc (Script_sections::add_memory_region): Convert
6546         field precision to int.
6547         * script.cc (script_set_section_region, script_set_section_region):
6548         Convert field precision to int.
6549
6550 2010-09-08  Rafael Espindola  <espindola@google.com>
6551
6552         * arm.cc (do_finalize_sections): Create the __exidx_start and
6553         __exdix_end symbols even when the section is missing.
6554
6555 2010-09-08  Nick Clifton  <nickc@redhat.com>
6556
6557         * README: Remove claim that MEMORY is not supported.
6558         * expression.cc (script_exp_function_origin)
6559         (script_exp_function_length): Move from here to ...
6560         * script.cc: ... here.
6561         (script_set_section_region, script_add_memory)
6562         (script_parse_memory_attr, script_include_directive): New
6563         functions.
6564         * script-sections.cc
6565         (class Memory_region): New class.
6566         (class Output_section_definition): Add set_memory_region,
6567         set_section_vma, set_section_lma and get_section_name methods.
6568         (class Script_Sections): Add add_memory_region,
6569         find_memory_region, find_memory_region_origin,
6570         find_memory_region_length and set_memory_region methods.
6571         Have set_section_addresses method walk the list of set memory
6572         regions.
6573         Extend the print methos to display memory regions.
6574         * script-sections.h: Add prototypes for new methods.
6575         Add enum for MEMORY region attributes.
6576         * yyscript.y: Add support for parsing MEMORY regions.
6577         * script-c.h: Add prototypes for new functions.
6578         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6579         * testsuite/Makefile.in: Regenerate.
6580         * testsuite/memory_test.sh: New script.
6581         * testsuite/memory_test.s: New assembler source file.
6582         * testsuite/memory_test.t: New linker script.
6583
6584 2010-08-27  Doug Kwan  <dougkwan@google.com>
6585
6586         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6587         reference override an existing dynamic weak reference.
6588         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6589         * testsuite/Makefile.in: Regenerate.
6590         * testsuite/dyn_weak_ref.sh: New file.
6591         * testsuite/dyn_weak_ref_1.c: Ditto.
6592         * testsuite/dyn_weak_ref_2.c: Ditto.
6593
6594 2010-08-27  Ian Lance Taylor  <iant@google.com>
6595
6596         * incremental.h (class Incremental_input_entry): Add virtual
6597         destructor.
6598
6599 2010-08-27  Ian Lance Taylor  <iant@google.com>
6600
6601         * testsuite/start_lib_test_3.c: Mark t3 as used.
6602
6603 2010-08-27  Nick Clifton  <nickc@redhat.com>
6604
6605         * options.cc (version_script): Fix small typo in previous
6606         whitespace tidyup.
6607
6608 2010-08-25  Nick Clifton  <nickc@redhat.com>
6609
6610         * archive.cc: Formatting fixes: Remove whitespace between
6611         typename and following asterisk.  Remove whitespace between
6612         function name and opening parenthesis.
6613         * archive.h: Likewise.
6614         * arm.cc: Likewise.
6615         * attributes.cc: Likewise.
6616         * attributes.h: Likewise.
6617         * common.cc: Likewise.
6618         * copy-relocs.cc: Likewise.
6619         * dirsearch.h: Likewise.
6620         * dynobj.cc: Likewise.
6621         * ehframe.cc: Likewise.
6622         * ehframe.h: Likewise.
6623         * expression.cc: Likewise.
6624         * fileread.cc: Likewise.
6625         * fileread.h: Likewise.
6626         * gc.h: Likewise.
6627         * gold-threads.cc: Likewise.
6628         * gold.cc: Likewise.
6629         * i386.cc: Likewise.
6630         * icf.h: Likewise.
6631         * incremental-dump.cc: Likewise.
6632         * incremental.cc: Likewise.
6633         * layout.cc: Likewise.
6634         * layout.h: Likewise.
6635         * main.cc: Likewise.
6636         * merge.cc: Likewise.
6637         * merge.h: Likewise.
6638         * object.cc: Likewise.
6639         * object.h: Likewise.
6640         * options.cc: Likewise.
6641         * options.h: Likewise.
6642         * output.cc: Likewise.
6643         * output.h: Likewise.
6644         * plugin.cc: Likewise.
6645         * plugin.h: Likewise.
6646         * powerpc.cc: Likewise.
6647         * reloc.cc: Likewise.
6648         * script-c.h: Likewise.
6649         * script-sections.cc: Likewise.
6650         * script.cc: Likewise.
6651         * stringpool.cc: Likewise.
6652         * symtab.cc: Likewise.
6653         * symtab.h: Likewise.
6654         * target.cc: Likewise.
6655         * timer.cc: Likewise.
6656         * timer.h: Likewise.
6657         * version.cc: Likewise.
6658         * x86_64.cc: Likewise.
6659
6660 2010-08-24  Nick Clifton  <nickc@redhat.com>
6661
6662         PR 11899
6663         * layout.cc (segment_precedes): Sort segments by their physical
6664         addresses, if they have been set.
6665
6666 2010-08-23  Cary Coutant  <ccoutant@google.com>
6667
6668         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6669         symbols data.
6670         (Lib_group::include_member): Unlock object after deleting its
6671         symbols data.
6672         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6673         the bug fixed here.
6674
6675 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6676             Cary Coutant  <ccoutant@google.com>
6677
6678         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6679         constructor, and set_blocker.
6680         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6681         readsyms_blocker_.
6682         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6683         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6684         * testsuite/Makefile.am (start_lib_test): New test case.
6685         * testsuite/Makefile.in: Regenerate.
6686         * testsuite/start_lib_test_main.c: New file.
6687         * testsuite/start_lib_test_1.c: New file.
6688         * testsuite/start_lib_test_2.c: New file.
6689         * testsuite/start_lib_test_3.c: New file.
6690
6691 2010-08-19  Ian Lance Taylor  <iant@google.com>
6692
6693         * Makefile.in: Rebuild with automake 1.11.1.
6694         * aclocal.m4: Likewise.
6695         * testsuite/Makefile.in: Likewise.
6696
6697 2010-08-19  Ian Lance Taylor  <iant@google.com>
6698
6699         PR 10893
6700         * i386.cc (class Output_data_plt_i386): Update declarations.
6701         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6702         local_ifuncs_ fields.
6703         (Target_i386::do_plt_section_for_global): New function.
6704         (Target_i386::do_plt_section_for_local): New function.
6705         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6706         parameter; change all callers.  Initialize global_ifuncs_ and
6707         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6708         __rel_iplt_end.
6709         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6710         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6711         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6712         symbols.
6713         (Target_i386::make_plt_section): New function, broken out of
6714         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6715         (Target_i386::make_plt_entry): Call make_plt_section.
6716         (Target_i386::make_local_ifunc_plt_entry): New function.
6717         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6718         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6719         R_386_IRELATIVE to switch.
6720         (Target_i386::Scan::global): Likewise.
6721         (Target_i386::Relocate::relocate): Likewise.
6722         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6723         switch.
6724         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6725         (Target_x86_64::do_plt_section_for_global): New function.
6726         (Target_x86_64::do_plt_section_for_local): New function.
6727         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6728         parameter; change all callers.  If doing a static link define
6729         __rela_iplt_start and __rela_iplt_end.
6730         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6731         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6732         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6733         to point to .plt.
6734         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6735         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6736         switch.
6737         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6738         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6739         R_X86_64_IRELATIVE to switch.
6740         (Target_x86_64::Scan::global): Likewise.
6741         (Target_x86_64::Relocate::relocate): Likewise.
6742         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6743         switch.
6744         * target.h (class Target): Add plt_section_for_global and
6745         plt_section_for_local functions.  Add do_plt_section_for_global
6746         and do_plt_section_for_local virtual functions.
6747         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6748         clarifying comments.
6749         (Symbol::use_plt_offset): Handle IFUNC symbol.
6750         * object.cc (Sized_relobj::Sized_relobj): Initialize
6751         local_plt_offsets_.
6752         (Sized_relobj::local_has_plt_offset): New function.
6753         (Sized_relobj::local_plt_offset): New function.
6754         (Sized_relobj::set_local_plt_offset): New function.
6755         (Sized_relobj::do_count): Handle IFUNC symbol.
6756         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6757         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6758         is_ifunc_symbol functions.
6759         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6760         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6761         local_plt_offsets_ field.
6762         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6763         * output.h (class Output_section_data): Add non-const
6764         output_section function.
6765         (class Output_data_got): Update declarations.
6766         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6767         Add use_plt_offset parameter to global and local constructors.
6768         Change all callers.  Change local_sym_index_ field to 31 bits.
6769         Change GSYM_CODE and CONSTANT_CODE accordingly.
6770         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6771         doing a static link don't set sh_link field.
6772         (Output_data_got::Got_entry::write): Use PLT offset if
6773         appropriate.
6774         (Output_data_got::add_global_plt): New function.
6775         (Output_data_got::add_local_plt): New function.
6776         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6777         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6778         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6779         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6780         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6781         IFUNC conditional.
6782         * testsuite/ifunc-sel.h: New file.
6783         * testsuite/ifuncmain1.c: New file.
6784         * testsuite/ifuncmain1vis.c: New file.
6785         * testsuite/ifuncmod1.c: New file.
6786         * testsuite/ifuncdep2.c: New file.
6787         * testsuite/ifuncmain2.c: New file.
6788         * testsuite/ifuncmain3.c: New file.
6789         * testsuite/ifuncmod3.c: New file.
6790         * testsuite/ifuncmain4.c: New file.
6791         * testsuite/ifuncmain5.c: New file.
6792         * testsuite/ifuncmod5.c: New file.
6793         * testsuite/ifuncmain6pie.c: New file.
6794         * testsuite/ifuncmod6.c: New file.
6795         * testsuite/ifuncmain7.c: New file.
6796         * configure, testsuite/Makefile.in: Rebuild.
6797
6798 2010-08-18  Ian Lance Taylor  <iant@google.com>
6799
6800         * incremental.cc
6801         (Output_section_incremental_inputs::write_input_files): Add cast
6802         to avoid signed/unsigned comparison warning.
6803         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6804
6805 2010-08-12  Cary Coutant  <ccoutant@google.com>
6806
6807         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6808
6809 2010-08-13  Ian Lance Taylor  <iant@google.com>
6810
6811         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6812
6813 2010-08-12  Cary Coutant  <ccoutant@google.com>
6814             Doug Kwan  <dougkwan@google.com>
6815
6816         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6817         defintion overrides non-weak undef, remember that the original undef
6818         is not weak.
6819         * symtab.cc (Symbol_table::sized_write_global): For undef without
6820         an original weak binding, set binding to global in output.
6821         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6822         * testsuite/Makefile.in: Regenerate.
6823         * testsuite/strong_ref_weak_def.sh: New file.
6824         * testsuite/strong_ref_weak_def_1.c: Ditto.
6825         * testsuite/strong_ref_weak_def_2.c: Ditto.
6826
6827 2010-08-12  Cary Coutant  <ccoutant@google.com>
6828
6829         * testsuite/incremental_test.sh: Rewrite.
6830         * testsuite/incremental_test_1.c: Rewrite.
6831         * testsuite/incremental_test_2.c: Rewrite.
6832
6833 2010-08-12  Cary Coutant  <ccoutant@google.com>
6834
6835         * arm.cc (Target_arm::got_size): Add const.
6836         (Target_arm::got_entry_count): New function.
6837         (Target_arm::plt_entry_count): New function.
6838         (Target_arm::first_plt_entry_offset): New function.
6839         (Target_arm::plt_entry_size): New function.
6840         (Output_data_plt_arm::entry_count): New function.
6841         (Output_data_plt_arm::first_plt_entry_offset): New function.
6842         (Output_data_plt_arm::get_plt_entry_size): New function.
6843         * i386.cc (Target_i386::got_size): Add const.
6844         (Target_i386::got_entry_count): New function.
6845         (Target_i386::plt_entry_count): New function.
6846         (Target_i386::first_plt_entry_offset): New function.
6847         (Target_i386::plt_entry_size): New function.
6848         (Output_data_plt_i386::entry_count): New function.
6849         (Output_data_plt_i386::first_plt_entry_offset): New function.
6850         (Output_data_plt_i386::get_plt_entry_size): New function.
6851         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6852         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6853         * incremental.cc: Include target.h.
6854         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6855         parameter.  Adjust all callers.  Find incremental_got_plt section.
6856         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6857         section.
6858         (Output_section_incremental_inputs::set_final_data_size): Calculate
6859         size of incremental_got_plt section.
6860         (Output_section_incremental_inputs::do_write): Write the
6861         incremental_got_plt section.
6862         (Got_plt_view_info): New struct.
6863         (Local_got_offset_visitor): New class.
6864         (Global_got_offset_visitor): New class.
6865         (Global_symbol_visitor_got_plt): New class.
6866         (Output_section_incremental_inputs::write_got_plt): New function.
6867         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6868         Add parameter.  Adjust all callers.
6869         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6870         (Incremental_inputs::got_plt_section): New function.
6871         (Incremental_inputs::got_plt_section_): New data member.
6872         (Incremental_got_plt_reader): New class.
6873         * layout.cc (Layout::create_incremental_info_sections): Add the
6874         incremental_got_plt section.
6875         * object.h (Got_offset_list::get_list): New function.
6876         (Got offset_list::for_all_got_offsets): New function.
6877         (Sized_relobj::local_got_offset_list): New function.
6878         * powerpc.cc (Target_powerpc::got_size): Add const.
6879         (Target_powerpc::got_entry_count): New function.
6880         (Target_powerpc::plt_entry_count): New function.
6881         (Target_powerpc::first_plt_entry_offset): New function.
6882         (Target_powerpc::plt_entry_size): New function.
6883         (Output_data_plt_powerpc::entry_count): New function.
6884         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6885         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6886         * sparc.cc (Target_sparc::got_size): Add const.
6887         (Target_sparc::got_entry_count): New function.
6888         (Target_sparc::plt_entry_count): New function.
6889         (Target_sparc::first_plt_entry_offset): New function.
6890         (Target_sparc::plt_entry_size): New function.
6891         (Output_data_plt_sparc::entry_count): New function.
6892         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6893         (Output_data_plt_sparc::get_plt_entry_size): New function.
6894         * symtab.h (Symbol::got_offset_list): New function.
6895         (Symbol_table::for_all_symbols): New function.
6896         * target.h (Sized_target::got_entry_count): New function.
6897         (Sized_target::plt_entry_count): New function.
6898         (Sized_target::plt_entry_size): New function.
6899         * x86_64.cc (Target_x86_64::got_size): Add const.
6900         (Target_x86_64::got_entry_count): New function.
6901         (Target_x86_64::plt_entry_count): New function.
6902         (Target_x86_64::first_plt_entry_offset): New function.
6903         (Target_x86_64::plt_entry_size): New function.
6904         (Output_data_plt_x86_64::entry_count): New function.
6905         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6906         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6907
6908 2010-08-12  Cary Coutant  <ccoutant@google.com>
6909
6910         * archive.cc: Include incremental.h.
6911         (Archive::Archive): Initialize incremental_info_.
6912         (Archive::include_member): Record archive members in incremental info.
6913         (Add_archive_symbols::run): Record begin and end of an archive in
6914         incremental info.
6915         (Lib_group::include_member): Record objects in incremental info.
6916         * archive.h (Incremental_archive_entry): Forward declaration.
6917         (Archive::set_incremental_info): New member function.
6918         (Archive::incremental_info): New member function.
6919         (Archive::Unused_symbol_iterator): New class.
6920         (Archive::unused_symbols_begin): New member function.
6921         (Archive::unused_symbols_end): New member function.
6922         (Archive::incremental_info_): New data member.
6923         * incremental-dump.cc (find_input_containing_global): New function.
6924         (dump_incremental_inputs): Dump new incremental info sections.
6925         * incremental.cc: Include symtab.h.
6926         (Output_section_incremental_inputs): New class.
6927         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6928         new incremental info sections.
6929         (Sized_incremental_binary::do_check_inputs): Likewise.
6930         (Incremental_inputs::report_archive): Remove.
6931         (Incremental_inputs::report_archive_begin): New function.
6932         (Incremental_inputs::report_archive_end): New function.
6933         (Incremental_inputs::report_object): New function.
6934         (Incremental_inputs::finalize_inputs): Remove.
6935         (Incremental_inputs::report_input_section): New function.
6936         (Incremental_inputs::report_script): Rewrite.
6937         (Incremental_inputs::finalize): Do nothing but finalize string table.
6938         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6939         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6940         (Incremental_inputs::create_data_sections): New function.
6941         (Incremental_inputs::relocs_entsize): New function.
6942         (Output_section_incremental_inputs::set_final_data_size): New function.
6943         (Output_section_incremental_inputs::do_write): New function.
6944         (Output_section_incremental_inputs::write_header): New function.
6945         (Output_section_incremental_inputs::write_input_files): New function.
6946         (Output_section_incremental_inputs::write_info_blocks): New function.
6947         (Output_section_incremental_inputs::write_symtab): New function.
6948         * incremental.h (Incremental_script_entry): Forward declaration.
6949         (Incremental_object_entry): Forward declaration.
6950         (Incremental_archive_entry): Forward declaration.
6951         (Incremental_inputs): Forward declaration.
6952         (Incremental_inputs_header_data): Remove.
6953         (Incremental_inputs_header): Remove.
6954         (Incremental_inputs_header_write): Remove.
6955         (Incremental_inputs_entry_data): Remove.
6956         (Incremental_inputs_entry): Remove.
6957         (Incremental_inputs_entry_write): Remove.
6958         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6959         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6960         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6961         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6962         Likewise.
6963         (Incremental_input_entry): New class.
6964         (Incremental_script_entry): New class.
6965         (Incremental_object_entry): New class.
6966         (Incremental_archive_entry): New class.
6967         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6968         (Incremental_inputs::report_inputs): Remove.
6969         (Incremental_inputs::report_archive): Remove.
6970         (Incremental_inputs::report_archive_begin): New function.
6971         (Incremental_inputs::report_archive_end): New function.
6972         (Incremental_inputs::report_object): Change prototype.
6973         (Incremental_inputs::report_input_section): New function.
6974         (Incremental_inputs::report_script): Change prototype.
6975         (Incremental_inputs::get_reloc_count): New function.
6976         (Incremental_inputs::set_reloc_count): New function.
6977         (Incremental_inputs::create_data_sections): New function.
6978         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6979         (Incremental_inputs::inputs_section): New function.
6980         (Incremental_inputs::symtab_section): New function.
6981         (Incremental_inputs::relocs_section): New function.
6982         (Incremental_inputs::get_stringpool): Add const.
6983         (Incremental_inputs::command_line): Add const.
6984         (Incremental_inputs::inputs): Remove.
6985         (Incremental_inputs::command_line_key): New function.
6986         (Incremental_inputs::input_file_count): New function.
6987         (Incremental_inputs::input_files): New function.
6988         (Incremental_inputs::relocs_entsize): New function.
6989         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6990         (Incremental_inputs::finalize_inputs): Remove.
6991         (Incremental_inputs::Input_info): Remove.
6992         (Incremental_inputs::lock_): Remove.
6993         (Incremental_inputs::inputs_): Change type.
6994         (Incremental_inputs::inputs_map_): Remove.
6995         (Incremental_inputs::current_object_entry_): New data member.
6996         (Incremental_inputs::inputs_section_): New data member.
6997         (Incremental_inputs::symtab_section_): New data member.
6998         (Incremental_inputs::relocs_section_): New data member.
6999         (Incremental_inputs::reloc_count_): New data member.
7000         (Incremental_inputs_reader): New class.
7001         (Incremental_symtab_reader): New class.
7002         (Incremental_relocs_reader): New class.
7003         * layout.cc (Layout::finalize): Move finalization of incremental info
7004         and creation of incremental info sections to follow finalization of
7005         symbol table.  Set offsets for postprocessing sections.
7006         (Layout::create_incremental_info_sections): Call
7007         Incremental_inputs::create_data_sections.  Add incremental symtab
7008         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7009         sections to layout after input sections.
7010         * layout.h (struct Timespec): Forward declaration.
7011         (Layout::incremental_inputs): Add const.
7012         (Layout::create_incremental_info_sections): Add parameter.
7013         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7014         * object.cc: Include incremental.h.
7015         (Relobj::finalize_incremental_relocs): New function.
7016         (Sized_relobj::do_layout): Record input sections in incremental info.
7017         * object.h (Object::output_section): New function.
7018         (Object::output_section_offset): Moved from Relobj.
7019         (Object::get_incremental_reloc_base): New function.
7020         (Object::get_incremental_reloc_count): New function.
7021         (Object::do_output_section): New function.
7022         (Object::do_output_section_offset): Moved from Relobj.
7023         (Object::do_get_incremental_reloc_base): New function.
7024         (Object::do_get_incremental_reloc_count): New function.
7025         (Object::Object): Initialize new data members.
7026         (Relobj::output_section): Renamed do_output_section and moved to
7027         protected.
7028         (Relobj::output_section_offset): Moved to Object.
7029         (Relobj::do_get_incremental_reloc_base): New function.
7030         (Relobj::do_get_incremental_reloc_count): New function.
7031         (Relobj::allocate_incremental_reloc_counts): New function.
7032         (Relobj::count_incremental_reloc): New function.
7033         (Relobj::finalize_incremental_relocs): New function.
7034         (Relobj::next_incremental_reloc_index): New function.
7035         (Relobj::reloc_counts_): New data member.
7036         (Relobj::reloc_bases_): New data member.
7037         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7038         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7039         (Sized_relobj::incremental_relocs_scan): New function.
7040         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7041         (Sized_relobj::incremental_relocs_write): New function.
7042         (Sized_relobj::incremental_relocs_write_reltype): New function.
7043         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7044         incremental link.
7045         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7046         archives and object files elsewhere.
7047         (Add_symbols::run): Report object files here.
7048         (Finish_group::run): Report end of archive at end of group.
7049         * reloc.cc: Include layout.h, incremental.h.
7050         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7051         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7052         (Sized_relobj::incremental_relocs_scan): New function.
7053         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7054         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7055         (Sized_relobj::incremental_relocs_write): New function.
7056         (Sized_relobj::incremental_relocs_write_reltype): New function.
7057         * script.cc (read_input_script): Rewrite test for incremental link.
7058         Change call to Incremental_inputs::report_script.
7059         * symtab.h (Symbol_table::first_global_index): New function.
7060         (Symbol_table::output_count): New function.
7061
7062 2010-08-12  Doug Kwan  <dougkwan@google.com>
7063
7064         * arm.cc (Target_arm::merge_object_attributes): Check command line
7065         options --no-wchar-size-warning and --no-enum-size-warning.
7066         * options.h (General_options): Add ld-compatible options
7067         --no-enum-size-warning and --no-wchar-size-warning.
7068
7069 2010-08-04  Ian Lance Taylor  <iant@google.com>
7070
7071         * x86_64.cc (Target_x86_64::Scan::local): Use
7072         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7073         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7074         (Target_x86_64::Scan::global): Likewise.
7075         (Target_x86_64::Relocate::relocate): Likewise.
7076         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7077         Likewise.
7078
7079 2010-08-03  Cary Coutant  <ccoutant@google.com>
7080
7081         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7082         to reserve space in merged_strings vector. Keep total input size
7083         for stats.
7084         (Output_merge_string::do_print_merge_stats): Print total input size.
7085         * merge.h (Output_merge_string): Add input_size_ field.
7086         * stringpool.cc (Stringpool_template::string_length): Move
7087         implementations out of Stringpool_template class and place in
7088         stringpool.h.
7089         * stringpool.h (string_length): Move out of Stringpool_template.
7090
7091 2010-08-03  Ian Lance Taylor  <iant@google.com>
7092
7093         PR 11712
7094         * layout.cc (relaxation_loop_body): If address of load segment is
7095         set, adjust address to include headers if possible.
7096
7097 2010-08-03  Ian Lance Taylor  <iant@google.com>
7098
7099         * version.cc (version_string): Bump to 1.10.
7100
7101 2010-08-03  Ian Lance Taylor  <iant@google.com>
7102
7103         PR 11805
7104         * layout.h (enum Output_section_order): Define.
7105         (class Layout): Update declarations.
7106         * layout.cc (Layout::get_output_section): Add order parameter.
7107         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7108         is_first_non_relro parameters.  Change all callers.
7109         (Layout::choose_output_section): Likewise.
7110         (Layout::add_output_section_data): Likewise.
7111         (Layout::make_output_section): Likewise.  Set order.
7112         (Layout::default_section_order): New function.
7113         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7114         * output.cc (Output_section::Output_section): Initialize order_.
7115         Don't initialize deleted fields.
7116         (Output_segment::Output_segment): Don't initialize deleted
7117         fields.
7118         (Output_segment::add_output_section_to_load): New function
7119         replacing add_output_section.  Change all callers to call this or
7120         add_output_section_to_nonload.
7121         (Output_segment::add_output_section_to_nonload): New function.
7122         (Output_segment::remove_output_section): Rewrite.
7123         (Output_segment::add_initial_output_data): Likewise.
7124         (Output_segment::has_any_data_sections): Likewise.
7125         (Output_segment::is_first_section_relro): Likewise.
7126         (Output_segment::maximum_alignment): Likewise.
7127         (Output_segment::has_dynamic_reloc): New function replacing
7128         dynamic_reloc_count.  Change all callers.
7129         (Output_segment::has_dynamic_reloc_list): New function replacing
7130         dynamic_reloc_count_list.  Change all callers.
7131         (Output_segment::set_section_addresses): Rewrite.
7132         (Output_segment::set_offset): Rewrite.
7133         (Output_segment::find_first_and_last_list): Remove.
7134         (Output_segment::set_tls_offsets): Rewrite.
7135         (Output_segment::first_section_load_address): Likewise.
7136         (Output_segment::output_section_count): Likewise.
7137         (Output_segment::section_with_lowest_load_address): Likewise.
7138         (Output_segment::write_section_headers): Likewise.
7139         (Output_segment::print_sections_to_map): Likewise.
7140         * output.h (class Output_data): Remove dynamic_reloc_count_
7141         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7142         (Output_data::add_dynamic_reloc): Rewrite.
7143         (Output_data::has_dynamic_reloc): New function.
7144         (Output_data::dynamic_reloc_count): Remove.
7145         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7146         is_last_relro_, is_first_non_relro_, is_interp_,
7147         is_dynamic_linker_section_ fields.  Add order and set_order
7148         functions.  Remove is_relro_local, set_is_relro_local,
7149         is_last_relro, set_is_last_relro, is_first_non_relro,
7150         set_is_first_non_relro functions, is_interp, set_is_interp,
7151         is_dynamic_linker_section, and set_is_dynamic_linker_section
7152         functions.
7153         (class Output_segment): Change Output_data_list from std::list to
7154         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7155         output_bss_ fields.  Update declarations.
7156
7157 2010-08-02  Ian Lance Taylor  <iant@google.com>
7158
7159         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7160         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7161         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7162
7163 2010-08-02  Ian Lance Taylor  <iant@google.com>
7164
7165         PR 11855
7166         * script.cc (Script_options::Script_options): Initialize
7167         symbol_definitions_ and symbol_references_.
7168         (Script_options::add_symbol_assignment): Update
7169         symbol_definitions_ and symbol_references_.
7170         (Script_options::add_symbol_reference): New function.
7171         (script_symbol): New function.
7172         * script.h (class Script_options): Add symbol_definitions_ and
7173         symbol_references_ fields.
7174         (Script_options::referenced_const_iterator): New type.
7175         (Script_options::referenced_begin): New function.
7176         (Script_options::referenced_end): New function.
7177         (Script_options::is_referenced): New function.
7178         (Script_options::any_unreferenced): New function.
7179         * script-c.h (script_symbol): Declare.
7180         * yyscript.y (exp): Call script_symbol.
7181         * symtab.cc: Include "script.h".
7182         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7183         Change all callers.  Check symbols referenced by scripts.
7184         (Symbol_table::add_undefined_symbols_from_command_line): Add
7185         layout parameter.  Change all callers.
7186         (Symbol_table::do_add_undefined_symbols_from_command_line):
7187         Likewise.  Break out loop body.  Check symbols referenced by
7188         scripts.
7189         (Symbol_table::add_undefined_symbol_from_command_line): New
7190         function broken out of
7191         do_add_undefined_symbols_from_command_line.
7192         * symtab.h (class Symbol_table): Update declarations.
7193         * archive.cc: Include "layout.h".
7194         (Archive::should_include_member): Add layout parameter.  Change
7195         all callers.  Check for symbol mentioned in expression.
7196         * archive.h (class Archive): Update declaration.
7197         * object.cc (Sized_relobj::do_should_include_member): Add layout
7198         parameter.
7199         * object.h (Object::should_include_member): Add layout parameter.
7200         Change all callers.
7201         (Object::do_should_include_member): Add layout parameter.
7202         (class Sized_relobj): Update declaration.
7203         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7204         parameter.
7205         * dynobj.h (class Sized_dynobj): Update declaration.
7206         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7207         layout parameter.
7208         * plugin.h (class Sized_pluginobj): Update declaration.
7209
7210 2010-08-02  Ian Lance Taylor  <iant@google.com>
7211
7212         PR 11866
7213         * output.cc (Output_segment::set_offset): Search for the first and
7214         last sections rather than assuming that the list is in order.
7215         (Output_segment::find_first_and_last_list): New function.
7216         * output.h (class Output_segment): Update declarations.
7217         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7218         (relro_strip_test_SOURCES): New variable.
7219         (relro_strip_test_DEPENDENCIES): New variable.
7220         (relro_strip_test_LDFLAGS): New variable.
7221         (relro_strip_test_LDADD): New variable.
7222         (relro_strip_test.so): New target.
7223
7224 2010-08-02  Ian Lance Taylor  <iant@google.com>
7225
7226         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7227         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7228         (Target_i386::got_tlsdesc_section): New function.
7229         (Target_i386::got_section): Create space for GOT entries for
7230         TLSDESC relocations.
7231         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7232         R_386_TLS_GOTDESC.
7233         (Target_i386::Scan::global): Likewise.
7234         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7235         using TLSDESC GOT.
7236         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7237         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7238         (Target_x86_64::got_tlsdesc_section): New function.
7239         (Target_x86_64::got_section): Create space for GOT entries for
7240         TLSDESC relocations.
7241         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7242         R_386_TLS_GOTDESC.
7243         (Target_x86_64::Scan::global): Likewise.
7244         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7245         using TLSDESC GOT.
7246
7247 2010-08-02  Ian Lance Taylor  <iant@google.com>
7248
7249         * testsuite/final_layout.sh: Use dc to convert from hex to
7250         decimal.
7251
7252 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7253
7254         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7255         paramter to the call to gold::gc_process_relocs.
7256         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7257         paramter to the call to gold::gc_process_relocs.
7258         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7259         parameter to the call to gold::gc_process_relocs.
7260         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7261         template parameter to the call to gold::gc_process_relocs.
7262         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7263         paramter to the call to gold::gc_process_relocs.
7264         * gc.h (get_embedded_addend_size): New function.
7265         (gc_process_relocs): Save the size of the reloc for use by ICF.
7266         * icf.cc (get_section_contents): Get the addend from the text section
7267         for SHT_REL relocation sections.
7268         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7269         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7270         * int_encoding.h (read_from_pointer): New overloaded function.
7271         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7272         * testsuite/icf_sht_rel_addend_test.sh: New file.
7273         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7274         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7275
7276 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7277
7278         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7279         * Makefile.in: Regenerate.
7280         * testsuite/Makefile.in: Regenerate.
7281
7282 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7283
7284         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7285         * gold/testsuite/debug_msg.cc: Likewise.
7286         * gold/testsuite/odr_violation1.cc
7287         * gold/testsuite/odr_violation2.cc
7288
7289 2010-07-21  Cary Coutant  <ccoutant@google.com>
7290
7291         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7292         string, and length fields.
7293         (Output_merge_string::Merged_strings_list): New type.
7294         (Output_merge_string::Merged_strings_lists): New typedef.
7295         (Output_merge_string): Replace merged_strings_ with
7296         merged_strings_lists_.
7297         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7298         Merged_strings_list per input object and section.  Don't store pointer
7299         to the string.  Don't store length with each merged string entry.
7300         (Output_merge_string::finalize_merged_data): Loop over list of merged
7301         strings lists.  Recompute length of each merged string.
7302
7303 2010-07-15  Cary Coutant  <ccoutant@google.com>
7304
7305         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7306         here.
7307
7308 2010-07-14  Ian Lance Taylor  <iant@google.com>
7309
7310         * descriptors.cc (Descriptors::open): Report correct name in error
7311         message.
7312
7313 2010-07-13  Doug Kwan  <dougkwan@google.com>
7314
7315         * arm.cc (Arm_input_section::Arm_input_section): For a
7316         SHT_ARM_EXIDX section, always keeps the input sections.
7317         (Arm_input_section::set_exidx_section_link): New method.
7318         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7319         has_errors_ to false.
7320         (Arm_exidx_input_section::has_errors,
7321         Arm_exidx_input_section::set_has_errors): New methods.
7322         (Arm_exidx_input_section::has_errors_): New data member.
7323         (Arm_relobj::get_exidx_shndx_list): New method.
7324         (Arm_output_section::append_text_sections_to_list): Do not skip
7325         section without SHF_EXECINSTR.
7326         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7327         errors.
7328         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7329         section header.  Make error messages more verbose.  Check for
7330         a non-executable section linked to an EXIDX section.
7331         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7332         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7333         check that there is no deferred EXIDX section if we exit early.
7334         Instead of not making an EXIDX section in case of an error, make one
7335         and set the has_errors flag of it.
7336         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7337         in a relocatable link.
7338         (Target_arm::do_relax): Look for the EXIDX output section instead of
7339         assuming that it is called .ARM.exidx.
7340         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7341         section list.  Do not check for SHF_EXECINSTR section flags but
7342         skip any input section with errors.
7343         * output.cc (Output_section::Output_section): Initialize
7344         always_keeps_input_sections_ to false.
7345         (Output_section::add_input_section): Check for
7346         always_keeps_input_sections_.
7347         *  output.h (Output_section::always_keeps_input_sections,
7348         Output_section::set_always_keeps_input_sections): New methods.
7349         (Output_section::always_keeps_input_sections): New data member.
7350
7351 2010-07-13  Rafael Espindola  <espindola@google.com>
7352
7353         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7354         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7355
7356 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7357             Ian Lance Taylor  <iant@google.com>
7358
7359         * output.h (Output_section_lookup_maps::add_merge_section):
7360         Correct check of whether value was inserted.
7361         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7362         (Output_section_lookup_maps::add_relaxed_input_section):
7363         Likewise.
7364         * arm.cc (Target_arm::got_section): Remove used local os.
7365         * i386.cc (Target_i386::got_section): Likewise.
7366         * x86_64.cc (Target_x86_64::got_section): Likewise.
7367         * sparc.cc (Target_sparc::got_section): Likewise.
7368         (Target_sparc::relocate): Remove unused local have_got_offset.
7369         * powerpc.cc (Target_powerpc::relocate): Likewise.
7370
7371 2010-07-13  Ian Lance Taylor  <iant@google.com>
7372
7373         * compressed_output.cc (zlib_decompress): Fix signature in
7374         !HAVE_ZLIB_H case.
7375
7376         * archive.cc (Archive::include_member): Unlock an external member
7377         of a thin archive.  Don't bother to delete an object we know is
7378         NULL.
7379
7380 2010-07-12  Cary Coutant  <ccoutant@google.com>
7381
7382         * compressed_output.cc (zlib_decompress): New function.
7383         (get_uncompressed_size): New function.
7384         (decompress_input_section): New function.
7385         * compressed_output.h (get_uncompressed_size): New function.
7386         (decompress_input_section): New function.
7387         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7388         Handle compressed debug sections.
7389         * layout.cc (is_compressed_debug_section): New function.
7390         (Layout::output_section_name): Map compressed section names to
7391         canonical names.
7392         * layout.h (is_compressed_debug_section): New function.
7393         (is_debug_info_section): Recognize compressed debug sections.
7394         * merge.cc: Include compressed_output.h.
7395         (Output_merge_data::do_add_input_section): Handle compressed
7396         debug sections.
7397         (Output_merge_string::do_add_input_section): Handle compressed
7398         debug sections.
7399         * object.cc: Include compressed_output.h.
7400         (Sized_relobj::Sized_relobj): Initialize new data members.
7401         (build_compressed_section_map): New function.
7402         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7403         * object.h (Object::section_is_compressed): New method.
7404         (Object::do_section_is_compressed): New method.
7405         (Sized_relobj::Compressed_section_map): New type.
7406         (Sized_relobj::do_section_is_compressed): New method.
7407         (Sized_relobj::compressed_sections_): New data member.
7408         * output.cc (Output_section::add_input_section): Handle compressed
7409         debug sections.
7410         * reloc.cc: Include compressed_output.h.
7411         (Sized_relobj::write_sections): Handle compressed debug sections.
7412
7413 2010-07-08  Cary Coutant  <ccoutant@google.com>
7414
7415         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7416         weak when resolving to a dynamic def.
7417         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7418         for weak undef/dynamic def cases. Adjust callers.
7419         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7420         undef_binding_weak_.
7421         (Symbol_table::sized_write_globals): Adjust symbol binding.
7422         (Symbol_table::sized_write_symbol): Add binding parameter.
7423         * symtab.h (Symbol::set_undef_binding): New method.
7424         (Symbol::is_undef_binding_weak): New method.
7425         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7426         (Symbol_table::should_override): Add new parameter.
7427         (Symbol_table::sized_write_symbol): Add new parameter.
7428
7429         * testsuite/weak_undef_file1.cc: Add new test case.
7430         * testsuite/weak_undef_file2.cc: Fix header comment.
7431         * testsuite/weak_undef_test.cc: Add new test case.
7432
7433 2010-06-29  Doug Kwan  <dougkwan@google.com>
7434
7435         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7436         Initialize USE_SYMBOL_.
7437         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7438         definition.
7439         (Arm_reloc_property::uses_symbol_): New data member declaration.
7440         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7441         uses symbol value and symbol is undefined but not weakly undefined.
7442
7443 2010-06-28  Rafael Espindola  <espindola@google.com>
7444
7445         * plugin.cc (Plugin::load): Use dlerror.
7446
7447 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7448
7449         * symtab.cc (detect_odr_violations): When reporting an ODR
7450         violation, report an object where the symbol is defined.
7451
7452 2010-06-25  Doug Kwan  <dougkwan@google.com>
7453
7454         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7455         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7456         definition.
7457         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7458         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7459         target hook to detect function points.
7460         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7461         * icf.h (Icf::check_section_for_function_pointers): Change type of
7462         parameter SECTION_NAME to const reference to std::string.  Use
7463         target hook to determine if section may have unsafe pointers.
7464         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7465         method definition.
7466
7467 2010-06-21  Rafael Espindola  <espindola@google.com>
7468
7469         * fileread.cc (Input_file::find_fie): New
7470         (Input_file::open): Use Input_file::find_fie.
7471         * fileread.h (Input_file::find_fie): New
7472         * plugin.cc (set_extra_library_path): New.
7473         (Plugin::load): Add set_extra_library_path to the transfer vector.
7474         (Plugin_manager::set_extra_library_path): New.
7475         (Plugin_manager::add_input_file): Use the extra search path if set.
7476         (set_extra_library_path(): New.
7477         * plugin.h (Plugin_manager): Add set_extra_library_path and
7478         extra_search_path_.
7479
7480 2010-06-19  Cary Coutant  <ccoutant@google.com>
7481
7482         * layout.cc (gdb_sections): Add .debug_types.
7483         (lines_only_debug_sections): Likewise.
7484
7485 2010-06-18  Rafael Espindola  <espindola@google.com>
7486
7487         * plugin.cc (add_input_file,add_input_library)
7488         (Plugin_manager::add_input_file): Make filename arguments const.
7489         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7490         const.
7491
7492 2010-06-16  Doug Kwan  <dougkwan@google.com>
7493
7494         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7495         .ARM.attributes section if we have not merged any input
7496         attributes sections.
7497
7498 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7499
7500         * arm.cc: Allow combining objects with no EABI version
7501         information.
7502
7503 2010-06-15  Rafael Espindola  <espindola@google.com>
7504
7505         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7506
7507 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7508
7509         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7510         (struct iovec): Correct !HAVE_READV definition.
7511
7512 2010-06-10  Cary Coutant  <ccoutant@google.com>
7513
7514         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7515         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7516         reloc sections.
7517         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7518
7519         PR 11683
7520         * symtab.h (Symbol::is_placeholder): New member function.
7521         * target-reloc.h (relocate_section): Check for placeholder symbols.
7522
7523         * testsuite/Makefile.am (plugin_test_8): New test.
7524         (plugin_test_9): New test.
7525         * testsuite/Makefile.in: Regenerate.
7526
7527 2010-06-09  Nick Clifton  <nickc@redhat.com>
7528
7529         * yyscript.y (input_list_element): Allow strings prefixed with
7530         the '-' character.  Treat these as libraries.
7531         * script.cc (script_add_library): New function.  Adds a library
7532         specified by "-l<name>" found in an input script.
7533         * script-c.h: Add prototype for script_add_library.
7534
7535 2010-06-07  Doug Kwan  <dougkwan@google.com>
7536
7537         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7538         Restrict stub-group size to be within long conditional branch
7539         range when working around cortex-A8 erratum.
7540
7541 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7542
7543         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7544         #ifdef typo.
7545
7546 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7547
7548         PR gold/11658
7549         * output.cc
7550         (Output_section::Input_section_sort_entry::compare_section_ordering):
7551         Change to return non-zero correctly.
7552         (Output_section::Input_section_sort_section_order_index_compare
7553         ::operator()): Change to fix ambiguity in comparisons.
7554
7555 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7556
7557         * gold.h (is_wildcard_string): New function.
7558         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7559         (Layout::layout_eh_frame): Ditto.
7560         (Layout::find_section_order_index): New method.
7561         (Layout::read_layout_from_file): New method.
7562         * layout.h (Layout::find_section_order_index): New method.
7563         (Layout::read_layout_from_file): New method.
7564         (Layout::input_section_position_): New private member.
7565         (Layout::input_section_glob_): New private member.
7566         * main.cc (main): Call read_layout_from_file here.
7567         * options.h (--section-ordering-file): New option.
7568         * output.cc (Output_section::input_section_order_specified_): New
7569         member.
7570         (Output_section::Output_section): Initialize new member.
7571         (Output_section::add_input_section): Add new parameter.
7572         Keep input sections when --section-ordering-file is used.
7573         (Output_section::set_final_data_size): Sort input sections when
7574         section ordering file is specified.
7575         (Output_section::Input_section_sort_entry): Add new parameter.
7576         Check sorting type.
7577         (Output_section::Input_section_sort_entry::compare_section_ordering):
7578         New method.
7579         (Output_section::Input_section_sort_compare::operator()): Change to
7580         consider section_order_index.
7581         (Output_section::Input_section_sort_init_fini_compare::operator()):
7582         Change to consider section_order_index.
7583         (Output_section::Input_section_sort_section_order_index_compare
7584         ::operator()): New method.
7585         (Output_section::sort_attached_input_sections): Change to sort
7586         according to section order when specified.
7587         (Output_section::add_input_section<32, true>): Add new parameter.
7588         (Output_section::add_input_section<64, true>): Add new parameter.
7589         (Output_section::add_input_section<32, false>): Add new parameter.
7590         (Output_section::add_input_section<64, false>): Add new parameter.
7591         * output.h (Output_section::add_input_section): Add new parameter.
7592         (Output_section::input_section_order_specified): New
7593         method.
7594         (Output_section::set_input_section_order_specified): New method.
7595         (Input_section::Input_section): Initialize section_order_index_.
7596         (Input_section::section_order_index): New method.
7597         (Input_section::set_section_order_index): New method.
7598         (Input_section::section_order_index_): New member.
7599         (Input_section::Input_section_sort_section_order_index_compare): New
7600         struct.
7601         (Output_section::input_section_order_specified_): New member.
7602         * script-sections.cc (is_wildcard_string): Delete and move modified
7603         method to gold.h.
7604         (Output_section_element_input::Output_section_element_input): Modify
7605         call to is_wildcard_string.
7606         (Output_section_element_input::Input_section_pattern
7607         ::Input_section_pattern): Ditto.
7608         (Output_section_element_input::Output_section_element_input): Ditto.
7609         * testsuite/Makefile.am (final_layout): New test case.
7610         * testsuite/Makefile.in: Regenerate.
7611         * testsuite/final_layout.cc: New file.
7612         * testsuite/final_layout.sh: New file.
7613
7614 2010-06-01  Rafael Espindola  <espindola@google.com>
7615
7616         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7617
7618 2010-06-01  Rafael Espindola  <espindola@google.com>
7619
7620         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7621         visibility of symbols.
7622
7623 2010-05-27  Doug Kwan  <dougkwan@google.com>
7624
7625         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7626         from start of output section instead of address for a local symbol
7627         in a merged or relaxed section when doing a relocatable link.
7628
7629 2010-05-26  Rafael Espindola  <espindola@google.com>
7630
7631         PR 11604
7632         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7633         adding sections the garbage collector removed.
7634         * gold/testsuite/Makefile.am: Add test.
7635         * gold/testsuite/Makefile.in: Regenerate.
7636         * gold/testsuite/plugin_test_7.sh: New.
7637         * gold/testsuite/plugin_test_7_1.c: New.
7638         * gold/testsuite/plugin_test_7_2.c: New.
7639
7640 2010-05-26  Rafael Espindola  <espindola@google.com>
7641
7642         * script-sections.cc (Output_section_definition::set_section_addresses):
7643         Check for --section-start.
7644
7645 2010-05-26  Doug Kwan  <dougkwan@google.com>
7646
7647         * arm.cc (Arm_scan_relocatable_relocs): New class.
7648         (Target_arm::relocate_special_relocatable): New method.
7649         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7650         (Arm_relocate_functions::thumb_branch_common): Same.
7651         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7652         instead of Default_scan_relocatable_relocs.
7653         * target-reloc.h (relocate_for_relocatable): Let target handle
7654         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7655         * target.h (Sized_target::relocate_special_relocatable): New method.
7656
7657 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7658
7659         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7660
7661 2010-05-23  Doug Kwan  <dougkwan@google.com>
7662
7663         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7664         instead of a cast.
7665         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7666         with a direct branch, not a conditional branch, to a stub.
7667         * merge.cc (Output_merge_base::record_input_section): New method
7668         defintion.
7669         (Output_merge_data::do_add_input_section): Record input section if
7670         keeps-input-sections flag is set.
7671         (Output_merge_string::do_add_input_section): Ditto.
7672         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7673         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7674         INPUT_SECTIONS_.
7675         (Output_merge_base::keeps_input_sections,
7676         Output_merge_base::set_keeps_input_sections,
7677         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7678         method definitions.
7679         (Output_merge_base::Input_sections): New type declaration.
7680         (Output_merge_base::input_sections_begin,
7681         Output_merge_base::input_sections_end,
7682         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7683         (Output_merge_base::bool keeps_input_sections_,
7684         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7685         Output_merge_base::input_sections_): New data members.
7686         (Output_merge_data::do_set_keeps_input_sections): New method
7687         defintion.
7688         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7689         * output.cc (Output_section::Input_section::relobj): Move method
7690         defintion from class declaration to here and handle merge sections.
7691         (Output_section::Input_section::shndx): Ditto.
7692         (Output_section::Output_section): Remove initializations of removed
7693         data members and initialize new data member LOOKUP_MAPS_.
7694         (Output_section::add_input_section): Set keeps-input-sections flag
7695         for a newly created merge output section as appropriate.  Adjust code
7696         to use Output_section_lookup_maps class.
7697         (Output_section::add_relaxed_input_section): Adjst code for lookup
7698         maps code refactoring.
7699         (Output_section::add_merge_input_section): Add a new parameter
7700         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7701         class.  If adding input section to a newly created merge output
7702         section fails, remove the new merge section.
7703         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7704         Adjust code for use of the Output_section_lookup_maps class.
7705         (Output_section::find_merge_section): Ditto.
7706         (Output_section::build_lookup_maps): New method defintion.
7707         (Output_section::find_relaxed_input_section): Adjust code to use
7708         Output_section_lookup_maps class.
7709         (Output_section::get_input_sections): Export merge sections.  Adjust
7710         code to use Output_section_lookup_maps class.
7711         (Output_section:::add_script_input_section): Adjust code to use
7712         Output_section_lookup_maps class.  Update lookup maps for merge
7713         sections also.
7714         (Output_section::discard_states): Use Output_section_lookup_maps.
7715         (Output_section::restore_states): Same.
7716         * output.h (Merge_section_properties): Move class defintion out of
7717         Output_section.
7718         (Output_section_lookup_maps): New class.
7719         (Output_section::Input_section::is_merge_section): New method
7720         defintion.
7721         (Output_section::Input_section::relobj): Move defintion out of class
7722         defintion.  Declare method only.
7723         (Output_section::Input_section::shndx): Ditto.
7724         (Output_section::Input_section::output_merge_base): New method defintion.
7725         (Output_section::Input_section::u2_.pomb): New union field.
7726         (Output_section::Merge_section_by_properties_map,
7727         Output_section::Output_section_data_by_input_section_map,
7728         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7729         Remove types.
7730         (Output_section::add_merge_input_section): Add new parameter
7731         KEEPS_INPUT_SECTIONS.
7732         (Output_section::build_lookup_maps): New method declaration.
7733         (Output_section::merge_section_map_,
7734         Output_section::merge_section_by_properties_map_,
7735         Output_section::relaxed_input_section_map_,
7736         Output_section::is_relaxed_input_section_map_valid_): Remove data
7737         members.
7738         (Output_section::lookup_maps_): New data member.
7739
7740 2010-05-21  Doug Kwan  <dougkwan@google.com>
7741
7742         PR gold/11619
7743         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7744         avoid a compilation error.
7745
7746 2010-05-19  Rafael Espindola  <espindola@google.com>
7747
7748         * script-sections.cc (Output_section_definition::allocate_to_segment):
7749         Update the phdrs_list even when the output section is NULL.
7750         * testsuite/Makefile.am: Add test.
7751         * testsuite/Makefile.in: Regenerate.
7752         * testsuite/script_test_9.cc: New.
7753         * testsuite/script_test_9.sh: New.
7754         * testsuite/script_test_9.t: New.
7755
7756 2010-05-19  Doug Kwan  <dougkwan@google.com>
7757
7758         * arm.cc (Arm_input_section::original_size): New method.
7759         (Arm_input_section::do_addralign): Add a cast.
7760         (Arm_input_section::do_output_offset): Remove static cast.
7761         (Arm_input_section::original_addralign,
7762          Arm_input_section::original_size_): Change type to uint32_t.
7763         (Arm_input_section::init): Add safe casts for section alignment
7764         and size.
7765         (Arm_input_section::set_final_data_size): Do not set address and
7766         offset of stub table.
7767         (Arm_output_section::fix_exidx_coverage): Change use of of
7768         Output_section::Simple_input_section to that of
7769         Output_section::Input_section.
7770         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7771         except for the first pass.
7772         * output.cc (Output_section::get_input_sections): Change type of
7773         input_sections to std::list<Input_section>.
7774         (Output_section::add_script_input_section): Rename from
7775         Output_section::add_simple_input_section.  Change type of SIS
7776         parameter from Simple_input_section to Input_section.
7777         * output.h (Output_section::Simple_input_section): Remove class.
7778         (Output_section::Input_section): Change class visibility to public.
7779         (Output_section::Input_section::addralign): Use stored alignments
7780         for special input sections if set.
7781         (Output_section::Input_section::set_addralign): New method.
7782         (Output_section::get_input_sections): Change parameter type from
7783         list of Simple_input_section to list of Input_section.
7784         (Output_section::add_script_input_section): Rename from
7785         Output_section::add_simple_input_section. Change first parameter's
7786         type from Simple_input_section to Input_section and remove the
7787         second and third parameters.
7788         * script-sections.cc (Input_section::Input_section_list): Change
7789         type to list of Output_section::Input_section/
7790         (Input_section_info::Input_section_info): Change parameter type of
7791         INPUT_SECTION to Output_section::Input_section.
7792         (Input_section_info::input_section): Change return type.
7793         (Input_section_info::input_section_): Change type to
7794         Output_section::Input_section.
7795         (Output_section_element_input::set_section_addresses): Adjust code
7796         to use Output_section::Input_section instead of
7797         Output_section::Simple_input_section.  Adjust code for renaming
7798         of Output_section::add_simple_input_section.
7799         (Orphan_output_section::set_section_addresses): Ditto.
7800
7801 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7802
7803         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7804         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7805
7806 2010-05-18  Rafael Espindola  <espindola@google.com>
7807
7808         * options.cc (General_options::finalize): Handle -nostdlib.
7809         * options.h (nostdlib): New option.
7810         * script.cc (script_add_search_dir): Handle -nostdlib.
7811
7812 2010-05-12  Doug Kwan  <dougkwan@google.com>
7813
7814         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7815         attributes section only if there no attributes section after merging.
7816         (Target_arm::merge_object_attributes): Move value of
7817         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7818         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7819         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7820         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7821         and arm_attr_merge_7.stdout.
7822         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7823         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7824         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7825         arm_attr_merge_7b.o): New rules.
7826         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7827         arm_attr_merge_7
7828         * testsuite/Makefile.in: Regenerate.
7829         * testsuite/arm_attr_merge.sh: New file.
7830         * testsuite/arm_attr_merge_[67][ab].s: Same.
7831
7832 2010-05-05  Nick Clifton  <nickc@redhat.com>
7833
7834         * po/es.po: Updated Spanish translation.
7835
7836 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7837
7838         * Makefile.am (install-exec-local): Properly install gold as
7839         default cross linker.
7840         * Makefile.in: Regenerated.
7841
7842 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7843             Nick Clifton  <nickc@redhat.com>
7844
7845         * configure.ac (install_as_default): Define and set to false
7846         unless --enable-gold or --enable-gold=both/gold has been
7847         specified.
7848         * configure: Regenerate.
7849
7850         * Makefile.am (install-exec-local): Install the executable as
7851         'ld.gold'.  If install_as_default is true then also install it as
7852         'ld'.
7853         * Makefile.in: Regenerated.
7854
7855 2010-04-24  Ian Lance Taylor  <iant@google.com>
7856
7857         * layout.cc (Layout::layout_reloc): In relocatable link don't
7858         combine reloc sections for grouped sections.
7859
7860 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7861
7862         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7863         sections that are not ordinary to icf.
7864         * icf.cc (get_section_contents): Handle relocation pointing to section
7865         with no object or shndx information.
7866         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7867         * testsuite/Makefile.in: Regenerate.
7868         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7869         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7870
7871 2010-04-22  Ian Lance Taylor  <iant@google.com>
7872
7873         * expression.cc (Expression::Expression_eval_info): Add
7874         result_alignment_pointer field.
7875         (Expression::eval_with_dot): Add result_alignment_pointer
7876         parameter.  Change all callers.
7877         (Expression::eval_maybe_dot): Likewise.
7878         (class Binary_expression): Add alignment_pointer parameter to
7879         left_value and right_value.  Change all callers.
7880         (BINARY_EXPRESSION): Set result alignment.
7881         (class Trinary_expression): Add alignment_pointer parameter to
7882         arg2_value and arg3_value.  Change all callers.
7883         (Trinary_cond::value): Set result alignment.
7884         (Max_expression::value, Min_expression::value): Likewise.
7885         (Align_expression::value): Likewise.
7886         * script-sections.cc (class Sections_element): Add dot_alignment
7887         parameter to set_section_addresses virtual function.  Update
7888         instantiations.
7889         (class Output_section_element): Likewise.
7890         (Script_sections::create_segments): Add dot_alignment parameter.
7891         Change all callers.
7892         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7893         (Script_sections::set_phdrs_clause_addresses): Likewise.
7894         * script-sections.h: Update declarations.
7895         * script.h: Update declarations.
7896         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7897         min_p_align.
7898         * testsuite/script_test_3.t: Set large alignment.
7899         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7900         segment has expected alignment.
7901
7902 2010-04-22  Nick Clifton  <nickc@redhat.com>
7903
7904         * po/gold.pot: Updated by the Translation project.
7905         * po/vi.po: Updated Vietnamese translation.
7906
7907 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7908
7909         * testsuite/Makefile.am (check_PROGRAMS): Add
7910         icf_virtual_function_folding_test.
7911         * testsuite/Makefile.in: Regenerated.
7912
7913 2010-04-15  Andrew Haley  <aph@redhat.com>
7914
7915         * options.h (merge_exidx_entries): New option.
7916         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7917         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7918         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7919         (Target_arm::merge_exidx_entries): New function.
7920         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7921         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7922         to Arm_exidx_fixup constructor.
7923         Add new arg, merge_exidx_entries.
7924         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7925         Arm_output_section::fix_exidx_coverage.
7926
7927 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7928
7929         * icf.cc (get_section_contents): Check for preemptible functions.
7930         Ignore addend when appropriate.
7931         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7932         section folded.
7933         (add_from_relobj): Check for section folded.
7934         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7935         * symtab.h (should_add_dynsym_entry): Add new parameter.
7936         * target-reloc.h (scan_relocs): Check for section folded.
7937         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7938         Check reloc types for function pointers in shared objects.
7939         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7940         case.
7941         (icf_preemptible_functions_test): New test case.
7942         (icf_string_merge_test): New test case.
7943         * testsuite.Makefile.in: Regenerate.
7944         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7945         bar_glob.  Refactor code.
7946         * testsuite/icf_preemptible_functions_test.cc: New file.
7947         * testsuite/icf_preemptible_functions_test.sh: New file.
7948         * testsuite/icf_string_merge_test.cc: New file.
7949         * testsuite/icf_string_merge_test.sh: New file.
7950         * testsuite/icf_virtual_function_folding_test.cc: New file.
7951         * testsuite/icf_virtual_function_folding_test.sh: New file.
7952
7953 2010-04-14  Doug Kwan  <dougkwan@google.com>
7954
7955         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7956         for local symbol recounting if we remove a section due to ICF.
7957         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7958         there are no regular objects in input.
7959
7960 2010-04-13  Doug Kwan  <dougkwan@google.com>
7961
7962         * arm.cc (Arm_input_section::set_final_data_size): Compute
7963         accurate final data size instead of using current data size.
7964
7965 2010-04-09  Doug Kwan  <dougkwan@google.com>
7966
7967         * layout.cc (Layout::choose_output_section): Handle script section
7968         types.
7969         (Layout::make_output_section_for_script): Add section type parameter.
7970         Handle script section types.
7971         * layout.h (Layout::make_output_section_for_script): Add section
7972         type parameter.
7973         * output.cc (Output_section::Output_section): Initialize data member
7974         is_noload_.
7975         (Output_section::do_reset_address_and_file_offset): Do not set address
7976         to 0 if section is a NOLOAD section.
7977         * output.h (Output_section::is_noload): New method.
7978         (Output_section::set_is_noload): Ditto.
7979         (Output_section::is_noload_): New data member.
7980         * script-c.h (Script_section_type): New enum type.
7981         (struct Parser_output_section_header): Add new file section_type.
7982         * script-sections.cc (Sections_element::output_section_name): Add
7983         parameter for returning script section type.
7984         (Output_section_definition::output_section_name): Ditto.
7985         (Output_section_definition::section_type)P; New method.
7986         (Output_section_definiton::script_section_type_name): Ditto.
7987         (Output_section_definition::script_section_type_): New data member.
7988         (Output_section_definition::Output_section_definition): Initialize
7989         data member Output_section_definition::script_section_type_.
7990         (Output_section_definition::create_sections): Pass script section type
7991         to Layout::make_output_section_for_script.
7992         (Output_section_definition::output_section_name): Return script
7993         section type to caller.
7994         (Output_section_definition::set_section_address): Do not advance
7995         dot value and load address if section type is NOLOAD.  Set address
7996         of NOLOAD sections regardless of section flags.
7997         (Output_section_definition::print): Print section type if it is
7998         not SCRIPT_SECTION_TYPE_NONE.
7999         (Output_section_definition::section_type): New method.
8000         (Output_section_definition::script_section_type_name): Ditto.
8001         (Script_sections::output_section_name): Add new parameter
8002         PSECTION_TYPE for returning script section type.  Pass it to
8003         section elements.  Handle discard sections.
8004         (Sort_output_sections::operator()): Handle NOLOAD sections.
8005         * script-sections.h (Script_sections::Section_type): New enum type.
8006         (Script_sections::output_section_name): Add a new parameter for
8007         returning script section type.
8008         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8009         INFO and NOLOAD.
8010         * yyscript.y (union): Add new field SECTION_TYPE.
8011         (COPY, DSECT, INFO, NOLOAD): New tokens.
8012         (opt_address_and_section_type): Change type to output_section_header.
8013         (section_type): New non-terminal
8014         (section_header): Handle section type.
8015         (opt_address_and_section_type): Return section type value.
8016
8017 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8018
8019         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8020         * testsuite/plugin_common_test_2.c (foo): Likewise.
8021
8022 2010-04-08  Doug Kwan  <dougkwan@google.com>
8023
8024         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8025         Output_merge_data.
8026         * output.cc (Output_section::add_merge_input_section): Simplify
8027         code and return status of Output_merge_base::add_input_section.
8028         Update merge section map only if Output_merge_base::add_input_section
8029         returns true.
8030
8031 2010-04-07  Doug Kwan  <dougkwan@google.com>
8032
8033         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8034         if section is marked as containing instructions but has no mapping
8035         symbols.
8036         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8037         correct section index.
8038         (Arm_relobj::find_linked_text_section): Ditto.
8039
8040 2010-04-07  Cary Coutant  <ccoutant@google.com>
8041
8042         * archive.cc (include_member): Destroy Read_symbols_data object before
8043         releasing file.
8044         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8045         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8046         (Read_symbols_data::~Read_symbols_data) New destructor.
8047         (Section_relocs::Section_relocs) New constructor.
8048         (Section_relocs::~Section_relocs) New destructor.
8049         (Read_relocs_data::Read_relocs_data) New constructor.
8050         (Read_relocs_data::~Read_relocs_data) New destructor.
8051         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8052         pointers to NULL after deleting.
8053
8054 2010-04-07  Doug Kwan  <dougkwan@google.com>
8055
8056         * arm.cc: Replace "endianity" with "endianness" in comments.
8057         (Arm_exidx_cantunwind): Ditto.
8058         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8059         (Arm_relobj::merge_flags_and_attributes): New method.
8060         (Arm_relobj::merge_flags_and_attributes_): New data member.
8061         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8062         (Arm_relobj::scan_sections_for_stubs): Ditto.
8063         (Arm_relobj::do_read_symbols): Check to see if we really want to
8064         merge processor-specific flags and attributes.  Exit early if
8065         an object is empty except for section names and the undefined symbol.
8066         (Target_arm::do_finalize_sections): Move check for ELF format to
8067         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8068         attributes from a regular object only when we have determined that
8069         it is aapropriate.  Do not create an .ARM.attributes section in
8070         output if there is no regular input object.
8071         (Target_arm::merge_processor_specific_flags): Check
8072         --warn-mismatch before printing any error.
8073         (Target_arm::merge_object_attributes): Ditto.
8074         * gold.cc (queue_middle_tasks): Handle the case in which there is
8075         no regular object in input.
8076         * options.cc (General_options::parse_EB): New method.
8077         (General_options::parse_EL): Same.
8078         (General_options::General_options): Initialize endianness_.
8079         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8080         New options.
8081         (General_options::Endianness): New enum.
8082         (General_options::endianness): New method.
8083         (General_options::endianness_): New data member.
8084         * parameters.cc (Parameters::set_options): Check target endianness.
8085         (Parameters::set_target_once): Ditto.
8086         (Parameters::check_target_endianness): New method.
8087         (parameters_force_valid_target): If either -EL or -EB is specified,
8088         use it to define endianness of default target.
8089         * parameters.h (Parameters::check_target_endianness): New method
8090         declaration.
8091         * target.h (class Target): Change "endianity" to "endianness"
8092         in comments.
8093
8094 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8095
8096         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8097         * configure: Regenerate.
8098         * Makefile.in: Regenerate.
8099         * testsuite/Makefile.in: Regenerate.
8100
8101 2010-04-06  Cary Coutant  <ccoutant@google.com>
8102
8103         gcc PR lto/42757
8104         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8105         prevailing definitions of common symbols.
8106         * testsuite/plugin_test_6.sh: New test case.
8107         * testsuite/plugin_common_test_1.c: New test case.
8108         * testsuite/plugin_common_test_2.c: New test case.
8109         * testsuite/Makefile.am (plugin_test_6): New test case.
8110         * testsuite/Makefile.in: Regenerate.
8111
8112 2010-04-06  Nick Clifton  <nickc@redhat.com>
8113
8114         * po/vi.po: New Vietnamese translation.
8115
8116 2010-03-30  Doug Kwan  <dougkwan@google.com>
8117
8118         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8119
8120 2010-03-25  Doug Kwan  <dougkwan@google.com>
8121
8122         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8123         to avoid a conversion warning on a 32-bit host.
8124
8125 2010-03-24  Ian Lance Taylor  <iant@google.com>
8126
8127         * testsuite/script_test_3.t: Add a TLS segment.
8128         * testsuite/Makefile.am (check_PROGRAMS): Add
8129         tls_phdrs_script_test.
8130         (tls_phdrs_script_test_SOURCES): Define.
8131         (tls_phdrs_script_test_DEPENDENCIES): Define.
8132         (tls_phdrs_script_test_LDFLAGS): Define.
8133         (tls_phdrs_script_test_LDADD): Define.
8134         * testsuite/Makefile.in: Rebuild.
8135
8136 2010-03-23  Cary Coutant  <ccoutant@google.com>
8137
8138         * fileread.cc (find_or_make_view): Fix comment.
8139
8140 2010-03-23  Ian Lance Taylor  <iant@google.com>
8141
8142         * script-sections.cc (class Orphan_section_placement): Define
8143         PLACE_TLS and PLACE_TLS_BSS.
8144         (Orphan_section_placement::Orphan_section_placement): Initialize
8145         new places.
8146         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8147         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8148         (tls_script_test_SOURCES): Define.
8149         (tls_script_test_DEPENDENCIES): Define.
8150         (tls_script_test_LDFLAGS): Define.
8151         (tls_script_test_LDADD): Define.
8152         * testsuite/Makefile.in: Rebuild.
8153
8154 2010-03-22  Doug Kwan  <dougkwan@google.com>
8155
8156         * arm.cc (Arm_relocate_functions::abs8,
8157         Arm_relocate_functions::abs16): Use correct check for overflow
8158         specified in the ARM ELF specs.
8159         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8160         target of a BLX instruction specially.
8161         (Reloc_stub::stub_type_for_reloc): Ditto.
8162         (Relocate::relocate): Use symbolic names instead of numeric relocation
8163         codes to report error.
8164         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8165         workaround.
8166         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8167         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8168         thumb2_blx_out_of_range.stdout
8169         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8170         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8171         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8172         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8173         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8174         thumb2_blx_in_range, thumb2_blx_in_range.o,
8175         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8176         thumb2_blx_out_of_range.o): New rules.
8177         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8178         thumb2_blx_in_range and thumb2_blx_out_of_range.
8179         * testsuite/Makefile.in: Regenerate.
8180         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8181         * testsuite/thumb_blx_in_range.s: New file.
8182         * testsuite/thumb_blx_out_of_range.s: New file.
8183
8184 2010-03-22  Rafael Espindola  <espindola@google.com>
8185
8186         * archive.cc (Should_include): Move to archive.h.
8187         (should_include_member): Make it a member of Archive.
8188         (Lib_group): New.
8189         (Add_lib_group_symbols): New.
8190         * archive.h: Include options.h.
8191         (Archive_member): Moved from Archive.
8192         (Should_include): Moved from archive.cc.
8193         (Lib_group): New.
8194         (Add_lib_group_symbols): New.
8195         * dynobj.cc (do_should_include_member): New.
8196         * dynobj.h (do_should_include_member): New.
8197         * gold.cc (queue_initial_tasks): Update call to queue.
8198         * main.cc (main): Print lib group stats.
8199         * object.cc (do_should_include_member): New.
8200         * object.h: Include archive.h.
8201         (Object::should_include_member): New.
8202         (Object::do_should_include_member): New.
8203         (Sized_relobj::do_should_include_member): New.
8204         * options.cc (General_options::parse_start_lib): New.
8205         (General_options::parse_end_lib): New.
8206         (Input_arguments::add_file): Handle lib groups.
8207         (Input_arguments::start_group): Check we are not in a lib.
8208         (Input_arguments::start_lib): New.
8209         (Input_arguments::end_lib): New.
8210         * options.h (General_options): Add start_lib and end_lib.
8211         (Input_argument::lib_): New.
8212         (Input_argument::lib): New.
8213         (Input_argument::is_lib): New.
8214         (Input_file_lib): New.
8215         (Input_arguments::in_lib_): New.
8216         (Input_arguments::in_lib): New.
8217         (Input_arguments::start_lib): New.
8218         (Input_arguments::end_lib_): New.
8219         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8220         in unused members as preempted.
8221         (Sized_pluginobj::do_should_include_member): New.
8222         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8223         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8224         return the blocker.
8225         (Read_symbols::do_whole_lib_group): New.
8226         (Read_symbols::do_lib_group): New.
8227         (Read_symbols::do_read_symbols): Handle lib groups.
8228         (Read_symbols::get_name): Handle lib groups.
8229         * readsyms.h (Read_symbols): Add an archive member pointer.
8230         (Read_symbols::do_whole_lib_group): New.
8231         (Read_symbols::do_lib_group): New.
8232         (Read_symbols::member_): New.
8233         * script.cc (read_input_script): Update call to queue_soon.
8234
8235 2010-03-19  Doug Kwan  <dougkwan@google.com>
8236
8237         * arm.cc (Stub_table::Stub_table): Initialize new data members
8238         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8239         (Stub_table::add_reloc_stub): Assign stub offset and update
8240         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8241         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8242         New data members.
8243         (Stub_table::update_data_size_and_addralign): Use
8244         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8245         instead of going over all reloc stubs.
8246         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8247         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8248         Stringpool_template::offset_ to size of Stringpool_char.
8249         (Stringpool_template::new_key_offset): Remove code to initialize
8250         Stringpool_template::offset_.
8251         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8252         Stringpool_template::offset_ to zero.
8253
8254 2010-03-15  Doug Kwan  <dougkwan@google.com>
8255
8256         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8257         offset_.
8258         (Stringpool_template::new_key_offset): New method.
8259         (Stringpool_template::add_string): Assign offsets when adding new
8260         strings.
8261         (Stringpool_template::set_string_offsets): Do not set string offsets
8262         when not optimizing.
8263         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8264         member size_.
8265         (Chunked_vector::clear): Clear size_.
8266         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8267         (Chunked_vector::size): Return size_.
8268         (Chunked_vector::push_back): Use size_ to find insert position.
8269         (Chunked_vector::size_): New data member.
8270         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8271         (Stringpool_template::new_key_offset): New method declaration.
8272         (Stringpool_template::offset_): New data member.
8273
8274 2010-03-15   Rafael Espindola  <espindola@google.com>
8275
8276         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8277         Add_symbols' constructor.
8278         * readsyms.h (Add_symbols): Remove the input_group member.
8279
8280 2010-03-10  Ian Lance Taylor  <iant@google.com>
8281
8282         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8283         target to ask whether a reference to a symbol requires a stack
8284         split.
8285         * target.h (Target::is_call_to_non_split): New function.
8286         (Target::do_is_call_to_non_split): Declare virtual function.
8287         * target.cc: Include "symtab.h".
8288         (Target::do_is_call_to_non_split): New function.
8289         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8290
8291 2010-03-10  Cary Coutant  <ccoutant@google.com>
8292
8293         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8294         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8295         (File_read::open[2]): Add whole_file_view_ to list of views.
8296         (File_read::make_view): Remove test of whole_file_view_.
8297         (File_read::find_or_make_view): Create whole_file_view_ if
8298         necessary.
8299         (File_read::clear_views): Replace bool parameter with enum;
8300         adjust all callers.  Don't delete views with permanent data;
8301         do delete cached views and views from archives if
8302         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8303         if clearing the corresponding view.
8304         * fileread.h (File_read::Clear_views_mode): New enum.
8305         (File_read::View::is_permanent_view): New method.
8306         (File_read::clear_views): Replace bool parameter
8307         with enum; adjust all callers.
8308         * options.h (General_options): Change keep_files_mapped option;
8309         add map_whole_files.
8310         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8311         releasing the file.
8312         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8313         the file.
8314
8315 2010-03-10  David S. Miller  <davem@davemloft.net>
8316
8317         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8318
8319 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8320
8321         * icf.cc (get_section_contents): Add '@' marker after processing the
8322         merge reloc.
8323
8324 2010-03-08  Doug Kwan  <dougkwan@google.com>
8325
8326         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8327         due to a conversion warning.
8328         (Arm_relobj::update_output_local_symbol_count): Check for local
8329         symbol with unset output index.
8330
8331 2010-03-05  Ian Lance Taylor  <iant@google.com>
8332
8333         * options.h (class General_options): Add --spare-dynamic-tags.
8334         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8335         --spare-dynamic-tags.
8336
8337 2010-03-05  Ian Lance Taylor  <iant@google.com>
8338
8339         * incremental.cc: Include "libiberty.h".
8340
8341 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8342
8343         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8344         function, is_info_ member.
8345         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8346         (Versions::Versions): Update caller.
8347         (Versions::define_base_version): Likewise.
8348         (Versions::add_def): Likewise.
8349
8350 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8351
8352         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8353         (Scan::possible_function_pointer_reloc): New function.
8354         (Scan::local_reloc_may_be_function_pointer): Change to call
8355         possible_function_pointer_reloc.
8356         (Scan::global_reloc_may_be_function_pointer): Ditto.
8357         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8358         relocations in ".data.rel.ro._ZTV" section.
8359         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8360         * testsuite/icf_safe_so_test.cc: Ditto.
8361         * testsuite/icf_safe_test.cc: Ditto.
8362         * testsuite/icf_safe_test.sh: Ditto.
8363
8364 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8365             Ian Lance Taylor  <iant@google.com>
8366
8367         * target-reloc.h (relocate_section): Check the symbol table index
8368         for -1U before setting the local symbol index.
8369         (scan_relocatable_relocs): If copying the relocation, record that
8370         the local symbol is required.
8371         * object.h (Symbol_value::is_output_symtab_index_set): New
8372         function.
8373         (Symbol_value::may_be_discarded_from_output_symtab): New
8374         function.
8375         (Symbol_value::has_output_symtab_entry): New function.
8376         (Symbol_value::needs_output_symtab_entry): Remove.
8377         (Symbol_value::output_symtab_index): Make sure the symbol index is
8378         set.
8379         (Symbol_value::set_output_symtab_index): Make sure the symbol
8380         index is not set.  Make sure the new index is valid.
8381         (Symbol_value::set_must_have_output_symtab_entry): New function.
8382         (Symbol_value::has_output_dynsym_entry): New function.
8383         (Symbol_value::set_output_dynsym_index): Make sure the new index
8384         is valid.
8385         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8386         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8387         local symbol if permitted.
8388         (Sized_relobj::do_finalize_local_symbols): Call
8389         is_output_symtab_index_set rather than needs_output_symtab_entry.
8390         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8391         rather than needs_output_symtab_entry.  Call
8392         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8393         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8394         is_output_symtab_index_set rather than needs_output_symtab_entry.
8395         * testsuite/discard_locals_relocatable_test.c: New file.
8396         * testsuite/discard_locals_test.sh: Test -r.
8397         * testsuite/Makefile.am (check_DATA): Add
8398         discard_locals_relocatable_test1.syms,
8399         discard_local_relocatable_test2.syms.
8400         (MOSTLYCLEANFILES): Likewise.  Also add
8401         discard_locals_relocatable_test1.lout and
8402         discard_locals_relocatable_test2.out.
8403         (discard_locals_relocatable_test1.syms): New target.
8404         (discard_locals_relocatable_test.o): New target.
8405         (discard_locals_relocatable_test1.out): New target.
8406         (discard_locals_relocatable_test2.syms): New target.
8407         (discard_locals_relocatable_test2.out): New target.
8408         (various): Add missing ../ld-new dependencies.
8409         * testsuite/Makefile.in: Rebuild.
8410
8411 2010-03-03  Nick Clifton  <nickc@redhat.com>
8412
8413         * po/fi.po: New Finnish translation.
8414
8415 2010-03-01  Doug Kwan  <dougkwan@google.com>
8416
8417         * layout.cc (Layout::Layout): Force section types of .init_array*,
8418         .preinit_array* and .fini_array* sections.
8419         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8420         Fix check of return value of std::string::find.().
8421         (Output_section::Input_section_sort_compare::operator()): Remove
8422         comment about .init_array.
8423         (Output_section::Input_section_sort_init_fini_compare::operator()):
8424         New method.
8425         (Output_section::sort_attached_input_sections): Handle .init_array
8426         and .fini_array specially.
8427         * output.h (Output_section::Inut_section_sort_compare): Update
8428         comment.
8429         (Output_section::Input_section_sort_init_fini_compare): New struct.
8430
8431 2010-02-26  Doug Kwan  <dougkwan@google.com>
8432
8433         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8434         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8435         * testsuite/debug_msg.sh: Avoid matching source line number for
8436         use of global variable undef_int.
8437
8438 2010-02-26  Doug Kwan  <dougkwan@google.com>
8439
8440         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8441         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8442         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8443         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8444         * options.cc (General_options::General_options): Initialize member
8445         fix_v4bx_.
8446         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8447         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8448         and rm_no_fix_v4bx.stdout
8449         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8450         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8451         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8452         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8453         and arm_no_fix_v4bx.
8454         * Makefile.in: Regenerate.
8455         * testsuite/arm_fix_v4bx.s: New file.
8456         * testsuite/arm_fix_v4bx.sh: Ditto.
8457
8458 2010-02-24  Doug Kwan  <dougkwan@google.com>
8459
8460         * arm.cc (Target_arm::got_section): Make the .got section the first
8461         non RELRO section in the data segment.
8462         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8463         suffixes of section names.
8464
8465 2010-02-24  Doug Kwan  <dougkwan@google.com>
8466
8467         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8468         flags and attributes merging if an input file is a binary file.
8469         * fileread.cc (Input_file::open): Record format of original file.
8470         * fileread.h (Input_file::Format): New enum type.
8471         (Input_file::Input_file): Initialize data member format_.
8472         (Input_file::format): New method definition.
8473         (Input_file::format_):: New data member.
8474
8475 2010-02-24  Doug Kwan  <dougkwan@google.com>
8476
8477         * arm.cc (Arm_output_data_got): New class.
8478         (ARM_TCB_SIZE): New constant
8479         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8480         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8481         If user uses a script with a SECTIONS clause, issue only a warning
8482         for a misplaced EXIDX input section.  Otherwise, issue an error.
8483         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8484         garbage collection.
8485         (Target_arm::got_mode_index_entry): Handle static linking.
8486         (Target_arm::Scan::local): Ditto.
8487         (Target_arm::Scan::global): Ditto.
8488         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8489         all incorrectly implemented relocations.
8490         (Target_arm::fix_exidx_coverage): Pass layout to
8491         Arm_output_section::fix_exidx_coverage.
8492         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8493         from ".ARM.exidx." and ".ARM.extab.".
8494
8495 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8496
8497         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8498         section if it does not already exist.
8499         * attributes.cc (Attributes_section_data::Attributes_section_data):
8500         Don't crash if size is zero.
8501
8502 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8503             Ian Lance Taylor  <iant@google.com>
8504
8505         * gold.cc (queue_middle_tasks): If no input files were opened,
8506         exit.
8507         * workqueue.h (Task_function::Task_function): Assert that there is
8508         a blocker.
8509
8510 2010-02-22  Doug Kwan  <dougkwan@google.com>
8511
8512         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8513         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8514         types to avoid warnings due to different uint64_t implementations
8515         on different hosts.
8516
8517 2010-02-21  Doug Kwan  <dougkwan@google.com>
8518
8519         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8520         handling of the maximum backward branch offset.
8521         (Arm_relocate_functions::thumb_branch_common): Ditto.
8522         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8523         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8524         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8525         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8526         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8527         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8528         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8529         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8530         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8531         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8532         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8533         thumb2_bl_out_of_range.o): New rules.
8534         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8535         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8536         thumb2_bl_out_of_range
8537         * testsuite/Makefile.in: Regenerate.
8538         * testsuite/arm_bl_in_range.s: New file.
8539         * testsuite/arm_bl_out_of_range.s: Ditto.
8540         * testsuite/arm_branch_in_range.sh: Ditto.
8541         * testsuite/arm_branch_range.t: Ditto.
8542         * testsuite/thumb2_branch_range.t: Ditto.
8543         * testsuite/thumb_bl_in_range.s: Ditto.
8544         * testsuite/thumb_bl_out_of_range.s: Ditto.
8545         * testsuite/thumb_branch_range.t: Ditto.
8546
8547 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8548
8549         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8550         Add reloc offset information.
8551         * icf.cc (get_section_contents): Change iterators to point to the new
8552         vectors. Add reloc offset information to the contents.
8553         * icf.h (Icf::Sections_reachable_info): New typedef.
8554         (Icf::Sections_reachable_list): New typedef.
8555         (Icf::Offset_info): New typedef.
8556         (Icf::Reloc_info): New struct typedef.
8557         (Icf::Reloc_info_list): New typedef.
8558         (Icf::symbol_reloc_list): Delete method.
8559         (Icf::addend_reloc_list): Delete method.
8560         (Icf::section_reloc_list): Delete method.
8561         (Icf::reloc_info_list): New method.
8562         (Icf::reloc_info_list_): New member.
8563
8564 2010-02-19  Doug Kwan  <dougkwan@google.com>
8565
8566         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8567         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8568         * arm.cc (Arm_relocation_functions): New forward declaration.
8569         (Target_arm::Target_arm): Initialize new data members
8570         got_mod_index_offset_ and tls_base_symbol_defined_.
8571         (Target_arm::Relocate::relocate_tls): New method.
8572         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8573          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8574         New methods.
8575         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8576         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8577         (Target_arm::got_mod_index_offset_,
8578         Target_arm::tls_base_symbol_defined_): New data members.
8579         (Target_arm::Scan::local, Target::Scan::global,
8580         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8581         relocations.
8582
8583 2010-02-18  Doug Kwan  <dougkwan@google.com>
8584
8585         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8586         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8587         text section as a parameter becuase some broken tools may not set
8588         the link in section header.
8589         (Target_arm::has_got_section): New method.
8590         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8591         without any mapping symbol as data only.  Remove warning.
8592         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8593         link in its section header, try to discover the link by inspecting the
8594         REL31 relocation at the beginning of the section.
8595         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8596         in error message.
8597         (Target_arm::Scan::global): Treat any reference to the symbol
8598         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8599
8600 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8601
8602         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8603         (Scan::global_reloc_may_be_function_pointer): New function.
8604         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8605         (Scan::global_reloc_may_be_function_pointer): New function.
8606         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8607         (Scan::global_reloc_may_be_function_pointer): New function.
8608         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8609         (Scan::global_reloc_may_be_function_pointer): New function.
8610         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8611         (Scan::global_reloc_may_be_function_pointer): New function.
8612         (Scan::possible_function_pointer_reloc): New function.
8613         (Target_x86_64::can_check_for_function_pointers): New function.
8614         * gc.h (gc_process_relocs): Scan relocation types to determine if
8615         function pointers were taken for targets that support it.
8616         * icf.cc (Icf::find_identical_sections): Include functions for
8617         folding in safe ICF whose pointer is not taken.
8618         * icf.h (Secn_fptr_taken_set): New typedef.
8619         (fptr_section_id_): New member.
8620         (section_has_function_pointers): New function.
8621         (set_section_has_function_pointers): New function.
8622         (check_section_for_function_pointers): New function.
8623         * options.h: Fix comment for safe ICF option.
8624         * target.h (can_check_for_function_pointers): New function.
8625         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8626         Modify icf_safe_test for X86-64.
8627         * testsuite/Makefile.in: Regenerate.
8628         * testsuite/icf_safe_so_test.cc: New file.
8629         * testsuite/icf_safe_so_test.sh: New file.
8630         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8631         (main): Change to take pointer to function kept_func_3.
8632         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8633         folding is done correctly for X86-64.
8634
8635 2010-02-12  David S. Miller  <davem@davemloft.net>
8636
8637         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8638         is_symbolless parameter.
8639         (Output_reloc<SHT_REL>::is_symbolless): New.
8640         (Output_reloc<SHT_REL>::is_symbolless_): New.
8641         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8642         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8643         (Output_reloc<SHT_RELA>::is_symbolless): New.
8644         (Output_data_reloc::add_global): Handle is_symbolless.
8645         (Output_data_reloc::add_global_relative): Likewise.
8646         (Output_data_reloc::add_local): Likewise.
8647         (Output_data_reloc::add_local_relative): Likewise.
8648         (Output_data_reloc::add_symbolless_global_addend): New.
8649         (Output_data_reloc::add_symbolless_local_addend): New.
8650         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8651         is_symbolless.
8652         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8653         instead of ->is_relative_
8654         (Output_reloc::write): Likewise.
8655         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8656         (Output_reloc::write_rel): Simplify.
8657
8658         * sparc.cc (Target_sparc::Scan::local): Use
8659         ->add_symbolless_local_addend as needed.
8660         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8661         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8662         based upon relocation offset.
8663
8664 2010-02-11  Doug Kwan  <dougkwan@google.com>
8665
8666         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8667         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8668         beginning of function.
8669         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8670         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8671         parameter is_32bit in calls to should_apply_static_reloc.
8672         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8673         (check_DATA): Add arm_abs_global.stdout.
8674         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8675         arm_abs_global.stdout): New rules.
8676         (MOSTLLYCLEANFILES): Add arm_abs_global
8677         * Makefile.in: Regenerate.
8678         * testsuite/arm_abs_global.s: New file.
8679         * testsuite/arm_abs_global.sh: Ditto.
8680         * testsuite/arm_abs_lib.s: Ditto.
8681
8682 2010-02-11  Ian Lance Taylor  <iant@google.com>
8683
8684         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8685         Read_relocs task.
8686         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8687         Allocate_commons_task first.
8688         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8689         task, rather than symtab_lock_.
8690         (Gc_process_relocs::~Gc_process_relocs): New function.
8691         (Gc_process_relocs::is_runnable): Check this_blocker_.
8692         (Gc_process_relocs::locks): Use next_blocker_ rather than
8693         blocker_.
8694         (Scan_relocs::~Scan_relocs): New function.
8695         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8696         symtab_lock_.
8697         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8698         next_blocker_.
8699         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8700         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8701         constructor accordingly.
8702         (class Gc_process_relocs): Likewise.
8703         (class Scan_relocs): Likewise.
8704         * common.h (class Allocate_commons_task): Remove symtab_lock_
8705         field, and corresponding constructor parameter.
8706         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8707         symtab_lock_.
8708         (Allocate_commons_task::locks): Likewise.
8709
8710 2010-02-11  Ian Lance Taylor  <iant@google.com>
8711
8712         * gold-threads.h (class Once): Define.
8713         (class Initialize_lock): Rewrite as child of Once.
8714         * gold-threads.cc (class Once_initialize): Define.
8715         (once_pointer_control): New static variable.
8716         (once_pointer, once_arg): New static variables.
8717         (c_run_once): New static function.
8718         (Once::Once, Once::run_once, Once::internal_run): New functions.
8719         (class Initialize_lock_once): Remove.
8720         (initialize_lock_control): Remove.
8721         (initialize_lock_pointer): Remove.
8722         (initialize_lock_once): Remove.
8723         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8724         (Initialize_lock::initialize): Rewrite.
8725         (Initialize_lock::do_run_once): New function.
8726         * archive.cc (Archive::interpret_header): Only clear name if it is
8727         not already empty.
8728         * fileread.cc: Include "gold-threads.h"
8729         (file_counts_lock): New static variable.
8730         (file_counts_initialize_lock): Likewise.
8731         (File_read::release): Only increment counts when using --stats.
8732         Use a lock around the increment.
8733         * parameters.cc (class Set_parameters_target_once): Define.
8734         (set_parameters_target_once): New static variable.
8735         (Parameters::Parameters): Move here from parameters.h.
8736         (Parameters::set_target): Rewrite.
8737         (Parameters::set_target_once): New function.
8738         (Parameters::clear_target): Move here and rewrite.
8739         * parameters.h (class Parameters): Update declarations.  Add
8740         set_parameters_target_once_ field.
8741         (Parameters::Parameters): Move to parameters.cc.
8742         (Parameters::clear_target): Likewise.
8743         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8744         task.
8745         (Start_group::~Start_group): New function.
8746         (Start_group::is_runnable): New function.
8747         (Start_group::locks, Start_group::run): New functions.
8748         (Finish_group::run): Change saw_undefined to size_t.
8749         * readsyms.h (class Start_group): Define.
8750         (class Finish_group): Change saw_undefined_ field to size_t.
8751         (Finish_group::Finish_group): Remove saw_undefined and
8752         this_blocker parameters.  Change all callers.
8753         (Finish_group::set_saw_undefined): New function.
8754         (Finish_group::set_blocker): New function.
8755         * symtab.h (class Symbol_table): Change saw_undefined to return
8756         size_t.  Change saw_undefined_ field to size_t.
8757         * target-select.cc (Set_target_once::do_run_once): New function.
8758         (Target_selector::Target_selector): Initialize set_target_once_
8759         field.  Don't initialize lock_ and initialize_lock_ fields.
8760         (Target_selector::instantiate_target): Rewrite.
8761         (Target_selector::set_target): New function.
8762         * target-select.h (class Set_target_once): Define.
8763         (class Target_selector): Update declarations.  Make
8764         Set_target_once a friend.  Remove lock_ and initialize_lock_
8765         fields.  Add set_target_once_ field.
8766
8767 2010-02-10  Ian Lance Taylor  <iant@google.com>
8768
8769         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8770         queueing any tasks.
8771         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8772         (queue_middle_tasks): Add all blockers before queueing any tasks.
8773         (queue_final_tasks): Likewise.
8774         * token.h (Task_token::add_blockers): New function.
8775         * object.h (Input_objects::number_of_relobjs): New function.
8776
8777 2010-02-10  Ian Lance Taylor  <iant@google.com>
8778
8779         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8780         shared, not if not position independent.
8781         * x86_64.cc (Relocate::relocate_tls): Likewise.
8782         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8783         (tls_pie_pic_test): New target.
8784         * testsuite/Makefile.in: Rebuild.
8785
8786         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8787         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8788         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8789         * testsuite/Makefile.in: Rebuild.
8790
8791 2010-02-09  David S. Miller  <davem@davemloft.net>
8792
8793         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8794         R_SPARC_RELATIVE using ->add_local_relative().
8795         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8796
8797         * output.h (Output_data_dynamic::add_section_size): New method
8798         that takes two Output_data objects.
8799         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8800         entry param.  Handle it in initializers.
8801         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8802         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8803         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8804         arg.
8805         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8806         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8807         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8808         for dynrel_includes_plt.
8809         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8810         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8811         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8812         before .rela.plt
8813         (Target_sparc::do_finalize_sections): Update to pass true for
8814         dynrel_includes_plt.
8815         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8816         output before .rela.plt
8817         (Target_powerpc::do_finalize_sections): Update to pass true for
8818         dynrel_includes_plt when 32-bit.
8819
8820 2010-02-08  Doug Kwan  <dougkwan@google.com>
8821
8822         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8823         method.
8824         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8825         Arm_relobj::scan_section_for_cortex_a8_stubs,
8826         Arm_relobj::do_relocation_section): Instead of calling
8827         Output_section::output_address, use faster
8828         Arm_relobj::simple_input_section_output_address.
8829
8830 2010-02-08  David S. Miller  <davem@davemloft.net>
8831
8832         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8833         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8834         relocation helper function.
8835
8836         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8837         just like R_SPARC_GOT{10,13,22}.
8838         (Target_sparc::Scan::local): Likewise.
8839         (Target_sparc::Relocate:relocate): Likewise.
8840
8841 2010-02-06  Ian Lance Taylor  <iant@google.com>
8842
8843         * configure.ac: Rewrite targetobjs duplicate removal code to use
8844         only shell constructs.
8845         * configure: Rebuild.
8846
8847 2010-02-05  Doug Kwan  <dougkwan@google.com>
8848
8849         PR 11247
8850         * arm.cc (Arm_relobj::section_is_scannable): New method.
8851         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8852         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8853
8854 2010-02-04  Doug Kwan  <dougkwan@google.com>
8855
8856         PR 11247
8857         * arm-reloc-property.cc (cstdio): Include.
8858         * configure.ac (targetobjs): Remove duplicates.
8859         * configure: Regenerate.
8860         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8861         big and little endian version for a given address size.
8862
8863 2010-02-03  Doug Kwan  <dougkwan@google.com>
8864
8865         * arm-reloc-property.cc
8866         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8867         definition.
8868         * arm-reloc-property.h
8869         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8870         New method definition.
8871         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8872         declaration.
8873         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8874         overflow to N.
8875         (GOT_PREL): Change implemented to Y.
8876         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8877         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8878         (Arm_relocate_functions::movw_abs_nc): Remove method.
8879         (Arm_relocate_functions::movt_abs): Ditto.
8880         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8881         (Arm_relocate_functions::thm_movt_abs): Ditto.
8882         (Arm_relocate_functions::movw_rel_nc): Ditto.
8883         (Arm_relocate_functions::movw_rel): Ditto.
8884         (Arm_relocate_functions::movt_rel): Ditto.
8885         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8886         (Arm_relocate_functions:thm_movw_rel): Ditto.
8887         (Arm_relocate_functions:thm_movt_rel): Ditto.
8888         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8889         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8890         New method definitions.
8891         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8892         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8893         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8894         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8895         (Target_arm::Relocate::relocate): Check for non-static or
8896         unimplemented relocation code and exit early.  Change calls to
8897         Target_arm::reloc_uses_thumb_bit and
8898         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8899         instead.  Refactor code to handle similar relocations to increase
8900         code sharing.  Remove check for unsupported relocation code in switch
8901         statement.
8902         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8903         relocation property table to find out size.  Change error message to
8904         print out the name of a relocation code instead of the numeric value.
8905         (Target_arm::scan_reloc_for_stub): Use relocation property table
8906         instead of calling Target_arm::reloc_uses_thumb_bit().
8907
8908 2010-02-02  Doug Kwan  <dougkwan@google.com>
8909
8910         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8911         types of relaxed input section.
8912
8913 2010-02-02  Doug Kwan  <dougkwan@google.com>
8914
8915         * Makefile.am (HFILES): Add arm-reloc-property.h.
8916         (DEFFILES): New.
8917         (TARGETSOURCES): Add arm-reloc-property.cc
8918         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8919         (libgold_a_SOURCES): $(DEFFILES)
8920         * Makefile.in: Regenerate.
8921         * arm-reloc-property.cc: New file.
8922         * arm-reloc-property.h: New file.
8923         * arm-reloc.def: New file.
8924         * arm.cc: Update comments.
8925         (arm-reloc-property.h): New included header.
8926         (arm_reloc_property_table): New global variable.
8927         (Target_arm::do_select_as_default_target): New method definition.
8928         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8929         arm-reloc-property to targ_extra_obj.
8930         * parameters.cc (set_parameters_target): Call
8931         Target::select_as_default_target().
8932         * target.h (Target::select_as_default_target): New method definition.
8933         (Target::do_select_as_default_target): Same.
8934
8935 2010-02-01  Doug Kwan  <dougkwan@google.com>
8936
8937         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8938         first_output_text_section_.
8939         (Arm_exidx_fixup::first_output_text_section): New method definition.
8940         (Arm_exidx_fixup::first_output_text_section_): New data member.
8941         (Arm_exidx_fixup::process_exidx_section): Record the first text
8942         output section seen.
8943         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8944         and entsize in output section header.
8945
8946 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8947
8948         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8949         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8950         (Arm_relocate_functions::thm_alu11): New Method.
8951         (Arm_relocate_functions::thm_pc8): New Method.
8952         (Arm_relocate_functions::thm_pc12): New Method.
8953         (Target_arm::Scan::local): Handle the relocations.
8954         (Target_arm::Scan::global): Likewise.
8955         (Target_arm::Relocate::relocate): Likewise.
8956         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8957
8958 2010-01-29  Doug Kwan  <dougkwan@google.com>
8959
8960         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8961         of relocation types as ld.
8962
8963 2010-01-29  Doug Kwan  <dougkwan@google.com>
8964
8965         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8966         to public.
8967         (Arm_relocate_functions::thumb_branch_common): Ditto.
8968         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8969         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8970         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8971         Arm_relocate_functions::jump24): Remove.
8972         (Target_arm::Relocate::relocate): Adjust code to call
8973         Arm_relocation_functions::arm_branch_common and
8974         Arm_relocation_functions::thumb_branch_common instead of their removed
8975         wrappers.  Merge switch-cases together to reduce source code size.
8976
8977 2010-01-29  Doug Kwan  <dougkwan@google.com>
8978
8979         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8980         output_local_symbol_count_needs_update_.
8981         (Arm_relobj::output_local_symbol_count_needs_update,
8982          Arm_relobj::set_output_local_symbol_count_needs_update,
8983          Arm_relobj::update_output_local_symbol_count): New methods.
8984         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8985         member.
8986         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8987         of pointed function as in a R_ARM_PREL31 relocation.
8988         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8989         for output local symbol count updating.
8990         (Target_arm::do_relax): Update output local symbol counts in objects
8991         if necessary.
8992         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8993
8994 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8995
8996         * arm.cc: Added support for the ARM relocations:
8997         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8998         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8999         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9000         movw_prel_nc).
9001         (Arm_relocate_functions::movw_rel): New method.
9002         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9003         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9004         thm_movw_prel_nc).
9005         (Arm_relocate_functions::thm_movw_rel): New method.
9006         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9007         thm_movt_prel).
9008         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9009         relocations.
9010         (Target_arm::Scan::global): Likewise.
9011         (Target_arm::Relocate::relocate): Likewise.
9012         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9013         Likewise.
9014
9015 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9016
9017         * arm.cc: Added support for ARM group relocations.
9018         (Target_arm::reloc_needs_sym_origin): New method.
9019         (Arm_relocate_functions::calc_grp_kn): New method.
9020         (Arm_relocate_functions::calc_grp_residual): New method.
9021         (Arm_relocate_functions::calc_grp_gn): New method.
9022         (Arm_relocate_functions::arm_grp_alu): New Method.
9023         (Arm_relocate_functions::arm_grp_ldr): New Method.
9024         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9025         (Arm_relocate_functions::arm_grp_ldc): New Method.
9026         (Target_arm::Scan::local): Handle the ARM group relocations.
9027         (Target_arm::Scan::global): Likewise.
9028         (Target_arm::Relocate::relocate): Likewise.
9029         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9030         Likewise.
9031
9032 2010-01-26  Doug Kwan  <dougkwan@google.com>
9033
9034         * arm.cc (set): Include.
9035         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9036         pointer type.
9037         (Arm_output_section::Text_section_list): New type.
9038         (Arm_output_section::append_text_sections_to_list): New method.
9039         (Arm_output_section::fix_exidx_coverage): Ditto.
9040         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9041         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9042         Relobj::set_section_offset() instead of
9043         Sized_relobj::invalidate_section_offset().
9044         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9045         parameter for section headers. Ignore relocation sections for
9046         unallocated sections and EXIDX sections.
9047         (Target_arm::fix_exidx_coverage): New method.
9048         (Target_arm::output_section_address_less_than): New type.
9049         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9050         linked text section instead of the EXIDX section.
9051         (Arm_output_section::create_stub_group): Add an assertion to check
9052         that this is not an EXIDX output section.
9053         (Arm_output_section::append_text_sections_to_list): New method.
9054         (Arm_output_section::fix_exidx_coverage): Ditto.
9055         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9056         Arm_relobj::section_needs_reloc_stub_scanning.
9057         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9058         first pass.
9059         (Target_arm::fix_exidx_coverage): New method.
9060         * object.h (Relobj::set_output_section): New method.
9061         (Sized_relobj::invalidate_section_offset): Remove method.
9062         (Sized_relobj::do_invalidate_section_offset): Remove method.
9063         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9064
9065 2010-01-25  Doug Kwan  <dougkwan@google.com>
9066
9067         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9068         Fix warning due to signed and unsigned comparison on a 32-bit host.
9069
9070 2010-01-22  Doug Kwan  <dougkwan@google.com>
9071
9072         * arm.cc (Target_arm::do_relax): Record an output section for section
9073         offset adjustment it contains any stub table that has changed.
9074         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9075         offsets in an output section if necessary.
9076         * output.cc (Output_section::Output_section): Initialize
9077         section_offsets_need_adjustments_.
9078         (Output_section::add_input_section_for_script): Renamed to
9079         Output_section::add_simple_input_section.
9080         (Output_section::save_states): Add a comment.
9081         (Output_section::discard_states): New method defintion.
9082         (Output_section::adjust_section_offsets): Same.
9083         * output.h (Output_section::add_input_section_for_script): Renamed to
9084         Output_section::add_simple_input_section.
9085         (Output_section::discard_states): New method declaration.
9086         (Output_section::adjust_section_offsets): Same.
9087         (Output_section::section_offsets_need_adjustment,
9088         Output_section::set_section_offsets_need_adjustment): New method
9089         definitions.
9090         (Output_section::section_offsets_need_adjustment_): New data member.
9091         * script-sections.cc
9092         (Output_section_element_input::set_section_address): Adjust code for
9093         renaming of Output_section::add_input_section_for_script.
9094         (Orphan_output_section::set_section_address): Same.
9095
9096 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9097
9098         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9099         Fix_v4bx enum values .
9100         * gold/options.h (General_options): New option definitions.
9101         (General_options::fix_v4bx): New method.
9102         (General_options::Fix_v4bx): New enum.
9103         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9104         (General_options::parse_fix_v4bx_interworking): New method.
9105
9106 2010-01-22  Doug Kwan  <dougkwan@google.com>
9107
9108         * arm.cc (Arm_exidx_fixup): New class.
9109
9110 2010-01-21  Doug Kwan  <dougkwan@google.com>
9111
9112         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9113         classes.
9114         (Arm_exidx_section_offset_map): New type.
9115
9116 2010-01-21  Doug Kwan  <dougkwan@google.com>
9117
9118         * arm.cc (Arm_exidx_input_section): New class.
9119         (Arm_relobj::exidx_input_section_by_link,
9120         Arm_relobj::exidx_input_section_by_shndx,
9121         Arm_relobj::make_exidx_input_section): New methods.
9122         (read_arm_attributes_section): Remove.
9123         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9124         information about them.
9125         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9126         to here.
9127
9128 2010-01-20  Doug Kwan  <dougkwan@google.com>
9129
9130         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9131         Input_section_specifier to Section_id.
9132         (Target_arm::new_arm_input_section: Adjust code for change of key
9133         type.
9134         (Target_arm::find_arm_input_section): Ditto.
9135         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9136         (Section_id): Remove.
9137         (Garbage_collection::Section_id_hash): Remove.
9138         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9139         (Section_id): Remove.
9140         (Icf::Section_id_hash): Remove.
9141         * object.h (Section_id, Const_section_id, Section_id_hash,
9142         Const_section_id_hash): New type definitions.
9143         * output.cc (Output_section::add_relaxed_input_section): Change to
9144         use Const_section_id instead of Input_section_specifier as key type.
9145         (Output_section::add_merge_input_section): Ditto.
9146         (Output_section::build_relaxation_map): Change to use Section_id
9147         instead of Input_section_specifier as key type.
9148         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9149         Ditto.
9150         (Output_section::convert_input_sections_to_relaxed_sections): Change
9151         to use Const_section_id instead of Input_section_specifier as key type.
9152         (Output_section::find_merge_section): Ditto.
9153         (Output_section::find_relaxed_input_section): Ditto.
9154         * output.h (Input_section_specifier): Remove class.
9155         (Output_section::Output_section_data_by_input_section_map): Change
9156         key type to Const_section_id.
9157         (Output_section::Output_relaxed_input_section_by_input_section_map):
9158         Ditto.
9159         (Output_section::Relaxation_map): Change key type to Section_id.
9160
9161 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9162
9163         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9164         (class Arm_v4bx_stub): New class.
9165         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9166         (Stub_factory::make_arm_v4bx_stub): New method.
9167         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9168         (Stub_table::empty): Handle v4bx stubs.
9169         (Stub_table::add_arm_v4bx_stub): New method.
9170         (Stub_table::find_arm_v4bx_stub): New method.
9171         (Arm_relocate_functions::v4bx): New method.
9172         (Target_arm::fix_v4bx): New method.
9173         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9174         (Stub_table::relocate_stubs): Likewise.
9175         (Stub_table::do_write): Likewise.
9176         (Stub_table::update_data_size_and_addralign): Likewise.
9177         (Stub_table::finalize_stubs):  Likewise.
9178         (Target_arm::Scan::local): Likewise.
9179         (Target_arm::Scan::global): Likewise.
9180         (Target_arm::do_finalize_sections): Likewise.
9181         (Target_arm::Relocate::relocate): Likewise.
9182         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9183         Likewise.
9184         (Target_arm::scan_reloc_for_stub): Likewise.
9185         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9186
9187 2010-01-19  Ian Lance Taylor  <iant@google.com>
9188
9189         * output.cc (Output_section_headers::do_sized_write): Write large
9190         segment count to sh_info field.
9191         (Output_file_header::do_sized_write): For large segment count,
9192         write PN_XNUM to e_phnum field.
9193
9194 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9195
9196         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9197         (Arm_relocate_functions::thm_jump8): New function.
9198         (Arm_relocate_functions::thm_jump11): New function.
9199         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9200         R_ARM_THM_JUMP11.
9201         (Target_arm::Scan::global): Likewise.
9202         (Target_arm::Relocate::relocate): Likewise.
9203         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9204         Likewise.
9205
9206 2010-01-14  Doug Kwan  <dougkwan@google.com>
9207
9208         * arm.cc (map, utility): Include headers.
9209         (Target_arm::apply_cortex_a8_workaround): New method.
9210         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9211         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9212         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9213         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9214         the --[no-]fix-cortex-a8 command line options.
9215         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9216         (Target_arm::relocate_stub): Use addend in instruction template.
9217         * options.h (DEFINE_bool): Set the user-set flag.
9218         (General_options): Add --[no-]-fix-cortex options.
9219         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9220         : Update fast look-up map after conversion.
9221
9222 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9223
9224         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9225         in the first pass of do_layout.
9226
9227 2010-01-13  Doug Kwan  <dougkwan@google.com>
9228
9229         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9230         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9231         apparent compiler problem of not folding static constant integral
9232         data members of elfcpp::Elf_sizes<32>.
9233
9234 2010-01-13  Doug Kwan  <dougkwan@google.com>
9235
9236         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9237         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9238         Arm_relobj::scan_section_for_cortex_a8_erratum,
9239         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9240         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9241         sections to scan for relocation stubs into a new method
9242         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9243         relocation and Cortex-A8 stub scanning.
9244         (Target_arm::do_relax): Force stubs to be after stubbed sections
9245         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9246         the beginning of a new relaxation pass.  Update a comment.
9247         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9248
9249 2010-01-12  Ian Lance Taylor  <iant@google.com>
9250
9251         * target-reloc.h (visibility_error): New inline function.
9252         (relocate_section): Call visibility_error.
9253         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9254         (MOSTLYCLEANFILES): Likewise.
9255         (protected_4_pic.o, protected_3.err): New targets.
9256         * testsuite/protected_4.cc: New file.
9257
9258 2010-01-12  Doug Kwan  <dougkwan@google.com>
9259
9260         * arm.cc (Cortex_a8_reloc): New class.
9261         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9262         and cortex_a8_relocs_info_.
9263         (Target_arm::fix_cortex_a8): New method definition.
9264         (Target_arm::Cortex_a8_relocs_info): New type.
9265         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9266         New data member declarations.
9267         (Target_arm::scan_reloc_for_stub): Record information about
9268         relocations for THUMB branches that might be exempted from the
9269         Cortex-A8 workaround.
9270         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9271         at the beginning of a relaxation pass.
9272
9273 2010-01-12  Doug Kwan  <dougkwan@google.com>
9274
9275         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9276         (Arm_relobj::Mapping_symbol_position,
9277          Arm_reloj::Mapping_symbol_position_less,
9278          Arm_relobj::Mapping_symbols_info): New types.
9279         (Target_arm::is_mapping_symbol_name): New method definition.
9280         (Arm_relobj::do_count_local_symbols): Save information about mapping
9281         symbols.
9282
9283 2010-01-11  Doug Kwan  <dougkwan@google.com>
9284
9285         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9286         Arm_relocate_functions::thumb32_branch_upper,
9287         Arm_relocate_functions::thumb32_branch_lower,
9288         Arm_relocate_functions::thumb32_cond_branch_offset,
9289         Arm_relocate_functions::thumb32_cond_branch_upper,
9290         Arm_relocate_functions::thumb32_cond_branch_lower,
9291         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9292         branch offset encoding.
9293         (Arm_relocate_functions::thumb_branch_common): Use new branch
9294         offset encoding methods to avoid code duplication.
9295         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9296         (Stub_addend_reader::operator()): Use new branch encoding method
9297         to avoid code duplication.
9298
9299 2010-01-11  Doug Kwan  <dougkwan@google.com>
9300
9301         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9302         (Target_arm::do_finalize_sections): Define special EXIDX section
9303         symbols only if referenced.
9304         * gc.h (Garbage_collection::add_reference): New method.
9305         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9306         code duplication.
9307
9308 2010-01-11  Ian Lance Taylor  <iant@google.com>
9309
9310         * script.cc (Version_script_info::build_expression_list_lookup):
9311         Change complaing about duplicate wildcard match from error to
9312         warning.
9313
9314         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9315         of 2009-12-30.
9316         (Version_script_info::Version_script_info): Initialize globs_,
9317         default_version_, default_is_global_, and exact_.  Don't
9318         initialize globals_ or locals_.
9319         (Version_script_info::build_lookup_tables): Build local symbols
9320         first.
9321         (Version_script_info::unquote): New function.
9322         (Version_script_info::add_exact_match): New function.
9323         (Version_script_info::build_expression_list_lookup): Remove lookup
9324         parameter.  Add is_global parameter.  Change all callers.  Handle
9325         wildcard pattern specially.  Unquote pattern.  Call
9326         add_exact_match.
9327         (Version_script_info::get_name_to_match): New function.
9328         (Version_script_info::get_symbol_version): New function.
9329         (Version_script_info::get_symbol_version_helper): Remove.
9330         (Version_script_info::check_unmatched_names): Call unquote.
9331         * script.h (class Version_script_info): Change get_symbol_version
9332         to be non-inline and add is_global parameter; change all callers.
9333         Rewrite symbol_is_local.  Update declarations.  Define struct
9334         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9335         Remove globals_ and locals_ members.  Add exact_, globs_,
9336         default_version_, is_global_.
9337         (Version_script_info::Glob): Remove pattern, add expression and
9338         is_global.  Update constructor.  Change all callers.
9339         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9340         default version.
9341         (Versions::symbol_section_contents): If a symbol is undefined, or
9342         defined in a dynamic object, set the version index to
9343         VER_NDX_LOCAL.
9344         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9345         symbol_is_local.
9346         (Symbol_table::add_from_pluginobj): Likewise.
9347         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9348
9349 2010-01-11  Doug Kwan  <dougkwan@google.com>
9350
9351         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9352         (incremental_dump_LDADD): Add linking option for libintl.
9353         * Makefile.in: Regenerate.
9354
9355 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9356
9357         PR gold/11144
9358         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9359         instead of -Ds.
9360         * testsuite/Makefile.in: Regenerated.
9361
9362 2010-01-10  Doug Kwan  <dougkwan@google.com>
9363
9364         * options.h (DEFINE_var): Use parentheses around argument varname__
9365         in macro body to avoid any unintended subsequent substitutions.
9366
9367 2010-01-10  Ian Lance Taylor  <iant@google.com>
9368
9369         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9370         candidates before doing symbol resolution.
9371
9372         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9373         ODR candidates if only one is weak.
9374
9375 2010-01-08  Ian Lance Taylor  <iant@google.com>
9376
9377         * script.cc (Version_script_info::build_expression_list_lookup):
9378         Don't warn about ambiguous version, just record the ambiguity.
9379         (Version_script_info::get_symbol_version_helper): Give error if
9380         version is ambiguous.
9381
9382 2010-01-08  Doug Kwan  <dougkwan@google.com>
9383
9384         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9385         prev_data_size_ and prev_addralign_.  Remove initializer for
9386         deleted data member has_been_changed_.
9387         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9388         to determine if the table is empty.
9389         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9390         Remove.
9391         (Stub_table::add_reloc_stub): Define method in class definition
9392         instead of just declaring it there.
9393         (Stub_table::add_cortex_a8_stub): New method definition.
9394         (Stub_table::update_data_size_and_addralign): Ditto.
9395         (Stub_table::finalize_stubs): Ditto.
9396         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9397         (Stub_table::do_addralign_): Return address alignment in the
9398         (Stub_table::do_reset_address_and_file_offset): Define method in
9399         class definition instead of declaring it there.  Set current data
9400         size to be the data size of the previous pass.
9401         (Stub_table::set_final_data_size): Use current data size as the
9402         final data size.
9403         (Stub_table::relocate_stub): Change parameter type of stub from
9404         Reloc_stub pointer to Stub pointer.
9405         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9406         (Stub_table::Cortex_a8_stub_list): New typedef.
9407         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9408          Stub_table::prev_addralign_): New data member.
9409         (Arm_relobj::Arm_relobj): Initialize data member
9410         section_has_cortex_a8_workaround_.
9411         (Arm_relobj::section_has_cortex_a8_workaround,
9412          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9413          definitions.
9414         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9415         declarations.
9416         (Target_arm::relocate_stub): Change parameter type of stub from
9417         Reloc_stub pointer to Stub pointer.
9418         (Insn_template::size, Insn_template::alignment): Handle
9419         THUMB16_SPECIAL_TYPE.
9420         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9421          Stub_table::update_data_size_and_addralign,
9422          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9423         definitions.
9424         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9425         (Stub_table::do_write): Ditto.
9426         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9427
9428 2010-01-08  Ian Lance Taylor  <iant@google.com>
9429
9430         PR 11108
9431         * symtab.h (class Symbol): Remove fields is_target_special_ and
9432         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9433         (Symbol::is_defined_in_discarded_section): New function.
9434         (Symbol::set_is_defined_in_discarded_section): New function.
9435         (Symbol::has_plt_offset): Rewrite.
9436         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9437         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9438         Don't initialize is_target_special_ or has_plt_offset_.
9439         Initialize is_defined_in_discarded_section_.
9440         (Symbol_table::add_from_relobj): If appropriate, set
9441         is_defined_in_discarded_section.
9442         * resolve.cc (Symbol::override_base_with_special): Don't test
9443         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9444         * target-reloc.h (relocate_section): Do special handling for
9445         symbols defined in discarded sections for global symbols as well
9446         as local symbols.
9447
9448 2010-01-08  Ian Lance Taylor  <iant@google.com>
9449
9450         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9451         the SHT_SYMTAB case.
9452
9453 2010-01-08  Ian Lance Taylor  <iant@google.com>
9454
9455         * object.cc (Sized_relobj::do_layout): Don't get confused if
9456         layout_eh_frame returns NULL.
9457
9458 2010-01-08  Ian Lance Taylor  <iant@google.com>
9459
9460         PR 11084
9461         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9462         dynamic symbol table, use the normal symbol table.
9463         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9464         symbol table.
9465
9466 2010-01-08  Ian Lance Taylor  <iant@google.com>
9467
9468         PR 11072
9469         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9470         sections.
9471
9472 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9473
9474         * version.cc (print_version): Change to "Copyright 2010".
9475
9476 2010-01-08  Ian Lance Taylor  <iant@google.com>
9477
9478         PR 10287
9479         PR 11063
9480         * i386.cc (class Target_i386): Change return type of plt_section
9481         to be non-const.
9482         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9483         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9484         tls_desc_rel_ field.
9485         (Output_data_plt_i386::rel_tls_desc): New function.
9486         (Target_i386::rel_tls_desc_section): New function.
9487         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9488         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9489         R_386_TLS_DESC reloc in rel_tls_desc_section.
9490         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9491         Define struct Tlsdesc_info.
9492         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9493         (Target_x86_64::do_reloc_symbol_index): New function.
9494         (Target_x86_64::add_tlsdesc_info): New function.
9495         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9496         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9497         tlsdesc_rel_ field.
9498         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9499         all callers.
9500         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9501         (Target_x86_64::rela_tlsdesc_section): New function.
9502         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9503         handling.
9504         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9505         (Target_x86_64::do_reloc_addend): New function.
9506         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9507         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9508         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9509         (Output_reloc::type): New function.
9510         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9511         (Output_reloc::is_target_specific): New function.
9512         (Output_reloc::target_arg): New function.
9513         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9514         absolute relocs and target specific relocs.
9515         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9516         add_target_specific.
9517         (class Output_data_reloc) [SHT_RELA]: Likewise.
9518         * output.cc (Output_reloc::Output_reloc): Add four new versions
9519         for absolute relocs and target specific relocs.
9520         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9521         (Output_reloc::get_symbol_index): Likewise.
9522         (Output_reloc::local_section_offset): Check that local_sym_index_
9523         is not TARGET_CODE or 0.
9524         (Output_reloc::symbol_value): Likewise.
9525         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9526         reloc.
9527         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9528         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9529         functions.
9530         * layout.cc (add_target_dynamic_tags): Use output section for
9531         DT_PLTRELSZ and DT_JMPREL.
9532
9533 2010-01-07  Ian Lance Taylor  <iant@google.com>
9534
9535         PR 11061
9536         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9537         function.
9538         (class Output_data_reloc_generic): Define.
9539         (class Output_data_reloc_base): Change base class to
9540         Output_data_reloc_generic.  Change add() method to call
9541         bump_relative_reloc_count for a relative reloc.  Remove
9542         sort_relocs_ field.
9543         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9544         to sort_relocs().
9545         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9546         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9547         appropriate.
9548         * layout.h (class Layout): Update declaration.
9549
9550 2010-01-07  Ian Lance Taylor  <iant@google.com>
9551
9552         * output.h (class Output_data): Add const version of
9553         output_section and do_output_section.
9554         (class Output_section_data): Add const version of
9555         do_output_section.
9556         (class Output_section): Likewise.
9557         * layout.cc (Layout::add_target_dynamic_tags): New function.
9558         * layout.h (class Layout): Update declarations.
9559         * arm.cc (Target_arm::do_finalize_sections): Use
9560         add_target_dynamic_tags.
9561         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9562         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9563         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9564         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9565
9566 2010-01-07  Ian Lance Taylor  <iant@google.com>
9567
9568         PR 11042
9569         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9570         object as needed.
9571
9572 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9573             Ian Lance Taylor  <iant@google.com>
9574
9575         PR 11019
9576         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9577         Xindex::read_symtab_xindex.
9578
9579 2010-01-07  Doug Kwan  <dougkwan@google.com>
9580
9581         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9582         (Insn_template::thumb16_bcond_insn): New method declaration.
9583         (Insn_template): Fix spelling.
9584         (Stub::thumb16_special): New method declaration.
9585         (Stub::do_write): Define virtual method which was previously pure
9586         virtual.
9587         (Stub::do_thumb16_special): New method declaration.
9588         (Stub::do_fixed_endian_write): New template member.
9589         (Reloc_stub::do_write): Remove.
9590         (Reloc_stub::do_fixed_endian_write): Remove.
9591         (Cortex_a8_stub): New class definition.
9592         (Stub_factory::make_cortex_a8_stub): New method definition.
9593         (Stub_factory::Stub_factory): Add missing static storage class
9594         qualifier for elf32_arm_stub_a8_veneer_blx.
9595
9596 2010-01-07  Ian Lance Taylor  <iant@google.com>
9597
9598         PR 10980
9599         * options.h (class General_options): Add --warn-unresolved-symbols
9600         and --error-unresolved-symbols.
9601         * errors.cc (Errors::undefined_symbol): Implement
9602         --warn-unresolved-symbols.
9603
9604         * options.h (class General_options): Add -z text and -z textoff.
9605         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9606
9607 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9608
9609         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9610         (Garbage_collection::cident_sections): New function.
9611         (Garbage_collection::add_cident_section): New function.
9612         (Garbage_collection::cident_sections_): New member.
9613         (gc_process_relocs): Add references to sections whose names are C
9614         identifiers.
9615         * gold.h (cident_section_start_prefix): New constant.
9616         (cident_section_stop_prefix): New constant.
9617         (is_cident): New function.
9618         * layout.cc (Layout::define_section_symbols): Replace string constants
9619         with the newly defined constants.
9620         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9621         C identifiers.
9622         * testsuite/Makefile.am: Add gc_orphan_section_test.
9623         * testsuite/Makefile.in: Regenerate.
9624         * testsuite/gc_orphan_section_test.cc: New file.
9625         * testsuite/gc_orphan_section_test.sh: New file.
9626
9627 2010-01-06  Ian Lance Taylor  <iant@google.com>
9628
9629         PR 10980
9630         * options.h (class General_options): Add --warn-shared-textrel.
9631         * layout.cc (Layout::finish_dynamic_section): Implement
9632         --warn-shared-textrel.
9633
9634         PR 10980
9635         * options.h (class General_options): Add --warn-multiple-gp.
9636
9637 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9638
9639         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9640         $(THREADSLIB) and $(LIBDL).
9641         * Makefile.in: Rebuild.
9642
9643 2010-01-06  Ian Lance Taylor  <iant@google.com>
9644
9645         PR 10980
9646         * options.cc (General_options::parse_section_start): New function.
9647         (General_options::section_start): New function.
9648         (General_options::General_options): Initialize all members.
9649         * options.h: Include <map>
9650         (class General_options): Add --section-start.  Add section_starts_
9651         member.
9652         * layout.cc (Layout::attach_allocated_section_to_segment): If
9653         --section-start was used, set the address of the segment.  Remove
9654         local sort_sections.
9655         (Layout::relaxation_loop_body): If the address of the load segment
9656         has been set by --section-start, don't use it.
9657         * output.h (Output_segment::update_flags_for_output_section): New
9658         function.
9659         * output.cc (Output_segment::add_output_section): Call
9660         update_flags_for_output_section.
9661
9662 2010-01-05  Ian Lance Taylor  <iant@google.com>
9663
9664         PR 10980
9665         * options.h (class General_options): Add --undefined-version.
9666         * script.cc (struct Version_expression): Add was_matched_by_symbol
9667         field.
9668         (Version_script_info::matched_symbol): New function.
9669         (Version_script_info::get_symbol_version_helper): Call
9670         matched_symbol.
9671         (Version_script_info::check_unmatched_names): New function.
9672         * script.h (class Version_script_info): Update declarations.
9673         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9674
9675         * options.h (class General_options): Use DEFINE_bool_alias for
9676         allow_multiple_definition.
9677         * resolve.cc (Symbol_table::should_override): Don't test
9678         allow_multiple_definition.
9679
9680         PR 10980
9681         * options.h (class General_options): Add --cref.
9682         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9683         until after printing cref table.
9684         * cref.cc: Include "symtab.h".
9685         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9686         (Cref_table_compare::operator()): New function.
9687         (Cref_inputs::gather_cref): New function.
9688         (filecol): New static const.
9689         (Cref_inputs::print_cref): New function.
9690         (Cref::print_cref): New function.
9691         * cref.h: Include <cstdio>.
9692         (class Cref): Update declarations.
9693         * mapfile.h (Mapfile::file): New function.
9694         * object.h (class Object): Define Symbols.  Declare virtual
9695         do_get_global_symbols.
9696         (Object::get_global_symbols): New function.
9697         * object.cc (Input_objects::add_object): Pass object to cref_ if
9698         --cref.
9699         (Input_objects::archive_start): Likewise.
9700         (Input_objects::archive_stop): Likewise.
9701         (Input_objects::print_cref): New function.
9702         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9703         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9704         --cref.
9705         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9706         function.
9707         * plugin.h (class Sized_pluginobj): Update declarations.
9708
9709 2010-01-05  Ian Lance Taylor  <iant@google.com>
9710
9711         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9712         to is_default_version.  Rename insdef to insdefault.
9713         (Symbol_table::add_from_relobj): Rename def to is_default_version
9714         and local to is_forced_local.
9715         (Symbol_table::add_from_pluginobj): Likewise.
9716         (Symbol_table::add_from_dynobj): Likewise.
9717         (Symbol_table::define_special_symbol): Rename insdef to
9718         insdefault.
9719
9720 2010-01-04  Ian Lance Taylor  <iant@google.com>
9721
9722         PR 10980
9723         * options.h (class General_options): Add
9724         --allow-multiple-definition and -z muldefs.
9725         * resolve.cc (Symbol_table::should_override): Don't warn about a
9726         multiple symbol definition if --allow-multiple-definition or -z
9727         muldefs.
9728
9729         PR 10980
9730         * options.h (class General_options): Add --add-needed and
9731         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9732         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9733         error if --copy-dt-needed-entries aka --add-needed is used and
9734         would cause a change in behaviour.
9735
9736         PR 10980
9737         * options.h (class General_options): Add -G as a short version of
9738         --shared.  Add no-op options -assert, -g, and -i.
9739
9740 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9741
9742         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9743         check for .text or .gnu.linkonce.t sections.
9744         * icf.cc (Icf::find_identical_sections): Ditto.
9745         Change the detection for mangled function name within the section
9746         name.
9747         * icf.h (is_section_foldable_candidate): New function.
9748
9749 2009-12-30  Ian Lance Taylor  <iant@google.com>
9750
9751         PR 10980
9752         * options.h (class General_options): Permit two dashes with
9753         --retain-symbols-file.
9754
9755 2009-12-30  Ian Lance Taylor  <iant@google.com>
9756
9757         PR 10979
9758         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9759         don't put the file header and segment headers in the text
9760         segment.
9761
9762         PR 10979
9763         * common.cc (Sort_commons::operator()): Stabilize sort when both
9764         entries are NULL.
9765         (Symbol_table::do_allocate_commons_list): When allocating common
9766         symbols, skip a symbol which is no longer common.
9767         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9768         an object before checking its type.
9769         * testsuite/common_test_2.c: New file.
9770         * testsuite/common_test_3.c: New file.
9771         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9772         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9773         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9774         (common_test_2_pic.o, common_test_2.so): New targets.
9775         (common_test_3_pic.o, common_test_3.so): New targets.
9776         * testsuite/Makefile.in: Rebuild.
9777
9778         PR 10979
9779         * script.cc (read_input_script): If we see a new SECTIONS clause,
9780         and we have added an input section, give an error.
9781         * layout.h (class Layout): Add have_added_input_section function.
9782         Add have_added_input_section_ field.
9783         * layout.cc (Layout::Layout): Initialize
9784         have_added_input_section_.
9785         (Layout::layout): Set have_added_input_section_.
9786         (Layout::layout_eh_frame): Likewise.
9787
9788 2009-12-30  Ian Lance Taylor  <iant@google.com>
9789
9790         PR 10931
9791         * options.h (class General_options): Add --sort-common option.
9792         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9793         * common.cc (Sort_common): Add sort_order parameter to
9794         constructor.  Add sort_order_ field.
9795         (Sort_commons::operator): Check sort_order_.
9796         (Symbol_table::allocate_commons): Determine the sort order.
9797         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9798         Change all callers.
9799         (Symbol_table::do_allocate_commons_list): Likewise.
9800
9801 2009-12-30  Ian Lance Taylor  <iant@google.com>
9802
9803         PR 10916
9804         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9805         symbols from this object, don't change the visibility of an
9806         undefined symbol.
9807         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9808
9809 2009-12-30  Ian Lance Taylor  <iant@google.com>
9810
9811         PR 10861
9812         * script.h (class Version_script_info): Define Language enum.
9813         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9814         new fields globals_, locals_, and is_finalized_.
9815         * script.cc: Various formatting fixes.
9816         (class Parser_closure): Change language_stack_ from a vector of
9817         std::string to one of Version_script_info::Language.  Adjust all
9818         uses accordingly.
9819         (class Lazy_demangler): Remove.
9820         (struct Version_expression): Change language from std::string to
9821         Version_script_info::Language.
9822         (Version_script_info::Version_script_info): New function.
9823         (Version_script_info::~Version_script_info): Don't call clear.
9824         (Version_script_info::finalize): New function.
9825         (Version_script_info::build_lookup_tables): New function.
9826         (Version_script_info::build_expression_list_lookup): New
9827         function.
9828         (Version_script_info::get_symbol_version_helper): Rewrite to use
9829         lookup tables.
9830         (Version_script_info::print_expression_list): Adjust to use
9831         Version_script_info::Language.
9832         (script_push_lex_into_version_mode): Check that the version script
9833         has not been finalized.
9834         (version_script_push_lang): Change language string to
9835         Version_script_info::Language.
9836         * options.cc (Command_line::version_script): New function.
9837         * options.h (class General_options): Add finalize_dynamic_list
9838         function.  Change version_script from declaration to definition.
9839         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9840         * testsuite/version_script.map: Remove duplicate def of foo.
9841         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9842         version_script.map.
9843         * testsuite/Makefile.in: Rebuild.
9844
9845 2009-12-30  Ian Lance Taylor  <iant@google.com>
9846
9847         PR 10843
9848         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9849         if the input symbol index is 0, make the output symbol index 0.
9850
9851 2009-12-30  Ian Lance Taylor  <iant@google.com>
9852
9853         PR 10670
9854         * options.h (class General_options): Add -x/--discard-all.
9855         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9856         --discard-all.  If the local symbol needs a dynamic entry, check
9857         that before handling --discard-locals.
9858
9859 2009-12-30  Ian Lance Taylor  <iant@google.com>
9860
9861         PR 10450
9862         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9863         flags to PF_R.
9864         (Output_segment::add_output_section): Don't change the flags if
9865         the type is PT_TLS.
9866
9867         PR 10450
9868         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9869         GNU hash table if they need a dynamic value.  Otherwise, don't add
9870         them if they are defined in a dynamic object or are forced local.
9871
9872 2009-12-29  Ian Lance Taylor  <iant@google.com>
9873
9874         PR 10450
9875         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9876         .gnu.hash table for a 32-bit target.
9877
9878         PR 10450
9879         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9880         regular and a dynamic object only needs a dynamic symbol table
9881         entry if it is externally visible.
9882
9883         PR 10450
9884         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9885         constructor.  Add global_offset_table_ field.
9886         (Target_i386::got_section): Set global_offset_table_.
9887         (Target_i386::do_finalize_sections): Set global_offset_table_
9888         size.
9889         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9890         in constructor.  Add global_offset_table_ field.
9891         (Target_x86_64::got_section): Set global_offset_table_.
9892         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9893         size.
9894
9895         * layout.cc (Layout::Layout): Initialize increase_relro_.
9896         (Layout::get_output_section): Add is_relro, is_last_relro, and
9897         is_first_non_relro parameters.  Change all callers.
9898         (Layout::choose_output_section): Likewise.
9899         (Layout::add_output_section_data): Likewise.
9900         (Layout::make_output_section): Likewise.
9901         (Layout::set_segment_offsets): Clear increase_relro when using a
9902         linker script.
9903         * layout.h (class Layout): Add increase_relro method.  Add
9904         increase_relro_ field.  Update declarations.
9905         * output.cc (Output_section::Output_section): Initialize
9906         is_last_relro_ and is_first_non_relro_.
9907         (Output_segment::add_output_section): Group relro sections is
9908         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9909         (Output_segment::maximum_alignment): Remove relro handling.
9910         (Output_segment::set_section_addresses): Add increase_relro
9911         parameter.  Change all callers.  Add initial alignment to align
9912         relro sections on separate page.  Remove old relro handling.
9913         (Output_segment::set_section_list_addresses): Remove in_relro
9914         parameter.  Change all callers.
9915         (Output_segment::set_offset): Add increase parameter.  Change all
9916         callers.  Remove old relro handling.
9917         * output.h (class Output_section): Add new methods: is_last_relro,
9918         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9919         Add is_last_relro_ and is_first_non_relro_ fields.
9920         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9921         Create separate .got.plt section.  Call increase_relro.
9922         * x86_64.cc (Target_x86_64::got_section): Likewise.
9923         * testsuite/relro_script_test.t: Add .got.plt.
9924
9925         PR 10450
9926         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9927         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9928         (Layout::finalize): Call set_dynamic_symbol_size.
9929         (Layout::set_dynamic_symbol_size): New function.
9930         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9931         set_dynamic_symbol_size.
9932
9933         PR 10450
9934         * output.h (class Output_section): Add is_entsize_zero_ field.
9935         * output.cc (Output_section::Output_section): Initialize
9936         is_entsize_zero_.
9937         (Output_section::set_entsize): If two different entsizes are
9938         requested, force it to zero.
9939         (Output_section::add_input_section): Set flags for .debug_str
9940         before updating section flags.  Set entsize.
9941         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9942         and SHF_STRING if all input sections have those flags.
9943
9944 2009-12-29   Rafael Espindola  <espindola@google.com>
9945
9946         * main.cc (main): Fix the sys time reporting.
9947         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9948         reporting.
9949
9950 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9951
9952         * options.cc (General_options::parse_version): Allow -v to exit
9953         without an error if there is nothing to link.
9954
9955 2009-12-29  Ian Lance Taylor  <iant@google.com>
9956
9957         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9958         using a version of gcc before 4.1.
9959         * configure: Rebuild.
9960
9961 2009-12-28  Chris Demetriou  <cgd@google.com>
9962
9963         * attributes.cc (Output_attributes_section_data::do_write): Use
9964         std::vector::front rather than std::vector::data.
9965
9966 2009-12-28  Ian Lance Taylor  <iant@google.com>
9967
9968         * symtab.h (class Symbol_table): Add enum Defined.
9969         * resolve.cc (Symbol_table::should_override): Add defined
9970         parameter.  Change all callers.  Test whether object is NULL
9971         before calling a method on it.
9972         (Symbol_table::report_resolve_problem): Add defined parameter.
9973         Change all callers.
9974         (Symbol_table::should_override_with_special): Likewise.
9975         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9976         parameter.  Change all callers.
9977         (Symbol_table::do_define_in_output_data): Likewise.
9978         (Symbol_table::define_in_output_segment): Likewise.
9979         (Symbol_table::do_define_in_output_segment): Likewise.
9980         (Symbol_table::define_as_constant): Likewise.
9981         (Symbol_table::do_define_as_constant): Likewise.
9982         * script.h (class Symbol_assignment): Add is_defsym parameter to
9983         constructor; change all callers.
9984         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9985         parameter.  Change all callers.  Add is_defsym_ field.
9986         (class Parser_closure): Add parsing_defsym parameter to
9987         constructor; change all callers.  Add parsing_defsym accessor
9988         function.  Add parsing_defsym_ field.
9989
9990 2009-12-28  Ian Lance Taylor  <iant@google.com>
9991
9992         * gold.cc (queue_middle_tasks): Fix formatting.
9993         * object.cc (Relobj::is_section_name_included): Likewise.
9994
9995 2009-12-23  Ian Lance Taylor  <iant@google.com>
9996
9997         * i386.cc (Target_i386::do_calls_non_split): Recognize
9998         -fsplit-stack prologue for a function with a static chain.
9999         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10000         -fsplit-stack prologue when using %r11.
10001
10002 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10003
10004         * options.cc (General_options::parse_version): Make -v continue and do
10005         the link like GNU ld does.
10006
10007 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10008
10009         * Makefile.am (CCFILES): Add timer.cc.
10010         (HFILES): Add timer.h.
10011         * configure.ac: Check for sysconf and times.
10012         * main.cc: include timer.h.
10013         (main): Use Timer instead of get_run_time.
10014         * timer.cc: New.
10015         * timer.h: New.
10016         * workqueue.cc: include timer.h.
10017         (Workqueue::find_and_run_task):
10018         Report user, sys and wall time.
10019         * Makefile.in: Regenerate.
10020         * config.in: Regenerate.
10021         * configure: Regenerate.
10022
10023 2009-12-16  Doug Kwan  <dougkwan@google.com>
10024
10025         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10026         sections.
10027         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10028         relaxed input sections.
10029         * output.cc (Output_section::find_relaxed_input_section): Change
10030         return type to Output_relaxed_input_section pointer.  Adjust code
10031         for new type of relaxed_input_section_map_.
10032         * output.h (Output_section::find_relaxed_input_section): Change
10033         return type to Output_relaxed_input_section pointer.
10034         (Output_section::Output_relaxed_input_section_by_input_section_map):
10035         New type.
10036         (Output_section::relaxed_input_section_map_): Change type to
10037         Output_section::Output_relaxed_input_section_by_input_section_map.
10038         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10039         input section.
10040
10041 2009-12-15  Ian Lance Taylor  <iant@google.com>
10042
10043         * layout.cc (Layout::create_shstrtab): Only write out after input
10044         sections if we are compressing debug sections.
10045
10046 2009-12-15  Ian Lance Taylor  <iant@google.com>
10047
10048         * archive.cc (Archive::add_symbols): Only look up a symbol without
10049         a version if there is, in fact, a version.
10050
10051 2009-12-14  Ian Lance Taylor  <iant@google.com>
10052
10053         Revert -Wshadow changes, all changes from:
10054         2009-12-11  Doug Kwan  <dougkwan@google.com>
10055         2009-12-11  Nick Clifton  <nickc@redhat.com>
10056         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10057
10058 2009-12-11  Doug Kwan  <dougkwan@google.com>
10059
10060         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10061         due to -Wshadow.
10062         * attributes.cc (Object_attribute::size): Ditto.
10063         (Attributes_section_data::size): Ditto.
10064         (Attributes_section_data::Attributes_section_data): Ditto.
10065         (Output_attributes_section_data::do_write): Ditto.
10066         * attributes.h (Object_attribute::set_type): Ditto.
10067         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10068
10069 2009-12-11  Nick Clifton  <nickc@redhat.com>
10070
10071         * archive.cc: Fix shadowed variable warnings.
10072         * arm.cc: Likewise.
10073         * compressed_output.cc: Likewise.
10074         * compressed_output.h: Likewise.
10075         * configure: Likewise.
10076         * dwarf_reader.cc: Likewise.
10077         * dynobj.cc: Likewise.
10078         * dynobj.h: Likewise.
10079         * ehframe.cc: Likewise.
10080         * ehframe.h: Likewise.
10081         * errors.cc: Likewise.
10082         * expression.cc: Likewise.
10083         * fileread.cc: Likewise.
10084         * fileread.h: Likewise.
10085         * freebsd.h: Likewise.
10086         * i386.cc: Likewise.
10087         * icf.cc: Likewise.
10088         * incremental.h: Likewise.
10089         * layout.cc: Likewise.
10090         * layout.h: Likewise.
10091         * mapfile.cc: Likewise.
10092         * merge.cc: Likewise.
10093         * merge.h: Likewise.
10094         * object.cc: Likewise.
10095         * object.h: Likewise.
10096         * options.h: Likewise.
10097         * output.cc: Likewise.
10098         * output.h: Likewise.
10099         * parameters.cc: Likewise.
10100         * plugin.cc: Likewise.
10101         * powerpc.cc: Likewise.
10102         * reduced_debug_output.cc: Likewise.
10103         * reduced_debug_output.h: Likewise.
10104         * reloc.cc: Likewise.
10105         * reloc.h: Likewise.
10106         * resolve.cc: Likewise.
10107         * script-sections.cc: Likewise.
10108         * script.cc: Likewise.
10109         * script.h: Likewise.
10110         * sparc.cc: Likewise.
10111         * symtab.cc: Likewise.
10112         * symtab.h: Likewise.
10113         * target-select.cc: Likewise.
10114         * target-select.h: Likewise.
10115         * token.h: Likewise.
10116         * workqueue.cc: Likewise.
10117         * workqueue.h: Likewise.
10118         * x86_64.cc: Likewise.
10119
10120 2009-12-10  Doug Kwan  <dougkwan@google.com>
10121
10122         * arm.cc (attributes.h): New include.
10123         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10124         (Arm_relobj::~Arm_relobj): Delete object pointed by
10125         attributes_section_data_.
10126         (Arm_relobj::attributes_section_data): New method definition.
10127         (Arm_relobj::attributes_section_data_): New data member declaration.
10128         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10129         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10130         attributes_section_data_.
10131         (Arm_dynobj::attributes_section_data): New method definition.
10132         (Arm_dynobj::attributes_section_data_): New data member declaration.
10133         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10134         initialization value of may_use_blx_ to false.
10135         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10136         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10137         object attributes to compute results instead of hard-coding.
10138         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10139         Target_arm::get_secondary_compatible_arch,
10140         Target_arm::set_secondary_compatible_arch
10141         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10142         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10143         New method declarations.
10144         (Target_arm::get_aeabi_object_attribute): New method definition.
10145         (Target_arm::attributes_section_data_): New data member declaration.
10146         (read_arm_attributes_section): New template definition.
10147         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10148         (Arm_dynobj::do_read_symbols): Ditto.
10149         (Target_arm::do_finalize_sections): Merge attributes sections from
10150         input.  Check for BLX use after attributes section merging.
10151         Fix __exidx_start and __exidx_end visibility.  Create an
10152         .ARM.attributes section if necessary.
10153         (Target_arm::get_secondary_compatible_arch,
10154         Target_arm::set_secondary_compatible_arch,
10155         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10156         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10157         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10158         New method definitions.
10159
10160 2009-12-09  Ian Lance Taylor  <iant@google.com>
10161
10162         * plugin.cc (Plugin::load): Don't cast from void* to a function
10163         pointer.
10164
10165 2009-12-09  Ian Lance Taylor  <iant@google.com>
10166
10167         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10168         information fields.
10169
10170 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10171
10172         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10173         Replace two_file_shared_1.so with two_file_shared_2.so.
10174         * testsuite/Makefile.in: Regenerated.
10175
10176 2009-12-08  Doug Kwan  <dougkwan@google.com>
10177
10178         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10179         (HFILES): Add attributes.h and int_encoding.h.
10180         * Makefile.in: Regenerate.
10181         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10182         function definitions to int_encoding.cc
10183         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10184         prototypes to int_encoding.h
10185         * reduced_debug_output.cc (int_encoding.h): New include.
10186         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10187         function definitions to int_encoding.cc
10188         (insert_into_vector, read_from_pointer): Move template definitions to
10189         int_encoding.h
10190         * attributes.cc: New file.
10191         * attributes.h: New file.
10192         * int_encoding.cc: New file.
10193         * int_encoding.h: New file.
10194
10195 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10196
10197         PR gold/11055
10198         * incremental-dump.cc (dump_incremental_inputs): New.
10199         (main): Use dump_incremental_inputs.
10200
10201 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10202
10203         PR gold/10893
10204         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10205         checking elfcpp::STT_FUNC.
10206         (Target_i386::Relocate::relocate): Likewise.
10207         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10208
10209         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10210         symbols from shared libraries into normal FUNC symbols.
10211
10212         * symtab.h (Symbol): Add is_func and use it.
10213
10214 2009-12-05  Doug Kwan  <dougkwan@google.com>
10215
10216         * arm.cc (Target_arm::arm_info): Initialize new fields
10217         attributes_section and attributes_vendor.
10218         * i386.cc (Target_i386::i386_info): Same.
10219         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10220         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10221         fields attributes_section and attributes_vendor.
10222         * sparc.cc (Target_sparc::sparc_info): Same.
10223         * target.h (Target::attributes_section, Target::attributes_vendor,
10224         Target::is_attributes_section, Target::attribute_arg_type,
10225         Target::attributes_order): New method definitions.
10226         (Target::Target_info::attributes_section,
10227         Target::Target_info::attributes_vendor): New fields.
10228         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10229         virtual method definitions.
10230         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10231         attributes_section and attributes_vendor.
10232         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10233
10234 2009-12-05  Doug Kwan  <dougkwan@google.com>
10235
10236         * arm.cc: Update comments about interworking and stub generation.
10237         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10238         considered as non-PIC.
10239         (Arm_relocate_functions::base_abs): Fix formatting.
10240         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10241         of function to use GOT entry address instead of offset.
10242         (Target_arm::Scan::global): Issue an error if a symbol would need a
10243         PLT does not get one because it is untyped.  Remove code to create
10244         dynamic symbols for relative branches.
10245         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10246         takes unsigned integer instead of boolean.
10247
10248 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10249
10250         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10251         (two_file_test_LDADD): Likewise.
10252         (common_test_1_LDADD): Likewise.
10253         (exception_test_LDADD) Likewise.
10254         (weak_test_LDADD): Likewise.
10255         (many_sections_test_LDADD): Likewise.
10256         (initpri1_LDADD): Likewise.
10257         (script_test_1_LDADD): Likewise.
10258         (script_test_2_LDADD): Likewise.
10259         (justsyms_LDADD): Likewise.
10260         (binary_test_LDADD): Likewise.
10261         (large_LDADD): Likewise.
10262         * testsuite/Makefile.in: Regenerated.
10263
10264 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10265
10266         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10267         (Symbol_table::override_with_special): Likewise.
10268         (Symbol_table::add_from_object): Likewise.
10269
10270 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10271
10272         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10273         Don't set the data_offset twice.
10274
10275 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10276
10277         * testsuite/Makefile.in: Regenerate.
10278
10279 2009-12-03  Doug Kwan  <dougkwan@google.com>
10280
10281         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10282         (Target_arm::do_finalize_sections): Add parameter for symbol table
10283         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10284         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10285         parameter for symbol table pointer.
10286         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10287         an additional parameter for a pointer to symbol table.
10288         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10289         parameter for a symbol table pointer.
10290         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10291         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10292         Ditto.
10293         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10294         parameter for a symbol table pointer.
10295
10296 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10297
10298         * incremental.cc (Incremental_inputs_header)
10299         (Incremental_inputs_header_write, Incremental_inputs_entry)
10300         (Incremental_inputs_entry_write): Move ...
10301         * incremental.h (Incremental_inputs_header)
10302         (Incremental_inputs_header_write, Incremental_inputs_entry)
10303         (Incremental_inputs_entry_write): here.
10304
10305 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10306
10307         * incremental.cc (make_sized_incremental_binary): Set the target.
10308         Error if it is incompatible.
10309         * output.h (Output_file): Add filename method.
10310
10311 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10312
10313         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10314         from the get_* methods.
10315
10316 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10317
10318         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10319         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10320         Write 0 for the data_offset of scripts.
10321
10322 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10323
10324         * testsuite/Makefile.am: Add the incremental_test.sh test.
10325         * testsuite/incremental_test.sh: New.
10326         * testsuite/incremental_test_1.c: New.
10327         * testsuite/incremental_test_2.c: New.
10328
10329 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10330
10331         * incremental-dump.cc (main): Fix typos.
10332
10333 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10334
10335         PR gold/11025
10336         * incremental-dump.cc (main): Use llu to print 64 bit values.
10337
10338 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10339             H.J. Lu  <hongjiu.lu@intel.com>
10340
10341         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10342         $(LIBDL).
10343         (incremental_dump_LDADD): Likewise.
10344         * Makefile.in: Regenerated.
10345
10346 2009-11-25  Doug Kwan  <dougkwan@google.com>
10347
10348         Revert:
10349
10350         2009-11-25  Doug Kwan  <dougkwan@google.com>
10351
10352                 * arm.cc (Target_arm::Target_arm): Move method definition
10353                 outside of class definition.  Add code to handle
10354                 --target1-rel, --target1-abs and --target2= options.
10355                 (Target_arm::get_reloc_reloc_type): Change method to be
10356                 non-static and const.
10357                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10358                 New data member declaration.
10359                 (Target_arm::Scan::local, Target_arm::Scan::global,
10360                 Target_arm::Relocate::relocate,
10361                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10362                 Adjust call to Target_arm::get_real_reloc_type.
10363                 (Target_arm::get_real_reloc_type): Use command line options
10364                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10365                 * options.h (--target1-rel, --target1-abs, --target2): New
10366                 ARM-only options.
10367
10368 2009-11-25  Doug Kwan  <dougkwan@google.com>
10369
10370         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10371         class definition.  Add code to handle --target1-rel, --target1-abs
10372         and --target2= options.
10373         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10374         and const.
10375         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10376         member declaration.
10377         (Target_arm::Scan::local, Target_arm::Scan::global,
10378         Target_arm::Relocate::relocate,
10379         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10380         call to Target_arm::get_real_reloc_type.
10381         (Target_arm::get_real_reloc_type): Use command line options to
10382         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10383         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10384         options.
10385
10386 2009-11-25  Doug Kwan  <dougkwan@google.com>
10387
10388         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10389         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10390         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10391         formatting.
10392         (Arm_relocate_functions::thm_call): Replace body with a call to
10393         Arm_relocate_functions::thumb_branch_common.
10394         (Arm_relocate_functions::thm_jump24,
10395         Arm_relocate_functions::thm_xpc22): New method definitions.
10396         (Arm_relocate_functions::thumb_branch_common): New method definition.
10397         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10398         operator.
10399         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10400         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10401
10402 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10403
10404         * Makefile.am: Build incremental-dump
10405         * Makefile.in: Regenerate.
10406         * incremental-dump.cc: New.
10407         * incremental.cc (Incremental_inputs_header_data,
10408         Incremental_inputs_entry_data): Move to incremental.h
10409         * incremental.h: (Incremental_inputs_header_data,
10410         Incremental_inputs_entry_data): Move from incremental.cc
10411
10412 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10413
10414         * incremental.cc (Incremental_inputs_header,
10415         Incremental_inputs_header_write, Incremental_inputs_entry,
10416         Incremental_inputs_entry_write): Add a typedef with the data type.
10417
10418 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10419
10420         * incremental.cc (Incremental_inputs_header,
10421         Incremental_inputs_header_write, Incremental_inputs_entry,
10422         Incremental_inputs_entry_write): Update comment about which
10423         type has the filed descriptions.
10424
10425 2009-11-15  Doug Kwan  <dougkwan@google.com>
10426
10427         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10428         (Arm_relocate_functions::arm_branch_common): Change method defintion
10429         in class definition to a method declaration and update list of formal
10430         parameters.
10431         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10432         Arm_relocation_functions::jump24): Adjust call to
10433         Arm_relocate_functions::arm_branch_common.  Update list of formal
10434         parameters.
10435         (Arm_relocate_functions::xpc25): New method definition.
10436         (Arm_relocate_functions::arm_branch_common): Move method defintion
10437         out from class definition.  Use stubs for mode-switching and extending
10438         branch ranges.
10439         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10440         specially.  Change code to enable use of stubs in ARM branches.
10441
10442 2009-11-10  Doug Kwan  <dougkwan@google.com>
10443
10444         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10445         in method declaration.
10446         (Target_arm::relocate_stub): New method declaration.
10447         (Target_arm::default_target): Change to return a pointer instead of
10448         a const reference.
10449         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10450         Target_arm::default_target.
10451         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10452         method definition.
10453         (Target_arm::relocate_section): Adjust view.
10454         (Target_arm::relocate_stub): New method definition.
10455
10456 2009-11-10  Doug Kwan  <dougkwan@google.com>
10457
10458         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10459         a format warning.
10460         * incremental.cc (open_incremental_binary): Initialized local
10461         variables to avoid warnings.
10462         * object.cc (make_elf_object): Ditto.
10463         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10464         a format warning.
10465
10466 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10467
10468         PR gold/10930
10469         * testsuite/plugin_test.c: Include "config.h".
10470
10471 2009-11-09  Doug Kwan  <dougkwan@google.com>
10472
10473         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10474         (arm_symbol_value): Remove.
10475         (Arm_relocate_functions::arm_branch_common,
10476         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10477         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10478         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10479         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10480         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10481         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10482         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10483         Arm_relocate_functions::thm_mobw_abs_nc,
10484         Arm_relocate_functions::thm_mov_abs,
10485         Arm_relocate_functions::movw_prel_nc,
10486         Arm_relocate_functions::thm_movt_abs,
10487         Arm_relocate_functions::movt_prel,
10488         Arm_relocate_functions::thm_movw_prel_nc,
10489         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10490         (Target_arm::Relocate::relocate): Only decompose address into two
10491         parts if relocation type uses the thumb-bit and pass the actual
10492         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10493         calls to methods in Arm_relocate_functions for this change.
10494
10495 2009-11-08  Ian Lance Taylor  <iant@google.com>
10496
10497         PR 10925
10498         * reloc.cc: Instantiate
10499         Sized_relobj::initialize_input_to_output_maps and
10500         Sized_relobj:free_input_to_output_maps.
10501
10502 2009-11-06  Ian Lance Taylor  <iant@google.com>
10503
10504         PR 10876
10505         * defstd.cc (in_segment): Set only_if_ref true for "end".
10506
10507 2009-11-06  Doug Kwan  <dougkwan@google.com>
10508
10509         * arm.cc (class Reloc_stub): Correct a comment.
10510         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10511         (Target_arm::scan_section_for_stubs): New method declaration.
10512         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10513         Change methods from private to protected.
10514         (Target_arm::do_may_relax): New method definition.
10515         (Target_arm::do_relax, Target_arm::group_sections,
10516         Target_arm::scan_reloc_for_stub,
10517         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10518         (Target_arm::arm_input_section_map_): New data member declaration.
10519         (Target_arm::scan_reloc_for_stub,
10520         Target_arm::scan_reloc_section_for_stubs,
10521         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10522         Target_arm::do_relax): New method definitions.
10523
10524 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10525
10526         * configure.ac: Check for (struct stat)::st_mtim
10527         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10528         * config.in: Regenerate.
10529         * configure: Regenerate.
10530
10531 2009-11-05  Ian Lance Taylor  <iant@google.com>
10532
10533         PR 10910
10534         * output.cc (Output_segment::add_output_section): Add missing
10535         return statement.
10536
10537 2009-11-04  Ian Lance Taylor  <iant@google.com>
10538
10539         PR 10880
10540         * object.h (class Object): Add is_needed and set_is_needed
10541         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10542         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10543         defined in a dynamic object and referenced by a regular object,
10544         set is_needed for the dynamic object.
10545         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10546         if the file is marked with as_needed and it is not needed.
10547
10548 2009-11-04  Ian Lance Taylor  <iant@google.com>
10549
10550         PR 10887
10551         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10552         tags if data is discarded by linker script.
10553         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10554         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10555         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10556         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10557
10558 2009-11-04  Ian Lance Taylor  <iant@google.com>
10559
10560         * layout.cc (Layout::get_output_section): Add is_interp and
10561         is_dynamic_linker_section parameters.  Change all callers.
10562         (Layout::choose_output_section): Likewise.
10563         (Layout::make_output_section): Likewise.
10564         (Layout::add_output_section_data): Add is_dynamic_linker_section
10565         parameter.  Change all callers.
10566         * layout.h (class Layout): Update declarations.
10567         * output.h (class Output_section): Add is_interp, set_is_interp,
10568         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10569         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10570         generate_code_fills_at_write_ to a bitfield.
10571         * output.cc (Output_section::Output_sections): Initialize new
10572         fields.
10573         (Output_segment::add_output_section): Add do_sort parameter.
10574         Change all callers.
10575
10576 2009-11-03  Ian Lance Taylor  <iant@google.com>
10577
10578         PR 10860
10579         * options.h (class General_options): Add --warn-common.
10580         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10581         merging two common symbols.
10582         (Symbol_table::should_override): Handle --warn-common when merging
10583         a common symbol with a defined symbol.  Use report_resolve_problem
10584         for multiple definitions.
10585         (Symbol_table::report_resolve_problem): New function.
10586         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10587
10588 2009-11-03  Doug Kwan  <dougkwan@google.com>
10589
10590         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10591         stub_factory_.
10592         (Target_arm::stub_factory): New method definition.
10593         (Target_arm::new_arm_input_section,
10594         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10595         Target_arm::reloc_uses_thumb_bit): New method declarations.
10596         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10597         New type definitions.
10598         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10599         member declarations.
10600         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10601         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10602         New method definitions.
10603
10604 2009-11-03  Ian Lance Taylor  <iant@google.com>
10605
10606         * options.h (class General_options): Add --warn_constructors.
10607
10608 2009-11-03  Ian Lance Taylor  <iant@google.com>
10609
10610         PR 10893
10611         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10612         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10613
10614 2009-11-03  Ian Lance Taylor  <iant@google.com>
10615
10616         PR 10895
10617         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10618         --msgid-bugs-address.
10619         (install-pdf): New target.
10620         (install-data_yes): Look up one directory to find mkinstalldirs.
10621
10622 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10623
10624         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10625         tree.
10626
10627 2009-10-30  Doug Kwan  <dougkwan@google.com>
10628
10629         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10630
10631 2009-10-30  Doug Kwan  <dougkwan@google.com>
10632
10633         * arm.cc (Stub_addend_reader): New struct template definition
10634         and partial specializations.
10635         (Stub_addend_reader::operator()): New method definition for a
10636         partially specialized template.
10637
10638 2009-10-30  Doug Kwan  <dougkwan@google.com>
10639
10640         * arm.cc (Arm_relobj::processor_specific_flags): New method
10641         definition.
10642         (Arm_relobj::do_read_symbols): New method declaration.
10643         (Arm_relobj::processor_specific_flags_): New data member declaration.
10644         (Arm_dynobj): New class definition.
10645         (Target_arm::do_finalize_sections): Add input_objects parameter.
10646         (Target_arm::do_adjust_elf_header): New method declaration.
10647         (Target_arm::are_eabi_versions_compatible,
10648         (Target_arm::merge_processor_specific_flags): New method declaration.
10649         (Target_arm::do_make_elf_object): New overloaded method definitions
10650         and declaration.
10651         (Arm_relobj::do_read_symbols): New method definition.
10652         (Arm_dynobj::do_read_symbols): Ditto.
10653         (Target_arm::do_finalize_sections): Add input_objects parameters.
10654         Merge processor-specific flags from all input objects.
10655         (Target_arm::are_eabi_versions_compatible,
10656         Target_arm::merge_processor_specific_flags,
10657         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10658         New method definitions.
10659         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10660         Input_objects pointer type parameter.
10661         * layout.cc (Layout::finalize): Pass input objects to target's.
10662         finalize_sections function.
10663         * output.cc (Output_file_header::do_sized_write): Set ELF file
10664         header's processor-specific flags.
10665         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10666         Input_objects pointer type parameter.
10667         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10668         * target.h (Input_objects): New forward class declaration.
10669         (Target::processor_specific_flags,
10670         Target::are_processor_specific_flags_sect): New method definitions.
10671         (Target::finalize_sections): Add input_objects parameter.
10672         (Target::Target): Initialize processor_specific_flags_ and
10673         are_processor_specific_flags_set_.
10674         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10675         parameter.
10676         (Target::set_processor_specific_flags): New method definition.
10677         (Target::processor_specific_flags_,
10678         Target::are_processor_specific_flags_set_): New data member
10679         declarations.
10680         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10681         Input_objects pointer type parameter.
10682
10683 2009-10-30  Doug Kwan  <dougkwan@google.com>
10684
10685         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10686
10687 2009-10-28  Ian Lance Taylor  <iant@google.com>
10688
10689         * object.h (class Relobj): Drop options parameter from
10690         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10691         do_scan_relocs, do_relocate.  Change all callers.
10692         (class Sized_relobj): Drop options parameters from
10693         do_gc_process_relocs, do_scan_relocs, do_relocate,
10694         do_relocate_sections, relocate_sections, emit_relocs_scan,
10695         emit_relocs_scan_reltype.  Change all callers.
10696         (struct Relocate_info): Remove options field and all references to
10697         it.
10698         * reloc.h (class Read_relocs): Remove options constructor
10699         parameter and options_ field.  Change all callers.
10700         (class Gc_process_relocs, class Scan_relocs): Likewise.
10701         (class Relocate_task): Likewise.
10702         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10703         all callers.
10704         (scan_relocatable_relocs): Likewise.
10705         * target.h (class Sized_target): Remove options parameter from
10706         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10707         all callers.
10708         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10709         callers.
10710         * arm.cc: Update functions to remove options parameters.
10711         * i386.cc: Likewise.
10712         * powerpc.cc: Likewise.
10713         * sparc.cc: Likewise.
10714         * x86_64.cc: Likewise.
10715         * testsuite/testfile.cc: Likewise.
10716
10717 2009-10-28  Doug Kwan  <dougkwan@google.com>
10718
10719         * arm.cc (Arm_relobj): New class definition.
10720         (Arm_relobj::scan_sections_for_stubs,
10721         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10722         New method definitions.
10723
10724 2009-10-28  Cary Coutant  <ccoutant@google.com>
10725
10726         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10727         (Plugin::cleanup_done_): New member.
10728         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10729         (Plugin_manager::cleanup_done_): Remove.
10730         (Plugin_manager::add_input_file): Edit error message.
10731         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10732         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10733
10734 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10735
10736         * fileread.cc: (File_read::View::~View): Use the new
10737         data_ownership_ filed.
10738         (File_read::~File_read): Dispose the new whole_file_view_.
10739         (File_read::open): Mmap the whole file if needed.
10740         (File_read::open): Use whole_file_view_ instead of contents_.
10741         (File_read::find_view): Use whole_file_view_ if applicable.
10742         (File_read::do_read): Use whole_file_view_ instead of contents_.
10743         (File_read::make_view): Use whole_file_view_ instead of contents_,
10744         update File_read::View::View call.
10745         (File_read::find_or_make_view): Update File_read::View::View
10746         call.
10747         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10748         remove contents_
10749         (File_read::View::Data_ownership): New enum.
10750         (File_read::View::View): Replace bool mapped_ with Data_ownership
10751         argument.
10752         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10753         (File_read::View::data_ownership_): New field.
10754         (File_read::contents_): Remove (replaced by whole_file_view_).
10755         (File_read::whole_file_view_): New field.
10756         * options.h (class General_options): Add --keep-files-mapped.
10757
10758 2009-10-27  Cary Coutant  <ccoutant@google.com>
10759
10760         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10761         * testsuite/Makefile.am (plugin_test_5): New test case.
10762         * testsuite/Makefile.in: Regenerate.
10763
10764 2009-10-25  Doug Kwan  <dougkwan@google.com>
10765
10766         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10767         from private to protected to allow access by child class.
10768         (Sized_relobj::do_relocate_sections): New method declaration.
10769         (Sized_relobj::relocate_sections): Virtualize.
10770         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10771         Sized_relobj::relocate_sections.  Instantiate template explicitly
10772         for different target sizes and endianity.
10773
10774 2009-10-24  Doug Kwan  <dougkwan@google.com>
10775
10776         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10777         (Arm_input_section::as_arm_input_section): New method.
10778         (Arm_output_section): New class definition.
10779         (Arm_output_section::create_stub_group,
10780         Arm_output_section::group_sections): New method definitions.
10781
10782 2009-10-22  Doug Kwan  <dougkwan@google.com>
10783
10784         * arm.cc (Arm_input_section): New class definition.
10785         (Arm_input_section::init, Arm_input_section:do_write,
10786         Arm_input_section::set_final_data_size,
10787         Arm_input_section::do_reset_address_and_file_offset): New method
10788         definitions.
10789
10790 2009-10-21  Doug Kwan  <dougkwan@google.com>
10791
10792         * arm.cc (Stub_table, Arm_input_section): New forward class
10793         declarations.
10794         (Stub_table): New class defintion.
10795         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10796         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10797         New method definition.
10798
10799 2009-10-21  Doug Kwan  <dougkwan@google.com>
10800
10801         * arm.cc: Update copyright comments.
10802         (Target_arm): New forward class template declaration.
10803         (Arm_address): New type.
10804         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10805         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10806         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10807         constants.
10808         (Insn_template): Same.
10809         (DEF_STUBS): New macro.
10810         (Stub_type): New enum type.
10811         (Stub_template): New class definition.
10812         (Stub): Same.
10813         (Reloc_stub): Same.
10814         (Stub_factory): Same.
10815         (Target_arm::Target_arm): Initialize may_use_blx_ and
10816         should_force_pic_veneer_.
10817         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10818         Target_arm::should_force_pic_veneer,
10819         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10820         Target_arm::using_thumb_only, Target_arm:;default_target): New
10821         method defintions.
10822         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10823         New data member declarations.
10824         (Insn_template::size, Insn_template::alignment): New method defintions.
10825         (Stub_template::Stub_template): New method definition.
10826         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10827         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10828         (Stub_factory::Stub_factory): New method definition.
10829         * gold.h (string_hash): New template.
10830         * output.h (Input_section_specifier::hash_value): Use
10831         gold::string_hash.
10832         (Input_section_specifier::string_hash): Remove.
10833         * stringpool.cc (Stringpool_template::string_hash): Use
10834         gold::string_hash.
10835
10836 2009-10-20  Doug Kwan  <dougkwan@google.com>
10837
10838         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10839         symbols of relaxed input sections.
10840         * output.h (Output_section::find_relaxed_input_section): Make
10841         method public.
10842
10843 2009-10-16  Doug Kwan  <dougkwan@google.com>
10844
10845         * dynobj.cc (Versions::Versions): Initialize version_script_.
10846         Only insert base version symbol definition for a shared object
10847         if version script defines any version versions.
10848         (Versions::define_base_version): New method definition.
10849         (Versions::add_def): Check that base version is not needed.
10850         (Versions::add_need): Define base version lazily.
10851         * dynobj.h (Versions::define_base_version): New method declaration.
10852         (Versions::needs_base_version_): New data member declaration.
10853         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10854         (check_DATA): Add no_version_test.stdout.
10855         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10856         New make rules.
10857         * testsuite/Makefile.in: Regenerate.
10858         * testsuite/no_version_test.c: New file.
10859         * testsuite/no_version_test.sh: Ditto.
10860
10861 2009-10-16  Doug Kwan  <dougkwan@google.com>
10862
10863         * expression.cc (class Segment_start_expression): New class definition.
10864         (Segment_start_expression::value): New method definition.
10865         (script_exp_function_segment_start): Return a new
10866         Segment_start_expression.
10867         * gold/script-c.h (script_saw_segment_start_expression): New function
10868         prototype.
10869         * script-sections.cc (Script_sections::Script_sections): Initialize
10870         SAW_SEGMENT_START_EXPRESSION_ to false.
10871         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10872         and -Tbbs options to specify section addresses if given in
10873         command line and no SEGMENT_START expression is seen in a script.
10874         * script-sections.h (Script_sections::saw_segment_start_expression,
10875         Script_sections::set_saw_segment_start_expression): New method
10876         definition.
10877         (Script_sections::saw_segment_start_expression_): New data member
10878         declaration.
10879         * script.cc (script_saw_segment_start_expression): New function.
10880         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10881         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10882         script_test_7.sh and script_test_8.sh.
10883         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10884         script_test_8.stdout.
10885         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10886         (script_test_6, script_test_6.stdout, script_test_7,
10887         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10888         * Makefile.in: Regenerate.
10889         * testsuite/script_test_6.sh: New file.
10890         * testsuite/script_test_6.t: Same.
10891         * testsuite/script_test_7.sh: Same.
10892         * testsuite/script_test_7.t: Same.
10893         * testsuite/script_test_8.sh: Same.
10894
10895 2009-10-16  Doug Kwan  <dougkwan@google.com>
10896
10897         * output.cc (Output_segment::set_section_list_address): Cast
10898         expressions to unsigned long long type to avoid format warnings.
10899
10900 2009-10-15  Ian Lance Taylor  <iant@google.com>
10901
10902         * script.cc (Script_options::add_symbol_assignment): Always add a
10903         dot assignment to script_sections_.
10904         * script-sections.cc (Script_sections::add_dot_assignment):
10905         Initialize if necessary.
10906
10907         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10908         program headers with no load segment if there is a linker script.
10909
10910         * layout.cc (Layout::set_segment_offsets): Align the file offset
10911         to the segment aligment for -N or -n with no load segment.
10912         * output.cc (Output_segment::add_output_section): Don't crash if
10913         the first section is a TLS section.
10914         (Output_segment::set_section_list_addresses): Print an error
10915         message if the address moves backward in a linker script.
10916         * script-sections.cc
10917         (Output_section_element_input::set_section_addresses): Don't
10918         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10919         (Orphan_output_section::set_section_addresses): Likewise.
10920
10921 2009-10-15  Doug Kwan  <dougkwan@google.com>
10922
10923         * layout.cc (Layout::finish_dynamic_section): Generate tags
10924         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10925         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10926         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10927
10928 2009-10-14  Ian Lance Taylor  <iant@google.com>
10929
10930         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10931         fields.
10932         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10933         data_shdr fields of relinfo.
10934         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10935         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10936         R_386_TLS_LDO_32, adjust based on section flags.
10937         (Target_i386::Relocate::fix_up_ldo): Remove.
10938
10939 2009-10-13  Ian Lance Taylor  <iant@google.com>
10940
10941         Add support for -pie.
10942         * options.h (class General_options): Add -pie and
10943         --pic-executable.
10944         (General_options::output_is_position_independent): Test -pie.
10945         (General_options::output_is_executable): Return true if not shared
10946         and not relocatable.
10947         (General_options::output_is_pie): Remove.
10948         * options.cc (General_options::finalize): Reject incompatible uses
10949         of -pie.
10950         * gold.cc (queue_middle_tasks): A -pie link is not static.
10951         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10952         * symtab.cc (Symbol::final_value_is_known): Return false if
10953         output_is_position_independent.
10954         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10955         output_is_position_independent.
10956         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10957         output_is_position_independent.
10958         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10959         output_is_position_independent.
10960         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10961         two_file_pie_test.
10962         (basic_pie_test.o, basic_pie_test): New targets.
10963         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10964         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10965         (two_file_pie_test): New target.
10966         * testsuite/Makefile.in: Rebuild.
10967         * README: Remove note saying that -pie is not supported.
10968
10969 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10970
10971         * options.h (class General_options): Add -init and -fini.
10972         * layout.cc (Layout::finish_dynamic_section): Emit
10973         given init and fini functions.
10974
10975 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10976
10977         * gc.h (gc_process_relocs): Check if icf is enabled using new
10978         function.
10979         * gold.cc (queue_initial_tasks): Likewise.
10980         (queue_middle_tasks): Likewise.
10981         * object.cc (do_layout): Likewise.
10982         * symtab.cc (is_section_folded): Likewise.
10983         * main.cc (main): Likewise.
10984         * reloc.cc (Read_relocs::run): Likewise.
10985         (Sized_relobj::do_scan_relocs): Likewise.
10986         * icf.cc (is_function_ctor_or_dtor): New function.
10987         (Icf::find_identical_sections): Check if function is ctor or dtor when
10988         safe icf is chosen.
10989         * options.h (General_options::icf): Change option to be an enum.
10990         (Icf_status): New enum.
10991         (icf_enabled): New method.
10992         (icf_safe_folding): New method.
10993         (set_icf_status): New method.
10994         (icf_status_): New variable.
10995         * (options.cc) (General_options::finalize): Set icf_status_.
10996         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10997         icf_test and icf_keep_unique_test to use the --icf enum flag.
10998         * testsuite/icf_safe_test.sh: New file.
10999         * testsuite/icf_safe_test.cc: New file.
11000
11001 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11002
11003         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11004         includes to gc.h and icf.h.
11005         * arm.cc: Include gc.h.
11006         * gold.cc: Likewise.
11007         * i386.cc: Likewise.
11008         * powerpc.cc: Likewise.
11009         * sparc.cc: Likewise.
11010         * x86_64.cc: Likewise.
11011         * gc.h: Include icf.h.
11012
11013 2009-10-11  Ian Lance Taylor  <iant@google.com>
11014
11015         * plugin.cc: Include "gold.h" before other header files.
11016
11017 2009-10-10  Chris Demetriou  <cgd@google.com>
11018
11019         * options.h (Input_file_argument::Input_file_type): New enum.
11020         (Input_file_argument::is_lib_): Replace with...
11021         (Input_file_argument::type_): New member.
11022         (Input_file_argument::Input_file_argument): Take Input_file_type
11023         'type' rather than boolean 'is_lib' as second argument.
11024         (Input_file_argument::is_lib): Use type_.
11025         (Input_file_argument::is_searched_file): New function.
11026         (Input_file_argument::may_need_search): Handle is_searched_file.
11027         * options.cc (General_options::parse_library): Support -l:filename.
11028         (General_options::parse_just_symbols): Update for Input_file_argument
11029         changes.
11030         (Command_line::process): Likewise.
11031         * archive.cc (Archive::get_file_and_offset): Likewise.
11032         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11033         * script.cc (read_script_file, script_add_file): Likewise.
11034         * fileread.cc (Input_file::Input_file): Likewise.
11035         (Input_file::will_search_for): Handle is_searched_file.
11036         (Input_file::open): Likewise.
11037         * readsyms.cc (Read_symbols::get_name): Likewise.
11038         * testsuite/Makefile.am (searched_file_test): New test.
11039         * testsuite/Makefile.in: Regenerate.
11040         * testsuite/searched_file_test.cc: New file.
11041         * testsuite/searched_file_test_lib.cc: New file.
11042
11043 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11044             Ian Lance Taylor  <iant@google.com>
11045
11046         * descriptor.cc: Include <cstdio> and "binary-io.h".
11047         (Descriptors::open): Open the files in binary mode always.
11048         * script.cc (Lex::get_token): Treat \r as whitespace.
11049
11050 2009-10-09  Ian Lance Taylor  <iant@google.com>
11051
11052         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11053
11054 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11055             Ian Lance Taylor  <iant@google.com>
11056
11057         * configure.ac: Check for readv function also.
11058         * fileread.cc (readv): Define if not HAVE_READV.
11059         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11060         does not exist.
11061         * config.in: Regenerate.
11062         * configure: Regenerate.
11063
11064 2009-10-09  Doug Kwan  <dougkwan@google.com>
11065
11066         * layout.cc (Layout::make_output_section): Call target hook to make
11067         ordinary output section.
11068         (Layout::finalize): Adjust parameter list of call the
11069         Target::may_relax().
11070         * layout.h (class Layout::section_list): New method.
11071         * merge.h (Output_merge_base::entsize): Change visibility to public.
11072         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11073         New methods.
11074         (Output_merge_string::do_is_string): New method.
11075         * object.cc (Sized_relobj::do_setup): renamed from
11076         Sized_relobj::set_up.
11077         * object.h (Sized_relobj::adjust_shndx,
11078         Sized_relobj::initializ_input_to_output_maps,
11079         Sized_relobj::free_input_to_output_maps): Change visibilities to
11080         protected.
11081         (Sized_relobj::setup): Virtualize.
11082         (Sized_relobj::do_setup): New method declaration.
11083         (Sized_relobj::invalidate_section_offset,
11084         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11085         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11086         * options.cc (parse_int): New function.
11087         * options.h (parse_int): New declaration.
11088         (DEFINE_int): New macro.
11089         (stub_group_size): New option.
11090         * output.cc (Output_section::Output_section): Initialize memebers
11091         merge_section_map_, merge_section_by_properties_map_,
11092         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11093         (Output_section::add_input_section): Handled deferred code-fill
11094         generation and remove an old comment.
11095         (Output_section::add_relaxed_input_section): New method definition.
11096         (Output_section::add_merge_input_section): Use merge section by
11097         properties map to speed to search.  Update merge section maps
11098         as appropriate.
11099         (Output_section::build_relaxation_map): New method definition.
11100         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11101         Same.
11102         (Output_section::relax_input_section): Renamed to
11103         Output_section::convert_input_sections_to_relaxed_sections and change
11104         interface to take a vector of pointers to relaxed sections.
11105         (Output_section::find_merge_section,
11106         Output_section::find_relaxed_input_section): New method definitions.
11107         (Output_section::is_input_address_mapped,
11108         Output_section::output_offset, Output_section::output_address):
11109         Use output section data maps to speed up searching.
11110         (Output_section::find_starting_output_address): Add comments.
11111         (Output_section::do_write,
11112         Output_section::write_to_postprocessing_buffer): Do code-fill
11113         generation as appropriate.
11114         (Output_section::get_input_sections): Invalidate relaxed input section
11115         map.
11116         (Output_section::restore_states): Adjust type of checkpoint .
11117         Invalidate relaxed input section map.
11118         * output.h (Output_merge_base): New class declaration.
11119         (Input_section_specifier): New class defintion.
11120         (class Output_relaxed_input_section) Change base class to
11121         Output_section_data_build.
11122         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11123         base class initializer.
11124         (Output_section::add_relaxed_input_section): New method declaration.
11125         (Output_section::Input_section): Change visibility to protected.
11126         (Output_section::Input_section::relobj,
11127         Output_section::Input_section::shndx): Handle relaxed input sections.
11128         Output_section::input_sections) Change visibility to protected.  Also
11129         define overload to return a non-const pointer.
11130         (Output_section::Merge_section_properties): New class defintion.
11131         (Output_section::Merge_section_by_properties_map,
11132         Output_section::Output_section_data_by_input_section_map,
11133         Output_section::Relaxation_map): New types.
11134         (Output_section::relax_input_section): Rename method to
11135         Output_section::convert_input_sections_to_relaxed_sections and change
11136         interface to take a vector of relaxed section pointers.
11137         (Output_section::find_merge_section,
11138         Output_section::find_relaxed_input_section,
11139         Output_section::build_relaxation_map,
11140         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11141         New method declarations.
11142         (Output_section::merge_section_map_
11143         Output_section::merge_section_by_properties_map_,
11144         Output_section::relaxed_input_section_map_,
11145         Output_section::is_relaxed_input_section_map_valid_,
11146         Output_section::generate_code_fills_at_write_): New data members.
11147         * script-sections.cc
11148         (Output_section_element_input::set_section_addresses): Call
11149         current_data_size and addralign methods of relaxed input sections.
11150         (Orphan_output_section::set_section_addresses): Call current_data_size
11151         and addralign methods of relaxed input sections.
11152         * symtab.cc (Symbol_table::compute_final_value): Extract template
11153         from the body of Symbol_table::sized_finalize_symbol.
11154         (Symbol_table::sized_finalized_symbol): Call
11155         Symbol_table::compute_final_value.
11156         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11157         (Symbol_table::compute_final_value): New templated method declaration.
11158         * target.cc (Target::do_make_output_section): New method defintion.
11159         * target.h (Target::make_output_section): New method declaration.
11160         (Target::relax): Add more parameters for input objects, symbol table
11161         and layout.  Adjust call to do_relax.
11162         (Target::do_make_output_section): New method declaration.
11163         (Target::do_relax): Add parameters for input objects, symbol table
11164         and layout.
11165
11166 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11167
11168         * pread.c: Include stdio.h.
11169
11170 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11171
11172         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11173         defined.
11174
11175 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11176
11177         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11178         Change read_shndx type to unsigned int.
11179         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11180         int.
11181         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11182         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11183         Change read_shndx type to unsigned int.
11184         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11185         int.
11186         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11187         * layout.cc (Layout::create_symtab_sections): Cast the result of
11188         local_symcount * symsize to off_t in the gold_assert.
11189
11190 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11191
11192         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11193         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11194         R_ARM_BASE_ABS.
11195         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11196         (Arm_relocate_functions::thm_abs5): New function.
11197         (Arm_relocate_functions::abs12): New function.
11198         (Arm_relocate_functions::abs16): New function.
11199         (Arm_relocate_functions::base_abs): New function.
11200         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11201         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11202         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11203         R_ARM_BASE_ABS.
11204         (Scan::global): Likewise.
11205         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11206         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11207         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11208         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11209         R_ARM_BASE_ABS.
11210
11211 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11212
11213         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11214         (Arm_relocate_functions::movt_prel): New function.
11215         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11216         (Arm_relocate_functions::thm_movt_prel): New function.
11217         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11218         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11219         (Scan::global, Relocate::relocate): Likewise.
11220         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11221
11222 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11223
11224         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11225         Incremental_checker.
11226         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11227         unsigned int.
11228         (class Incremental_inputs_header): New class.
11229         (Incremental_inputs_header_writer): Edit comment.
11230         (Incremental_inputs_entry): New class.
11231         (Incremental_inputs_entry_writer): Edit comment.
11232         (Sized_incremental_binary::do_find_incremental_inputs_section):
11233         Add *strtab_shndx parameter, fill it.
11234         (Sized_incremental_binary::do_check_inputs): New method.
11235         (Incremental_checker::can_incrementally_link_output_file): Use
11236         Sized_incremental_binary::check_inputs.
11237         (Incremental_inputs::report_command_line): Save command line in
11238         command_line_.
11239         * incremental.h:
11240         (Incremental_binary::find_incremental_inputs_section): New
11241         method.
11242         (Incremental_binary::do_find_incremental_inputs_section): Add
11243         strtab_shndx parameter.
11244         (Incremental_binary::do_check_inputs): New pure virtual method.
11245         (Sized_incremental_binary::do_check_inputs): Declare.
11246         (Incremental_checker::Incremental_checker): Add incremental_inputs
11247         parameter, use it to initialize incremental_inputs_.
11248         (Incremental_checker::incremental_inputs_): New field.
11249         (Incremental_checker::command_line): New method.
11250         (Incremental_checker::inputs): New method.
11251         (Incremental_checker::command_line_): New field.
11252
11253 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11254
11255         * incremental.cc: Include <cstdarg> and "target-select.h".
11256         (vexplain_no_incremental): New function.
11257         (explain_no_incremental): New function.
11258         (Incremental_binary::error): New method.
11259         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11260         method.
11261         (make_sized_incremental_binary): New function.
11262         (open_incremental_binary): New function.
11263         (can_incrementally_link_file): Add checks if output is ELF and has
11264         inputs section.
11265         * incremental.h: Include "elfcpp_file.h" and "output.h".
11266         (Incremental_binary): New class.
11267         (Sized_incremental_binary): New class.
11268         (open_incremental_binary): Declare.
11269         * object.cc (is_elf_object): Use
11270         elfcpp::Elf_recognizer::is_elf_file.
11271         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11272         * output.h (Output_file::filesize): New method.
11273
11274 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11275
11276         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11277         New function.
11278         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11279         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11280         function.
11281         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11282         function.
11283         (Arm_relocate_functions::movw_abs_nc): New function.
11284         (Arm_relocate_functions::movt_abs): New function.
11285         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11286         (Arm_relocate_functions::thm_movt_abs): New function.
11287         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11288         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11289         (Scan::global): Likewise.
11290         (Relocate::relocate): Likewise.
11291         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11292
11293 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11294
11295         * arm.cc (Arm_relocate_functions::got_prel) New function.
11296         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11297         (Relocate::relocate): Likewise.
11298         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11299
11300 2009-10-06  Ian Lance Taylor  <iant@google.com>
11301
11302         * options.h (class General_options): Define
11303         split_stack_adjust_size parameter.
11304         * object.h (class Object): Add uses_split_stack_ and
11305         has_no_split_stack_ fields.  Add uses_split_stack and
11306         has_no_split_stack accessor functions.  Declare
11307         handle_split_stack_section.
11308         (class Reloc_symbol_changes): Define.
11309         (class Sized_relobj): Define Function_offsets.  Declare
11310         split_stack_adjust, split_stack_adjust_reltype, and
11311         find_functions.
11312         * object.cc (Object::handle_split_stack_section): New function.
11313         (Sized_relobj::do_layout): Call handle_split_stack_section.
11314         * dynobj.cc (Sized_dynobj::do_layout): Call
11315         handle_split_stack_section.
11316         * reloc.cc (Sized_relobj::relocate_sections): Call
11317         split_stack_adjust for executable sections in split_stack
11318         objects.  Pass reloc_map to relocate_section.
11319         (Sized_relobj::split_stack_adjust): New function.
11320         (Sized_relobj::split_stack_adjust_reltype): New function.
11321         (Sized_relobj::find_functions): New function.
11322         * target-reloc.h: Include "object.h".
11323         (relocate_section): Add reloc_symbol_changes parameter.  Change
11324         all callers.
11325         * target.h (class Target): Add calls_non_split method.  Declare
11326         do_calls_non_split virtual method.  Declare match_view and
11327         set_view_to_nop.
11328         * target.cc: Include "elfcpp.h".
11329         (Target::do_calls_non_split): New function.
11330         (Target::match_view): New function.
11331         (Target::set_view_to_nop): New function.
11332         * gold.cc (queue_middle_tasks): Give an error if mixing
11333         split-stack and non-split-stack objects with -r.
11334         * i386.cc (Target_i386::relocate_section): Add
11335         reloc_symbol_changes parameter.
11336         (Target_i386::do_calls_non_split): New function.
11337         * x86_64.cc (Target_x86_64::relocate_section): Add
11338         reloc_symbol_changes parameter.
11339         (Target_x86_64::do_calls_non_split): New function.
11340         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11341         parameter.
11342         * powerpc.cc (Target_powerpc::relocate_section): Add
11343         reloc_symbol_changes parameter.
11344         * sparc.cc (Target_sparc::relocate_section): Add
11345         reloc_symbol_changes parameter.
11346         * configure.ac: Call AM_CONDITIONAL for the default target.
11347         * configure: Rebuild.
11348         * testsuite/Makefile.am (TEST_AS): New variable.
11349         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11350         (check_DATA): Add split_i386 and split_x86_64 files.
11351         (SPLIT_DEFSYMS): Define.
11352         (split_i386_[1234n].o): New targets.
11353         (split_i386_[124]): New targets.
11354         (split_i386_[1234r].stdout): New targets.
11355         (split_x86_64_[1234n].o): New targets.
11356         (split_x86_64_[124]): New targets.
11357         (split_x86_64_[1234r].stdout): New targets.
11358         (MOSTLYCLEANFILES): Add new executables.
11359         * testsuite/split_i386.sh: New file.
11360         * testsuite/split_x86_64.sh: New file.
11361         * testsuite/split_i386_1.s: New file.
11362         * testsuite/split_i386_2.s: New file.
11363         * testsuite/split_i386_3.s: New file.
11364         * testsuite/split_i386_4.s: New file.
11365         * testsuite/split_i386_n.s: New file.
11366         * testsuite/split_x86_64_1.s: New file.
11367         * testsuite/split_x86_64_2.s: New file.
11368         * testsuite/split_x86_64_3.s: New file.
11369         * testsuite/split_x86_64_4.s: New file.
11370         * testsuite/split_x86_64_n.s: New file.
11371         * testsuite/testfile.cc (Target_test): Update relocation_section
11372         function.
11373         * testsuite/Makefile.in: Rebuild.
11374
11375 2009-10-06  Ian Lance Taylor  <iant@google.com>
11376
11377         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11378         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11379         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11380         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11381         the address on ldo_addrs_.
11382         (Target_i386::Relocate::fix_up_ldo): New function.
11383
11384 2009-10-06   Rafael Espindola  <espindola@google.com>
11385
11386         * plugin.cc (add_input_library): New.
11387         (Plugin::load): Add add_input_library to tv.
11388         (Plugin_manager::add_input_file): Add the is_lib argument.
11389         (add_input_file): Update call to Plugin_manager::add_input_file.
11390         (add_input_library): New.
11391         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11392
11393 2009-09-30  Doug Kwan  <dougkwan@google.com>
11394
11395         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11396         symbol and call Symbol::may_need_copy_reloc to determine if
11397         a copy reloc is needed.
11398         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11399         nocopyreloc is given in command line.
11400         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11401         given in command line.
11402         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11403         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11404         of the removed Target_i386::may_need_copy_reloc.
11405         * options.h (copyreloc): New option with default value false.
11406         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11407         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11408         instead of the removed Target_powerpc::may_need_copy_reloc.
11409         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11410         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11411         instead of the removed Target_sparc::may_need_copy_reloc.
11412         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11413         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11414         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11415         instead of the removed Target_x86_64::may_need_copy_reloc.
11416
11417 2009-09-30  Ian Lance Taylor  <iant@google.com>
11418
11419         * object.h (class Object): Remove target_ field, and target,
11420         sized_target, and set_target methods.
11421         (Object::sized_target): Remove.
11422         (class Sized_relobj): Update declarations.  Remove sized_target.
11423         * object.cc (Sized_relobj::setup): Remove target parameter.
11424         Change all callers.
11425         (Input_objects::add_object): Don't do anything with the target.
11426         (make_elf_sized_object): Add punconfigured parameter.  Change all
11427         callers.  Set or test parameter target.
11428         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11429         Change all callers.
11430         * parameters.cc (Parameters::set_target): Change parameter type to
11431         be non-const.
11432         (Parameters::default_target): Remove.
11433         (set_parameters_target): Change parameter type to be non-const.
11434         (parameters_force_valid_target): New function.
11435         (parameters_clear_target): New function.
11436         * parameters.h (class Parameters): Update declarations.  Remove
11437         default_target method.  Add sized_target and clear_target
11438         methods.  Change target_ to be non-const.
11439         (set_parameters_target): Update declaration.
11440         (parameters_force_valid_target): Declare.
11441         (parameters_clear_target): Declare.
11442         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11443         as NULL if we aren't searching.
11444         (Add_symbols::run): Don't check for compatible target.
11445         * fileread.cc (Input_file::open_binary): Call
11446         parameters_force_valid_target.
11447         * gold.cc (queue_middle_tasks): Likewise.
11448         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11449         set_target on object.
11450         * dynobj.h (class Sized_dynobj): Update declarations.
11451         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11452         make_elf_object returns NULL.
11453         (Archive::include_member): Don't check whether object target is
11454         compatible.
11455         * output.cc (Output_section::add_input_section): Get target from
11456         parameters.
11457         (Output_section::relax_input_section): Likewise.
11458         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11459         parameters.
11460         (Sized_relobj::do_scan_relocs): Likewise.
11461         (Sized_relobj::relocate_sections): Likewise.
11462         * resolve.cc (Symbol_table::resolve): Likewise.
11463         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11464         parameter.  Change all callers.
11465         (Symbol_table::add_from_object): Get target from parameters.
11466         (Symbol_table::add_from_relobj): Don't check object target.
11467         (Symbol_table::add_from_dynobj): Likewise.
11468         (Symbol_table::define_special_symbol): Get target from
11469         parameters.
11470         * symtab.h (class Symbol_table): Update declaration.
11471         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11472         parameter.  Change all callers.  Clear parameter target.
11473         (Binary_test): Test target here.
11474         * testsuite/object_unittest.cc (gold_testsuite): Remove
11475         target_test_pointer parameter.  Change all callers.
11476         (Object_test): Test target here.
11477
11478 2009-09-26  Ian Lance Taylor  <iant@google.com>
11479
11480         * testsuite/initpri1.c: Don't try to use constructor priorities if
11481         compiling with gcc before 4.3.
11482
11483 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11484
11485         * testsuite/retain_symbols_file_test.sh (check_present): Change
11486         output file name to retain_symbols_file_test.stdout.
11487         (check_absent): Likewise.
11488
11489 2009-09-18  Craig Silverstein  <csilvers@google.com>
11490
11491         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11492         * options.cc: Include <cerrno> and <fstream>.
11493         (General_options::finalize): Parse -retain-symbols-file tag.
11494         * options.h: New flag.
11495         (General_options): New method should_retain_symbol, new
11496         variable symbols_to_retain.
11497         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11498         should_retain_symbol map.
11499         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11500         * testsuite/Makefile.in: Regenerate.
11501         * testsuite/retain_symbols_file_test.sh: New file.
11502
11503 2009-09-18  Nick Clifton  <nickc@redhat.com>
11504
11505         * po/es.po: Updated Spanish translation.
11506
11507 2009-09-17  Doug Kwan  <dougkwan@google.com>
11508
11509         * debug.h (DEBUG_RELAXATION): New constant.
11510         (DEBUG_ALL): Add DEBUG_RELAXATION.
11511         (debug_string_to_enum): Add relaxation debug option.
11512         * layout.cc
11513         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11514         Layout::Relaxation_debug_check::read_sections,
11515         Layout::Relaxation_debug_check::read_sections): New method definitions.
11516         (Layout::Layout): Initialize data members
11517         record_output_section_data_from_scrips_,
11518         script_output_section_data_list_ and relaxation_debug_check_.
11519         (Layout::save_segments, Layout::restore_segments,
11520         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11521         Layout::relaxation_loop_body): New method definitions.
11522         (Layout::finalize): Support relaxation.  Move section layout code to
11523         Layout::relaxation_loop_body.
11524         (Layout::set_asection_address_from_script): Move code for orphan
11525         section placement out.
11526         (Layout::place_orphan_sections_in_script): New method definition.
11527         * layout.h (Output_segment_headers, Output_file_header):
11528         New forward class declarations.
11529         (Layout::~Layout): Define.
11530         (Layout::new_output_section_data_from_script): New method definition.
11531         (Layout::place_orphan_sections_in_script): New method declaration.
11532         (Layout::Segment_states): New type declaration.
11533         (Layout::save_segments, Layout::restore_segments,
11534         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11535         Layout::relaxation_loop_body): New method declarations.
11536         (Layout::Output_section_data_list): New type declaration.
11537         (Layout::Relaxation_debug_check): New class definition.
11538         (Layout::record_output_section_data_from_script_,
11539         Layout::script_output_section_data_list_, Layout::segment_states_,
11540         Layout::relaxation_debug_check_): New data members.
11541         * output.cc: (Output_section_headers::do_size): New method definition.
11542         (Output_section_headers::Output_section_headers): Move size
11543         computation to Output_section_headers::do_size.
11544         (Output_segment_headers::do_size): New method definition.
11545         (Output_file_header::Output_file_header): Move size computation to
11546         Output_file_header::do_size and call it.
11547         (Output_file_header::do_size): New method definition.
11548         (Output_data_group::Output_data_group): Adjust call to
11549         Output_section_data.
11550         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11551         (Output_symtab_xindex::do_write): Add array bound check.
11552         (Output_section::Input_section::print_to_mapfile): Handle
11553         RELAXED_INPUT_SECTION_CODE.
11554         (Output_section::Output_section): Initialize data member checkpoint_.
11555         (Output_section::~Output_section): Delete checkpoint object pointed
11556         by checkpoint_.
11557         (Output_section::add_input_section): Always add an Input_section if
11558         relaxing.
11559         (Output_section::add_merge_input_section): Add assert.
11560         (Output_section::relax_input_section): New method definition.
11561         (Output_section::set_final_data_size): Set load address to zero for
11562         an unallocated section.
11563         (Output_section::do_address_and_file_offset_have_reset_values):
11564         New method definition.
11565         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11566         Handle relaxed input section.
11567         (Output_section::sort_attached_input_sections): Checkpoint input
11568         section list lazily.
11569         (Output_section::get_input_sections): Change type of input_sections to
11570         list of Simple_input_section pointers.  Checkpoint input section list
11571         lazily.  Also handle relaxed input sections.
11572         (Output_section::add_input_section_for_script): Take a reference to
11573         a Simple_input_section object instead of Relobj pointer and section
11574         index as parameter.  Handle relaxed input sections.
11575         (Output_section::save_states, Output_section::restore_states): New
11576         method definitions.
11577         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11578         (Output_data::is_data_size_fixed): New method definition.
11579         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11580         if it is fixed.
11581         (Output_data::address_and_file_offset_have_reset_values): New method
11582         definition.
11583         (Output_data::do_address_and_file_offset_have_reset_values): New method
11584         definition.
11585         (Output_data::set_data_size): Check that data size is not fixed.
11586         (Output_data::fix_data_size): New method definition.
11587         (Output_data::is_data_size_fixed_): New data member.
11588         (Output_section_headers::set_final_data_size): New method definition.
11589         (Output_section_headers::do_size): New method declaration.
11590         (Output_segment_headers::set_final_data_size): New method definition.
11591         (Output_segment_headers::do_size): New method declaration.
11592         (Output_file_header::set_final_data_size)::New method definition.
11593         (Output_file_header::do_size)::New method declaration.
11594         (Output_section_data::Output_section_data): Add new parameter
11595         is_data_size_fixed and use it to fix data size.
11596         (Output_data_const::Output_data_const): Adjust call to base class
11597         constructor and fix data size.
11598         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11599         base class constructor and fix data size.
11600         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11601         base class constructor and fix data size.
11602         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11603         class constructor and fix data size.
11604         (Output_data_group::set_final_data_size): New method definition.
11605         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11606         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11607         class constructor and fix data size.
11608         (Output_relaxed_input_section): New class definition.
11609         (Output_section::Simple_input_section): New class definition.
11610         (Output_section::get_input_sections): Adjust parameter list.
11611         (Output_section::add_input_section_for_script): Same.
11612         (Output_section::save_states, Output_section::restore_states,
11613         Output_section::do_address_and_file_offset_have_reset_values,
11614         (Output_section::Input_section::Input_section): Handle
11615         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11616         Output_relaxed_input_section.
11617         (Output_section::Input_section::is_input_section,
11618         Output_section::Input_section::set_output_section): Handle relaxed
11619         input section.
11620         (Output_section::Input_section::is_relaxed_input_section,
11621         Output_section::Input_section::output_section_data,
11622         Output_section::Input_section::relaxed_input_section): New method
11623         definitions.
11624         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11625         value.
11626         (Output_section::Input_section::u1_): Update comments.
11627         (Output_section::Input_section::u2_): Add new union member poris.
11628         (Output_section::Checkpoint_output_section): New classs definition.
11629         (Output_section::relax_input_section): New method declaration.
11630         (Output_section::checkpoint_): New data member.
11631         (Output_segment): Update comments.
11632         (Output_segment::Output_segment): Un-privatize copy constructor.
11633         (Output_segment::operator=): Un-privatize.
11634         * script-sections.cc (Output_section_element::Input_section_list):
11635         Change element type to Output_section::Simple_input_section.
11636         (Output_section_element_dot_assignment::set_section_addresses):
11637         Register output section data for relaxation clean up.
11638         (Output_data_exression::Output_data_expression): Adjust call to base
11639         constructor to fix data size.
11640         (Output_section_element_data::set_section_addresses): Register
11641         Output_data_expression object for relaxation clean up.
11642         (struct Input_section_info): Replace Relobj pointer and section index
11643         pair with Output_section::Simple_input_section and Convert struct to a
11644         class.
11645         (Input_section_sorter::operator()): Adjust access to
11646         Input_section_info data member to use accessors.
11647         (Output_section_element_input::set_section_addresses): Use layout
11648         parameter.  Adjust code to use Output_section::Simple_input_section
11649         and Input_secction_info classes.  Register filler for relaxation
11650         clean up.
11651         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11652         and section index pair with Output_section::Simple_input_section
11653         class.  Adjust code accordingly.
11654         (Phdrs_element::release_segment): New method definition.
11655         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11656         segment list.
11657         (Script_sections::release_segments): New method definition.
11658         * gold/script-sections.h (Script_sections::release_segments): New
11659         method declaration.
11660         * gold/target.h (Target::may_relax, Target::relax,
11661         Target::do_may_relax, Target::do_relax): New method definitions.
11662
11663 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11664
11665         * arm.cc (has_signed_unsigned_overflow): New function.
11666         (Arm_relocate_functions::abs8): New function.
11667         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11668         (Target_arm::Scan::global): Likewise.
11669         (Target_arm::relocate::relocate): Likewise.
11670         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11671         Likewise.
11672
11673 2009-09-16  Cary Coutant  <ccoutant@google.com>
11674
11675         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11676         * testsuite/Makefile.in: Regenerate.
11677
11678 2009-09-11  Nick Clifton  <nickc@redhat.com>
11679
11680         * po/gold.pot: Updated by the Translation project.
11681
11682 2009-09-08  Cary Coutant  <ccoutant@google.com>
11683
11684         * output.cc (Output_file::open): Add execute permission to empty file.
11685         * testsuite/Makefile.am (permission_test): New test.
11686         * testsuite/Makefile.in: Regenerate.
11687
11688 2009-09-02  Ian Lance Taylor  <iant@google.com>
11689
11690         * output.cc (Output_file::resize): Call map_no_anonymous rather
11691         than map.
11692
11693 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11694
11695         * gold.cc: Include "incremental.h".
11696         (queue_initial_tasks): Call Incremental_checker methods.
11697         * incremental.cc: Include "output.h".
11698         (Incremental_checker::can_incrementally_link_output_file): New
11699         method.
11700         * incremental.h (Incremental_checker): New class.
11701
11702         * output.cc (Output_file::open_for_modification): New method.
11703         (Output_file::map_anonymous): Changed return type to bool.  Record
11704         map in base_ field.
11705         (Output_file::map_no_anonymous): New method, broken out of map.
11706         (Output_file::map): Use map_no_anonymous and map_anonymous.
11707         * output.h (class Output_file): Update declarations.
11708
11709 2009-08-24  Cary Coutant  <ccoutant@google.com>
11710
11711         * options.h (Command_line::Pre_options): New class.
11712         (Command_line::pre_options): New member.
11713         * options.cc (gold::options::ready_to_register): New variable.
11714         (One_option::register_option): Do nothing if not registering options.
11715         Assert if same short option registered twice.
11716         (General_options::General_options): Turn off option registration when
11717         done constructing.
11718         (Command_line::Pre_options::Pre_options): New constructor.
11719
11720 2009-08-24  Cary Coutant  <ccoutant@google.com>
11721
11722         * options.h (General_options::no_keep_memory): Remove incorrect
11723         short option.
11724
11725 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11726
11727         * Makefile.am (am__skiplex, am__skipyacc): New.
11728         * Makefile.in: Regenerate.
11729
11730 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11731
11732         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11733         (INCLUDES): ... this.
11734         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11735         (AM_CPPFLAGS): Renamed from ...
11736         (INCLUDE): ... this.
11737         * Makefile.in, testsuite/Makefile.in: Regenerate.
11738
11739         * Makefile.in: Regenerate.
11740         * aclocal.m4: Likewise.
11741         * config.in: Likewise.
11742         * configure: Likewise.
11743         * testsuite/Makefile.in: Likewise.
11744
11745         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11746         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11747         * Makefile.in: Regenerate.
11748         * testsuite/Makefile.in: Regenerate.
11749
11750 2009-08-19  Cary Coutant  <ccoutant@google.com>
11751
11752         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11753         symbols in shared libraries overridden by hidden or internal symbols
11754         in the main program.
11755
11756 2009-08-19  Chris Demetriou  <cgd@google.com>
11757
11758         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11759         checking source file names in error messages.
11760
11761 2009-08-18  Doug Kwan  <dougkwan@google.com>
11762
11763         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11764         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11765         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11766         an elfcpp::Ehdr as parameter.
11767         * object.cc (Object::set_target): Remove the version that looks up
11768         a target and sets it.
11769         (Sized_relobj::setup): Take a Target object instead of
11770         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11771         (make_elf_sized_object): Find target and ask target to
11772         make an ELF object.
11773         * object.h: (Object::set_target): Remove the version that looks up
11774         a target and sets it.
11775         (Sized_relobj::setup): Take a Target object instead of
11776         an elfcpp:Ehdr as parameter.
11777         * target.cc: Include dynobj.h.
11778         (Target::do_make_elf_object_implementation): New.
11779         (Target::do_make_elf_object): New.
11780         * target.h (Target::make_elf_object): New template declaration.
11781         (Target::do_make_elf_object): New method declarations.
11782         (Target::do_make_elf_object_implementation): New template declaration.
11783
11784 2009-08-14  Ian Lance Taylor  <iant@google.com>
11785
11786         * gold.h (FUNCTION_NAME): Define.
11787         (gold_unreachable): Use FUNCTION_NAME.
11788
11789 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11790
11791         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11792         symbol in the --keep-unique list is not found.
11793
11794 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11795
11796         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11797         been maked as --keep-unique.
11798         (Icf::unfold_section): New function.
11799         * icf.h (Icf::unfold_section): New function.
11800         * options.h (General_options::keep_unique): New option.
11801         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11802         * testsuite/Makefile.in: Regenerate.
11803         * testsuite/icf_keep_unique_test.sh: New file.
11804         * testsuite/icf_keep_unique_test.cc: New file.
11805
11806 2009-08-12  Cary Coutant  <ccoutant@google.com>
11807
11808         PR 10471
11809         * resolve.cc (Symbol_table::resolve): Check for references from
11810         dynamic objects to hidden and internal symbols.
11811         * testsuite/Makefile.am (hidden_test.sh): New test.
11812         * testsuite/Makefile.in: Regenerate.
11813         * testsuite/hidden_test.sh: New script.
11814         * testsuite/hidden_test_1.c: New test source.
11815         * testsuite/hidden_test_main.c: New test source.
11816
11817 2009-08-11  Doug Kwan  <dougkwan@google.com>
11818
11819         * arm.cc: Update comments.
11820         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11821         segment to locate the .ARM.exidx section if present.
11822
11823 2009-08-09  Doug Kwan  <dougkwan@google.com>
11824
11825         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11826         patch.
11827
11828 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11829         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11830         compiler warnings.
11831
11832 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11833
11834         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11835         valid tls_segment only for non-debug-section relocations.
11836         * testsuite/Makefile.am: Add gc_tls_test.
11837         * testsuite/Makefile.in: Regenerate.
11838         * testsuite/gc_tls_test.cc: New file.
11839         * testsuite/gc_tls_test.sh: New file.
11840
11841 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11842
11843         * icf.cc: New file.
11844         * icf.h: New file.
11845         * Makefile.am (CCFILES): Add icf.cc.
11846         (HFILES): Add icf.h
11847         * Makefile.in: Regenerate.
11848         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11849         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11850         section, symbol and addend information for the relocs.
11851         * gold.cc (queue_middle_tasks): Call identical code folding.
11852         * gold.h: Add defines for multimap.
11853         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11854         to the call of finalize_local_symbols.
11855         * main.cc (main): Create object of class Icf.
11856         * object.cc (Sized_relobj::do_layout): Allow this function to be
11857         called twice during icf.
11858         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11859         to sections marked as identical by icf.
11860         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11861         when available.
11862         (Sized_relobj::do_section_entsize): New function.
11863         * object.h (Object::section_entsize): New function.
11864         (Object::do_section_entsize): New pure virtual function.
11865         (Relobj::finalize_local_symbols): Add new parameter.
11866         (Relobj::do_section_entsize): New function.
11867         * options.h (General_options::icf): New option.
11868         (General_options::icf_iterations): New option.
11869         (General_options::print_icf_sections): New option.
11870         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11871         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11872         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11873         icf.
11874         * symtab.cc (Symbol_table::is_section_folded): New function.
11875         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11876         to sections marked as identical by icf.
11877         * symtab.h (Symbol_table::set_icf): New function.
11878         (Symbol_table::icf): New function.
11879         (Symbol_table::is_section_folded): New function.
11880         (Symbol_table::icf_): New data member.
11881         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11882         * testsuite/Makefile.am: Add commands to build icf_test.
11883         * testsuite/Makefile.in: Regenerate.
11884         * testsuite/icf_test.sh: New file.
11885         * testsuite/icf_test.cc: New file.
11886
11887 2009-07-24  Chris Demetriou  <cgd@google.com>
11888
11889         * layout.cc (is_compressible_debug_section): Fix incorrect
11890         comment about compressed section names.
11891
11892 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11893
11894         PR 10419
11895         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11896
11897 2009-07-16  Ian Lance Taylor  <iant@google.com>
11898
11899         PR 10400
11900         * layout.h: #include <map>.
11901         (class Kept_section): Change from struct to class.  Add accessors
11902         and setters.  Add section size to Comdat_group mapping.  Change
11903         Comdat_group to std::map.  Add is_comdat_ field.  Add
11904         linkonce_size field in union.
11905         (class Layout): Update declaration of find_or_add_kept_section.
11906         Don't declare find_kept_object.
11907         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11908         parameter.  Add object, shndx, is_comdat, and is_group_name
11909         parameters.  Change all callers.  Adjust for new Kept_section.
11910         (Layout::find_kept_object): Remove.
11911         * object.cc (Sized_relobj::include_section_group): Update use of
11912         Kept_section.  Rename secnum to shndx.  Only record
11913         Kept_comdat_section if sections are the same size.
11914         (Sized_relobj::include_linkonce_section): Update use of
11915         Kept_section.  Only record Kept_comdat_section if sections are the
11916         same size.  Set size of linkonce section.
11917         (Sized_relobj::map_to_kept_section): Update call to
11918         get_kept_comdat_section.
11919         * object.h (class Sized_relobj): Rename fields in
11920         Kept_comdat_section to drop trailing underscores; change object
11921         field to Relobj*.  Change Kept_comdat_section_table to store
11922         struct rather than pointer.
11923         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11924         Add kept_object and kept_shndx parameters.  Change all callers.
11925         (Sized_relobj::get_kept_comdat_section): Change return type to
11926         bool.  Add kept_object and kept_shndx parameters.  Change all
11927         callers.
11928         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11929         Layout::find_or_add_kept_section.
11930
11931 2009-07-09  Ian Lance Taylor  <iant@google.com>
11932
11933         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11934         Reserve space in the hash table.
11935
11936 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11937
11938         * fileread.cc (File_read::get_mtime): New method.
11939         * fileread.h (Timespec): New structure.
11940         (File_read::get_mtime): New method.
11941         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11942         Renamed from timestamp_nsec.
11943         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11944         Elf_Xword.
11945         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11946         timestamp_nsec.
11947         (Incremental_inputs::report_archive): Save mtime; style fix.
11948         (Incremental_inputs::report_obejct): Save mtime; style fix.
11949         (Incremental_inputs::report_script): Save mtime; style fix.
11950         (Incremental_inputs::finalize_inputs): Style fix.
11951         (Incremental_inputs::finalize): Style fix.
11952         (Incremental_inputs::create_input_section_data): Store inputs
11953         mtime.
11954         * incremental.h (Incremental_inputs::report_script): Add mtime
11955         argument.
11956         (Incremental_inputs::Input_info::Input_info): Intialize only one
11957         union member.
11958         (Incremental_inputs::Input_info::archive): Move to nameless
11959         union.
11960         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11961         (Incremental_inputs::Input_info::script): Move to nameless union.
11962         (Incremental_inputs::mtime): New field.
11963         * script.cc (read_input_script): Pass file mtime to
11964         Incremental_input.
11965         * script.h (Script_info::inputs): Style fix.
11966
11967 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11968
11969         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11970         instead of 32.
11971
11972 2009-06-24  Ian Lance Taylor  <iant@google.com>
11973
11974         PR 10156
11975         * layout.cc (Layout::choose_output_section): If we find an
11976         existing section, update the flags.
11977         (Layout::create_notes): New function, broken out of
11978         Layout::finalize.
11979         (Layout::finalize): Don't create note sections.
11980         (Layout::create_note): Don't crash if linker script discards
11981         section.
11982         (Layout::create_gold_note): Likewise.
11983         (Layout::create_build_id): Likewise.  Don't set
11984         after_input_sections on the section.
11985         (Layout::create_executable_stack_info): Remove target parameter.
11986         Change caller.
11987         * layout.h (class Layout): Declare create_notes.  Update
11988         declaration of create_executable_stack_info.
11989         * gold.cc (queue_middle_tasks): Call create_notes.
11990         * output.cc (Output_section::update_flags_for_input_section): Move
11991         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11992         invalid.
11993         * output.h (Output_data::mark_address_invalid): New function.
11994         (class Output_section): Only declare, not define,
11995         update_flags_for_input_section.  Remove set_flags.
11996
11997 2009-06-24  Ian Lance Taylor  <iant@google.com>
11998
11999         * script-sections.cc (Output_section_definition::
12000         set_section_addresses): Rename shadowing local load_address to
12001         laddr.
12002
12003 2009-06-24  Ian Lance Taylor  <iant@google.com>
12004
12005         PR 10244
12006         * reloc.cc (relocate_sections): Skip empty relocation sections.
12007
12008 2009-06-23  Ian Lance Taylor  <iant@google.com>
12009
12010         PR 10156
12011         * layout.cc (Layout::create_note): Use choose_output_section
12012         rather than make_output_section.
12013
12014 2009-06-23  Ian Lance Taylor  <iant@google.com>
12015
12016         PR 10237
12017         * options.cc (General_options::parse_V): Set printed_version_.
12018         (General_options::General_options): Initialize printed_version_.
12019         * options.h (class General_options): Add printed_version_ field.
12020         * gold.cc (queue_initial_tasks): If there are no input files,
12021         don't give a fatal error if we printed the version information.
12022         (queue_middle_tasks): If using -r with a shared object, give a
12023         fatal error rather than an ordinary error.
12024
12025 2009-06-23  Ian Lance Taylor  <iant@google.com>
12026
12027         PR 10219
12028         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12029         (Layout::make_output_section): Set have_stabstr_section_ if we see
12030         a .stab*str section.
12031         (Layout::finalize): Call link_stabs_sections.
12032         (Layout::link_stabs_sections): New file.
12033         * layout.h (class Layout): Add have_stabstr_section_ field.
12034         Declare link_stabs_sections.
12035
12036 2009-06-23  Doug Kwan  <dougkwan@google.com>
12037
12038         * Makefile.am (libgold_a_LIBADD): New.
12039         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12040         * Makefile.in: Regenerate.
12041         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12042         * configure: Regenerate.
12043         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12044         * fileread.cc: Include sys/state.h
12045         * gold.h: Declare memmem and strndup if found missing.
12046         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12047
12048 2009-06-23  Ian Lance Taylor  <iant@google.com>
12049
12050         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12051         * configure: Rebuild.
12052
12053 2009-06-23  Ian Lance Taylor  <iant@google.com>
12054
12055         PR 10147
12056         * object.cc (Object::section_contents): Don't try to get a view if
12057         the section has length zero.
12058         (Object::handle_gnu_warning_section): If the section is empty, use
12059         the name of the section as the warning.
12060
12061 2009-06-23  Ian Lance Taylor  <iant@google.com>
12062
12063         PR 10133
12064         * stringpool.h (class Stringpool_template): Add optimize_ field.
12065         (Stringpool_template::set_optimize): New function.
12066         * stringpool.cc (Stringpool_template::Stringpool_template):
12067         Initialize optimize_ field.
12068         (Stringpool_template::set_string_offsets): Test local optimize
12069         fild rather than parameter.
12070         * layout.cc (Layout::Layout): Call set_optimize on the section
12071         name stringpool.
12072
12073 2009-06-22  Ian Lance Taylor  <iant@google.com>
12074
12075         PR 10030
12076         * yyscript.y: Parse TARGET.
12077         * script.cc (script_set_target): New function.
12078         * script-c.h (script_set_target): Declare.
12079         * options.cc (General_options::string_to_object_format): Rename
12080         from string_to_object_format in anonymous namespace.  Change
12081         callers.
12082         * options.h (class General_options): Declare
12083         string_to_object_format.
12084
12085 2009-06-22  Ian Lance Taylor  <iant@google.com>
12086
12087         * script-sections.cc (Script_sections::create_segments): Don't put
12088         program headers in a PT_LOAD segment if -n or -N.
12089
12090 2009-06-22  Ian Lance Taylor  <iant@google.com>
12091
12092         PR 10141
12093         * options.h (class General_options): Add -z lazy and -z now.  Sort
12094         -z options into alphabetical order.
12095         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12096
12097 2009-06-21  Ian Lance Taylor  <iant@google.com>
12098
12099         * layout.cc (Layout::make_output_section): Call
12100         Target::new_output_section.
12101         (Layout::attach_allocated_section_to_segment): Put large section
12102         sections in a separate load segment with the large segment flag
12103         set.
12104         (Layout::segment_precedes): Sort large data segments after other
12105         load segments.
12106         (align_file_offset): New static function.
12107         (Layout::set_segment_offsets): Use align_file_offset.
12108         * output.h (class Output_section): Add is_small_section_ and
12109         is_large_section_ fields.
12110         (Output_section::is_small_section): New function.
12111         (Output_section::set_is_small_section):  New function.
12112         (Output_section::is_large_section): New function.
12113         (Output_section::set_is_large_section): New function.
12114         (Output_section::is_large_data_section): New function.
12115         (class Output_segment): Add is_large_data_segment_ field.
12116         (Output_segment::is_large_data_segment): New function.
12117         (Output_segment::set_is_large_data_segment): New function.
12118         * output.cc (Output_section::Output_section): Initialize new
12119         fields.
12120         (Output_segment::Output_segment): Likewise.
12121         (Output_segment::add_output_section): Add assertion that large
12122         data sections always go in large data segments.  Force small data
12123         sections to the end of the list of data sections.  Force small BSS
12124         sections to the start of the list of BSS sections.  For large BSS
12125         sections to the end of the list of BSS sections.
12126         * symtab.h (class Symbol): Declare is_common_shndx.
12127         (Symbol::is_defined): Check Symbol::is_common_shndx.
12128         (Symbol::is_common): Likewise.
12129         (class Symbol_table): Define enum Commons_section_type.  Update
12130         declarations.  Add small_commons_ and large_commons_ fields.
12131         * symtab.cc (Symbol::is_common_shndx): New function.
12132         (Symbol_table::Symbol_table): Initialize new fields.
12133         (Symbol_table::add_from_object): Put small and large common
12134         symbols in the right list.
12135         (Symbol_table::sized_finalized_symbol): Check
12136         Symbol::is_common_shndx.
12137         (Symbol_table::sized_write_globals): Likewise.
12138         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12139         common symbol lists.  Don't call do_allocate_commons_list if the
12140         list is empty.
12141         (Symbol_table::do_allocate_commons_list): Remove is_tls
12142         parameter.  Add comons_section_type parameter.  Change all
12143         callers.  Handle small and large common symbols.
12144         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12145         Symbol::is_common_shndx.
12146         * resolve.cc (symbol_to_bits): Likewise.
12147         * target.h (Target::small_common_shndx): New function.
12148         (Target::small_common_section_flags): New function.
12149         (Target::large_common_shndx): New function.
12150         (Target::large_common_section_flags): New function.
12151         (Target::new_output_section): New function.
12152         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12153         small_common_section_flags, and large_common_section_flags
12154         fields.
12155         (Target::do_new_output_section): New virtual function.
12156         * arm.cc (Target_arm::arm_info): Initialize new fields.
12157         * i386.cc (Target_i386::i386_info): Likewise.
12158         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12159         Likewise.
12160         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12161         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12162         (Target_x86_64::do_new_output_section): New function.
12163         * configure.ac: Define conditional MCMODEL_MEDIUM.
12164         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12165         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12166         (large_LDFLAGS): Define.
12167         * testsuite/large.c: New file.
12168         * testsuite/testfile.cc (Target_test::test_target_info):
12169         Initialize new fields.
12170         * configure, testsuite/Makefile.in: Rebuild.
12171
12172 2009-06-05  Doug Kwan  <dougkwan@google.com>
12173
12174         * Makefile.am (CCFILES): Add target.cc.
12175         * Makefile.in: Regenerate.
12176         * i386.cc (class Target_i386): Define new virtual method to
12177         override do_is_local_label_name in parent.
12178         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12179         local symbols if --discard-locals or -X is given.
12180         * options.h (class General_options): Declare new options
12181         '--discard-locals' and '-X' for discarding locals.
12182         * target.h (class Target): Define new methods is_local_label_name.
12183         Declare new virtual method do_is_local_label_name.
12184         * target.cc: New file.
12185         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12186         (check_SCRIPTS): Add discard_locals_test.sh.
12187         (check_DATA): Add discard_local_tests.syms.
12188         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12189         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12190         * testsuite/Makefile.in: Regenerate.
12191         * testsuite/discard_locals_test.c: New file.
12192         * testsuite/discard_locals_test.sh: Same.
12193
12194 2009-06-05  Doug Kwan  <dougkwan@google.com>
12195
12196         * object.cc (Sized_relobj::Sized_relobj): Initialize
12197         discarded_eh_frame_shndx_ to -1U.
12198         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12199         section.
12200         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12201         a discarded .eh_frame section.
12202         (Sized_relobj::do_finalize_local_symbols): Ditto.
12203         * object.h (class Sized_relobj): Declare new member
12204         discarded_eh_frame_shndx_.
12205         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12206         (local_labels_test.o, local_labels_test): New rules.
12207         * testsuite/Makefile.in: Regenerate.
12208
12209 2009-06-04  Doug Kwan  <dougkwan@google.com>
12210
12211         * layout.cc (Layout::section_name_mapping): Add mapping for
12212         special ARM sections.
12213
12214 2009-06-03  Doug Kwan  <dougkwan@google.com>
12215
12216         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12217         (utils::has_overflow): Same.
12218
12219 2009-06-03  Ian Lance Taylor  <iant@google.com>
12220
12221         * layout.cc (Layout::section_name_mapping): New array, replacing
12222         Layout::linkonce_mapping.
12223         (Layout::section_name_mapping_count): New variable, replacing
12224         Layout::linkonce_mapping_count.
12225         (Layout::linkonce_output_name): Remove.
12226         (Layout::output_section_name): Rewrite.
12227         * layout.h (class Layout): Rename Linkonce_mapping to
12228         Section_name_mapping, linkonce_mapping to section_name_mapping,
12229         linkonce_mapping_count to section_name_mapping_count.  Don't
12230         declare linkonce_output_name.
12231
12232 2009-06-03  Doug Kwan  <dougkwan@google.com>
12233
12234         * gold/arm.cc (namespace utils): New.
12235         (Target_arm::reloc_is_non_pic): Define new method.
12236         (class Arm_relocate_functions): New.
12237         (Target_arm::Relocate::relocate): Handle relocation types used by
12238         Android.
12239
12240 2009-06-03  Ian Lance Taylor  <iant@google.com>
12241
12242         * arm.cc (Target_arm::scan::global): Use || instead of |.
12243
12244 2009-06-02  Doug Kwan  <dougkwan@google.com>
12245
12246         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12247         issued_non_pic_error_.
12248         (class Target_arm::Scan): Declare new method check_non_pic.
12249         Define new method symbol_needs_plt_entry.
12250         Declare new data member issued_non_pic_error_.
12251         (class Target_arm::Relocate): Declare new method
12252         should_apply_static_reloc.
12253         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12254         (Target_arm::Scan::check_non_pic): Define new method.
12255         (Target_arm::Scan::local): Handle a small subset of reloc types used
12256         by Android.
12257         (Target_arm::Scan::local): Same.
12258         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12259
12260 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12261
12262         * incremental.cc (Incremental_inputs::report_command_line): Filter
12263         out --incremental-* options.
12264
12265 2009-05-29  Doug Kwan  <dougkwan@google.com>
12266
12267         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12268         template class.
12269         (class Target_arm): Update comment.
12270         (Target_arm::Target_arm): Initialize new data members GOT_,
12271         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12272         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12273         and Target_arm::rel_dyn_section.
12274         Declare new_enum Target_arm::Got_type.
12275         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12276         and DYNBSS_.
12277         Update commments for member do_dynsym_value.
12278         (Target_arm::got_size, Target_arm::plt_section,
12279         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12280         new methods inside class defintion.
12281         (Target_arm::got_section): Define new method.
12282         (Target_arm::rel_dyn_section): Same.
12283         (Output_data_plt_arm): New template class.
12284         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12285         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12286         (Output_data_plt_arm::add_entry): Same.
12287         (Output_data_plt_arm::first_plt_entry): Define new
12288         static data member for PLT instruction template.
12289         (Output_data_plt_arm::plt_entry): Same.
12290         (Output_data_plt_arm::do_write): Define new method.
12291         (Target_arm::make_plt_entry): Same.
12292         (Target_arm::do_finalize_sections): Same.
12293         (Target_arm::do_dynsym_value): Same.
12294
12295 2009-05-28  Doug Kwan  <dougkwan@google.com>
12296
12297         * Makefile.am (TARGETSOURCES): Add arm.cc.
12298         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12299         * Makefile.in: Regenerate.
12300         * arm.cc: New file.
12301         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12302
12303 2009-05-26  Doug Kwan  <dougkwan@google.com>
12304
12305         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12306         (General_options::check_excluded_libs): Strip off directories in
12307         archive name before matching like GNU ld does.
12308         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12309         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12310         (exclude_libs_test_LDFLAGS): Add linker option
12311         -Wl,--exclude-libs,libexclude_libs_test_3
12312         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12313         an explicit archive without using -l.
12314         (alt/libexclude_libs_test_3.a): New make rule.
12315         * testsuite/Makefile.in: Regenerate.
12316         * testsuite/exclude_libs_test.c : Declare lib3_default().
12317         (main): Call it.
12318         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12319         * exclude_libs_test_3.c: New file.
12320
12321 2009-05-26  Nick Clifton  <nickc@redhat.com>
12322
12323         * po/id.po: New Indonesian translation.
12324         * po/gold.pot: Updated template file.
12325
12326 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12327
12328         * testsuite/Makefile.am: Add -ffunction-sections to compile
12329         gc_comdat_test files.  Add -Wl,--gc-sections to build
12330         gc_comdat_test.
12331         * testsuite/Makefile.in: Regenerate.
12332         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12333
12334 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12335
12336         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12337         kept comdat section was garbage collected.
12338         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12339         * testsuite/Makefile.in: Regenerate.
12340         * testsuite/gc_comdat_test.sh: New file.
12341         * testsuite/gc_comdat_test_1.cc: New file.
12342         * testsuite/gc_comdat_test_2.cc: New file.
12343
12344 2009-05-19  Doug Kwan  <dougkwan@google.com>
12345
12346         * archive.cc (Archive::Archive): Move constructor from archive.h
12347         to here.  Initialize no_export_.
12348         (Archive::get_elf_object_for_member): Set no_export flag of object.
12349         * archive.h (Archive::Archive): Move constructor body to
12350         archive.cc.
12351         (Archive::no_export): New method.
12352         (Archive::no_export_): New field.
12353         * object.h (Object::Object): Initialize no_export_ to false.
12354         (Object::no_export, Object::set_no_export): New methods.
12355         (Object::no_export_): New field.
12356         * options.cc (General_options::parse_exclude_libs): New method.
12357         (General_options::check_excluded_libs) Same.
12358         * options.h (exclude_libs): New option.
12359         (General_options::check_excluded_libs): New method declaration.
12360         (General_options::excluded_libs_): New field.
12361         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12362         default or protected visibility if an object has no-export flag set.
12363         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12364         (check_SCRIPTS): Add exclude_libs_test.sh.
12365         (check_DATA): Add exclude_libs_test.syms.
12366         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12367         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12368         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12369         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12370         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12371         libexclude_libs_test_2.a): New rules.
12372         * testsuite/Makefile.in: Regenerate.
12373         * testsuite/exclude_libs_test.c: New file.
12374         * testsuite/exclude_libs_test.sh: Ditto.
12375         * testsuite/exclude_libs_test_1.c: Ditto.
12376         * testsuite/exclude_libs_test_2.c: Ditto.
12377
12378 2009-05-15  Ian Lance Taylor  <iant@google.com>
12379
12380         * configure.ac: Check for declarations for cases where libiberty.h
12381         checks HAVE_DECL_xxx.
12382         * configure, config.in: Rebuild.
12383
12384 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12385
12386         * gold.h (Incremental_argument_list): Remove (invalid) forward
12387         declaration.
12388         * incremental.cc (Incremental_inputs::report_achive): New method.
12389         (Incremental_inputs::report_object): New method.
12390         (Incremental_inputs::report_script): New method.
12391         (Incremental_inputs::finalize_inputs): New method.
12392         (Incremental_inputs::finalize): Call finalize_inputs().
12393         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12394         Create inputs entries.
12395         * incremental.h (Incremental_input_type): New enum.
12396         (Incremental_inputs::Incremental_input): Initialize new fields.
12397         (Incremental_inputs::report_inputs): New method.
12398         (Incremental_inputs::report_achive): New method.
12399         (Incremental_inputs::report_object): New method.
12400         (Incremental_inputs::report_script): New method.
12401         (Incremental_inputs::finalize_inputs): New method.
12402         (Incremental_inputs::Input_info): New struct.
12403         (Incremental_inputs::Input_info_map): New typedef.
12404         (Incremental_inputs::lock_): New field.
12405         (Incremental_inputs::Inputs_): New field.
12406         (Incremental_inputs::Inputs_map): New field.
12407         * main.cc (main): Call Incremental_input::report_inputs.
12408         * options.h (Input_argument_list): Typedef moved from
12409         Input_arguments.
12410         (Input_file_group::Files): Remove, use ::Input_argument_list.
12411         (Input_file_group::Input_argument_list): Remove, use
12412         ::Input_argument_list.
12413         * plugin.cc (Plugin_manager::add_input_file): Add error in
12414         incremental build.
12415         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12416         functions.
12417         * script.cc (read_input_script): Call
12418         Incremental_input::report_script.
12419         * script.h (Script_info): New class.
12420
12421 2009-04-27  Ian Lance Taylor  <iant@google.com>
12422
12423         * x86_64.cc (do_adjust_output_section): Set entsize to
12424         plt_entry_size.
12425
12426 2009-04-23  Elliott Hughes  <enh@google.com>
12427
12428         * output.cc (Output_file::close): After short writes, continue
12429         writing from the correct offset in the buffer being written.
12430
12431 2009-04-23  Chris Demetriou  <cgd@google.com>
12432
12433         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12434         * configure: Regenerate.
12435         * config.in: Regenerate.
12436         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12437         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12438
12439 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12440
12441         * incremental.cc (Incremental_inputs_header_data): Renamed from
12442         Incremental_input_header_data.
12443         (Incremental_inputs_header_data::data_size): New field.
12444         (Incremental_inputs_header_data::put_input_file_count): Renamed
12445         from input_file_count.
12446         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12447         from command_line_offset.
12448         (Incremental_inputs_header_data::put_reserved): Renamed from
12449         put_reserved.
12450         (Incremental_inputs_entry_data): Renamed from
12451         Incremental_input_entry_data.
12452         (Incremental_inputs_entry_data::data_size): New field.
12453         (Incremental_inputs::report_command_line): New method.
12454         (Incremental_inputs::finalize): New method.
12455         (Incremental_inputs::create_incremental_inputs_data): New method.
12456         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12457         * incremental.h: New file.
12458         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12459         (Layout::finalize): Create incremental inputs section in
12460         incremental builds.
12461         (Layout::create_incremental_info_sections): New method.
12462         * layout.h (Layout::incremental_inputs): New method.
12463         (Layout::create_incremental_info_sections): New method.
12464         (Layout::incremental_inputs_): New field.
12465         * main.cc (main): Notify Incremental_input of the command line.
12466
12467 2009-04-01  Ian Lance Taylor  <iant@google.com>
12468             Mikolaj Zalewski  <mikolajz@google.com>
12469
12470         * gold.h (reserve_unordered_map): Define, three versions, one for
12471         each version of Unordered_map.
12472         * layout.cc (Layout::Layout): Remove options parameter.  Add
12473         number_of_input_files parameter.  Don't initialize options_.
12474         Initialize number_of_input_files_ and resized_signatures_.  Move
12475         sections_are_attached_.
12476         (Layout::layout_group): Reserve space for group_signatures_.
12477         (Layout::find_or_add_kept_section): Change name parameter to be a
12478         reference.  Resize signatures_ map when it gets large enough.
12479         (Layout::layout_eh_frame): Use parameters->options() instead of
12480         this->options_.
12481         (Layout::make_output_section): Likewise.
12482         (Layout::attach_allocated_section_to_segment): Likewise.
12483         (Layout::finalize, Layout::create_executable_stack): Likewise.
12484         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12485         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12486         * layout.h (class Layout): Update declarations.  Remove options_
12487         field.  Add number_of_input_files_ and resized_signatures_
12488         fields.  Move sections_are_attached_ field.
12489         * main.cc (main): Pass number of input files to Layout
12490         constructor.  Don't pass options.
12491
12492 2009-03-30  Ian Lance Taylor  <iant@google.com>
12493
12494         * ffsll.c (ffsll): Correct implementation.
12495
12496 2009-03-27  Ian Lance Taylor  <iant@google.com>
12497
12498         * ffsll.c: New file.
12499         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12500         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12501         * ftruncate.c (ftruncate): Declare before definition.
12502         * mremap.c (mremap): Likewise.
12503         * pread.c (pread): Likewise.
12504         * configure, Makefile.in, config.in: Rebuild.
12505
12506         * mremap.c: New file.
12507         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12508         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12509         (mremap): Declare if HAVE_MREMAP is not defined.
12510         * configure, Makefile.in, config.in: Rebuild.
12511
12512 2009-03-27  Cary Coutant  <ccoutant@google.com>
12513
12514         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12515         position independent.
12516         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12517         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12518
12519 2009-03-24  Cary Coutant  <ccoutant@google.com>
12520
12521         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12522         an executable.
12523         (needs_dynamic_reloc): Likewise.
12524
12525 2009-03-24  Ian Lance Taylor  <iant@google.com>
12526
12527         * yyscript.y (file_cmd): Recognize EXTERN.
12528         (extern_name_list, extern_name_list_body): New nonterminals.
12529         * script.cc (script_add_extern): Define.
12530         * script-c.h (script_add_extern): Declare.
12531
12532 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12533
12534         * object.cc (is_elf_object): Define.
12535         * object.h (is_elf_object): Declare.
12536         * archive.cc (Archive::get_elf_object_for_member): Call
12537         is_elf_object.
12538         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12539
12540 2009-03-24  Elliott Hughes  <enh@google.com>
12541
12542         * output.cc (Output_file::map_anonymous): Define.
12543         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12544         try an anonymous one.  Report the size if the mmap fails.
12545         * output.h (class Output_file): Declare map_anonymous.
12546
12547 2009-03-24  Ian Lance Taylor  <iant@google.com>
12548
12549         * target-select.cc (instantiate_target): Don't acquire the lock if
12550         the instantiated_target_ field has already been set.
12551
12552 2009-03-23  Ian Lance Taylor  <iant@google.com>
12553
12554         * gold-threads.h (class Initialize_lock): Define.
12555         * gold-threads.cc (class Initialize_lock_once): Define.
12556         (initialize_lock_control): New static variable.
12557         (initialize_lock_pointer): New static variable.
12558         (initialize_lock_once): New static function.
12559         (Initialize_lock::Initialize_lock): Define.
12560         (Initialize_lock::initialize): Define.
12561         * target-select.h: Include "gold-threads.h".
12562         (class Target_selector): Add lock_ and initialize_lock_ fields.
12563         Don't define instantiate_target, just declare it.
12564         * target-select.cc (Target_selector::Target_selector): Initialize
12565         new fields.
12566         (Target_selector::instantiate_target): Define.
12567         * descriptors.h: Include "gold-threads.h".
12568         (class Descriptors): Add initialize_lock_ field.
12569         * descriptors.cc (Descriptors::Descriptors): Initialize new
12570         field.
12571         (Descriptors::open): Use initialize_lock_ field
12572         * errors.h (class Errors): Add initialize_lock_ field.
12573         * errors.cc (Errors::Errors): Initialize new field.
12574         (Errors::initialize_lock): Use initialize_lock_ field.
12575         * powerpc.cc (class Target_selector_powerpc): Remove
12576         instantiated_target_ field.  In do_recognize call
12577         instantiate_target rather than do_instantiate_target.  In
12578         do_instantiate_target just allocate a new target.
12579         * sparc.cc (class Target_selector_sparc): Likewise.
12580
12581         * freebsd.h: New file.
12582         * i386.cc: Include "freebsd.h".
12583         (Target_i386): Derive from Target_freebsd rather than
12584         Sized_target.
12585         (Target_selector_i386): Derive from Target_selector_freebsd rather
12586         than Target_selector.
12587         * x86_64.cc: Include "freebsd.h".
12588         (Target_x86_64): Derive from Target_freebsd rather than
12589         Sized_target.
12590         (Target_selector_x86_64): Derive from Target_selector_freebsd
12591         rather than Target_selector.
12592         * target.h (class Target): Add adjust_elf_header and
12593         do_adjust_elf_header.
12594         * output.cc (Output_file_header:: do_sized_write): Call target
12595         adjust_elf_header routine.
12596         * configure.tgt: Set targ_osabi.
12597         * configure.ac: Define GOLD_DEFAULT_OSABI.
12598         * parameters.cc (Parameters::default_target): Pass
12599         GOLD_DEFAULT_OSABI to select_target.
12600         * target-select.h (class Target_selector): Make instantiate_target
12601         protected rather than private.
12602         * Makefile.am (HFILES): Add freebsd.h.
12603         * configure, Makefile.in, config.in: Rebuild.
12604
12605         * merge.cc (do_add_input_section): Correct pend value.  Change
12606         message about last entry not being null terminated from error to
12607         warning.
12608
12609 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12610
12611         * incremental.cc: New file.
12612         * Makefile.am (CCFILES): Add incremental.cc.
12613         * Makefile.in: Rebuild.
12614
12615 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12616
12617         * layout.cc (Layout::output_section_name): Preserve names
12618         of '.note.' sections.
12619
12620 2009-03-19  Ian Lance Taylor  <iant@google.com>
12621
12622         * descriptors.cc (Descriptors::open): Check that the options are
12623         valid before using them.
12624
12625 2009-03-18  Ian Lance Taylor  <iant@google.com>
12626
12627         * script-sections.h: Include <list>.
12628         (class Script_sections): Change Sections_elements from std::vector
12629         to std::list.  Typedef public Elements_iterator.  Add
12630         orphan_section_placement_, data_segment_align_start_, and
12631         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12632         field.
12633         * script-sections.cc (class Orphan_section_placement): New class.
12634         (class Sections_element): Add virtual functions is_relro and
12635         orphan_section_init.  Remove virtual function place_orphan_here.
12636         (class Output_section_definition): Add is_relro and
12637         orphan_section_init.  Remove place_orphan_here.
12638         (class Orphan_output_section): Likewise.
12639         (Script_sections::Script_sections): Update for field changes.
12640         (Script_sections::data_segment_align): Set saw_data_segment_align_
12641         and data_segment_align_start_, not data_segment_align_index.
12642         (Script_sections::data_segment_relro_end): Check
12643         saw_data_segment_align_.  Use data_segment_align_start_ rather
12644         than data_segment_align_index_.
12645         (Script_sections::place_orphan): Rewrite to use
12646         Orphan_section_placement.
12647
12648 2009-03-17  Ian Lance Taylor  <iant@google.com>
12649
12650         * archive.cc (Archive::add_symbols): Check for a version attached
12651         to the symbol name in the archive map.
12652         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12653         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12654         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12655         (ver_test_11.a): New target.
12656         * testsuite/Makefile.in: Rebuild.
12657
12658         * configure.ac: Check for chsize and posix_fallocate.  Replace
12659         ftruncate.
12660         * ftruncate.c: New file, from gnulib.
12661         * output.cc (posix_fallocate): Define dummy version if not
12662         HAVE_POSIX_FALLOCATE.
12663         (Output_file::map): Call posix_fallocate rather than lseek and
12664         write.
12665         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12666         * configure, Makefile.in, config.in: Rebuild.
12667
12668 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12669
12670         * layout.h (Layout::create_note): Add section_name parameter.
12671         * layout.cc (Layout::create_note): Likewise.
12672         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12673
12674 2009-03-17  Ian Lance Taylor  <iant@google.com>
12675
12676         * descriptors.cc: Include "options.h".
12677         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12678         (Descriptors::open): Always use O_CLOEXEC when opening a new
12679         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12680         then set FD_CLOEXEC.
12681
12682         * sparc.cc (class Target_sparc): Add has_got_section.
12683         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12684         make sure we have a GOT section.
12685
12686         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12687         (Target_sparc::Scan::local): Likewise.
12688         (Target_sparc::Scan::global): Likewise.
12689         (Target_sparc::Relocate::relocate): Likewise.
12690         (Target_sparc::Relocate::relocate_tls): Likewise.
12691
12692         * symtab.cc (Symbol_table::define_default_version): New function,
12693         broken out of add_from_object.
12694         (Symbol_table::add_from_object): Call define_default_version.
12695         (Symbol_table::define_special_symbol): Add resolve_oldsym
12696         parameter.  Change all callers.  If the version for a symbol comes
12697         from a version script, resolve it with the symbol with the same
12698         name with no version.  Also add the symbol without a version if
12699         appropriate.
12700         (do_define_in_output_data): If resolving with oldsym, don't delete
12701         sym.
12702         (do_define_in_output_segment): Likewise.
12703         (do_define_as_constant): Likewise.
12704         * symtab.h (class Symbol_table): Update declarations.
12705
12706 2009-03-13  Ian Lance Taylor  <iant@google.com>
12707
12708         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12709         (Read_symbols::requeue): New function.
12710         (Read_symbols::do_read_symbols): If make_elf_object fails because
12711         the target type is not configured, and the file was searched for,
12712         issue a warning and retry with the next directory.
12713         (Add_symbols::run): If the file has an incompatible format, and
12714         it was searched for, requeue the Read_symbols task.  On error,
12715         release the object.
12716         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12717         dirindex parameter to constructor.  Change all callers.  Declare
12718         incompatible_warning and requeue.
12719         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12720         input_argument_ and input_group_ fields.  Add them to
12721         constructor.  Change all callers.
12722         (class Read_script): Add dirindex_ field.  Add it to constructor.
12723         Change all callers.
12724         * archive.cc (Archive::setup): Remove input_objects parameter.
12725         Change all callers.
12726         (Archive::get_file_and_offset): Likewise.
12727         (Archive::read_all_symbols): Likewise.
12728         (Archive::read_symbols): Likewise.
12729         (Archive::get_elf_object_for_member): Remove input_objects
12730         parameter.  Add punconfigured parameter.  Change all callers.
12731         (Archive::add_symbols): Change return type to bool.  Check return
12732         value of include_member.
12733         (Archive::include_all_members): Likewise.
12734         (Archive::include_member): Change return type to bool.  Return
12735         false if first included object has incompatible target.  Set
12736         included_member_ field.
12737         (Add_archive_symbols::run): If add_symbols returns false, requeue
12738         Read_symbols task.
12739         * archive.h (class Archive): Add included_member_ field.
12740         Initialize it in constructor.  Add input_file and searched_for
12741         methods.  Update declarations.
12742         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12743         input_argument_ fields.  Add them to constructor.  Change all
12744         callers.
12745         * script.cc: Include "target-select.h".
12746         (class Parser_closure): Add skip_on_incompatible_target_ and
12747         found_incompatible_target_ fields.  Add
12748         skip_on_incompatible_target parameter to constructor.  Change all
12749         callers.  Add methods skip_on_incompatible_target,
12750         clear_skip_on_incompatible_target, found_incompatible_target, and
12751         set_found_incompatible_target.
12752         (read_input_script): Add dirindex parameter.  Change all callers.
12753         If parser finds an incompatible target, requeue Read_symbols
12754         task.
12755         (script_set_symbol): Clear skip_on_incompatible_target in
12756         closure.
12757         (script_add_assertion, script_parse_option): Likewise.
12758         (script_start_sections, script_add_phdr): Likewise.
12759         (script_check_output_format): New function.
12760         * script.h (read_input_script): Update declaration.
12761         * script-c.h (script_check_output_format): Declare.
12762         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12763         (ignore_cmd): Remove OUTPUT_FORMAT.
12764         * fileread.cc (Input_file::Input_file): Add explicit this.
12765         (Input_file::will_search_for): New function.
12766         (Input_file::open): Add pindex parameter.  Change all callers.
12767         * fileread.h (class Input_file): Add input_file_argument method.
12768         Declare will_search_for.  Update declarations.
12769         * object.cc (make_elf_object): Add punconfigured parameter.
12770         Change all callers.
12771         * object.h (class Object): Make input_file public.  Add
12772         searched_for method.
12773         (make_elf_object): Update declaration.
12774         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12775         restart search.
12776         * dirsearch.h (class Dirsearch): Update declaration.
12777         * options.h (class General_options): Add --warn-search-mismatch.
12778         * parameters.cc (Parameters::is_compatible_target): New function.
12779         * parameters.h (class Parameters): Declare is_compatible_target.
12780         * workqueue.cc (Workqueue::add_blocker): New function.
12781         * workqueue.h (class Workqueue): Declare add_blocker.
12782
12783         * fileread.cc (Input_file::open): Remove options parameter.
12784         Change all callers.
12785         (Input_file::open_binary): Likewise.
12786         * script.cc (read_input_script): Likewise.
12787         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12788         options parameter from constructor.  Change all callers.
12789         (class Read_script): Likewise.
12790         * fileread.h (class Input_file): Update declarations.
12791         * script.h (read_input_script): Update declaration.
12792
12793 2009-03-10  Nick Clifton  <nickc@redhat.com>
12794
12795         * po/es.po: New Spanish translation.
12796
12797 2009-03-06  Cary Coutant  <ccoutant@google.com>
12798
12799         * options.cc (parse_short_option): Keep dash_z from registering itself.
12800
12801 2009-03-03  Ian Lance Taylor  <iant@google.com>
12802
12803         PR 9918
12804         * target-reloc.h (relocate_section): Pass output_section to
12805         relocate.
12806         * i386.cc (Target_i386::should_apply_static_reloc): Add
12807         output_section parameter.  Change all callers.
12808         (Target_i386::Relocate::relocate): Add output_section parameter.
12809         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12810         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12811         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12812         * testsuite/two_file_shared.sh: New script.
12813         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12814         (check_DATA): Add two_file_shared.dbg.
12815         (two_file_shared.dbg): New target.
12816         * testsuite/Makefile.in: Rebuild.
12817
12818 2009-03-01  Ian Lance Taylor  <iant@google.com>
12819
12820         * configure.ac: Check for byteswap.h.
12821         * configure: Rebuild.
12822         * config.in: Rebuild.
12823
12824 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12825
12826         * layout.cc (Layout::find_or_add_kept_section): New function.
12827         (Layout::add_comdat): Removed.
12828         * layout.h (struct Kept_section): Move out of class Layout.
12829         Remove trailing underscores from field names.  Add group_sections
12830         field.  Rename group_ field to is_group.  Change all uses.
12831         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12832         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12833         comdat_groups_ field.
12834         (Sized_relobj::include_section_group): Use
12835         find_or_add_kept_section and Kept_section::group_sections.
12836         (Sized_relobj::include_linkonce_section): Likewise.
12837         * object.cc (class Sized_relobj): Don't define Comdat_group or
12838         Comdat_group_table.  Remove find_comdat_group and
12839         add_comdat_group.  Remove comdat_groups_ field.
12840         * plugin.cc (include_comdat_group): Use
12841         Layout::find_or_add_kept_section.
12842
12843 2009-02-28  Ian Lance Taylor  <iant@google.com>
12844
12845         * README: --gc-sections and map files are now supported.  Document
12846         some build requirements.
12847
12848         PR 6992
12849         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12850         relocatable link set the value of the section symbol to zero.
12851         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12852         relocatable link don't include the section address in the local
12853         symbol value.
12854
12855 2009-02-27  Ian Lance Taylor  <iant@google.com>
12856
12857         PR 6811
12858         * options.h (class Search_directory): Add is_system_directory.
12859         (class General_options): Declare is_in_system_directory.
12860         * options.cc (get_relative_sysroot): Make static.
12861         (get_default_sysroot): Make static.
12862         (General_optoins::is_in_system_directory): New function.
12863         * fileread.cc (Input_file::is_in_system_directory): New function.
12864         * fileread.h (class Input_file): Declare is_in_system_directory.
12865         * object.h (class Object): Add is_in_system_directory.
12866         (class Input_objects): Remove system_library_directory_ field.
12867         * object.cc (Input_objects::add_object): Don't set
12868         system_library_directory_.
12869         (input_objects::found_in_system_library_directory): Remove.
12870         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12871         parameter.  Change all callers.
12872         (Symbol_table::sized_write_globals): Likewise.
12873         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12874         Call Object::is_in_system_directory.
12875         * symtab.h (class Symbol_table): Update declarations.
12876
12877         PR 5990
12878         * descriptors.h (Open_descriptor): Add is_on_stack field.
12879         * descriptors.cc (Descriptors::open): If the descriptor is on the
12880         top of the stack, remove it.  Initialize is_on_stack field.
12881         (Descriptors::release): Only add pod to stack if it is not on the
12882         stack already.
12883         (Descriptors::close_some_descriptor): Clear stack_next and
12884         is_on_stack fields.
12885
12886         PR 7091
12887         * output.cc (Output_section::find_starting_output_address): Rename
12888         from starting_output_address; add PADDR parameter; change return
12889         type.
12890         * output.h (class Output_section): Declare
12891         find_starting_output_address instead of starting_output_address.
12892         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12893         section symbol for which we can't find a merge section.
12894
12895         PR 9836
12896         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12897         hidden or internal, force the symbol to be local.
12898         * resolve.cc (Symbol::override_visibility): Define.
12899         (Symbol::override_base): Use override_visibility.
12900         (Symbol_table::resolve): Likewise.
12901         (Symbol::override_base_with_special): Likewise.
12902         (Symbol_table::override_with_special): If the visibility is hidden
12903         or internal, force the symbol to be local.
12904         * symtab.h (class Symbol): Add set_visibility and
12905         override_visibility.
12906         * testsuite/ver_test_1.sh: New file.
12907         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12908         (check_DATA): Add ver_test_1.syms.
12909         (ver_test_1.syms): New target.
12910         * testsuite/Makefile.in: Rebuild.
12911
12912 2009-02-25  Cary Coutant  <ccoutant@google.com>
12913
12914         * layout.cc (Layout::choose_output_section): Don't rename sections
12915         when using a linker script that has a SECTIONS clause.
12916         * Makefile.in: Regenerate.
12917
12918         * testsuite/Makefile.am (script_test_5.sh): New test case.
12919         * testsuite/Makefile.in: Regenerate.
12920         * testsuite/script_test_5.cc: New file.
12921         * testsuite/script_test_5.sh: New file.
12922         * testsuite/script_test_5.t: New file.
12923
12924 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12925
12926         * archive.cc (Archive::include_member): Update calls to add_symbols.
12927         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12928         the Layout argument.
12929         * dynobj.h (do_add_symbols): Add the Layout argument.
12930         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12931         Layout argument.
12932         * object.h (Object::add_symbols): Add the Layout argument.
12933         (Object::do_add_symbols): Add the Layout argument.
12934         (Sized_relobj::do_add_symbols): Add the Layout argument.
12935         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12936         Unify the two versions.
12937         (Add_plugin_symbols): Remove.
12938         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12939         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12940         (Add_plugin_symbols): Remove.
12941         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12942         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12943         (Add_symbols::run): Make it work with Pulginobj.
12944
12945 2009-02-06  Ian Lance Taylor  <iant@google.com>
12946
12947         * object.cc (Sized_relobj::do_layout): Make info message start
12948         with lower case letter.
12949
12950 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12951
12952         * binary.cc: Fix file comment.
12953
12954         * options.h (enum Incremental_disposition): Define.
12955         (class General_options): Add new options: --incremental,
12956         --incremental_changed, --incremental_unchanged,
12957         --incremental_unknown.  Add incremental_disposition_ and
12958         implicit_incremental_ fields.
12959         (General_options::incremental_disposition): New function.
12960         (class Position_dependent_options): Add incremental_disposition
12961         option.
12962         (Position_dependent_options::copy_from_options): Set incremental
12963         dispositions.
12964         * options.cc (General_options::parse_incremental_changed): New
12965         function.
12966         (General_options::parse_incremental_unchanged): New function.
12967         (General_options::parse_incremental_unknown): New function.
12968         (General_options::General_options): Initialize new fields
12969         incremental_disposition_ and implicit_incremental_.
12970         (General_options::finalize): Check for uasge of --incremental-*
12971         without --incremental.
12972
12973 2009-02-06  Chris Demetriou  <cgd@google.com>
12974
12975         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12976         pointer and to report location as the file name associated with
12977         the symbol.
12978         (gold_undefined_symbol_at_location): New function to replace the
12979         old gold_undefined_symbol functionality.
12980         * target-reloc.h (relocate_section): Update to use
12981         gold_undefined_symbol_at_location.
12982         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12983         Call gold_undefined_symbol function rather than gold_error.
12984         * errors.h (Errors::undefined_symbol): Take location as a
12985         string, rather than calculating it from a relocation.
12986         * errors.cc (Errors::fatal): Print "fatal error:" before the
12987         formatted message.
12988         (Errors::error, Errors::error_at_location): Print "error: "
12989         before the formatted message.
12990         (Errors::undefined_symbol): Take location as a string, rather
12991         than calculating it from a relocation.
12992         (gold_undefined_symbol_at_location): New function akin to
12993         old gold_undefined_symbol, calculates location from relocation.
12994         (gold_undefined_symbol): Change to take only a Symbol pointer
12995         and to report location as the file name associated with the symbol.
12996         * testsuite/debug_msg.sh: Update for changed error messages.
12997         * testsuite/undef_symbol.sh: Likewise.
12998
12999 2009-02-04  Duncan Sands  <baldrick@free.fr>
13000
13001         PR 9812
13002         * reduced_debug_output.h
13003         (Output_reduced_debug_abbrev_section::failed): Use format for
13004         gold_warning.
13005         (Output_reduced_debug_info_section::faild): Likewise.
13006
13007 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13008
13009         * script.cc (Lazy_demangler): New class.
13010         (Version_script_info::get_symbol_version_helper): Demangle a
13011         symbol only once.
13012
13013 2009-01-29  Cary Coutant  <ccoutant@google.com>
13014
13015         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13016         to __tls_get_addr.
13017         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13018
13019 2009-01-28  Ian Lance Taylor  <iant@google.com>
13020
13021         * version.cc (version_string): Bump to 1.9.
13022
13023         * gold.h: Include <cstring> and <stdint.h>.
13024         * version.cc: Include <cstdio>.
13025         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13026         warning.
13027         * reduced_debug_output.cc (insert_into_vector): Rename from
13028         Insert_into_vector; change all callers.  Use Swap_unaligned to
13029         avoid aliasing issue; remove union since it is unnecessary.
13030
13031 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13032
13033         * Makefile.am (CCFILES): Add gc.cc.
13034         (HFILES): Add gc.h.
13035         * Makefile.in: Regenerate.
13036         * gold.cc (Gc_runner): New class.
13037         (queue_initial_tasks): Call garbage collection related tasks
13038         when corresponding options are invoked.
13039         (queue_middle_gc_tasks): New function.
13040         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13041         processed early before laying out sections during garbage collection.
13042         * gold.h (queue_middle_gc_tasks): New function.
13043         (is_prefix_of): Move from "layout.cc".
13044         * i386.cc (Target_i386::gc_process_relocs): New function.
13045         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13046         * main.cc (main): Create object of class "Garbage_collection".
13047         * object.cc (Relobj::copy_symbols_data): New function.
13048         (Relobj::is_section_name_included): New function.
13049         (Sized_relobj::do_layout): Allow this function to be called twice
13050         during garbage collection and defer layout of section during the
13051         first call.
13052         * object.h (Relobj::get_symbols_data): New function.
13053         (Relobj::is_section_name_included): New function.
13054         (Relobj::copy_symbols_data): New function.
13055         (Relobj::set_symbols_data): New function.
13056         (Relobj::get_relocs_data): New function.
13057         (Relobj::set_relocs_data): New function.
13058         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13059         (Relobj::gc_process_relocs): New function.
13060         (Relobj::do_gc_process_relocs): New pure virtual function.
13061         (Relobj::sd_): New data member.
13062         (Sized_relobj::is_output_section_offset_invalid): New function.
13063         (Sized_relobj::do_gc_process_relocs): New function.
13064         * options.h (General_options::gc_sections): Modify to not be a no-op.
13065         (General_options::print_gc_sections): New option.
13066         * plugin.cc (Plugin_finish::run): Remove function call to
13067         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13068         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13069         * reloc.cc (Read_relocs::run): Add task to process relocs and
13070         determine unreferenced sections when doing garbage collection.
13071         (Gc_process_relocs): New class.
13072         (Sized_relobj::do_gc_process_relocs): New function.
13073         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13074         sections that are garbage collected.
13075         * reloc.h (Gc_process_relocs): New class.
13076         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13077         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13078         symbols whose corresponding sections are garbage collected.
13079         (Symbol_table::Symbol_table): Add new parameter for the garbage
13080         collection object.
13081         (Symbol_table::gc_mark_undef_symbols): New function.
13082         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13083         (Symbol_table::gc_mark_dyn_syms): New function.
13084         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13085         as garbage.
13086         (Symbol_table::add_from_object): Likewise.
13087         (Symbol_table::add_from_relobj): When building shared objects, do not
13088         treat externally visible symbols as garbage.
13089         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13090         table information for static and relocatable links.
13091         * symtab.h (Symbol_table::set_gc): New function.
13092         (Symbol_table::gc): New function.
13093         (Symbol_table::gc_mark_undef_symbols): New function.
13094         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13095         (Symbol_table::gc_mark_dyn_syms): New function.
13096         (Symbol_table::gc_): New data member.
13097         * target.h (Sized_target::gc_process_relocs): New pure virtual
13098         function.
13099         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13100         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13101
13102 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13103
13104         * options.h (General_options::gc_sections): Define as a no-op for now.
13105         (General_options::no_keep_memory): Ditto.
13106         (General_options::Bshareable): Define.
13107         * options.cc (General_options::finalize): Honor -Bshareable.
13108
13109 2009-01-20  Andreas Schwab  <schwab@suse.de>
13110
13111         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13112         read the value in the contents, since we don't use it.  Use the
13113         template endianness when writing.
13114         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13115
13116 2009-01-19  Andreas Schwab  <schwab@suse.de>
13117
13118         * configure.tgt (powerpc64-*): Fix targ_obj.
13119
13120 2009-01-15  Ian Lance Taylor  <iant@google.com>
13121
13122         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13123         local symbols when stripping all symbols.
13124
13125 2009-01-14  Cary Coutant  <ccoutant@google.com>
13126
13127         * output.cc (Output_reloc): Add explicit instantiations.
13128
13129 2009-01-14  Cary Coutant  <ccoutant@google.com>
13130
13131         * archive.cc (Archive::get_elf_object_for_member): Remove call
13132         to File_read::claim_for_plugin.
13133         * descriptors.cc (Descriptors::open): Remove reference to
13134         is_claimed.
13135         (Descriptors::claim_for_plugin): Remove.
13136         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13137         (Descriptors::is_claimed): Remove.
13138         (claim_descriptor_for_plugin): Remove.
13139         * fileread.cc (File_read::claim_for_plugin): Remove.
13140         * fileread.h (File_read::claim_for_plugin): Remove.
13141         (File_read::descriptor): Reopen descriptor if necessary.
13142         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13143         (Plugin_manager::all_symbols_read): Add task parameter. Change
13144         all callers.
13145         (Plugin_manager::get_input_file): New function.
13146         (Plugin_manager::release_input_file): New function.
13147         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13148         corresponding data member.
13149         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13150         and pass to base constructor. Change all callers.
13151         (get_input_file, release_input_file): New functions.
13152         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13153         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13154         (Plugin_manager::all_symbols_read): Add task parameter.
13155         (Plugin_manager::get_input_file): New function.
13156         (Plugin_manager::release_input_file): New function.
13157         (Plugin_manager::task_): New data member.
13158         (Pluginobj::Pluginobj): Add filesize parameter.
13159         (Pluginobj::filename): New function.
13160         (Pluginobj::descriptor): New function.
13161         (Pluginobj::filesize): New function.
13162         (Pluginobj::filesize_): New data member.
13163         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13164         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13165         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13166
13167         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13168         with archive libraries.
13169         * testsuite/Makefile.in: Regenerate.
13170         * testsuite/plugin_test.c (struct sym_info): New type.
13171         (get_input_file, release_input_file): New static variables.
13172         (onload): Capture new transfer vector entries.
13173         (claim_file_hook): Stop reading at end of file according to filesize.
13174         Factor out parsing of readelf output into separate function.
13175         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13176         APIs and get the source file name from the symbol table.  Convert
13177         source file name to corresponding object file name.  Print info
13178         message when adding new input files.
13179         (parse_readelf_line): New function.
13180         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13181         * testsuite/plugin_test_2.sh: Likewise.
13182         * testsuite/plugin_test_3.sh: Likewise.
13183         * testsuite/plugin_test_4.sh: New test case.
13184
13185 2009-01-07  Ian Lance Taylor  <iant@google.com>
13186
13187         * version.cc (version_string): Bump to 1.8.
13188
13189 2008-12-23  Cary Coutant  <ccoutant@google.com>
13190
13191         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13192         * plugin.cc (Plugin_manager::finish): Rename as
13193         layout_deferred_objects.  Move cleanup to separate function.
13194         (Plugin_manager::cleanup): New function.
13195         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13196         separately.
13197         * plugin.h (Plugin_manager::finish): Rename as
13198         layout_deferred_objects.
13199         (Plugin_manager::cleanup): New function.
13200         (Plugin_manager::cleanup_done): New field.
13201
13202 2008-12-23  Cary Coutant  <ccoutant@google.com>
13203
13204         * plugin.cc (is_visible_from_outside): New function.
13205         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13206         so we don't return "IR only" status for exported symbols or -r links.
13207
13208         * testsuite/Makefile.am (plugin_test_3): New test case.
13209         * testsuite/Makefile.in: Regenerate.
13210         * testsuite/plugin_test_3.sh: New file.
13211
13212 2008-12-22  Cary Coutant  <ccoutant@google.com>
13213
13214         * object.cc (Sized_relobj::layout_section): New function.
13215         (Sized_relobj::do_layout): Defer layout of input sections until after
13216         plugin has provided replacement files.
13217         (Sized_relobj::do_layout_deferred_sections): New function.
13218         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13219         (Relobj::layout_deferred_sections): New function.
13220         (Relobj::do_layout_deferred_sections): New function.
13221         (Sized_relobj::do_layout_deferred_sections): New function.
13222         (Sized_relobj::layout_section): New function.
13223         (Sized_relobj::Deferred_layout): New structure.
13224         (Sized_relobj::deferred_layout_): New field.
13225         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13226         Change all callers.  Layout deferred sections.
13227         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13228         references.
13229         (Plugin_hook::run): Move code from do_plugin_hook inline.
13230         (Plugin_hook::do_plugin_hook): Remove.
13231         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13232         (Plugin_manager::finish): Renamed, was cleanup.
13233         (Plugin_manager::should_defer_layout): New function.
13234         (Plugin_manager::add_deferred_layout_object): New function.
13235         (Plugin_manager::Deferred_layout_list): New type.
13236         (Plugin_manager::deferred_layout_objects_): New field.
13237         (Plugin_hook::do_plugin_hook): Remove.
13238
13239 2008-12-17  Ian Lance Taylor  <iant@google.com>
13240
13241         * options.h (class General_options): Add --no case for
13242         --export-dynamic.
13243
13244 2008-12-16  Cary Coutant  <ccoutant@google.com>
13245
13246         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13247         vector.
13248         (Plugin_manager::claim_file): Create plugin object even if
13249         plugin did not call the add_symbols callback.
13250         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13251         asking for more symbols than were added.
13252         * testsuite/Makefile.am (plugin_test_1): Add test case with
13253         no global symbols.
13254         (empty.syms): New target.
13255         * testsuite/Makefile.in: Regenerate.
13256         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13257         message. Don't call add_symbols if no globals.
13258         (all_symbols_read_hook): Don't provide replacement for empty
13259         claimed file.
13260
13261 2008-12-12  Ian Lance Taylor  <iant@google.com>
13262
13263         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13264         r_type == 0 for a local symbol with r_sym == 0.
13265         (scan_relocatable_relocs): Pass r_sym to
13266         local_non_section_strategy.
13267         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13268         r_sym parameter.
13269
13270         * configure.ac: Update test for TLS descriptors: they are
13271         supported as of glibc 2.9.
13272         * configure: Rebuild.
13273
13274 2008-12-11  Ian Lance Taylor  <iant@google.com>
13275
13276         PR 7091
13277         * target-reloc.h (Default_scan_relocatable_relocs): For each
13278         function, map r_type == 0 to RELOC_DISCARD.
13279
13280 2008-12-10  Cary Coutant  <ccoutant@google.com>
13281
13282         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13283         object to override a kept COMDAT group from a plugin object.
13284
13285 2008-12-09  Ian Lance Taylor  <iant@google.com>
13286
13287         PR 7088
13288         * yyscript.y (file_cmd): Handle INPUT.
13289
13290         * testsuite/initpri1.c: Change all declarations to be full
13291         prototypes by adding void, to avoid compiler warnings.
13292
13293 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13294
13295         * options.cc (General_options::parse_plugin_opt): New.
13296         (General_options::add_plugin): The argument now is just the filename.
13297         (General_options::add_plugin_option): New.
13298         * options.h (plugin_opt): New.
13299         (add_plugin): Change argument name.
13300         (add_plugin_option): New.
13301         * plugin.cc (Plugin::load): Don't parse the plugin option.
13302         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13303         (Plugin::add_option): New.
13304         (Plugin::args_): Change type.
13305         (Plugin::filename_): New.
13306         (Plugin_manager::add_plugin_option): New.
13307         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13308         * testsuite/Makefile.in: Regenerate.
13309
13310 2008-12-05  Cary Coutant  <ccoutant@google.com>
13311
13312         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13313         Handle --strip-lto-sections option.
13314         * options.h (strip_lto_sections): New option.
13315
13316 2008-12-01  Cary Coutant  <ccoutant@google.com>
13317
13318         * plugin.cc (ld_plugin_message): Change format parameter to const.
13319         Fix mismatch between new[] and delete.
13320
13321 2008-11-14  Cary Coutant  <ccoutant@google.com>
13322
13323         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13324         instead of -1U.
13325
13326 2008-11-05  Craig Silverstein  <csilvers@google.com>
13327
13328         * options.cc (General_options::parse_dynamic_list): New function.
13329         * options.h (General_options): New flags dynamic_list,
13330         dynamic_list_data, dynamic_list_cpp_new, and
13331         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13332         (General_options::in_dynamic_list): New function.
13333         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13334         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13335         (Lex::can_continue_name): Likewise.
13336         (yylex): Likewise.
13337         (read_script_file): New parameter script_options.
13338         (read_dynamic_list): New function.
13339         (Script_options::define_dynamic_list): New function.
13340         (dynamic_list_keyword_parsecodes): New variable.
13341         (dynamic_list_keywords): New variable.
13342         * script.h (Script_options::define_dynamic_list): New function
13343         prototype.
13344         (read_dynamic_list): New function prototype.
13345         * symtab.cc (strprefix): New macro.
13346         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13347         dynamic_list_data, dynamic_list_cpp_new, and
13348         dynamic_list_cpp_typeinfo.
13349         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13350         (dynamic_list_expr): New rule.
13351         (dynamic_list_nodes): Likewise.
13352         (dynamic_list_node): Likewise.
13353         * testsuite/Makefile.am (dynamic_list): New test.
13354         * testsuite/Makefile.in: Regenerated.
13355         * testsuite/dynamic_list.t: New file.
13356         * testsuite/dynamic_list.sh: New file.
13357
13358 2008-11-05  Craig Silverstein  <csilvers@google.com>
13359
13360         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13361         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13362         (t11_last): Likewise.
13363         * testsuite/ver_test_6.c (main): Likewise.
13364
13365 2008-10-07  Cary Coutant  <ccoutant@google.com>
13366
13367         * options.c (General_options::finalize): Add check for -static and
13368         -shared.
13369         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13370         is not empty.
13371
13372 2008-10-02  Cary Coutant  <ccoutant@google.com>
13373
13374         * plugin.cc (make_sized_plugin_object): Fix conditional
13375         compilation to work when not all targets are enabled.
13376
13377 2008-09-29  Cary Coutant  <ccoutant@google.com>
13378
13379         * archive.cc (Archive::get_file_and_offset): Use filename instead
13380         of name to get library path.
13381         (Archive::include_member): Unlock external member of a thin archive.
13382
13383         * testsuite/Makefile.am (TEST_AR): New variable.
13384         (thin_archive_test_1): New test.
13385         (thin_archive_test_2): New test.
13386         * testsuite/Makefile.in: Regenerate.
13387         * testsuite/thin_archive_main.cc: New file.
13388         * testsuite/thin_archive_test_1.cc: New file.
13389         * testsuite/thin_archive_test_2.cc: New file.
13390         * testsuite/thin_archive_test_3.cc: New file.
13391         * testsuite/thin_archive_test_4.cc: New file.
13392
13393 2008-09-29  Cary Coutant  <ccoutant@google.com>
13394
13395         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13396         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13397         instead of -1U.
13398         (Sized_relobj::do_finalize_local_symbols): Likewise.
13399         (Sized_relobj::map_to_kept_section): Likewise.
13400         * object.h (Sized_relobj::invalid_address): New constant.
13401         (Sized_relobj::do_output_section_offset): Check for invalid_address
13402         and return -1ULL.
13403         * output.cc (Output_reloc::local_section_offset): Use constant
13404         invalid_address instead of -1U.
13405         (Output_reloc::get_address): Likewise.
13406         (Output_section::output_address): Change -1U to -1ULL.
13407         * output.h (Output_reloc::invalid_address): New constant.
13408         * reloc.cc (Sized_relobj::write_sections): Use constant
13409         invalid_address instead of -1U.
13410         (Sized_relobj::relocate_sections): Likewise.
13411         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13412         values for merge sections.
13413         * target-reloc.h (relocate_for_relocatable): Use constant
13414         invalid_address instead of -1U.
13415
13416 2008-09-19  Cary Coutant  <ccoutant@google.com>
13417
13418         Add plugin functionality for link-time optimization (LTO).
13419         * configure.ac (plugins): Add --enable-plugins option.
13420         * configure: Regenerate.
13421         * config.in: Regenerate.
13422         * Makefile.am (LIBDL): New variable.
13423         (CCFILES): Add plugin.cc.
13424         (HFILES): Add plugin.h.
13425         (ldadd_var): Add LIBDL.
13426         * Makefile.in: Regenerate.
13427
13428         * archive.cc: Include "plugin.h".
13429         (Archive::setup): Don't preread archive symbols when using a plugin.
13430         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13431         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13432         files.
13433         (Archive::include_member): Add symbols from plugin objects.
13434         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13435         * descriptors.cc (Descriptors::open): Check for file descriptors
13436         abandoned by plugins.
13437         (Descriptors::claim_for_plugin): New function.
13438         * descriptors.h (Descriptors::claim_for_plugin): New function.
13439         (Open_descriptor::is_claimed): New field.
13440         (claim_descriptor_for_plugin): New function.
13441         * fileread.cc (File_read::claim_for_plugin): New function.
13442         * fileread.h (File_read::claim_for_plugin): New function.
13443         (File_read::descriptor): New function.
13444         * gold.cc: Include "plugin.h".
13445         (queue_initial_tasks): Add task to call plugin hooks for generating
13446         new object files.
13447         * main.cc: Include "plugin.h".
13448         (main): Load plugin libraries.
13449         * object.h (Pluginobj): Declare.
13450         (Object::pluginobj): New function.
13451         (Object::do_pluginobj): New function.
13452         (Object::set_target): New function.
13453         * options.cc: Include "plugin.h".
13454         (General_options::parse_plugin): New function.
13455         (General_options::General_options): Initialize plugins_ field.
13456         (General_options::add_plugin): New function.
13457         * options.h (Plugin_manager): Declare.
13458         (General_options): Add --plugin option.
13459         (General_options::has_plugins): New function.
13460         (General_options::plugins): New function.
13461         (General_options::add_plugin): New function.
13462         (General_options::plugins_): New field.
13463         * plugin.cc: New file.
13464         * plugin.h: New file.
13465         * readsyms.cc: Include "plugin.h".
13466         (Read_symbols::do_read_symbols): Check for archive before checking
13467         for ELF file.  Call plugin hooks to claim files.
13468         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13469         from a real object file; force override when processing replacement
13470         files.
13471         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13472         (Symbol::init_base_object): Likewise.
13473         (Symbol::init_base_output_data): Likewise.
13474         (Symbol::init_base_output_segment): Likewise.
13475         (Symbol::init_base_constant): Likewise.
13476         (Symbol::init_base_undefined): Likewise.
13477         (Symbol::output_section): Assert that object is not a plugin.
13478         (Symbol_table::add_from_pluginobj): New function.
13479         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13480         undefined.
13481         (Symbol_table::sized_write_globals): Likewise.
13482         (Symbol_table::add_from_pluginobj): Instantiate template.
13483         * symtab.h (Sized_pluginobj): Declare.
13484         (Symbol::in_real_elf): New function.
13485         (Symbol::set_in_real_elf): New function.
13486         (Symbol::in_real_elf_): New field.
13487         (Symbol_table::add_from_pluginobj): New function.
13488
13489         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13490         (LIBDL): New variable.
13491         (LDADD): Add LIBDL.
13492         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13493         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13494         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13495         (MOSTLYCLEANFILES): Likewise.
13496         * testsuite/Makefile.in: Regenerate.
13497         * testsuite/plugin_test.c: New file.
13498         * testsuite/plugin_test_1.sh: New file.
13499         * testsuite/plugin_test_2.sh: New file.
13500
13501 2008-09-16  Ian Lance Taylor  <iant@google.com>
13502
13503         * target-reloc.h (relocate_section): Check whether a symbol is
13504         defined by the ABI before reporting an undefined symbol error.
13505         * target.h (Target::is_defined_by_abi): Make parameter const.
13506         (Target::do_is_defined_by_abi): Likewise.
13507         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13508         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13509         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13510         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13511         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13512         * testsuite/Makefile.in: Rebuild.
13513
13514         * fileread.cc (make_view): Add casts to avoid warning.
13515
13516 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13517
13518         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13519         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13520
13521 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13522
13523         * options.h (General_options::output_is_executable): New.
13524         (General_options::output_is_pie): New.
13525         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13526         for shared libraries.
13527         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13528
13529 2008-09-11  Chris Demetriou  <cgd@google.com>
13530
13531         * options.h (origin): New -z option.
13532         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13533         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13534         in DT_FLAGS_1.
13535
13536 2008-09-05  Cary Coutant  <ccoutant@google.com>
13537
13538         * fileread.cc (File_read::make_view): Add check for attempt to map
13539         beyond end of file.
13540
13541 2008-09-05  Cary Coutant  <ccoutant@google.com>
13542
13543         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13544         explicit instantiations.
13545
13546 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13547
13548         PR gold/6858
13549         * options.cc (General_options::finalize): Allow undefined symbols
13550         in shlibs if linking -shared.
13551
13552         PR gold/6859
13553         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13554         symbols as not needing a dynsym entry.
13555
13556 2008-08-20  Craig Silverstein  <csilvers@google.com>
13557
13558         * fileread.cc (File_read::open): Do not lock the file unless it
13559         was successfully opened.
13560
13561 2008-08-14  Cary Coutant  <ccoutant@google.com>
13562
13563         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13564         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13565         * testsuite/tls_test.cc (struct int128): 128-bit struct
13566         for testing TLS relocs with non-zero addend.
13567         (v12): New TLS variable.
13568         (t12): New test.
13569         (t_last): Add check for v12.
13570         * testsuite/tls_test.h (t12): New function.
13571         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13572
13573 2008-08-13  Ian Lance Taylor  <iant@google.com>
13574
13575         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13576         set tls_segment_ or relro_segment_.
13577         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13578         when appropriate.
13579         * output.h (Output_section::clear_is_relro): New function.
13580         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13581         sections specially even when output_data_ is empty.
13582         (Output_segment::maximum_alignment): When first section is relro,
13583         only force alignment for PT_LOAD segments.
13584         * script.cc (script_data_segment_align): New function.
13585         (script_data_segment_relro_end): New function.
13586         * script-c.h (script_data_segment_align): Declare.
13587         (script_data_segment_relro_end): Declare.
13588         * script-sections.h (class Script_sections): Declare
13589         data_segment_align and data_segment_relro_end.  Add fields
13590         segment_align_index_ and saw_relro_end_.
13591         * script-sections.cc (class Sections_element): Add set_is_relro
13592         virtual function.  Add new bool* parameter to place_orphan_here.
13593         Add get_output_section virtual function.
13594         (class Output_section_definition): Add set_is_relro.  Add new
13595         bool* parameter to place_orphan_here.  Add get_output_section.
13596         Add is_relro_ field.
13597         (Output_section_definition::Output_section_definition): Initialize
13598         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13599         and is_relro_ fields.
13600         (Output_section_definition::place_orphan_here): Add is_relro
13601         parameter.
13602         (Output_section_definition::set_section_addresses): Set relro for
13603         output section.
13604         (Output_section_definition::alternate_constraint): Likewise.
13605         (class Orphan_output_section): Add new bool* parameter to
13606         place_orphan_here.  Add get_output_section.
13607         (Orphan_output_section::place_orphan_here): Add is_relro
13608         parameter.
13609         (Script_sections::Script_sections): Initialize
13610         data_segment_align_index_ and saw_relro_end_.
13611         (Script_sections::data_segment_align): New function.
13612         (Script_sections::data_segment_relro_end): New function.
13613         (Script_sections::place_orphan): Set or clear is_relro.
13614         (Script_sections::set_section_addresses): Force alignment of first
13615         TLS section.
13616         * yyscript.y (exp): Call script_data_segment_align and
13617         script_data_segment_relro_end.
13618         * testsuite/relro_script_test.t: New file.
13619         * testsuite/relro_test.cc (using_script): Declare.
13620         (t1, t2): Test using_script.
13621         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13622         (relro_script_test_SOURCES): Define.
13623         (relro_script_test_DEPENDENCIES): Define.
13624         (relro_script_test_LDFLAGS): Define.
13625         (relro_script_test_LDADD): Define.
13626         (relro_script_test.so): New target.
13627         * testsuite/Makefile.in: Rebuild.
13628
13629 2008-08-06  Cary Coutant <ccoutant@google.com>
13630
13631         * archive.cc (Archive::total_archives, Archive::total_members)
13632         (Archive::total_members_loaded): New variables.
13633         (Archive::setup): Add parameter.  Add option to preread
13634         archive symbols.
13635         (Archive::read_armap): Add counter.
13636         (Archive::get_file_and_offset): New function.
13637         (Archive::get_elf_object_for_member): New function.
13638         (Archive::read_all_symbols): New function.
13639         (Archive::read_symbols): New function.
13640         (Archive::add_symbols): Add counters.
13641         (Archive::include_all_members): Use armap to find members if it's
13642         already built.
13643         (Archive::include_member): Skip reading symbols if already read.
13644         Factored code into Archive::get_file_and_offset and
13645         Archive::get_elf_object_for_member.  Changed call to
13646         Mapfile::report_include_archive_member.
13647         (Archive::print_stats): New function.
13648         * archive.h: Declare Object and Read_symbols_data classes.
13649         (Archive::Archive): Add initializers for new members.
13650         (Archive::setup): Add parameter.
13651         (Archive::print_stats): New function.
13652         (Archive::total_archives, Archive::total_members)
13653         (Archive::total_members_loaded): New variables.
13654         (Archive::get_file_and_offset): New function.
13655         (Archive::get_elf_object_for_member): New function.
13656         (Archive::read_all_symbols): New function.
13657         (Archive::read_symbols): New function.
13658         (Archive::Archive_member): New class.
13659         (Archive::members_): New member.
13660         (Archive::num_members_): New member.
13661         * main.cc: Include archive.h.
13662         (main): Call Archive::print_stats.
13663         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13664         archive parameter; member_name is now the fully-decorated name.
13665         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13666         * options.h: (General_options): Add --preread-archive-symbols option.
13667         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13668         Archive::setup.
13669
13670 2008-08-04  Ian Lance Taylor  <iant@google.com>
13671
13672         * symtab.h (Symbol::use_plt_offset): New function.
13673         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13674         * powerpc.cc (Relocate::relocate): Likewise.
13675         * sparc.cc (Relocate::relocate): Likewise.
13676         * x86_64.cc (Relocate::relocate): Likewise.
13677         * testsuite/weak_plt.sh: New test.
13678         * testsuite/weak_plt_main.cc: New test.
13679         * testsuite/weak_plt_shared.cc: New test.
13680         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13681         (check_PROGRAMS): Add weak_plt.
13682         (check_DATA): Add weak_plt_shared.so.
13683         (weak_plt_main_pic.o, weak_plt): New targets.
13684         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13685         * testsuite/Makefile.in: Rebuild.
13686
13687         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13688         gcctestdir/ld.
13689         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13690         * testsuite/Makefile.in: Rebuild.
13691
13692 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13693
13694         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13695         * Makefile.in: Regenerate.
13696         * po/POTFILES.in: Regenerate.
13697
13698 2008-07-29  Ian Lance Taylor  <iant@google.com>
13699
13700         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13701         symbols before other symbols.
13702         * testsuite/script_test_2.cc (test_addr): Declare.
13703         (test_addr_alias): Declare.
13704         (main): Check that test_addr and test_addr_alias have the right
13705         values.
13706         * testsuite/script_test_2.t: Define test_addr_alias and
13707         test_addr.
13708
13709 2008-07-24  Ian Lance Taylor  <iant@google.com>
13710
13711         PR 5990
13712         * descriptors.cc: New file.
13713         * descriptors.h: New file.
13714         * gold-threads.h (class Hold_optional_lock): New class.
13715         * fileread.cc: Include "descriptors.h".
13716         (File_read::~File_read): Release descriptor rather than closing
13717         it.
13718         (File_read::open) [file]: Call open_descriptor rather than open.
13719         Set is_descriptor_opened_.
13720         (File_read::open) [memory]: Assert that descriptor is not open.
13721         (File_read::reopen_descriptor): New function.
13722         (File_read::release): Release descriptor.
13723         (File_read::do_read): Make non-const.  Reopen descriptor.
13724         (File_read::read): Make non-const.
13725         (File_read::make_view): Reopen descriptor.
13726         (File_read::do_readv): Likewise.
13727         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13728         Update declarations.
13729         * layout.cc: Include "descriptors.h".
13730         (Layout::create_build_id): Use open_descriptor rather than open.
13731         * output.cc: Include "descriptors.h".
13732         (Output_file::open): Use open_descriptor rather than open.
13733         * archive.cc (Archive::const_iterator): Change Archive to be
13734         non-const.
13735         (Archive::begin, Archive::end): Make non-const.
13736         (Archive::count_members): Likewise.
13737         * archive.h (class Archive): Update declarations.
13738         * object.h (Object::read): Make non-const.
13739         * Makefile.am (CCFILES): Add descriptors.cc.
13740         (HFILES): Add descriptors.h.
13741         * Makefile.in: Rebuild.
13742
13743         PR 6716
13744         * gold.h: Always include <clocale>.  Add Solaris workarounds
13745         following code in binutils/sysdep.h.
13746
13747         PR 6048
13748         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13749         this->eh_frame_hdr_ is NULL before using it.
13750
13751         * dynobj.cc (Versions::Versions): Update comment.
13752
13753         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13754         the base version name.
13755
13756         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13757         array size plus one.
13758         (Stringpool_template::set_string_offsets): Subtract one from key
13759         before using it as an array index.
13760         (Stringpool_template::get_offset_with_length): Likewise.
13761         (Stringpool_template::write_to_buffer): Likewise.
13762         * stringpool.h (Stringpool_template::get_offset_from_key):
13763         Likewise.
13764
13765 2008-07-23  Ian Lance Taylor  <iant@google.com>
13766
13767         PR 6658
13768         * object.h (Merged_symbol_value::value): Do our best to handle a
13769         negative addend.
13770
13771         PR 6647
13772         * script.cc (Version_script_info::get_versions): Don't add empty
13773         version tag to return value.
13774         (Version_script_info::get_symbol_version_helper): Change return
13775         type to bool.  Add pversion parameter.  Change all callers.
13776         (script_register_vers_node): Don't require a non-NULL tag.
13777         * script.h (class Version_script_info): Update declarations.
13778         (Version_script_info::get_symbol_version): Change return type to
13779         bool.  Add version parameter.  Change all callers.
13780         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13781         handling.  Handle an empty version from a version script.
13782         (Symbol_table::define_special_symbol): Likewise.
13783         * testsuite/ver_test_10.script: New file.
13784         * testsuite/ver_test_10.sh: New file.
13785         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13786         (check_DATA): Add ver_test_10.syms.
13787         (ver_test_10.syms, ver_test_10.so): New target.
13788         * testsuite/Makefile.in: Rebuild.
13789
13790 2008-07-23  Simon Baldwin  <simonb@google.com>
13791
13792         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13793         to zero for undefined symbols from dynamic libraries.
13794
13795 2008-07-23  Ian Lance Taylor  <iant@google.com>
13796
13797         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13798         Change all callers.
13799         * symtab.h (class Symbol_table): Update declaration.
13800         * testsuite/ver_test_9.cc: New file.
13801         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13802         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13803         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13804         (ver_test_9.so, ver_test_9.o): New targets.
13805         * testsuite/Makefile.in: Rebuild.
13806
13807 2008-07-22  Ian Lance Taylor  <iant@google.com>
13808
13809         * options.h (class General_options): Define --check-sections.
13810         * layout.cc (Layout::set_segment_offsets): Handle
13811         --check-sections.
13812
13813         * options.h (class General_options): Define -n/--nmagic and
13814         -N/--omagic.
13815         * options.cc (General_options::finalize): For -n/--nmagic or
13816         -N/--omagic, set -static.
13817         * layout.cc (Layout::attach_allocated_section_to_segment): If
13818         -N/--omagic, don't put read-only and read-write sections in
13819         different segments.
13820         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13821         finding a read-only segment.
13822         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13823         don't set the minimum segment alignment to the common page size,
13824         and don't set the file offset to the address modulo the page size.
13825         * script-sections.cc (Script_sections::create_segments): If
13826         -n/--omagic, don't put read-only and read-write sections in
13827         different segments.
13828
13829         * cref.cc: New file.
13830         * cref.h: New file.
13831         * options.h (class General_options): Add --print-symbol-counts.
13832         * main.cc (main): Issue defined symbol report if requested.
13833         * archive.cc (Archive::interpret_header): Make into a const member
13834         function.
13835         (Archive::add_symbols): Call Input_objects::archive_start and
13836         archive_stop.
13837         (Archive::const_iterator): Define new class.
13838         (Archive::begin, Archive::end): New functions.
13839         (Archive::include_all_members): Rewrite to use iterator.
13840         (Archive::count_members): New function.
13841         * archive.h (class Archive): Update declarations.
13842         (Archive::filename): New function.
13843         * object.cc: Include "cref.h".
13844         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13845         (Sized_relobj::do_get_global_symbol_counts): New function.
13846         (Input_objects::add_object): Add object to cross-referencer.
13847         (Input_objects::archive_start): New function.
13848         (Input_objects::archive_stop): New function.
13849         (Input_objects::print_symbol_counts): New function.
13850         * object.h: Declare Cref and Archive.
13851         (Object::get_global_symbol_counts): New function.
13852         (Object::do_get_global_symbol_counts): New pure virtual function.
13853         (class Sized_relobj): Add defined_count_ field.  Update
13854         declarations.
13855         (class Input_objects): Add cref_ field.  Update constructor.
13856         Update declarations.
13857         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13858         defined_count_.
13859         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13860         symbol counts.
13861         (Sized_dynobj::do_get_global_symbol_counts): New function.
13862         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13863         defined_count_.  Update declarations.  Define Symbols typedef.
13864         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13865         parameter.  Change all callers.
13866         (Symbol_table::add_from_dynobj): Add sympointers and defined
13867         parameters.  Change all callers.
13868         * symtab.h (class Symbol_table): Update declarations.
13869         * Makefile.am (CCFILES): Add cref.cc.
13870         (HFILES): Add cref.h.
13871         * Makefile.in: Rebuild.
13872
13873 2008-07-22  Simon Baldwin  <simonb@google.com>
13874
13875         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13876         to zero when writing undefined symbols.
13877
13878 2008-07-22  Ian Lance Taylor  <iant@google.com>
13879
13880         * output.cc (Output_section::add_input_section): Don't try to
13881         merge empty merge sections.
13882
13883 2008-07-21  Craig Silverstein  <csilvers@google.com>
13884
13885         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13886         Include symbol version in error message.
13887
13888 2008-07-20  Chris Demetriou  <cgd@google.com>
13889
13890         * configure.ac (gold_cv_c_random_seed): New configured variable.
13891         (RANDOM_SEED_CFLAGS): New substituted variable.
13892         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13893         * configure: Rebuild.
13894         * Makefile.in: Likewise.
13895         * testsuite/Makefile.in: Likewise.
13896
13897 2008-07-18  Ian Lance Taylor  <iant@google.com>
13898
13899         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13900         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13901         * testsuite/ver_test_main.cc (main): Call t4.
13902         (t4, t4_2a): Define.
13903         * testsuite/ver_test_2.cc (t4_2): Define.
13904         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13905         * testsuite/ver_test_4.cc (t4_2a): Define.
13906         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13907         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13908
13909 2008-07-17  Ian Lance Taylor  <iant@google.com>
13910
13911         * dynobj.cc (Versions::add_def): If we give an error about a
13912         missing version, go ahead and create the version anyhow.
13913
13914 2008-07-10  Ian Lance Taylor  <iant@google.com>
13915
13916         Handle output sections with more than 0x7fffffff bytes.
13917         * object.h (class Relobj): Change map_to_output_ to
13918         output_sections_, and just keep a section pointer.  Change all
13919         uses.  Move comdat group support to Sized_relobj.
13920         (Relobj::is_section_specially_mapped): Remove.
13921         (Relobj::output_section): Remove poff parameter.  Change all
13922         callers.
13923         (Relobj::output_section_offset): New function.
13924         (Relobj::set_section_offset): Rewrite.
13925         (Relobj::map_to_output): Remove.
13926         (Relobj::output_sections): New function.
13927         (Relobj::do_output_section_offset): New pure virtual function.
13928         (Relobj::do_set_section_offset): Likewise.
13929         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13930         group support from Relobj.  Update declarations.
13931         (Sized_relobj::get_output_section_offset): New function.
13932         (Sized_relobj::do_output_section_offset): New function.
13933         (Sized_relobj::do_set_section_offset): New function.
13934         * object.cc (Relobj::output_section_address): Remove.
13935         (Sized_relobj::Sized_relobj): Initialize new fields.
13936         (Sized_relobj::include_section_group): Cast find_kept_object to
13937         Sized_relobj.
13938         (Sized_relobj::include_linkonce_section): Likewise.
13939         (Sized_relobj::do_layout): Use separate arrays for output section
13940         and output offset.
13941         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13942         output_sections.
13943         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13944         output_sections and section_offsets.
13945         (Sized_relobj::write_local_symbols): Likewise.
13946         (map_to_kept_section): Compute output address directly.
13947         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13948         output_sections and section_offsets.
13949         (Sized_relobj::write_sections): Likewise.
13950         (Sized_relobj::relocate_sections): Likewise.
13951         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13952         * output.h (class Output_reloc): Update declarations.  Change
13953         u2_.relobj to Sized_relobj*.
13954         (class Output_data_reloc): Change add functions to use
13955         Sized_relobj*.
13956         * output.cc (Output_reloc::Output_reloc): Change relobj to
13957         Sized_relobj*.
13958         (Output_reloc::local_section_offset): Change return type to
13959         Elf_Addr.  Use get_output_section_offset.
13960         (Output_reloc::get_address): Likewise.
13961         (Output_section::is_input_address_mapped): Don't call
13962         is_section_specially_mapped.
13963         (Output_section::output_offset): Likewise.
13964         (Output_section::output_address): Likewise.
13965         (Output_section::starting_output_address): Likewise.
13966         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13967         parameter to Sized_relobj*.
13968         (Copy_relocs::need_copy_reloc): Likewise.
13969         (Copy_relocs::save): Likewise.
13970         * copy-relocs.h (class Copy_relocs): Update declarations.
13971         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13972         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13973         * target-reloc.h (relocate_for_relocatable): Change
13974         offset_in_output_section type to Elf_Addr.  Change code that uses
13975         it as well.
13976         * layout.cc (Layout::layout): Always set *off.
13977         * mapfile.cc (Mapfile::print_input_section): Use
13978         output_section_offset.
13979         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13980         Sized_relobj*.
13981         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13982         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13983         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13984
13985 2008-07-03  Ian Lance Taylor  <iant@google.com>
13986
13987         * layout.cc (Layout::include_section): Do not discard unrecognized
13988         SHT_STRTAB sections.
13989
13990 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13991
13992         * script.cc (Lex::can_continue_name): Make '?' allowable in
13993         version-script names.
13994         * testsuite/version_script.map: Change glob pattern to use '?'
13995
13996 2008-06-30  Manish Singh  <yosh@gimp.org>
13997
13998         PR 6585
13999         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14000         Correct typo.
14001
14002 2008-06-30  Ian Lance Taylor  <iant@google.com>
14003
14004         PR 6660
14005         PR 6682
14006         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14007         versions]: Don't try to read the value in the contents, since we
14008         don't use it.  Use the template endianness when writing.
14009
14010 2008-06-25  Cary Coutant  <ccoutant@google.com>
14011
14012         * fileread.cc (File_read::make_view): Assert on zero-length view.
14013         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14014         symbol table when there are no symbols to read.
14015
14016 2008-06-23  Craig Silverstein  <csilvers@google.com>
14017
14018         * version.cc (version_string): Bump to 1.7
14019
14020 2008-06-18  Craig Silverstein  <csilvers@google.com>
14021
14022         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14023         constant 0xFFFF to type Valtype.
14024         (Powerpc_relocate_functions::rel16_ha): Likewise.
14025
14026 2008-06-17  Ian Lance Taylor  <iant@google.com>
14027
14028         * output.h (Output_section::Input_section): Initialize p2align_ to
14029         zero for Output_section_data constructors.
14030         (Output_section::Input_section::addralign): If not an input
14031         section, return the alignment of the Output_section_data.
14032         * testsuite/copy_test.cc: New file.
14033         * testsuite/copy_test_1.cc: New file.
14034         * testsuite/copy_test_2.cc: New file.
14035         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14036         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14037         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14038         (copy_test_1_pic.o, copy_test_1.so): New targets.
14039         (copy_test_2_pic.o, copy_test_2.so): New targets.
14040         * testsuite/Makefile.in: Rebuild.
14041
14042         * script-sections.cc (Script_sections::place_orphan): Initialize
14043         local variable exact.
14044
14045 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14046
14047         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14048
14049 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14050             David S. Miller  <davem@davemloft.net>
14051
14052         * powerpc.cc: New file.
14053         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14054         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14055         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14056         * Makefile.in: Rebuild.
14057
14058 2008-06-09  Ian Lance Taylor  <iant@google.com>
14059
14060         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14061         <exception>.
14062         (throwing, orig_terminate): New static variables.
14063         (terminate_handler): New static function.
14064         (t2): Set terminate handler.
14065
14066 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14067
14068         PR 6584
14069         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14070         alignment.
14071
14072 2008-05-30  Cary Coutant  <ccoutant@google.com>
14073
14074         * archive.cc (Archive::include_all_members) Correct to step
14075         over symbol table and extended name table in thin archives.
14076
14077 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14078
14079         PR 6407
14080         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14081         calculation.
14082
14083 2008-05-28  Caleb Howe  <cshowe@google.com>
14084
14085         * reduced_debug_output.cc: New file.
14086         * reduced_debug_output.h: New file.
14087         * options.h (class General_options): Add --strip-debug-non-line.
14088         * options.cc (General_options::finalize): Add strip_debug_non_line
14089         to the strip heirarchy.
14090         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14091         fields.
14092         * layout.cc: Include "reduced_debug_output.h".
14093         (Layout::Layout): Initialize new fields.
14094         (line_only_debug_sections): New static array.
14095         (is_lines_only_debug_sections): New static inline function.
14096         (Layout::include_section): Handle --strip-debug-non-line.
14097         (Layout::make_output_section): If --strip-debug-non-line, build
14098         new output sections for .debug_abbrev and .debug_info.
14099         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14100         gold.  Warn about possible overflow.
14101         (read_signed_LEB_128): Likewise.
14102         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14103         (read_signed_LEB_128): Declare.
14104         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14105         (HFILES): Add reduced_debug_output.h.
14106         * Makefile.in: Rebuild.
14107
14108 2008-05-21  Ian Lance Taylor  <iant@google.com>
14109
14110         * mapfile.cc: New file.
14111         * mapfile.h: New file.
14112         * options.h (class General_options): Add -M/--print-map and -Map.
14113         * options.cc (General_options::finalize): Make -M equivalent to
14114         -Map -.
14115         * main.cc: Include <cstdio> and "mapfile.h".
14116         (main): Open mapfile if requested.
14117         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14118         constructor.  Change caller.
14119         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14120         (queue_middle_tasks): Likewise.
14121         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14122         declarations.
14123         * archive.cc: Include "mapfile.h".
14124         (Archive::add_symbols): Add mapfile parameter.  Change all
14125         callers.  Pass mapfile, symbol, and reason to include_member.
14126         (Archive::include_all_members): Add mapfile parameter.  Change all
14127         callers.
14128         (Archive::include_member): Add mapfile, sym, and why parameters.
14129         Change all callers.  Report inclusion to map file.
14130         * archive.h: Include "fileread.h".
14131         (class Archive): Update declarations.
14132         (Archive::file): New const method.
14133         (class Add_archive_symbols): Add mapfile_ field.  Update
14134         constructor.  Change all callers.
14135         * readsyms.h (class Read_symbols): Likewise.
14136         (class Finish_group): Likewise.
14137         (class Read_script): Likewise.
14138         * common.cc: Include "mapfile.h".
14139         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14140         all callers.
14141         (Symbol_table::do_allocate_commons): Likewise.
14142         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14143         symbol allocation to mapfile.
14144         * common.h (class Allocate_commons_task): Add mapfile_ field.
14145         Update constructor.  Change all callers.
14146         * symtab.h (class Symbol_table): Update declarations.
14147         * layout.cc: Include "mapfile.h".
14148         (Layout_task_runner::run): Print information to mapfile.
14149         (Layout::create_gold_note): Change Output_data_fixed_space to
14150         Output_data_zero_fill.
14151         (Layout::create_build_id): Likewise.
14152         (Layout::print_to_mapfile): New function.
14153         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14154         constructor.  Change caller.
14155         (class Layout): Declare print_to_mapfile.
14156         * output.cc (Output_section::Input_section::print_to_mapfile): New
14157         function.
14158         (Output_section::add_input_section): If producing a map, always
14159         add to input_sections_ list.
14160         (Output_section::do_print_to_mapfile): New function.
14161         (Output_segment::print_sections_to_mapfile): New function.
14162         (Output_segment::print_section_list_to_mapfile): New function.
14163         * output.h: Include "mapfile.h".
14164         (Output_data::print_to_mapfile): New function.
14165         (Output_data::do_print_to_mapfile): New virtual function.
14166         (Output_segment_headers::do_print_to_mapfile): New function.
14167         (Output_file_header::do_print_to_mapfile): New function.
14168         (Output_data_const::do_print_to_mapfile): New function.
14169         (class Output_data_const_buffer): Add map_name_ field.  Update
14170         constructor.  Change all callers.  Add do_print_to_mapfile
14171         function.
14172         (class Output_data_fixed_space): Likewise.
14173         (class Output_data_space): Likewise.
14174         (class Output_data_zero_fill): New class.
14175         (Output_data_strtab::do_print_to_mapfile): New function.
14176         (Output_data_reloc_base::do_print_to_mapfile): New function.
14177         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14178         (Output_data_group::do_print_to_mapfile): New function.
14179         (Output_data_got::do_print_to_mapfile): New function.
14180         (Output_data_dynamic::do_print_to_mapfile): New function.
14181         (Output_symtab_xindex::do_print_to_mapfile): New function.
14182         (class Output_section): Declare do_print_to_mapflie.  Declare
14183         print_to_mapfile in Input_section.
14184         (class Output_segment): Declare new functions.
14185         * object.h (Sized_relobj::symbol_count): New function.
14186         * script-sections.cc
14187         (Output_section_element_dot_assignment::set_section_addresses):
14188         Change Output_data_fixed_space to Output_data_zero_fill.
14189         (Output_data_expression::do_print_to_mapfile): New function.
14190         * script.cc (read_input_script): Add mapfile parameter.  Change
14191         all callers.
14192         * script.h (read_input_script): Update declaration.
14193         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14194         (Eh_frame::do_print_to_mapfile): New function.
14195         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14196         (Output_merge_string::do_print_to_mapfile): New function.
14197         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14198         function.
14199         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14200         function.
14201         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14202         function.
14203         * Makefile.am (CCFILES): Add mapfile.cc.
14204         (HFILES): Add mapfile.h.
14205         * Makefile.in: Rebuild.
14206
14207 2008-05-19  Ian Lance Taylor  <iant@google.com>
14208
14209         * options.h (class General_options): Add -z relro.
14210         * layout.cc (Layout::Layout): Initialize relro_segment_.
14211         (Layout::add_output_section_data): Return the output section.
14212         (Layout::make_output_section): Rcognize relro sections and mark
14213         them appropriately.
14214         (Layout::attach_allocated_section_to_segment): Put relro sections
14215         in a PT_GNU_RELRO segment.
14216         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14217         section as relro.
14218         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14219         PT_TLS segments.
14220         (Layout::linkonce_mapping): Map d.rel.ro.local to
14221         .data.rel.ro.local.
14222         (Layout::output_section_name): Us .data.rel.ro.local for any
14223         section which begins with that.
14224         * layout.h (class Layout): Update add_output_section_data
14225         declaration.  Add relro_segment_ field.
14226         * output.cc (Output_section::Output_section): Initialize is_relro_
14227         and is_relro_local_ fields.
14228         (Output_segment::add_output_section): Group relro sections.
14229         (Output_segment::is_first_section_relro): New function.
14230         (Output_segment::maximum_alignment): If there is a relro section,
14231         align the segment to the common page size.
14232         (Output_segment::set_section_addresses): Track whether we are
14233         looking at relro sections.  If the last section is a relro
14234         section, align to the common page size.
14235         (Output_segment::set_section_list_addresses): Add in_relro
14236         parameter.  Change all callers.  Align to the page size when
14237         moving from relro to non-relro section.
14238         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14239         segment.
14240         * output.h (class Output_section): Add is_relro_ and
14241         is_relro_local_ fields.
14242         (Output_section::is_relro): New function.
14243         (Output_section::set_is_relro): New function.
14244         (Output_section::is_relro_local): New function.
14245         (Output_section::set_is_relro_local): New function.
14246         (class Output_segment): Update declarations.
14247         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14248         * sparc.cc (Target_sparc::got_section): Likewise.
14249         * x86_64.cc (Target_x86_64::got_section): Likewise.
14250         * testsuite/relro_test_main.cc: New file.
14251         * testsuite/relro_test.cc: New file.
14252         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14253         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14254         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14255         (relro_test.so, relro_test_pic.o): New targets.
14256         * testsuite/Makefile.in: Rebuild.
14257
14258 2008-05-16  Ian Lance Taylor  <iant@google.com>
14259
14260         * output.cc (Output_segment::add_output_section): Remove front
14261         parameter.
14262         * output.h (class Output_segment): Remove
14263         add_initial_output_section and overloaded add_output_section.
14264         Update declaration of remaining add_output_section.
14265         * layout.cc (Layout::create_interp): Call add_output_section
14266         rather than add_initial_output_section.
14267         (Layout::finish_dynamic_section): Likewise.
14268
14269         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14270         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14271         know the dynamic type.
14272         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14273         field.  Initialize it in constructor.
14274         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14275         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14276         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14277         reloc.
14278
14279         * output.cc (Output_reloc::get_address): Change return type to
14280         Elf_Addr.
14281         * output.h (class Output_reloc): Update get_address declaration.
14282         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14283         for section addresses.
14284
14285 2008-05-09  Ian Lance Taylor  <iant@google.com>
14286
14287         PR 6493
14288         * gold.cc (gold_nomem): Use return value of write.
14289
14290 2008-05-08  Ian Lance Taylor  <iant@google.com>
14291
14292         * symtab.c (Symbol::init_base_output_data): Add version
14293         parameter.  Change all callers.
14294         (Symbol::init_base_output_segment): Likewise.
14295         (Symbol::init_base_constant): Likewise.
14296         (Symbol::init_base_undefined): Likewise.
14297         (Sized_symbol::init_output_data): Likewise.
14298         (Sized_symbol::init_output_segment): Likewise.
14299         (Sized_symbol::init_constant): Likewise.
14300         (Sized_symbol::init_undefined): Likewise.
14301         (Symbol_table::do_define_in_output_data): If the new symbol has a
14302         version, mark it as the default.
14303         (Symbol_table::do_define_in_output_segment): Likewise.
14304         (Symbol_table::do_define_as_constant): Likewise.
14305         * symtab.h (class Symbol): Update declarations.
14306         (class Sized_symbol): Likewise.
14307         * resolve.cc (Symbol::override_version): New function.
14308         (Symbol::override_base): Call override_version.
14309         (Symbol::override_base_with_special): Likewise.
14310         * testsuite/ver_script_8.script: New file.
14311         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14312         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14313         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14314         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14315
14316 2008-05-06  Ian Lance Taylor  <iant@google.com>
14317
14318         PR 6049
14319         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14320         functions.
14321         (class General_options): Remove existing --undefined, and add
14322         --no-undefined instead.  Add new --undefined as synonym for -u.
14323         * archive.cc (Archive::add_symbols): Check whether symbol was
14324         named with -u.
14325         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14326         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14327         all uses.  Add IS_UNDEFINED.  Update declarations to split
14328         different versions of init_base.  Declare init_base_undefined.
14329         (Symbol::is_defined): Handle IS_UNDEFINED.
14330         (Symbol::is_undefined): Likewise.
14331         (Symbol::is_weak_undefined): Call is_undefined.
14332         (Symbol::is_absolute): Handle IS_CONSTANT.
14333         (class Sized_symbol): Update declarations to split different
14334         versions of init.  Declare init_undefined.
14335         (class Symbol_table): Declare new functions.
14336         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14337         Change all callers.
14338         (Symbol::init_base_output_data): Likewise.
14339         (Symbol::init_base_output_segment): Likewise.
14340         (Symbol::init_base_constant): Likewise.
14341         (Symbol::init_base_undefined): New function.
14342         (Sized_symbol::init_object): Rename from init.  Change all
14343         callers.
14344         (Sized_symbol::init_output_data): Likewise.
14345         (Sized_symbol::init_output_segment): Likewise.
14346         (Sized_symbol::init_constant): Likewise.
14347         (Sized_symbol::init_undefined): New function.
14348         (Symbol_table::add_undefined_symbols_from_command_line): New
14349         function.
14350         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14351         function.
14352         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14353         (Symbol::output_section): Likewise.
14354         (Symbol::set_output_section): Likewise.
14355         (Symbol_table::sized_finalize_symbol): Likewise.
14356         (Symbol_table::sized_write_globals): Likewise.
14357         * resolve.cc (Symbol_table::should_override): Likewise.
14358         (Symbol::override_base_with_special): Likewise.
14359
14360         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14361         symbol, change it to have default visibility.
14362         * testsuite/protected_1.cc: New file.
14363         * testsuite/protected_2.cc: New file.
14364         * testsuite/protected_3.cc: New file.
14365         * testsuite/protected_main_1.cc: New file.
14366         * testsuite/protected_main_2.cc: New file.
14367         * testsuite/protected_main_3.cc: New file.
14368         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14369         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14370         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14371         (protected_1.so): New target.
14372         (protected_1_pic.o, protected_2_pic.o): New targets.
14373         (protected_3_pic.o): New target.
14374         (check_PROGRAMS): Add protected_2.
14375         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14376         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14377         * testsuite/Makefile.in: Rebuild.
14378
14379         * options.h (DEFINE_var): Add set_user_set_##varname__.
14380         (DEFINE_bool_alias): New macro.
14381         (class General_options): Define -Bstatic using DEFINE_bool_alias
14382         rather than DEFINE_special.  Add --undefined as an alias for -z
14383         defs.
14384         * options.cc (General_options::parse_Bstatic): Remove.
14385
14386         * options.h (class General_options): Add --fatal-warnings.
14387         * main.cc (main): Implement --fatal-warnings.
14388         * errors.h (Errors::warning_count): New function.
14389
14390         * options.h (class General_options): Add -Bsymbolic-functions.
14391         * symtab.h (Symbol::is_preemptible): Check for
14392         -Bsymbolic-functions.
14393
14394 2008-05-05  Ian Lance Taylor  <iant@google.com>
14395
14396         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14397         as noVARNAME rather than no-VARNAME.
14398         (class General_options): Add option -z combreloc.
14399         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14400         get_address.
14401         (Output_reloc::sort_before) [SHT_REL]: New function.
14402         (Output_reloc::sort_before) [SHT_RELA]: New function.
14403         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14404         Sort_relocs_comparison.
14405         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14406         parameter.  Change all callers.
14407         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14408         sort_relocs parameter.  Change all callers.
14409         * output.cc (Output_reloc::get_address): New function, broken out
14410         of write_rel.
14411         (Output_reloc::write_rel): Call it.
14412         (Output_reloc::compare): New function.
14413         (Output_data_reloc_base::do_write): Optionally sort relocs.
14414
14415         * configure.ac: If targ_extra_obj is set, link it in.
14416         * configure.tgt: Initialize all variables.
14417         (x86_64*): Set targ_extra_obj and targ_extra_size.
14418         * configure: Rebuild.
14419
14420         * object.cc (Sized_relobj::include_section_group): Adjust section
14421         indexes read from group data.  Build vector to pass to
14422         layout_group.
14423         * layout.cc (Layout::layout_group): Add flags and shndxes
14424         parameters.  Remove contents parameter.  Change caller.  Update
14425         explicit instantiations.
14426         * layout.h (class Layout): Update layout_group declaration.
14427         * output.cc (Output_data_group::Output_data_group): Add flags and
14428         input_shndxes parameters.  Remove contents parameter.  Change
14429         caller.
14430         (Output_data_group::do_write): Change input_sections_ to
14431         input_shndxes_.
14432         * output.h (class Output_data_group): Update constructor
14433         declaration.  Rename input_sections_ to input_shndxes_.
14434         * testsuite/many_sections_test.cc: Add template.
14435
14436 2008-04-30  Cary Coutant  <ccoutant@google.com>
14437
14438         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14439
14440         * layout.cc (Layout::include_section): Refactored check for debug
14441         info section.
14442         (Layout::add_comdat): Add new parameters.  Change type
14443         of signature parameter.  Add object and shndx to signatures table.
14444         (Layout::find_kept_object): New function.
14445         * layout.h: Include <cstring>.
14446         (Layout::is_debug_info_section): New function.
14447         (Layout::add_comdat): Add new parameters.
14448         (Layout::find_kept_object): New function.
14449         (Layout::Kept_section): New struct.
14450         (Layout::Signatures): Change type of map range.
14451         * object.cc (Relobj::output_section_address): New function.
14452         (Sized_relobj::include_section_group): Add new parameters.  Change
14453         calls to Layout::add_comdat.  Change to build table of kept comdat
14454         groups and table mapping discarded sections to kept sections.
14455         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14456         (Sized_relobj::do_layout): Change calls to include_section_group and
14457         include_linkonce_section.
14458         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14459         value to zero when section is discarded.
14460         (Sized_relobj::map_to_kept_section): New function.
14461         * object.h (Relobj::output_section_address): New function.
14462         (Relobj::Comdat_group): New type.
14463         (Relobj::find_comdat_group): New function.
14464         (Relobj::Comdat_group_table): New type.
14465         (Relobj::Kept_comdat_section): New type.
14466         (Relobj::Kept_comdat_section_table): New type.
14467         (Relobj::add_comdat_group): New function.
14468         (Relobj::set_kept_comdat_section): New function.
14469         (Relobj::get_kept_comdat_section): New function.
14470         (Relobj::comdat_groups_): New field.
14471         (Relobj::kept_comdat_sections_): New field.
14472         (Symbol_value::input_value): Update comment.
14473         (Sized_relobj::map_to_kept_section) New function.
14474         (Sized_relobj::include_linkonce_section): Add new parameter.
14475         * target-reloc.h (Comdat_behavior): New type.
14476         (get_comdat_behavior): New function.
14477         (relocate_section): Add code to map a discarded section to the
14478         corresponding kept section when applying a relocation.
14479
14480 2008-04-30  Craig Silverstein  <csilvers@google.com>
14481
14482         * dwarf_reader.cc (next_generation_count): New static var.
14483         (Addr2line_cache_entry): New struct.
14484         (addr2line_cache): New static var.
14485         (Dwarf_line_info::one_addr2line): Added caching.
14486         (Dwarf_line_info::clear_addr2line_cache): New function.
14487         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14488         cache-size parameter.
14489         (Dwarf_line_info::one_addr2line_cache): New function.
14490         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14491         new cache-size argument to one_addr2line(), and clear cache.
14492
14493 2008-04-28  Cary Coutant  <ccoutant@google.com>
14494
14495         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14496         R_386_PC8 relocations.
14497
14498 2008-04-23  Ian Lance Taylor  <iant@google.com>
14499
14500         * object.cc (Sized_relobj::include_section_group): Check for
14501         invalid section group.
14502
14503         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14504         header size.
14505
14506         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14507         than read for file header.
14508         * archive.cc (Archive::include_member): Likewise.
14509
14510 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14511
14512         * aclocal.m4: Regenerate.
14513         * configure: Regenerate.
14514
14515 2008-04-19  Ian Lance Taylor  <iant@google.com>
14516
14517         * version.cc (version_string): Bump to 1.6.
14518
14519         * testsuite/Makefile.am (many_sections_r_test): New target.
14520         (many_sections_r_test_SOURCES): Remove.
14521         (many_sections_r_test_DEPENDENCIES): Remove.
14522         (many_sections_r_test_LDFLAGS): Remove.
14523         (many_sections_r_test_LDADD): Remove.
14524
14525         * object.cc (Sized_relobj::do_add_symbols): Always pass
14526         local_symbol_count_ to add_from_relobj.
14527
14528         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14529         every thousand variables.
14530         * testsuite/Makefile.in: Rebuild.
14531
14532         * object.cc (Xindex::initialize_symtab_xindex): New function.
14533         (Xindex::read_symtab_xindex): New function.
14534         (Xindex::sym_xindex_to_shndx): New function.
14535         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14536         available.
14537         (Sized_relobj::do_initialize_xindex): New function.
14538         (Sized_relobj::do_read_symbols): Adjust section links.
14539         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14540         parameter.  Change all callers.
14541         (Sized_relobj::include_section_group): Adjust section links and
14542         symbol section indexes.
14543         (Sized_relobj::do_layout): Adjust section links.
14544         (Sized_relobj::do_count_local_symbols): Adjust section links and
14545         symbol section indexes.
14546         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14547         ordinary and special symbols.
14548         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14549         dynsym_xindex parameters.  Change all callers.  Adjust section
14550         links.  Use SHN_XINDEX when needed.
14551         (Sized_relobj::get_symbol_location_info): Adjust section links.
14552         Don't get fooled by special symbols.
14553         * object.h (class Xindex): Define.
14554         (class Object): Add xindex_ parameter.  Declare virtual functoin
14555         do_initialize_xindex.
14556         (Object::adjust_sym_shndx): New function.
14557         (Object::set_xindex): New protected function.
14558         (class Symbol_value): Add is_ordinary_shndx_ field.
14559         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14560         (Symbol_value::value): Assert ordinary section.
14561         (Symbol_value::initialize_input_to_output_map): Likewise.
14562         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14563         Change all callers.
14564         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14565         all callers.
14566         (class Sized_relobj): Update declarations.
14567         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14568         parameter.  Change all callers.
14569         (Sized_relobj::adjust_shndx): New function.
14570         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14571         field.
14572         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14573         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14574         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14575         (Sized_dynobj::read_dynsym_section): Adjust section links.
14576         (Sized_dynobj::read_dynamic): Likewise.
14577         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14578         section links.
14579         (Sized_dynobj::do_initialize_xindex): New function.
14580         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14581         do_initialize_xindex.
14582         (Sized_dynobj::adjust_shndx): New function.
14583         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14584         dynsym_xindex_ fields.
14585         (Layout::finalize): Add a call to set_section_indexes before
14586         creating the symtab sections.
14587         (Layout::set_section_indexes): Don't do anything if the section
14588         already has a section index.
14589         (Layout::create_symtab_sections): Add shnum parameter.  Change
14590         caller.  Create .symtab_shndx section if needed.
14591         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14592         caller.
14593         (Layout::allocated_output_section_count): New function.
14594         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14595         needed.
14596         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14597         fields.  Update declarations.
14598         (Layout::symtab_xindex): New function.
14599         (Layout::dynsym_xindex): New function.
14600         (class Write_symbols_task): Add layout_ field.
14601         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14602         Change caller.
14603         * output.cc (Output_section_headers::Output_section_headers): Add
14604         shstrtab_section parameter.  Change all callers.
14605         (Output_section_headers::do_sized_write): Store overflow values
14606         for section count and section string table section index in
14607         section header zero.
14608         (Output_file_header::do_sized_write): Check for overflow of
14609         section count and section string table section index.
14610         (Output_symtab_xindex::do_write): New function.
14611         (Output_symtab_xindex::endian_do_write): New function.
14612         * output.h (class Output_section_headers): Add shstrtab_section_.
14613         Update declarations.
14614         (class Output_symtab_xindex): Define.
14615         (Output_section::has_out_shndx): New function.
14616         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14617         field.
14618         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14619         Change all callers.
14620         (Sized_symbol::init): Likewise.
14621         (Symbol::output_section): Check for ordinary symbol.
14622         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14623         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14624         callers.
14625         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14626         Change all callers.  Simplify handling of symbols from sections
14627         not included in the link.
14628         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14629         distinction.
14630         (Weak_alias_sorter::operator()): Assert that symbols are
14631         ordinary.
14632         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14633         distinction.
14634         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14635         parameters.  Change all callers.
14636         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14637         symbol distinction.  Use SHN_XINDEX when needed.
14638         (Symbol_table::write_section_symbol): Add symtab_xindex
14639         parameter.  Change all callers.
14640         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14641         SHN_XINDEX when needed.
14642         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14643         declarations.
14644         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14645         (Symbol::is_defined): Check is_ordinary.
14646         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14647         (Symbol::is_absolute, Symbol::is_common): Likewise.
14648         (class Sized_symbol): Update declarations.
14649         (class Symbol_table): Update declarations.
14650         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14651         parameters.  Change all callers.
14652         (Sized_symbol::override): Likewise.
14653         (Symbol_table::override): Likewise.
14654         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14655         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14656         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14657         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14658         to be in an ordinary section.
14659         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14660         object and is_ordinary parameters.  Change all callers.
14661         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14662         Change all callers.  Don't add undefined or non-ordinary symbols
14663         to reloc_map_.
14664         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14665         Change all callers.
14666         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14667         declarations.
14668         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14669         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14670         (Sized_relobj::relocate_sections): Likewise.
14671         * target-reloc.h (scan_relocs): Adjust section symbol index.
14672         (scan_relocatable_relocs): Likewise.
14673         * i386.cc (Scan::local): Check for ordinary symbols.
14674         * sparc.cc (Scan::local): Likewise.
14675         * x86_64.cc (Scan::local): Likewise.
14676         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14677         to symbol_section_and_value.
14678         * testsuite/many_sections_test.cc: New file.
14679         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14680         (check_PROGRAMS): Add many_sections_test.
14681         (many_sections_test_SOURCES): Define.
14682         (many_sections_test_DEPENDENCIES): Define.
14683         (many_sections_test_LDFLAGS): Define.
14684         (BUILT_SOURCES): Add many_sections_define.h.
14685         (many_sections_define.h): New target.
14686         (BUILT_SOURCES): Add many_sections_check.h.
14687         (many_sections_check.h): New target.
14688         (check_PROGRAMS): Add many_sections_r_test.
14689         (many_sections_r_test_SOURCES): Define.
14690         (many_sections_r_test_DEPENDENCIES): Define.
14691         (many_sections_r_test_LDFLAGS): Define.
14692         (many_sections_r_test_LDADD): Define.
14693         (many_sections_r_test.o): New target.
14694         * testsuite/Makefile.in: Rebuild.
14695
14696 2008-04-17  Cary Coutant  <ccoutant@google.com>
14697
14698         * errors.cc (Errors::info): New function.
14699         (gold_info): New function.
14700         * errors.h (Errors::info): New function.
14701         * gold.h (gold_info): New function.
14702         * object.cc (Input_objects::add_object): Print trace output.
14703         * options.cc (options::parse_set): New function.
14704         (General_options::parse_wrap): Deleted.
14705         (General_options::General_options): Deleted initializer.
14706         * options.h (options::String_set): New typedef.
14707         (options::parse_set): New function.
14708         (DEFINE_set): New macro.
14709         (General_options::wrap): Changed to use DEFINE_set. Changed
14710         callers of any_wrap_symbols and is_wrap_symbol.
14711         (General_options::trace, General_options::trace_symbol):
14712         New options.
14713         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14714         (General_options::wrap_symbols_): Deleted.
14715         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14716
14717 2008-04-17  David S. Miller  <davem@davemloft.net>
14718
14719         * options.cc (General_options::parse_V): New function.
14720         * options.h: Add entries for -V and -Qy.
14721
14722 2008-04-17  Ian Lance Taylor  <iant@google.com>
14723
14724         * common.cc (Symbol_table::allocate_commons): Remove options
14725         parameter.  Change caller.
14726         (Symbol_table::do_allocate_commons): Remove options parameter.
14727         Change caller.  Just call do_allocate_commons_list twice.
14728         (Symbol_table::do_allocate_commons_list): New function, broken out
14729         of do_allocate_commons.
14730         * common.h (class Allocate_commons_task): Remove options_ field.
14731         Update constructor.
14732         * symtab.cc (Symbol_table::Symbol_table): Initialize
14733         tls_commons_.
14734         (Symbol_table::add_from_object): Put TLS common symbols on
14735         tls_commons_ list.
14736         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14737         which are IN_OUTPUT_DATA.
14738         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14739         allocate_commons and do_allocate_commons declarations.  Declare
14740         do_allocate_commons_list.
14741         * gold.cc (queue_middle_tasks): Update creation of
14742         Allocate_commons_task to not pass options.
14743         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14744         (TLS_TEST_C_FLAGS): New variable.
14745         (tls_test_c_pic.o): New target.
14746         (tls_test_shared.so): Link in tls_test_c_pic.o.
14747         (tls_test_c_pic_ie.o): New target.
14748         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14749         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14750         (tls_test_c.o): New target.
14751         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14752         (tls_pic_test_LDADD): Likewise.
14753         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14754         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14755         (tls_test_c_gnu2.o): New target.
14756         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14757         tls_test_c_gnu2.o.
14758         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14759         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14760         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14761         * testsuite/tls_test.cc: Include "config.h".
14762         (t_last): Call t11_last.
14763         * testsuite/tls_test.h (t11, t11_last): Declare.
14764         * testsuite/tls_test_c.c: New file.
14765         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14766         * configure.ac: Check for OpenMP support.
14767         * configure, config.in, Makefile.in: Rebuild.
14768         * testsuite/Makefile.in: Rebuild.
14769
14770 2008-04-16  Cary Coutant  <ccoutant@google.com>
14771
14772         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14773         (Target_i386::tls_base_symbol_defined_): New field.
14774         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14775         (Target_i386::Scan::global): Likewise.
14776         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14777         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14778         (Target_x86_64::tls_base_symbol_defined_): New field.
14779         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14780         (Target_x86_64::Scan::global): Likewise.
14781
14782 2008-04-16  Cary Coutant  <ccoutant@google.com>
14783
14784         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14785         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14786         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14787         building shared libraries.
14788         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14789         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14790         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14791         * testsuite/Makefile.in: Rebuild.
14792         * testsuite/weak_undef.h: New file.
14793         * testsuite/weak_undef_file1.cc: Add extra test cases.
14794         * testsuite/weak_undef_file2.cc: Likewise.
14795         * testsuite/weak_undef_test.cc: Likewise.
14796
14797 2008-04-16  David S. Miller  <davem@davemloft.net>
14798
14799         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14800         Add issued_non_pic_error_ field.  Declare check_non_pic.
14801         (Target_sparc::Scan::check_non_pic): New function.
14802         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14803         (Target_sparc::Scan::global): Likewise.
14804
14805         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14806         * configure: Rebuild.
14807
14808         * options.h (DEFINE_enable): New macro.
14809         (new_dtags): New enable option.
14810         (initfirst, interpose, loadfltr, nodefaultlib,
14811         nodelete, nodlopen, nodump): New -z options.
14812         * layout.cc (Layout:finish_dynamic_section): If new
14813         dtags enabled, emit DT_RUNPATH.  Also, emit a
14814         DT_FLAGS_1 containing any specified -z flags.
14815
14816 2008-04-16  Ian Lance Taylor  <iant@google.com>
14817
14818         * copy-relocs.cc: New file.
14819         * copy-relocs.h: New file.
14820         * reloc.cc: Remove Copy_relocs code.
14821         * reloc.h: Likewise.
14822         * reloc-types.h (struct Reloc_types) [both versions]: Add
14823         get_reloc_addend_noerror.
14824         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14825         variants of add_global which take an addend which must be zero.
14826         * i386.cc: Include "copy-relocs.h".
14827         (class Target_i386): Change type of copy_relocs_ to variable,
14828         update initializer.
14829         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14830         Change all callers.
14831         (Target_i386::do_finalize_sections): Change handling of
14832         copy_relocs_.
14833         * sparc.cc: Include "copy-relocs.h".
14834         (class Target_sparc): Change type of copy_relocs_ to variable,
14835         update initializer.
14836         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14837         Change all callers.
14838         (Target_sparc::do_finalize_sections): Change handling of
14839         copy_relocs_.
14840         * x86_64.cc: Include "copy-relocs.h".
14841         (class Target_x86_64): Change type of copy_relocs_ to variable,
14842         update initializer.
14843         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14844         class.  Change all callers.
14845         (Target_x86_64::do_finalize_sections): Change handling of
14846         copy_relocs_.
14847         * Makefile.am (CCFILES): Add copy-relocs.cc.
14848         (HFILES): Add copy-relocs.h.
14849
14850         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14851
14852         * testsuite/script_test_4.sh: Permit leading zeroes.
14853
14854 2008-04-15  Ian Lance Taylor  <iant@google.com>
14855
14856         * script-sections.cc (Script_sections::create_segments): Use
14857         header_size_adjustment even when there is enough room for the
14858         headers.
14859         * testsuite/script_test_4.sh: New file.
14860         * testsuite/script_test_4.t: New file.
14861         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14862         (check_DATA): Add script_test_4.stdout.
14863         (MOSTLYCLEANFILES): Likewise.
14864         (script_test_4): New target.
14865         (script_test_4.stdout): New target.
14866         * testsuite/Makefile.in: Rebuild.
14867
14868         * sparc.cc: Add definitions for Output_data_plt_sparc class
14869         constants.
14870
14871 2008-04-14  David S. Miller  <davem@davemloft.net>
14872
14873         * sparc.cc: New file.
14874         * Makefile.am (TARGETSOURCES): Add sparc.cc
14875         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14876         * configure.tgt: Document targ_extra_size and
14877         targ_extra_big_endian.  Add entries for sparc-* and
14878         sparc64-*.
14879         * configure.ac: Handle targ_extra_size and
14880         targ_extra_big_endian.
14881         * Makefile.in: Rebuild.
14882         * configure: Likewise.
14883         * po/POTFILES.in: Likewise.
14884         * po/gold.pot: Likewise.
14885
14886 2008-04-14  Ian Lance Taylor  <iant@google.com>
14887
14888         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14889         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14890         in the name/type/flags to section mapping.  Don't call
14891         allocate_output_section.
14892         (Layout::choose_output_section): Change parameter from adjust_name
14893         to is_input_section.  Don't permit input sections after sections
14894         are attached to segments.  Don't call allocate_output_section.
14895         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14896         not write_enable_output_section.
14897         (Layout::make_output_section): Don't push to
14898         unattached_section_list_ nor call attach_to_segment.  Call
14899         attach_section_to_segment if sections are attached.
14900         (Layout::attach_sections_to_segments): New function.
14901         (Layout::attach_section_to_segment): New function.
14902         (Layout::attach_allocated_section_to_segment): Rename from
14903         attach_to_segment.  Remove flags parameter.
14904         (Layout::allocate_output_section): Remove function.
14905         (Layout::write_enable_output_section): Remove function.
14906         * layout.h (class Layout): Update for above changes.  Add new
14907         field sections_are_attached_.
14908         * output.h (Output_section::update_flags_for_input_section): New
14909         function.
14910         * output.cc (Output_section::add_input_section): Call
14911         update_flags_for_input_section.
14912         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14913
14914 2008-04-11  Cary Coutant  <ccoutant@google.com>
14915
14916         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14917         thought unnecessary.
14918         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14919
14920 2008-04-11  Ian Lance Taylor  <iant@google.com>
14921
14922         * output.h (class Output_section_data): Remove inline definition
14923         of set_addralign.
14924         * output.cc (Output_section_data::set_addralign): New function.
14925
14926 2008-04-11  Cary Coutant  <ccoutant@google.com>
14927
14928         Add support for TLS descriptors for i386 and x86_64.
14929         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14930         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14931         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14932         GOT_TYPE_TLS_DESC.
14933         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14934         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14935         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14936         relocations.
14937         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14938         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14939         Fix problem with initial-exec relocations.
14940         (Target_i386::Relocate::relocate_tls): Likewise.
14941         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14942         relaxation.
14943         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14944         support for section-plus-offset dynamic table entries.
14945         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14946         (Output_data_dynamic::Dynamic_entry): Add support for
14947         section-plus-offset dynamic table entries.
14948         (Output_data_dynamic::Classification): Likewise.
14949         (Output_data_dynamic::classification_): Renamed offset_.
14950         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14951         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14952         (Target_x86_64::make_plt_section): New function.
14953         (Target_x86_64::reserve_tlsdesc_entries): New function.
14954         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14955         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14956         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14957         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14958         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14959         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14960         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14961         add extra PLT entry for TLS descriptors.
14962         (Output_data_plt_x86_64::got_): New field.
14963         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14964         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14965         fields.
14966         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14967         descriptors.
14968         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14969         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14970         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14971         R_386_TLS_DESC_CALL relocations.
14972         (Target_x86_64::Scan::global): Likewise.
14973         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14974         for TLS descriptors.
14975         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14976         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14977         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14978         GD-to-IE relaxation.
14979         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14980         and TLS_DESCRIPTORS.
14981         * Makefile.in: Rebuild.
14982         * configure: Rebuild.
14983         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14984         (tls_test_shared2.so): New target.
14985         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14986         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14987         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14988         (tls_shared_gd_to_ie_test_LDADD): New variable.
14989         (tls_shared_gnu2_gd_to_ie_test): New target.
14990         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14991         New targets.
14992         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14993         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14994         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14995         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14996         (tls_shared_gnu2_test): New target.
14997         (tls_test_gnu2_shared.so): New target.
14998         (tls_shared_gnu2_test_SOURCES): New variable.
14999         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15000         (tls_shared_gnu2_test_LDFLAGS): New variable.
15001         (tls_shared_gnu2_test_LDADD): New variable.
15002         * testsuite/Makefile.in: Rebuild.
15003         * testsuite/Makefile.
15004
15005 2008-04-11  Ian Lance Taylor  <iant@google.com>
15006
15007         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15008         justsyms.t.
15009         * testsuite/Makefile.in: Rebuild.
15010
15011         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15012         long.
15013         * testsuite/script_test_2.cc (main): Adjust test.
15014
15015 2008-04-11  David S. Miller  <davem@davemloft.net>
15016             Ian Lance Taylor  <iant@google.com>
15017
15018         * options.h (General_options): Add entries for '-Y' and
15019         '-relax'.
15020         * options.cc (General_options:finalize): If -Y was used, add those
15021         entries to the library path instead of the default "/lib" and
15022         "/usr/lib".
15023
15024 2008-04-11  David S. Miller  <davem@davemloft.net>
15025
15026         * testsuite/justsyms.t: Start at 0x100.
15027         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15028         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15029         long.
15030         * testsuite/script_test_2.cc: Adjust string and section length
15031         checks.
15032
15033 2008-04-09  Ian Lance Taylor  <iant@google.com>
15034
15035         PR gold/5996
15036         * script-sections.cc (Sections_element::allocate_to_segment): Add
15037         orphan parameter.
15038         (Output_section_definition::allocate_to_segment): Likewise.
15039         (Orphan_output_section::allocate_to_segment): Likewise.
15040         (Script_sections::attach_sections_using_phdrs_clause): Don't
15041         propagate non-PT_LOAD segments to orphan sections.
15042         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15043         readelf rather than objdump.
15044         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15045         .interp section and PT_INTERP segment are the same size.
15046         * testsuite/Makefile.in: Rebuild.
15047
15048         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15049         aliases for symbols defined in the same object.
15050         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15051         (weak_alias_test_SOURCES): New variable.
15052         (weak_alias_test_DEPENDENCIES): New variable.
15053         (weak_alias_test_LDFLAGS): New variable.
15054         (weak_alias_test_LDADD): New variable.
15055         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15056         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15057         (weak_alias_test_3.o): New target.
15058         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15059         * testsuite/weak_alias_test_main.cc: New file.
15060         * testsuite/weak_alias_test_1.cc: New file.
15061         * testsuite/weak_alias_test_2.cc: New file.
15062         * testsuite/weak_alias_test_3.cc: New file.
15063
15064 2008-04-08  Ian Lance Taylor  <iant@google.com>
15065
15066         * options.h (class General_options): Add --noinhibit-exec option.
15067         * main.cc (main): Check --noinhibit-exec.
15068
15069         * options.h (class General_options): Define --wrap as a special
15070         option.  Add wrap_symbols_ field.
15071         (General_options::any_wrap_symbols): New function.
15072         (General_options::is_wrap_symbol): New function.
15073         * options.cc (General_options::parse_wrap): New function.
15074         (General_options::General_options): Initialize wrap_symbols_.
15075         * symtab.cc (Symbol_table::wrap_symbol): New function.
15076         (Symbol_table::add_from_object): Handle --wrap.
15077         * symtab.h (class Symbol_table): Declare wrap_symbol.
15078         * target.h (Target::wrap_char): New function.
15079         (Target::Target_info): Add wrap_char field.
15080         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15081         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15082         * testsuite/testfile.cc (Target_test::test_target_info):
15083         Likewise.
15084
15085         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15086         there is one.
15087
15088         * layout.h (class Layout): Add added_eh_frame_data_ field.
15089         * layout.cc (Layout::Layout): Initialize new field.
15090         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15091         output section until we find a section we merged successfully.
15092         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15093         that the size be non-zero.
15094
15095         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15096         qualifier.
15097
15098 2008-04-08  Craig Silverstein  <csilvers@google.com>
15099
15100         * configure.ac: Export new conditional variable HAVE_ZLIB.
15101         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15102         on HAVE_ZLIB.
15103         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15104         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15105
15106 2008-04-07  Ian Lance Taylor  <iant@google.com>
15107
15108         * version.cc (version_string): Set to "1.5".
15109
15110         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15111         Add issued_non_pic_error_ field.  Declare check_non_pic.
15112         (Target_x86_64::Scan::check_non_pic): New function.
15113         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15114         (Target_x86_64::Scan::global): Likewise.
15115
15116         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15117         addend parameter.  Change caller.  Handle merge sections.
15118         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15119         Address to Addend.  Don't add in the result of
15120         local_section_offset, pass down the addend and use the returned
15121         value.
15122         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15123         Update declarations of local_section_offset and symbol_value.
15124         * testsuite/two_file_test_1.cc (t18): New function.
15125         * testsuite/two_file_test_2.cc (f18): New function.
15126         * testsuite/two_file_test_main.cc (main): Call t18.
15127         * testsuite/two_file_test.h (t18, f18): Declare.
15128
15129         * configure.ac: Don't test for objdump, c++filt, or readelf.
15130         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15131         conditionals.
15132         (TEST_READELF): New variable.
15133         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15134         (check_PROGRAMS): Add two_file_strip_test.
15135         (two_file_strip_test): New target.
15136         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15137         (two_file_same_shared_strip_test_SOURCES): New variable.
15138         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15139         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15140         (two_file_same_shared_strip_test_LDADD): New variable.
15141         (two_file_shared_strip.so): New target.
15142         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15143         (ver_test_5.syms, ver_test_7.syms): Likewise.
15144         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15145         (strip_test_3.stdout): Use TEST_OBJDUMP.
15146         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15147
15148 2008-04-04  Cary Coutant  <ccoutant@google.com>
15149
15150         * symtab.h (Symbol::is_weak_undefined): New function.
15151         (Symbol::is_strong_undefined): New function.
15152         (Symbol::is_absolute): New function.
15153         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15154         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15155         absolute symbols.
15156         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15157         (weak_undef_test): New target.
15158         * testsuite/Makefile.in: Rebuild.
15159         * testsuite/weak_undef_file1.cc: New file.
15160         * testsuite/weak_undef_file2.cc: New file.
15161         * testsuite/weak_undef_test.cc: New file.
15162
15163 2008-04-03  Craig Silverstein  <csilvers@google.com>
15164
15165         * compressed_output.h (class Output_compressed_section): Use
15166         unsigned buffer.
15167         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15168         add zlib header.
15169         (zlib_compressed_suffix): Removed.
15170         (Output_compressed_section::set_final_data_size): Use unsigned
15171         buffers.
15172         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15173         Fix linker invocation.
15174         (flagstest_o_specialfile_and_compress_debug_sections):
15175         Likewise.
15176         * testsuite/Makefile.in: Regenerated.
15177
15178 2008-04-02  David S. Miller  <davem@davemloft.net>
15179
15180         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15181         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15182
15183 2008-04-02  Craig Silverstein  <csilvers@google.com>
15184
15185         * TODO: New file.
15186
15187 2008-04-02  Ian Lance Taylor  <iant@google.com>
15188
15189         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15190         parameters.  Update for new key type to views_.  Change all
15191         callers.
15192         (File_read::read): Adjust for byteshift in returned view.
15193         (File_read::add_view): New function, broken out of
15194         find_and_make_view.
15195         (File_read::make_view): New function, broken out of
15196         find_and_make_view.
15197         (File_read::find_or_make_view): Add offset and aligned
15198         parameters.  Rewrite accordingly.  Change all callers.
15199         (File_read::get_view): Add offset and aligned parameters.  Adjust
15200         for byteshift in return value.
15201         (File_read::get_lasting_view): Likewise.
15202         * fileread.h (class File_read): Update declarations.
15203         (class File_read::View): Add byteshift_ field.  Add byteshift to
15204         constructor.  Add byteshift method.
15205         * archive.h (Archive::clear_uncached_views): New function.
15206         (Archive::get_view): Add aligned parameter.  Change all callers.
15207         * object.h (Object::get_view): Add aligned parameter.  Change all
15208         callers.
15209         (Object::get_lasting_view): Likewise.
15210
15211         * fileread.cc (File_read::release): Don't call clear_views if
15212         there are multiple objects.
15213         * fileread.h (File_read::clear_uncached_views): New function.
15214         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15215         on the archive.
15216
15217 2008-03-31  Cary Coutant  <ccoutant@google.com>
15218
15219         Add thin archive support.
15220         * archive.cc (Archive::armagt): New const.
15221         (Archive::setup): Remove task parameter and calls to unlock.
15222         (Archive::unlock_nested_archives): New function.
15223         (Archive::read_header): Add nested_off parameter. Change
15224         all callers.
15225         (Archive::interpret_header): Likewise.
15226         (Archive::include_all_members): Change to handle thin
15227         archives.
15228         (Archive::include_member): Likewise.
15229         * archive.h (Archive::Archive): Add new parameters and
15230         initializers.
15231         (Archive::armagt): New const.
15232         (Archive::setup): Remove task parameter.
15233         (Archive::unlock_nested_archives): New function.
15234         (Archive::read_header): Add nested_off parameter.
15235         (Archive::interpret_header): Likewise.
15236         (Archive::Nested_archive_table): New typedef.
15237         (Archive::is_thin_archive_): New field.
15238         (Archive::nested_archives_): New field.
15239         (Archive::options_): New field.
15240         (Archive::dirpath_): New field.
15241         (Archive::task_): New field.
15242         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15243         for thin archives.  Pass additional parameters to
15244         Archive::Archive.  Unlock the archive file after calling
15245         Archive::setup.
15246
15247 2008-03-29  Ian Lance Taylor  <iant@google.com>
15248
15249         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15250         version symbol to be local.
15251         * testsuite/ver_test_4.sh: New file.
15252         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15253         (check_DATA): Add ver_test_4.syms.
15254         (ver_test_4.syms): New target.
15255         * testsuite/Makefile.in: Rebuild.
15256
15257         * output.cc
15258         (Output_section::Input_section_sort_entry::has_priority): New
15259         function.
15260         (Output_section::Input_section_sort_entry::match_file_name): New
15261         function.
15262         (Output_section::Input_section_sort_entry::match_section_name):
15263         Remove.
15264         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15265         Remove.
15266         (Output_section::Input_section_sort_entry::match_section_file):
15267         Remove.
15268         (Output_section::Input_section_sort_compare::operator()): Rewrite
15269         using new Input_section_sort_entry functions.  Sort crtbegin and
15270         crtend first.  Sort sections with no priority before sections with
15271         a priority.
15272         * testsuite/initpri1.c (d3): Check j != 4.
15273         (cd5): New constructor/destructor function.
15274         (main): Check j != 2.
15275
15276         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15277         new symbol when resolving, don't call set_is_default.
15278         * testsuite/ver_test_7.cc: New file.
15279         * testsuite/ver_test_7.sh: New file.
15280         * testsuite/Makefile.am (ver_test_7.so): New target.
15281         (ver_test_7.o): New target.
15282         (check_SCRIPTS): Add ver_test_7.sh.
15283         (check_DATA): Add ver_test_7.syms.
15284         (ver_test_7.syms): New target.
15285
15286 2008-03-28  Ian Lance Taylor  <iant@google.com>
15287
15288         * layout.cc (Layout::layout): If we see an input section with a
15289         name that needs sorting, set the must_sort flag for the output
15290         section.
15291         (Layout::make_output_section): If the name of the output section
15292         indicates that it might require sorting, set the may_sort flag.
15293         * output.h (Output_section::may_sort_attached_input_sections): New
15294         function.
15295         (Output_section::set_may_sort_attached_input_sections): New
15296         function.
15297         (Output_section::must_sort_attached_input_sections): New
15298         function.
15299         (Output_section::set_must_sort_attached_input_sections): New
15300         function.
15301         (class Output_section): Declare Input_section_sort_entry.  Define
15302         Input_section_sort_compare.  Declare
15303         sort_attached_input_sections.  Add new fields:
15304         may_sort_attached_input_sections_,
15305         must_sort_attached_input_sections_,
15306         attached_input_sections_are_sorted_.
15307         * output.cc (Output_section::Output_section): Initialize new
15308         fields.
15309         (Output_section::add_input_section): Add an entry to
15310         input_sections_ if may_sort or must_sort are true.
15311         (Output_section::set_final_data_size): Call
15312         sort_attached_input_sections if necessary.
15313         (Output_section::Input_section_sort_entry): Define new class.
15314         (Output_section::Input_section_sort_compare::operator()): New
15315         function.
15316         (Output_section::sort_attached_input_sections): New function.
15317         * configure.ac: Check whether the compiler supports constructor
15318         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15319         * testsuite/initpri1.c: New file.
15320         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15321         CONSTRUCTOR_PRIORITY.
15322         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15323         (initpri1_LDFLAGS): New variable.
15324         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15325
15326 2008-03-27  Ian Lance Taylor  <iant@google.com>
15327
15328         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15329         * testsuite/common_test_1.c: New file.
15330         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15331         (common_test_1_SOURCES): New variable.
15332         (common_test_1_DEPENDENCIES): New variable.
15333         (common_test_1_LDFLAGS): New variable.
15334
15335         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15336         and commons_ correctly when NAME/VERSION does not override
15337         NAME/NULL.
15338         * testsuite/ver_test_6.c: New file.
15339         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15340         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15341         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15342
15343 2008-03-26  Ian Lance Taylor  <iant@google.com>
15344
15345         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15346         of an undefined symbol from a version script.
15347         * testsuite/Makefile.am (ver_test_5.so): New target.
15348         (ver_test_5.o): New target.
15349         (check_SCRIPTS): Add ver_test_5.sh.
15350         (check_DATA): Add ver_test_5.syms.
15351         (ver_test_5.syms): New target.
15352         * testsuite/ver_test_5.cc: New file.
15353         * testsuite/ver_test_5.script: New file.
15354         * testsuite/ver_test_5.sh: New file.
15355         * Makefile.in, testsuite/Makefile.in: Rebuild.
15356
15357         PR gold/5986
15358         Fix problems building gold with gcc 4.3.0.
15359         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15360         (gold_error_at_location, gold_warning_at_location): Use it.
15361         * configure.ac: Check whether we can compile and use a template
15362         function with a printf attribute.
15363         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15364         when jumping over bytes.
15365         * object.cc: Instantiate Object::read_section_data.
15366         * debug.h: Include <cstring>
15367         * dwarf_reader.cc: Include <algorithm>
15368         * main.cc: Include <cstring>.
15369         * options.cc: Include <cstring>.
15370         * output.cc: Include <cstring>.
15371         * script.cc: Include <cstring>.
15372         * script.h: Include <string>.
15373         * symtab.cc: Include <cstring> and <algorithm>.
15374         * target-select.cc: Include <cstring>.
15375         * version.cc: Include <string>.
15376         * testsuite/testmain.cc: Include <cstdlib>.
15377         * configure, config.in: Rebuild.
15378
15379 2008-03-25  Ian Lance Taylor  <iant@google.com>
15380
15381         * options.cc: Include "../bfd/bfdver.h".
15382         (options::help): Print bug reporting address.
15383
15384         * version.cc (print_version): Adjust output for current value of
15385         BFD_VERSION_STRING.
15386
15387         * NEWS: New file.
15388
15389         * options.cc (options::help): Print list of supported targets.
15390         * target-select.h: Include <vector>.
15391         (class Target_selector): Make machine_, size_, and is_big_endian_
15392         fields const.  Add bfd_name_ and instantiated_target_ fields.
15393         (Target_selector::Target_selector): Add bfd_name parameter.
15394         (Target_selector::recognize): Make non-virtual, call
15395         do_recognize.
15396         (Target_selector::recognize_by_name): Make non-virtual, call
15397         do_recognize_by_name.
15398         (Target_selector::supported_names): New function.
15399         (Target_selector::bfd_name): New function.
15400         (Target_selector::do_instantiate_target): New pure virtual
15401         function.
15402         (Target_selector::do_recognize): New virtual function.
15403         (Target_selector::do_recognize_by_name): New virtual function.
15404         (Target_selector::instantiate_target): New private function.
15405         (supported_target_names): Declare.
15406         * target-select.cc (Target_selector::Target_selector): Update for
15407         new parameter and fields.
15408         (select_target_by_name): Check that the name matches before
15409         calling recognize_by_name.
15410         (supported_target_names): New function.
15411         * i386.cc (class Target_selector_i386): Update Target_selector
15412         constructor call.  Remove recognize and recognize_by_name.  Add
15413         do_instantiate_target.
15414         * x86_64.cc (class Target_selector_x86_64): Likewise.
15415         * testsuite/testfile.cc (class Target_selector_test): Update for
15416         changes to Target_selector.
15417
15418         * README: Rewrite, with some notes on unsupported features.
15419
15420 2008-03-24  Cary Coutant  <ccoutant@google.com>
15421
15422         * i386.cc (Target_i386::Got_type): New enum declaration.
15423         (Target_i386::Scan::local): Updated callers of Output_data_got
15424         member functions.
15425         (Target_i386::Scan::global): Likewise.
15426         (Target_i386::Relocate::relocate): Likewise.
15427         (Target_i386::Relocate::relocate_tls): Likewise.
15428         * object.h (Got_offset_list): New class.
15429         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15430         (Sized_relobj::local_got_offset): Likewise.
15431         (Sized_relobj::set_local_got_offset): Likewise.
15432         (Sized_relobj::local_has_tls_got_offset): Removed.
15433         (Sized_relobj::local_tls_got_offset): Removed.
15434         (Sized_relobj::set_local_tls_got_offset): Removed.
15435         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15436         * output.cc (Output_data_got::add_global): Added got_type parameter.
15437         (Output_data_got::add_global_with_rel): Likewise.
15438         (Output_data_got::add_global_with_rela): Likewise.
15439         (Output_data_got::add_global_pair_with_rel): New function.
15440         (Output_data_got::add_global_pair_with_rela): New function.
15441         (Output_data_got::add_local): Added got_type parameter.
15442         (Output_data_got::add_local_with_rel): Likewise.
15443         (Output_data_got::add_local_with_rela): Likewise.
15444         (Output_data_got::add_local_pair_with_rel): New function.
15445         (Output_data_got::add_local_pair_with_rela): New function.
15446         (Output_data_got::add_global_tls): Removed.
15447         (Output_data_got::add_global_tls_with_rel): Removed.
15448         (Output_data_got::add_global_tls_with_rela): Removed.
15449         (Output_data_got::add_local_tls): Removed.
15450         (Output_data_got::add_local_tls_with_rel): Removed.
15451         (Output_data_got::add_local_tls_with_rela): Removed.
15452         * output.h (Output_data_got::add_global): Added got_type parameter.
15453         (Output_data_got::add_global_with_rel): Likewise.
15454         (Output_data_got::add_global_with_rela): Likewise.
15455         (Output_data_got::add_global_pair_with_rel): New function.
15456         (Output_data_got::add_global_pair_with_rela): New function.
15457         (Output_data_got::add_local): Added got_type parameter.
15458         (Output_data_got::add_local_with_rel): Likewise.
15459         (Output_data_got::add_local_with_rela): Likewise.
15460         (Output_data_got::add_local_pair_with_rel): New function.
15461         (Output_data_got::add_local_pair_with_rela): New function.
15462         (Output_data_got::add_global_tls): Removed.
15463         (Output_data_got::add_global_tls_with_rel): Removed.
15464         (Output_data_got::add_global_tls_with_rela): Removed.
15465         (Output_data_got::add_local_tls): Removed.
15466         (Output_data_got::add_local_tls_with_rel): Removed.
15467         (Output_data_got::add_local_tls_with_rela): Removed.
15468         * resolve.cc (Symbol::override_base_with_special): Removed
15469         reference to has_got_offset_ field.
15470         * symtab.cc (Symbol::init_fields): Replaced initialization
15471         of got_offset_ with got_offsets_.  Removed initialization
15472         of has_got_offset_
15473         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15474         (Symbol::got_offset): Likewise.
15475         (Symbol::set_got_offset): Likewise.
15476         (Symbol::has_tls_got_offset): Removed.
15477         (Symbol::tls_got_offset): Removed.
15478         (Symbol::set_tls_got_offset): Removed.
15479         (Symbol::got_offset_): Removed.
15480         (Symbol::tls_mod_got_offset_): Removed.
15481         (Symbol::tls_pair_got_offset_): Removed.
15482         (Symbol::got_offsets_): New field.
15483         (Symbol::has_got_offset): Removed.
15484         (Symbol::has_tls_mod_got_offset): Removed.
15485         (Symbol::has_tls_pair_got_offset): Removed.
15486         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15487         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15488         member functions.
15489         (Target_x86_64::Scan::global): Likewise.
15490         (Target_x86_64::Relocate::relocate): Likewise.
15491         (Target_x86_64::Relocate::relocate_tls): Likewise.
15492
15493 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15494
15495         * yyscript.y: Fix spelling error in comment.
15496
15497 2008-03-24  Ian Lance Taylor  <iant@google.com>
15498
15499         * options.h (class General_options): Define build_id option.
15500         * layout.h (class Layout): Declare write_build_id, create_note,
15501         create_build_id.  Add build_id_note_ member.
15502         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15503         "libiberty.h", "md5.h", "sha1.h".
15504         (Layout::Layout): Initialize eh_frame_data_,
15505         eh_frame_hdr_section_, and build_id_note_.
15506         (Layout::finalize): Call create_build_id.
15507         (Layout::create_note): New function, broken out of
15508         Layout::create_gold_note.
15509         (Layout::create_gold_note): Call create_note.
15510         (Layout::create_build_id): New function.
15511         (Layout::write_build_id): New function.
15512         (Close_task_runner::run): Call write_build_id.
15513
15514         * x86_64.cc: Correct license to GPLv3.
15515
15516 2008-03-23  Ian Lance Taylor  <iant@google.com>
15517
15518         * options.cc: Include "demangle.h".
15519         (parse_optional_string): New function.
15520         (parse_long_option): Handle takes_optional_argument.
15521         (parse_short_option): Update dash_z initializer.  Handle
15522         takes_optional_argument.
15523         (General_options::General_options): Initialize do_demangle_.
15524         (General_options::finalize): Set do_demangle_.  Handle demangling
15525         style.
15526         * options.h (parse_optional_string): Declare.
15527         (struct One_option): Add optional_arg field.  Update constructor.
15528         Update call constructor calls.  Add takes_optional_argument
15529         function.
15530         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15531         (DEFINE_optional_string): Define.
15532         (General_options::demangle): Change from DEFINE_bool to
15533         DEFINE_optional_string.
15534         (General_options::no_demangle): New function.
15535         (General_options::do_demangle): New function.
15536         (General_options::set_do_demangle): New function.
15537         (General_options::execstack_status_): Move definition to end of
15538         class definition.
15539         (General_options::static_): Likewise.
15540         (General_options::do_demangle_): New field.
15541         * object.cc (big_endian>::get_symbol_location_info): Call
15542         Options::do_demangle, not Options::demangle.
15543         * symtab.cc (demangle): Likewise.
15544
15545 2008-03-22  Ian Lance Taylor  <iant@google.com>
15546
15547         * gold.h: Include <cstddef> and <sys/types.h>
15548         * options.h: Include <cstring>.
15549
15550 2008-03-21  Ian Lance Taylor  <iant@google.com>
15551
15552         * Added source code to GNU binutils.
15553 \f
15554 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15555
15556 Copying and distribution of this file, with or without modification,
15557 are permitted in any medium without royalty provided the copyright
15558 notice and this notice are preserved.
15559
15560 Local Variables:
15561 mode: change-log
15562 left-margin: 8
15563 fill-column: 74
15564 version-control: never
15565 End: