5996f3e326fbbfe6d00ceaaa061205dc12592408
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-02-05  Cary Coutant  <ccoutant@google.com>
2
3         Fix issues with gold undefined symbol diagnostics.
4
5         PR binutils/15435
6         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
7         check to here.
8         * target-reloc.h (is_strong_undefined): New function.
9         (relocate_section): Move undef vtable symbol check from here.
10         Check for is_strong_undefined.
11
12 2014-02-05  Cary Coutant  <ccoutant@google.com>
13     
14         Fix problems with the --dynamic-list option.
15
16         PR gold/13577
17         * options.cc (General_options::parse_dynamic_list):
18         Set have_dynamic_list_.
19         (General_options::General_options): Initialize have_dynamic_list_.
20         (General_options::finalize): Turn off -Bsymbolic and
21         -Bsymbolic-functions if --dynamic-list provided.
22         * options.h (General_options::have_dynamic_list): New function.
23         (General_options::have_dynamic_list_): New data member.
24         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
25         correctly.
26    
27         PR gold/16530
28         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
29         in --dynamic-list, mark it.
30    
31         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
32         (dynamic_list_2): New test case.
33         * testsuite/Makefile.in: Regenerate.
34         * testsuite/dynamic_list_2.cc: New file.
35         * testsuite/dynamic_list_2.t: New file.
36         * testsuite/dynamic_list_lib1.cc: New file.
37         * testsuite/dynamic_list_lib2.cc: New file.
38         * testsuite/gc_dynamic_list_test.c: New file.
39         * testsuite/gc_dynamic_list_test.sh: New file.
40         * testsuite/gc_dynamic_list_test.t: New file.
41
42 2014-01-28  Cary Coutant  <ccoutant@google.com>
43
44         Add .gdb_index version 7 support.
45
46         * gold/dwarf_reader.cc: include <utility> (for make_pair).
47         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
48         debug sections.
49         (Dwarf_ranges_table::read_ranges_table): Likewise.
50         (Dwarf_pubnames_table::read_section): Check for GNU-style
51         sections, and for compressed debug sections.
52         (Dwarf_pubnames_table::read_header): Compute end address of table.
53         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
54         for end of list by offset, not by offset == 0.
55         (Dwarf_info_reader::do_read_string_table): Check for compressed
56         debug sections.
57         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
58         Initialize new data members.
59         (Dwarf_pubnames_table::next_name): return flag_byte.
60         (Dwarf_pubnames_table::end_of_table_): New data member.
61         (Dwarf_pubnames_table::is_gnu_style_): New data member.
62         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
63         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
64         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
65         read skeleton type unit DIEs.
66         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
67         (Gdb_index::do_write): Write flag_byte.
68         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
69         (Gdb_index::Cu_vector): Store flags along with cu indexes.
70         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
71         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
72
73 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
74
75         * version.cc (print_version): Update copyright year to 2014.
76
77 2013-12-19  Dimitry Andric  <dimitry@andric.com>
78
79         * stringpool.cc (Stringpool_template::reserve): Add
80         HAVE_UNORDERED_MAP case.
81         * stringpool.cc (Stringpool_template::print_stats): Likewise.
82
83 2013-12-18  Cary Coutant  <ccoutant@google.com>
84
85         * configure.ac: Check for <unordered_set> and <unordered_map>.
86         * config.in: Regenerate.
87         * configure: Regenerate.
88         * system.h: Use <unordered_set> and <unordered_map> if available.
89
90 2013-12-10  Roland McGrath  <mcgrathr@google.com>
91
92         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
93         with $(INSTALL_PROGRAM_ENV).
94         * Makefile.in: Regenerate.
95
96 2013-11-22  Cary Coutant  <ccoutant@google.com>
97
98         * configure.ac: Add check for which library is needed for
99         dlopen.
100         * configure: Regenerate.
101
102 2013-11-22  Cary Coutant  <ccoutant@google.com>
103
104         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
105         assembler.
106         * testsuite/Makefile.in: Regenerate.
107
108 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
109
110         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
111         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
112         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
113         (Target_x86_64<size>::Scan::local): Likewise.
114         (Target_x86_64<size>::Scan::global): Likewise.
115         (Target_x86_64<size>::Relocate::relocate): Likewise.
116         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
117         Likewise.
118         (Target_x86_64<size>::Scan::check_non_pic(): Handle
119         R_X86_64_PC32_BND.
120
121         * testsuite/Makefile.am (check_PROGRAMS): Add
122         exception_x86_64_bnd_test.
123         (exception_x86_64_bnd_test_SOURCES): New macro.
124         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
125         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
126         (exception_x86_64_bnd_test_LDADD): Likewise.
127         (exception_x86_64_bnd_1.o): New rule.
128         (exception_x86_64_bnd_2.o): Likewise.
129         * testsuite/Makefile.in: Regenerated.
130
131 2013-11-15  Alan Modra  <amodra@gmail.com>
132
133         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
134         accessor.
135         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
136         Only call ppc64_local_entry_offset for 64-bit.  Restrict
137         symval_for_branch lookup to ELFv1.
138         (Stub_table::add_plt_call_entry): Use unsigned int off.
139         (Output_data_glink::Address, invalid_address): New.
140         (Output_data_glink::add_eh_frame): Move out of line.  Add
141         support for ELFv2.
142         (Output_data_glink::add_global_entry, find_global_entry,
143         global_entry_address): New functions.
144         (Output_data_glink::global_entry_stubs_, end_branch_table_,
145         ge_size): New variables.
146         (Output_data_glink::set_final_data_size): Add global entry
147         stub sizing.
148         (Output_data_glink::do_write): Write global entry stubs.
149         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
150         parameter.  Return true for ELFv2.  Adjust callers.
151         (Target_powerpc::Scan::local, global): Restrict opd lookup to
152         ELFv1.  Similarly for ifunc and dynamic relocation processing
153         specific to ELFv1.  Recognize that symbols are defined on
154         their plt entries for ELFv2.
155         (Target_powerpc::symval_for_branch): Assert if called for
156         ELFv2 or ppc32.
157         (Target_powerpc::Relocate::relocate): Use global entry plt
158         stub for symbol value if such exists on ELFv2.
159         (Target_powerpc::Relocate::relocate): Don't call
160         symval_for_branch when ELFv2.  Do adjust for local entry
161         offset when ELFv2.
162         (Target_powerpc::do_dynsym_value): Set symbols to global entry
163         plt stub for ELFv2.
164         (Target_powerpc::do_plt_address_for_global): Similarly.
165
166 2013-11-14  Cary Coutant  <ccoutant@google.com>
167
168         Revert patch -- this did not fix the problem, and there is
169         no race there.
170
171         2013-11-14  Cary Coutant  <ccoutant@google.com>
172
173             PR gold/14860
174             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
175             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
176             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
177             updating fde_offsets_.
178             (Eh_frame_hdr::lock_): New data member.
179
180 2013-11-14  Cary Coutant  <ccoutant@google.com>
181
182         * dwp.cc (Dwo_file_entry): New type.
183         (File_list): Use Dwo_file_entry.
184         (Dwo_file::verify): New function.
185         (Dwo_file::verify_dwo_list): New function.
186         (Dwo_file::sized_verify_dwo_list): New function.
187         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
188         list.
189         (Dwp_options): New enum type.
190         (dwp_options): Add --verify-only.
191         (usage): Likewise.
192         (main): Likewise.
193         * dwp.h (gold_info): Add declaration.
194
195 2013-11-14  Cary Coutant  <ccoutant@google.com>
196
197         PR gold/14860
198         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
199         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
200         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
201         updating fde_offsets_.
202         (Eh_frame_hdr::lock_): New data member.
203
204 2013-11-06  Cary Coutant  <ccoutant@google.com>
205
206         PR gold/15758
207         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
208         before reloc sections.
209
210 2013-11-04  Alan Modra  <amodra@gmail.com>
211
212         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
213         (Symbol::needs_dynamic_reloc): Test new flag.
214         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
215         (Target_powerpc::Scan::get_reference_flags): Add target param.
216         Return FUNC_DESC_ABI for 64-bit ELFv1.
217         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
218         call.
219         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
220         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
221
222 2013-10-31  Cary Coutant  <ccoutant@google.com>
223
224         Restore support for dwp v2 DWARF package file format.
225
226         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
227         tu_length parameter.  Adjust all callers.
228         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
229         * dwp.cc: Include dwarf.h.
230         (Section_bounds): New struct type.
231         (Unit_set): New struct type.
232         (Dwo_file::Dwo_file): Initialize new data member.
233         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
234         Combine and rename to...
235         (Dwo_file::read_unit_index): ...this.
236         (Dwo_file::sized_read_compunit_index)
237         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
238         (Dwo_file::sized_read_unit_index): ...this.
239         (Dwo_file::copy_section): Remove section_name, is_str_offsets
240         parameters; add section_id parameter.
241         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
242         (Dwo_file::add_unit_set): ...this.
243         (Dwo_file::shndx_map_): Remove.
244         (Dwo_file::sect_offsets_): New data member.
245         (Dwp_output_file::Dwp_output_file): Initialize new data members.
246         (Dwp_output_file::add_section): Rename to...
247         (Dwp_output_file::add_contribution): ...this.
248         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
249         (Dwp_output_file::add_tu_set): Likewise.
250         (Dwp_output_file::Contribution): New type.
251         (Dwp_output_file::Section::contributions): New data member.
252         (Dwp_output_file::Cu_or_tu_set): Remove.
253         (Dwp_output_file::Section::Section): New ctor.
254         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
255         (Dwp_output_file::Dwp_index::Section_table): New type.
256         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
257         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
258         parameter.
259         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
260         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
261         (Dwp_output_file::Dwp_index::section_table): New member function.
262         (Dwp_output_file::Dwp_index::section_table_end): New member function.
263         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
264         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
265         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
266         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
267         (Dwp_output_file::Dwp_index::section_table_): New data member.
268         (Dwp_output_file::Dwp_index::section_mask_): New data member.
269         (Dwp_output_file::add_output_section): New member function.
270         (Dwp_output_file::write_new_section): New member function.
271         (Dwp_output_file::write_contributions): New member function.
272         (Dwp_output_file::section_id_map_): New data member.
273         (class Dwo_id_info_reader): Remove.
274         (class Unit_reader): New class.
275         (get_dwarf_section_name): New function.
276         (Dwo_file::read_executable): Adjust initializations of class data.
277         (Dwo_file::read): Add support for v2 package file format.
278         (Dwo_file::read_unit_index): Likewise.
279         (Dwo_file::sized_read_unit_index): Likewise.
280         (Dwo_file::copy_section): Likewise.
281         (Dwo_file::add_unit_set): Likewise.
282         (Dwp_output_file::add_output_section): Likewise.
283         (Dwp_output_file::add_contribution): Likewise.
284         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
285         for empty slot.
286         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
287         file format.
288         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
289         slot.
290         (Dwp_output_file::initialize): Remove unused function.
291         (Dwp_output_file::finalize): Add support for v2 package file format.
292         (Dwp_output_file::write_index): Likewise.
293         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
294         function prototype.
295
296 2013-10-31  Cary Coutant  <ccoutant@google.com>
297
298         * configure.ac: Fix check for -fmerge-constants.
299         * configure.ac: Regenerate.
300
301 2013-10-30  Roland McGrath  <mcgrathr@google.com>
302
303         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
304         Correct 9-byte nop sequence to match what the assembler generates.
305
306 2013-10-30  Alan Modra  <amodra@gmail.com>
307
308         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
309         ppc64_local_entry_offset, ppc64_local_entry_offset,
310         do_read_symbols): New functions.
311         (Powerpc_relobj::e_flags_, st_other_): New vars.
312         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
313         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
314         (Powerpc_relobj::e_flags_): New var.
315         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
316         and adjust for ELFv2.
317         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
318         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
319         (Powerpc_dynobj::do_find_special_sections): Likewise.
320         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
321         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
322         to ELFv2 local entry.
323         (Target_powerpc::do_relax): No thread safe barriers needed for
324         ELFv2.
325         (Output_data_plt_powerpc::initial_plt_entry_size_,
326         plt_entry_size): Delete.  Replace all uses with
327         first_plt_entry_offset() and plt_entry_size().
328         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
329         reserved_size parm.  Update callers.
330         (Output_data_plt_powerpc::entry_count): Update.
331         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
332         and use Target_powerpc::first_plt_entry_offset().
333         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
334         rename to plt_entry_size.
335         (Output_data_plt_powerpc::add_ifunc_entry,
336         add_local_ifunc_entry): Adjust reloc for ELFv2.
337         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
338         (glink_eh_frame_fde_64v2): New.
339         (Stub_table::plt_call_size): Support ELFv2 sizing.
340         (Output_data_glink::add_eh_frame): Use the new FDE.
341         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
342         (Stub_table::do_write): Write ELFv2 stubs and glink.
343         (Target_powerpc::Relocate::relocate): Replaces nop after call
344         with ld 2,24(1) and adjust local offset destination for ELFv2.
345
346 2013-10-30  Alan Modra  <amodra@gmail.com>
347
348         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
349         (Target_powerpc::Scan::global, local): Likewise.
350         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
351         on all ppc64 @h and @ha relocs.
352
353 2013-10-14  Alan Modra  <amodra@gmail.com>
354
355         * output.h (Output_data_got::add_constant): Tidy.
356         (Output_data_got::add_constant_pair): New function.
357         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
358         methods used so as to first call reserve_ent().
359
360 2013-10-11  Roland McGrath  <mcgrathr@google.com>
361
362         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
363         add_got_entry and add_got_entry_pair.
364
365         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
366         (HAVE_PUBNAMES): Likewise.
367         * configure: Regenerate.
368
369         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
370         * testsuite/Makefile.in: Regenerate.
371
372         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
373         Remove const from declaration.
374         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
375         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
376         * output.h (Output_file_header): Remove const from member target_
377         and corresponding constructor argument.
378         * output.cc (Output_file_header::Output_file_header): Update prototype.
379         (Output_file_header::do_sized_write): Use this->target_ in place
380         of parameters()->target().
381
382         * testsuite/undef_symbol.cc (Foo::get_a): New method.
383
384         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
385         * configure: Regenerate.
386         * Makefile.in: Regenerate.
387         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
388         * testsuite/merge_string_literals_2.c: Likewise.
389         * testsuite/Makefile.am
390         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
391         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
392         literal -fmerge-constants.
393         * testsuite/Makefile.in: Regenerate.
394
395         * i386.cc (Target_i386): Remove unused member dynbss_.
396         * arm.cc (Target_arm): Likewise.
397         * powerpc.cc (Target_powerpc): Likewise.
398         * sparc.cc (Target_sparc): Likewise.
399         * tilegx.cc (Target_tilegx): Likewise.
400         * x86_64.cc (Target_x86_64): Likewise.
401         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
402         type_signature_, type_offset_.
403         * plugin.h (Plugin_hook): Remove unused member layout_.
404         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
405         mapfile_.
406         (Read_member): Remove unused members input_objects_, symtab_,
407         mapfile_, layout_.
408         (Check_library): Remove unused member symtab_.
409         * archive.h (Lib_group): Remove unused member lib_.
410         * archive.cc (Lib_group::Lib_group): Update initializer.
411         * incremental.h (Incremental_binary): Remove unused member target_.
412         (Incremental_script_entry): Removed unused member script_.
413         * layout.h (Write_symbols_task): Remove unused member input_objects_.
414         * icf.h (Icf): Remove unused member num_tracked_relocs.
415
416         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
417         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
418         its only use.
419         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
420
421         * archive.h: Use struct rather than class for forward declaration
422         of Read_symbols_data.
423
424 2013-10-07  Cary Coutant  <ccoutant@google.com>
425
426         PR gold/16010
427         * testsuite/Makefile.am (icf_test): Fix dependencies.
428         (icf_safe_test): Likewise.
429         (icf_safe_so_test): Likewise.
430         (large_symbol_alignment): Add empty _LDADD rule.
431         * testsuite/Makefile.in: Regenerate.
432
433 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
434
435         PR gold/15927
436         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
437         relocation for R_X86_64_32 on x32.
438
439 2013-08-27  Roland McGrath  <mcgrathr@google.com>
440
441         * output.cc (Output_segment::set_section_addresses): Take new
442         Target* argument.  If target->isolate_execinstr() and the segment
443         is executable and starts at a target->abi_pagesize() boundary,
444         pad its end out to a target->abi_pagesize() boundary with code fill.
445         * output.h (Output_segment::set_section_addresses): Update decl.
446         * layout.h (Layout::check_output_data_for_reset_values): Take new
447         argument RELAX_OUTPUTS.
448         (Layout): New member relax_output_list_.
449         (Layout::add_relax_output): New method.
450         * layout.cc (Layout::Layout): Update constructor.
451         (Layout::reset_relax_output): New method.
452         (Layout::clean_up_after_relaxation): Call it.
453         (Layout::prepare_for_relaxation): Update caller.
454         (Layout::set_segment_offsets): Update callers of set_section_addresses.
455         Call reset_relax_output before re-processing segments for
456         isolate_execinstr case.
457         (Layout::write_data): Handle relax_output_list_.
458         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
459         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
460
461 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
462
463         PR binutils/15834
464         * object.h: Fix typos.
465
466 2013-08-16  Roland McGrath  <mcgrathr@google.com>
467
468         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
469         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
470
471 2013-08-07  Cary Coutant  <ccoutant@google.com>
472
473         Revert support for v2 DWP files:
474
475         2013-03-01  Cary Coutant  <ccoutant@google.com>
476
477             Add dwp support for v2 DWARF package file format.
478             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
479             tu_length parameter.  Adjust all callers.
480             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
481             * dwp.cc: Include dwarf.h.
482             (Section_bounds): New struct type.
483             (Unit_set): New struct type.
484             (Dwo_file::Dwo_file): Initialize new data member.
485             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
486             Combine and rename to...
487             (Dwo_file::read_unit_index): ...this.
488             (Dwo_file::sized_read_compunit_index)
489             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
490             (Dwo_file::sized_read_unit_index): ...this.
491             (Dwo_file::copy_section): Remove section_name, is_str_offsets
492             parameters; add section_id parameter.
493             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
494             (Dwo_file::add_unit_set): ...this.
495             (Dwo_file::shndx_map_): Remove.
496             (Dwo_file::sect_offsets_): New data member.
497             (Dwp_output_file::Dwp_output_file): Initialize new data members.
498             (Dwp_output_file::add_section): Rename to...
499             (Dwp_output_file::add_contribution): ...this.
500             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
501             (Dwp_output_file::add_tu_set): Likewise.
502             (Dwp_output_file::Contribution): New type.
503             (Dwp_output_file::Section::contributions): New data member.
504             (Dwp_output_file::Cu_or_tu_set): Remove.
505             (Dwp_output_file::Section::Section): New ctor.
506             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
507             (Dwp_output_file::Dwp_index::Section_table): New type.
508             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
509             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
510             parameter.
511             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
512             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
513             (Dwp_output_file::Dwp_index::section_table): New member function.
514             (Dwp_output_file::Dwp_index::section_table_end): New member function.
515             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
516             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
517             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
518             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
519             (Dwp_output_file::Dwp_index::section_table_): New data member.
520             (Dwp_output_file::Dwp_index::section_mask_): New data member.
521             (Dwp_output_file::add_output_section): New member function.
522             (Dwp_output_file::write_new_section): New member function.
523             (Dwp_output_file::write_contributions): New member function.
524             (Dwp_output_file::section_id_map_): New data member.
525             (class Dwo_id_info_reader): Remove.
526             (class Unit_reader): New class.
527             (get_dwarf_section_name): New function.
528             (Dwo_file::read_executable): Adjust initializations of class data.
529             (Dwo_file::read): Add support for v2 package file format.
530             (Dwo_file::read_unit_index): Likewise.
531             (Dwo_file::sized_read_unit_index): Likewise.
532             (Dwo_file::copy_section): Likewise.
533             (Dwo_file::add_unit_set): Likewise.
534             (Dwp_output_file::add_output_section): Likewise.
535             (Dwp_output_file::add_contribution): Likewise.
536             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
537             for empty slot.
538             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
539             file format.
540             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
541             slot.
542             (Dwp_output_file::initialize): Remove unused function.
543             (Dwp_output_file::finalize): Add support for v2 package file format.
544             (Dwp_output_file::write_index): Likewise.
545             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
546             function prototype.
547
548 2013-07-31  Cary Coutant  <ccoutant@google.com>
549
550         * object.cc (Sized_relobj::do_output_section_address): New function.
551         (Sized_relobj): Instantiate explicitly.
552         * object.h (Object::output_section_address): New function.
553         (Object::do_output_section_address): New function.
554         (Sized_relobj::do_output_section_address): New function.
555         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
556
557 2013-07-30  Cary Coutant  <ccoutant@google.com>
558             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
559
560         * parameters.cc (Parameters::entry): Return target-specific entry
561         symbol name.
562         * target.h (Target::entry_symbol_name): New function.
563         (Target_info::entry_symbol_name): New data member.
564
565         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
566         * i386.cc (Target_i386::i386_info): Likewise.
567         (Target_i386_nacl::i386_nacl_info): Likewise.
568         * sparc.cc (Target_sparc::sparc_info): Likewise.
569         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
570         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
571         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
572         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
573
574 2013-07-22  Sterling Augustine  <saugustine@google.com>
575
576         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
577         Convert parameter shndx to local variable. Add parameters symtab
578         and symtab_size.  Scan over section names.  Find relocation
579         section corresponding to current section.  Create and initialize
580         reloc_mapper_ and reloc_type_.
581         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
582         unit_length to off_t.  Initialize member unit_length_.  Fill in field
583         cu_offset_.
584         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
585         Initialize new fields unit_length_ and cu_offset_.
586         (Dwarf_pubnames_table::read_section): Update prototype.
587         (Dwarf_pubnames_table::cu_offset): New member function.
588         (Dwarf_pubnames_table::subsection_size): Likewise.
589         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
590         New fields.
591         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
592         member functions public.
593         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
594         Update comment.  Rework logic.  Move repeated parts to...
595         (Gdb_index_info_reader::read_pubtable): ...here. New function.
596         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
597         pubtypes_table_, and stmt_list_offset.
598         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
599         Gdb_index::find_pubtype_offset,
600         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
601         (Gdb_index::pubnames_read): Update prototype and rework logic.
602         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
603         Forward declare.
604         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
605         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
606         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
607         Gdb_index::map_pubtable_to_dies):
608         Declare functions.
609         (Gdb_index::pubnames_read): Update declaration.
610         (Gdb_index::Pubname_offset_map): New type.
611         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
612         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
613         Gdb_index::stmt_list_offset): Declare.
614         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
615         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
616         Gdb_index::pubtypes_offset_): Remove.
617
618 2013-07-19  Roland McGrath  <mcgrathr@google.com>
619
620         * options.h (General_options): Add -Trodata-segment option.
621         * parameters.cc (Parameters::check_rodata_segment): New function.
622         (Parameters::set_target_once): Call it.
623         * parameters.h (Parameters): Declare it (private member function).
624         * layout.cc (load_seg_unusable_for_headers): New function, broken
625         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
626         then validate rodata segment rather than text segment.
627         (relaxation_loop_body): Call that.
628         (is_text_segment): New function.  Don't admit a non-executable
629         segment if TARGET->isolate_execinstr().
630         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
631
632 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
633
634         PR gold/15070
635         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
636         * nacl.h (Sniff_file::View::View): Request aligned view.
637
638 2013-07-11  Cary Coutant  <ccoutant@google.com>
639
640         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
641         correct BRLT entry size.
642
643 2013-07-03  Alan Modra  <amodra@gmail.com>
644
645         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
646         comment.
647
648 2013-07-01  Cary Coutant  <ccoutant@google.com>
649
650         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
651         reloc_type_.
652         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
653         (Dwarf_ranges_table::lookup_reloc): New function.
654         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
655         reloc_type_.
656         (Dwarf_ranges_table::lookup_reloc): New function.
657         (Dwarf_ranges_table::reloc_type_): New data member.
658
659 2013-06-27  Jing Yu  <jingyu@google.com>
660
661         PR gold/15662
662         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
663         function.
664         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
665         (Target_powerpc::do_relax): Call the above.
666
667 2013-06-27  Cary Coutant  <ccoutant@google.com>
668
669         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
670         on garbage collected .opd section.
671
672 2013-06-27  Alan Modra  <amodra@gmail.com>
673
674         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
675         is non-zero.
676         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
677         (Target_powerpc::do_function_location): Likewise for loc->shndx.
678
679 2013-06-14  Cary Coutant  <ccoutant@google.com>
680
681         * resolve.cc (Symbol::override_base): Don't override st_type
682         from plugin placeholder symbols.
683         (Symbol_table::resolve): Likewise.
684         (Symbol_table::should_override): Don't complain about TLS mismatch
685         if the TO symbol is a plugin placeholder.
686         * testsuite/Makefile.am (plugin_test_tls): New test.
687         * testsuite/Makefile.in: Regenerate.
688         * testsuite/plugin_test_tls.sh: New test script.
689         * testsuite/two_file_test_2_tls.cc: New test source.
690         * testsuite/two_file_test_tls.cc: New test source.
691
692 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
693
694         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
695         the maximum segment alignment is larger than the page size.
696         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
697         correctly aligns the symbols with large alignemnt.
698         * testsuite/Makefile.in: Regenerate.
699         * testsuite/large_symbol_alignment.cc: New file.
700
701 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
702             Sriraman Tallam  <tmsriram@google.com>
703
704         * options.h (sort_section): New option.
705         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
706         Rename from Input_section_sort_section_name_special_ordering_compare.
707         (Input_section_sort_section_name_compare): New struct.
708         * output.cc (Output_section::Input_section_sort_section_name_compare::
709         operator()): New function.
710         (Output_section::sort_attached_input_sections): Use new sort function
711         for .text if --sort-section=name is specified.
712         * layout.cc (Layout::make_output_section):
713         Add sorting by name when --sort-section=name is specified.
714         * testsuite/Makefile.am (text_section_grouping): Test option
715         --sort-section=name.
716         * testsuite/Makefile.in: Regenerate.
717         * testsuite/section_sorting_name.cc: New file.
718         * testsuite/section_sorting_name.sh: New file.
719
720 2013-05-21  Cary Coutant  <ccoutant@google.com>
721
722         * symtab.h (Symbol::is_cxx_vtable): New function.
723         * target-reloc.h (relocate_section): Check for vtable symbol.
724         * testsuite/Makefile.am (missing_key_func.sh): New test case.
725         * testsuite/Makefile.in: Regenerate.
726         * testsuite/missing_key_func.cc: New test source.
727         * testsuite/missing_key_func.sh: New test script.
728
729 2013-05-21  Cary Coutant  <ccoutant@google.com>
730
731         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
732         type of enclosing symbol.
733         (Relocate_info::location): Check symbol type when describing symbol.
734         * object.h (Symbol_location_info): Remove unused line_number;
735         add enclosing_symbol_type.
736         * testsuite/debug_msg.sh: Adjust expected output.
737
738 2013-05-13  Cary Coutant  <ccoutant@google.com>
739
740         * configure.ac: Export DEFAULT_TARGET.
741         * configure: Regenerate.
742         * Makefile.in: Regenerate.
743         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
744         * testsuite/Makefile.in: Regenerate.
745         * testsuite/debug_msg.sh: Delete duplicate tests.
746         Don't check undef_int error message match for powerpc where the
747         source file and line number aren't available.
748
749 2013-05-10  Roland McGrath  <mcgrathr@google.com>
750
751         * options.h (General_options): Add --rosegment-gap option.
752         * options.cc (finalize): --rosegment-gap implies --rosegment.
753         * layout.cc (set_segment_offsets): Let user option override
754         target->rosegment_gap().
755
756 2013-05-10  Roland McGrath  <mcgrathr@google.com>
757
758         * options.h (General_options): Remove leading space from help
759         messages for -nostdlib and --rosegment.
760
761 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
762
763         PR ld/15365
764         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
765
766 2013-05-03  Alan Modra  <amodra@gmail.com>
767
768         * merge.cc (Output_merge_string::do_add_input_section): Correct
769         scan for number of strings.  Rename vars to avoid shadowing.
770         Include missing terminator in input_size_.
771
772 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
773
774         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
775         Restore empty string handling.
776
777 2013-05-01  Cary Coutant  <ccoutant@google.com>
778
779         * stringpool.cc (Stringpool_template::new_key_offset): Fix
780         uninitialized warning.
781
782 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
783
784         * output.cc (Output_section::add_merge_input_section): Allow
785         to merge sections if the alignment is more than character size.
786         * merge.h (Output_merge_string::Output_merge_string): Remove
787         assert.
788         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
789         only not-null strings. Check the alignment of strings.
790         * stringpool.h
791         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
792         alignment as the argument.
793         (Stringpool_template<Stringpool_char>::addralign_): New class member.
794         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
795         Align non-zero length strings according to the addralign_.
796         (Stringpool_template<Stringpool_char>::set_string_offsets):
797         Updating offsets according to the given alignment.
798         * testsuite/Makefile.am (text_section_grouping): Test if string
799         literals are getting merged.
800         * testsuite/Makefile.in: Regenerate.
801         * testsuite/merge_string_literals_1.c: New file.
802         * testsuite/merge_string_literals_2.c: Ditto.
803         * testsuite/merge_string_literals.sh: Ditto.
804
805 2013-04-26  Ian Lance Taylor  <iant@google.com>
806
807         * target-reloc.h (relocate_section): If the reloc offset is out of
808         range, pass VIEW as NULL to relocate.relocate.
809         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
810         * i386.cc (Target_i386::Relocate::relocate): Likewise.
811         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
812         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
813         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
814         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
815
816 2013-04-26  Geoff Pike  <gpike@chromium.org>
817
818         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
819         * layout.cc (Hash_task): New class.
820         (Layout::queue_build_id_tasks): New function.
821         (Layout::write_build_id): Handle single-thread portion of build ID
822         computation.  (In some cases, all of it is single-threaded.)  Replace
823         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
824         functionality in fewer lines of code.
825         * layout.h (Layout::queue_build_id_tasks): New function declaration.
826         * options.h (General_options): make "--build-id" default to tree
827         rather than sha1.  Add two new options related to --build-id=tree:
828         --build-id-chunk-size-for-treehash and
829         --build-id-min-file-size-for-treehash.
830         * Makefile.am: add testing of --build-id=tree and related new options
831         (these tests will be invoked by "make check").
832         * Makefile.in: Regenerate.
833
834 2013-04-25  Alan Modra  <amodra@gmail.com>
835
836         * configure.tgt: Add powerpcle and powerpc64le.
837
838 2013-04-22  Alan Modra  <amodra@gmail.com>
839
840         PR gold/15355
841         * layout.cc (Layout::segment_precedes): Allow more than one
842         segment with the same type and flags.
843
844 2013-04-15  Cary Coutant  <ccoutant@google.com>
845
846         * layout.cc (Layout::set_relocatable_section_offsets): Don't
847         allocate space in file for BSS sections.
848
849 2013-04-15  Cary Coutant  <ccoutant@google.com>
850
851         * script-sections.cc (Orphan_output_section): Reset address
852         to zero after each orphaned section for relocatable links.
853
854 2013-04-15  Cary Coutant  <ccoutant@google.com>
855
856         * symtab.cc (Symbol_table::sized_write_globals): Subtract
857         section starting address for relocatable link.
858         * testsuite/Makefile.am (script_test_11): New test.
859         * testsuite/Makefile.in: Regenerate.
860         * testsuite/script_test_11.c: New source file.
861         * testsuite/script_test_11.t: New linker script.
862
863 2013-04-13  Alan Modra  <amodra@gmail.com>
864
865         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
866         owner when sections are not adjacent and exceed group size.
867         (Target_powerpc::group_sections): Handle corner case.
868         (Target_powerpc::Branch_info::make_stub): Handle case where
869         stub table doesn't exist due to branches in non-exec sections.
870         (Target_powerpc::Relocate::relocate): Likewise.
871
872 2013-04-11  Alan Modra  <amodra@gmail.com>
873
874         PR gold/15354
875         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
876         .branch_lt to match bfd ld.  Adjust comments throughout file.
877
878 2013-04-04  Ian Lance Taylor  <iant@google.com>
879
880         GCC PR c++/56840
881         * object.cc (do_layout_deferred_sections): Handle .eh_frame
882         sections before checking whether they are included in the link.
883
884 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
885
886         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
887         object before calling the plugin claim_file handler.  Pass the elf
888         object of the archive to the plugin. Delete the elf object if the
889         plugin claims the file.
890
891 2013-03-21  Alan Modra  <amodra@gmail.com>
892
893         * layout.cc (Layout::set_segment_offsets): Accept writable .text
894         segment when omagic.
895
896 2013-03-21  Alan Modra  <amodra@gmail.com>
897
898         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
899         comparison warning.
900         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
901         uninitialized" warning.
902
903 2013-03-20  Alan Modra  <amodra@gmail.com>
904
905         * symtab.h (Symbol::clear_version): New function.
906         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
907         is_needed by weak references.  Clear version for symbols defined
908         in as-needed objects that are not needed.
909
910 2013-03-15  Alan Modra  <amodra@gmail.com>
911
912         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
913         static and public.  Add report_err param.  Return false for data refs.
914         (Target_powerpc::rela_dyn_section): New overloaded function.
915         (Target_powerpc::plt_, iplt_): Elucidate.
916         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
917         (Output_data_plt_powerpc::do_write): Don't write .iplt.
918         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
919         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
920         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
921         push_branch and make_plt_entry for ifunc syms when
922         reloc_needs_plt_for_ifunc.
923         (Target_powerpc::Relocate::relocate): Don't use plt entry value
924         for ifunc unless reloc_needs_plt_for_ifunc.
925
926 2013-03-15  Alan Modra  <amodra@gmail.com>
927
928         * gc.h (gc_process_relocs): Don't look through function descriptors.
929         * icf.cc (get_section_contents): Do so here instead.
930
931 2013-03-13  Alan Modra  <amodra@gmail.com>
932
933         * powerpc.cc (is_branch_reloc): Forward declare.
934         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
935         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
936         false for 64-bit, true for 32-bit non-branch relocs.
937         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
938         * testsuite/Makefile.am (icf_test): Use linker map file instead of
939         nm output.
940         (icf_safe_test): Generate linker map file as well as nm output.
941         (icf_safe_so_test): Likewise.
942         * testsuite/Makefile.in: Regenerate.
943         * testsuite/icf_test.sh: Parse linker map file to determine
944         section folding.
945         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
946         * testsuite/icf_safe_so_test.sh: Likewise.
947         (X86_32_or_ARM_specific_safe_fold): Merge into..
948         (arch_specific_safe_fold): ..this.
949         (X86_64_specific_safe_fold): Delete unused function.
950
951 2013-03-12  Alan Modra  <amodra@gmail.com>
952
953         * gc.h (gc_process_relocs): Look through function descriptors
954         to determine shndx, symvalue and addend used by ICF.  Tidy
955         variable duplication.
956
957 2013-03-11  Alan Modra  <amodra@gmail.com>
958
959         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
960         * layout.cc (Layout_task_runner::run): ..to here.
961         * symtab.h (struct Symbol_location): Extract from..
962         (class Symbol_table): ..here.
963         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
964         * target.h (class Target): Add function_location and
965         do_function_location functions.
966         (class Sized_target): Add do_function_location.
967         * object.h (class Sized_relobj_file): Move find_shdr..
968         (class Object): ..to here.
969         * object.cc: Likewise.  Update to suit.  Instantiate.
970         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
971         * powerpc.cc (class Powerpc_dynobj): New.
972         (Target_powerpc::do_function_location): New function.
973         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
974         (Powerpc_dynobj::do_read_symbols): New function.
975         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
976
977 2013-03-08  Ian Lance Taylor  <iant@google.com>
978
979         * options.cc (General_options::string_to_object_format): Accept
980         "default".
981
982 2013-03-08  Alan Modra  <amodra@gmail.com>
983
984         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
985         pointer to Post_fde.
986         (struct Post_fde): Move definition to here..
987         * ehframe.cc (struct Post_fde): ..from here.
988         (Cie::write): Don't alloc Post_fde.
989         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
990
991 2013-03-07  Alan Modra  <amodra@gmail.com>
992
993         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
994         relocation referencing .LC0.
995         * testsuite/discard_locals_test.sh: Remove FIXMEs.
996
997 2013-03-07  Alan Modra  <amodra@gmail.com>
998
999         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1000         always_inline.  Add assembly for powerpc to avoid GOT.
1001
1002 2013-03-07  Alan Modra  <amodra@gmail.com>
1003
1004         * testsuite/script_test_10.sh: Don't test .bss section
1005         header number.
1006
1007 2013-03-06  Alan Modra  <amodra@gmail.com>
1008
1009         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1010         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1011         all callers.  Handle folded sections.
1012         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1013         to Powerpc_relobj.
1014         (Global_symbol_visitor_opd::operator()): Likewise.
1015
1016 2013-03-04  Alan Modra  <amodra@gmail.com>
1017
1018         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1019         * testsuite/Makefile.in: Regenerate.
1020
1021 2013-03-01  Cary Coutant  <ccoutant@google.com>
1022
1023         Add dwp support for v2 DWARF package file format.
1024         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1025         tu_length parameter.  Adjust all callers.
1026         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1027         * dwp.cc: Include dwarf.h.
1028         (Section_bounds): New struct type.
1029         (Unit_set): New struct type.
1030         (Dwo_file::Dwo_file): Initialize new data member.
1031         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1032         Combine and rename to...
1033         (Dwo_file::read_unit_index): ...this.
1034         (Dwo_file::sized_read_compunit_index)
1035         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1036         (Dwo_file::sized_read_unit_index): ...this.
1037         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1038         parameters; add section_id parameter.
1039         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1040         (Dwo_file::add_unit_set): ...this.
1041         (Dwo_file::shndx_map_): Remove.
1042         (Dwo_file::sect_offsets_): New data member.
1043         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1044         (Dwp_output_file::add_section): Rename to...
1045         (Dwp_output_file::add_contribution): ...this.
1046         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1047         (Dwp_output_file::add_tu_set): Likewise.
1048         (Dwp_output_file::Contribution): New type.
1049         (Dwp_output_file::Section::contributions): New data member.
1050         (Dwp_output_file::Cu_or_tu_set): Remove.
1051         (Dwp_output_file::Section::Section): New ctor.
1052         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1053         (Dwp_output_file::Dwp_index::Section_table): New type.
1054         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1055         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1056         parameter.
1057         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1058         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1059         (Dwp_output_file::Dwp_index::section_table): New member function.
1060         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1061         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1062         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1063         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1064         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1065         (Dwp_output_file::Dwp_index::section_table_): New data member.
1066         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1067         (Dwp_output_file::add_output_section): New member function.
1068         (Dwp_output_file::write_new_section): New member function.
1069         (Dwp_output_file::write_contributions): New member function.
1070         (Dwp_output_file::section_id_map_): New data member.
1071         (class Dwo_id_info_reader): Remove.
1072         (class Unit_reader): New class.
1073         (get_dwarf_section_name): New function.
1074         (Dwo_file::read_executable): Adjust initializations of class data.
1075         (Dwo_file::read): Add support for v2 package file format.
1076         (Dwo_file::read_unit_index): Likewise.
1077         (Dwo_file::sized_read_unit_index): Likewise.
1078         (Dwo_file::copy_section): Likewise.
1079         (Dwo_file::add_unit_set): Likewise.
1080         (Dwp_output_file::add_output_section): Likewise.
1081         (Dwp_output_file::add_contribution): Likewise.
1082         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1083         for empty slot.
1084         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1085         file format.
1086         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1087         slot.
1088         (Dwp_output_file::initialize): Remove unused function.
1089         (Dwp_output_file::finalize): Add support for v2 package file format.
1090         (Dwp_output_file::write_index): Likewise.
1091         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1092         function prototype.
1093
1094 2013-03-01  Cary Coutant  <ccoutant@google.com>
1095
1096         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1097         function into class definition in header file.
1098         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1099         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1100         New function.
1101         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1102
1103 2013-02-28  Alan Modra  <amodra@gmail.com>
1104
1105         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1106         * target.cc (Target::do_plt_fde_location): New function.
1107         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1108         accessor function, and constructor param.
1109         (struct Post_fde, Post_fdes): Declare.
1110         (Cie::write): Add post_fdes param.
1111         * ehframe.cc (Fde::write): Use plt_fde_location.
1112         (struct Post_fde): Define.
1113         (Cie::write): Stash FDEs added post merge mapping.
1114         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1115         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1116         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1117         other FDEs.
1118         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1119         (Target_powerpc::has_glink): New function.
1120         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1121         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1122         glink_eh_frame_fde_32, default_fde): New data.
1123         (Stub_table::eh_frame_added_): New var.
1124         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1125         Make const.
1126         (Stub_table::add_eh_frame): New function.
1127         (Output_data_glink::add_eh_frame): New function.
1128         (Target_powerpc::make_glink_section): Call add_eh_frame.
1129
1130 2013-02-15  Ian Lance Taylor  <iant@google.com>
1131
1132         * options.h (DEFINE_uint64_alias): Define.
1133         (class General_options): Add -Ttext-segment as an alias for
1134         -Ttext.
1135
1136 2013-02-15  Alan Modra  <amodra@gmail.com>
1137
1138         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1139         (Stub_table::do_write): ..here, two places.
1140         (Stub_table::plt_call_size): Use it here too.
1141
1142 2013-02-11  Ian Lance Taylor  <iant@google.com>
1143
1144         * descriptors.cc (Descriptors::close_all): New function.
1145         * descriptors.h (class Descriptors): Declare close_all.
1146         (close_all_descriptors): New inline function.
1147         * plugin.cc: Include "descriptors.h".
1148         (Plugin_manager::cleanup): Call close_all_descriptors.
1149
1150 2013-02-06  Alan Modra  <amodra@gmail.com>
1151
1152         * README: Update coding style link.
1153
1154 2013-01-28  Cary Coutant  <ccoutant@google.com>
1155
1156         * dwp.cc (File_list): New typedef.
1157         (Dwo_name_info_reader): New class.
1158         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1159         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1160         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1161         (Dwo_file::read_executable): New function.
1162         (Dwo_file::read): Move common setup code to ...
1163         (Dwo_file::make_object): ... here.
1164         (dwp_options): Add --exec/-e.
1165         (usage): Likewise.
1166         (main): Likewise.
1167
1168 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1169
1170         * layout.cc (Layout::layout): Check for option text_reorder.
1171         (Layout::make_output_section): Ditto.
1172         * options.h (text_reorder): New option.
1173         * output.cc (Input_section_sort_compare): Remove special ordering
1174         of section names.
1175         (Output_section::
1176          Input_section_sort_section_name_special_ordering_compare::
1177          operator()): New function.
1178         (Output_section::sort_attached_input_sections): Use new sort function
1179         for .text.
1180         * output.h (Input_section_sort_section_name_special_ordering_compare):
1181         New struct.
1182         * testsuite/Makefile.am (text_section_grouping): Test option
1183         --no-text-reorder
1184         * testsuite/Makefile.in: Regenerate.
1185         * testsuite/text_section_grouping.sh: Check order of functions without
1186         default text reordering.
1187
1188 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1189
1190         * options.h (General_options): Change default to true for new_dtags.
1191
1192 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1193
1194         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1195         when enable_new_dtags is false.  Only add DT_RUNPATH when
1196         enable_new_dtags is true.
1197
1198 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1199
1200         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1201         used in declaration and definition consistent.
1202         (Target_powerpc::symval_for_branch): Ditto.
1203
1204 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1205
1206         * testsuite/plugin_final_layout.cc: Fix comment.
1207
1208 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1209
1210         * layout.cc (Layout::layout): Do not do default sorting for
1211         text sections when section ordering is specified.
1212         (make_output_section): Ditto.
1213         * testsuite/plugin_final_layout.cc: Name the function sections
1214         to catch reordering issues.
1215
1216 2013-01-15  Alan Modra  <amodra@gmail.com>
1217
1218         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1219         plt-thread-safe.
1220
1221 2013-01-15  Alan Modra  <amodra@gmail.com>
1222
1223         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1224         * testsuite/Makefile.in: Regenerate.
1225
1226 2013-01-14  Alan Modra  <amodra@gmail.com>
1227
1228         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1229         * testsuite/Makefile.in: Regenerate.
1230
1231 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1232
1233         PR bfd/14430
1234         Fix mingw gold build with plugins enabled
1235         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1236         * configure.ac: Export DLOPEN_LIBS and add headers check.
1237         * plugin.cc: Handle non-dlfcn case.
1238         * Makefile.in: Regenerate.
1239         * config.in: Regenerate.
1240         * configure: Regenerate.
1241         * testsuite/Makefile.in: Regenerate.
1242
1243 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1244
1245         * output.h (sort_attached_input_sections): Change to be public.
1246         * script-sections.cc
1247         (Output_section_definition::set_section_addresses): Sort
1248         attached input sections according to section order before linker
1249         script assigns section addresses.
1250         (Orphan_output_section::set_section_addresses): Sort
1251         attached input sections according to section order before linker
1252         script assigns section addresses.
1253         * Makefile.am (final_layout.sh): Use a simple linker script to
1254         check if section ordering still works.
1255         * Makefile.in: Regenerate.
1256
1257 2013-01-09  Ben Cheng  <bccheng@google.com>
1258
1259         * arm.cc (Target_arm::attributes_accept_div): New function.
1260         (Target_arm::attributes_forbid_div): New function.
1261         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1262         attribute using the same new functions as what bfd/elf32_arm.c
1263         does.
1264
1265 2013-01-07  Cary Coutant  <ccoutant@google.com>
1266
1267         PR gold/14993
1268         * output.cc (Output_section::add_input_section): For incremental
1269         updates, don't track input sections that are allocated from patch
1270         space.
1271
1272 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1273             Ian Lance Taylor  <iant@google.com>
1274
1275         PR gold/14897
1276         * configure.ac (--enable-ld): Removed.
1277         (install_as_default): Set to yes only for --enable-gold=default
1278         or --disable-ld.
1279         * configure: Regenerated.
1280
1281 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1282
1283         * options.h (General_options): Add -fuse-ld= for GCC linker
1284         option compatibility.
1285
1286 2013-01-04  Cary Coutant  <ccoutant@google.com>
1287
1288         * configure.ac: Fix typo restoring CXXFLAGS.
1289         * configure: Regenerate.
1290
1291 2013-01-04  Cary Coutant  <ccoutant@google.com>
1292
1293         * testsuite/Makefile.am (CXXLINK_S): New macro.
1294         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1295         * testsuite/Makefile.in: Regenerate.
1296
1297 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1298
1299         * version.cc (print_version): Update copyright year to 2013.
1300
1301 2012-12-20  Ian Lance Taylor  <iant@google.com>
1302
1303         * layout.cc (Layout::special_ordering_of_input_section): New
1304         function.
1305         (Layout::layout): If input section requires special ordering, must
1306         sort input sections.
1307         (Layout::make_output_section): May sort .text input sections.
1308         (Layout::is_section_name_prefix_grouped): Remove.
1309         * layout.h (class Layout): Declare
1310         special_ordering_of_input_section.  Don't declare
1311         is_section_name_prefix_grouped.
1312         * output.cc (Output_section::add_input_section): Revert last
1313         change.
1314         (Output_section::Input_section_sort::match_file_name): Don't crash
1315         if called on output section data.
1316         (Output_section::Input_section_sort_compare): Sort based on
1317         special ordering.
1318         (Output_section::Input_section_sort_section_order_index_compare):
1319         Revert last patch.
1320         (Output_section::sort_attached_input_sections): Likewise.
1321
1322 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1323
1324         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1325         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1326         * output.cc (Output_section::add_input_section): Check if section
1327         name contains special prefix.  Keep input sections to sort such
1328         sections.
1329         (Output_section::Input_section_sort_section_order_index_compare
1330          ::operator()): Group sections according to prefixes.
1331         (Output_section::sort_attached_input_sections): Add condition to
1332         Input_section_entry constructor call.
1333         * testsuite/Makefile.am (text_section_grouping): New test.
1334         * testsuite/Makefile.in: Regenerate.
1335         * testsuite/text_section_grouping.cc: New file.
1336         * testsuite/text_section_grouping.sh: New file.
1337
1338 2012-12-17  Nick Clifton  <nickc@redhat.com>
1339
1340         * Makefile.am: Add copyright notice.
1341         * NEWS: Likewise.
1342         * README: Likewise.
1343         * configure.ac: Likewise.
1344         * ftruncate.c: Likewise.
1345         * Makefile.in: Regenerate.
1346
1347 2012-12-14  Cary Coutant  <ccoutant@google.com>
1348
1349         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1350         --no-as-needed flag.
1351         (exception_separate_shared_12_test): Likewise.
1352         (incremental_copy_test): Likewise.
1353         * testsuite/Makefile.in: Regenerate.
1354
1355 2012-12-14  Cary Coutant  <ccoutant@google.com>
1356
1357         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1358         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1359
1360 2012-12-12  Alan Modra  <amodra@gmail.com>
1361
1362         * powerpc.cc (class Track_tls): New.
1363         (class Relocate, class Scan): Inherit Track_tls.
1364         (Target_powerpc::Scan::local, global): Track tls optimization
1365         and avoid creating plt entry for __tls_get_addr if all uses
1366         are optimized away.
1367         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1368
1369 2012-12-12  Alan Modra  <amodra@gmail.com>
1370
1371         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1372         Replace no_toc_optimize with toc_optimize.
1373         * output.h (Output_section::input_sections): Provide non-const variant.
1374         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1375         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1376         accessors.
1377         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1378         (class Sort_toc_sections): New.
1379         (Target_powerpc::do_finalize_sections): Sort toc sections.
1380         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1381
1382 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1383
1384         * testsuite/binary_unittest.cc (read_all): New function.
1385         (Sized_binary_test): Use it instead of ::read.
1386         * fileread.cc (do_read): Don't assume pread always reads the whole
1387         amount in a single call.
1388
1389 2012-12-10  Alan Modra  <amodra@gmail.com>
1390
1391         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1392         Set EM_PPC64 or EM_PPC here.
1393         (Target_selector_powerpc::do_recognize): Delete.
1394
1395 2012-12-10  Alan Modra  <amodra@gmail.com>
1396
1397         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1398         stub_table_.
1399         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1400
1401 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1402
1403         * testsuite/binary_unittest.cc (Sized_binary_test):
1404         Use open_descriptor rather than ::open.
1405
1406 2012-12-07  Alan Modra  <amodra@gmail.com>
1407
1408         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1409         typedef and invalid_address constant.
1410         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1411         instantiate constants.
1412
1413 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1414
1415         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1416         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1417         * aclocal.m4: Regenerate.
1418         * configure: Regenerate.
1419         * Makefile.in: Regenerate.
1420         * testsuite/Makefile.in: Regenerate.
1421
1422 2012-12-07  Alan Modra  <amodra@gmail.com>
1423
1424         * options.h (General_options): Add no_toc_optimize.
1425         * powerpc.cc (ok_lo_toc_insn): New function.
1426         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1427
1428 2012-12-06  Alan Modra  <amodra@gmail.com>
1429
1430         * options.h (General_options): Add plt_align, plt_static_chain,
1431         plt_thread_safe.  Update stub_group_size help text.
1432         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1433         for new plt_thread_safe_ var.
1434         (use_plt_offset): Correct comments.
1435         (Target_powerpc::do_relax): Look for thread creation symbols to
1436         determine default plt_thread_safe value.  Clear plt call stubs
1437         as well as branch stubs each iteration.
1438         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1439         insn constants.
1440         (l, hi, ha, write_insn): Move earlier.
1441         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1442         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1443         plt stubs too.
1444         (Stub_table::update_size): Adjust.
1445         (Stub_table::prev_size, set_prev_size): Delete.
1446         (Stub_table::stub_align): Let --plt-align affect result.
1447         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1448         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1449         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1450         (Stub_table::do_write): Support more stub variants.
1451
1452 2012-12-04  Alan Modra  <amodra@gmail.com>
1453
1454         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1455         (Target_powerpc::do_define_standard_symbols): New function.
1456
1457 2012-12-03  Alan Modra  <amodra@gmail.com>
1458
1459         * output.h: Formatting, whitespace.
1460
1461 2012-12-03  Alan Modra  <amodra@gmail.com>
1462
1463         * layout.h (Layout::get_executable_sections): Declare.
1464         * layout.cc (Layout::get_executable_sections): New function.
1465         * arm.cc (Target_arm::group_sections): Use it.
1466         (Arm_output_section::group_sections): Delete now redundant test.
1467         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1468         param to handle relative relocs.
1469         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1470         (Output_data_reloc::add_absolute): Adjust.
1471         (Output_data_reloc::add_relative): New function.
1472         (Output_data::reset_data_size): New function.
1473         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1474         (Output_section::set_addralign): New function.
1475         (Output_section::checkpoint_set_addralign): New function.
1476         (Output_section::clear_section_offsets_need_adjustment): New function.
1477         (Output_section::input_sections): Make public.
1478         * powerpc.cc (class Output_data_brlt_powerpc): New.
1479         (class Stub_table, class Stub_control): New.
1480         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1481         stub_table_, set_stub_table, stub_table): New vectors and accessor
1482         functions.
1483         (Target_powerpc::do_may_relax, do_relax, push_branch,
1484         new_stub_table, stub_tables, brlt_section, group_sections,
1485         add_branch_lookup_table, find_branch_lookup_table,
1486         write_branch_lookup_table, make_brlt_section): New functions.
1487         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1488         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1489         branch_info_): New vars.
1490         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1491         make call stubs here.
1492         (Output_data_glink): Remove all call stub handling from this class.
1493         (Target_powerpc::Scan::local, global): Save interesting branch
1494         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1495         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1496         functions on final link.
1497         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1498         Handle long branch destinations too.
1499         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1500         do_plt_address_for_local): Adjust lookup of plt call stubs.
1501
1502 2012-11-30  Alan Modra  <amodra@gmail.com>
1503
1504         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1505         relocs against protected symbols when building 32-bit shared libs.
1506
1507 2012-11-30  Alan Modra  <amodra@gmail.com>
1508
1509         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1510         param.  Call got_section() to make .got.  Update all callers
1511         and their callers and so on.
1512
1513 2012-11-30  Alan Modra  <amodra@gmail.com>
1514
1515         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1516         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1517         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1518         value if it already exists.
1519
1520 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1521
1522         PR gold/14858
1523         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1524
1525 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1526
1527         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1528         than bfc instruction for data sandboxing.
1529
1530 2012-11-08  Alan Modra  <amodra@gmail.com>
1531
1532         * po/POTFILES.in: Regenerate.
1533
1534 2012-11-05  Alan Modra  <amodra@gmail.com>
1535
1536         * configure.ac: Apply 2012-09-10 change to config.in here.
1537         * configure: Regenerate.
1538
1539 2012-11-05  Alan Modra  <amodra@gmail.com>
1540
1541         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1542         (struct Opd_ent): Use "Address" rather than "Offset".
1543         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1544         (Target_powerpc::got_section): Make public.
1545         (Target_powerpc::scan_relocs): Move code setting symbols..
1546         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1547         Create _SDA_BASE_ only when referenced.
1548
1549 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1550
1551         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1552         from last change.
1553
1554 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1555
1556         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1557         for offset_in_output_section parameter.
1558         (Sized_target::relocate_special_relocatable): Likewise.
1559         * arm.cc (Target_arm::relocate_relocs): Likewise.
1560         (Target_arm::relocate_special_relocatable): Likewise.
1561         * i386.cc (Target_i386::relocate_relocs): Likewise.
1562         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1563         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1564         * target-reloc.h (relocate_relocs): Likewise.
1565         * testsuite/testfile.cc (Target_test): Likewise.
1566         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1567         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1568
1569         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1570         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1571
1572         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1573         parameter, which is unused in the [!F_SETFD] case.
1574
1575         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1576         SYMNDX to off_t before comparing it to this->data_size().
1577         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1578         * incremental.cc (Output_section_incremental_inputs::do_write):
1579         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1580
1581         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1582
1583 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1584
1585         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1586         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1587         in EABI_VER5.
1588
1589 2012-10-29  Cary Coutant  <ccoutant@google.com>
1590
1591         * dwp.cc (usage): Add file and exit status parameters;
1592         add --help and --version options.
1593         (print_version): New function.
1594         (main): Add --help and --version options.
1595
1596 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1597
1598         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1599         final_layout_sequence.txt.
1600         * testsuite/Makefile.in: Regenerated.
1601
1602 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1603
1604         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1605         COMPILE generated by automake.
1606         (LINK1): Likewise.
1607         (CXXCOMPILE1): Likewise.
1608         (CXXLINK1): Likewise.
1609         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1610         (LINK): Likewise.
1611         (CXXCOMPILE): Likewise.
1612         (CXXLINK): Likewise.
1613         * testsuite/Makefile.in: Regenerated.
1614
1615 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1616
1617         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1618         on bad fwrite return.
1619
1620 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1621
1622         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1623         on val.
1624
1625 2012-10-23  Cary Coutant  <ccoutant@google.com>
1626
1627         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1628         * testsuite/Makefile.in: Regenerate.
1629         * testsuite/dwp_test.h: New source file.
1630         * testsuite/dwp_test_1.cc: New source file.
1631         * testsuite/dwp_test_1.s: New source file.
1632         * testsuite/dwp_test_1.sh: New source file.
1633         * testsuite/dwp_test_1b.cc: New source file.
1634         * testsuite/dwp_test_1b.s: New source file.
1635         * testsuite/dwp_test_2.cc: New source file.
1636         * testsuite/dwp_test_2.s: New source file.
1637         * testsuite/dwp_test_2.sh: New source file.
1638         * testsuite/dwp_test_main.cc: New source file.
1639         * testsuite/dwp_test_main.s: New source file.
1640
1641 2012-10-23  Cary Coutant  <ccoutant@google.com>
1642
1643         * dwp.h: New header file.
1644         * dwp.cc: New source file.
1645         * gold.h: Move shared declarations to system.h.
1646         * system.h: New header file.
1647         * Makefile.am: Add dwp.
1648         * Makefile.in: Regenerate.
1649
1650 2012-10-23  Cary Coutant  <ccoutant@google.com>
1651
1652         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1653         Dwarf_info_reader::read_from_pointer.
1654         (Dwarf_pubnames_table::read_header): Likewise.
1655         (Dwarf_pubnames_table::next_name): Likewise.
1656         (Dwarf_die::read_attributes): Likewise.
1657         (Dwarf_die::skip_attributes): Likewise.
1658         (Dwarf_info_reader::read_from_pointer): New function template.
1659         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1660         (Dwarf_pubnames_table): Likewise.
1661         (Dwarf_info_reader::read_from_pointer): New function template.
1662         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1663         Dwarf_pubnames_table ctor.
1664
1665 2012-10-23  Cary Coutant  <ccoutant@google.com>
1666
1667         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1668         abbrev_shndx.
1669         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1670         abbrev_shndx_.
1671         (Dwarf_info_reader::set_abbrev_shndx): New method.
1672         (Dwarf_info_reader::abbrev_shndx_): New data member.
1673
1674 2012-10-23  Cary Coutant  <ccoutant@google.com>
1675
1676         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1677         from object, not parameters.
1678         (Dwarf_info_reader::parse): Likewise.
1679         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1680         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1681         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1682         methods.
1683
1684 2012-10-23  Cary Coutant  <ccoutant@google.com>
1685
1686         * fileread.cc (Input_file::Input_file): New constructor.
1687         * fileread.h (class Input_file): Add new constructor.
1688
1689 2012-10-18  Alan Modra  <amodra@gmail.com>
1690
1691         PR gold/14727
1692         * object.cc (Relobj::is_section_name_included): Also match
1693         .sdata personality section.
1694
1695 2012-10-18  Alan Modra  <amodra@gmail.com>
1696
1697         * target-reloc.h (class Default_comdat_behavior): New, package up..
1698         (get_comdat_behaviour): ..this.
1699         (relocate_section): Add Relocate_comdat_behavior template arg,
1700         adjust code to suit.
1701         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1702         (Target_arm::scan_reloc_section): Likewise.
1703         * i386.cc (Target_i386::relocate_section): Likewise.
1704         * sparc.cc (Target_sparc::relocate_section): Likewise.
1705         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1706         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1707         * powerpc.cc (class Relocate_comdat_behavior): New.
1708         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1709         gold::relocate_section with new template arg.
1710
1711 2012-10-18  Alan Modra  <amodra@gmail.com>
1712
1713         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1714         dynamic relocs for GOT_TPREL got entries, without symbol if
1715         resolving locally.
1716         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1717         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1718         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1719
1720 2012-10-17  Alan Modra  <amodra@gmail.com>
1721
1722         PR gold/14726
1723         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1724
1725 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1726
1727         * layout.cc (Layout::include_section): Keep sections marked
1728         SHF_EXCLUDE when doing relocatable links.
1729
1730 2012-10-16  Alan Modra  <amodra@gmail.com>
1731
1732         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1733         (Target_powerpc::do_finalize_sections): Call it.
1734         (Output_data_save_res): New class and supporting functions.
1735         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1736         normal symbols defined in object files.
1737
1738 2012-10-12  Alan Modra  <amodra@gmail.com>
1739
1740         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1741         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1742         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1743         section if scan_opd_relocs not yet called.
1744         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1745
1746 2012-10-12  Alan Modra  <amodra@gmail.com>
1747
1748         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1749         add_local_ifunc_entry): Revert last change.
1750         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1751
1752 2012-10-05  Alan Modra  <amodra@gmail.com>
1753
1754         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1755         do_plt_address_for_global): New functions.
1756         (Output_data_got_powerpc::do_write): Don't segfault when linking
1757         statically.
1758         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1759         add_local_ifunc_entry): Return true on adding entry..
1760         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1761         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1762         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1763         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1764         set up symbols here.
1765         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1766         syms here.  Do so even when no .iplt.  Don't segfault when linking
1767         statically.
1768         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1769         new variants without reloc param.
1770         (Glink_sym_ent::Glink_sym_ent): Likewise.
1771         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1772         reloc when refs will resolve to plt call stub.
1773         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1774         R_PPC_PLTREL24 to resolve locally.
1775         (Target_powerpc::Scan::global): Correct ifunc handling.
1776         (Target_powerpc::Relocate::relocate): Correct local sym glink
1777         lookup.  Don't destroy "value" when we have a plt call stub,
1778         and when checking plt call validity.
1779         (Target_powerpc::do_dynsym_value): Simplify.
1780
1781 2012-10-05  Alan Modra  <amodra@gmail.com>
1782
1783         * i386.cc (Output_data_plt_i386::address_for_global,
1784         address_for_local): Add plt offset to returned value.  Adjust uses.
1785         * sparc.cc (Output_data_plt_sparc::address_for_global,
1786         address_for_local): Likewise.
1787         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1788         address_for_local): Likewise.
1789         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1790         address_for_local): Likewise.
1791         * target.h (Target::plt_address_for_global, plt_address_for_local):
1792         Update comment.
1793         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1794         (Output_data_got::Got_entry::write): Nor here.
1795         * output.h: Comment fix.
1796
1797 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1798
1799         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1800         global_offset_table_ value for larget got.
1801         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1802
1803 2012-09-29  Alan Modra  <amodra@gmail.com>
1804
1805         * powerpc.cc (Target_powerpc::iplt_): New output section.
1806         (Target_powerpc::iplt_section, make_iplt_section,
1807         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1808         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1809         Target_powerpc::plt_entry_count): Count iplt entries too.
1810         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1811         reloc section in constructor.  New params.
1812         (Target_powerpc::make_plt_section): Create reloc section here instead.
1813         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1814         functions.
1815         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1816         (Output_data_glink::add_entry, find_entry): New functions to
1817         deal with local syms.
1818         (Glink_sym_ent): Add support for local syms.
1819         (Output_data_glink::do_write): Handle ifunc plt entries.
1820         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1821         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1822         (Target_powerpc::Relocate::relocate): Likewise.
1823         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1824
1825 2012-09-25  Alan Modra  <amodra@gmail.com>
1826
1827         * object.h (Sized_relobj_file::adjust_local_symbol,
1828         do_adjust_local_symbol): New functions.
1829         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1830         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1831         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1832         and irregular opd entry spacing.
1833         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1834         (Global_symbol_visitor_opd): New functor.
1835         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1836         on deleted opd entries.
1837
1838 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1839
1840         * tilegx.cc: New file.
1841         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1842         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1843         * configure.tgt: Add entries for tilegx*.
1844         * configure.ac: Likewise.
1845         * Makefile.in: Rebuild.
1846         * configure: Likewise.
1847         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1848         tilegx.
1849
1850 2012-09-13  Alan Modra  <amodra@gmail.com>
1851
1852         * target-reloc.h (scan_relocs): Call scan.local for relocs
1853         against symbols in discarded sections.  Pass is_discarded
1854         param.
1855         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1856         Add is_discarded param.
1857         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1858         is_discarded to flag opd entry as discarded.  Don't emit dyn
1859         relocs on such entries.
1860         (Target_powerpc::Scan::global): Similarly detect and handle
1861         such opd entries.
1862         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1863         opd_ent_.  Update all uses.
1864         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1865         (Target_powerpc::relocate_section): Zero out discarded opd
1866         entry relocs.
1867
1868 2012-09-12  Ian Lance Taylor  <iant@google.com>
1869
1870         PR gold/14570
1871         * output.cc: Rename Output_data_got template parameter from size
1872         to got_size for all functions.  Compile all variants of
1873         Output_data_got.
1874         (Output_data_got::Got_entry::write): Correct use of size for
1875         symbol value.  Use local_is_tls rather than casting to
1876         Sized_relobj_file.
1877         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1878         (class Sized_relobj_file): Add do_local_is_tls.
1879         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1880
1881 2012-09-11  Alan Modra  <amodra@gmail.com>
1882
1883         PR gold/14566
1884         * layout.cc (Layout::set_segment_offsets): When using
1885         common-page-size alignment, ensure we are on a new max-page-size
1886         page.
1887         * output.cc (Output_segment::set_section_addresses): Use
1888         abi_pagesize, not common_pagesize for relro boundary.
1889         (Output_segment::set_offset): Likewise.
1890
1891 2012-09-11  Alan Modra  <amodra@gmail.com>
1892
1893         * output.h (Output_data_got::add_global_tls, add_local_tls,
1894         add_local_tls_pair): New functions.
1895         (Output_data_got::add_local_pair_with_rel): Remove second
1896         reloc param.  Expand comment.
1897         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1898         use_plt_or_tls_offset_, similarly for constructor param.
1899         (Output_data_got::Got_entry::write): Add got_index param.
1900         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1901         add_local_tls_pair): New functions.
1902         (Output_data_got::Got_entry::write): Handle tls symbols
1903         with use_plt_or_tls_offset_ set specially.
1904         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1905         (Output_data_got::do_write): Replace iterator with index, pass
1906         index to entry write function.
1907         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1908         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1909         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1910         call.
1911         * i386.cc (Target_i386::Scan::local): Likewise.
1912         * sparc.cc (Target_sparc::Scan::local): Likewise.
1913         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1914         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1915         do_tls_offset_for_global): New functions.
1916         (Target_powerpc::Scan::local): Correct TLS relocations and got
1917         entry values.
1918         (Target_powerpc::Scan::global): Don't emit unnecessary
1919         dynamic relocations on TLS GOT entries.
1920
1921 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1922
1923         * config.in: Disable sanity check for kfreebsd.
1924
1925 2012-09-10  Sterling Augustine  <saugustine@google.com>
1926
1927         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1928         (Gdb_index::pubtypes_read): New parameter.
1929         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1930         to calls.
1931         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1932         pubtypes_object_.
1933
1934 2012-09-09  Alan Modra  <amodra@gmail.com>
1935
1936         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1937         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1938         * gc.h (gc_process_relocs): Call target gc_add_reference.
1939         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1940         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1941         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1942         unnecessary cast.
1943         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1944         to cater for when we don't need code offset.  Update use.
1945         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1946         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1947         set_opd_valid): New functions.
1948         (Target_powerpc::do_gc_add_reference): New function.
1949         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1950         stashed refs.
1951         (Target_powerpc::do_gc_mark_symbol): New function.
1952
1953 2012-09-06  Cary Coutant  <ccoutant@google.com>
1954
1955         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1956         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1957         (Dwarf_die::skip_attributes): Likewise.
1958         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1959         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1960         (main): Call it.
1961         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1962
1963 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1964
1965         * testsuite/script_test_3.t: Add .got.plt output section
1966         statement.
1967         * testsuite/script_test_4.t: Likewise.
1968
1969 2012-09-05  Alan Modra  <amodra@gmail.com>
1970
1971         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1972         update all uses and lose "enum" when using type.
1973
1974 2012-09-05  Alan Modra  <amodra@gmail.com>
1975
1976         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1977         * configure: Regenerate.
1978         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1979         (plugin_final_layout.stdout): Likewise.
1980         (memory_test): Set page sizes to 0x1000.
1981         * testsuite/Makefile.in: Regenerate.
1982         * testsuite/discard_locals_test.sh: Add FIXME comment.
1983         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1984         * testsuite/pr14265.t: Add .got output section statement.
1985         * testsuite/script_test_2.t: Likewise.
1986         * testsuite/script_test_3.t: Likewise.
1987         * testsuite/script_test_4.t: Likewise.
1988         * testsuite/script_test_5.t: Likewise.
1989         * testsuite/script_test_6.t: Likewise.
1990         * testsuite/script_test_7.t: Likewise.
1991         * testsuite/script_test_9.t: Likewise.
1992
1993 2012-09-05  Alan Modra  <amodra@gmail.com>
1994
1995         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1996         (Powerpc_relocate_functions::Status): New typedef.
1997         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1998         (Target_powerpc::Scan::local): Handle REL64.
1999         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2000         for REL32 and REL64.
2001         (Target_powerpc::symval_for_branch): New function, extracted from..
2002         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2003         checks.  Report overflow errors.
2004
2005 2012-09-05  Alan Modra  <amodra@gmail.com>
2006
2007         * object.h (Sized_relobj_file::emit_relocs): Delete.
2008         (Sized_relobj_file::emit_relocs_reltype): Delete.
2009         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2010         relocate_relocs for --emit-relocs.
2011         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2012         * output.h: Update comment.
2013         (Output_segment::first_section): New function.
2014         (Output_segment::first_section_load_address): Use first_section.
2015         * output.cc (Output_segment::first_section): New function extracted..
2016         (Output_segment::first_section_load_address): ..from here.  Delete.
2017         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2018         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2019         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2020         adjust call to target.h function.
2021         * i386.cc (Target_i386): Likewise.
2022         * sparc.cc (Target_sparc): Likewise.
2023         * x86_64.cc (Target_x86_64): Likewise.
2024         * powerpc.cc (Target_powerpc): Likewise.
2025         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2026         first tls section has section symbol for optimised local dynamic
2027         output relocs.
2028         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2029         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2030         optimised tls code.
2031         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2032         Rename to relocate_relocs.  Update error message.
2033
2034 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2035
2036         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2037         --just-symbols.
2038
2039 2012-08-31  Alan Modra  <amodra@gmail.com>
2040
2041         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2042         (Powerpc_relobj::toc_base_offset): New stub function.
2043         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2044         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2045         (Target_powerpc::Relocate::enum skip_tls): New.
2046         (Target_powerpc::call_tls_get_addr_): New var.
2047         (Target_powerpc::is_branch_reloc): Move to file scope.
2048         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2049         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2050         New functions.
2051         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2052         (powerpc_info): Correct common_pagesize for ppc64.
2053         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2054         (Powerpc_relocate_functions): Add overflow check enums and functions.
2055         Add non-shift version of rela, rela_ua.  Delete all rel public
2056         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2057         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2058         addr16_ha3, addr14 functions.
2059         (Output_data_got_powerpc::add_constant_pair): New function.
2060         (Output_data_got_powerpc::got_base_offset): Likewise.
2061         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2062         (instruction constants): Sort, add some more.
2063         (Output_data_glink::do_write): Add and use Address typedef.  Use
2064         object->toc_base_offset() stub for 64-bit.
2065         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2066         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2067         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2068         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2069         Always treat .opd relocs as against locally defined symbol.
2070         Correct condition for RELATIVE relocs.
2071         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2072         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2073         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2074         calculations.  Handle TLS relocs, and more.  Add overflow
2075         checking and adjust for Powerpc_relocate_functions changes.
2076         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2077         Reinstate --emit-relocs code with FIXME.
2078
2079 2012-08-30  Alan Modra  <amodra@gmail.com>
2080
2081         * layout.cc (Layout::set_segment_offsets): Set p_align to
2082         abi_pagesize, not common_pagesize.
2083         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2084         to determine whether file header can go in segment.
2085
2086 2012-08-30  Alan Modra  <amodra@gmail.com>
2087
2088         * output.h (Output_reloc::Output_reloc <output section>): Add
2089         is_relative param.  Adjust calls.
2090         (Output_reloc::add_output_section_relative): New functions.
2091         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2092         is_relative.
2093         (Output_reloc::symbol_value): Handle SECTION_CODE.
2094
2095 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2096
2097         * gold.cc (queue_middle_tasks): Call layout again when unique
2098         segments for sections is desired.
2099         * layout.cc (Layout::Layout): Initialize new members.
2100         (Layout::get_output_section_flags): New function.
2101         (Layout::choose_output_section): Call get_output_section_flags.
2102         (Layout::layout): Make output section for mapping to a unique segment.
2103         (Layout::insert_section_segment_map): New function.
2104         (Layout::attach_allocated_section_to_segment): Make unique segment for
2105         output sections marked so.
2106         (Layout::segment_precedes): Check for unique segments when sorting.
2107         * layout.h (Layout::Unique_segment_info): New struct.
2108         (Layout::Section_segment_map): New typedef.
2109         (Layout::insert_section_segment_map): New function.
2110         (Layout::get_output_section_flags): New function.
2111         (Layout::is_unique_segment_for_sections_specified): New function.
2112         (Layout::set_unique_segment_for_sections_specified): New function.
2113         (Layout::unique_segment_for_sections_specified_): New member.
2114         (Layout::section_segment_map_): New member.
2115         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2116         Rename is_gc_pass_one to is_pass_one.
2117         Rename is_gc_pass_two to is_pass_two.
2118         Rename is_gc_or_icf to is_two_pass.
2119         Check for which pass based on whether symbols data is present.
2120         Make it two pass when unique segments for sections is desired.
2121         * output.cc (Output_section::Output_section): Initialize new
2122         members.
2123         * output.h (Output_section::is_unique_segment): New function.
2124         (Output_section::set_is_unique_segment): New function.
2125         (Output_section::is_unique_segment_): New member.
2126         (Output_section::extra_segment_flags): New function.
2127         (Output_section::set_extra_segment_flags): New function.
2128         (Output_section::extra_segment_flags_): New member.
2129         (Output_section::segment_alignment): New function.
2130         (Output_section::set_segment_alignment): New function.
2131         (Output_section::segment_alignment_): New member.
2132         (Output_segment::Output_segment): Initialize is_unique_segment_.
2133         (Output_segment::is_unique_segment): New function.
2134         (Output_segment::set_is_unique_segment): New function.
2135         (Output_segment::is_unique_segment_): New member.
2136         * plugin.cc (allow_unique_segment_for_sections): New function.
2137         (unique_segment_for_sections): New function.
2138         (Plugin::load): Add new functions to transfer vector.
2139         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2140         * Makefile.in: Regenerate.
2141         * testsuite/plugin_final_layout.sh: Check if unique segment
2142         functionality works.
2143         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2144         are available.
2145         (allow_unique_segment_for_sections): New global.
2146         (unique_segment_for_sections): New global.
2147         (claim_file_hook): Call allow_unique_segment_for_sections.
2148         (all_symbols_read_hook): Call unique_segment_for_sections.
2149
2150 2012-08-22  Cary Coutant  <ccoutant@google.com>
2151
2152         * layout.cc (Layout::include_section): Don't assert on GROUP
2153         sections with --emit-relocs.
2154
2155 2012-08-21  Cary Coutant  <ccoutant@google.com>
2156
2157         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2158         if --export-dynamic-symbol names an undef symbol.
2159
2160 2012-08-18  Alan Modra  <amodra@gmail.com>
2161
2162         * powerpc.cc: Formatting and white space.
2163         (Powerpc_relobj): Rename got2_section_ to special_.
2164         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2165         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2166         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2167         (Target_powerpc): Add Address typedef and invalid_address.  Use
2168         throughout.
2169         (Target_powerpc::is_branch_reloc): New function.
2170         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2171         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2172         for dst_mask, value and addend.
2173         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2174         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2175         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2176         uint16_t for 24-bit offset.  Use get_output_section_offset and
2177         check return.
2178         (Target_powerpc::Scan::local): Handle more relocs.
2179         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2180         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2181         Plug in toc restoring insn after plt calls.  Translate branches
2182         to function descriptor symbols to corresponding entry point.
2183         (Target_powerpc::relocate_for_relocatable): Check return from
2184         get_output_section_offset.
2185         * symtab.h: Comment typo.
2186
2187 2012-08-14  Ian Lance Taylor  <iant@google.com>
2188
2189         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2190         unsupported_relocal_local to call unsupported_reloc_global.
2191
2192 2012-08-14  Nick Clifton  <nickc@redhat.com>
2193
2194         PR ld/14265
2195         * script-sections.cc (Sections_element::output_section_name): Add
2196         keep return parameter.
2197         (Output_section_element::match_name): Add keep return parameter.
2198         Return the value of the keep_ member.
2199         * script-sections.h (class Output_section): Update
2200         output_section_name prototype.
2201         * layout.cc (Layout::keep_input_section): New public member
2202         function.
2203         (Layout::choose_output_section): Pass keep parameter to
2204         output_section_name.
2205         * layout.h (class Layout): Add keep_input_section.
2206         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2207         sections.
2208         * testsuite/Makefile.am: Add a test.
2209         * testsuite/Makefile.in: Regenerate.
2210         * testsuite/pr14265.c: Source file for the test.
2211         * testsuite/pr14265.t: Linker script for the test.
2212         * testsuite/pr14265.sh: Shell script for the test.
2213
2214 2012-08-14  Alan Modra  <amodra@gmail.com>
2215
2216         * target.h (Target::output_section_name): New function.
2217         (Target::do_output_section_name): New function.
2218         * layout.cc (Layout::choose_output_section): Call the above.
2219         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2220
2221 2012-08-14  Alan Modra  <amodra@gmail.com>
2222
2223         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2224         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2225         for replace_constant call.
2226         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2227         (Output_data_glink::do_print_to_mapfile): New function.
2228         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2229         (Target_powerpc::Relocate::relocate): Likewise.
2230
2231 2012-08-14  Alan Modra  <amodra@gmail.com>
2232
2233         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2234         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2235         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2236         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2237         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2238         here.
2239         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2240         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2241         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2242         here.
2243         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2244         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2245
2246 2012-08-12  Alan Modra  <amodra@gmail.com>
2247
2248         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2249         (glink insn constants): Use uint32_t.
2250         (Output_data_glink::add_entry): Use insert, not [] operator.
2251
2252 2012-08-11  Alan Modra  <amodra@gmail.com>
2253
2254         * object.h (Sized_relobj_file::find_shdr): New function.
2255         (Sized_relobj_file::find_special_sections): New function.
2256         * object.cc (Sized_relobj_file::find_shdr): New function.
2257         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2258         (Sized_relobj_file::find_special_sections): New function, split out..
2259         (Sized_relobj_file::do_read_symbols): ..from here.
2260         * output.h (Output_data_got::replace_constant): New function.
2261         (Output_data_got::num_entries): New function.
2262         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2263         (Output_data_got::got_offset): Protected rather than private.
2264         (Output_data_got::replace_got_entry): New function.
2265         * output.cc (Output_data_got::replace_got_entry): New function.
2266         * powerpc.cc (class Powerpc_relobj): New.
2267         (class Powerpc_relocate_functions): Delete all psymval variants or
2268         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2269         Implement _ha functions using corresponding _hi function.
2270         (Powerpc_relobj::find_special_sections): New function.
2271         (Target_powerpc::do_make_elf_object): New function.
2272         (class Output_data_got_powerpc): New.
2273         (class Output_data_glink): New.
2274         (class Powerpc_scan_relocatable_reloc): New.
2275         Many more changes througout file.
2276
2277 2012-08-09  Nick Clifton  <nickc@redhat.com>
2278
2279         * po/vi.po: Updated Vietnamese translation.
2280
2281 2012-08-07  Ian Lance Taylor  <iant@google.com>
2282
2283         * layout.cc (Layout::add_target_dynamic_tags): If
2284         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2285         plt_rel.
2286
2287 2012-07-30  Nick Clifton  <nickc@redhat.com>
2288
2289         * po/gold.pot: Updated template.
2290         * po/es.po: Updated Spanish translation.
2291
2292 2012-07-18  Cary Coutant  <ccoutant@google.com>
2293
2294         PR gold/14344
2295         * configure.ac: Add check for -gpubnames support.
2296         * configure: Regenerate.
2297         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2298         support; force -gno-pubnames.
2299         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2300         support.
2301         (gdb_index_test_4): New test.
2302         * testsuite/Makefile.in: Regenerate.
2303         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2304         * testsuite/gdb_index_test_2.sh: Likewise.
2305         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2306         * testsuite/gdb_index_test_4.sh: New script.
2307         * testsuite/gdb_index_test_comm.sh: New script with common code;
2308         don't look for space after colon.
2309
2310 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2311
2312         * gold.cc (queue_middle_tasks): Update function order only after
2313         deferred objects due to plugins are processed.
2314
2315 2012-07-11  Ian Lance Taylor  <iant@google.com>
2316
2317         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2318         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2319         (Target_arm::scan_reloc_for_stub): Likewise.
2320         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2321         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2322         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2323         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2324         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2325
2326 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2327             Ian Lance Taylor  <iant@google.com>
2328
2329         PR gold/14309
2330         * configure.ac: Test whether std::tr1::hash<off_t> works.
2331         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2332         needed.
2333         * output.h (class Output_fill): Add virtual destructor.
2334         * configure, config.in: Rebuild.
2335
2336 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2337
2338         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2339
2340 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2341
2342         * plugin.cc (Plugin::load): Handle position independent executables.
2343
2344 2012-06-06  Cary Coutant  <ccoutant@google.com>
2345
2346         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2347         add .debug_macro.
2348         (lines_only_debug_sections): Likewise.
2349         (gdb_fast_lookup_sections): New static array.
2350         (is_gdb_debug_section): Rename formal parameter.
2351         (is_lines_only_debug_section): Likewise.
2352         (is_gdb_fast_lookup_section): New function.
2353         (Layout::include_section): Check for ".zdebug_" prefix; pass
2354         section name suffix to is_gdb_debug_section, et al.; check for
2355         fast-lookup sections when building .gdb_index.
2356         * options.h (--strip-debug-gdb): Update GDB version number.
2357
2358 2012-06-06  Cary Coutant  <ccoutant@google.com>
2359
2360         * configure.ac: Add check for fallocate.
2361         * configure: Regenerate.
2362         * config.in: Regenerate.
2363
2364         * options.h (class General_options): Add --mmap-output-file and
2365         --posix-fallocate options.
2366         * output.cc: (posix_fallocate): Remove; replace with...
2367         (gold_fallocate): New function.
2368         (Output_file::map_no_anonymous): Call gold_fallocate.
2369         (Output_file::map): Check --mmap-output-file option.
2370
2371 2012-06-05  Jing Yu  <jingyu@google.com>
2372
2373         * gold.h (textdomain): Add do {} to empty while(0).
2374         (bindtextdomain): Likewise.
2375
2376 2012-06-04  Cary Coutant  <ccoutant@google.com>
2377
2378         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2379         has_dynsym_index.
2380
2381 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2382
2383         * symtab.cc (Symbol_table::define_special_symbol):
2384         Initialize *poldsym to prevent uninitialized variable errors.
2385
2386 2012-05-23  Cary Coutant  <ccoutant@google.com>
2387
2388         * layout.cc (Layout::section_name_mapping): Add rules to handle
2389         exact match on .data.rel.ro.local or .data.rel.ro.
2390         (Layout::output_section_name): Check for exact matches.
2391
2392 2012-05-23  Cary Coutant  <ccoutant@google.com>
2393
2394         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2395         more carefully.
2396
2397 2012-05-22  Cary Coutant  <ccoutant@google.com>
2398
2399         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2400         object before exporting symbol.
2401
2402 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2403
2404         * testsuite/tls_test.cc: Include "config.h" first.
2405         * testsuite/tls_test_c.c: Likewise.
2406
2407 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2408             Nick Clifton  <nickc@redhat.com>
2409
2410         PR 14072
2411         * configure.in: Add check that sysdep.h has been included before
2412         any system header files.
2413         * configure: Regenerate.
2414         * config.in: Regenerate.
2415
2416 2012-05-14  Cary Coutant  <ccoutant@google.com>
2417
2418         * layout.cc (Layout::make_output_section): Mark .tdata section
2419         as RELRO.
2420         * testsuite/relro_test.cc: Add a TLS variable.
2421
2422 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2423
2424         PR gold/14091
2425         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2426         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2427         R_X86_64_64.
2428
2429 2012-05-08  Cary Coutant  <ccoutant@google.com>
2430
2431         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2432         (lines_only_debug_sections): Likewise.
2433
2434 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2435
2436         * nacl.cc: New file.
2437         * nacl.h: New file.
2438         * Makefile.am (CCFILES, HFILES): Add them.
2439         * Makefile.in: Regenerate.
2440         * i386.cc (Output_data_plt_i386_nacl): New class.
2441         (Output_data_plt_i386_nacl_exec): New class.
2442         (Output_data_plt_i386_nacl_dyn): New class.
2443         (Target_i386_nacl): New class.
2444         (Target_selector_i386_nacl): New class.
2445         (target_selector_i386): Use it instead of Target_selector_i386.
2446         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2447         (Target_x86_64_nacl): New class.
2448         (Target_selector_x86_64_nacl): New class.
2449         (target_selector_x86_64, target_selector_x32): Use it instead of
2450         Target_selector_x86_64.
2451         * arm.cc (Output_data_plt_arm_nacl): New class.
2452         (Target_arm_nacl): New class.
2453         (Target_selector_arm_nacl): New class.
2454         (target_selector_arm, target_selector_armbe): Use it instead of
2455         Target_selector_arm.
2456
2457         * target-select.cc (select_target): Take new Input_file* and off_t
2458         arguments, pass them on to recognize method of selector.
2459         * object.cc (make_elf_sized_object): Update caller.
2460         * parameters.cc (parameters_force_valid_target): Likewise.
2461         * incremental.cc (make_sized_incremental_binary): Likewise.
2462         * target-select.h: Update decl.
2463         (Target_selector::recognize): Take new Input_file* argument,
2464         pass it on to do_recognize.
2465         (Target_selector::do_recognize): Take new Input_file* argument.
2466         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2467         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2468         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2469         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2470
2471         * target.h (Target::Target_info): New members isolate_execinstr
2472         and rosegment_gap.
2473         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2474         * arm.cc (Target_arm::arm_info): Update initializer.
2475         * i386.cc (Target_i386::i386_info): Likewise.
2476         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2477         * sparc.cc (Target_sparc::sparc_info): Likewise.
2478         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2479         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2480         * layout.cc (Layout::attach_allocated_section_to_segment):
2481         Take new const Target* argument.  If target->isolate_execinstr(), act
2482         like --rosegment.
2483         (Layout::find_first_load_seg): Take new const Target* argument;
2484         if target->isolate_execinstr(), reject PF_X segments.
2485         (Layout::relaxation_loop_body): Update caller.
2486         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2487         reset file offset to zero when we hit LOAD_SEG, and then do a second
2488         loop over the segments before LOAD_SEG to reassign offsets after
2489         addresses have been determined.  Handle target->rosegment_gap().
2490         (Layout::attach_section_to_segment): Take new const Target* argument;
2491         pass it to attach_allocated_section_to_segment.
2492         (Layout::make_output_section): Update caller.
2493         (Layout::attach_sections_to_segments): Take new const Target* argument;
2494         pass it to attach_section_to_segment.
2495         * gold.cc (queue_middle_tasks): Update caller.
2496         * layout.h (Layout): Update method decls with new arguments.
2497
2498         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2499         Target_info pointer to use.
2500         (Target_arm::do_make_data_plt): New virtual method.
2501         (Target_arm::make_data_plt): New method that calls it.
2502         (Target_arm::make_plt_entry): Use it.
2503         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2504         for the section alignment.
2505         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2506         method.
2507         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2508         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2509         method.
2510         (Output_data_plt_arm::get_plt_entry_size): Call it.
2511         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2512         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2513         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2514         method.
2515         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2516         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2517         method instead of sizeof(plt_entry).
2518         (Output_data_plt_arm::add_entry): Likewise.
2519         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2520         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2521         than static method.
2522         (Target_arm::plt_entry_size): Likewise.
2523         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2524         Move to ...
2525         (Output_data_plt_arm_standard): ... here, new class.
2526         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2527         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2528         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2529
2530         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2531         Take additional argument for the PLT entry size.
2532         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2533         Use get_plt_entry_size method rather than plt_entry_size variable.
2534         (Output_data_plt_x86_64::reserve_slot): Likewise.
2535         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2536         (Output_data_plt_x86_64::add_entry): Likewise.
2537         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2538         (Output_data_plt_x86_64::address_for_global): Likewise.
2539         (Output_data_plt_x86_64::address_for_local): Likewise.
2540         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2541         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2542         Make method non-static.
2543         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2544         method.
2545         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2546         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2547         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2548         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2549         virtual method.
2550         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2551         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2552         virtual method.
2553         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2554         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2555         virtual method.
2556         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2557         (Output_data_plt_x86_64::plt_entry_size)
2558         (Output_data_plt_x86_64::first_plt_entry)
2559         (Output_data_plt_x86_64::plt_entry)
2560         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2561         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2562         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2563         (Output_data_plt_x86_64_standard): ... here, new class.
2564         (Target_x86_64::Target_x86_64): Take optional argument for the
2565         Target_info pointer to use.
2566         (Target_x86_64::do_make_data_plt): New virtual method.
2567         (Target_x86_64::make_data_plt): New method to call it.
2568         (Target_x86_64::init_got_plt_for_update): Use that.
2569         Call this->plt_->add_eh_frame method here.
2570         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2571         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2572         rather than static method.
2573         (Target_x86_64::plt_entry_size): Likewise.
2574         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2575         rather than plt_entry_size variable.  Move guts of PLT filling to...
2576         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2577         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2578         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2579
2580         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2581         additional argument for the section alignment.
2582         Don't do add_eh_frame_for_plt here.
2583         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2584         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2585         variable.
2586         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2587         method.
2588         (Output_data_plt_i386::get_plt_entry_size): Call it.
2589         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2590         (Output_data_plt_i386::add_eh_frame): New method to call it.
2591         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2592         method.
2593         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2594         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2595         method.
2596         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2597         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2598         method instead of plt_entry_size.
2599         (Output_data_plt_i386::plt_entry_size)
2600         (Output_data_plt_i386::plt_eh_frame_fde_size)
2601         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2602         (Output_data_plt_i386_standard): ... here, new class.
2603         (Output_data_plt_i386_exec): New class.
2604         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2605         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2606         (Output_data_plt_i386::exec_plt_entry): Move to ...
2607         (Output_data_plt_i386_exec::plt_entry): ... here.
2608         (Output_data_plt_i386_dyn): New class.
2609         (Output_data_plt_i386::first_plt_entry): Move to ...
2610         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2611         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2612         (Output_data_plt_i386_dyn::plt_entry): ... here.
2613         (Target_i386::Target_i386): Take optional argument for the Target_info
2614         pointer to use.
2615         (Target_i386::do_make_data_plt): New virtual method.
2616         (Target_i386::make_data_plt): New method to call it.
2617         (Target_i386::make_plt_section): Use that.
2618         Call this->plt_->add_eh_frame method here.
2619         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2620         rather than plt_entry_size variable.
2621         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2622         (Output_data_plt_i386::address_for_local): Likewise.
2623         (Output_data_plt_i386::do_write): Likewise.
2624         Move guts of PLT filling to...
2625         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2626         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2627         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2628         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2629
2630 2012-05-01  Cary Coutant  <ccoutant@google.com>
2631
2632         * dwarf_reader.cc (Dwarf_die::read_attributes)
2633         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2634         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2635         * reduced_debug_output.cc
2636         (Output_reduced_debug_info_section::get_die_end): Remove
2637         DW_FORM_GNU_ref_index.  Add default case.
2638
2639 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2640
2641         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2642         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2643         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2644         DW_AT_high_pc as offset from DW_AT_low_pc.
2645
2646         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2647         * testsuite/Makefile.in: Regenerate.
2648         * testsuite/gdb_index_test_3.c: New test source file.
2649         * testsuite/gdb_index_test_3.sh: New test source file.
2650
2651 2012-04-25  Ian Lance Taylor  <iant@google.com>
2652
2653         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2654         pointer.
2655         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2656         as a class, not a struct.
2657         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2658         (Target_arm::apply_cortex_a8_workaround): Likewise.
2659         * gc.h: Declare Reloc_types as a struct, not a class.
2660         * object.h: Declare Symbols_data as a struct.
2661         * reloc.h: Declare Read_relocs_data as a struct.
2662         * target.h: Declare Relocate_info as a struct.
2663
2664 2012-04-24  David S. Miller  <davem@davemloft.net>
2665
2666         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2667         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2668         and R_SPARC_WPLT30.
2669
2670 2012-04-24  Cary Coutant  <ccoutant@google.com>
2671
2672         * incremental-dump.cc (find_input_containing_global): Replace
2673         magic number with symbolic constant.
2674         (dump_incremental_inputs): Update version number.
2675         * incremental.cc (Output_section_incremental_inputs): Update version
2676         number; import symbolic constants from Incremental_inputs_reader.
2677         (Incremental_inputs::create_data_sections): Align relocations
2678         section correctly for 64-bit targets.
2679         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2680         constants; add padding.
2681         (Output_section_incremental_inputs::write_header): Add assert for
2682         header_size.
2683         (Output_section_incremental_inputs::write_input_files): Add assert
2684         for input_entry_size.
2685         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2686         add assert for object_info_size, input_section_entry_size,
2687         global_sym_entry_size.
2688         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2689         for data structure sizes; use them.
2690         (Incremental_input_entry_reader): Import symbolic constants from
2691         Incremental_inputs_reader; use them.
2692
2693 2012-04-23  David S. Miller  <davem@davemloft.net>
2694
2695         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2696         and elf_flags_set_.
2697         (Target_sparc::Target_sparc): Initialize new fields.
2698         (Target_sparc::do_make_elf_object): New function.
2699         (Target_sparc::do_adjust_elf_header): New function.
2700
2701 2012-04-23  Cary Coutant  <ccoutant@google.com>
2702
2703         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2704         CU range table of gdb index.
2705
2706 2012-04-20  David S. Miller  <davem@davemloft.net>
2707
2708         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2709         instead of false.
2710
2711 2012-04-16  David S. Miller  <davem@davemloft.net>
2712
2713         * sparc.cc (Target_sparc::got_address): New function.
2714         (Sparc_relocate_functions::gdop_hix22): New function.
2715         (Sparc_relocate_functions::gdop_lox10): New function.
2716         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2717         relocs.
2718         (Target_sparc::Scan::local): Likewise if the global symbol is not
2719         preemptible and is not IFUNC.
2720         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2721         transformations for local and non-preemptible non-IFUNC global
2722         symbols.
2723
2724         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2725         writing out 64-bit part of ranges.
2726
2727         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2728         -fpic and -fpie respectively.
2729         * Makefile.in: Regenerate.
2730
2731         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2732         (Target_sparc::Target_sparc): Initialize new field.
2733         (Target_sparc::do_plt_section_for_global): New function.
2734         (Target_sparc::do_plt_section_for_local): New function.
2735         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2736         (Target_sparc::make_plt_section): New function, broken out of
2737         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2738         (Target_sparc::make_plt_entry): Call make_plt_section.
2739         (Target_sparc::make_local_ifunc_plt_entry): New function.
2740         (Target_sparc::rela_ifunc_section): New function.
2741         (Target_sparc::plt_section): Remove const.
2742         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2743         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2744         and ifunc_count_ fields.
2745         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2746         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2747         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2748         (Output_data_plt_sparc::rela_ifunc): New function.
2749         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2750         (Output_data_plt_sparc::has_ifunc_section): New function.
2751         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2752         (Output_data_plt_sparc::address_for_global): New function.
2753         (Output_data_plt_sparc::address_for_local): New function.
2754         (Output_data_plt_sparc::plt_index_to_offset): New function.
2755         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2756         and entry_count.
2757         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2758         entry_count.
2759         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2760         R_SPARC_JMP_IREL to switch.
2761         (Target_sparc::Scan::check_non_pic): Likewise.
2762         (Target_sparc::Scan::local): Handle IFUNC symbols.
2763         (Target_sparc::Scan::local): Likewise.
2764         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2765         and plt_address_for_local.
2766         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2767         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2768
2769         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2770         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2771         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2772         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2773         global relocs too.
2774         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2775         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2776         calls.
2777         * sparc.cc (Target_sparc::Scan::global): Likewise.
2778         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2779
2780 2012-04-16  Cary Coutant  <ccoutant@google.com>
2781
2782         * archive.cc (Library_base::should_include_member): Check for
2783         --export-dynamic-symbol.
2784         * options.h (class General_options): Add --export-dynamic-symbol.
2785         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2786         --export-dynamic-symbol.
2787         (Symbol_table::gc_mark_undef_symbols): Likewise.
2788         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2789
2790 2012-04-12  David S. Miller  <davem@davemloft.net>
2791
2792         * sparc.cc (Reloc::wdisp10): New relocation method.
2793         (Reloc::h34): Likewise.
2794         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2795         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2796         R_SPARC_WDISP10.
2797         (Target_sparc::Scan::local): Likewise.
2798         (Target_sparc::Scan::global): Likewise.
2799         (Target_sparc::Relocate::relocate): Likewise.
2800
2801 2012-04-09  Cary Coutant  <ccoutant@google.com>
2802
2803         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2804         low_pc == 0.
2805
2806 2012-04-06  Ian Lance Taylor  <iant@google.com>
2807
2808         * timer.cc: #include <unistd.h>.
2809
2810 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2811
2812         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2813         * config.in: Regenerate.
2814         * configure: Regenerate.
2815
2816 2012-04-05  Nick Clifton  <nickc@redhat.com>
2817
2818         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2819         (AM_LC_MESSAGES): Add.
2820         * aclocal.m4: Regenerate.
2821         * config.in: Regenerate.
2822         * configure: Regenerate.
2823
2824 2012-03-21  Cary Coutant  <ccoutant@google.com>
2825
2826         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2827         * Makefile.in: Regenerate.
2828         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2829         (Sized_elf_reloc_mapper::symbol_section): New function.
2830         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2831         (make_elf_reloc_mapper): New function.
2832         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2833         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2834         (Dwarf_abbrev_table::do_get_abbrev): New function.
2835         (Dwarf_ranges_table::read_ranges_table): New function.
2836         (Dwarf_ranges_table::read_range_list): New function.
2837         (Dwarf_pubnames_table::read_section): New function.
2838         (Dwarf_pubnames_table::read_header): New function.
2839         (Dwarf_pubnames_table::next_name): New function.
2840         (Dwarf_die::Dwarf_die): New function.
2841         (Dwarf_die::read_attributes): New function.
2842         (Dwarf_die::skip_attributes): New function.
2843         (Dwarf_die::set_name): New function.
2844         (Dwarf_die::set_linkage_name): New function.
2845         (Dwarf_die::attribute): New function.
2846         (Dwarf_die::string_attribute): New function.
2847         (Dwarf_die::int_attribute): New function.
2848         (Dwarf_die::uint_attribute): New function.
2849         (Dwarf_die::ref_attribute): New function.
2850         (Dwarf_die::child_offset): New function.
2851         (Dwarf_die::sibling_offset): New function.
2852         (Dwarf_info_reader::check_buffer): New function.
2853         (Dwarf_info_reader::parse): New function.
2854         (Dwarf_info_reader::do_parse): New function.
2855         (Dwarf_info_reader::do_read_string_table): New function.
2856         (Dwarf_info_reader::lookup_reloc): New function.
2857         (Dwarf_info_reader::get_string): New function.
2858         (Dwarf_info_reader::visit_compilation_unit): New function.
2859         (Dwarf_info_reader::visit_type_unit): New function.
2860         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2861         Sized_elf_reloc_mapper.
2862         (Sized_dwarf_line_info::symbol_section): Remove function.
2863         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2864         (Sized_dwarf_line_info::read_line_mappings): Remove object
2865         parameter, adjust callers.
2866         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2867         * dwarf_reader.h: Include <sys/types.h>.
2868         (class Track_relocs): Remove forward declaration.
2869         (class Elf_reloc_mapper): New class.
2870         (class Sized_elf_reloc_mapper): New class.
2871         (class Dwarf_abbrev_table): New class.
2872         (class Dwarf_range_list): New class.
2873         (class Dwarf_ranges_table): New class.
2874         (class Dwarf_pubnames_table): New class.
2875         (class Dwarf_die): New class.
2876         (class Dwarf_info_reader): New class.
2877         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2878         (Sized_dwarf_line_info::symbol_section): Remove member function.
2879         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2880         base class.
2881         * gdb-index.cc: New source file.
2882         * gdb-index.h: New source file.
2883         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2884         and .debug_types sections, call Layout::add_to_gdb_index.
2885         (Sized_relobj_incr::do_section_name): Implement.
2886         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2887         return type; Implement.
2888         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2889         return type.
2890         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2891         parameter list and return type.
2892         (Sized_incr_dynobj::do_section_contents): Likewise.
2893         * layout.cc: Include gdb-index.h.
2894         (Layout::Layout): Initialize gdb_index_data_.
2895         (Layout::init_fixed_output_section): Check for .gdb_index section.
2896         (Layout::add_to_gdb_index): New function. Instantiate.
2897         * layout.h: Add forward declaration for class Gdb_index.
2898         (Layout::add_to_gdb_index): New member function.
2899         (Layout::gdb_index_data_): New data member.
2900         * main.cc: Include gdb-index.h.
2901         (main): Print statistics for gdb index.
2902         * object.cc (Object::section_contents): Move code into
2903         do_section_contents.
2904         (need_decompressed_section): Check for sections needed when building
2905         gdb index.
2906         (build_compressed_section_map): Likewise.
2907         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2908         gdb index.
2909         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2910         sections; call Layout::add_to_gdb_index.
2911         (Sized_relobj_file::do_decompressed_section_contents): Call
2912         do_section_contents directly.
2913         * object.h (Object::do_section_contents): Adjust parameter list and
2914         return type.
2915         (Object::do_decompressed_section_contents): Call do_section_contents
2916         directly.
2917         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2918         return type.
2919         * options.h (class General_options): Add --gdb-index option.
2920         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2921         list and return type.
2922         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2923         * reloc.h (Track_relocs::checkpoint): New function.
2924         (Track_relocs::reset): New function.
2925
2926         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2927         New test cases.
2928         * testsuite/Makefile.in: Regenerate.
2929         * testsuite/gdb_index_test.cc: New test source file.
2930         * testsuite/gdb_index_test_1.sh: New test source file.
2931         * testsuite/gdb_index_test_2.sh: New test source file.
2932
2933 2012-03-19  Doug Kwan  <dougkwan@google.com>
2934
2935         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2936         (Target_arm::do_finalize_sections): Remove code which defines
2937         __exidx_start and __exidx_end.  Make symbol table parameter
2938         anonymous as it is not used.
2939         * gold.cc (queue_middle_tasks): Call target hook to define any
2940         target-specific symbols.
2941         * target.h (Target::define_standard_symbols): New method.
2942         (Target::do_define_standard_symbols): Same.
2943         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2944         * testsuite/Makefile.in: Regenerate.
2945         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2946         and __exidx_end.
2947         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2948         relocations are generated for __exidx_start and __exidx_end.
2949
2950 2012-03-16  Doug Kwan  <dougkwan@google.com>
2951
2952         * testsuite/Makefile.am: Disable test initpri3b.
2953         * testsuite/Makefile.in: Regenerate.
2954
2955 2012-03-15  Doug Kwan  <dougkwan@google.com>
2956
2957         * arm.cc (Target_arm::got_section): Make .got section read-only
2958         if -z now is given.
2959
2960 2012-03-15  Ian Lance Taylor  <iant@google.com>
2961
2962         PR gold/13850
2963         * layout.cc (Layout::make_output_section): Correctly mark
2964         SHT_INIT_ARRAY, et. al., as relro.
2965
2966 2012-03-14  Doug Kwan  <dougkwan@google.com>
2967
2968         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2969         dynamic relocations for protected symbols in shared objects.
2970
2971 2012-03-13  Ian Lance Taylor  <iant@google.com>
2972
2973         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2974         keep the larger alignment.
2975
2976 2012-03-12  Cary Coutant  <ccoutant@google.com>
2977
2978         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2979         handling of DW_LNE_define_file.
2980
2981 2012-03-12  Cary Coutant  <ccoutant@google.com>
2982
2983         * reduced_debug_output.cc
2984         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2985         codes to switch.
2986
2987 2012-02-29  Cary Coutant  <ccoutant@google.com>
2988
2989         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2990
2991 2012-02-29  Cary Coutant  <ccoutant@google.com>
2992
2993         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2994         Call Object::decompressed_section_contents.
2995         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2996         New dtor.
2997         (Sized_dwarf_line_info::buffer_start_): New data member.
2998         * merge.cc (Output_merge_data::do_add_input_section): Call
2999         Object::decompressed_section_contents.
3000         (Output_merge_string::do_add_input_section): Likewise.
3001         * object.cc (need_decompressed_section): New function.
3002         (build_compressed_section_map): Decompress sections needed later.
3003         (Sized_relobj_file::do_decompressed_section_contents): New function.
3004         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3005         * object.h (Object::decompressed_section_contents): New function.
3006         (Object::discard_decompressed_sections): New function.
3007         (Object::do_decompressed_section_contents): New function.
3008         (Object::do_discard_decompressed_sections): New function.
3009         (Compressed_section_info): New type.
3010         (Compressed_section_map): Include decompressed section contents.
3011         (Sized_relobj_file::do_decompressed_section_contents): New function.
3012         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3013
3014 2012-02-16  Cary Coutant  <ccoutant@google.com>
3015
3016         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3017         * testsuite/Makefile.in: Regenerate.
3018
3019 2012-02-14  Cary Coutant  <ccoutant@google.com>
3020
3021         * options.cc (General_options::finalize): Disallow -pie and -static.
3022
3023 2012-02-03  Doug Kwan  <dougkwan@google.com>
3024
3025         * arm.cc (Arm_relocate_functions::abs8,
3026         Arm_relocate_functions::abs16): Use
3027         Bits::has_signed_unsigned_overflow32.
3028         (Arm_relocate_functions::thm_abs8): Correct range of
3029         overflow check.
3030         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3031         in assertions.
3032
3033 2012-02-02  Doug Kwan  <dougkwan@google.com>
3034
3035         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3036         position independent outputs, not just shared objects.
3037
3038 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3039
3040         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3041         * configure: Regenerated.
3042
3043 2012-01-27  Ian Lance Taylor  <iant@google.com>
3044
3045         * reloc.h (Bits): New class with static functions, copied from
3046         namespace utils in arm.cc.
3047         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3048         instead.
3049
3050 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3051
3052         * incremental.cc (write_info_blocks): Correct relocation offset.
3053
3054 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3055
3056         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3057         (Relocate::tls_gd_to_le): Likewise.
3058
3059 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3060
3061         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3062
3063 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3064
3065         * configure.ac: Check if -mcmodel=medium works.
3066         * configure: Regenerated.
3067
3068 2012-01-24  Cary Coutant  <ccoutant@google.com>
3069
3070         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3071         definition and ...
3072         (read_unsigned_LEB_128_x): ... this new function.
3073         (read_signed_LEB_128): Replaced with inline definition and ...
3074         (read_signed_LEB_128_x): ... this new function.
3075         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3076         (read_unsigned_LEB_128): Add inline definition.
3077         (read_signed_LEB_128_x): New function.
3078         (read_signed_LEB_128): Add inline definition.
3079         * testsuite/Makefile.am (leb128_unittest): New unit test.
3080         * testsuite/Makefile.in: Regenerate.
3081         * testsuite/leb128_unittest.cc: New unit test.
3082
3083 2012-01-23  Ian Lance Taylor  <iant@google.com>
3084
3085         PR gold/13617
3086         * i386.cc (Target_i386::do_code_fill): When using a jmp
3087         instruction, pad with nop instructions.
3088         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3089
3090 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3091
3092         * x86_64.cc (gc_process_relocs): Add typename on types used in
3093         template.
3094         (scan_relocs): Likewise.
3095         (relocate_section): Likewise.
3096         (apply_relocation): Likewise.
3097
3098 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3099
3100         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3101         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3102         under x32.
3103
3104 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3105
3106         * x86_64.cc: Initial support for x32.
3107
3108 2012-01-03  Cary Coutant  <ccoutant@google.com>
3109
3110         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3111         Use abstract base class for GOT.
3112         * gold/output.h (class Output_data_got_base): New abstract base class.
3113         (class Output_data_got): Derive from new base class, adjust ctors.
3114         (Output_data_got::reserve_slot): Make virtual; rename to
3115         do_reserve_slot; Adjust callers.
3116         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3117         pointer to abstract base class.
3118         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3119
3120 2011-12-18  Ian Lance Taylor  <iant@google.com>
3121
3122         * object.h (Relobj::local_symbol_value): New function.
3123         (Relobj::local_plt_offset): New function.
3124         (Relobj::local_has_got_offset): New function.
3125         (Relobj::local_got_offset): New function.
3126         (Relobj::set_local_got_offset): New function.
3127         (Relobj::do_local_symbol_value): New pure virtual function.
3128         (Relobj::do_local_plt_offset): Likewise.
3129         (Relobj::do_local_has_got_offset): Likewise.
3130         (Relobj::do_local_got_offset): Likewise.
3131         (Relobj::do_set_local_got_offset): Likewise.
3132         (Sized_relobj::do_local_has_got_offset): Rename from
3133         local_has_got_offset.
3134         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3135         (Sized_relobj::do_set_local_got_offset): Rename from
3136         set_local_got_offset.
3137         (Sized_relobj_file::do_local_plt_offset): Rename from
3138         local_plt_offset.
3139         (Sized_relobj_file::do_local_symbol_value): New function.
3140         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3141         local_plt_offset.
3142         * output.cc (Output_data_got::Got_entry::write): Change object to
3143         Relobj.  Use local_symbol_value.
3144         (Output_data_got::add_global_with_rel): Change rel_dyn to
3145         Output_data_reloc_generic*.  Use add_global_generic.
3146         (Output_data_got::add_global_with_rela): Remove.  Change all
3147         callers to use add_global_with_rel.
3148         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3149         Output_data_reloc_generic*.  Use add_global_generic.
3150         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3151         callers to use add_global_pair_with_rel.
3152         (Output_data_got::add_local): Change object to Relobj*.
3153         (Output_data_got::add_local_plt): Likewise.
3154         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3155         change rel_dyn to Output_data_reloc_generic*.  Use
3156         add_local_generic.
3157         (Output_data_got::add_local_with_rela): Remove.  Change all
3158         callers to use all_local_with_rel.
3159         (Output_data_got::add_local_pair_with_rel): Change object to
3160         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3161         add_output_section_generic.
3162         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3163         callers to use add_local_pair_with_rel.
3164         (Output_data_got::reserve_local): Change object to Relobj*.
3165         * output.h: (class Output_data_reloc_generic): Add pure virtual
3166         declarations for add_global_generic, add_local_generic,
3167         add_output_section_generic.
3168         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3169         functions for Output_data_reloc_generic.  Update declarations for
3170         changes listed in output.cc.
3171         (class Output_data_got): Change template parameter to got_size.
3172         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3173         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3174         function.
3175         (Sized_relobj_incr::do_local_plt_offset): New function.
3176         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3177         add_global_generic.
3178
3179 2011-12-17  Cary Coutant  <ccoutant@google.com>
3180
3181         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3182         * resolve.cc (Symbol_table::resolve): Likewise.
3183         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3184         arrays.
3185         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3186
3187 2011-12-16  Ian Lance Taylor  <iant@google.com>
3188
3189         * output.h (Output_data_reloc_generic::add): Only call
3190         add_dynamic_reloc if this is a dynamic reloc section.
3191
3192 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3193
3194         PR gold/13505
3195         * target-reloc.h (apply_relocation): Replace <64, false> with
3196         <size, big_endian>.
3197
3198 2011-11-25  Nick Clifton  <nickc@redhat.com>
3199
3200         * po/it.po: New Italian translation.
3201
3202 2011-11-17  Sterling Augustine  <saugustine@google.com>
3203
3204         * script.cc (script_include_directive): Implement.
3205         (read_script_file): New local variables name and search_path. Update
3206         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3207         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3208         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3209
3210 2011-11-11  Sterling Augustine  <saugustine@google.com>
3211
3212         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3213         (file_or_sections_cmd): Likewise.
3214
3215 2011-11-11  Doug Kwan  <dougkwan@google.com>
3216
3217         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3218         if --just-symbols is given.
3219
3220 2011-11-10  Doug Kwan  <dougkwan@google.com>
3221
3222         PR gold/13362
3223         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3224         when processing data relocs.
3225         * reloc.h (Relocate_functions::rel_unaligned): New method.
3226         (Relocate_functions::pcrel_unaligned): Ditto.
3227         (Relocate_functions::rel32_unaligned): Ditto.
3228         (Relocate_functions::pcrel32_unaligned): Ditto.
3229
3230 2011-11-09  Doug Kwan  <dougkwan@google.com>
3231
3232         PR gold/13362
3233         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3234         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3235         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3236         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3237         (Relocate_functions::rel_unaligned): New.
3238         (Relocate_functions::rel32_unaligned): New.
3239         * target-reloc.h (relocate_for_relocatable): Add code to handle
3240         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3241         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3242         arm_unaligned_reloc_r): New targets.
3243         * testsuite/Makefile.in: Regenerate.
3244         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3245         linking.
3246
3247 2011-11-02  Ian Lance Taylor  <iant@google.com>
3248
3249         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3250         NATIVE_LINKER.
3251         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3252         * options.cc (General_options::finalize): Use library search path
3253         from configure script if specified.  If not native and no sysroot,
3254         only search TOOLLIBDIR.
3255         * options.h (Search_directory::Search_directory): Change name to
3256         const std::string&.
3257         (General_options::add_to_library_path_with_sysroot): Change arg to
3258         const std::string&.
3259         * configure, Makefile.in, config.in: Rebuild.
3260
3261 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3262
3263         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3264         we are working around the ARM1176 Erratum.
3265         * options.h (General_options::fix_arm1176): Add option.
3266         * testsuite/Makefile.am: Add testcases, and keep current ones
3267         working.
3268         * testsuite/Makefile.in: Regenerate.
3269         * testsuite/arm_fix_1176.s: New file.
3270         * testsuite/arm_fix_1176.sh: Likewise.
3271
3272 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3273
3274         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3275         may_use_blx_.
3276         (Target_arm::may_use_blx): Remove method.
3277         (Target_arm::set_may_use_blx): Likewise.
3278         (Target_arm::may_use_v4t_interworking): New method.
3279         (Target_arm::may_use_v5t_interworking): Likewise.
3280         (Target_arm::may_use_blx_): Remove member variable.
3281         (Arm_relocate_functions::arm_branch_common): Check for v5T
3282         interworking.
3283         (Arm_relocate_functions::thumb_branch_common): Likewise.
3284         (Reloc_stub::stub_type_for_reloc): Likewise.
3285         (Target_arm::do_finalize_sections): Correct interworking checks.
3286         * testsuite/Makefile.am: Add new tests.
3287         * testsuite/Makefile.in: Regenerate.
3288         * testsuite/arm_farcall_arm_arm.s: New test.
3289         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3290         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3291         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3292         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3293         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3294         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3295         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3296
3297 2011-10-31  Cary Coutant  <ccoutant@google.com>
3298
3299         PR gold/13023
3300         * expression.cc (Expression::eval_with_dot): Add
3301         is_section_dot_assignment parameter.
3302         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3303         absolute and assigning to dot within a section.
3304         * script-sections.cc
3305         (Output_section_element_assignment::set_section_addresses): Pass
3306         dot_section to set_if_absolute.
3307         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3308         as is_section_dot_assignment flag to eval_with_dot.
3309         (Output_section_element_dot_assignment::set_section_addresses):
3310         Likewise.
3311         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3312         parameter.  Also set value if relative to dot_section; set the
3313         symbol's output_section.
3314         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3315         parameter.  Adjust all callers.
3316         (Expression::eval_maybe_dot): Likewise.
3317         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3318         Adjust all callers.
3319         * testsuite/script_test_2.t: Test assignment of an absolute value
3320         to dot within an output section element.
3321
3322 2011-10-31  Cary Coutant  <ccoutant@google.com>
3323
3324         * options.h (class General_options): Add --[no-]gnu-unique options.
3325         * symtab.cc (Symbol_table::sized_write_globals): Convert
3326         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3327
3328 2011-10-31  Cary Coutant  <ccoutant@google.com>
3329
3330         PR gold/13359
3331         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3332         unnecessary assertion.
3333         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3334
3335 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3336
3337         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3338         gc_mark_symbol.
3339         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3340         gc_mark_symbol.
3341         Change to just keep the section associated with symbol.
3342         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3343         they are externally visible and --export-dynamic is turned on.
3344         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3345
3346 2011-10-19  Ian Lance Taylor  <iant@google.com>
3347
3348         PR gold/13163
3349         * script-sections.cc
3350         (Output_section_element_dot_assignment::needs_output_section): New
3351         function.
3352
3353 2011-10-19  Ian Lance Taylor  <iant@google.com>
3354
3355         PR gold/13204
3356         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3357         --section-start option was seen.
3358         * options.h (General_options::any_section_start): New function.
3359
3360 2011-10-18  David S. Miller  <davem@davemloft.net>
3361
3362         PR binutils/13301
3363         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3364         member to track relocation locations that have moved during TLS
3365         reloc optimizations.
3366         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3367         (Target_sparc::Relocate::relocate): Adjust view down by 4
3368         bytes if it matches reloc_adjust_addr_.
3369         (Target_sparc::Relocate::relocate_tls): Always move the
3370         __tls_get_addr call delay slot instruction forward 4 bytes when
3371         performing relaxation.
3372
3373 2011-10-18  Cary Coutant  <ccoutant@google.com>
3374
3375         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3376         (Output_file::map_no_anonymous): Check for non-zero
3377         return code from posix_fallocate.
3378
3379 2011-10-17  Cary Coutant  <ccoutant@google.com>
3380
3381         PR gold/13245
3382         * plugin.cc (is_visible_from_outside): Check for symbols
3383         referenced from dynamic objects.
3384         * resolve.cc (Symbol_table::resolve): Don't count references
3385         from dynamic objects as references from real ELF files.
3386         * testsuite/plugin_test_2.sh: Adjust expected result.
3387
3388 2011-10-17  Cary Coutant  <ccoutant@google.com>
3389
3390         * gold.cc: Include timer.h.
3391         (queue_middle_tasks): Stamp time.
3392         (queue_final_tasks): Likewise.
3393         * main.cc (main): Store timer in parameters.  Print timers
3394         for each pass.
3395         * parameters.cc (Parameters::Parameters): Initialize timer_.
3396         (Parameters::set_timer): New function.
3397         (set_parameters_timer): New function.
3398         * parameters.h (Parameters::set_timer): New function.
3399         (Parameters::timer): New function.
3400         (Parameters::timer_): New data member.
3401         (set_parameters_timer): New function.
3402         * timer.cc (Timer::stamp): New function.
3403         (Timer::get_pass_time): New function.
3404         * timer.h (Timer::stamp): New function.
3405         (Timer::get_pass_time): New function.
3406         (Timer::pass_times_): New data member.
3407
3408 2011-10-17  Cary Coutant  <ccoutant@google.com>
3409
3410         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3411         task for members of lib groups.
3412
3413 2011-10-17  Cary Coutant  <ccoutant@google.com>
3414
3415         PR gold/13288
3416         * fileread.cc (File_read::find_view): Add assert.
3417         (File_read::make_view): Move bounds check (replace with assert)...
3418         (File_read::find_or_make_view): ... to here.
3419
3420 2011-10-12  Cary Coutant  <ccoutant@google.com>
3421
3422         * output.cc (Output_file::open_base_file): Handle case where
3423         ::read returns less than requested size.
3424
3425 2011-10-10  Cary Coutant  <ccoutant@google.com>
3426
3427         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3428         Initialize defined_count_.
3429         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3430         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3431         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3432         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3433         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3434         * incremental.h (Sized_relobj_incr::defined_count_): New data
3435         member.
3436         (Sized_incr_dynobj::defined_count_): New data member.
3437         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3438         Return zeroes instead of internal error.
3439
3440 2011-10-10  Cary Coutant  <ccoutant@google.com>
3441
3442         PR gold/13249
3443         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3444         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3445         * output.h (class Output_reloc): Add use_plt_offset flag.
3446         (Output_reloc::type_): Adjust size of bit field.
3447         (Output_reloc::use_plt_offset_): New bit field.
3448         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3449         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3450         flag.  Adjust all callers.
3451         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3452         creating RELATIVE relocations.
3453
3454 2011-10-10  Nick Clifton  <nickc@redhat.com>
3455
3456         * po/es.po: Updated Spanish translation.
3457         * po/fi.po: Updated Finnish translation.
3458
3459 2011-10-03   Diego Novillo  <dnovillo@google.com>
3460
3461         * options.cc (parse_uint): Fix dereference of RETVAL.
3462
3463 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3464
3465         * layout.h (section_order_map_): New member.
3466         (get_section_order_map): New member function.
3467         * output.cc (Output_section::add_input_section): Check for patterns
3468         only when --section-ordering-file is specified.
3469         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3470         output_sections have been formed.
3471         * layout.cc (Layout_Layout): Initialize section_order_map_.
3472         * plugin.cc (update_section_order): Store order in order_map. Do not
3473         update the order.
3474         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3475         * testsuite/Makefile.in: Regenerate.
3476         * testsuite/plugin_section_order.c: New file.
3477         * testsuite/plugin_final_layout.cc: New file.
3478         * testsuite/plugin_final_layout.sh: New file.
3479
3480 2011-09-29  Cary Coutant  <ccoutant@google.com>
3481
3482         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3483         Check for NULL.
3484         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3485         symbols during incremental update.
3486         (Symbol_table::add_from_dynobj): Likewise.
3487
3488 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3489             Ian Lance Taylor  <iant@google.com>
3490
3491         * symtab.cc (Symbol_table::define_special_symbol): Always
3492         canonicalize version string.
3493
3494 2011-09-26  Cary Coutant  <ccoutant@google.com>
3495
3496         * gold.cc (queue_initial_tasks): Move option checks ...
3497         * options.cc (General_options::finalize): ... to here. Disable
3498         some options; make others fatal.
3499
3500 2011-09-26  Cary Coutant  <ccoutant@google.com>
3501
3502         gcc PR lto/47247
3503         * plugin.cc (get_symbols_v2): New function.
3504         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3505         (is_referenced_from_outside): New function.
3506         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3507         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3508         (get_symbols): Pass version parameter.
3509         (get_symbols_v2): New function.
3510         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3511         parameter.
3512         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3513         (onload): Add LDPT_GET_SYMBOLS_V2.
3514         (all_symbols_read_hook): Use get_symbols_v2; check for
3515         LDPR_PREVAILING_DEF_IRONLY_EXP.
3516         * testsuite/plugin_test_3.sh: Update expected results.
3517
3518 2011-09-23  Simon Baldwin  <simonb@google.com>
3519
3520         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3521         configuration options.
3522         * configure: Regenerate.
3523         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3524         * Makefile.in: Regenerate.
3525         * testsuite/Makefile.in: Regenerate.
3526
3527 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3528
3529         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3530
3531 2011-09-19  Cary Coutant  <ccoutant@google.com>
3532
3533         * incremental.cc (can_incremental_update): Fix typo in comment.
3534         * incremental.h (can_incremental_update): Likewise.
3535
3536 2011-09-18  Cary Coutant  <ccoutant@google.com>
3537
3538         * incremental.cc (can_incremental_update): New function.
3539         * incremental.h (can_incremental_update): New function.
3540         * layout.cc (Layout::init_fixed_output_section): Call it.
3541         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3542         * object.cc (Sized_relobj_file::do_layout): Call
3543         can_incremental_update.
3544
3545 2011-09-13  Cary Coutant  <ccoutant@google.com>
3546
3547         * configure.ac: Check for glibc support for gnu_indirect_function
3548         support with static linking, setting automake conditional
3549         IFUNC_STATIC.
3550         * Makefile.in: Regenerate.
3551         * configure: Regenerate.
3552
3553         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3554         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3555         for IFUNC_STATIC.
3556         * testsuite/Makefile.in: Regenerate.
3557
3558 2011-09-13  Cary Coutant  <ccoutant@google.com>
3559
3560         * incremental.cc (Sized_relobj_incr::do_layout): Call
3561         report_comdat_group for kept comdat sections.
3562         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3563         * testsuite/Makefile.in: Regenerate.
3564         * testsuite/incr_comdat_test_1.cc: New source file.
3565         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3566         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3567         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3568
3569 2011-09-13  Ian Lance Taylor  <iant@google.com>
3570
3571         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3572         variable external_symbols_offset.
3573
3574 2011-09-12  Ian Lance Taylor  <iant@google.com>
3575
3576         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3577         triggered if object has no symbols.
3578
3579 2011-09-09  David S. Miller  <davem@davemloft.net>
3580
3581         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3582         (Output_fill_debug_line::do_write): Likewise.
3583
3584 2011-08-29  Cary Coutant  <ccoutant@google.com>
3585
3586         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3587         casts to match formatting specs.
3588         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3589
3590 2011-08-26  Cary Coutant  <ccoutant@google.com>
3591
3592         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3593         remaining hole size when allocating.
3594         (Layout::make_output_section): Set fill methods for debug sections.
3595         * layout.h (Free_list::Free_list_node): Move from private to
3596         public.
3597         (Free_list::set_min_hole_size): New function.
3598         (Free_list::begin, Free_list::end): New functions.
3599         (Free_list::min_hole_): New data member.
3600         * output.cc: Include dwarf.h.
3601         (Output_fill_debug_info::do_minimum_hole_size): New function.
3602         (Output_fill_debug_info::do_write): New function.
3603         (Output_fill_debug_line::do_minimum_hole_size): New function.
3604         (Output_fill_debug_line::do_write): New function.
3605         (Output_section::Output_section): Initialize new data member.
3606         (Output_section::set_final_data_size): Ensure patch space is larger
3607         than minimum hole size.
3608         (Output_section::do_write): Fill holes in debug sections.
3609         * output.h (Output_fill): New class.
3610         (Output_fill_debug_info): New class.
3611         (Output_fill_debug_line): New class.
3612         (Output_section::set_free_space_fill): New function.
3613         (Output_section::free_space_fill_): New data member.
3614         * testsuite/Makefile.am (incremental_test_3): Add
3615         --incremental-patch option.
3616         (incremental_test_4): Likewise.
3617         (incremental_test_5): Likewise.
3618         (incremental_test_6): Likewise.
3619         (incremental_copy_test): Likewise.
3620         (incremental_common_test_1): Likewise.
3621         * testsuite/Makefile.in: Regenerate.
3622
3623 2011-08-26  Nick Clifton  <nickc@redhat.com>
3624
3625         * po/es.po: Updated Spanish translation.
3626
3627 2011-08-01  Cary Coutant  <ccoutant@google.com>
3628
3629         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3630         * gold/testsuite/Makefile.in: Regenerate.
3631         * gold/testsuite/justsyms_exec.c: New source file.
3632         * gold/testsuite/justsyms_lib.c: New source file.
3633
3634 2011-08-01  Cary Coutant  <ccoutant@google.com>
3635
3636         * layout.cc (Layout::set_segment_offsets): Don't realign text
3637         segment if -Ttext was specified.
3638         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3639         file type.
3640         * object.h (Sized_relobj_file::e_type): New function.
3641         (Sized_relobj_file::e_type_): New data member.
3642         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3643         base address for ET_EXEC files.
3644         * target.cc (Target::do_make_elf_object_implementation): Allow
3645         ET_EXEC files with --just-symbols option.
3646
3647 2011-07-28  Cary Coutant  <ccoutant@google.com>
3648
3649         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3650         Add thread_number parameter.
3651         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3652         * workqueue-threads.cc
3653         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3654         current thread if its thread number is greater than desired thread
3655         count.
3656         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3657         Add thread_number parameter.
3658         (Workqueue::should_cancel_thread): Likewise.
3659         (Workqueue::find_runnable_or_wait): Pass thread_number to
3660         should_cancel_thread.
3661         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3662         parameter.
3663
3664 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3665
3666         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3667         only after checking if it cannot be forced local.
3668         * symtab.h (is_externally_visible): Check if the symbol is not forced
3669         local.
3670
3671 2011-07-15  Ian Lance Taylor  <iant@google.com>
3672
3673         * options.h (class General_options): Add --print-output-format.
3674         Move -EL next to -EB, for  better --help output.
3675         * target-select.cc: Include <cstdio>, "options.h", and
3676         "parameters.h".
3677         (Target_selector::do_target_bfd_name): New function.
3678         (print_output_format): New function.
3679         * target-select.h (class Target_selector): Update declarations.
3680         (Target_selector::target_bfd_name): New function.
3681         (print_output_format): Declare.
3682         * main.cc: Include "target-select.h".
3683         (main): Handle --print-output-format.
3684         * gold.cc: Include "target-select.h".
3685         (queue_initial_tasks): Handle --print-output-format when there are
3686         no input files.
3687         * parameters.cc (parameters_force_valid_target): Give a better
3688         error message if -EB/-EL does not match target.
3689         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3690         function.
3691
3692 2011-07-15  Ian Lance Taylor  <iant@google.com>
3693
3694         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3695         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3696         (Output_data_plt_i386::do_write): Write address of .dynamic
3697         section to first entry in .got.plt section.
3698         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3699         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3700         Initialize layout_.
3701         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3702         section to first entry in .got.plt section.
3703         * layout.h (Layout::dynamic_section): New function.
3704
3705 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3706
3707         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3708         to claim_file call.
3709         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3710         input_section_position_, and input_section_glob_.
3711         (read_layout_from_file): Call function section_ordering_specified.
3712         * layout.h (is_section_ordering_specified): New function.
3713         (section_ordering_specified): New function.
3714         (section_ordering_specified_): New boolean member.
3715         * main.cc(main): Call load_plugins after layout object is defined.
3716         * output.cc (Output_section::add_input_section): Use
3717         function section_ordering_specified to check if section ordering is
3718         needed.
3719         * output.cc (Output_section::add_relaxed_input_section): Use
3720         function section_ordering_specified to check if section ordering is
3721         needed.
3722         (Output_section::update_section_layout): New function.
3723         (Output_section::sort_attached_input_sections): Check if input section
3724         must be reordered.
3725         * output.h (Output_section::update_section_layout): New function.
3726         * plugin.cc (get_section_count): New function.
3727         (get_section_type): New function.
3728         (get_section_name): New function.
3729         (get_section_contents): New function.
3730         (update_section_order): New function.
3731         (allow_section_ordering): New function.
3732         (Plugin::load): Add the new interfaces to the transfer vector.
3733         (Plugin_manager::load_plugins): New parameter.
3734         (Plugin_manager::all_symbols_read): New parameter.
3735         (Plugin_manager::claim_file): New parameter. Save the elf object for
3736         unclaimed objects.
3737         (Plugin_manager::get_elf_object): New function.
3738         (Plugin_manager::get_view): Change to directly use the bool to check
3739         if get_view is called from claim_file_hook.
3740         * plugin.h (input_objects): New function
3741         (Plugin__manager::load_plugins): New parameter.
3742         (Plugin_manager::claim_file): New parameter.
3743         (Plugin_manager::get_elf_object): New function.
3744         (Plugin_manager::in_claim_file_handler): New function.
3745         (Plugin_manager::in_claim_file_handler_): New member.
3746         (layout): New function.
3747         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3748         handler with an extra parameter. Make the elf object before calling
3749         claim_file handler.
3750         * testsuite/plugin_test.c (get_section_count): New function pointer.
3751         (get_section_type): New function pointer.
3752         (get_section_name): New function pointer.
3753         (get_section_contents): New function pointer.
3754         (update_section_order): New function pointer.
3755         (allow_section_ordering): New function pointer.
3756         (onload): Check if the new interfaces exist.
3757
3758 2011-07-13  Ian Lance Taylor  <iant@google.com>
3759
3760         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3761         relro section.
3762         * x86_64.cc (Target_x86_64::got_section): Likewise.
3763         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3764         (relro_now_test_SOURCES): New variable.
3765         (relro_now_test_DEPENDENCIES): New variable.
3766         (relro_now_test_LDFLAGS): New variable.
3767         (relro_now_test_LDADD): New variable.
3768         (relro_now_test.so): New target.
3769         * testsuite/Makefile.in: Rebuild.
3770
3771 2011-07-12  Ian Lance Taylor  <iant@google.com>
3772
3773         PR gold/12980
3774         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3775         GLOB_DAT relocation rather than a RELATIVE relocation for a
3776         protected symbol when creating a shared library.
3777         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3778         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3779         * testsuite/protected_main_1.cc (main): Test that protected
3780         function has same address.
3781
3782 2011-07-11  Ian Lance Taylor  <iant@google.com>
3783
3784         PR gold/12979
3785         * options.h (class General_options): Add -Bgroup.
3786         * options.cc (General_options::finalize): If -Bgroup is set,
3787         default to --unresolved-symbols=report-all.
3788         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3789         * target-reloc.h (issue_undefined_symbol_error): Handle
3790         --unresolved-symbols=report-all.
3791
3792 2011-07-08  Ian Lance Taylor  <iant@google.com>
3793
3794         PR gold/11985
3795         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3796         if linker script discards key sections.
3797         (Layout::create_dynamic_symtab): Likewise.
3798         (Layout::assign_local_dynsym_offsets): Likewise.
3799         (Layout::sized_create_version_sections): Likewise.
3800         (Layout::create_interp): Likewise.
3801         (Layout::finish_dynamic_section): Likewise.
3802         (Layout::set_dynamic_symbol_size): Likewise.
3803
3804 2011-07-08  Ian Lance Taylor  <iant@google.com>
3805
3806         PR gold/12386
3807         * options.h (class General_options): Add --unresolved-symbols.
3808         * target-reloc.h (issue_undefined_symbol_error): Check
3809         --unresolved-symbols.  Add comments.
3810
3811 2011-07-08  Ian Lance Taylor  <iant@google.com>
3812
3813         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3814         expression more complex.
3815
3816 2011-07-08  Ian Lance Taylor  <iant@google.com>
3817
3818         PR gold/11317
3819         * target-reloc.h (issue_undefined_symbol_error): New inline
3820         function, broken out of relocate_section.
3821         (relocate_section): Call issue_undefined_symbol_error.
3822         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3823         there is no TLS segment if we are about to issue an undefined
3824         symbol error.
3825         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3826
3827 2011-07-08  Ian Lance Taylor  <iant@google.com>
3828
3829         PR gold/12279
3830         * resolve.cc (Symbol_table::should_override): Add fromtype
3831         parameter.  Change all callers.  Give error when linking together
3832         TLS and non-TLS symbol.
3833         (Symbol_table::should_override_with_special): Add fromtype
3834         parameter.  Change all callers.
3835         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3836         there is no TLS segment if we have reported some errors.
3837         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3838
3839 2011-07-08  Ian Lance Taylor  <iant@google.com>
3840
3841         PR gold/12372
3842         * target.h (Target::plt_address_for_global): New function.
3843         (Target::plt_address_for_local): New function.
3844         (Target::plt_section_for_global): Remove.
3845         (Target::plt_section_for_local): Remove.
3846         (Target::do_plt_address_for_global): New virtual function.
3847         (Target::do_plt_address_for_local): New virtual function.
3848         (Target::do_plt_section_for_global): Remove.
3849         (Target::do_plt_section_for_local): Remove.
3850         (Target::register_global_plt_entry): Add Symbol_table and Layout
3851         parameters.
3852         * output.cc (Output_data_got::Got_entry::write): Use
3853         plt_address_for_global and plt_address_for_local.
3854         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3855         address of output section.
3856         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3857         got_irelative_, and irelative_count_ fields.  Update
3858         declarations.
3859         (Output_data_plt_i386::has_irelative_section): New function.
3860         (Output_data_plt_i386::entry_count): Add irelative_count_.
3861         (Output_data_plt_i386::set_final_data_size): Likewise.
3862         (class Target_i386): Add got_irelative_ and rel_irelative_
3863         fields.  Update declarations.
3864         (Target_i386::Target_i386): Initialize new fields.
3865         (Target_i386::do_plt_address_for_global): New function replacing
3866         do_plt_section_for_global.
3867         (Target_i386::do_plt_address_for_local): New function replacing
3868         do_plt_section_for_local.
3869         (Target_i386::got_section): Create got_irelative_.
3870         (Target_i386::rel_irelative_section): New function.
3871         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3872         fields.  Don't define __rel_iplt_{start,end}.
3873         (Output_data_plt_i386::add_entry): Add symtab and layout
3874         parameters.  Change all callers.  Use different PLT and GOT for
3875         IFUNC symbols.
3876         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3877         layout parameters.  Change all callers.  Use different PLT and
3878         GOT.
3879         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3880         (Output_data_plt_i386::rel_irelative): New function.
3881         (Output_data_plt_i386::address_for_global): New function.
3882         (Output_data_plt_i386::address_for_local): New function.
3883         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3884         IRELATIVE GOT when changing IFUNC GOT entries.
3885         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3886         reloc.
3887         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3888         if we didn't create an IRELATIVE GOT.
3889         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3890         plt_address_for_local.
3891         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3892         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3893         got_irelative_, and irelative_count_ fields.  Update
3894         declarations.
3895         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3896         Initialize new fields.  Remove symtab parameter.  Change all
3897         callers.
3898         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3899         irelative_count_.
3900         (Output_data_plt_x86_64::has_irelative_section): New function.
3901         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3902         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3903         fields.  Update declarations.
3904         (Target_x86_64::Target_x86_64): Initialize new fields.
3905         (Target_x86_64::do_plt_address_for_global): New function replacing
3906         do_plt_section_for_global.
3907         (Target_x86_64::do_plt_address_for_local): New function replacing
3908         do_plt_section_for_local.
3909         (Target_x86_64::got_section): Create got_irelative_.
3910         (Target_x86_64::rela_irelative_section): New function.
3911         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3912         all callers.  Don't create __rel_iplt_{start,end}.
3913         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3914         parameters.  Change all callers.  Use different PLT and GOT for
3915         IFUNC symbols.
3916         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3917         layout parameters.  Change all callers.  Use different PLT and
3918         GOT.
3919         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3920         parameters.  Change all callers.  Use different PLT and GOT for
3921         IFUNC symbols.
3922         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3923         (Output_data_plt_x86_64::rela_irelative): New function.
3924         (Output_data_plt_x86_64::address_for_global): New function.
3925         (Output_data_plt_x86_64::address_for_local): New function.
3926         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3927         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3928         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3929         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3930         parameters.
3931         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3932         reloc.
3933         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3934         symbols if we didn't create an IRELATIVE GOT.
3935         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3936         plt_address_for_local.
3937         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3938         * testsuite/ifuncvar1.c: New test file.
3939         * testsuite/ifuncvar2.c: New test file.
3940         * testsuite/ifuncvar3.c: New test file.
3941         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3942         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3943         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3944         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3945         * testsuite/Makefile.in: Rebuild.
3946
3947 2011-07-07  Cary Coutant  <ccoutant@google.com>
3948
3949         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3950         (two_file_test_1_ndebug.o): Likewise.
3951         (two_file_test_1b_ndebug.o): Likewise.
3952         (two_file_test_2_ndebug.o): Likewise.
3953         (two_file_test_main_ndebug.o): Likewise.
3954         (incremental_test_2): Link with no-debug versions.
3955
3956 2011-07-06  Cary Coutant  <ccoutant@google.com>
3957
3958         * gold/incremental.cc
3959         (Output_section_incremental_inputs::write_info_blocks): Check for
3960         hidden and internal symbols.
3961
3962 2011-07-06  Cary Coutant  <ccoutant@google.com>
3963
3964         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3965         Check disposition for startup file.
3966         (Incremental_inputs::report_command_line): Ignore
3967         --incremental-startup-unchanged option.
3968         * options.cc (General_options::parse_incremental_startup_unchanged):
3969         New function.
3970         (General_options::General_options): Initialize new data member.
3971         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3972         (General_options): Add --incremental-startup-unchanged option.
3973         (General_options::incremental_startup_disposition): New function.
3974         (General_options::incremental_startup_disposition_): New data member.
3975
3976 2011-07-06  Cary Coutant  <ccoutant@google.com>
3977
3978         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3979         input file index to Script_info ctor.
3980         (Sized_incremental_binary::do_file_has_changed): Find the
3981         command-line argument for files named in scripts.
3982         * incremental.h (Script_info::Script_info): New ctor
3983         with input file index.
3984         (Script_info::input_file_index): New function.
3985         (Script_info::input_file_index_): New data member.
3986         (Incremental_binary::get_library): Add const.
3987         (Incremental_binary::get_script_info): Add const.
3988         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3989         * testsuite/Makefile.am (incremental_test_5): New test case.
3990         (incremental_test_6): New test case.
3991         * testsuite/Makefile.in: Regenerate.
3992
3993 2011-07-06  Cary Coutant  <ccoutant@google.com>
3994
3995         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3996         debug output when command lines differ.
3997
3998 2011-07-06  Cary Coutant  <ccoutant@google.com>
3999
4000         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4001         --incremental-patch option.
4002         * layout.cc (Free_list::allocate): Extend allocation beyond original
4003         end if enabled.
4004         (Layout::make_output_section): Mark sections that should get
4005         patch space.
4006         * options.cc (parse_percent): New function.
4007         * options.h (parse_percent): New function.
4008         (DEFINE_percent): New macro.
4009         (General_options): Add --incremental-patch option.
4010         * output.cc (Output_section::Output_section): Initialize new data
4011         members.
4012         (Output_section::add_input_section): Print section name when out
4013         of patch space.
4014         (Output_section::add_output_section_data): Likewise.
4015         (Output_section::set_final_data_size): Add patch space when
4016         doing --incremental-full.
4017         (Output_section::do_reset_address_and_file_offset): Remove patch
4018         space.
4019         (Output_segment::set_section_list_addresses): Print debug output
4020         only if --incremental-update.
4021         * output.h (Output_section::set_is_patch_space_allowed): New function.
4022         (Output_section::is_patch_space_allowed_): New data member.
4023         (Output_section::patch_space_): New data member.
4024         * parameters.cc (Parameters::incremental_full): New function.
4025         * parameters.h (Parameters::incremental_full): New function
4026         * testsuite/Makefile.am (incremental_test_2): Add test for
4027         --incremental-patch option.
4028         * testsuite/Makefile.in: Regenerate.
4029         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4030         (t18): Remove function body.
4031
4032 2011-07-05  Doug Kwan  <dougkwan@google.com>
4033
4034         PR gold/12771
4035         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4036         Arm_Address type for relocation result.
4037         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4038         overflow check.
4039         (Arm_relocate_functions::abs32): Use unaligned access.
4040         (Arm_relocate_functions::rel32): Ditto.
4041         (Arm_relocate_functions::prel31): Ditto.
4042         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4043         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4044         static data relocations.
4045         * testsuite/Makefile.in: Regnerate.
4046         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4047
4048 2011-07-05  Ian Lance Taylor  <iant@google.com>
4049
4050         PR gold/12392
4051         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4052         symbols if necessary.
4053         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4054
4055 2011-07-05  Ian Lance Taylor  <iant@google.com>
4056
4057         PR gold/12952
4058         * resolve.cc (Symbol::override_base_with_special): Simply override
4059         version with special symbol version, ignoring previous version.
4060
4061 2011-07-05  Ian Lance Taylor  <iant@google.com>
4062
4063         * object.cc (Sized_relobj_file::include_section_group): Add
4064         information to comment about signature location.
4065
4066 2011-07-02  Ian Lance Taylor  <iant@google.com>
4067
4068         PR gold/12957
4069         * options.h (class General_options): Add -f and -F.
4070         * options.cc (General_options::finalize): Fatal error if -f/-F
4071         are used without -shared.
4072         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4073
4074 2011-07-02  Ian Lance Taylor  <iant@google.com>
4075
4076         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4077
4078 2011-07-01  Ian Lance Taylor  <iant@google.com>
4079
4080         PR gold/12525
4081         PR gold/12952
4082         * resolve.cc (Symbol::override_base_with_special): Don't override
4083         the version if the overriding symbol has a different name.
4084         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4085         all callers.  If we give an error about an undefined version,
4086         define the base version if necessary.
4087         * dynobj.h (class Versions): Update declaration.
4088         * testsuite/weak_alias_test_5.cc: New file.
4089         * testsuite/weak_alias_test.script: New file.
4090         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4091         and versioned_alias have the right value, and call t2.
4092         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4093         weak_alias_test_5.so.
4094         (weak_alias_test_LDADD): Likewise.
4095         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4096         * testsuite/Makefile.in: Rebuild.
4097
4098 2011-07-01  Ian Lance Taylor  <iant@google.com>
4099
4100         PR gold/12525
4101         * options.h (class General_options): Support -z notext.
4102         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4103         -Wl,-z,notext.
4104         (two_file_shared_nonpic.so): Likewise.
4105         (two_file_shared_mixed.so): Likewise.
4106         (two_file_shared_mixed_1.so): Likewise.
4107         (weak_undef_lib_nonpic.so): Likewise.
4108         (alt/weak_undef_lib_nonpic.so): Likewise.
4109         (tls_test_shared_nonpic.so): Likewise.
4110         * testsuite/Makefile.in: Rebuild.
4111
4112 2011-07-01  Ian Lance Taylor  <iant@google.com>
4113
4114         PR gold/12525
4115         * configure.ac: Test whether static linking works, setting
4116         the automake conditional HAVE_STATIC.
4117         * testsuite/Makefile.am: Disable tests using -static if
4118         HAVE_STATIC is not true.
4119         * configure, testsuite/Makefile.in: Rebuild.
4120
4121 2011-07-01  Ian Lance Taylor  <iant@google.com>
4122
4123         PR gold/12525
4124         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4125         Assert if we see DW_EH_PE_indirect.
4126         * target.h (Target::ehframe_datarel_base): New function.
4127         (Target::do_ehframe_datarel_base): New target function.
4128         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4129         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4130         function.
4131
4132 2011-07-01  Ian Lance Taylor  <iant@google.com>
4133
4134         PR gold/12571
4135         * options.h (class General_options): Add
4136         --ld-generated-unwind-info.
4137         * ehframe.cc (Fde::write): Add address parameter.  Change all
4138         callers.  If associated with PLT, fill in address and size.
4139         (Cie::set_output_offset): Only add merge mapping if there is an
4140         object.
4141         (Cie::write): Add address parameter.  Change all callers.
4142         (Eh_frame::add_ehframe_for_plt): New function.
4143         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4144         input_offset_ fields into union u_, with new plt field.
4145         (Fde::Fde): Adjust for new union field.
4146         (Fde::Fde) [Output_data version]: New constructor.
4147         (Fde::add_mapping): Only add merge mapping if there is an object.
4148         (class Cie): Update declarations.
4149         (class Eh_frame): Declare add_ehframe_for_plt.
4150         * layout.cc (Layout::layout_eh_frame): Break out code into
4151         make_eh_frame_section, and call it.
4152         (Layout::make_eh_frame_section): New function.
4153         (Layout::add_eh_frame_for_plt): New function.
4154         * layout.h (class Layout): Update declarations.
4155         * merge.cc (Merge_map::add_mapping): Add assertion.
4156         * i386.cc: Include "dwarf.h".
4157         (class Output_data_plt_i386): Make first_plt_entry,
4158         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4159         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4160         and plt_eh_frame_fde.
4161         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4162         boundary.  Call add_eh_frame_for_plt if appropriate.
4163         * x86_64.cc: Include "dwarf.h".
4164         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4165         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4166         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4167         and plt_eh_frame_fde.
4168         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4169         appropriate.
4170
4171 2011-06-29  Ian Lance Taylor  <iant@google.com>
4172
4173         PR gold/12629
4174         * object.cc (Sized_relobj_file::layout_section): Change shdr
4175         parameter to be const.
4176         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4177         out of do_layout.
4178         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4179         appropriate.  Call layout_eh_frame_section.
4180         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4181         sections.
4182         * object.h (class Sized_relobj_file): Update declarations.
4183
4184 2011-06-29  Ian Lance Taylor  <iant@google.com>
4185
4186         PR gold/12652
4187         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4188         modifier.
4189         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4190
4191 2011-06-29  Ian Lance Taylor  <iant@google.com>
4192
4193         PR gold/12675
4194         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4195         SHT_X86_64_UNWIND.
4196         * layout.cc (Layout::layout_eh_frame): Likewise.
4197
4198 2011-06-29  Ian Lance Taylor  <iant@google.com>
4199
4200         PR gold/12695
4201         * layout.cc (Layout::symtab_section_shndx): New function.
4202         * layout.h (class Layout): Declare symtab_section_shndx.
4203         * output.cc (Output_section::write_header): Call it.
4204
4205 2011-06-29  Ian Lance Taylor  <iant@google.com>
4206
4207         PR gold/12818
4208         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4209         symbols which are not used in a relocation.
4210
4211 2011-06-28  Ian Lance Taylor  <iant@google.com>
4212
4213         PR gold/12898
4214         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4215         script create indistinguishable segments.
4216         (Layout::set_segment_offsets): Use stable_sort when sorting
4217         segments.  Pass this to Compare_segments constructor.
4218         * layout.h (class Layout): Make segment_precedes non-static.
4219         (class Compare_segments): Change from struct to class.  Add
4220         layout_ field.  Add constructor.
4221         * script-sections.cc
4222         (Script_sections::attach_sections_using_phdrs_clause): Rename
4223         local orphan to is_orphan.  Don't report failure to put empty
4224         section in segment.  On attachment failure, report name of
4225         section, and attach to first PT_LOAD segment.
4226
4227 2011-06-28  Ian Lance Taylor  <iant@google.com>
4228
4229         PR gold/12934
4230         * target-select.cc (Target_selector::Target_selector): Add
4231         emulation parameter.  Change all callers.
4232         (select_target_by_bfd_name): Rename from select_target_by_name.
4233         Change all callers.
4234         (select_target_by_emulation): New function.
4235         (supported_emulation_names): New function.
4236         * target-select.h (class Target_selector): Add emulation_ field.
4237         Update declarations.
4238         (Target_selector::recognize_by_bfd_name): Rename from
4239         recognize_by_name.  Change all callers.
4240         (Target_selector::supported_bfd_names): Rename from
4241         supported_names.  Change all callers.
4242         (Target_selector::recognize_by_emulation): New function.
4243         (Target_selector::supported_emulations): New function.
4244         (Target_selector::emulation): New function.
4245         (Target_selector::do_recognize_by_bfd_name): Rename from
4246         do_recognize_by_name.  Change all callers.
4247         (Target_selector::do_supported_bfd_names): Rename from
4248         do_supported_names.  Change all callers.
4249         (Target_selector::do_recognize_by_emulation): New function.
4250         (Target_selector::do_supported_emulations): New function.
4251         (select_target_by_bfd_name): Change name in declaration.
4252         (select_target_by_emulation): Declare.
4253         (supported_emulation_names): Declare.
4254         * parameters.cc (parameters_force_valid_target): Try to find
4255         target based on emulation from -m option.
4256         * options.h (class General_options): Change doc string for -m.
4257         * options.cc (help): Print emulations.
4258         (General_options::parse_V): Likewise.
4259         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4260         Add emulation parameter.  Change all callers.
4261
4262 2011-06-28  Ian Lance Taylor  <iant@google.com>
4263
4264         * target.h (class Target): Add osabi_ field.
4265         (Target::osabi): New function.
4266         (Target::set_osabi): New function.
4267         (Target::Target): Initialize osabi_.
4268         (Target::do_adjust_elf_header): Make pure virtual.
4269         (Sized_target::do_adjust_elf_header): Declare.
4270         * target.cc (Sized_target::do_adjust_elf_header): New function.
4271         (class Sized_target): Instantiate all versions.
4272         * freebsd.h (class Target_freebsd): Remove.
4273         (Target_selector_freebsd::do_recognize): Call set_osabi on
4274         Target.
4275         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4276         (Target_selector_freebsd::set_osabi): Remove.
4277         * i386.cc (class Target_i386): Inherit from Sized_target rather
4278         than Target_freebsd.
4279         * x86_64.cc (class Target_x86_64): Likewise.
4280
4281 2011-06-28  Ian Lance Taylor  <iant@google.com>
4282
4283         * target.h (Target::can_check_for_function_pointers): Rewrite.
4284         Make non-virtual.
4285         (Target::can_icf_inline_merge_sections): Likewise.
4286         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4287         (Target::Target_info): Add can_icf_inline_merge_sections field.
4288         (Target::do_can_check_for_function_pointers): New virtual
4289         function.
4290         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4291         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4292         from can_check_for_function_pointers, move in file.
4293         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4294         section_may_have_icf_unsafe_poineters, move in file.
4295         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4296         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4297         Rename from can_check_for_function_pointers, move in file.
4298         (Target_i386::can_icf_inline_merge_sections): Remove.
4299         (Target_i386::i386_info): Initialize
4300         can_icf_inline_merge_sections.
4301         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4302         Initialize can_icf_inline_merge_sections.
4303         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4304         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4305         Rename from can_check_for_function_pointers, move in file.
4306         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4307         (Target_x86_64::x86_64_info): Initialize
4308         can_icf_inline_merge_sections.
4309         * testsuite/testfile.cc (Target_test::test_target_info):
4310         Likewise.
4311         * icf.cc (get_section_contents): Correct formatting.
4312
4313 2011-06-27  Ian Lance Taylor  <iant@google.com>
4314
4315         * symtab.cc (Symbol::versioned_name): New function.
4316         (Symbol_table::add_to_final_symtab): Use versioned_name when
4317         appropriate.
4318         (Symbol_table::sized_write_symbol): Likewise.
4319         * symtab.h (class Symbol): Declare versioned_name.
4320         * stringpool.h (class Stringpool_template): Add variant of add
4321         which takes a std::basic_string.
4322         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4323         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4324         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4325         (ver_test_12.o): New target.
4326         * testsuite/Makefile.in: Rebuild.
4327
4328 2011-06-27  Doug Kwan  <dougkwan@google.com>
4329
4330         * arm.cc (Arm_relocate_functions::thm_jump8,
4331         Arm_relocate_functions::thm_jump11): Use a wider signed
4332         type to compute offset.
4333         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4334         arm_thm_jump8.
4335         * testsuite/Makefile.in: Regenerate.
4336         * testsuite/arm_branch_in_range.sh: Check test results of
4337         arm_thm_jump11 and arm_thm_jump8.
4338         * testsuite/arm_thm_jump11.s: New test source file.
4339         * testsuite/arm_thm_jump11.t: New linker script.
4340         * testsuite/arm_thm_jump8.s: New test source file.
4341         * testsuite/arm_thm_jump8.t: New linker script.
4342
4343 2011-06-24  Ian Lance Taylor  <iant@google.com>
4344
4345         * layout.cc: Include "object.h".
4346         (ctors_sections_in_init_array): New static variable.
4347         (Layout::is_ctors_in_init_array): New function.
4348         (Layout::layout): Add entry to ctors_sections_in_init_array if
4349         appropriate.
4350         * layout.h (class Layout): Declare is_ctors_in_init_array.
4351         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4352         is_ctors_reverse_view is set.
4353         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4354         all callers.  Set is_ctors_reverse_view field of View_size.
4355         (Sized_relobj_file::reverse_words): New function.
4356         * object.h (Sized_relobj_file::View_size): Add
4357         is_ctors_reverse_view field.
4358         (class Sized_relobj_file): Update declarations.
4359         * testsuite/initpri3.c: New test.
4360         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4361         initpri3b.
4362         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4363         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4364         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4365         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4366         * testsuite/Makefile.in: Rebuild.
4367
4368 2011-06-24  Cary Coutant  <ccoutant@google.com>
4369
4370         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4371         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4372         (debug_msg_cdebug.err): New targets.
4373         * testsuite/Makefile.in: Regenerate.
4374         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4375         Fix checks for link with shared library.
4376
4377 2011-06-24  Doug Kwan  <dougkwan@google.com>
4378
4379         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4380         skip empty text sections.
4381         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4382
4383 2011-06-22  Ian Lance Taylor  <iant@google.com>
4384
4385         PR gold/12910
4386         * options.h (class General_options): Add --ctors-in-init-array.
4387         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4388         friends as SHT_PROGBITS for merging sections.
4389         (Layout::layout): Remove special handling of .init_array and
4390         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4391         and .dtors if ctors_in_init_array.
4392         (Layout::make_output_section): Force correct section types for
4393         .init_array and friends.  Don't sort if doing relocatable link,
4394         Don't sort .ctors and .dtors if ctors_in_init_array.
4395         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4396         (Layout::output_section_name): Add relobj parameter.  Change all
4397         callers.  Handle .ctors. and .dtors. in code rather than table.
4398         Handle .ctors and .dtors if ctors_in_init_array.
4399         (Layout::match_file_name): New function, moved from output.cc.
4400         * layout.h (class Layout): Update declarations.
4401         * output.cc: Include "layout.h".
4402         (Input_section_sort_entry::get_priority): New function.
4403         (Input_section_sort_entry::match_file_name): Just call
4404         Layout::match_file_name.
4405         (Output_section::Input_section_sort_init_fini_compare::operator()):
4406         Handle .ctors and .dtors.  Sort by explicit priority rather than
4407         by name.
4408         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4409         * testsuite/initpri2.c: New test.
4410         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4411         (check_PROGRAMS): Add initpri2.
4412         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4413         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4414         * configure, testsuite/Makefile.in: Rebuild.
4415
4416 2011-06-19  Ian Lance Taylor  <iant@google.com>
4417
4418         PR gold/12880
4419         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4420         .interp section to a PT_INTERP segment even if we have seen a
4421         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4422         clause in a linker script.
4423         (Layout::finalize): Don't create a .interp section if we've
4424         already create a PT_INTERP segment.
4425         (Layout::create_interp): Always call choose_output_section (revert
4426         patch of 2011-06-17).  Don't create PT_INTERP segment.
4427         * script-sections.cc
4428         (Script_sections::create_note_and_tls_segments): Add a .interp
4429         section to a PT_INTERP segment even if we have seen a
4430         --dynamic-linker option.
4431
4432 2011-06-18  Ian Lance Taylor  <iant@google.com>
4433
4434         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4435         merely because a non-PT_LOAD segment has a dynamic reloc.
4436
4437 2011-06-18  Ian Lance Taylor  <iant@google.com>
4438
4439         * layout.cc (Layout::finish_dynamic_section): Don't create
4440         DT_FLAGS entry if not needed.
4441
4442 2011-06-18  Ian Lance Taylor  <iant@google.com>
4443
4444         PR gold/12745
4445         * layout.cc (Layout::layout_eh_frame): Correct handling of
4446         writable .eh_frame section.
4447
4448 2011-06-17  Ian Lance Taylor  <iant@google.com>
4449
4450         PR gold/12893
4451         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4452         symbol is redefined with the exact same object and value.
4453
4454 2011-06-17  Ian Lance Taylor  <iant@google.com>
4455
4456         PR gold/12880
4457         * layout.h (class Layout): Add interp_segment_ field.
4458         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4459         (Layout::attach_allocated_section_to_segment): If making shared
4460         library, put .interp section in PT_INTERP segment.
4461         (Layout::finalize): Also call create_interp if -dynamic-linker
4462         option was used.
4463         (Layout::create_interp): Assert that there is no PT_INTERP
4464         segment.  If not using a SECTIONS clause, use make_output_section.
4465         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4466         * script-sections.cc
4467         (Script_sections::create_note_and_tls_segments): If making shared
4468         library, put .interp section in PT_INTERP segment.
4469
4470 2011-06-17  Ian Lance Taylor  <iant@google.com>
4471
4472         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4473         when making a shared library.
4474
4475 2011-06-17  Ian Lance Taylor  <iant@google.com>
4476
4477         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4478         parameter.  Change all callers.  Don't issue warning about PC32
4479         against locally defined symbol.
4480
4481 2011-06-16  Ian Lance Taylor  <iant@google.com>
4482
4483         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4484         occurs in same object.
4485
4486 2011-06-14  Alan Modra  <amodra@gmail.com>
4487
4488         * po/POTFILES.in: Regenerate.
4489
4490 2011-06-09  Ian Lance Taylor  <iant@google.com>
4491
4492         * script-sections.cc
4493         (Orphan_output_section::set_section_addresses): For a relocatable
4494         link set address to 0.
4495
4496 2011-06-09  Cary Coutant  <ccoutant@google.com>
4497
4498         PR gold/12804
4499         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4500         used with --compress-debug-sections.
4501         * gold/object.cc (Sized_relobj_file::do_layout): Report
4502         uncompressed size of compressed input sections.
4503
4504 2011-06-08  Cary Coutant  <ccoutant@google.com>
4505
4506         PR gold/12804
4507         * testsuite/two_file_test_2_v1.cc: Change initialization of
4508         v2 to keep it in .data.
4509
4510 2011-06-07  Cary Coutant  <ccoutant@google.com>
4511
4512         * common.cc (Symbol_table::do_allocate_commons_list): Call
4513         gold_fallback.
4514         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4515         (Errors::fallback): New function.
4516         (gold_fallback): New function.
4517         * errors.h (Errors::fallback): New function.
4518         * gold.cc (gold_exit): Change status parameter to enum; adjust
4519         all callers.
4520         (queue_initial_tasks): Call gold_fallback.
4521         * gold.h: Include cstdlib.
4522         (Exit_status): New enum type.
4523         (gold_exit): Change status parameter to enum.
4524         (gold_fallback): New function.
4525         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4526         (Layout::create_symtab_sections): Likewise.
4527         (Layout::create_shdrs): Likewise.
4528         * main.cc (main): Adjust call to gold_exit.
4529         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4530         (Output_data_got::add_got_entry_pair): Likewise.
4531         (Output_section::add_input_section): Likewise.
4532         (Output_section::add_output_section_data): Likewise.
4533         (Output_segment::set_section_list_addresses): Likewise.
4534         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4535
4536 2011-06-07  Cary Coutant  <ccoutant@google.com>
4537
4538         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4539         for incremental links.
4540         * output.cc (Output_segment::set_section_list_addresses): Remove
4541         FIXME and test for TLS or BSS.
4542
4543 2011-06-07  Cary Coutant  <ccoutant@google.com>
4544
4545         * testsuite/Makefile.am: Add incremental_copy_test,
4546         incremental_common_test_1.
4547         * testsuite/Makefile.in: Regenerate.
4548         * testsuite/common_test_1_v1.c: New source file.
4549         * testsuite/common_test_1_v2.c: New source file.
4550         * testsuite/copy_test_v1.cc: New source file.
4551
4552 2011-06-07  Cary Coutant  <ccoutant@google.com>
4553
4554         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4555         update, allocate common from bss section's free list.
4556         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4557         linker-defined symbols.
4558         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4559         Skip GOT and PLT entries that are no longer referenced.
4560         (Output_section_incremental_inputs::write_info_blocks): Mark
4561         linker-defined symbols.
4562         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4563         * output.cc (Output_section::allocate): New function.
4564         * output.h (Output_section::allocate): New function.
4565         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4566         linker-defined symbols.
4567         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4568         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4569         (Symbol::init_base_output_data): Likewise.
4570         (Symbol::init_base_output_segment): Likewise.
4571         (Symbol::init_base_constant): Likewise.
4572         (Sized_symbol::init_output_data): Likewise.
4573         (Sized_symbol::init_output_segment): Likewise.
4574         (Sized_symbol::init_constant): Likewise.
4575         (Symbol_table::do_define_in_output_data): Likewise.
4576         (Symbol_table::do_define_in_output_segment): Likewise.
4577         (Symbol_table::do_define_as_constant): Likewise.
4578         * symtab.h (Symbol::is_predefined): New function.
4579         (Symbol::init_base_output_data): Add is_predefined parameter.
4580         (Symbol::init_base_output_segment): Likewise.
4581         (Symbol::init_base_constant): Likewise.
4582         (Symbol::is_predefined_): New data member.
4583         (Sized_symbol::init_output_data): Add is_predefined parameter.
4584         (Sized_symbol::init_output_segment): Likewise.
4585         (Sized_symbol::init_constant): Likewise.
4586         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4587
4588 2011-06-07  Cary Coutant  <ccoutant@google.com>
4589
4590         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4591         instead of emit_copy_reloc.
4592         (Copy_relocs::emit_copy_reloc): Refactor.
4593         (Copy_relocs::make_copy_reloc): New function.
4594         (Copy_relocs::add_copy_reloc): Remove.
4595         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4596         section.
4597         (Copy_relocs::make_copy_reloc): New function.
4598         (Copy_relocs::add_copy_reloc): Remove.
4599         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4600         unchanged input files.
4601         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4602         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4603         Reserve BSS space for COPY relocations.
4604         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4605         (Output_section_incremental_inputs::write_info_blocks): Record
4606         whether a symbol is copied from a shared object.
4607         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4608         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4609         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4610         (Incremental_input_entry_reader::get_output_symbol_index): Add
4611         is_copy parameter.
4612         (Incremental_binary::emit_copy_relocs): New function.
4613         (Incremental_binary::do_emit_copy_relocs): New function.
4614         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4615         new data member.
4616         (Sized_incremental_binary::add_copy_reloc): New function.
4617         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4618         (Sized_incremental_binary::Copy_reloc): New struct.
4619         (Sized_incremental_binary::Copy_relocs): New typedef.
4620         (Sized_incremental_binary::copy_relocs_): New data member.
4621         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4622         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4623         * target.h (Sized_target::emit_copy_reloc): New function.
4624         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4625
4626 2011-06-02  Cary Coutant  <ccoutant@google.com>
4627
4628         PR gold/12163
4629         * gold/archive.cc (Archive::Archive): Initialize new data member.
4630         (Archive::include_all_members): Return if archive has already been
4631         included.
4632         * gold/archive.h (Archive::include_all_members_): New data member.
4633
4634 2011-06-02  Nick Clifton  <nickc@redhat.com>
4635
4636         * dynobj.h: Fix spelling mistake in comment.
4637         * output.cc: Likewise.
4638
4639 2011-05-31  Doug Kwan  <dougkwan@google.com>
4640             Asier Llano
4641
4642         PR gold/12826
4643         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4644         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4645         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4646         redundant arm_exidx_test.so.
4647         * testsuite/Makefile.in: Regenerate.
4648         (check_SCRIPTS): Add pr12826.sh
4649         (check_DATA): Add pr12826.stdout
4650         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4651         * testsuite/pr12826.sh: New file.
4652         * testsuite/pr12826_1.s: Ditto.
4653         * testsuite/pr12826_1.s: Ditto.
4654
4655 2011-05-30  Ian Lance Taylor  <iant@google.com>
4656
4657         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4658         sections.
4659
4660 2011-05-29  Ian Lance Taylor  <iant@google.com>
4661
4662         PR gold/12804
4663         * testsuite/Makefile.am: Use different file name for two_file_test
4664         temporary file for each incremental test.
4665         * testsuite/Makefile.in: Rebuild.
4666
4667 2011-05-29  Ian Lance Taylor  <iant@google.com>
4668
4669         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4670         binary input file is empty.
4671
4672 2011-05-27  Ian Lance Taylor  <iant@google.com>
4673
4674         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4675         (ver_test_9.so): Likewise.
4676         * testsuite/Makefile.in: Rebuild.
4677
4678 2011-05-26 Cary Coutant  <ccoutant@google.com>
4679
4680         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4681         * incremental.cc (Incremental_inputs::report_input_section): Fix
4682         comment, indentation.
4683         (Incremental_inputs::report_comdat_group): New function.
4684         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4685         of data for incremental input file entry.
4686         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4687         group count, COMDAT group signatures.
4688         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4689         an unchanged input file.
4690         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4691         Initialize new data member.
4692         (Incremental_object_entry::add_comdat_group): New function.
4693         (Incremental_object_entry::get_comdat_group_count): New function.
4694         (Incremental_object_entry::get_comdat_signature_key): New function.
4695         (Incremental_object_entry::groups_): New data member.
4696         (Incremental_inputs::report_comdat_group): New function.
4697         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4698         data for incremental input file entry.
4699         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4700         (Incremental_input_entry_reader::get_input_section): Adjust size of
4701         data for incremental input file entry.
4702         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4703         (Incremental_input_entry_reader::get_comdat_group_signature): New
4704         function.
4705         * object.cc (Sized_relobj::include_section_group): Report kept
4706         COMDAT groups for incremental links.
4707
4708 2011-05-24  David Meyer  <pdox@google.com>
4709
4710         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4711         with name parameter.  Add found_name parameter.
4712         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4713         * dirsearch.h (class Dirsearch): Update declaration.
4714
4715 2011-05-24  Ian Lance Taylor  <iant@google.com>
4716
4717         * archive.cc (Library_base::should_include_member): Pull in object
4718         from archive if it defines the entry symbol.
4719         * parameters.cc (Parameters::entry): New function.
4720         * parameters.h (class Parameters): Declare entry.
4721         * output.h (class Output_file_header): Remove entry_ field.
4722         * output.cc (Output_file_header::Output_file_header): Remove entry
4723         parameter.  Change all callers.
4724         (Output_file_header::entry): Use parameters->entry.
4725         * gold.cc (queue_middle_tasks): Likewise.
4726         * plugin.cc (Plugin_hook::run): Likewise.
4727
4728 2011-05-24 Cary Coutant  <ccoutant@google.com>
4729
4730         * gold.cc (queue_initial_tasks): Pass incremental base filename
4731         to Output_file::open_base_file; don't print error message.
4732         * incremental-dump.cc (main): Adjust call to
4733         Output_file::open_for_modification.
4734         * incremental-dump.cc (main): Likewise.
4735         * incremental.cc (Incremental_inputs::report_command_line):
4736         Ignore --incremental-base option when comparing command lines.
4737         Ignore parameter when given as separate argument.
4738         * options.h (class General_options): Add --incremental-base.
4739         * output.cc (Output_file::Output_file):
4740         (Output_file::open_base_file): Add base_name and writable parameters;
4741         read base file into new file; print error message here.
4742         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4743         callers.
4744         * output.h (Output_file::open_for_modification): Rename to...
4745         (Output_file::open_base_file): ...this; add base_name and
4746         writable parameters; adjust all callers.
4747         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4748         callers.
4749         * testsuite/Makefile.am (incremental_test_4): Test
4750         --incremental-base.
4751         * testsuite/Makefile.in: Regenerate.
4752
4753 2011-05-24 Cary Coutant  <ccoutant@google.com>
4754
4755         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4756         incremental_test_4.
4757         * testsuite/Makefile.in: Regenerate.
4758         * testsuite/two_file_test_1_v1.cc: New test source file.
4759         * testsuite/two_file_test_1b_v1.cc: New test source file.
4760         * testsuite/two_file_test_2_v1.cc: New test source file.
4761
4762 2011-05-24 Cary Coutant  <ccoutant@google.com>
4763
4764         * dynobj.h (Dynobj::do_dynobj): New function.
4765         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4766         flag and soname for shared objects.
4767         * incremental.cc (Incremental_inputs::report_object): Make
4768         either Incremental_object_entry or Incremental_dynobj_entry; add
4769         soname to string table.
4770         (Incremental_inputs::report_input_section): Add assertion.
4771         (Output_section_incremental_inputs::set_final_data_size): Adjust
4772         type of input file entry for shared libraries; adjust size of
4773         shared library info entry.
4774         (Output_section_incremental_inputs::write_input_files): Write
4775         as_needed flag for shared libraries.
4776         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4777         of input file entry for shared libraries; write soname.
4778         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4779         soname from incremental info.
4780         * incremental.h (enum Incremental_input_flags): Add
4781         INCREMENTAL_INPUT_AS_NEEDED.
4782         (Incremental_input_entry::Incremental_input_entry): Initialize new
4783         data member.
4784         (Incremental_input_entry::set_as_needed): New function.
4785         (Incremental_input_entry::as_needed): New function.
4786         (Incremental_input_entry::do_dynobj_entry): New function.
4787         (Incremental_input_entry::as_needed_): New data member.
4788         (Incremental_object_entry::Incremental_object_entry): Don't check
4789         for shared library.
4790         (Incremental_object_entry::do_type): Likewise.
4791         (class Incremental_dynobj_entry): New class.
4792         (Incremental_input_entry_reader::as_needed): New function.
4793         (Incremental_input_entry_reader::get_soname): New function.
4794         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4795         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4796         size of shared library info entry.
4797         * layout.cc (Layout::finish_dynamic_section): Don't test for
4798         incremental link when adding DT_NEEDED entries.
4799         * object.h (Object::Object): Initialize new data member.
4800         (Object::dynobj): New function.
4801         (Object::set_as_needed): New function.
4802         (Object::as_needed): New function.
4803         (Object::do_dynobj): New function.
4804         (Object::as_needed_): New data member.
4805
4806 2011-05-24 Cary Coutant  <ccoutant@google.com>
4807
4808         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4809         info; adjust display of GOT entries.
4810         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4811         vector of input objects; remove file_status_.
4812         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4813         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4814         got_plt reader; call target hooks to reserve GOT entries.
4815         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4816         of input file info header and GOT info entry.
4817         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4818         relocation info.
4819         (Got_plt_view_info::got_descriptor): Remove.
4820         (Got_plt_view_info::sym_index): New data member.
4821         (Got_plt_view_info::input_index): New data member.
4822         (Local_got_offset_visitor::visit): Write input file index.
4823         (Global_got_offset_visitor::visit): Write 0 for input file index.
4824         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4825         with sym_index and input_index.
4826         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4827         incremental info GOT entry; replace got_descriptor with input_index.
4828         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4829         map from input file index to object.
4830         (Sized_relobj_incr::do_layout): Replace direct data member reference
4831         with accessor function.
4832         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4833         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4834         Adjust size of input file info header.
4835         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4836         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4837         (Incremental_input_entry_reader::get_input_section): Adjust size of
4838         input file info header.
4839         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4840         of incremental info GOT entry.
4841         (Incremental_got_plt_reader::get_got_desc): Remove.
4842         (Incremental_got_plt_reader::get_got_symndx): New function.
4843         (Incremental_got_plt_reader::get_got_input_index): New function.
4844         (Sized_incremental_binary::Sized_incremental_binary): Remove
4845         file_status_; add input_objects_.
4846         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4847         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4848         (Sized_incremental_binary::file_is_unchanged): Remove.
4849         (Sized_incremental_binary::set_input_object): New function.
4850         (Sized_incremental_binary::input_object): New function.
4851         (Sized_incremental_binary::file_status_): Remove.
4852         (Sized_incremental_binary::input_objects_): New data member.
4853         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4854         references.
4855         (Sized_relobj_incr::invalid_address): Move to base class.
4856         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4857         class.
4858         (Sized_relobj_incr::do_output_section_offset): Likewise.
4859         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4860         (Sized_relobj_incr::section_offsets_): Likewise.
4861         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4862         function.
4863         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4864         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4865         with accessor function.
4866         (Sized_relobj_file::do_layout): Likewise.
4867         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4868         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4869         (Sized_relobj_file::compute_final_local_value): Replace refs to
4870         section_offsets_ with accessor function.
4871         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4872         * object.h (Relobj::Relobj): Initialize new data members.
4873         (Relobj::add_dyn_reloc): New function.
4874         (Relobj::first_dyn_reloc): New function.
4875         (Relobj::dyn_reloc_count): New function.
4876         (Relobj::first_dyn_reloc_): New data member.
4877         (Relobj::dyn_reloc_count_): New data member.
4878         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4879         references.
4880         (Sized_relobj::Address): New typedef.
4881         (Sized_relobj::invalid_address): Move here from child class.
4882         (Sized_relobj::Sized_relobj): Initialize new data members.
4883         (Sized_relobj::sized_relobj): New function.
4884         (Sized_relobj::is_output_section_offset_invalid): Move here from
4885         child class.
4886         (Sized_relobj::get_output_section_offset): Likewise.
4887         (Sized_relobj::local_has_got_offset): Likewise.
4888         (Sized_relobj::local_got_offset): Likewise.
4889         (Sized_relobj::set_local_got_offset): Likewise.
4890         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4891         (Sized_relobj::clear_got_offsets): New function.
4892         (Sized_relobj::section_offsets): Move here from child class.
4893         (Sized_relobj::do_output_section_offset): Likewise.
4894         (Sized_relobj::do_set_section_offset): Likewise.
4895         (Sized_relobj::Local_got_offsets): Likewise.
4896         (Sized_relobj::local_got_offsets_): Likewise.
4897         (Sized_relobj::section_offsets_): Likewise.
4898         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4899         references.
4900         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4901         class.
4902         (Sized_relobj_file::sized_relobj): New function
4903         (Sized_relobj_file::local_has_got_offset): Move to base class.
4904         (Sized_relobj_file::local_got_offset): Likewise.
4905         (Sized_relobj_file::set_local_got_offset): Likewise.
4906         (Sized_relobj_file::get_output_section_offset): Likewise.
4907         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4908         (Sized_relobj_file::do_output_section_offset): Likewise.
4909         (Sized_relobj_file::do_set_section_offset): Likewise.
4910         (Sized_relobj_file::Local_got_offsets): Likewise.
4911         (Sized_relobj_file::local_got_offsets_): Likewise.
4912         (Sized_relobj_file::section_offsets_): Likewise.
4913         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4914         (all constructors).
4915         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4916         (Output_reloc::get_symbol_index): Likewise.
4917         (Output_reloc::local_section_offset): Likewise.
4918         (Output_reloc::get_address): Likewise.
4919         (Output_reloc::symbol_value): Likewise.
4920         (Output_data_got::reserve_slot): Move to class definition.
4921         (Output_data_got::reserve_local): New function.
4922         (Output_data_got::reserve_slot_for_global): Remove.
4923         (Output_data_got::reserve_global): New function.
4924         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4925         (all constructors, two instantiations).
4926         (Output_reloc::get_relobj): New function (two instantiations).
4927         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4928         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4929         (Output_data_reloc::add_global): Adjust type of relobj.
4930         (Output_data_reloc::add_global_relative): Likewise.
4931         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4932         (Output_data_reloc::add_local): Likewise.
4933         (Output_data_reloc::add_local_relative): Likewise.
4934         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4935         (Output_data_reloc::add_local_section): Likewise.
4936         (Output_data_reloc::add_output_section): Likewise.
4937         (Output_data_reloc::add_absolute): Likewise.
4938         (Output_data_reloc::add_target_specific): Likewise.
4939         (Output_data_got::reserve_slot): Move definition here.
4940         (Output_data_got::reserve_local): New function.
4941         (Output_data_got::reserve_global): New function.
4942         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4943         section_offsets_ with accessor function.
4944         (Sized_relobj_file::write_sections): Likewise.
4945         (Sized_relobj_file::do_relocate_sections): Likewise.
4946         * target.h (Sized_target::reserve_local_got_entry): New function.
4947         (Sized_target::reserve_global_got_entry): New function.
4948         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4949         (Target_x86_64::reserve_global_got_entry): New function.
4950         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4951
4952 2011-05-23 Cary Coutant  <ccoutant@google.com>
4953
4954         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4955         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4956         bit when checking got_type.
4957         * incremental.cc (Sized_incremental_binary::setup_readers):
4958         Store symbol table and string table locations; initialize bit vector
4959         of file status flags.
4960         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4961         unchanged files.
4962         (Sized_incremental_binary::do_process_got_plt): New function.
4963         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4964         (Output_section_incremental_inputs::set_final_data_size): Record
4965         file index for each input file.
4966         (Output_section_incremental_inputs::write_got_plt): Store file index
4967         instead of input entry offset for each GOT entry.
4968         * incremental.h
4969         (Incremental_input_entry::Incremental_input_entry): Initialize new
4970         data member.
4971         (Incremental_input_entry::set_offset): Store file index.
4972         (Incremental_input_entry::get_file_index): New function.
4973         (Incremental_input_entry::file_index_): New data member.
4974         (Incremental_binary::process_got_plt): New function.
4975         (Incremental_binary::do_process_got_plt): New function.
4976         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4977         data members.
4978         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4979         (Sized_incremental_binary::set_file_is_unchanged): New function.
4980         (Sized_incremental_binary::file_is_unchanged): New function.
4981         (Sized_incremental_binary::do_process_got_plt): New function.
4982         (Sized_incremental_binary::file_status_): New data member.
4983         (Sized_incremental_binary::main_symtab_loc_): New data member.
4984         (Sized_incremental_binary::main_strtab_loc_): New data member.
4985         * output.cc (Output_data_got::Got_entry::write): Add case
4986         RESERVED_CODE.
4987         (Output_data_got::add_global): Call add_got_entry.
4988         (Output_data_got::add_global_plt): Likewise.
4989         (Output_data_got::add_global_with_rel): Likewise.
4990         (Output_data_got::add_global_with_rela): Likewise.
4991         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4992         (Output_data_got::add_global_pair_with_rela): Likewise.
4993         (Output_data_got::add_local): Call add_got_entry.
4994         (Output_data_got::add_local_plt): Likewise.
4995         (Output_data_got::add_local_with_rel): Likewise.
4996         (Output_data_got::add_local_with_rela): Likewise.
4997         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4998         (Output_data_got::add_local_pair_with_rela): Likewise.
4999         (Output_data_got::reserve_slot): New function.
5000         (Output_data_got::reserve_slot_for_global): New function.
5001         (Output_data_got::add_got_entry): New function.
5002         (Output_data_got::add_got_entry_pair): New function.
5003         (Output_section::add_output_section_data): Edit FIXME.
5004         * output.h
5005         (Output_section_data_build::Output_section_data_build): New
5006         constructor with size parameter.
5007         (Output_data_space::Output_data_space): Likewise.
5008         (Output_data_got::Output_data_got): Initialize new data member; new
5009         constructor with size parameter.
5010         (Output_data_got::add_constant): Call add_got_entry.
5011         (Output_data_got::reserve_slot): New function.
5012         (Output_data_got::reserve_slot_for_global): New function.
5013         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5014         (Output_data_got::add_got_entry): New function.
5015         (Output_data_got::add_got_entry_pair): New function.
5016         (Output_data_got::free_list_): New data member.
5017         * target.h (Sized_target::init_got_plt_for_update): New function.
5018         (Sized_target::register_global_plt_entry): New function.
5019         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5020         Initialize new data member; call init; add constructor with PLT count.
5021         (Output_data_plt_x86_64::init): New function.
5022         (Output_data_plt_x86_64::add_relocation): New function.
5023         (Output_data_plt_x86_64::reserve_slot): New function.
5024         (Output_data_plt_x86_64::free_list_): New data member.
5025         (Target_x86_64::init_got_plt_for_update): New function.
5026         (Target_x86_64::register_global_plt_entry): New function.
5027         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5028         incremental updates.
5029         (Output_data_plt_x86_64::add_relocation): New function.
5030         * testsuite/object_unittest.cc (Object_test): Set default options.
5031
5032 2011-05-16  Ian Lance Taylor  <iant@google.com>
5033
5034         * options.h (class General_options): Make -i a synonym for -r.
5035
5036 2011-05-16  Ian Lance Taylor  <iant@google.com>
5037
5038         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5039
5040 2011-05-10 Cary Coutant  <ccoutant@google.com>
5041
5042         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5043         strip_all (-s).
5044
5045 2011-05-06  Ian Lance Taylor  <iant@google.com>
5046
5047         * layout.cc (Layout::layout): If the output section flags change,
5048         update the ordering.
5049
5050 2011-04-25 Cary Coutant  <ccoutant@google.com>
5051
5052         * incremental-dump.cc (dump_incremental_inputs): Print local
5053         symbol info for each input file.
5054         * incremental.cc
5055         (Output_section_incremental_inputs::set_final_data_size): Add local
5056         symbol info to input file entries in incremental info.
5057         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5058         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5059         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5060         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5061         implementation.
5062         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5063         (Sized_incr_relobj::do_relocate): Write the local symbols.
5064         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5065         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5066         Adjust size of input file header.
5067         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5068         (Incremental_inputs_reader::get_local_symbol_count): New function.
5069         (Incremental_inputs_reader::get_input_section): Adjust size of input
5070         file header.
5071         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5072         (Sized_incr_relobj::This): New typedef.
5073         (Sized_incr_relobj::sym_size): New const data member.
5074         (Sized_incr_relobj::Local_symbol): New struct.
5075         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5076         (Sized_incr_relobj::do_local_symbol_offset): New function.
5077         (Sized_incr_relobj::local_symbol_count_): New data member.
5078         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5079         (Sized_incr_relobj::local_symbol_index_): New data member.
5080         (Sized_incr_relobj::local_symbol_offset_): New data member.
5081         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5082         (Sized_incr_relobj::local_symbols_): New data member.
5083         * object.h (Relobj::output_local_symbol_count): New function.
5084         (Relobj::local_symbol_offset): New function.
5085         (Relobj::do_output_local_symbol_count): New function.
5086         (Relobj::do_local_symbol_offset): New function.
5087         (Sized_relobj::do_output_local_symbol_count): New function.
5088         (Sized_relobj::do_local_symbol_offset): New function.
5089
5090 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5091
5092         * descriptors.cc (set_close_on_exec): New function.
5093         (Descriptors::open): Use set_close_on_exec.
5094         * output.cc (S_ISLNK): Define if not defined.
5095
5096 2011-04-22 Cary Coutant  <ccoutant@google.com>
5097
5098         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5099         global symbol map.
5100         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5101         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5102         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5103         relocations.
5104         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5105         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5106         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5107         * incremental.h
5108         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5109         function.
5110         (Incremental_binary::apply_incremental_relocs): New function.
5111         (Incremental_binary::do_apply_incremental_relocs): New function.
5112         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5113         data member.
5114         (Sized_incremental_binary::add_global_symbol): New function.
5115         (Sized_incremental_binary::global_symbol): New function.
5116         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5117         (Sized_incremental_binary::symbol_map_): New data member.
5118         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5119         * target.h (Sized_target::apply_relocation): New function.
5120         * target-reloc.h (apply_relocation): New function.
5121         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5122
5123 2011-04-22  Doug Kwan  <dougkwan@google.com>
5124
5125         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5126         flag of a SHT_ARM_EXIDX section.
5127         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5128         * testsuite/Makefile.in: Regenerate.
5129         * testsuite/arm_exidx_test.s: New file.
5130         * testsuite/arm_exidx_test.sh: Same.
5131
5132 2011-04-20 Cary Coutant  <ccoutant@google.com>
5133
5134         PR gold/12689
5135         * archive.h (Incremental_archive_entry::Archive_member):
5136         Initialize arg_serial_ (second constructor).
5137
5138 2011-04-17  Ian Lance Taylor  <iant@google.com>
5139
5140         * object.cc (Relocate_info::location): Simplify location string.
5141         * errors.cc (Errors::error_at_location): Don't print program
5142         name.
5143         (Errors::warning_at_location): Likewise.
5144         (Errors::undefined_symbol): Likewise.
5145         * testsuite/debug_msg.sh: Update accordingly.
5146
5147 2011-04-14 Cary Coutant  <ccoutant@google.com>
5148
5149         * gold/layout.cc (Layout::symtab_section_offset): New function.
5150         * gold/layout.h (Layout::symtab_section_offset): New function.
5151         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5152
5153 2011-04-12  Ian Lance Taylor  <iant@google.com>
5154
5155         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5156         with MREMAP_MAYMOVE.
5157         * output.h (class Output_file): Add map_is_allocated_ field.
5158         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5159         not available, provide stubs.  If mremap is not available, #define
5160         it to gold_mremap.
5161         (MREMAP_MAYMOVE): Define if not defined.
5162         (Output_file::Output_file): Initialize map_is_allocated_.
5163         (Output_file::resize): Check map_is_allocated_.
5164         (Output_file::map_anonymous): If mmap fails, use malloc.
5165         (Output_file::unmap): Don't do anything for an anonymous map.
5166         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5167         is not available, provide stubs.
5168         (File_read::View::~View): Use free rather than delete[].
5169         (File_read::make_view): Use malloc rather than new[].  If mmap
5170         fails, use malloc.
5171         (File_read::find_or_make_view): Use malloc rather than new[].
5172         * gold.h: Remove HAVE_REMAP code.
5173         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5174         exists.  Rename mremap to gold_mremap.  If mmap is not available
5175         don't do anything.
5176         * configure, config.in: Rebuild.
5177
5178 2011-04-11  Ian Lance Taylor  <iant@google.com>
5179
5180         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5181         initialize local variable v.
5182
5183 2011-04-11  Cary Coutant  <ccoutant@google.com>
5184
5185         * archive.cc (Archive::include_member): Adjust call to
5186         report_object.
5187         (Add_archive_symbols::run): Track argument serial numbers.
5188         (Lib_group::include_member): Likewise.
5189         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5190         * archive.h (Incremental_archive_entry::Archive_member):
5191         Initialize arg_serial_.
5192         (Archive_member::arg_serial_): New data member.
5193         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5194         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5195         incremental link.
5196         (Sized_dynobj::do_for_all_local_got_entries): New function.
5197         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5198         function.
5199         * fileread.cc (get_mtime): New function.
5200         * fileread.h (get_mtime): New function.
5201         * gold.cc (queue_initial_tasks): Check for incremental update.
5202         (process_incremental_input): New function.
5203         (queue_middle_tasks): Don't force valid target for incremental
5204         update.
5205         * incremental-dump.cc (find_input_containing_global): Adjust
5206         size of symbol info entry.
5207         (dump_incremental_inputs): Dump argument serial number and
5208         in_system_directory flag; bias shndx by 1; print symbol names
5209         when dumping per-file symbol lists; use new symbol info readers.
5210         * incremental.cc
5211         (Output_section_incremental_inputs:update_data_size): New function.
5212         (Sized_incremental_binary::setup_readers): Setup input readers
5213         for each input file; build maps for files added from libraries
5214         and scripts.
5215         (Sized_incremental_binary::check_input_args): New function.
5216         (Sized_incremental_binary::do_check_inputs): Build map of argument
5217         serial numbers to input arguments.
5218         (Sized_incremental_binary::do_file_has_changed): Rename
5219         do_file_is_unchanged to this; compare file modification times.
5220         (Sized_incremental_binary::do_init_layout): New function.
5221         (Sized_incremental_binary::do_reserve_layout): New function.
5222         (Sized_incremental_binary::do_get_input_reader): Remove.
5223         (Sized_incremental_binary::get_symtab_view): New function.
5224         (Incremental_checker::can_incrementally_link_output_file): Remove.
5225         (Incremental_inputs::report_command_line): Exclude --debug options.
5226         (Incremental_inputs::report_archive_begin): Add parameter; track
5227         argument serial numbers; don't put input file entry for archive
5228         before archive members.
5229         (Incremental_inputs::report_archive_end): Put input file entry
5230         for archive after archive members.
5231         (Incremental_inputs::report_object): Add parameter; track argument
5232         serial numbers and in_system_directory flag.
5233         (Incremental_inputs::report_script): Add parameter; track argument
5234         serial numbers.
5235         (Output_section_incremental_inputs::set_final_data_size): Adjust
5236         size of symbol info entry; check for forwarding symbols.
5237         (Output_section_incremental_inputs::write_input_files): Write
5238         in_system_directory flag and argument serial number.
5239         (Output_section_incremental_inputs::write_info_blocks): Map section
5240         indices between incremental info and original input file; store
5241         input section index for each symbol.
5242         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5243         change operator() to visit().
5244         (class Global_got_offset_visitor): Likewise.
5245         (class Global_symbol_visitor_got_plt):
5246         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5247         classes.
5248         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5249         (Sized_incr_relobj::do_read_symbols): New function.
5250         (Sized_incr_relobj::do_layout): New function.
5251         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5252         (Sized_incr_relobj::do_add_symbols): New function.
5253         (Sized_incr_relobj::do_should_include_member): New function.
5254         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5255         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5256         (Sized_incr_relobj::do_section_size): New function.
5257         (Sized_incr_relobj::do_section_name): New function.
5258         (Sized_incr_relobj::do_section_contents): New function.
5259         (Sized_incr_relobj::do_section_flags): New function.
5260         (Sized_incr_relobj::do_section_entsize): New function.
5261         (Sized_incr_relobj::do_section_address): New function.
5262         (Sized_incr_relobj::do_section_type): New function.
5263         (Sized_incr_relobj::do_section_link): New function.
5264         (Sized_incr_relobj::do_section_info): New function.
5265         (Sized_incr_relobj::do_section_addralign): New function.
5266         (Sized_incr_relobj::do_initialize_xindex): New function.
5267         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5268         (Sized_incr_relobj::do_read_relocs): New function.
5269         (Sized_incr_relobj::do_gc_process_relocs): New function.
5270         (Sized_incr_relobj::do_scan_relocs): New function.
5271         (Sized_incr_relobj::do_count_local_symbols): New function.
5272         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5273         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5274         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5275         (Sized_incr_relobj::do_relocate): New function.
5276         (Sized_incr_relobj::do_set_section_offset): New function.
5277         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5278         (Sized_incr_dynobj::do_read_symbols): New function.
5279         (Sized_incr_dynobj::do_layout): New function.
5280         (Sized_incr_dynobj::do_add_symbols): New function.
5281         (Sized_incr_dynobj::do_should_include_member): New function.
5282         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5283         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5284         (Sized_incr_dynobj::do_section_size): New function.
5285         (Sized_incr_dynobj::do_section_name): New function.
5286         (Sized_incr_dynobj::do_section_contents): New function.
5287         (Sized_incr_dynobj::do_section_flags): New function.
5288         (Sized_incr_dynobj::do_section_entsize): New function.
5289         (Sized_incr_dynobj::do_section_address): New function.
5290         (Sized_incr_dynobj::do_section_type): New function.
5291         (Sized_incr_dynobj::do_section_link): New function.
5292         (Sized_incr_dynobj::do_section_info): New function.
5293         (Sized_incr_dynobj::do_section_addralign): New function.
5294         (Sized_incr_dynobj::do_initialize_xindex): New function.
5295         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5296         (make_sized_incremental_object): New function.
5297         (Incremental_library::copy_unused_symbols): New function.
5298         (Incremental_library::do_for_all_unused_symbols): New function.
5299         * incremental.h (enum Incremental_input_flags): New type.
5300         (class Incremental_checker): Remove.
5301         (Incremental_input_entry::Incremental_input_entry): Add argument
5302         serial number.
5303         (Incremental_input_entry::arg_serial): New function.
5304         (Incremental_input_entry::set_is_in_system_directory): New function.
5305         (Incremental_input_entry::is_in_system_directory): New function.
5306         (Incremental_input_entry::arg_serial_): New data member.
5307         (Incremental_input_entry::is_in_system_directory_): New data member.
5308         (class Script_info): Move here from script.h.
5309         (Script_info::Script_info): Add filename parameter.
5310         (Script_info::filename): New function.
5311         (Script_info::filename_): New data member.
5312         (Incremental_script_entry::Incremental_script_entry): Add argument
5313         serial number.
5314         (Incremental_object_entry::Incremental_object_entry): Likewise.
5315         (Incremental_object_entry::add_input_section): Build list of input
5316         sections with map to original shndx.
5317         (Incremental_object_entry::get_input_section_index): New function.
5318         (Incremental_object_entry::shndx_): New data member.
5319         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5320         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5321         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5322         serial number.
5323         (Incremental_inputs::report_archive_begin): Likewise.
5324         (Incremental_inputs::report_object): Likewise.
5325         (Incremental_inputs::report_script): Likewise.
5326         (class Incremental_global_symbol_reader): New class.
5327         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5328         and store flags and input file type.
5329         (Incremental_input_entry_reader::arg_serial): New function.
5330         (Incremental_input_entry_reader::type): Extract type from flags.
5331         (Incremental_input_entry_reader::is_in_system_directory): New function.
5332         (Incremental_input_entry_reader::get_input_section_count): Call
5333         accessor function for type.
5334         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5335         function for type; adjust size of global symbol entry.
5336         (Incremental_input_entry_reader::get_global_symbol_count): Call
5337         accessor function for type.
5338         (Incremental_input_entry_reader::get_object_count): Likewise.
5339         (Incremental_input_entry_reader::get_object_offset): Likewise.
5340         (Incremental_input_entry_reader::get_member_count): Likewise.
5341         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5342         (Incremental_input_entry_reader::get_member_offset): Likewise.
5343         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5344         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5345         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5346         (Incremental_input_entry_reader::get_global_symbol_reader): New
5347         function.
5348         (Incremental_input_entry_reader::get_output_symbol_index): New
5349         function.
5350         (Incremental_input_entry_reader::type_): Remove.
5351         (Incremental_input_entry_reader::flags_): New data member.
5352         (Incremental_inputs_reader::input_file_offset): New function.
5353         (Incremental_inputs_reader::input_file_index): New function.
5354         (Incremental_inputs_reader::input_file): Call input_file_offset.
5355         (Incremental_inputs_reader::input_file_at_offset): New function.
5356         (Incremental_relocs_reader::get_r_type): Reformat.
5357         (Incremental_relocs_reader::get_r_shndx): Reformat.
5358         (Incremental_relocs_reader::get_r_offset): Reformat.
5359         (Incremental_relocs_reader::data): New function.
5360         (Incremental_binary::Incremental_binary): Initialize new data members.
5361         (Incremental_binary::check_inputs): Add cmdline parameter.
5362         (Incremental_binary::file_is_unchanged): Remove.
5363         (Input_reader::arg_serial): New function.
5364         (Input_reader::get_unused_symbol_count): New function.
5365         (Input_reader::get_unused_symbol): New function.
5366         (Input_reader::do_arg_serial): New function.
5367         (Input_reader::do_get_unused_symbol_count): New function.
5368         (Input_reader::do_get_unused_symbol): New function.
5369         (Incremental_binary::input_file_count): New function.
5370         (Incremental_binary::get_input_reader): Change signature to use
5371         index instead of filename.
5372         (Incremental_binary::file_has_changed): New function.
5373         (Incremental_binary::get_input_argument): New function.
5374         (Incremental_binary::get_library): New function.
5375         (Incremental_binary::get_script_info): New function.
5376         (Incremental_binary::init_layout): New function.
5377         (Incremental_binary::reserve_layout): New function.
5378         (Incremental_binary::output_file): New function.
5379         (Incremental_binary::do_check_inputs): New function.
5380         (Incremental_binary::do_file_is_unchanged): Remove.
5381         (Incremental_binary::do_file_has_changed): New function.
5382         (Incremental_binary::do_init_layout): New function.
5383         (Incremental_binary::do_reserve_layout): New function.
5384         (Incremental_binary::do_input_file_count): New function.
5385         (Incremental_binary::do_get_input_reader): Change signature.
5386         (Incremental_binary::input_args_map_): New data member.
5387         (Incremental_binary::library_map_): New data member.
5388         (Incremental_binary::script_map_): New data member.
5389         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5390         new data members.
5391         (Sized_incremental_binary::output_section): New function.
5392         (Sized_incremental_binary::inputs_reader): Add const.
5393         (Sized_incremental_binary::symtab_reader): Add const.
5394         (Sized_incremental_binary::relocs_reader): Add const.
5395         (Sized_incremental_binary::got_plt_reader): Add const.
5396         (Sized_incremental_binary::get_symtab_view): New function.
5397         (Sized_incremental_binary::Inputs_reader): New typedef.
5398         (Sized_incremental_binary::Input_entry_reader): New typedef.
5399         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5400         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5401         (Sized_incremental_binary::do_file_has_changed): New function.
5402         (Sized_incremental_binary::do_init_layout): New function.
5403         (Sized_incremental_binary::do_reserve_layout): New function.
5404         (Sized_input_reader::Inputs_reader): Remove.
5405         (Sized_input_reader::Input_entry_reader): Remove.
5406         (Sized_input_reader::do_arg_serial): New function.
5407         (Sized_input_reader::do_get_unused_symbol_count): New function.
5408         (Sized_input_reader::do_get_unused_symbol): New function.
5409         (Sized_incremental_binary::do_input_file_count): New function.
5410         (Sized_incremental_binary::do_get_input_reader): Change signature;
5411         use index instead of filename.
5412         (Sized_incremental_binary::section_map_): New data member.
5413         (Sized_incremental_binary::input_entry_readers_): New data member.
5414         (class Sized_incr_relobj): New class.
5415         (class Sized_incr_dynobj): New class.
5416         (make_sized_incremental_object): New function.
5417         (class Incremental_library): New class.
5418         * layout.cc (Free_list::num_lists): New static data member.
5419         (Free_list::num_nodes): New static data member.
5420         (Free_list::num_removes): New static data member.
5421         (Free_list::num_remove_visits): New static data member.
5422         (Free_list::num_allocates): New static data member.
5423         (Free_list::num_allocate_visits): New static data member.
5424         (Free_list::init): New function.
5425         (Free_list::remove): New function.
5426         (Free_list::allocate): New function.
5427         (Free_list::dump): New function.
5428         (Free_list::print_stats): New function.
5429         (Layout_task_runner::run): Resize output file for incremental updates.
5430         (Layout::Layout): Initialize new data members.
5431         (Layout::set_incremental_base): New function.
5432         (Layout::init_fixed_output_section): New function.
5433         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5434         incremental updates.
5435         (Layout::create_gold_note): Do not create gold note section for
5436         incremental updates.
5437         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5438         for incremental updates.
5439         (Layout::set_section_offsets): For incremental updates, allocate space
5440         from free list.
5441         (Layout::create_symtab_sections): Layout with offsets relative to
5442         start of section; for incremental updates, allocate space from free
5443         list.
5444         (Layout::create_shdrs): For incremental updates, allocate space from
5445         free list.
5446         (Layout::finish_dynamic_section): For incremental updates, do not
5447         check --as-needed (fixed in subsequent patch).
5448         * layout.h (class Free_list): New class.
5449         (Layout::set_incremental_base): New function.
5450         (Layout::incremental_base): New function.
5451         (Layout::init_fixed_output_section): New function.
5452         (Layout::allocate): New function.
5453         (Layout::incremental_base_): New data member.
5454         (Layout::free_list_): New data member.
5455         * main.cc (main): Print Free_list statistics.
5456         * object.cc (Relobj::finalize_incremental_relocs): Add
5457         clear_counts parameter; clear counts only when clear_counts is set.
5458         (Sized_relobj::Sized_relobj): Initialize new base class.
5459         (Sized_relobj::do_layout): Don't report special sections.
5460         (Sized_relobj::do_for_all_local_got_entries): New function.
5461         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5462         symtab_off to all symbol table offsets.
5463         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5464         * object.h (class Got_offset_list): Move to top of file.
5465         (Object::Object): Allow case where input_file == NULL.
5466         (Object::~Object): Likewise.
5467         (Object::input_file): Assert that input_file != NULL.
5468         (Object::lock): Allow case where input_file == NULL.
5469         (Object::unlock): Likewise.
5470         (Object::is_locked): Likewise.
5471         (Object::token): Likewise.
5472         (Object::release): Likewise.
5473         (Object::is_incremental): New function.
5474         (Object::get_mtime): New function.
5475         (Object::for_all_local_got_entries): New function.
5476         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5477         (Object::set_is_in_system_directory): New function.
5478         (Object::is_in_system_directory): New function.
5479         (Object::do_is_incremental): New function.
5480         (Object::do_get_mtime): New function.
5481         (Object::do_for_all_local_got_entries): New function.
5482         (Object::is_in_system_directory_): New data member.
5483         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5484         (class Sized_relobj_base): New class.
5485         (class Sized_relobj): Derive from Sized_relobj_base.
5486         (class Sized_relobj::Symbols): Redeclare from base class.
5487         (class Sized_relobj::local_got_offset_list): Remove.
5488         (class Sized_relobj::Output_sections): Redeclare from base class.
5489         (class Sized_relobj::do_for_all_local_got_entries): New function.
5490         (class Sized_relobj::write_local_symbols): Add offset parameter.
5491         (class Sized_relobj::local_symbol_offset_): Update comment.
5492         (class Sized_relobj::local_dynsym_offset_): Update comment.
5493         * options.cc (Input_arguments::add_file): Remove const.
5494         * options.h (Input_file_argument::Input_file_argument):
5495         Initialize arg_serial_ (all constructors).
5496         (Input_file_argument::set_arg_serial): New function.
5497         (Input_file_argument::arg_serial): New function.
5498         (Input_file_argument::arg_serial_): New data member.
5499         (Input_arguments::Input_arguments): Initialize file_count_.
5500         (Input_arguments::add_file): Remove const.
5501         (Input_arguments::number_of_input_files): New function.
5502         (Input_arguments::file_count_): New data member.
5503         (Command_line::number_of_input_files): Call
5504         Input_arguments::number_of_input_files.
5505         * output.cc (Output_segment_headers::Output_segment_headers):
5506         Set current size.
5507         (Output_section::Input_section::current_data_size): New function.
5508         (Output_section::Output_section): Initialize new data members.
5509         (Output_section::add_input_section): Don't do merge sections for
5510         an incremental link; allocate space from free list for an
5511         incremental update.
5512         (Output_section::add_output_section_data): Allocate space from
5513         free list for an incremental update.
5514         (Output_section::update_data_size): New function.
5515         (Output_section::set_fixed_layout): New function.
5516         (Output_section::reserve): New function.
5517         (Output_segment::set_section_addresses): Remove const.
5518         (Output_segment::set_section_list_addresses): Remove const; allocate
5519         space from free list for an incremental update.
5520         (Output_segment::set_offset): Adjust size of RELRO segment for an
5521         incremental update.
5522         * output.h (Output_data::current_data_size): Move here from
5523         child classes.
5524         (Output_data::pre_finalize_data_size): New function.
5525         (Output_data::update_data_size): New function.
5526         (Output_section_headers::update_data_size): new function.
5527         (Output_section_data_build::current_data_size): Move to Output_data.
5528         (Output_data_strtab::update_data_size): New function.
5529         (Output_section::current_data_size): Move to Output_data.
5530         (Output_section::set_fixed_layout): New function.
5531         (Output_section::has_fixed_layout): New function.
5532         (Output_section::reserve): New function.
5533         (Output_section::update_data_size): New function.
5534         (Output_section::has_fixed_layout_): New data member.
5535         (Output_section::free_list_): New data member.
5536         (Output_segment::set_section_addresses): Remove const.
5537         (Output_segment::set_section_list_addresses): Remove const.
5538         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5539         New function.
5540         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5541         New function.
5542         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5543         parameter when calling Add_symbols constructor; store argument
5544         serial number for members of a lib group.
5545         (Add_symbols::locks): Allow case where token == NULL.
5546         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5547         (Read_member::~Read_member): New function.
5548         (Read_member::is_runnable): New function.
5549         (Read_member::locks): New function.
5550         (Read_member::run): New function.
5551         (Check_script::~Check_script): New function.
5552         (Check_script::is_runnable): New function.
5553         (Check_script::locks): New function.
5554         (Check_script::run): New function.
5555         (Check_library::~Check_library): New function.
5556         (Check_library::is_runnable): New function.
5557         (Check_library::locks): New function.
5558         (Check_library::run): New function.
5559         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5560         (Add_symbols::library_): New data member.
5561         (class Read_member): New class.
5562         (class Check_script): New class.
5563         (class Check_library): New class.
5564         * reloc.cc (Read_relocs::is_runnable): Allow case where
5565         token == NULL.
5566         (Read_relocs::locks): Likewise.
5567         (Scan_relocs::locks): Likewise.
5568         (Relocate_task::locks): Likewise.
5569         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5570         to clear counters.
5571         (Sized_relobj::incremental_relocs_scan): Fix comment.
5572         (Sized_relobj::do_relocate): Pass output file offset to
5573         write_local_symbols.
5574         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5575         from class declaration.
5576         * script.cc (read_input_script): Allocate Script_info; pass
5577         argument serial number to report_script.
5578         * script.h (class Script_info): Move to incremental.h.
5579         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5580         * symtab.h (Symbol_table::add_from_incrobj): New function.
5581         (Symbol_table::set_file_offset): New function.
5582
5583 2011-04-05  Cary Coutant  <ccoutant@google.com>
5584
5585         * incremental-dump.cc (dump_incremental_inputs): Change signature
5586         to take a Sized_incremental_binary; change caller.  Use readers
5587         in Sized_incremental_binary.
5588         * incremental.cc
5589         (Sized_incremental_binary::find_incremental_inputs_sections):
5590         Rename do_find_incremental_inputs_sections to this.
5591         (Sized_incremental_binary::setup_readers): New function.
5592         (Sized_incremental_binary::do_check_inputs): Check
5593         has_incremental_info_ flag; move setup code to setup_readers;
5594         use input readers.
5595         (Sized_incremental_binary::do_file_is_unchanged): New function.
5596         (Sized_incremental_binary::do_get_input_reader): New function.
5597         * incremental.h (class Incremental_binary): Move to end of file.
5598         (Incremental_binary::file_is_unchanged): New function.
5599         (Incremental_binary::do_file_is_unchanged): New function.
5600         (Incremental_binary::Input_reader): New class.
5601         (Incremental_binary::get_input_reader): New function.
5602         (class Sized_incremental_binary): Move to end of file.
5603         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5604         input section reader classes.
5605         (Sized_incremental_binary::has_incremental_info): New function.
5606         (Sized_incremental_binary::inputs_reader): New function.
5607         (Sized_incremental_binary::symtab_reader): New function.
5608         (Sized_incremental_binary::relocs_reader): New function.
5609         (Sized_incremental_binary::got_plt_reader): New function.
5610         (Sized_incremental_binary::do_file_is_unchanged): New function.
5611         (Sized_incremental_binary::Sized_input_reader): New class.
5612         (Sized_incremental_binary::get_input_reader): New function.
5613         (Sized_incremental_binary::find_incremental_inputs_sections):
5614         Rename do_find_incremental_inputs_sections to this.
5615         (Sized_incremental_binary::setup_readers): New function.
5616         (Sized_incremental_binary::has_incremental_info_): New data member.
5617         (Sized_incremental_binary::inputs_reader_): New data member.
5618         (Sized_incremental_binary::symtab_reader_): New data member.
5619         (Sized_incremental_binary::relocs_reader_): New data member.
5620         (Sized_incremental_binary::got_plt_reader_): New data member.
5621         (Sized_incremental_binary::current_input_file_): New data member.
5622
5623 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5624
5625         PR gold/12640
5626         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5627         violation.
5628
5629 2011-03-30  Cary Coutant  <ccoutant@google.com>
5630
5631         * archive.cc (Archive::include_member): Adjust call to report_object.
5632         (Add_archive_symbols::run): Add script_info to call to
5633         report_archive_begin.
5634         (Lib_group::include_member): Adjust call to report_object.
5635         (Add_lib_group_symbols::run): Adjust call to report_object.
5636         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5637         blocks.  Add object count for script input files.
5638         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5639         script_info parameter; change all callers.
5640         (Incremental_inputs::report_object): Add script_info parameter;
5641         change all callers.
5642         (Incremental_inputs::report_script): Store backpointer to
5643         incremental info entry.
5644         (Output_section_incremental_inputs::set_final_data_size): Record
5645         additional information for scripts.
5646         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5647         * incremental.h (Incremental_script_entry::add_object): New function.
5648         (Incremental_script_entry::get_object_count): New function.
5649         (Incremental_script_entry::get_object): New function.
5650         (Incremental_script_entry::objects_): New data member; adjust
5651         constructor.
5652         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5653         (Incremental_inputs::report_object): Add script_info parameter.
5654         (Incremental_inputs_reader::get_object_count): New function.
5655         (Incremental_inputs_reader::get_object_offset): New function.
5656         * options.cc (Input_arguments::add_file): Return reference to
5657         new input argument.
5658         * options.h (Input_argument::set_script_info): New function.
5659         (Input_argument::script_info): New function.
5660         (Input_argument::script_info_): New data member; adjust all
5661         constructors.
5662         (Input_file_group::add_file): Return reference to new input argument.
5663         (Input_file_lib::add_file): Likewise.
5664         (Input_arguments::add_file): Likewise.
5665         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5666         * script.cc (Parser_closure::Parser_closure): Add script_info
5667         parameter; adjust all callers.
5668         (Parser_closure::script_info): New function.
5669         (Parser_closure::script_info_): New data member.
5670         (read_input_script): Report scripts earlier to incremental info.
5671         (script_add_file): Set script_info in Input_argument.
5672         (script_add_library): Likewise.
5673         * script.h (Script_options::Script_info): Rewrite class.
5674
5675 2011-03-29  Cary Coutant  <ccoutant@google.com>
5676
5677         * archive.cc (Library_base::should_include_member): Move
5678         method here from class Archive.
5679         (Archive::Archive): Initialize base class.
5680         (Archive::should_include_member): Move to base class.
5681         (Archive::do_for_all_unused_symbols): New function.
5682         (Add_archive_symbols::run): Remove redundant access to
5683         incremental_inputs.
5684         (Lib_group::Lib_group): Initialize base class.
5685         (Lib_group::do_filename): New function.
5686         (Lib_group::include_member): Pass pointer to Lib_group to
5687         report_object.
5688         (Lib_group::do_for_all_unused_symbols): New function.
5689         (Add_lib_group_symbols::run): Report archive information for
5690         incremental links.
5691         * archive.h (class Library_base): New base class.
5692         (class Archive): Derive from Library_base.
5693         (Archive::filename): Move to base class.
5694         (Archive::set_incremental_info): Likewise.
5695         (Archive::incremental_info): Likewise.
5696         (Archive::Should_include): Likewise.
5697         (Archive::should_include_member): Likewise.
5698         (Archive::Armap_entry): Remove.
5699         (Archive::Unused_symbol_iterator): Remove.
5700         (Archive::unused_symbols_begin): Remove.
5701         (Archive::unused_symbols_end): Remove.
5702         (Archive::do_filename): New function.
5703         (Archive::do_get_mtime): New function.
5704         (Archive::do_for_all_unused_symbols): New function.
5705         (Archive::task_): Move to base class.
5706         (Archive::incremental_info_): Likewise.
5707         (class Lib_group): Derive from Library_base.
5708         (Lib_group::do_filename): New function.
5709         (Lib_group::do_get_mtime): New function.
5710         (Lib_group::do_for_all_unused_symbols): New function.
5711         (Lib_group::task_): Move to base class.
5712         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5713         function.
5714         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5715         function.
5716         * incremental.cc (Incremental_inputs::report_archive_begin):
5717         Use Library_base; call library's get_mtime; add incremental inputs
5718         entry before members.
5719         (class Unused_symbol_visitor): New class.
5720         (Incremental_inputs::report_archive_end): Use Library_base; use
5721         visitor class to record unused symbols; don't add incremental inputs
5722         entry after members.
5723         (Incremental_inputs::report_object): Use Library_base.
5724         * incremental.h
5725         (Incremental_archive_entry::Incremental_archive_entry): Remove
5726         unused Archive parameter.
5727         (Incremental_inputs::report_archive_begin): Use Library_base.
5728         (Incremental_inputs::report_archive_end): Likewise.
5729         (Incremental_inputs::report_object): Likewise.
5730         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5731         function.
5732         * object.h (Object::for_all_global_symbols): New function.
5733         (Object::do_for_all_global_symbols): New function.
5734         (Sized_relobj::do_for_all_global_symbols): New function.
5735         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5736         function.
5737         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5738         function.
5739
5740 2011-03-27  Ian Lance Taylor  <iant@google.com>
5741
5742         * archive.cc (Archive::interpret_header): Return -1 if something
5743         goes wrong.  Change callers accordingly.
5744
5745 2011-03-25  Cary Coutant  <ccoutant@google.com>
5746
5747         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5748         * testsuite/Makefile.in: Regenerate.
5749
5750 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5751
5752         * plugin.cc (get_view): New.
5753         (Plugin::load): Pass get_view to the plugin.
5754         (Plugin_manager::get_view): New.
5755
5756 2011-03-21  Ian Lance Taylor  <iant@google.com>
5757
5758         * testsuite/final_layout.sh: Rewrite to not use dc.
5759         * testsuite/relro_test.sh: Fail if dc is not present.
5760
5761 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5762
5763         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5764         Change == to -eq.
5765         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5766         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5767         Change == to -eq.
5768         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5769         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5770
5771 2011-03-14  Ian Lance Taylor  <iant@google.com>
5772
5773         * script-sections.cc (Sort_output_sections::script_compare):
5774         Rename from is_before, change return type.
5775         (Sort_output_sections::operator()): Adjust accordingly.
5776
5777 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5778
5779         PR gold/12572
5780         * testsuite/odr_violation2.cc: Add comment to make all error line
5781         numbers double digits.
5782         * testsuite/debug_msg.sh: Adjust expected errors.
5783
5784 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5785
5786         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5787         but mark earlier ones as non-canonical
5788         (offset_to_iterator): Update search target and example
5789         (do_addr2line): Return extra lines in a vector*
5790         (format_file_lineno): Extract from do_addr2line
5791         (one_addr2line): Add vector* out-param
5792         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5793         when a lineno entry appeared last for its instruction
5794         (Dwarf_line_info): Add vector* out-param
5795         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5796         * symtab.cc (Odr_violation_compare): Include the lineno in the
5797         comparison again.
5798         (linenos_from_loc): New. Combine the canonical line for an
5799         address with its other lines.
5800         (True_if_intersect): New. Helper functor to make
5801         std::set_intersection a query.
5802         (detect_odr_violations): Compare sets of lines instead of just
5803         one line for each function. This became less deterministic, but
5804         has fewer false positives.
5805         * symtab.h: Declarations.
5806         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5807         mix an optimized and non-optimized object in the same binary
5808         (odr_violation2.so): Same.
5809         * testsuite/Makefile.in: Regenerate from Makefile.am.
5810         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5811         * testsuite/debug_msg.sh: Update line numbers and add
5812         assertions.
5813         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5814         non-optimized context.
5815         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5816         isn't inlined, and use OdrDerived in an optimized context.
5817         * testsuite/odr_header1.h: Defines OdrDerived, where
5818         optimization will change the
5819         first-instruction-in-the-destructor's file and line number.
5820         * testsuite/odr_header2.h: Defines OdrBase.
5821
5822 2011-03-09  Ian Lance Taylor  <iant@google.com>
5823
5824         * fileread.cc (File_read::clear_views): Don't delete the whole
5825         file view.
5826
5827 2011-03-08  Ian Lance Taylor  <iant@google.com>
5828
5829         PR gold/12525
5830         * fileread.cc: #include <climits>.
5831         (GOLD_IOV_MAX): Define.
5832         (File_read::read_multiple): Limit number of entries by iov_max.
5833         * fileread.h (class File_read): Always set max_readv_entries to
5834         128.
5835
5836 2011-03-07  Ian Lance Taylor  <iant@google.com>
5837
5838         PR gold/12525
5839         * options.h (class General_options): Add -dy and -dn.
5840
5841 2011-03-02  Cary Coutant  <ccoutant@google.com>
5842
5843         * testsuite/script_test_9.t: Add TLS segment.
5844
5845 2011-03-02  Simon Baldwin  <simonb@google.com>
5846
5847         * configure.ac: Add check for gnu_indirect_function support in
5848         the toolchain building binutils.
5849         * configure: Rebuild.
5850
5851 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5852
5853         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5854         plugin only symbols.
5855         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5856         in plugin files as not needed in the symbol table.
5857
5858 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5859
5860         * output.cc (Output_section::add_input_section): Delay fill
5861         generation for section ordering.
5862
5863 2011-02-09  Ian Lance Taylor  <iant@google.com>
5864
5865         PR gold/12316
5866         * object.h (class Sized_relobj): Remove clear_local_symbols.
5867         * reloc.cc (Sized_relobj::do_relocate): Don't call
5868         clear_local_symbols.
5869
5870 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5871
5872         * plugin.cc (is_visible_from_outside): Return true for symbols
5873         in the -u option.
5874
5875 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5876
5877         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5878         filename.
5879
5880 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5881
5882         * icf.h (is_section_foldable_candidate): Change type of parameter
5883         to std::string.
5884         * icf.cc (Icf::find_identical_sections): Change type of local variable
5885         section_name to be std::string.
5886         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5887
5888 2011-01-25  Ian Lance Taylor  <iant@google.com>
5889
5890         * script.cc (script_add_extern): Rewrite to use
5891         add_symbol_reference.
5892
5893 2011-01-25  Doug Kwan  <dougkwan@google.com>
5894
5895         * icf.cc (get_section_contents): Always lock section's object.
5896
5897 2011-01-24  Ian Lance Taylor  <iant@google.com>
5898
5899         * options.h (class General_options): Accept
5900         --no-detect-odr-violations.
5901
5902 2011-01-24  Ian Lance Taylor  <iant@google.com>
5903
5904         * version.cc (version_string): Bump to 1.11.
5905
5906 2011-01-24  Ian Lance Taylor  <iant@google.com>
5907
5908         * plugin.cc (class Plugin_rescan): Define new class.
5909         (Plugin_manager::claim_file): Set any_claimed_.
5910         (Plugin_manager::save_archive): New function.
5911         (Plugin_manager::save_input_group): New function.
5912         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5913         necessary.
5914         (Plugin_manager::new_undefined_symbol): New function.
5915         (Plugin_manager::rescan): New function.
5916         (Plugin_manager::rescannable_defines): New function.
5917         (Plugin_manager::add_input_file): Set any_added_.
5918         * plugin.h (class Plugin_manager): define new fields rescannable_,
5919         undefined_symbols_, any_claimed_, and any_added_.  Declare
5920         Plugin_rescan as friend.  Declare new functions.
5921         (Plugin_manager::Rescannable): Define type.
5922         (Plugin_manager::Rescannable_list): Define type.
5923         (Plugin_manager::Undefined_symbol_list): Define type.
5924         (Plugin_manager::Plugin_manager): Initialize new fields.
5925         * archive.cc (Archive::defines_symbol): New function.
5926         (Add_archive_symbols::run): Pass archive to plugins if any.
5927         * archive.h (class Archive): Declare defines_symbol.
5928         * readsyms.cc (Input_group::~Input_group): New function.
5929         (Finish_group::run): Pass input_group to plugins if any.
5930         * readsyms.h (class Input_group): Declare destructor.
5931         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5932         any.
5933
5934 2011-01-10  Ian Lance Taylor  <iant@google.com>
5935
5936         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5937         section as relro.
5938         (Layout::set_segment_offsets): Reset increase_relro before calling
5939         set_section_addresses a second time.
5940
5941 2011-01-04  Cary Coutant  <ccoutant@google.com>
5942
5943         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5944         sections before NOBITS sections.
5945
5946 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5947
5948         * version.cc (print_version): Update copyright to 2011.
5949
5950 2010-12-23  Cary Coutant  <ccoutant@google.com>
5951
5952         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5953         of OS to this->add.  Add OD parameter to second form of the function.
5954
5955 2010-12-20  Ian Lance Taylor  <iant@google.com>
5956
5957         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5958         second of two consecutive entries with same offset.
5959
5960 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5961
5962         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5963         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5964         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5965         to avoid unneeded links against $(LDADD).
5966         * testsuite/Makefile.in: Regenerate.
5967
5968 2010-12-15  Ian Lance Taylor  <iant@google.com>
5969
5970         PR gold/12324
5971         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5972         for R_X86_64_32 and R_X86_64_PC32.
5973         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5974         ver_matching_def_pic.o.
5975         (ver_matching_def_pic.o): New target.
5976
5977 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5978
5979         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5980         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5981         Move definition before File_read::View member definitions.
5982         (File_read::View::~View): Initialize and hold lock before
5983         updating current_mapped_bytes.
5984
5985 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5986
5987         * dwarf_reader.cc: Remove outdated comment.
5988         * gold-threads.cc: Fix typo in error message.
5989         * archive.cc: Fix typos in comments.
5990         * archive.h: Likewise.
5991         * arm-reloc-property.cc: Likewise.
5992         * arm-reloc-property.h: Likewise.
5993         * arm-reloc.def: Likewise.
5994         * arm.cc: Likewise.
5995         * attributes.h: Likewise.
5996         * cref.cc: Likewise.
5997         * ehframe.cc: Likewise.
5998         * fileread.h: Likewise.
5999         * gold.h: Likewise.
6000         * i386.cc: Likewise.
6001         * icf.cc: Likewise.
6002         * incremental.h: Likewise.
6003         * int_encoding.cc: Likewise.
6004         * layout.h: Likewise.
6005         * main.cc: Likewise.
6006         * merge.h: Likewise.
6007         * object.cc: Likewise.
6008         * object.h: Likewise.
6009         * options.cc: Likewise.
6010         * readsyms.cc: Likewise.
6011         * reduced_debug_output.cc: Likewise.
6012         * reloc.cc: Likewise.
6013         * script-sections.cc: Likewise.
6014         * sparc.cc: Likewise.
6015         * symtab.h: Likewise.
6016         * target-reloc.h: Likewise.
6017         * target.cc: Likewise.
6018         * target.h: Likewise.
6019         * timer.cc: Likewise.
6020         * timer.h: Likewise.
6021         * x86_64.cc: Likewise.
6022
6023 2010-12-09  Cary Coutant  <ccoutant@google.com>
6024
6025         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6026         stack.
6027         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6028         parameter; change all callers.
6029         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6030         * options.h (warn_execstack): New option.
6031
6032 2010-12-07  Doug Kwan  <dougkwan@google.com>
6033
6034         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6035         like function call relocations.
6036
6037 2010-12-07  Ian Lance Taylor  <iant@google.com>
6038
6039         * archive.cc (Archive::get_elf_object_for_member): Permit
6040         punconfigured to be NULL.
6041         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6042         (Archive::include_member): Pass NULL to get_elf_object_for_member
6043         if we searched for the archive and this is the first included
6044         object.
6045
6046 2010-12-01  Ian Lance Taylor  <iant@google.com>
6047
6048         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6049         track_relocs_type_ field.
6050         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6051         Set track_relocs_type_.
6052         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6053         contents when using RELA relocs.
6054         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6055         reloc_map_.
6056         * reloc.cc (Track_relocs::next_addend): New function.
6057         * reloc.h (class Track_relocs): Declare next_addend.
6058
6059 2010-12-01  Ian Lance Taylor  <iant@google.com>
6060
6061         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6062         virtual destructor.
6063
6064 2010-12-01  Ian Lance Taylor  <iant@google.com>
6065
6066         * README: Update compilers known to work and fail.
6067
6068 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6069
6070         * configure.in: For --enable-gold, handle value `default' instead of
6071         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6072         not the default.
6073         * configure: Regenerate.
6074
6075 2010-11-18  Doug Kwan  <dougkwan@google.com>
6076
6077         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6078         and right_alignment to be zero.  Store result alignment only if it is
6079         greater than existing alignment.
6080
6081 2010-11-16  Cary Coutant  <ccoutant@google.com>
6082
6083         PR gold/12220
6084         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6085         Check for ".zdebug_line".
6086
6087 2010-11-16  Doug Kwan  <dougkwan@google.com>
6088             Cary Coutant  <ccoutant@google.com>
6089
6090         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6091         by reference; adjust all callers.
6092         * output.cc (Output_segment::set_section_addresses): Adjust references
6093         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6094         list is empty.
6095         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6096         end at page boundary.
6097
6098 2010-11-16  Cary Coutant  <ccoutant@google.com>
6099
6100         PR gold/12220
6101         * layout.cc (Layout::choose_output_section): Transform names of
6102         compressed sections even when using a script with a SECTIONS clause.
6103         (Layout::output_section_name): Remove code to transform
6104         compressed debug section names.
6105         * output.cc (Output_section::add_input_section): Use uncompressed
6106         section size when tracking input sections.
6107
6108 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6109
6110         * symtab.h (Symbol::NON_PIC_REF): Remove.
6111         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6112         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6113         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6114         (Symbol::use_plt_offset): Take a flags argument and pass it
6115         directly to needs_dynamic_reloc.  Restrict check for undefined
6116         weak symbols to function calls.
6117         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6118         (Target_arm::Scan::global): Use it.
6119         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6120         (Target_arm::Relocate::relocate): Likewise.
6121         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6122         parameter with an r_type parameter.  Use get_reference_flags
6123         to get the flags.
6124         (Target_arm::Relocate::relocate): Update accordingly.
6125         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6126         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6127         (Target_i386::Scan::global): Likewise.
6128         (Target_i386::Relocate::relocate): Likewise.
6129         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6130         parameter with an r_type parameter.  Use get_reference_flags
6131         to get the flags.
6132         (Target_i386::Relocate::relocate): Update accordingly.
6133         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6134         (Target_powerpc::Scan::global): Use it.
6135         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6136         (Target_powerpc::Relocate::relocate): Likewise.
6137         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6138         (Target_sparc::Scan::global): Use it.
6139         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6140         (Target_sparc::Relocate::relocate): Likewise.
6141         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6142         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6143         (Target_x86_64::Scan::global): Likewise.
6144         (Target_x86_64::Relocate::relocate): Likewise.
6145
6146 2010-11-08  Doug Kwan  <dougkwan@google.com>
6147             Cary Coutant  <ccoutant@google.com>
6148
6149         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6150         (Arm_exidx_merge_section::section_contents_): New data member.
6151         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6152         (Arm_input_section::~Arm_input_section): De-allocate memory.
6153         (Arm_input_section::original_contents_): New data member.
6154         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6155         in parameters instead of calling Object::section_contents without
6156         locking.
6157         (Arm_output_section::group_section): New parameter TASK.  Pass it
6158         to callees that need locking objects.
6159         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6160         to lock EXIDX input sections.  Fix a formatting issue.  Call
6161         Arm_exidx_merged_section::build_contents to create merged section
6162         contents.
6163         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6164         to lock object of stub table owner.
6165         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6166         TEXT_SIZE to initialize data member TEXT_SIZE_.
6167         (Arm_exidx_input_section::addralign): Fix typo in comment.
6168         (Arm_exidx_input_section::text_size): New method.
6169         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6170         that require locking objects.  Lock objects before scanning for stubs
6171         and updating local symbols.
6172         (Arm_input_section<big_endian>::init): Copy contents of original
6173         input section.
6174         (Arm_input_section<big_endian>::do_write): Use saved contents of
6175         original input section instead of calling Object::section_contents
6176         without locking.
6177         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6178         size without calling Object::section_size().
6179         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6180         for size.  Allocate a buffer for merged EXIDX entries.
6181         (Arm_exidx_merged_section::build_contents): New method.
6182         (Arm_exidx_merged_section::do_write): Move merge section contents
6183         building code to Arm_exidx_merged_section::build_contetns.  Write
6184         out contetns in buffer instead of building it on the fly.
6185         (Arm_relobj::make_exidx_input_section): Also pass text section size
6186         to Arm_exidx_input_section constructor.
6187         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6188         (Arm_dynobj::do_read_symbols): Fix memory leak.
6189         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6190         * target.h: (class Task): Add forward declaration.
6191         (Target::relax): Add new parameter TASK and pass it to
6192         Target::do_relax().
6193         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6194
6195 2010-11-05  Cary Coutant  <ccoutant@google.com>
6196
6197         PR gold/10708
6198         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6199         object when reading from the file.
6200         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6201         second layout pass.
6202         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6203         when reading section contents.
6204         (get_section_contents): Likewise.
6205         (icf::find_identical_sections): Likewise.
6206         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6207         object when reading from the file.
6208         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6209         the object when doing deferred section layout.
6210
6211 2010-11-03  Nick Clifton  <nickc@redhat.com>
6212
6213         PR gold/12001
6214         * script.h (class Symbol_assignment: name): New member.  Returns
6215         the name of the symbol.
6216         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6217         Returns true if the given symbol name is on the list of
6218         assignments wating to be processed.
6219         * archive.cc (should_incldue_member): If the symbol is undefined,
6220         check to see if it is on the list of symbols pending assignment.
6221
6222 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6223
6224         * script-sections.cc (Script_sections::find_memory_region): Check
6225         for a NULL output section pointer.
6226
6227 2010-10-29  Doug Kwan  <dougkwan@google.com>
6228
6229         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6230         Output_section::add_relaxed_input_section.
6231         * output.cc (Output_section::add_relaxed_input_section): Add new
6232         arguments LAYOUT and NAME.  Set section order index.
6233         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6234         Copy section order index.
6235         * output.h (Output_section::add_relaxed_input_section): Add new
6236         arguments LAYOUT and NAME.
6237
6238 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6239
6240         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6241         NATIVE_OR_CROSS_LINKER.
6242         * testsuite/Makefile.in: Regenerate.
6243
6244 2010-10-20  Doug Kwan  <dougkwan@google.com>
6245
6246         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6247         without SHF_LINK_ORDER flags.
6248         * layout.cc (Layout::choose_output_section): Do not filter
6249         SHF_LINK_ORDER flag in a relocatable link.
6250
6251 2010-10-17  Cary Coutant  <ccoutant@google.com>
6252
6253         * output.h (Output_segment::set_section_addresses): Change function
6254         signature.  Update all callers.
6255         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6256         sections.
6257         (Output_segment::set_section_addresses): Align after last TLS
6258         section.  Add padding before last relro section instead of after.
6259
6260 2010-10-17  Doug Kwan  <dougkwan@google.com>
6261
6262         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6263         GOT output section to be writable.
6264
6265 2010-10-14  Cary Coutant  <ccoutant@google.com>
6266
6267         * debug.h (DEBUG_INCREMENTAL): New flag.
6268         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6269         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6270         mode.
6271         * incremental.cc (report_command_line): Ignore all forms of
6272         --incremental.
6273         * layout.cc (Layout::Layout): Check parameters for incremental link
6274         mode.
6275         * options.cc (General_options::parse_incremental): New function.
6276         (General_options::parse_no_incremental): New function.
6277         (General_options::parse_incremental_full): New function.
6278         (General_options::parse_incremental_update): New function.
6279         (General_options::incremental_mode_): New data member.
6280         (General_options::finalize): Check incremental_mode_.
6281         * options.h (General_options): Update help text for --incremental.
6282         Add --no-incremental, --incremental-full, --incremental-update.
6283         (General_options::Incremental_mode): New enum type.
6284         (General_options::incremental_mode): New function.
6285         (General_options::incremental_mode_): New data member.
6286         * parameters.cc (Parameters::incremental_mode_): New data member.
6287         (Parameters::set_options): Set incremental_mode_.
6288         (Parameters::set_incremental_full): New function.
6289         (Parameters::incremental): New function.
6290         (Parameters::incremental_update): New function.
6291         (set_parameters_incremental_full): New function.
6292         * parameters.h (Parameters::set_incremental_full): New function.
6293         (Parameters::incremental): New function.
6294         (Parameters::incremental_update): New function.
6295         (Parameters::incremental_mode_): New data member.
6296         (set_parameters_incremental_full): New function.
6297         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6298         incremental link mode.
6299         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6300         (Sized_relobj::do_relocate_sections): Likewise.
6301         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6302         option.
6303         * testsuite/Makefile.in: Regenerate.
6304         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6305
6306 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6307
6308         * script-sections.h (class Script_sections): Make
6309         Sections_elements typedef public.
6310         * script-sections.cc (class Sort_output_sections): Add elements_
6311         field.  Add constructor which sets it; change all callers.
6312         (Sort_output_sections::is_before): New function.
6313         (Sort_output_sections::operator()): Call is_before.
6314         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6315         conditional.
6316         * testsuite/script_test_10.sh: New test. Test script section
6317         order.
6318         * testsuite/script_test_10.t: Likewise.
6319         * testsuite/script_test_10.s: Likewise.
6320         * testsuite/Makefile.am: Wrap the cross linker tests and the
6321         common tests into NATIVE_OR_CROSS_LINKER.
6322         (check_SCRIPTS): Add script_test_10.sh.
6323         (check_DATA): Add script_test_10.stdout.
6324         (script_test_10.o, script_test_10): New targets.
6325         (script_test_10.stdout): New target.
6326         * configure, testsuite/Makefile.in: Regenerate.
6327
6328 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6329
6330         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6331         error for the deprecated relocations.
6332         (Target_arm::Scan::global): Likewise.
6333         (Target_arm::Relocate::relocate): Likewise.
6334
6335 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6336
6337         * fileread.cc (Input_file::find_file): Initialize *found_name
6338         and *namep when using the fallback search for case 4.
6339
6340 2010-10-11  Cary Coutant  <ccoutant@google.com>
6341
6342         * options.h (class General_options): Redefine -z lazy as an alias for
6343         the negation of -z now.
6344
6345 2010-10-11  Ian Lance Taylor  <iant@google.com>
6346
6347         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6348         binding.
6349
6350 2010-10-06  Nick Clifton  <nickc@redhat.com>
6351
6352         * script-sections.cc(class Memory_region): Remove
6353         current_lma_offset_ field.  Rename current_vma_offset_ to
6354         current_offset_.  Add last_section_ field.
6355         (Memory_region::get_current_vma_address): Rename to
6356         get_current_address.
6357         (Memory_region::get_current_lma_address): Delete.
6358         (Memory_region::increment_vma_offset): Rename to
6359         increment_offset.
6360         (Memory_region::increment_lma_offset): Delete.
6361         (Memory_region::attributes_compatible): New method.  Returns
6362         true if the provided section is compatible with the region.
6363         (Memory_region::get_last_section): New method.  Returns the last
6364         section to use the region.
6365         (Memory_region::set_last_section): New method.  Stores the last
6366         section to use the region.
6367         (Script_sections::block_in_region): New method.  Returns true if
6368         a block of memory is contained within a region.
6369         (Script_sections::find_memory_region): New method.  Locates a
6370         memory region to be used to set a VMA or LMA address.
6371         (Output_section_definition::set_section_addresses): Add code to
6372         check for addresses set by memory regions.
6373         (Output_segment::set_section_addresses): Remove memory region
6374         walking code.
6375         (Script_sections::create_segment): Add a warning if a header
6376         segment is created outside of any region.
6377         * script-sections.h (class Script_sections): Add prototypes for
6378         find_memory_region and block_in_region methods.
6379         * testsuite/memory_test.s: Use .long instead of .word.
6380         * testsuite/memory_test.t: Add some more output sections.
6381         * testsuite/memory_test.sh: Update expected output.
6382
6383 2010-10-02  Doug Kwan  <dougkwan@google.com>
6384
6385         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6386         defintion to symtab.h
6387         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6388         declaration to defintion.
6389
6390 2010-10-01  Nick Clifton  <nickc@redhat.com>
6391
6392         * expression.cc (eval): Replace dummy argument with NULL.
6393         (eval_maybe_dot): Check for a NULL result section pointer.
6394         (Symbol_expression::value): Likewise.
6395         (Dot_expression::value): Likewise.
6396         (BINARY_EXPRESSION): Likewise.
6397         (Max_expression::value): Likewise.
6398         (Min_expression::value): Likewise.
6399         (Absolute_expression::value): Likewise.
6400         (Addr_expression::value_from_output_section): Likewise.
6401         (Loaddddr_expression::value_from_output_section): Likewise.
6402         (Segment_start_expression::value): Likewise.
6403         * script-sections.cc
6404         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6405         argument with NULL.
6406         (Sections_elememt_dot_assignment::set_section_addresses):
6407         Likewise.
6408         (Output_data_expression::do_write_to_buffer): Likewise.
6409         (Output_section_definition::finalize_symbols): Likewise.
6410         (Output_section_definition::set_section_addresses): Likewise.
6411
6412 2010-09-30  Doug Kwan  <dougkwan@google.com>
6413
6414         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6415
6416 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6417
6418         * target.h (Target::can_icf_inline_merge_sections): New virtual
6419         function.
6420         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6421         virtual function.
6422         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6423         virtual function.
6424         * icf.cc (get_section_contents): Inline merge sections only when
6425         target allows it.
6426
6427 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6428
6429         * configure: Regenerate.
6430
6431 2010-09-17  Ian Lance Taylor  <iant@google.com>
6432
6433         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6434         * testsuite/Makefile.am (memory_test.o): New target.
6435         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6436         memory_test.t.
6437         * testsuite/Makefile.in: Rebuild.
6438
6439 2010-09-17  Doug Kwan  <dougkwan@google.com>
6440
6441         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6442         defintion if relocation uses GOT entries of the symbol.
6443         * testsuite/icf_safe_test.sh: Fix test.
6444         * testsuite/icf_safe_so_test.sh: Fix test.
6445
6446 2010-09-16  Cary Coutant  <ccoutant@google.com>
6447
6448         * script_sections.cc (class Memory_region): Remove "NULL" from
6449         vector initializations.
6450
6451 2010-09-15  Cary Coutant  <ccoutant@google.com>
6452
6453         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6454         Resolve forwarding symbols.
6455
6456 2010-09-15  Doug Kwan  <dougkwan@google.com>
6457
6458         * gold/testsuite/script_test_3.t: Add ARM special sections.
6459         * gold/testsuite/script_test_4.t: Same.
6460         * gold/testsuite/script_test_5.t: Same.
6461         * gold/testsuite/script_test_6.t: Same.
6462         * gold/testsuite/script_test_7.t: Same.
6463         * gold/testsuite/script_test_7.t: Same.
6464         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6465
6466 2010-09-14  Cary Coutant  <ccoutant@google.com>
6467
6468         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6469         (Target_x86_64::Relocate::relocate_tls): Replace check for
6470         saw_tls_block_reloc_ with test for executable section.
6471
6472 2010-09-12  Cary Coutant  <ccoutant@google.com>
6473
6474         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6475         position-independent executables to shared libraries need dynamic
6476         relocations.
6477         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6478         position-independent executables.
6479         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6480         * testsuite/Makefile.in: Regenerate.
6481
6482 2010-09-10  Nick Clifton  <nickc@redhat.com>
6483
6484         PR gold/11997
6485         * testsuite/memory_test.t: Discard any sections that are not
6486         needed.
6487
6488 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6489
6490         PR gold/11996
6491         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6492         "This::" to work around a bug in gcc 4.2.
6493
6494         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6495
6496 2010-09-09  Rafael Espindola  <espindola@google.com>
6497
6498         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6499         sections with different PF_X flags in the same segment.
6500         (Layout::find_first_load_seg): Search all segments to find the first
6501         one.
6502         * options.h (rosegment): New.
6503
6504 2010-09-08  Rafael Espindola  <espindola@google.com>
6505
6506         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6507
6508 2010-09-08  Doug Kwan  <dougkwan@google.com>
6509
6510         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6511         (Arm_relobj::do_relocate_sections): Add new parameter for output
6512         file to match the parent.
6513         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6514         of local symbols instead of input values.  Update code to track
6515         changes in gold::relocate_section.
6516         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6517         (Sized_relobj::compute_final_local_value_internal): New methods.
6518         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6519         body into private version of Sized_relobj::compute_final_local_value.
6520         Call the inline method.
6521         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6522         merged symbol value if there is one.
6523         (Symbol_value::has_output_value): New method defintiion.
6524         (Sized_relobj::Compute_final_local_value_status): New enum type.
6525         (Sized_relobj::compute_final_local_value): New methods.
6526         (Sized_relobj::compute_final_local_value_internal): New methods.
6527         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6528         and arm_cortex_a8.sh.
6529         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6530         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6531         New tests.
6532         * Makefile.in: Regenerate.
6533         * testsuite/arm_bl_out_of_range.s: Update test.
6534         * testsuite/thumb_bl_out_of_range.s: Ditto.
6535         * testsuite/thumb_blx_out_of_range.s: Ditto.
6536         * testsuite/arm_branch_out_of_range.sh: New file.
6537         * testsuite/arm_cortex_a8.sh: Ditto.
6538         * testsuite/arm_cortex_a8_b.s: Ditto.
6539         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6540         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6541         * testsuite/arm_cortex_a8_bl.s: Ditto.
6542         * testsuite/arm_cortex_a8_blx.s: Ditto.
6543         * testsuite/arm_cortex_a8_local.s: Ditto.
6544         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6545         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6546
6547 2010-09-08  Rafael Espindola  <espindola@google.com>
6548
6549         * Makefile.am (memory_test.stdout): Run readelf with -W.
6550         * Makefile.in: Regenerate.
6551         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6552         64 bit output.
6553
6554 2010-09-08  Rafael Espindola  <espindola@google.com>
6555
6556         * script-sections.cc (Script_sections::add_memory_region): Convert
6557         field precision to int.
6558         * script.cc (script_set_section_region, script_set_section_region):
6559         Convert field precision to int.
6560
6561 2010-09-08  Rafael Espindola  <espindola@google.com>
6562
6563         * arm.cc (do_finalize_sections): Create the __exidx_start and
6564         __exdix_end symbols even when the section is missing.
6565
6566 2010-09-08  Nick Clifton  <nickc@redhat.com>
6567
6568         * README: Remove claim that MEMORY is not supported.
6569         * expression.cc (script_exp_function_origin)
6570         (script_exp_function_length): Move from here to ...
6571         * script.cc: ... here.
6572         (script_set_section_region, script_add_memory)
6573         (script_parse_memory_attr, script_include_directive): New
6574         functions.
6575         * script-sections.cc
6576         (class Memory_region): New class.
6577         (class Output_section_definition): Add set_memory_region,
6578         set_section_vma, set_section_lma and get_section_name methods.
6579         (class Script_Sections): Add add_memory_region,
6580         find_memory_region, find_memory_region_origin,
6581         find_memory_region_length and set_memory_region methods.
6582         Have set_section_addresses method walk the list of set memory
6583         regions.
6584         Extend the print methos to display memory regions.
6585         * script-sections.h: Add prototypes for new methods.
6586         Add enum for MEMORY region attributes.
6587         * yyscript.y: Add support for parsing MEMORY regions.
6588         * script-c.h: Add prototypes for new functions.
6589         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6590         * testsuite/Makefile.in: Regenerate.
6591         * testsuite/memory_test.sh: New script.
6592         * testsuite/memory_test.s: New assembler source file.
6593         * testsuite/memory_test.t: New linker script.
6594
6595 2010-08-27  Doug Kwan  <dougkwan@google.com>
6596
6597         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6598         reference override an existing dynamic weak reference.
6599         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6600         * testsuite/Makefile.in: Regenerate.
6601         * testsuite/dyn_weak_ref.sh: New file.
6602         * testsuite/dyn_weak_ref_1.c: Ditto.
6603         * testsuite/dyn_weak_ref_2.c: Ditto.
6604
6605 2010-08-27  Ian Lance Taylor  <iant@google.com>
6606
6607         * incremental.h (class Incremental_input_entry): Add virtual
6608         destructor.
6609
6610 2010-08-27  Ian Lance Taylor  <iant@google.com>
6611
6612         * testsuite/start_lib_test_3.c: Mark t3 as used.
6613
6614 2010-08-27  Nick Clifton  <nickc@redhat.com>
6615
6616         * options.cc (version_script): Fix small typo in previous
6617         whitespace tidyup.
6618
6619 2010-08-25  Nick Clifton  <nickc@redhat.com>
6620
6621         * archive.cc: Formatting fixes: Remove whitespace between
6622         typename and following asterisk.  Remove whitespace between
6623         function name and opening parenthesis.
6624         * archive.h: Likewise.
6625         * arm.cc: Likewise.
6626         * attributes.cc: Likewise.
6627         * attributes.h: Likewise.
6628         * common.cc: Likewise.
6629         * copy-relocs.cc: Likewise.
6630         * dirsearch.h: Likewise.
6631         * dynobj.cc: Likewise.
6632         * ehframe.cc: Likewise.
6633         * ehframe.h: Likewise.
6634         * expression.cc: Likewise.
6635         * fileread.cc: Likewise.
6636         * fileread.h: Likewise.
6637         * gc.h: Likewise.
6638         * gold-threads.cc: Likewise.
6639         * gold.cc: Likewise.
6640         * i386.cc: Likewise.
6641         * icf.h: Likewise.
6642         * incremental-dump.cc: Likewise.
6643         * incremental.cc: Likewise.
6644         * layout.cc: Likewise.
6645         * layout.h: Likewise.
6646         * main.cc: Likewise.
6647         * merge.cc: Likewise.
6648         * merge.h: Likewise.
6649         * object.cc: Likewise.
6650         * object.h: Likewise.
6651         * options.cc: Likewise.
6652         * options.h: Likewise.
6653         * output.cc: Likewise.
6654         * output.h: Likewise.
6655         * plugin.cc: Likewise.
6656         * plugin.h: Likewise.
6657         * powerpc.cc: Likewise.
6658         * reloc.cc: Likewise.
6659         * script-c.h: Likewise.
6660         * script-sections.cc: Likewise.
6661         * script.cc: Likewise.
6662         * stringpool.cc: Likewise.
6663         * symtab.cc: Likewise.
6664         * symtab.h: Likewise.
6665         * target.cc: Likewise.
6666         * timer.cc: Likewise.
6667         * timer.h: Likewise.
6668         * version.cc: Likewise.
6669         * x86_64.cc: Likewise.
6670
6671 2010-08-24  Nick Clifton  <nickc@redhat.com>
6672
6673         PR 11899
6674         * layout.cc (segment_precedes): Sort segments by their physical
6675         addresses, if they have been set.
6676
6677 2010-08-23  Cary Coutant  <ccoutant@google.com>
6678
6679         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6680         symbols data.
6681         (Lib_group::include_member): Unlock object after deleting its
6682         symbols data.
6683         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6684         the bug fixed here.
6685
6686 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6687             Cary Coutant  <ccoutant@google.com>
6688
6689         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6690         constructor, and set_blocker.
6691         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6692         readsyms_blocker_.
6693         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6694         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6695         * testsuite/Makefile.am (start_lib_test): New test case.
6696         * testsuite/Makefile.in: Regenerate.
6697         * testsuite/start_lib_test_main.c: New file.
6698         * testsuite/start_lib_test_1.c: New file.
6699         * testsuite/start_lib_test_2.c: New file.
6700         * testsuite/start_lib_test_3.c: New file.
6701
6702 2010-08-19  Ian Lance Taylor  <iant@google.com>
6703
6704         * Makefile.in: Rebuild with automake 1.11.1.
6705         * aclocal.m4: Likewise.
6706         * testsuite/Makefile.in: Likewise.
6707
6708 2010-08-19  Ian Lance Taylor  <iant@google.com>
6709
6710         PR 10893
6711         * i386.cc (class Output_data_plt_i386): Update declarations.
6712         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6713         local_ifuncs_ fields.
6714         (Target_i386::do_plt_section_for_global): New function.
6715         (Target_i386::do_plt_section_for_local): New function.
6716         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6717         parameter; change all callers.  Initialize global_ifuncs_ and
6718         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6719         __rel_iplt_end.
6720         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6721         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6722         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6723         symbols.
6724         (Target_i386::make_plt_section): New function, broken out of
6725         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6726         (Target_i386::make_plt_entry): Call make_plt_section.
6727         (Target_i386::make_local_ifunc_plt_entry): New function.
6728         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6729         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6730         R_386_IRELATIVE to switch.
6731         (Target_i386::Scan::global): Likewise.
6732         (Target_i386::Relocate::relocate): Likewise.
6733         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6734         switch.
6735         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6736         (Target_x86_64::do_plt_section_for_global): New function.
6737         (Target_x86_64::do_plt_section_for_local): New function.
6738         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6739         parameter; change all callers.  If doing a static link define
6740         __rela_iplt_start and __rela_iplt_end.
6741         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6742         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6743         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6744         to point to .plt.
6745         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6746         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6747         switch.
6748         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6749         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6750         R_X86_64_IRELATIVE to switch.
6751         (Target_x86_64::Scan::global): Likewise.
6752         (Target_x86_64::Relocate::relocate): Likewise.
6753         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6754         switch.
6755         * target.h (class Target): Add plt_section_for_global and
6756         plt_section_for_local functions.  Add do_plt_section_for_global
6757         and do_plt_section_for_local virtual functions.
6758         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6759         clarifying comments.
6760         (Symbol::use_plt_offset): Handle IFUNC symbol.
6761         * object.cc (Sized_relobj::Sized_relobj): Initialize
6762         local_plt_offsets_.
6763         (Sized_relobj::local_has_plt_offset): New function.
6764         (Sized_relobj::local_plt_offset): New function.
6765         (Sized_relobj::set_local_plt_offset): New function.
6766         (Sized_relobj::do_count): Handle IFUNC symbol.
6767         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6768         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6769         is_ifunc_symbol functions.
6770         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6771         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6772         local_plt_offsets_ field.
6773         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6774         * output.h (class Output_section_data): Add non-const
6775         output_section function.
6776         (class Output_data_got): Update declarations.
6777         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6778         Add use_plt_offset parameter to global and local constructors.
6779         Change all callers.  Change local_sym_index_ field to 31 bits.
6780         Change GSYM_CODE and CONSTANT_CODE accordingly.
6781         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6782         doing a static link don't set sh_link field.
6783         (Output_data_got::Got_entry::write): Use PLT offset if
6784         appropriate.
6785         (Output_data_got::add_global_plt): New function.
6786         (Output_data_got::add_local_plt): New function.
6787         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6788         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6789         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6790         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6791         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6792         IFUNC conditional.
6793         * testsuite/ifunc-sel.h: New file.
6794         * testsuite/ifuncmain1.c: New file.
6795         * testsuite/ifuncmain1vis.c: New file.
6796         * testsuite/ifuncmod1.c: New file.
6797         * testsuite/ifuncdep2.c: New file.
6798         * testsuite/ifuncmain2.c: New file.
6799         * testsuite/ifuncmain3.c: New file.
6800         * testsuite/ifuncmod3.c: New file.
6801         * testsuite/ifuncmain4.c: New file.
6802         * testsuite/ifuncmain5.c: New file.
6803         * testsuite/ifuncmod5.c: New file.
6804         * testsuite/ifuncmain6pie.c: New file.
6805         * testsuite/ifuncmod6.c: New file.
6806         * testsuite/ifuncmain7.c: New file.
6807         * configure, testsuite/Makefile.in: Rebuild.
6808
6809 2010-08-18  Ian Lance Taylor  <iant@google.com>
6810
6811         * incremental.cc
6812         (Output_section_incremental_inputs::write_input_files): Add cast
6813         to avoid signed/unsigned comparison warning.
6814         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6815
6816 2010-08-12  Cary Coutant  <ccoutant@google.com>
6817
6818         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6819
6820 2010-08-13  Ian Lance Taylor  <iant@google.com>
6821
6822         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6823
6824 2010-08-12  Cary Coutant  <ccoutant@google.com>
6825             Doug Kwan  <dougkwan@google.com>
6826
6827         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6828         defintion overrides non-weak undef, remember that the original undef
6829         is not weak.
6830         * symtab.cc (Symbol_table::sized_write_global): For undef without
6831         an original weak binding, set binding to global in output.
6832         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6833         * testsuite/Makefile.in: Regenerate.
6834         * testsuite/strong_ref_weak_def.sh: New file.
6835         * testsuite/strong_ref_weak_def_1.c: Ditto.
6836         * testsuite/strong_ref_weak_def_2.c: Ditto.
6837
6838 2010-08-12  Cary Coutant  <ccoutant@google.com>
6839
6840         * testsuite/incremental_test.sh: Rewrite.
6841         * testsuite/incremental_test_1.c: Rewrite.
6842         * testsuite/incremental_test_2.c: Rewrite.
6843
6844 2010-08-12  Cary Coutant  <ccoutant@google.com>
6845
6846         * arm.cc (Target_arm::got_size): Add const.
6847         (Target_arm::got_entry_count): New function.
6848         (Target_arm::plt_entry_count): New function.
6849         (Target_arm::first_plt_entry_offset): New function.
6850         (Target_arm::plt_entry_size): New function.
6851         (Output_data_plt_arm::entry_count): New function.
6852         (Output_data_plt_arm::first_plt_entry_offset): New function.
6853         (Output_data_plt_arm::get_plt_entry_size): New function.
6854         * i386.cc (Target_i386::got_size): Add const.
6855         (Target_i386::got_entry_count): New function.
6856         (Target_i386::plt_entry_count): New function.
6857         (Target_i386::first_plt_entry_offset): New function.
6858         (Target_i386::plt_entry_size): New function.
6859         (Output_data_plt_i386::entry_count): New function.
6860         (Output_data_plt_i386::first_plt_entry_offset): New function.
6861         (Output_data_plt_i386::get_plt_entry_size): New function.
6862         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6863         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6864         * incremental.cc: Include target.h.
6865         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6866         parameter.  Adjust all callers.  Find incremental_got_plt section.
6867         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6868         section.
6869         (Output_section_incremental_inputs::set_final_data_size): Calculate
6870         size of incremental_got_plt section.
6871         (Output_section_incremental_inputs::do_write): Write the
6872         incremental_got_plt section.
6873         (Got_plt_view_info): New struct.
6874         (Local_got_offset_visitor): New class.
6875         (Global_got_offset_visitor): New class.
6876         (Global_symbol_visitor_got_plt): New class.
6877         (Output_section_incremental_inputs::write_got_plt): New function.
6878         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6879         Add parameter.  Adjust all callers.
6880         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6881         (Incremental_inputs::got_plt_section): New function.
6882         (Incremental_inputs::got_plt_section_): New data member.
6883         (Incremental_got_plt_reader): New class.
6884         * layout.cc (Layout::create_incremental_info_sections): Add the
6885         incremental_got_plt section.
6886         * object.h (Got_offset_list::get_list): New function.
6887         (Got offset_list::for_all_got_offsets): New function.
6888         (Sized_relobj::local_got_offset_list): New function.
6889         * powerpc.cc (Target_powerpc::got_size): Add const.
6890         (Target_powerpc::got_entry_count): New function.
6891         (Target_powerpc::plt_entry_count): New function.
6892         (Target_powerpc::first_plt_entry_offset): New function.
6893         (Target_powerpc::plt_entry_size): New function.
6894         (Output_data_plt_powerpc::entry_count): New function.
6895         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6896         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6897         * sparc.cc (Target_sparc::got_size): Add const.
6898         (Target_sparc::got_entry_count): New function.
6899         (Target_sparc::plt_entry_count): New function.
6900         (Target_sparc::first_plt_entry_offset): New function.
6901         (Target_sparc::plt_entry_size): New function.
6902         (Output_data_plt_sparc::entry_count): New function.
6903         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6904         (Output_data_plt_sparc::get_plt_entry_size): New function.
6905         * symtab.h (Symbol::got_offset_list): New function.
6906         (Symbol_table::for_all_symbols): New function.
6907         * target.h (Sized_target::got_entry_count): New function.
6908         (Sized_target::plt_entry_count): New function.
6909         (Sized_target::plt_entry_size): New function.
6910         * x86_64.cc (Target_x86_64::got_size): Add const.
6911         (Target_x86_64::got_entry_count): New function.
6912         (Target_x86_64::plt_entry_count): New function.
6913         (Target_x86_64::first_plt_entry_offset): New function.
6914         (Target_x86_64::plt_entry_size): New function.
6915         (Output_data_plt_x86_64::entry_count): New function.
6916         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6917         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6918
6919 2010-08-12  Cary Coutant  <ccoutant@google.com>
6920
6921         * archive.cc: Include incremental.h.
6922         (Archive::Archive): Initialize incremental_info_.
6923         (Archive::include_member): Record archive members in incremental info.
6924         (Add_archive_symbols::run): Record begin and end of an archive in
6925         incremental info.
6926         (Lib_group::include_member): Record objects in incremental info.
6927         * archive.h (Incremental_archive_entry): Forward declaration.
6928         (Archive::set_incremental_info): New member function.
6929         (Archive::incremental_info): New member function.
6930         (Archive::Unused_symbol_iterator): New class.
6931         (Archive::unused_symbols_begin): New member function.
6932         (Archive::unused_symbols_end): New member function.
6933         (Archive::incremental_info_): New data member.
6934         * incremental-dump.cc (find_input_containing_global): New function.
6935         (dump_incremental_inputs): Dump new incremental info sections.
6936         * incremental.cc: Include symtab.h.
6937         (Output_section_incremental_inputs): New class.
6938         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6939         new incremental info sections.
6940         (Sized_incremental_binary::do_check_inputs): Likewise.
6941         (Incremental_inputs::report_archive): Remove.
6942         (Incremental_inputs::report_archive_begin): New function.
6943         (Incremental_inputs::report_archive_end): New function.
6944         (Incremental_inputs::report_object): New function.
6945         (Incremental_inputs::finalize_inputs): Remove.
6946         (Incremental_inputs::report_input_section): New function.
6947         (Incremental_inputs::report_script): Rewrite.
6948         (Incremental_inputs::finalize): Do nothing but finalize string table.
6949         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6950         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6951         (Incremental_inputs::create_data_sections): New function.
6952         (Incremental_inputs::relocs_entsize): New function.
6953         (Output_section_incremental_inputs::set_final_data_size): New function.
6954         (Output_section_incremental_inputs::do_write): New function.
6955         (Output_section_incremental_inputs::write_header): New function.
6956         (Output_section_incremental_inputs::write_input_files): New function.
6957         (Output_section_incremental_inputs::write_info_blocks): New function.
6958         (Output_section_incremental_inputs::write_symtab): New function.
6959         * incremental.h (Incremental_script_entry): Forward declaration.
6960         (Incremental_object_entry): Forward declaration.
6961         (Incremental_archive_entry): Forward declaration.
6962         (Incremental_inputs): Forward declaration.
6963         (Incremental_inputs_header_data): Remove.
6964         (Incremental_inputs_header): Remove.
6965         (Incremental_inputs_header_write): Remove.
6966         (Incremental_inputs_entry_data): Remove.
6967         (Incremental_inputs_entry): Remove.
6968         (Incremental_inputs_entry_write): Remove.
6969         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6970         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6971         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6972         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6973         Likewise.
6974         (Incremental_input_entry): New class.
6975         (Incremental_script_entry): New class.
6976         (Incremental_object_entry): New class.
6977         (Incremental_archive_entry): New class.
6978         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6979         (Incremental_inputs::report_inputs): Remove.
6980         (Incremental_inputs::report_archive): Remove.
6981         (Incremental_inputs::report_archive_begin): New function.
6982         (Incremental_inputs::report_archive_end): New function.
6983         (Incremental_inputs::report_object): Change prototype.
6984         (Incremental_inputs::report_input_section): New function.
6985         (Incremental_inputs::report_script): Change prototype.
6986         (Incremental_inputs::get_reloc_count): New function.
6987         (Incremental_inputs::set_reloc_count): New function.
6988         (Incremental_inputs::create_data_sections): New function.
6989         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6990         (Incremental_inputs::inputs_section): New function.
6991         (Incremental_inputs::symtab_section): New function.
6992         (Incremental_inputs::relocs_section): New function.
6993         (Incremental_inputs::get_stringpool): Add const.
6994         (Incremental_inputs::command_line): Add const.
6995         (Incremental_inputs::inputs): Remove.
6996         (Incremental_inputs::command_line_key): New function.
6997         (Incremental_inputs::input_file_count): New function.
6998         (Incremental_inputs::input_files): New function.
6999         (Incremental_inputs::relocs_entsize): New function.
7000         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7001         (Incremental_inputs::finalize_inputs): Remove.
7002         (Incremental_inputs::Input_info): Remove.
7003         (Incremental_inputs::lock_): Remove.
7004         (Incremental_inputs::inputs_): Change type.
7005         (Incremental_inputs::inputs_map_): Remove.
7006         (Incremental_inputs::current_object_entry_): New data member.
7007         (Incremental_inputs::inputs_section_): New data member.
7008         (Incremental_inputs::symtab_section_): New data member.
7009         (Incremental_inputs::relocs_section_): New data member.
7010         (Incremental_inputs::reloc_count_): New data member.
7011         (Incremental_inputs_reader): New class.
7012         (Incremental_symtab_reader): New class.
7013         (Incremental_relocs_reader): New class.
7014         * layout.cc (Layout::finalize): Move finalization of incremental info
7015         and creation of incremental info sections to follow finalization of
7016         symbol table.  Set offsets for postprocessing sections.
7017         (Layout::create_incremental_info_sections): Call
7018         Incremental_inputs::create_data_sections.  Add incremental symtab
7019         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7020         sections to layout after input sections.
7021         * layout.h (struct Timespec): Forward declaration.
7022         (Layout::incremental_inputs): Add const.
7023         (Layout::create_incremental_info_sections): Add parameter.
7024         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7025         * object.cc: Include incremental.h.
7026         (Relobj::finalize_incremental_relocs): New function.
7027         (Sized_relobj::do_layout): Record input sections in incremental info.
7028         * object.h (Object::output_section): New function.
7029         (Object::output_section_offset): Moved from Relobj.
7030         (Object::get_incremental_reloc_base): New function.
7031         (Object::get_incremental_reloc_count): New function.
7032         (Object::do_output_section): New function.
7033         (Object::do_output_section_offset): Moved from Relobj.
7034         (Object::do_get_incremental_reloc_base): New function.
7035         (Object::do_get_incremental_reloc_count): New function.
7036         (Object::Object): Initialize new data members.
7037         (Relobj::output_section): Renamed do_output_section and moved to
7038         protected.
7039         (Relobj::output_section_offset): Moved to Object.
7040         (Relobj::do_get_incremental_reloc_base): New function.
7041         (Relobj::do_get_incremental_reloc_count): New function.
7042         (Relobj::allocate_incremental_reloc_counts): New function.
7043         (Relobj::count_incremental_reloc): New function.
7044         (Relobj::finalize_incremental_relocs): New function.
7045         (Relobj::next_incremental_reloc_index): New function.
7046         (Relobj::reloc_counts_): New data member.
7047         (Relobj::reloc_bases_): New data member.
7048         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7049         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7050         (Sized_relobj::incremental_relocs_scan): New function.
7051         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7052         (Sized_relobj::incremental_relocs_write): New function.
7053         (Sized_relobj::incremental_relocs_write_reltype): New function.
7054         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7055         incremental link.
7056         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7057         archives and object files elsewhere.
7058         (Add_symbols::run): Report object files here.
7059         (Finish_group::run): Report end of archive at end of group.
7060         * reloc.cc: Include layout.h, incremental.h.
7061         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7062         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7063         (Sized_relobj::incremental_relocs_scan): New function.
7064         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7065         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7066         (Sized_relobj::incremental_relocs_write): New function.
7067         (Sized_relobj::incremental_relocs_write_reltype): New function.
7068         * script.cc (read_input_script): Rewrite test for incremental link.
7069         Change call to Incremental_inputs::report_script.
7070         * symtab.h (Symbol_table::first_global_index): New function.
7071         (Symbol_table::output_count): New function.
7072
7073 2010-08-12  Doug Kwan  <dougkwan@google.com>
7074
7075         * arm.cc (Target_arm::merge_object_attributes): Check command line
7076         options --no-wchar-size-warning and --no-enum-size-warning.
7077         * options.h (General_options): Add ld-compatible options
7078         --no-enum-size-warning and --no-wchar-size-warning.
7079
7080 2010-08-04  Ian Lance Taylor  <iant@google.com>
7081
7082         * x86_64.cc (Target_x86_64::Scan::local): Use
7083         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7084         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7085         (Target_x86_64::Scan::global): Likewise.
7086         (Target_x86_64::Relocate::relocate): Likewise.
7087         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7088         Likewise.
7089
7090 2010-08-03  Cary Coutant  <ccoutant@google.com>
7091
7092         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7093         to reserve space in merged_strings vector. Keep total input size
7094         for stats.
7095         (Output_merge_string::do_print_merge_stats): Print total input size.
7096         * merge.h (Output_merge_string): Add input_size_ field.
7097         * stringpool.cc (Stringpool_template::string_length): Move
7098         implementations out of Stringpool_template class and place in
7099         stringpool.h.
7100         * stringpool.h (string_length): Move out of Stringpool_template.
7101
7102 2010-08-03  Ian Lance Taylor  <iant@google.com>
7103
7104         PR 11712
7105         * layout.cc (relaxation_loop_body): If address of load segment is
7106         set, adjust address to include headers if possible.
7107
7108 2010-08-03  Ian Lance Taylor  <iant@google.com>
7109
7110         * version.cc (version_string): Bump to 1.10.
7111
7112 2010-08-03  Ian Lance Taylor  <iant@google.com>
7113
7114         PR 11805
7115         * layout.h (enum Output_section_order): Define.
7116         (class Layout): Update declarations.
7117         * layout.cc (Layout::get_output_section): Add order parameter.
7118         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7119         is_first_non_relro parameters.  Change all callers.
7120         (Layout::choose_output_section): Likewise.
7121         (Layout::add_output_section_data): Likewise.
7122         (Layout::make_output_section): Likewise.  Set order.
7123         (Layout::default_section_order): New function.
7124         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7125         * output.cc (Output_section::Output_section): Initialize order_.
7126         Don't initialize deleted fields.
7127         (Output_segment::Output_segment): Don't initialize deleted
7128         fields.
7129         (Output_segment::add_output_section_to_load): New function
7130         replacing add_output_section.  Change all callers to call this or
7131         add_output_section_to_nonload.
7132         (Output_segment::add_output_section_to_nonload): New function.
7133         (Output_segment::remove_output_section): Rewrite.
7134         (Output_segment::add_initial_output_data): Likewise.
7135         (Output_segment::has_any_data_sections): Likewise.
7136         (Output_segment::is_first_section_relro): Likewise.
7137         (Output_segment::maximum_alignment): Likewise.
7138         (Output_segment::has_dynamic_reloc): New function replacing
7139         dynamic_reloc_count.  Change all callers.
7140         (Output_segment::has_dynamic_reloc_list): New function replacing
7141         dynamic_reloc_count_list.  Change all callers.
7142         (Output_segment::set_section_addresses): Rewrite.
7143         (Output_segment::set_offset): Rewrite.
7144         (Output_segment::find_first_and_last_list): Remove.
7145         (Output_segment::set_tls_offsets): Rewrite.
7146         (Output_segment::first_section_load_address): Likewise.
7147         (Output_segment::output_section_count): Likewise.
7148         (Output_segment::section_with_lowest_load_address): Likewise.
7149         (Output_segment::write_section_headers): Likewise.
7150         (Output_segment::print_sections_to_map): Likewise.
7151         * output.h (class Output_data): Remove dynamic_reloc_count_
7152         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7153         (Output_data::add_dynamic_reloc): Rewrite.
7154         (Output_data::has_dynamic_reloc): New function.
7155         (Output_data::dynamic_reloc_count): Remove.
7156         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7157         is_last_relro_, is_first_non_relro_, is_interp_,
7158         is_dynamic_linker_section_ fields.  Add order and set_order
7159         functions.  Remove is_relro_local, set_is_relro_local,
7160         is_last_relro, set_is_last_relro, is_first_non_relro,
7161         set_is_first_non_relro functions, is_interp, set_is_interp,
7162         is_dynamic_linker_section, and set_is_dynamic_linker_section
7163         functions.
7164         (class Output_segment): Change Output_data_list from std::list to
7165         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7166         output_bss_ fields.  Update declarations.
7167
7168 2010-08-02  Ian Lance Taylor  <iant@google.com>
7169
7170         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7171         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7172         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7173
7174 2010-08-02  Ian Lance Taylor  <iant@google.com>
7175
7176         PR 11855
7177         * script.cc (Script_options::Script_options): Initialize
7178         symbol_definitions_ and symbol_references_.
7179         (Script_options::add_symbol_assignment): Update
7180         symbol_definitions_ and symbol_references_.
7181         (Script_options::add_symbol_reference): New function.
7182         (script_symbol): New function.
7183         * script.h (class Script_options): Add symbol_definitions_ and
7184         symbol_references_ fields.
7185         (Script_options::referenced_const_iterator): New type.
7186         (Script_options::referenced_begin): New function.
7187         (Script_options::referenced_end): New function.
7188         (Script_options::is_referenced): New function.
7189         (Script_options::any_unreferenced): New function.
7190         * script-c.h (script_symbol): Declare.
7191         * yyscript.y (exp): Call script_symbol.
7192         * symtab.cc: Include "script.h".
7193         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7194         Change all callers.  Check symbols referenced by scripts.
7195         (Symbol_table::add_undefined_symbols_from_command_line): Add
7196         layout parameter.  Change all callers.
7197         (Symbol_table::do_add_undefined_symbols_from_command_line):
7198         Likewise.  Break out loop body.  Check symbols referenced by
7199         scripts.
7200         (Symbol_table::add_undefined_symbol_from_command_line): New
7201         function broken out of
7202         do_add_undefined_symbols_from_command_line.
7203         * symtab.h (class Symbol_table): Update declarations.
7204         * archive.cc: Include "layout.h".
7205         (Archive::should_include_member): Add layout parameter.  Change
7206         all callers.  Check for symbol mentioned in expression.
7207         * archive.h (class Archive): Update declaration.
7208         * object.cc (Sized_relobj::do_should_include_member): Add layout
7209         parameter.
7210         * object.h (Object::should_include_member): Add layout parameter.
7211         Change all callers.
7212         (Object::do_should_include_member): Add layout parameter.
7213         (class Sized_relobj): Update declaration.
7214         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7215         parameter.
7216         * dynobj.h (class Sized_dynobj): Update declaration.
7217         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7218         layout parameter.
7219         * plugin.h (class Sized_pluginobj): Update declaration.
7220
7221 2010-08-02  Ian Lance Taylor  <iant@google.com>
7222
7223         PR 11866
7224         * output.cc (Output_segment::set_offset): Search for the first and
7225         last sections rather than assuming that the list is in order.
7226         (Output_segment::find_first_and_last_list): New function.
7227         * output.h (class Output_segment): Update declarations.
7228         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7229         (relro_strip_test_SOURCES): New variable.
7230         (relro_strip_test_DEPENDENCIES): New variable.
7231         (relro_strip_test_LDFLAGS): New variable.
7232         (relro_strip_test_LDADD): New variable.
7233         (relro_strip_test.so): New target.
7234
7235 2010-08-02  Ian Lance Taylor  <iant@google.com>
7236
7237         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7238         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7239         (Target_i386::got_tlsdesc_section): New function.
7240         (Target_i386::got_section): Create space for GOT entries for
7241         TLSDESC relocations.
7242         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7243         R_386_TLS_GOTDESC.
7244         (Target_i386::Scan::global): Likewise.
7245         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7246         using TLSDESC GOT.
7247         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7248         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7249         (Target_x86_64::got_tlsdesc_section): New function.
7250         (Target_x86_64::got_section): Create space for GOT entries for
7251         TLSDESC relocations.
7252         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7253         R_386_TLS_GOTDESC.
7254         (Target_x86_64::Scan::global): Likewise.
7255         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7256         using TLSDESC GOT.
7257
7258 2010-08-02  Ian Lance Taylor  <iant@google.com>
7259
7260         * testsuite/final_layout.sh: Use dc to convert from hex to
7261         decimal.
7262
7263 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7264
7265         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7266         paramter to the call to gold::gc_process_relocs.
7267         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7268         paramter to the call to gold::gc_process_relocs.
7269         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7270         parameter to the call to gold::gc_process_relocs.
7271         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7272         template parameter to the call to gold::gc_process_relocs.
7273         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7274         paramter to the call to gold::gc_process_relocs.
7275         * gc.h (get_embedded_addend_size): New function.
7276         (gc_process_relocs): Save the size of the reloc for use by ICF.
7277         * icf.cc (get_section_contents): Get the addend from the text section
7278         for SHT_REL relocation sections.
7279         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7280         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7281         * int_encoding.h (read_from_pointer): New overloaded function.
7282         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7283         * testsuite/icf_sht_rel_addend_test.sh: New file.
7284         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7285         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7286
7287 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7288
7289         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7290         * Makefile.in: Regenerate.
7291         * testsuite/Makefile.in: Regenerate.
7292
7293 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7294
7295         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7296         * gold/testsuite/debug_msg.cc: Likewise.
7297         * gold/testsuite/odr_violation1.cc
7298         * gold/testsuite/odr_violation2.cc
7299
7300 2010-07-21  Cary Coutant  <ccoutant@google.com>
7301
7302         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7303         string, and length fields.
7304         (Output_merge_string::Merged_strings_list): New type.
7305         (Output_merge_string::Merged_strings_lists): New typedef.
7306         (Output_merge_string): Replace merged_strings_ with
7307         merged_strings_lists_.
7308         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7309         Merged_strings_list per input object and section.  Don't store pointer
7310         to the string.  Don't store length with each merged string entry.
7311         (Output_merge_string::finalize_merged_data): Loop over list of merged
7312         strings lists.  Recompute length of each merged string.
7313
7314 2010-07-15  Cary Coutant  <ccoutant@google.com>
7315
7316         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7317         here.
7318
7319 2010-07-14  Ian Lance Taylor  <iant@google.com>
7320
7321         * descriptors.cc (Descriptors::open): Report correct name in error
7322         message.
7323
7324 2010-07-13  Doug Kwan  <dougkwan@google.com>
7325
7326         * arm.cc (Arm_input_section::Arm_input_section): For a
7327         SHT_ARM_EXIDX section, always keeps the input sections.
7328         (Arm_input_section::set_exidx_section_link): New method.
7329         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7330         has_errors_ to false.
7331         (Arm_exidx_input_section::has_errors,
7332         Arm_exidx_input_section::set_has_errors): New methods.
7333         (Arm_exidx_input_section::has_errors_): New data member.
7334         (Arm_relobj::get_exidx_shndx_list): New method.
7335         (Arm_output_section::append_text_sections_to_list): Do not skip
7336         section without SHF_EXECINSTR.
7337         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7338         errors.
7339         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7340         section header.  Make error messages more verbose.  Check for
7341         a non-executable section linked to an EXIDX section.
7342         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7343         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7344         check that there is no deferred EXIDX section if we exit early.
7345         Instead of not making an EXIDX section in case of an error, make one
7346         and set the has_errors flag of it.
7347         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7348         in a relocatable link.
7349         (Target_arm::do_relax): Look for the EXIDX output section instead of
7350         assuming that it is called .ARM.exidx.
7351         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7352         section list.  Do not check for SHF_EXECINSTR section flags but
7353         skip any input section with errors.
7354         * output.cc (Output_section::Output_section): Initialize
7355         always_keeps_input_sections_ to false.
7356         (Output_section::add_input_section): Check for
7357         always_keeps_input_sections_.
7358         *  output.h (Output_section::always_keeps_input_sections,
7359         Output_section::set_always_keeps_input_sections): New methods.
7360         (Output_section::always_keeps_input_sections): New data member.
7361
7362 2010-07-13  Rafael Espindola  <espindola@google.com>
7363
7364         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7365         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7366
7367 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7368             Ian Lance Taylor  <iant@google.com>
7369
7370         * output.h (Output_section_lookup_maps::add_merge_section):
7371         Correct check of whether value was inserted.
7372         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7373         (Output_section_lookup_maps::add_relaxed_input_section):
7374         Likewise.
7375         * arm.cc (Target_arm::got_section): Remove used local os.
7376         * i386.cc (Target_i386::got_section): Likewise.
7377         * x86_64.cc (Target_x86_64::got_section): Likewise.
7378         * sparc.cc (Target_sparc::got_section): Likewise.
7379         (Target_sparc::relocate): Remove unused local have_got_offset.
7380         * powerpc.cc (Target_powerpc::relocate): Likewise.
7381
7382 2010-07-13  Ian Lance Taylor  <iant@google.com>
7383
7384         * compressed_output.cc (zlib_decompress): Fix signature in
7385         !HAVE_ZLIB_H case.
7386
7387         * archive.cc (Archive::include_member): Unlock an external member
7388         of a thin archive.  Don't bother to delete an object we know is
7389         NULL.
7390
7391 2010-07-12  Cary Coutant  <ccoutant@google.com>
7392
7393         * compressed_output.cc (zlib_decompress): New function.
7394         (get_uncompressed_size): New function.
7395         (decompress_input_section): New function.
7396         * compressed_output.h (get_uncompressed_size): New function.
7397         (decompress_input_section): New function.
7398         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7399         Handle compressed debug sections.
7400         * layout.cc (is_compressed_debug_section): New function.
7401         (Layout::output_section_name): Map compressed section names to
7402         canonical names.
7403         * layout.h (is_compressed_debug_section): New function.
7404         (is_debug_info_section): Recognize compressed debug sections.
7405         * merge.cc: Include compressed_output.h.
7406         (Output_merge_data::do_add_input_section): Handle compressed
7407         debug sections.
7408         (Output_merge_string::do_add_input_section): Handle compressed
7409         debug sections.
7410         * object.cc: Include compressed_output.h.
7411         (Sized_relobj::Sized_relobj): Initialize new data members.
7412         (build_compressed_section_map): New function.
7413         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7414         * object.h (Object::section_is_compressed): New method.
7415         (Object::do_section_is_compressed): New method.
7416         (Sized_relobj::Compressed_section_map): New type.
7417         (Sized_relobj::do_section_is_compressed): New method.
7418         (Sized_relobj::compressed_sections_): New data member.
7419         * output.cc (Output_section::add_input_section): Handle compressed
7420         debug sections.
7421         * reloc.cc: Include compressed_output.h.
7422         (Sized_relobj::write_sections): Handle compressed debug sections.
7423
7424 2010-07-08  Cary Coutant  <ccoutant@google.com>
7425
7426         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7427         weak when resolving to a dynamic def.
7428         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7429         for weak undef/dynamic def cases. Adjust callers.
7430         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7431         undef_binding_weak_.
7432         (Symbol_table::sized_write_globals): Adjust symbol binding.
7433         (Symbol_table::sized_write_symbol): Add binding parameter.
7434         * symtab.h (Symbol::set_undef_binding): New method.
7435         (Symbol::is_undef_binding_weak): New method.
7436         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7437         (Symbol_table::should_override): Add new parameter.
7438         (Symbol_table::sized_write_symbol): Add new parameter.
7439
7440         * testsuite/weak_undef_file1.cc: Add new test case.
7441         * testsuite/weak_undef_file2.cc: Fix header comment.
7442         * testsuite/weak_undef_test.cc: Add new test case.
7443
7444 2010-06-29  Doug Kwan  <dougkwan@google.com>
7445
7446         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7447         Initialize USE_SYMBOL_.
7448         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7449         definition.
7450         (Arm_reloc_property::uses_symbol_): New data member declaration.
7451         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7452         uses symbol value and symbol is undefined but not weakly undefined.
7453
7454 2010-06-28  Rafael Espindola  <espindola@google.com>
7455
7456         * plugin.cc (Plugin::load): Use dlerror.
7457
7458 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7459
7460         * symtab.cc (detect_odr_violations): When reporting an ODR
7461         violation, report an object where the symbol is defined.
7462
7463 2010-06-25  Doug Kwan  <dougkwan@google.com>
7464
7465         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7466         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7467         definition.
7468         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7469         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7470         target hook to detect function points.
7471         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7472         * icf.h (Icf::check_section_for_function_pointers): Change type of
7473         parameter SECTION_NAME to const reference to std::string.  Use
7474         target hook to determine if section may have unsafe pointers.
7475         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7476         method definition.
7477
7478 2010-06-21  Rafael Espindola  <espindola@google.com>
7479
7480         * fileread.cc (Input_file::find_fie): New
7481         (Input_file::open): Use Input_file::find_fie.
7482         * fileread.h (Input_file::find_fie): New
7483         * plugin.cc (set_extra_library_path): New.
7484         (Plugin::load): Add set_extra_library_path to the transfer vector.
7485         (Plugin_manager::set_extra_library_path): New.
7486         (Plugin_manager::add_input_file): Use the extra search path if set.
7487         (set_extra_library_path(): New.
7488         * plugin.h (Plugin_manager): Add set_extra_library_path and
7489         extra_search_path_.
7490
7491 2010-06-19  Cary Coutant  <ccoutant@google.com>
7492
7493         * layout.cc (gdb_sections): Add .debug_types.
7494         (lines_only_debug_sections): Likewise.
7495
7496 2010-06-18  Rafael Espindola  <espindola@google.com>
7497
7498         * plugin.cc (add_input_file,add_input_library)
7499         (Plugin_manager::add_input_file): Make filename arguments const.
7500         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7501         const.
7502
7503 2010-06-16  Doug Kwan  <dougkwan@google.com>
7504
7505         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7506         .ARM.attributes section if we have not merged any input
7507         attributes sections.
7508
7509 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7510
7511         * arm.cc: Allow combining objects with no EABI version
7512         information.
7513
7514 2010-06-15  Rafael Espindola  <espindola@google.com>
7515
7516         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7517
7518 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7519
7520         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7521         (struct iovec): Correct !HAVE_READV definition.
7522
7523 2010-06-10  Cary Coutant  <ccoutant@google.com>
7524
7525         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7526         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7527         reloc sections.
7528         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7529
7530         PR 11683
7531         * symtab.h (Symbol::is_placeholder): New member function.
7532         * target-reloc.h (relocate_section): Check for placeholder symbols.
7533
7534         * testsuite/Makefile.am (plugin_test_8): New test.
7535         (plugin_test_9): New test.
7536         * testsuite/Makefile.in: Regenerate.
7537
7538 2010-06-09  Nick Clifton  <nickc@redhat.com>
7539
7540         * yyscript.y (input_list_element): Allow strings prefixed with
7541         the '-' character.  Treat these as libraries.
7542         * script.cc (script_add_library): New function.  Adds a library
7543         specified by "-l<name>" found in an input script.
7544         * script-c.h: Add prototype for script_add_library.
7545
7546 2010-06-07  Doug Kwan  <dougkwan@google.com>
7547
7548         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7549         Restrict stub-group size to be within long conditional branch
7550         range when working around cortex-A8 erratum.
7551
7552 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7553
7554         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7555         #ifdef typo.
7556
7557 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7558
7559         PR gold/11658
7560         * output.cc
7561         (Output_section::Input_section_sort_entry::compare_section_ordering):
7562         Change to return non-zero correctly.
7563         (Output_section::Input_section_sort_section_order_index_compare
7564         ::operator()): Change to fix ambiguity in comparisons.
7565
7566 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7567
7568         * gold.h (is_wildcard_string): New function.
7569         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7570         (Layout::layout_eh_frame): Ditto.
7571         (Layout::find_section_order_index): New method.
7572         (Layout::read_layout_from_file): New method.
7573         * layout.h (Layout::find_section_order_index): New method.
7574         (Layout::read_layout_from_file): New method.
7575         (Layout::input_section_position_): New private member.
7576         (Layout::input_section_glob_): New private member.
7577         * main.cc (main): Call read_layout_from_file here.
7578         * options.h (--section-ordering-file): New option.
7579         * output.cc (Output_section::input_section_order_specified_): New
7580         member.
7581         (Output_section::Output_section): Initialize new member.
7582         (Output_section::add_input_section): Add new parameter.
7583         Keep input sections when --section-ordering-file is used.
7584         (Output_section::set_final_data_size): Sort input sections when
7585         section ordering file is specified.
7586         (Output_section::Input_section_sort_entry): Add new parameter.
7587         Check sorting type.
7588         (Output_section::Input_section_sort_entry::compare_section_ordering):
7589         New method.
7590         (Output_section::Input_section_sort_compare::operator()): Change to
7591         consider section_order_index.
7592         (Output_section::Input_section_sort_init_fini_compare::operator()):
7593         Change to consider section_order_index.
7594         (Output_section::Input_section_sort_section_order_index_compare
7595         ::operator()): New method.
7596         (Output_section::sort_attached_input_sections): Change to sort
7597         according to section order when specified.
7598         (Output_section::add_input_section<32, true>): Add new parameter.
7599         (Output_section::add_input_section<64, true>): Add new parameter.
7600         (Output_section::add_input_section<32, false>): Add new parameter.
7601         (Output_section::add_input_section<64, false>): Add new parameter.
7602         * output.h (Output_section::add_input_section): Add new parameter.
7603         (Output_section::input_section_order_specified): New
7604         method.
7605         (Output_section::set_input_section_order_specified): New method.
7606         (Input_section::Input_section): Initialize section_order_index_.
7607         (Input_section::section_order_index): New method.
7608         (Input_section::set_section_order_index): New method.
7609         (Input_section::section_order_index_): New member.
7610         (Input_section::Input_section_sort_section_order_index_compare): New
7611         struct.
7612         (Output_section::input_section_order_specified_): New member.
7613         * script-sections.cc (is_wildcard_string): Delete and move modified
7614         method to gold.h.
7615         (Output_section_element_input::Output_section_element_input): Modify
7616         call to is_wildcard_string.
7617         (Output_section_element_input::Input_section_pattern
7618         ::Input_section_pattern): Ditto.
7619         (Output_section_element_input::Output_section_element_input): Ditto.
7620         * testsuite/Makefile.am (final_layout): New test case.
7621         * testsuite/Makefile.in: Regenerate.
7622         * testsuite/final_layout.cc: New file.
7623         * testsuite/final_layout.sh: New file.
7624
7625 2010-06-01  Rafael Espindola  <espindola@google.com>
7626
7627         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7628
7629 2010-06-01  Rafael Espindola  <espindola@google.com>
7630
7631         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7632         visibility of symbols.
7633
7634 2010-05-27  Doug Kwan  <dougkwan@google.com>
7635
7636         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7637         from start of output section instead of address for a local symbol
7638         in a merged or relaxed section when doing a relocatable link.
7639
7640 2010-05-26  Rafael Espindola  <espindola@google.com>
7641
7642         PR 11604
7643         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7644         adding sections the garbage collector removed.
7645         * gold/testsuite/Makefile.am: Add test.
7646         * gold/testsuite/Makefile.in: Regenerate.
7647         * gold/testsuite/plugin_test_7.sh: New.
7648         * gold/testsuite/plugin_test_7_1.c: New.
7649         * gold/testsuite/plugin_test_7_2.c: New.
7650
7651 2010-05-26  Rafael Espindola  <espindola@google.com>
7652
7653         * script-sections.cc (Output_section_definition::set_section_addresses):
7654         Check for --section-start.
7655
7656 2010-05-26  Doug Kwan  <dougkwan@google.com>
7657
7658         * arm.cc (Arm_scan_relocatable_relocs): New class.
7659         (Target_arm::relocate_special_relocatable): New method.
7660         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7661         (Arm_relocate_functions::thumb_branch_common): Same.
7662         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7663         instead of Default_scan_relocatable_relocs.
7664         * target-reloc.h (relocate_for_relocatable): Let target handle
7665         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7666         * target.h (Sized_target::relocate_special_relocatable): New method.
7667
7668 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7669
7670         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7671
7672 2010-05-23  Doug Kwan  <dougkwan@google.com>
7673
7674         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7675         instead of a cast.
7676         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7677         with a direct branch, not a conditional branch, to a stub.
7678         * merge.cc (Output_merge_base::record_input_section): New method
7679         defintion.
7680         (Output_merge_data::do_add_input_section): Record input section if
7681         keeps-input-sections flag is set.
7682         (Output_merge_string::do_add_input_section): Ditto.
7683         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7684         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7685         INPUT_SECTIONS_.
7686         (Output_merge_base::keeps_input_sections,
7687         Output_merge_base::set_keeps_input_sections,
7688         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7689         method definitions.
7690         (Output_merge_base::Input_sections): New type declaration.
7691         (Output_merge_base::input_sections_begin,
7692         Output_merge_base::input_sections_end,
7693         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7694         (Output_merge_base::bool keeps_input_sections_,
7695         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7696         Output_merge_base::input_sections_): New data members.
7697         (Output_merge_data::do_set_keeps_input_sections): New method
7698         defintion.
7699         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7700         * output.cc (Output_section::Input_section::relobj): Move method
7701         defintion from class declaration to here and handle merge sections.
7702         (Output_section::Input_section::shndx): Ditto.
7703         (Output_section::Output_section): Remove initializations of removed
7704         data members and initialize new data member LOOKUP_MAPS_.
7705         (Output_section::add_input_section): Set keeps-input-sections flag
7706         for a newly created merge output section as appropriate.  Adjust code
7707         to use Output_section_lookup_maps class.
7708         (Output_section::add_relaxed_input_section): Adjst code for lookup
7709         maps code refactoring.
7710         (Output_section::add_merge_input_section): Add a new parameter
7711         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7712         class.  If adding input section to a newly created merge output
7713         section fails, remove the new merge section.
7714         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7715         Adjust code for use of the Output_section_lookup_maps class.
7716         (Output_section::find_merge_section): Ditto.
7717         (Output_section::build_lookup_maps): New method defintion.
7718         (Output_section::find_relaxed_input_section): Adjust code to use
7719         Output_section_lookup_maps class.
7720         (Output_section::get_input_sections): Export merge sections.  Adjust
7721         code to use Output_section_lookup_maps class.
7722         (Output_section:::add_script_input_section): Adjust code to use
7723         Output_section_lookup_maps class.  Update lookup maps for merge
7724         sections also.
7725         (Output_section::discard_states): Use Output_section_lookup_maps.
7726         (Output_section::restore_states): Same.
7727         * output.h (Merge_section_properties): Move class defintion out of
7728         Output_section.
7729         (Output_section_lookup_maps): New class.
7730         (Output_section::Input_section::is_merge_section): New method
7731         defintion.
7732         (Output_section::Input_section::relobj): Move defintion out of class
7733         defintion.  Declare method only.
7734         (Output_section::Input_section::shndx): Ditto.
7735         (Output_section::Input_section::output_merge_base): New method defintion.
7736         (Output_section::Input_section::u2_.pomb): New union field.
7737         (Output_section::Merge_section_by_properties_map,
7738         Output_section::Output_section_data_by_input_section_map,
7739         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7740         Remove types.
7741         (Output_section::add_merge_input_section): Add new parameter
7742         KEEPS_INPUT_SECTIONS.
7743         (Output_section::build_lookup_maps): New method declaration.
7744         (Output_section::merge_section_map_,
7745         Output_section::merge_section_by_properties_map_,
7746         Output_section::relaxed_input_section_map_,
7747         Output_section::is_relaxed_input_section_map_valid_): Remove data
7748         members.
7749         (Output_section::lookup_maps_): New data member.
7750
7751 2010-05-21  Doug Kwan  <dougkwan@google.com>
7752
7753         PR gold/11619
7754         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7755         avoid a compilation error.
7756
7757 2010-05-19  Rafael Espindola  <espindola@google.com>
7758
7759         * script-sections.cc (Output_section_definition::allocate_to_segment):
7760         Update the phdrs_list even when the output section is NULL.
7761         * testsuite/Makefile.am: Add test.
7762         * testsuite/Makefile.in: Regenerate.
7763         * testsuite/script_test_9.cc: New.
7764         * testsuite/script_test_9.sh: New.
7765         * testsuite/script_test_9.t: New.
7766
7767 2010-05-19  Doug Kwan  <dougkwan@google.com>
7768
7769         * arm.cc (Arm_input_section::original_size): New method.
7770         (Arm_input_section::do_addralign): Add a cast.
7771         (Arm_input_section::do_output_offset): Remove static cast.
7772         (Arm_input_section::original_addralign,
7773          Arm_input_section::original_size_): Change type to uint32_t.
7774         (Arm_input_section::init): Add safe casts for section alignment
7775         and size.
7776         (Arm_input_section::set_final_data_size): Do not set address and
7777         offset of stub table.
7778         (Arm_output_section::fix_exidx_coverage): Change use of of
7779         Output_section::Simple_input_section to that of
7780         Output_section::Input_section.
7781         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7782         except for the first pass.
7783         * output.cc (Output_section::get_input_sections): Change type of
7784         input_sections to std::list<Input_section>.
7785         (Output_section::add_script_input_section): Rename from
7786         Output_section::add_simple_input_section.  Change type of SIS
7787         parameter from Simple_input_section to Input_section.
7788         * output.h (Output_section::Simple_input_section): Remove class.
7789         (Output_section::Input_section): Change class visibility to public.
7790         (Output_section::Input_section::addralign): Use stored alignments
7791         for special input sections if set.
7792         (Output_section::Input_section::set_addralign): New method.
7793         (Output_section::get_input_sections): Change parameter type from
7794         list of Simple_input_section to list of Input_section.
7795         (Output_section::add_script_input_section): Rename from
7796         Output_section::add_simple_input_section. Change first parameter's
7797         type from Simple_input_section to Input_section and remove the
7798         second and third parameters.
7799         * script-sections.cc (Input_section::Input_section_list): Change
7800         type to list of Output_section::Input_section/
7801         (Input_section_info::Input_section_info): Change parameter type of
7802         INPUT_SECTION to Output_section::Input_section.
7803         (Input_section_info::input_section): Change return type.
7804         (Input_section_info::input_section_): Change type to
7805         Output_section::Input_section.
7806         (Output_section_element_input::set_section_addresses): Adjust code
7807         to use Output_section::Input_section instead of
7808         Output_section::Simple_input_section.  Adjust code for renaming
7809         of Output_section::add_simple_input_section.
7810         (Orphan_output_section::set_section_addresses): Ditto.
7811
7812 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7813
7814         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7815         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7816
7817 2010-05-18  Rafael Espindola  <espindola@google.com>
7818
7819         * options.cc (General_options::finalize): Handle -nostdlib.
7820         * options.h (nostdlib): New option.
7821         * script.cc (script_add_search_dir): Handle -nostdlib.
7822
7823 2010-05-12  Doug Kwan  <dougkwan@google.com>
7824
7825         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7826         attributes section only if there no attributes section after merging.
7827         (Target_arm::merge_object_attributes): Move value of
7828         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7829         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7830         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7831         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7832         and arm_attr_merge_7.stdout.
7833         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7834         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7835         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7836         arm_attr_merge_7b.o): New rules.
7837         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7838         arm_attr_merge_7
7839         * testsuite/Makefile.in: Regenerate.
7840         * testsuite/arm_attr_merge.sh: New file.
7841         * testsuite/arm_attr_merge_[67][ab].s: Same.
7842
7843 2010-05-05  Nick Clifton  <nickc@redhat.com>
7844
7845         * po/es.po: Updated Spanish translation.
7846
7847 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7848
7849         * Makefile.am (install-exec-local): Properly install gold as
7850         default cross linker.
7851         * Makefile.in: Regenerated.
7852
7853 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7854             Nick Clifton  <nickc@redhat.com>
7855
7856         * configure.ac (install_as_default): Define and set to false
7857         unless --enable-gold or --enable-gold=both/gold has been
7858         specified.
7859         * configure: Regenerate.
7860
7861         * Makefile.am (install-exec-local): Install the executable as
7862         'ld.gold'.  If install_as_default is true then also install it as
7863         'ld'.
7864         * Makefile.in: Regenerated.
7865
7866 2010-04-24  Ian Lance Taylor  <iant@google.com>
7867
7868         * layout.cc (Layout::layout_reloc): In relocatable link don't
7869         combine reloc sections for grouped sections.
7870
7871 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7872
7873         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7874         sections that are not ordinary to icf.
7875         * icf.cc (get_section_contents): Handle relocation pointing to section
7876         with no object or shndx information.
7877         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7878         * testsuite/Makefile.in: Regenerate.
7879         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7880         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7881
7882 2010-04-22  Ian Lance Taylor  <iant@google.com>
7883
7884         * expression.cc (Expression::Expression_eval_info): Add
7885         result_alignment_pointer field.
7886         (Expression::eval_with_dot): Add result_alignment_pointer
7887         parameter.  Change all callers.
7888         (Expression::eval_maybe_dot): Likewise.
7889         (class Binary_expression): Add alignment_pointer parameter to
7890         left_value and right_value.  Change all callers.
7891         (BINARY_EXPRESSION): Set result alignment.
7892         (class Trinary_expression): Add alignment_pointer parameter to
7893         arg2_value and arg3_value.  Change all callers.
7894         (Trinary_cond::value): Set result alignment.
7895         (Max_expression::value, Min_expression::value): Likewise.
7896         (Align_expression::value): Likewise.
7897         * script-sections.cc (class Sections_element): Add dot_alignment
7898         parameter to set_section_addresses virtual function.  Update
7899         instantiations.
7900         (class Output_section_element): Likewise.
7901         (Script_sections::create_segments): Add dot_alignment parameter.
7902         Change all callers.
7903         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7904         (Script_sections::set_phdrs_clause_addresses): Likewise.
7905         * script-sections.h: Update declarations.
7906         * script.h: Update declarations.
7907         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7908         min_p_align.
7909         * testsuite/script_test_3.t: Set large alignment.
7910         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7911         segment has expected alignment.
7912
7913 2010-04-22  Nick Clifton  <nickc@redhat.com>
7914
7915         * po/gold.pot: Updated by the Translation project.
7916         * po/vi.po: Updated Vietnamese translation.
7917
7918 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7919
7920         * testsuite/Makefile.am (check_PROGRAMS): Add
7921         icf_virtual_function_folding_test.
7922         * testsuite/Makefile.in: Regenerated.
7923
7924 2010-04-15  Andrew Haley  <aph@redhat.com>
7925
7926         * options.h (merge_exidx_entries): New option.
7927         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7928         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7929         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7930         (Target_arm::merge_exidx_entries): New function.
7931         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7932         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7933         to Arm_exidx_fixup constructor.
7934         Add new arg, merge_exidx_entries.
7935         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7936         Arm_output_section::fix_exidx_coverage.
7937
7938 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7939
7940         * icf.cc (get_section_contents): Check for preemptible functions.
7941         Ignore addend when appropriate.
7942         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7943         section folded.
7944         (add_from_relobj): Check for section folded.
7945         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7946         * symtab.h (should_add_dynsym_entry): Add new parameter.
7947         * target-reloc.h (scan_relocs): Check for section folded.
7948         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7949         Check reloc types for function pointers in shared objects.
7950         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7951         case.
7952         (icf_preemptible_functions_test): New test case.
7953         (icf_string_merge_test): New test case.
7954         * testsuite.Makefile.in: Regenerate.
7955         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7956         bar_glob.  Refactor code.
7957         * testsuite/icf_preemptible_functions_test.cc: New file.
7958         * testsuite/icf_preemptible_functions_test.sh: New file.
7959         * testsuite/icf_string_merge_test.cc: New file.
7960         * testsuite/icf_string_merge_test.sh: New file.
7961         * testsuite/icf_virtual_function_folding_test.cc: New file.
7962         * testsuite/icf_virtual_function_folding_test.sh: New file.
7963
7964 2010-04-14  Doug Kwan  <dougkwan@google.com>
7965
7966         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7967         for local symbol recounting if we remove a section due to ICF.
7968         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7969         there are no regular objects in input.
7970
7971 2010-04-13  Doug Kwan  <dougkwan@google.com>
7972
7973         * arm.cc (Arm_input_section::set_final_data_size): Compute
7974         accurate final data size instead of using current data size.
7975
7976 2010-04-09  Doug Kwan  <dougkwan@google.com>
7977
7978         * layout.cc (Layout::choose_output_section): Handle script section
7979         types.
7980         (Layout::make_output_section_for_script): Add section type parameter.
7981         Handle script section types.
7982         * layout.h (Layout::make_output_section_for_script): Add section
7983         type parameter.
7984         * output.cc (Output_section::Output_section): Initialize data member
7985         is_noload_.
7986         (Output_section::do_reset_address_and_file_offset): Do not set address
7987         to 0 if section is a NOLOAD section.
7988         * output.h (Output_section::is_noload): New method.
7989         (Output_section::set_is_noload): Ditto.
7990         (Output_section::is_noload_): New data member.
7991         * script-c.h (Script_section_type): New enum type.
7992         (struct Parser_output_section_header): Add new file section_type.
7993         * script-sections.cc (Sections_element::output_section_name): Add
7994         parameter for returning script section type.
7995         (Output_section_definition::output_section_name): Ditto.
7996         (Output_section_definition::section_type)P; New method.
7997         (Output_section_definiton::script_section_type_name): Ditto.
7998         (Output_section_definition::script_section_type_): New data member.
7999         (Output_section_definition::Output_section_definition): Initialize
8000         data member Output_section_definition::script_section_type_.
8001         (Output_section_definition::create_sections): Pass script section type
8002         to Layout::make_output_section_for_script.
8003         (Output_section_definition::output_section_name): Return script
8004         section type to caller.
8005         (Output_section_definition::set_section_address): Do not advance
8006         dot value and load address if section type is NOLOAD.  Set address
8007         of NOLOAD sections regardless of section flags.
8008         (Output_section_definition::print): Print section type if it is
8009         not SCRIPT_SECTION_TYPE_NONE.
8010         (Output_section_definition::section_type): New method.
8011         (Output_section_definition::script_section_type_name): Ditto.
8012         (Script_sections::output_section_name): Add new parameter
8013         PSECTION_TYPE for returning script section type.  Pass it to
8014         section elements.  Handle discard sections.
8015         (Sort_output_sections::operator()): Handle NOLOAD sections.
8016         * script-sections.h (Script_sections::Section_type): New enum type.
8017         (Script_sections::output_section_name): Add a new parameter for
8018         returning script section type.
8019         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8020         INFO and NOLOAD.
8021         * yyscript.y (union): Add new field SECTION_TYPE.
8022         (COPY, DSECT, INFO, NOLOAD): New tokens.
8023         (opt_address_and_section_type): Change type to output_section_header.
8024         (section_type): New non-terminal
8025         (section_header): Handle section type.
8026         (opt_address_and_section_type): Return section type value.
8027
8028 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8029
8030         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8031         * testsuite/plugin_common_test_2.c (foo): Likewise.
8032
8033 2010-04-08  Doug Kwan  <dougkwan@google.com>
8034
8035         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8036         Output_merge_data.
8037         * output.cc (Output_section::add_merge_input_section): Simplify
8038         code and return status of Output_merge_base::add_input_section.
8039         Update merge section map only if Output_merge_base::add_input_section
8040         returns true.
8041
8042 2010-04-07  Doug Kwan  <dougkwan@google.com>
8043
8044         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8045         if section is marked as containing instructions but has no mapping
8046         symbols.
8047         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8048         correct section index.
8049         (Arm_relobj::find_linked_text_section): Ditto.
8050
8051 2010-04-07  Cary Coutant  <ccoutant@google.com>
8052
8053         * archive.cc (include_member): Destroy Read_symbols_data object before
8054         releasing file.
8055         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8056         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8057         (Read_symbols_data::~Read_symbols_data) New destructor.
8058         (Section_relocs::Section_relocs) New constructor.
8059         (Section_relocs::~Section_relocs) New destructor.
8060         (Read_relocs_data::Read_relocs_data) New constructor.
8061         (Read_relocs_data::~Read_relocs_data) New destructor.
8062         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8063         pointers to NULL after deleting.
8064
8065 2010-04-07  Doug Kwan  <dougkwan@google.com>
8066
8067         * arm.cc: Replace "endianity" with "endianness" in comments.
8068         (Arm_exidx_cantunwind): Ditto.
8069         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8070         (Arm_relobj::merge_flags_and_attributes): New method.
8071         (Arm_relobj::merge_flags_and_attributes_): New data member.
8072         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8073         (Arm_relobj::scan_sections_for_stubs): Ditto.
8074         (Arm_relobj::do_read_symbols): Check to see if we really want to
8075         merge processor-specific flags and attributes.  Exit early if
8076         an object is empty except for section names and the undefined symbol.
8077         (Target_arm::do_finalize_sections): Move check for ELF format to
8078         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8079         attributes from a regular object only when we have determined that
8080         it is aapropriate.  Do not create an .ARM.attributes section in
8081         output if there is no regular input object.
8082         (Target_arm::merge_processor_specific_flags): Check
8083         --warn-mismatch before printing any error.
8084         (Target_arm::merge_object_attributes): Ditto.
8085         * gold.cc (queue_middle_tasks): Handle the case in which there is
8086         no regular object in input.
8087         * options.cc (General_options::parse_EB): New method.
8088         (General_options::parse_EL): Same.
8089         (General_options::General_options): Initialize endianness_.
8090         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8091         New options.
8092         (General_options::Endianness): New enum.
8093         (General_options::endianness): New method.
8094         (General_options::endianness_): New data member.
8095         * parameters.cc (Parameters::set_options): Check target endianness.
8096         (Parameters::set_target_once): Ditto.
8097         (Parameters::check_target_endianness): New method.
8098         (parameters_force_valid_target): If either -EL or -EB is specified,
8099         use it to define endianness of default target.
8100         * parameters.h (Parameters::check_target_endianness): New method
8101         declaration.
8102         * target.h (class Target): Change "endianity" to "endianness"
8103         in comments.
8104
8105 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8106
8107         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8108         * configure: Regenerate.
8109         * Makefile.in: Regenerate.
8110         * testsuite/Makefile.in: Regenerate.
8111
8112 2010-04-06  Cary Coutant  <ccoutant@google.com>
8113
8114         gcc PR lto/42757
8115         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8116         prevailing definitions of common symbols.
8117         * testsuite/plugin_test_6.sh: New test case.
8118         * testsuite/plugin_common_test_1.c: New test case.
8119         * testsuite/plugin_common_test_2.c: New test case.
8120         * testsuite/Makefile.am (plugin_test_6): New test case.
8121         * testsuite/Makefile.in: Regenerate.
8122
8123 2010-04-06  Nick Clifton  <nickc@redhat.com>
8124
8125         * po/vi.po: New Vietnamese translation.
8126
8127 2010-03-30  Doug Kwan  <dougkwan@google.com>
8128
8129         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8130
8131 2010-03-25  Doug Kwan  <dougkwan@google.com>
8132
8133         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8134         to avoid a conversion warning on a 32-bit host.
8135
8136 2010-03-24  Ian Lance Taylor  <iant@google.com>
8137
8138         * testsuite/script_test_3.t: Add a TLS segment.
8139         * testsuite/Makefile.am (check_PROGRAMS): Add
8140         tls_phdrs_script_test.
8141         (tls_phdrs_script_test_SOURCES): Define.
8142         (tls_phdrs_script_test_DEPENDENCIES): Define.
8143         (tls_phdrs_script_test_LDFLAGS): Define.
8144         (tls_phdrs_script_test_LDADD): Define.
8145         * testsuite/Makefile.in: Rebuild.
8146
8147 2010-03-23  Cary Coutant  <ccoutant@google.com>
8148
8149         * fileread.cc (find_or_make_view): Fix comment.
8150
8151 2010-03-23  Ian Lance Taylor  <iant@google.com>
8152
8153         * script-sections.cc (class Orphan_section_placement): Define
8154         PLACE_TLS and PLACE_TLS_BSS.
8155         (Orphan_section_placement::Orphan_section_placement): Initialize
8156         new places.
8157         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8158         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8159         (tls_script_test_SOURCES): Define.
8160         (tls_script_test_DEPENDENCIES): Define.
8161         (tls_script_test_LDFLAGS): Define.
8162         (tls_script_test_LDADD): Define.
8163         * testsuite/Makefile.in: Rebuild.
8164
8165 2010-03-22  Doug Kwan  <dougkwan@google.com>
8166
8167         * arm.cc (Arm_relocate_functions::abs8,
8168         Arm_relocate_functions::abs16): Use correct check for overflow
8169         specified in the ARM ELF specs.
8170         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8171         target of a BLX instruction specially.
8172         (Reloc_stub::stub_type_for_reloc): Ditto.
8173         (Relocate::relocate): Use symbolic names instead of numeric relocation
8174         codes to report error.
8175         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8176         workaround.
8177         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8178         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8179         thumb2_blx_out_of_range.stdout
8180         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8181         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8182         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8183         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8184         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8185         thumb2_blx_in_range, thumb2_blx_in_range.o,
8186         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8187         thumb2_blx_out_of_range.o): New rules.
8188         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8189         thumb2_blx_in_range and thumb2_blx_out_of_range.
8190         * testsuite/Makefile.in: Regenerate.
8191         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8192         * testsuite/thumb_blx_in_range.s: New file.
8193         * testsuite/thumb_blx_out_of_range.s: New file.
8194
8195 2010-03-22  Rafael Espindola  <espindola@google.com>
8196
8197         * archive.cc (Should_include): Move to archive.h.
8198         (should_include_member): Make it a member of Archive.
8199         (Lib_group): New.
8200         (Add_lib_group_symbols): New.
8201         * archive.h: Include options.h.
8202         (Archive_member): Moved from Archive.
8203         (Should_include): Moved from archive.cc.
8204         (Lib_group): New.
8205         (Add_lib_group_symbols): New.
8206         * dynobj.cc (do_should_include_member): New.
8207         * dynobj.h (do_should_include_member): New.
8208         * gold.cc (queue_initial_tasks): Update call to queue.
8209         * main.cc (main): Print lib group stats.
8210         * object.cc (do_should_include_member): New.
8211         * object.h: Include archive.h.
8212         (Object::should_include_member): New.
8213         (Object::do_should_include_member): New.
8214         (Sized_relobj::do_should_include_member): New.
8215         * options.cc (General_options::parse_start_lib): New.
8216         (General_options::parse_end_lib): New.
8217         (Input_arguments::add_file): Handle lib groups.
8218         (Input_arguments::start_group): Check we are not in a lib.
8219         (Input_arguments::start_lib): New.
8220         (Input_arguments::end_lib): New.
8221         * options.h (General_options): Add start_lib and end_lib.
8222         (Input_argument::lib_): New.
8223         (Input_argument::lib): New.
8224         (Input_argument::is_lib): New.
8225         (Input_file_lib): New.
8226         (Input_arguments::in_lib_): New.
8227         (Input_arguments::in_lib): New.
8228         (Input_arguments::start_lib): New.
8229         (Input_arguments::end_lib_): New.
8230         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8231         in unused members as preempted.
8232         (Sized_pluginobj::do_should_include_member): New.
8233         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8234         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8235         return the blocker.
8236         (Read_symbols::do_whole_lib_group): New.
8237         (Read_symbols::do_lib_group): New.
8238         (Read_symbols::do_read_symbols): Handle lib groups.
8239         (Read_symbols::get_name): Handle lib groups.
8240         * readsyms.h (Read_symbols): Add an archive member pointer.
8241         (Read_symbols::do_whole_lib_group): New.
8242         (Read_symbols::do_lib_group): New.
8243         (Read_symbols::member_): New.
8244         * script.cc (read_input_script): Update call to queue_soon.
8245
8246 2010-03-19  Doug Kwan  <dougkwan@google.com>
8247
8248         * arm.cc (Stub_table::Stub_table): Initialize new data members
8249         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8250         (Stub_table::add_reloc_stub): Assign stub offset and update
8251         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8252         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8253         New data members.
8254         (Stub_table::update_data_size_and_addralign): Use
8255         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8256         instead of going over all reloc stubs.
8257         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8258         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8259         Stringpool_template::offset_ to size of Stringpool_char.
8260         (Stringpool_template::new_key_offset): Remove code to initialize
8261         Stringpool_template::offset_.
8262         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8263         Stringpool_template::offset_ to zero.
8264
8265 2010-03-15  Doug Kwan  <dougkwan@google.com>
8266
8267         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8268         offset_.
8269         (Stringpool_template::new_key_offset): New method.
8270         (Stringpool_template::add_string): Assign offsets when adding new
8271         strings.
8272         (Stringpool_template::set_string_offsets): Do not set string offsets
8273         when not optimizing.
8274         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8275         member size_.
8276         (Chunked_vector::clear): Clear size_.
8277         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8278         (Chunked_vector::size): Return size_.
8279         (Chunked_vector::push_back): Use size_ to find insert position.
8280         (Chunked_vector::size_): New data member.
8281         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8282         (Stringpool_template::new_key_offset): New method declaration.
8283         (Stringpool_template::offset_): New data member.
8284
8285 2010-03-15   Rafael Espindola  <espindola@google.com>
8286
8287         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8288         Add_symbols' constructor.
8289         * readsyms.h (Add_symbols): Remove the input_group member.
8290
8291 2010-03-10  Ian Lance Taylor  <iant@google.com>
8292
8293         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8294         target to ask whether a reference to a symbol requires a stack
8295         split.
8296         * target.h (Target::is_call_to_non_split): New function.
8297         (Target::do_is_call_to_non_split): Declare virtual function.
8298         * target.cc: Include "symtab.h".
8299         (Target::do_is_call_to_non_split): New function.
8300         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8301
8302 2010-03-10  Cary Coutant  <ccoutant@google.com>
8303
8304         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8305         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8306         (File_read::open[2]): Add whole_file_view_ to list of views.
8307         (File_read::make_view): Remove test of whole_file_view_.
8308         (File_read::find_or_make_view): Create whole_file_view_ if
8309         necessary.
8310         (File_read::clear_views): Replace bool parameter with enum;
8311         adjust all callers.  Don't delete views with permanent data;
8312         do delete cached views and views from archives if
8313         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8314         if clearing the corresponding view.
8315         * fileread.h (File_read::Clear_views_mode): New enum.
8316         (File_read::View::is_permanent_view): New method.
8317         (File_read::clear_views): Replace bool parameter
8318         with enum; adjust all callers.
8319         * options.h (General_options): Change keep_files_mapped option;
8320         add map_whole_files.
8321         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8322         releasing the file.
8323         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8324         the file.
8325
8326 2010-03-10  David S. Miller  <davem@davemloft.net>
8327
8328         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8329
8330 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8331
8332         * icf.cc (get_section_contents): Add '@' marker after processing the
8333         merge reloc.
8334
8335 2010-03-08  Doug Kwan  <dougkwan@google.com>
8336
8337         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8338         due to a conversion warning.
8339         (Arm_relobj::update_output_local_symbol_count): Check for local
8340         symbol with unset output index.
8341
8342 2010-03-05  Ian Lance Taylor  <iant@google.com>
8343
8344         * options.h (class General_options): Add --spare-dynamic-tags.
8345         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8346         --spare-dynamic-tags.
8347
8348 2010-03-05  Ian Lance Taylor  <iant@google.com>
8349
8350         * incremental.cc: Include "libiberty.h".
8351
8352 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8353
8354         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8355         function, is_info_ member.
8356         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8357         (Versions::Versions): Update caller.
8358         (Versions::define_base_version): Likewise.
8359         (Versions::add_def): Likewise.
8360
8361 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8362
8363         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8364         (Scan::possible_function_pointer_reloc): New function.
8365         (Scan::local_reloc_may_be_function_pointer): Change to call
8366         possible_function_pointer_reloc.
8367         (Scan::global_reloc_may_be_function_pointer): Ditto.
8368         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8369         relocations in ".data.rel.ro._ZTV" section.
8370         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8371         * testsuite/icf_safe_so_test.cc: Ditto.
8372         * testsuite/icf_safe_test.cc: Ditto.
8373         * testsuite/icf_safe_test.sh: Ditto.
8374
8375 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8376             Ian Lance Taylor  <iant@google.com>
8377
8378         * target-reloc.h (relocate_section): Check the symbol table index
8379         for -1U before setting the local symbol index.
8380         (scan_relocatable_relocs): If copying the relocation, record that
8381         the local symbol is required.
8382         * object.h (Symbol_value::is_output_symtab_index_set): New
8383         function.
8384         (Symbol_value::may_be_discarded_from_output_symtab): New
8385         function.
8386         (Symbol_value::has_output_symtab_entry): New function.
8387         (Symbol_value::needs_output_symtab_entry): Remove.
8388         (Symbol_value::output_symtab_index): Make sure the symbol index is
8389         set.
8390         (Symbol_value::set_output_symtab_index): Make sure the symbol
8391         index is not set.  Make sure the new index is valid.
8392         (Symbol_value::set_must_have_output_symtab_entry): New function.
8393         (Symbol_value::has_output_dynsym_entry): New function.
8394         (Symbol_value::set_output_dynsym_index): Make sure the new index
8395         is valid.
8396         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8397         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8398         local symbol if permitted.
8399         (Sized_relobj::do_finalize_local_symbols): Call
8400         is_output_symtab_index_set rather than needs_output_symtab_entry.
8401         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8402         rather than needs_output_symtab_entry.  Call
8403         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8404         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8405         is_output_symtab_index_set rather than needs_output_symtab_entry.
8406         * testsuite/discard_locals_relocatable_test.c: New file.
8407         * testsuite/discard_locals_test.sh: Test -r.
8408         * testsuite/Makefile.am (check_DATA): Add
8409         discard_locals_relocatable_test1.syms,
8410         discard_local_relocatable_test2.syms.
8411         (MOSTLYCLEANFILES): Likewise.  Also add
8412         discard_locals_relocatable_test1.lout and
8413         discard_locals_relocatable_test2.out.
8414         (discard_locals_relocatable_test1.syms): New target.
8415         (discard_locals_relocatable_test.o): New target.
8416         (discard_locals_relocatable_test1.out): New target.
8417         (discard_locals_relocatable_test2.syms): New target.
8418         (discard_locals_relocatable_test2.out): New target.
8419         (various): Add missing ../ld-new dependencies.
8420         * testsuite/Makefile.in: Rebuild.
8421
8422 2010-03-03  Nick Clifton  <nickc@redhat.com>
8423
8424         * po/fi.po: New Finnish translation.
8425
8426 2010-03-01  Doug Kwan  <dougkwan@google.com>
8427
8428         * layout.cc (Layout::Layout): Force section types of .init_array*,
8429         .preinit_array* and .fini_array* sections.
8430         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8431         Fix check of return value of std::string::find.().
8432         (Output_section::Input_section_sort_compare::operator()): Remove
8433         comment about .init_array.
8434         (Output_section::Input_section_sort_init_fini_compare::operator()):
8435         New method.
8436         (Output_section::sort_attached_input_sections): Handle .init_array
8437         and .fini_array specially.
8438         * output.h (Output_section::Inut_section_sort_compare): Update
8439         comment.
8440         (Output_section::Input_section_sort_init_fini_compare): New struct.
8441
8442 2010-02-26  Doug Kwan  <dougkwan@google.com>
8443
8444         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8445         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8446         * testsuite/debug_msg.sh: Avoid matching source line number for
8447         use of global variable undef_int.
8448
8449 2010-02-26  Doug Kwan  <dougkwan@google.com>
8450
8451         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8452         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8453         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8454         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8455         * options.cc (General_options::General_options): Initialize member
8456         fix_v4bx_.
8457         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8458         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8459         and rm_no_fix_v4bx.stdout
8460         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8461         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8462         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8463         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8464         and arm_no_fix_v4bx.
8465         * Makefile.in: Regenerate.
8466         * testsuite/arm_fix_v4bx.s: New file.
8467         * testsuite/arm_fix_v4bx.sh: Ditto.
8468
8469 2010-02-24  Doug Kwan  <dougkwan@google.com>
8470
8471         * arm.cc (Target_arm::got_section): Make the .got section the first
8472         non RELRO section in the data segment.
8473         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8474         suffixes of section names.
8475
8476 2010-02-24  Doug Kwan  <dougkwan@google.com>
8477
8478         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8479         flags and attributes merging if an input file is a binary file.
8480         * fileread.cc (Input_file::open): Record format of original file.
8481         * fileread.h (Input_file::Format): New enum type.
8482         (Input_file::Input_file): Initialize data member format_.
8483         (Input_file::format): New method definition.
8484         (Input_file::format_):: New data member.
8485
8486 2010-02-24  Doug Kwan  <dougkwan@google.com>
8487
8488         * arm.cc (Arm_output_data_got): New class.
8489         (ARM_TCB_SIZE): New constant
8490         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8491         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8492         If user uses a script with a SECTIONS clause, issue only a warning
8493         for a misplaced EXIDX input section.  Otherwise, issue an error.
8494         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8495         garbage collection.
8496         (Target_arm::got_mode_index_entry): Handle static linking.
8497         (Target_arm::Scan::local): Ditto.
8498         (Target_arm::Scan::global): Ditto.
8499         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8500         all incorrectly implemented relocations.
8501         (Target_arm::fix_exidx_coverage): Pass layout to
8502         Arm_output_section::fix_exidx_coverage.
8503         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8504         from ".ARM.exidx." and ".ARM.extab.".
8505
8506 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8507
8508         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8509         section if it does not already exist.
8510         * attributes.cc (Attributes_section_data::Attributes_section_data):
8511         Don't crash if size is zero.
8512
8513 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8514             Ian Lance Taylor  <iant@google.com>
8515
8516         * gold.cc (queue_middle_tasks): If no input files were opened,
8517         exit.
8518         * workqueue.h (Task_function::Task_function): Assert that there is
8519         a blocker.
8520
8521 2010-02-22  Doug Kwan  <dougkwan@google.com>
8522
8523         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8524         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8525         types to avoid warnings due to different uint64_t implementations
8526         on different hosts.
8527
8528 2010-02-21  Doug Kwan  <dougkwan@google.com>
8529
8530         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8531         handling of the maximum backward branch offset.
8532         (Arm_relocate_functions::thumb_branch_common): Ditto.
8533         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8534         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8535         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8536         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8537         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8538         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8539         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8540         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8541         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8542         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8543         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8544         thumb2_bl_out_of_range.o): New rules.
8545         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8546         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8547         thumb2_bl_out_of_range
8548         * testsuite/Makefile.in: Regenerate.
8549         * testsuite/arm_bl_in_range.s: New file.
8550         * testsuite/arm_bl_out_of_range.s: Ditto.
8551         * testsuite/arm_branch_in_range.sh: Ditto.
8552         * testsuite/arm_branch_range.t: Ditto.
8553         * testsuite/thumb2_branch_range.t: Ditto.
8554         * testsuite/thumb_bl_in_range.s: Ditto.
8555         * testsuite/thumb_bl_out_of_range.s: Ditto.
8556         * testsuite/thumb_branch_range.t: Ditto.
8557
8558 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8559
8560         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8561         Add reloc offset information.
8562         * icf.cc (get_section_contents): Change iterators to point to the new
8563         vectors. Add reloc offset information to the contents.
8564         * icf.h (Icf::Sections_reachable_info): New typedef.
8565         (Icf::Sections_reachable_list): New typedef.
8566         (Icf::Offset_info): New typedef.
8567         (Icf::Reloc_info): New struct typedef.
8568         (Icf::Reloc_info_list): New typedef.
8569         (Icf::symbol_reloc_list): Delete method.
8570         (Icf::addend_reloc_list): Delete method.
8571         (Icf::section_reloc_list): Delete method.
8572         (Icf::reloc_info_list): New method.
8573         (Icf::reloc_info_list_): New member.
8574
8575 2010-02-19  Doug Kwan  <dougkwan@google.com>
8576
8577         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8578         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8579         * arm.cc (Arm_relocation_functions): New forward declaration.
8580         (Target_arm::Target_arm): Initialize new data members
8581         got_mod_index_offset_ and tls_base_symbol_defined_.
8582         (Target_arm::Relocate::relocate_tls): New method.
8583         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8584          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8585         New methods.
8586         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8587         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8588         (Target_arm::got_mod_index_offset_,
8589         Target_arm::tls_base_symbol_defined_): New data members.
8590         (Target_arm::Scan::local, Target::Scan::global,
8591         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8592         relocations.
8593
8594 2010-02-18  Doug Kwan  <dougkwan@google.com>
8595
8596         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8597         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8598         text section as a parameter becuase some broken tools may not set
8599         the link in section header.
8600         (Target_arm::has_got_section): New method.
8601         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8602         without any mapping symbol as data only.  Remove warning.
8603         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8604         link in its section header, try to discover the link by inspecting the
8605         REL31 relocation at the beginning of the section.
8606         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8607         in error message.
8608         (Target_arm::Scan::global): Treat any reference to the symbol
8609         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8610
8611 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8612
8613         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8614         (Scan::global_reloc_may_be_function_pointer): New function.
8615         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8616         (Scan::global_reloc_may_be_function_pointer): New function.
8617         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8618         (Scan::global_reloc_may_be_function_pointer): New function.
8619         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8620         (Scan::global_reloc_may_be_function_pointer): New function.
8621         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8622         (Scan::global_reloc_may_be_function_pointer): New function.
8623         (Scan::possible_function_pointer_reloc): New function.
8624         (Target_x86_64::can_check_for_function_pointers): New function.
8625         * gc.h (gc_process_relocs): Scan relocation types to determine if
8626         function pointers were taken for targets that support it.
8627         * icf.cc (Icf::find_identical_sections): Include functions for
8628         folding in safe ICF whose pointer is not taken.
8629         * icf.h (Secn_fptr_taken_set): New typedef.
8630         (fptr_section_id_): New member.
8631         (section_has_function_pointers): New function.
8632         (set_section_has_function_pointers): New function.
8633         (check_section_for_function_pointers): New function.
8634         * options.h: Fix comment for safe ICF option.
8635         * target.h (can_check_for_function_pointers): New function.
8636         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8637         Modify icf_safe_test for X86-64.
8638         * testsuite/Makefile.in: Regenerate.
8639         * testsuite/icf_safe_so_test.cc: New file.
8640         * testsuite/icf_safe_so_test.sh: New file.
8641         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8642         (main): Change to take pointer to function kept_func_3.
8643         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8644         folding is done correctly for X86-64.
8645
8646 2010-02-12  David S. Miller  <davem@davemloft.net>
8647
8648         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8649         is_symbolless parameter.
8650         (Output_reloc<SHT_REL>::is_symbolless): New.
8651         (Output_reloc<SHT_REL>::is_symbolless_): New.
8652         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8653         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8654         (Output_reloc<SHT_RELA>::is_symbolless): New.
8655         (Output_data_reloc::add_global): Handle is_symbolless.
8656         (Output_data_reloc::add_global_relative): Likewise.
8657         (Output_data_reloc::add_local): Likewise.
8658         (Output_data_reloc::add_local_relative): Likewise.
8659         (Output_data_reloc::add_symbolless_global_addend): New.
8660         (Output_data_reloc::add_symbolless_local_addend): New.
8661         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8662         is_symbolless.
8663         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8664         instead of ->is_relative_
8665         (Output_reloc::write): Likewise.
8666         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8667         (Output_reloc::write_rel): Simplify.
8668
8669         * sparc.cc (Target_sparc::Scan::local): Use
8670         ->add_symbolless_local_addend as needed.
8671         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8672         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8673         based upon relocation offset.
8674
8675 2010-02-11  Doug Kwan  <dougkwan@google.com>
8676
8677         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8678         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8679         beginning of function.
8680         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8681         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8682         parameter is_32bit in calls to should_apply_static_reloc.
8683         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8684         (check_DATA): Add arm_abs_global.stdout.
8685         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8686         arm_abs_global.stdout): New rules.
8687         (MOSTLLYCLEANFILES): Add arm_abs_global
8688         * Makefile.in: Regenerate.
8689         * testsuite/arm_abs_global.s: New file.
8690         * testsuite/arm_abs_global.sh: Ditto.
8691         * testsuite/arm_abs_lib.s: Ditto.
8692
8693 2010-02-11  Ian Lance Taylor  <iant@google.com>
8694
8695         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8696         Read_relocs task.
8697         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8698         Allocate_commons_task first.
8699         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8700         task, rather than symtab_lock_.
8701         (Gc_process_relocs::~Gc_process_relocs): New function.
8702         (Gc_process_relocs::is_runnable): Check this_blocker_.
8703         (Gc_process_relocs::locks): Use next_blocker_ rather than
8704         blocker_.
8705         (Scan_relocs::~Scan_relocs): New function.
8706         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8707         symtab_lock_.
8708         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8709         next_blocker_.
8710         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8711         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8712         constructor accordingly.
8713         (class Gc_process_relocs): Likewise.
8714         (class Scan_relocs): Likewise.
8715         * common.h (class Allocate_commons_task): Remove symtab_lock_
8716         field, and corresponding constructor parameter.
8717         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8718         symtab_lock_.
8719         (Allocate_commons_task::locks): Likewise.
8720
8721 2010-02-11  Ian Lance Taylor  <iant@google.com>
8722
8723         * gold-threads.h (class Once): Define.
8724         (class Initialize_lock): Rewrite as child of Once.
8725         * gold-threads.cc (class Once_initialize): Define.
8726         (once_pointer_control): New static variable.
8727         (once_pointer, once_arg): New static variables.
8728         (c_run_once): New static function.
8729         (Once::Once, Once::run_once, Once::internal_run): New functions.
8730         (class Initialize_lock_once): Remove.
8731         (initialize_lock_control): Remove.
8732         (initialize_lock_pointer): Remove.
8733         (initialize_lock_once): Remove.
8734         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8735         (Initialize_lock::initialize): Rewrite.
8736         (Initialize_lock::do_run_once): New function.
8737         * archive.cc (Archive::interpret_header): Only clear name if it is
8738         not already empty.
8739         * fileread.cc: Include "gold-threads.h"
8740         (file_counts_lock): New static variable.
8741         (file_counts_initialize_lock): Likewise.
8742         (File_read::release): Only increment counts when using --stats.
8743         Use a lock around the increment.
8744         * parameters.cc (class Set_parameters_target_once): Define.
8745         (set_parameters_target_once): New static variable.
8746         (Parameters::Parameters): Move here from parameters.h.
8747         (Parameters::set_target): Rewrite.
8748         (Parameters::set_target_once): New function.
8749         (Parameters::clear_target): Move here and rewrite.
8750         * parameters.h (class Parameters): Update declarations.  Add
8751         set_parameters_target_once_ field.
8752         (Parameters::Parameters): Move to parameters.cc.
8753         (Parameters::clear_target): Likewise.
8754         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8755         task.
8756         (Start_group::~Start_group): New function.
8757         (Start_group::is_runnable): New function.
8758         (Start_group::locks, Start_group::run): New functions.
8759         (Finish_group::run): Change saw_undefined to size_t.
8760         * readsyms.h (class Start_group): Define.
8761         (class Finish_group): Change saw_undefined_ field to size_t.
8762         (Finish_group::Finish_group): Remove saw_undefined and
8763         this_blocker parameters.  Change all callers.
8764         (Finish_group::set_saw_undefined): New function.
8765         (Finish_group::set_blocker): New function.
8766         * symtab.h (class Symbol_table): Change saw_undefined to return
8767         size_t.  Change saw_undefined_ field to size_t.
8768         * target-select.cc (Set_target_once::do_run_once): New function.
8769         (Target_selector::Target_selector): Initialize set_target_once_
8770         field.  Don't initialize lock_ and initialize_lock_ fields.
8771         (Target_selector::instantiate_target): Rewrite.
8772         (Target_selector::set_target): New function.
8773         * target-select.h (class Set_target_once): Define.
8774         (class Target_selector): Update declarations.  Make
8775         Set_target_once a friend.  Remove lock_ and initialize_lock_
8776         fields.  Add set_target_once_ field.
8777
8778 2010-02-10  Ian Lance Taylor  <iant@google.com>
8779
8780         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8781         queueing any tasks.
8782         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8783         (queue_middle_tasks): Add all blockers before queueing any tasks.
8784         (queue_final_tasks): Likewise.
8785         * token.h (Task_token::add_blockers): New function.
8786         * object.h (Input_objects::number_of_relobjs): New function.
8787
8788 2010-02-10  Ian Lance Taylor  <iant@google.com>
8789
8790         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8791         shared, not if not position independent.
8792         * x86_64.cc (Relocate::relocate_tls): Likewise.
8793         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8794         (tls_pie_pic_test): New target.
8795         * testsuite/Makefile.in: Rebuild.
8796
8797         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8798         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8799         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8800         * testsuite/Makefile.in: Rebuild.
8801
8802 2010-02-09  David S. Miller  <davem@davemloft.net>
8803
8804         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8805         R_SPARC_RELATIVE using ->add_local_relative().
8806         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8807
8808         * output.h (Output_data_dynamic::add_section_size): New method
8809         that takes two Output_data objects.
8810         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8811         entry param.  Handle it in initializers.
8812         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8813         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8814         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8815         arg.
8816         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8817         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8818         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8819         for dynrel_includes_plt.
8820         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8821         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8822         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8823         before .rela.plt
8824         (Target_sparc::do_finalize_sections): Update to pass true for
8825         dynrel_includes_plt.
8826         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8827         output before .rela.plt
8828         (Target_powerpc::do_finalize_sections): Update to pass true for
8829         dynrel_includes_plt when 32-bit.
8830
8831 2010-02-08  Doug Kwan  <dougkwan@google.com>
8832
8833         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8834         method.
8835         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8836         Arm_relobj::scan_section_for_cortex_a8_stubs,
8837         Arm_relobj::do_relocation_section): Instead of calling
8838         Output_section::output_address, use faster
8839         Arm_relobj::simple_input_section_output_address.
8840
8841 2010-02-08  David S. Miller  <davem@davemloft.net>
8842
8843         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8844         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8845         relocation helper function.
8846
8847         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8848         just like R_SPARC_GOT{10,13,22}.
8849         (Target_sparc::Scan::local): Likewise.
8850         (Target_sparc::Relocate:relocate): Likewise.
8851
8852 2010-02-06  Ian Lance Taylor  <iant@google.com>
8853
8854         * configure.ac: Rewrite targetobjs duplicate removal code to use
8855         only shell constructs.
8856         * configure: Rebuild.
8857
8858 2010-02-05  Doug Kwan  <dougkwan@google.com>
8859
8860         PR 11247
8861         * arm.cc (Arm_relobj::section_is_scannable): New method.
8862         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8863         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8864
8865 2010-02-04  Doug Kwan  <dougkwan@google.com>
8866
8867         PR 11247
8868         * arm-reloc-property.cc (cstdio): Include.
8869         * configure.ac (targetobjs): Remove duplicates.
8870         * configure: Regenerate.
8871         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8872         big and little endian version for a given address size.
8873
8874 2010-02-03  Doug Kwan  <dougkwan@google.com>
8875
8876         * arm-reloc-property.cc
8877         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8878         definition.
8879         * arm-reloc-property.h
8880         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8881         New method definition.
8882         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8883         declaration.
8884         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8885         overflow to N.
8886         (GOT_PREL): Change implemented to Y.
8887         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8888         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8889         (Arm_relocate_functions::movw_abs_nc): Remove method.
8890         (Arm_relocate_functions::movt_abs): Ditto.
8891         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8892         (Arm_relocate_functions::thm_movt_abs): Ditto.
8893         (Arm_relocate_functions::movw_rel_nc): Ditto.
8894         (Arm_relocate_functions::movw_rel): Ditto.
8895         (Arm_relocate_functions::movt_rel): Ditto.
8896         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8897         (Arm_relocate_functions:thm_movw_rel): Ditto.
8898         (Arm_relocate_functions:thm_movt_rel): Ditto.
8899         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8900         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8901         New method definitions.
8902         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8903         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8904         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8905         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8906         (Target_arm::Relocate::relocate): Check for non-static or
8907         unimplemented relocation code and exit early.  Change calls to
8908         Target_arm::reloc_uses_thumb_bit and
8909         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8910         instead.  Refactor code to handle similar relocations to increase
8911         code sharing.  Remove check for unsupported relocation code in switch
8912         statement.
8913         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8914         relocation property table to find out size.  Change error message to
8915         print out the name of a relocation code instead of the numeric value.
8916         (Target_arm::scan_reloc_for_stub): Use relocation property table
8917         instead of calling Target_arm::reloc_uses_thumb_bit().
8918
8919 2010-02-02  Doug Kwan  <dougkwan@google.com>
8920
8921         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8922         types of relaxed input section.
8923
8924 2010-02-02  Doug Kwan  <dougkwan@google.com>
8925
8926         * Makefile.am (HFILES): Add arm-reloc-property.h.
8927         (DEFFILES): New.
8928         (TARGETSOURCES): Add arm-reloc-property.cc
8929         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8930         (libgold_a_SOURCES): $(DEFFILES)
8931         * Makefile.in: Regenerate.
8932         * arm-reloc-property.cc: New file.
8933         * arm-reloc-property.h: New file.
8934         * arm-reloc.def: New file.
8935         * arm.cc: Update comments.
8936         (arm-reloc-property.h): New included header.
8937         (arm_reloc_property_table): New global variable.
8938         (Target_arm::do_select_as_default_target): New method definition.
8939         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8940         arm-reloc-property to targ_extra_obj.
8941         * parameters.cc (set_parameters_target): Call
8942         Target::select_as_default_target().
8943         * target.h (Target::select_as_default_target): New method definition.
8944         (Target::do_select_as_default_target): Same.
8945
8946 2010-02-01  Doug Kwan  <dougkwan@google.com>
8947
8948         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8949         first_output_text_section_.
8950         (Arm_exidx_fixup::first_output_text_section): New method definition.
8951         (Arm_exidx_fixup::first_output_text_section_): New data member.
8952         (Arm_exidx_fixup::process_exidx_section): Record the first text
8953         output section seen.
8954         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8955         and entsize in output section header.
8956
8957 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8958
8959         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8960         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8961         (Arm_relocate_functions::thm_alu11): New Method.
8962         (Arm_relocate_functions::thm_pc8): New Method.
8963         (Arm_relocate_functions::thm_pc12): New Method.
8964         (Target_arm::Scan::local): Handle the relocations.
8965         (Target_arm::Scan::global): Likewise.
8966         (Target_arm::Relocate::relocate): Likewise.
8967         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8968
8969 2010-01-29  Doug Kwan  <dougkwan@google.com>
8970
8971         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8972         of relocation types as ld.
8973
8974 2010-01-29  Doug Kwan  <dougkwan@google.com>
8975
8976         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8977         to public.
8978         (Arm_relocate_functions::thumb_branch_common): Ditto.
8979         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8980         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8981         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8982         Arm_relocate_functions::jump24): Remove.
8983         (Target_arm::Relocate::relocate): Adjust code to call
8984         Arm_relocation_functions::arm_branch_common and
8985         Arm_relocation_functions::thumb_branch_common instead of their removed
8986         wrappers.  Merge switch-cases together to reduce source code size.
8987
8988 2010-01-29  Doug Kwan  <dougkwan@google.com>
8989
8990         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8991         output_local_symbol_count_needs_update_.
8992         (Arm_relobj::output_local_symbol_count_needs_update,
8993          Arm_relobj::set_output_local_symbol_count_needs_update,
8994          Arm_relobj::update_output_local_symbol_count): New methods.
8995         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8996         member.
8997         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8998         of pointed function as in a R_ARM_PREL31 relocation.
8999         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9000         for output local symbol count updating.
9001         (Target_arm::do_relax): Update output local symbol counts in objects
9002         if necessary.
9003         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9004
9005 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9006
9007         * arm.cc: Added support for the ARM relocations:
9008         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9009         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9010         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9011         movw_prel_nc).
9012         (Arm_relocate_functions::movw_rel): New method.
9013         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9014         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9015         thm_movw_prel_nc).
9016         (Arm_relocate_functions::thm_movw_rel): New method.
9017         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9018         thm_movt_prel).
9019         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9020         relocations.
9021         (Target_arm::Scan::global): Likewise.
9022         (Target_arm::Relocate::relocate): Likewise.
9023         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9024         Likewise.
9025
9026 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9027
9028         * arm.cc: Added support for ARM group relocations.
9029         (Target_arm::reloc_needs_sym_origin): New method.
9030         (Arm_relocate_functions::calc_grp_kn): New method.
9031         (Arm_relocate_functions::calc_grp_residual): New method.
9032         (Arm_relocate_functions::calc_grp_gn): New method.
9033         (Arm_relocate_functions::arm_grp_alu): New Method.
9034         (Arm_relocate_functions::arm_grp_ldr): New Method.
9035         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9036         (Arm_relocate_functions::arm_grp_ldc): New Method.
9037         (Target_arm::Scan::local): Handle the ARM group relocations.
9038         (Target_arm::Scan::global): Likewise.
9039         (Target_arm::Relocate::relocate): Likewise.
9040         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9041         Likewise.
9042
9043 2010-01-26  Doug Kwan  <dougkwan@google.com>
9044
9045         * arm.cc (set): Include.
9046         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9047         pointer type.
9048         (Arm_output_section::Text_section_list): New type.
9049         (Arm_output_section::append_text_sections_to_list): New method.
9050         (Arm_output_section::fix_exidx_coverage): Ditto.
9051         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9052         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9053         Relobj::set_section_offset() instead of
9054         Sized_relobj::invalidate_section_offset().
9055         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9056         parameter for section headers. Ignore relocation sections for
9057         unallocated sections and EXIDX sections.
9058         (Target_arm::fix_exidx_coverage): New method.
9059         (Target_arm::output_section_address_less_than): New type.
9060         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9061         linked text section instead of the EXIDX section.
9062         (Arm_output_section::create_stub_group): Add an assertion to check
9063         that this is not an EXIDX output section.
9064         (Arm_output_section::append_text_sections_to_list): New method.
9065         (Arm_output_section::fix_exidx_coverage): Ditto.
9066         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9067         Arm_relobj::section_needs_reloc_stub_scanning.
9068         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9069         first pass.
9070         (Target_arm::fix_exidx_coverage): New method.
9071         * object.h (Relobj::set_output_section): New method.
9072         (Sized_relobj::invalidate_section_offset): Remove method.
9073         (Sized_relobj::do_invalidate_section_offset): Remove method.
9074         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9075
9076 2010-01-25  Doug Kwan  <dougkwan@google.com>
9077
9078         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9079         Fix warning due to signed and unsigned comparison on a 32-bit host.
9080
9081 2010-01-22  Doug Kwan  <dougkwan@google.com>
9082
9083         * arm.cc (Target_arm::do_relax): Record an output section for section
9084         offset adjustment it contains any stub table that has changed.
9085         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9086         offsets in an output section if necessary.
9087         * output.cc (Output_section::Output_section): Initialize
9088         section_offsets_need_adjustments_.
9089         (Output_section::add_input_section_for_script): Renamed to
9090         Output_section::add_simple_input_section.
9091         (Output_section::save_states): Add a comment.
9092         (Output_section::discard_states): New method defintion.
9093         (Output_section::adjust_section_offsets): Same.
9094         * output.h (Output_section::add_input_section_for_script): Renamed to
9095         Output_section::add_simple_input_section.
9096         (Output_section::discard_states): New method declaration.
9097         (Output_section::adjust_section_offsets): Same.
9098         (Output_section::section_offsets_need_adjustment,
9099         Output_section::set_section_offsets_need_adjustment): New method
9100         definitions.
9101         (Output_section::section_offsets_need_adjustment_): New data member.
9102         * script-sections.cc
9103         (Output_section_element_input::set_section_address): Adjust code for
9104         renaming of Output_section::add_input_section_for_script.
9105         (Orphan_output_section::set_section_address): Same.
9106
9107 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9108
9109         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9110         Fix_v4bx enum values .
9111         * gold/options.h (General_options): New option definitions.
9112         (General_options::fix_v4bx): New method.
9113         (General_options::Fix_v4bx): New enum.
9114         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9115         (General_options::parse_fix_v4bx_interworking): New method.
9116
9117 2010-01-22  Doug Kwan  <dougkwan@google.com>
9118
9119         * arm.cc (Arm_exidx_fixup): New class.
9120
9121 2010-01-21  Doug Kwan  <dougkwan@google.com>
9122
9123         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9124         classes.
9125         (Arm_exidx_section_offset_map): New type.
9126
9127 2010-01-21  Doug Kwan  <dougkwan@google.com>
9128
9129         * arm.cc (Arm_exidx_input_section): New class.
9130         (Arm_relobj::exidx_input_section_by_link,
9131         Arm_relobj::exidx_input_section_by_shndx,
9132         Arm_relobj::make_exidx_input_section): New methods.
9133         (read_arm_attributes_section): Remove.
9134         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9135         information about them.
9136         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9137         to here.
9138
9139 2010-01-20  Doug Kwan  <dougkwan@google.com>
9140
9141         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9142         Input_section_specifier to Section_id.
9143         (Target_arm::new_arm_input_section: Adjust code for change of key
9144         type.
9145         (Target_arm::find_arm_input_section): Ditto.
9146         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9147         (Section_id): Remove.
9148         (Garbage_collection::Section_id_hash): Remove.
9149         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9150         (Section_id): Remove.
9151         (Icf::Section_id_hash): Remove.
9152         * object.h (Section_id, Const_section_id, Section_id_hash,
9153         Const_section_id_hash): New type definitions.
9154         * output.cc (Output_section::add_relaxed_input_section): Change to
9155         use Const_section_id instead of Input_section_specifier as key type.
9156         (Output_section::add_merge_input_section): Ditto.
9157         (Output_section::build_relaxation_map): Change to use Section_id
9158         instead of Input_section_specifier as key type.
9159         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9160         Ditto.
9161         (Output_section::convert_input_sections_to_relaxed_sections): Change
9162         to use Const_section_id instead of Input_section_specifier as key type.
9163         (Output_section::find_merge_section): Ditto.
9164         (Output_section::find_relaxed_input_section): Ditto.
9165         * output.h (Input_section_specifier): Remove class.
9166         (Output_section::Output_section_data_by_input_section_map): Change
9167         key type to Const_section_id.
9168         (Output_section::Output_relaxed_input_section_by_input_section_map):
9169         Ditto.
9170         (Output_section::Relaxation_map): Change key type to Section_id.
9171
9172 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9173
9174         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9175         (class Arm_v4bx_stub): New class.
9176         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9177         (Stub_factory::make_arm_v4bx_stub): New method.
9178         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9179         (Stub_table::empty): Handle v4bx stubs.
9180         (Stub_table::add_arm_v4bx_stub): New method.
9181         (Stub_table::find_arm_v4bx_stub): New method.
9182         (Arm_relocate_functions::v4bx): New method.
9183         (Target_arm::fix_v4bx): New method.
9184         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9185         (Stub_table::relocate_stubs): Likewise.
9186         (Stub_table::do_write): Likewise.
9187         (Stub_table::update_data_size_and_addralign): Likewise.
9188         (Stub_table::finalize_stubs):  Likewise.
9189         (Target_arm::Scan::local): Likewise.
9190         (Target_arm::Scan::global): Likewise.
9191         (Target_arm::do_finalize_sections): Likewise.
9192         (Target_arm::Relocate::relocate): Likewise.
9193         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9194         Likewise.
9195         (Target_arm::scan_reloc_for_stub): Likewise.
9196         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9197
9198 2010-01-19  Ian Lance Taylor  <iant@google.com>
9199
9200         * output.cc (Output_section_headers::do_sized_write): Write large
9201         segment count to sh_info field.
9202         (Output_file_header::do_sized_write): For large segment count,
9203         write PN_XNUM to e_phnum field.
9204
9205 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9206
9207         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9208         (Arm_relocate_functions::thm_jump8): New function.
9209         (Arm_relocate_functions::thm_jump11): New function.
9210         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9211         R_ARM_THM_JUMP11.
9212         (Target_arm::Scan::global): Likewise.
9213         (Target_arm::Relocate::relocate): Likewise.
9214         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9215         Likewise.
9216
9217 2010-01-14  Doug Kwan  <dougkwan@google.com>
9218
9219         * arm.cc (map, utility): Include headers.
9220         (Target_arm::apply_cortex_a8_workaround): New method.
9221         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9222         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9223         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9224         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9225         the --[no-]fix-cortex-a8 command line options.
9226         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9227         (Target_arm::relocate_stub): Use addend in instruction template.
9228         * options.h (DEFINE_bool): Set the user-set flag.
9229         (General_options): Add --[no-]-fix-cortex options.
9230         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9231         : Update fast look-up map after conversion.
9232
9233 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9234
9235         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9236         in the first pass of do_layout.
9237
9238 2010-01-13  Doug Kwan  <dougkwan@google.com>
9239
9240         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9241         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9242         apparent compiler problem of not folding static constant integral
9243         data members of elfcpp::Elf_sizes<32>.
9244
9245 2010-01-13  Doug Kwan  <dougkwan@google.com>
9246
9247         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9248         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9249         Arm_relobj::scan_section_for_cortex_a8_erratum,
9250         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9251         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9252         sections to scan for relocation stubs into a new method
9253         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9254         relocation and Cortex-A8 stub scanning.
9255         (Target_arm::do_relax): Force stubs to be after stubbed sections
9256         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9257         the beginning of a new relaxation pass.  Update a comment.
9258         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9259
9260 2010-01-12  Ian Lance Taylor  <iant@google.com>
9261
9262         * target-reloc.h (visibility_error): New inline function.
9263         (relocate_section): Call visibility_error.
9264         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9265         (MOSTLYCLEANFILES): Likewise.
9266         (protected_4_pic.o, protected_3.err): New targets.
9267         * testsuite/protected_4.cc: New file.
9268
9269 2010-01-12  Doug Kwan  <dougkwan@google.com>
9270
9271         * arm.cc (Cortex_a8_reloc): New class.
9272         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9273         and cortex_a8_relocs_info_.
9274         (Target_arm::fix_cortex_a8): New method definition.
9275         (Target_arm::Cortex_a8_relocs_info): New type.
9276         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9277         New data member declarations.
9278         (Target_arm::scan_reloc_for_stub): Record information about
9279         relocations for THUMB branches that might be exempted from the
9280         Cortex-A8 workaround.
9281         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9282         at the beginning of a relaxation pass.
9283
9284 2010-01-12  Doug Kwan  <dougkwan@google.com>
9285
9286         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9287         (Arm_relobj::Mapping_symbol_position,
9288          Arm_reloj::Mapping_symbol_position_less,
9289          Arm_relobj::Mapping_symbols_info): New types.
9290         (Target_arm::is_mapping_symbol_name): New method definition.
9291         (Arm_relobj::do_count_local_symbols): Save information about mapping
9292         symbols.
9293
9294 2010-01-11  Doug Kwan  <dougkwan@google.com>
9295
9296         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9297         Arm_relocate_functions::thumb32_branch_upper,
9298         Arm_relocate_functions::thumb32_branch_lower,
9299         Arm_relocate_functions::thumb32_cond_branch_offset,
9300         Arm_relocate_functions::thumb32_cond_branch_upper,
9301         Arm_relocate_functions::thumb32_cond_branch_lower,
9302         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9303         branch offset encoding.
9304         (Arm_relocate_functions::thumb_branch_common): Use new branch
9305         offset encoding methods to avoid code duplication.
9306         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9307         (Stub_addend_reader::operator()): Use new branch encoding method
9308         to avoid code duplication.
9309
9310 2010-01-11  Doug Kwan  <dougkwan@google.com>
9311
9312         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9313         (Target_arm::do_finalize_sections): Define special EXIDX section
9314         symbols only if referenced.
9315         * gc.h (Garbage_collection::add_reference): New method.
9316         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9317         code duplication.
9318
9319 2010-01-11  Ian Lance Taylor  <iant@google.com>
9320
9321         * script.cc (Version_script_info::build_expression_list_lookup):
9322         Change complaing about duplicate wildcard match from error to
9323         warning.
9324
9325         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9326         of 2009-12-30.
9327         (Version_script_info::Version_script_info): Initialize globs_,
9328         default_version_, default_is_global_, and exact_.  Don't
9329         initialize globals_ or locals_.
9330         (Version_script_info::build_lookup_tables): Build local symbols
9331         first.
9332         (Version_script_info::unquote): New function.
9333         (Version_script_info::add_exact_match): New function.
9334         (Version_script_info::build_expression_list_lookup): Remove lookup
9335         parameter.  Add is_global parameter.  Change all callers.  Handle
9336         wildcard pattern specially.  Unquote pattern.  Call
9337         add_exact_match.
9338         (Version_script_info::get_name_to_match): New function.
9339         (Version_script_info::get_symbol_version): New function.
9340         (Version_script_info::get_symbol_version_helper): Remove.
9341         (Version_script_info::check_unmatched_names): Call unquote.
9342         * script.h (class Version_script_info): Change get_symbol_version
9343         to be non-inline and add is_global parameter; change all callers.
9344         Rewrite symbol_is_local.  Update declarations.  Define struct
9345         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9346         Remove globals_ and locals_ members.  Add exact_, globs_,
9347         default_version_, is_global_.
9348         (Version_script_info::Glob): Remove pattern, add expression and
9349         is_global.  Update constructor.  Change all callers.
9350         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9351         default version.
9352         (Versions::symbol_section_contents): If a symbol is undefined, or
9353         defined in a dynamic object, set the version index to
9354         VER_NDX_LOCAL.
9355         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9356         symbol_is_local.
9357         (Symbol_table::add_from_pluginobj): Likewise.
9358         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9359
9360 2010-01-11  Doug Kwan  <dougkwan@google.com>
9361
9362         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9363         (incremental_dump_LDADD): Add linking option for libintl.
9364         * Makefile.in: Regenerate.
9365
9366 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9367
9368         PR gold/11144
9369         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9370         instead of -Ds.
9371         * testsuite/Makefile.in: Regenerated.
9372
9373 2010-01-10  Doug Kwan  <dougkwan@google.com>
9374
9375         * options.h (DEFINE_var): Use parentheses around argument varname__
9376         in macro body to avoid any unintended subsequent substitutions.
9377
9378 2010-01-10  Ian Lance Taylor  <iant@google.com>
9379
9380         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9381         candidates before doing symbol resolution.
9382
9383         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9384         ODR candidates if only one is weak.
9385
9386 2010-01-08  Ian Lance Taylor  <iant@google.com>
9387
9388         * script.cc (Version_script_info::build_expression_list_lookup):
9389         Don't warn about ambiguous version, just record the ambiguity.
9390         (Version_script_info::get_symbol_version_helper): Give error if
9391         version is ambiguous.
9392
9393 2010-01-08  Doug Kwan  <dougkwan@google.com>
9394
9395         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9396         prev_data_size_ and prev_addralign_.  Remove initializer for
9397         deleted data member has_been_changed_.
9398         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9399         to determine if the table is empty.
9400         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9401         Remove.
9402         (Stub_table::add_reloc_stub): Define method in class definition
9403         instead of just declaring it there.
9404         (Stub_table::add_cortex_a8_stub): New method definition.
9405         (Stub_table::update_data_size_and_addralign): Ditto.
9406         (Stub_table::finalize_stubs): Ditto.
9407         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9408         (Stub_table::do_addralign_): Return address alignment in the
9409         (Stub_table::do_reset_address_and_file_offset): Define method in
9410         class definition instead of declaring it there.  Set current data
9411         size to be the data size of the previous pass.
9412         (Stub_table::set_final_data_size): Use current data size as the
9413         final data size.
9414         (Stub_table::relocate_stub): Change parameter type of stub from
9415         Reloc_stub pointer to Stub pointer.
9416         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9417         (Stub_table::Cortex_a8_stub_list): New typedef.
9418         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9419          Stub_table::prev_addralign_): New data member.
9420         (Arm_relobj::Arm_relobj): Initialize data member
9421         section_has_cortex_a8_workaround_.
9422         (Arm_relobj::section_has_cortex_a8_workaround,
9423          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9424          definitions.
9425         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9426         declarations.
9427         (Target_arm::relocate_stub): Change parameter type of stub from
9428         Reloc_stub pointer to Stub pointer.
9429         (Insn_template::size, Insn_template::alignment): Handle
9430         THUMB16_SPECIAL_TYPE.
9431         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9432          Stub_table::update_data_size_and_addralign,
9433          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9434         definitions.
9435         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9436         (Stub_table::do_write): Ditto.
9437         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9438
9439 2010-01-08  Ian Lance Taylor  <iant@google.com>
9440
9441         PR 11108
9442         * symtab.h (class Symbol): Remove fields is_target_special_ and
9443         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9444         (Symbol::is_defined_in_discarded_section): New function.
9445         (Symbol::set_is_defined_in_discarded_section): New function.
9446         (Symbol::has_plt_offset): Rewrite.
9447         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9448         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9449         Don't initialize is_target_special_ or has_plt_offset_.
9450         Initialize is_defined_in_discarded_section_.
9451         (Symbol_table::add_from_relobj): If appropriate, set
9452         is_defined_in_discarded_section.
9453         * resolve.cc (Symbol::override_base_with_special): Don't test
9454         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9455         * target-reloc.h (relocate_section): Do special handling for
9456         symbols defined in discarded sections for global symbols as well
9457         as local symbols.
9458
9459 2010-01-08  Ian Lance Taylor  <iant@google.com>
9460
9461         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9462         the SHT_SYMTAB case.
9463
9464 2010-01-08  Ian Lance Taylor  <iant@google.com>
9465
9466         * object.cc (Sized_relobj::do_layout): Don't get confused if
9467         layout_eh_frame returns NULL.
9468
9469 2010-01-08  Ian Lance Taylor  <iant@google.com>
9470
9471         PR 11084
9472         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9473         dynamic symbol table, use the normal symbol table.
9474         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9475         symbol table.
9476
9477 2010-01-08  Ian Lance Taylor  <iant@google.com>
9478
9479         PR 11072
9480         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9481         sections.
9482
9483 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9484
9485         * version.cc (print_version): Change to "Copyright 2010".
9486
9487 2010-01-08  Ian Lance Taylor  <iant@google.com>
9488
9489         PR 10287
9490         PR 11063
9491         * i386.cc (class Target_i386): Change return type of plt_section
9492         to be non-const.
9493         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9494         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9495         tls_desc_rel_ field.
9496         (Output_data_plt_i386::rel_tls_desc): New function.
9497         (Target_i386::rel_tls_desc_section): New function.
9498         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9499         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9500         R_386_TLS_DESC reloc in rel_tls_desc_section.
9501         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9502         Define struct Tlsdesc_info.
9503         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9504         (Target_x86_64::do_reloc_symbol_index): New function.
9505         (Target_x86_64::add_tlsdesc_info): New function.
9506         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9507         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9508         tlsdesc_rel_ field.
9509         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9510         all callers.
9511         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9512         (Target_x86_64::rela_tlsdesc_section): New function.
9513         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9514         handling.
9515         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9516         (Target_x86_64::do_reloc_addend): New function.
9517         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9518         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9519         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9520         (Output_reloc::type): New function.
9521         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9522         (Output_reloc::is_target_specific): New function.
9523         (Output_reloc::target_arg): New function.
9524         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9525         absolute relocs and target specific relocs.
9526         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9527         add_target_specific.
9528         (class Output_data_reloc) [SHT_RELA]: Likewise.
9529         * output.cc (Output_reloc::Output_reloc): Add four new versions
9530         for absolute relocs and target specific relocs.
9531         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9532         (Output_reloc::get_symbol_index): Likewise.
9533         (Output_reloc::local_section_offset): Check that local_sym_index_
9534         is not TARGET_CODE or 0.
9535         (Output_reloc::symbol_value): Likewise.
9536         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9537         reloc.
9538         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9539         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9540         functions.
9541         * layout.cc (add_target_dynamic_tags): Use output section for
9542         DT_PLTRELSZ and DT_JMPREL.
9543
9544 2010-01-07  Ian Lance Taylor  <iant@google.com>
9545
9546         PR 11061
9547         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9548         function.
9549         (class Output_data_reloc_generic): Define.
9550         (class Output_data_reloc_base): Change base class to
9551         Output_data_reloc_generic.  Change add() method to call
9552         bump_relative_reloc_count for a relative reloc.  Remove
9553         sort_relocs_ field.
9554         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9555         to sort_relocs().
9556         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9557         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9558         appropriate.
9559         * layout.h (class Layout): Update declaration.
9560
9561 2010-01-07  Ian Lance Taylor  <iant@google.com>
9562
9563         * output.h (class Output_data): Add const version of
9564         output_section and do_output_section.
9565         (class Output_section_data): Add const version of
9566         do_output_section.
9567         (class Output_section): Likewise.
9568         * layout.cc (Layout::add_target_dynamic_tags): New function.
9569         * layout.h (class Layout): Update declarations.
9570         * arm.cc (Target_arm::do_finalize_sections): Use
9571         add_target_dynamic_tags.
9572         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9573         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9574         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9575         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9576
9577 2010-01-07  Ian Lance Taylor  <iant@google.com>
9578
9579         PR 11042
9580         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9581         object as needed.
9582
9583 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9584             Ian Lance Taylor  <iant@google.com>
9585
9586         PR 11019
9587         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9588         Xindex::read_symtab_xindex.
9589
9590 2010-01-07  Doug Kwan  <dougkwan@google.com>
9591
9592         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9593         (Insn_template::thumb16_bcond_insn): New method declaration.
9594         (Insn_template): Fix spelling.
9595         (Stub::thumb16_special): New method declaration.
9596         (Stub::do_write): Define virtual method which was previously pure
9597         virtual.
9598         (Stub::do_thumb16_special): New method declaration.
9599         (Stub::do_fixed_endian_write): New template member.
9600         (Reloc_stub::do_write): Remove.
9601         (Reloc_stub::do_fixed_endian_write): Remove.
9602         (Cortex_a8_stub): New class definition.
9603         (Stub_factory::make_cortex_a8_stub): New method definition.
9604         (Stub_factory::Stub_factory): Add missing static storage class
9605         qualifier for elf32_arm_stub_a8_veneer_blx.
9606
9607 2010-01-07  Ian Lance Taylor  <iant@google.com>
9608
9609         PR 10980
9610         * options.h (class General_options): Add --warn-unresolved-symbols
9611         and --error-unresolved-symbols.
9612         * errors.cc (Errors::undefined_symbol): Implement
9613         --warn-unresolved-symbols.
9614
9615         * options.h (class General_options): Add -z text and -z textoff.
9616         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9617
9618 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9619
9620         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9621         (Garbage_collection::cident_sections): New function.
9622         (Garbage_collection::add_cident_section): New function.
9623         (Garbage_collection::cident_sections_): New member.
9624         (gc_process_relocs): Add references to sections whose names are C
9625         identifiers.
9626         * gold.h (cident_section_start_prefix): New constant.
9627         (cident_section_stop_prefix): New constant.
9628         (is_cident): New function.
9629         * layout.cc (Layout::define_section_symbols): Replace string constants
9630         with the newly defined constants.
9631         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9632         C identifiers.
9633         * testsuite/Makefile.am: Add gc_orphan_section_test.
9634         * testsuite/Makefile.in: Regenerate.
9635         * testsuite/gc_orphan_section_test.cc: New file.
9636         * testsuite/gc_orphan_section_test.sh: New file.
9637
9638 2010-01-06  Ian Lance Taylor  <iant@google.com>
9639
9640         PR 10980
9641         * options.h (class General_options): Add --warn-shared-textrel.
9642         * layout.cc (Layout::finish_dynamic_section): Implement
9643         --warn-shared-textrel.
9644
9645         PR 10980
9646         * options.h (class General_options): Add --warn-multiple-gp.
9647
9648 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9649
9650         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9651         $(THREADSLIB) and $(LIBDL).
9652         * Makefile.in: Rebuild.
9653
9654 2010-01-06  Ian Lance Taylor  <iant@google.com>
9655
9656         PR 10980
9657         * options.cc (General_options::parse_section_start): New function.
9658         (General_options::section_start): New function.
9659         (General_options::General_options): Initialize all members.
9660         * options.h: Include <map>
9661         (class General_options): Add --section-start.  Add section_starts_
9662         member.
9663         * layout.cc (Layout::attach_allocated_section_to_segment): If
9664         --section-start was used, set the address of the segment.  Remove
9665         local sort_sections.
9666         (Layout::relaxation_loop_body): If the address of the load segment
9667         has been set by --section-start, don't use it.
9668         * output.h (Output_segment::update_flags_for_output_section): New
9669         function.
9670         * output.cc (Output_segment::add_output_section): Call
9671         update_flags_for_output_section.
9672
9673 2010-01-05  Ian Lance Taylor  <iant@google.com>
9674
9675         PR 10980
9676         * options.h (class General_options): Add --undefined-version.
9677         * script.cc (struct Version_expression): Add was_matched_by_symbol
9678         field.
9679         (Version_script_info::matched_symbol): New function.
9680         (Version_script_info::get_symbol_version_helper): Call
9681         matched_symbol.
9682         (Version_script_info::check_unmatched_names): New function.
9683         * script.h (class Version_script_info): Update declarations.
9684         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9685
9686         * options.h (class General_options): Use DEFINE_bool_alias for
9687         allow_multiple_definition.
9688         * resolve.cc (Symbol_table::should_override): Don't test
9689         allow_multiple_definition.
9690
9691         PR 10980
9692         * options.h (class General_options): Add --cref.
9693         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9694         until after printing cref table.
9695         * cref.cc: Include "symtab.h".
9696         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9697         (Cref_table_compare::operator()): New function.
9698         (Cref_inputs::gather_cref): New function.
9699         (filecol): New static const.
9700         (Cref_inputs::print_cref): New function.
9701         (Cref::print_cref): New function.
9702         * cref.h: Include <cstdio>.
9703         (class Cref): Update declarations.
9704         * mapfile.h (Mapfile::file): New function.
9705         * object.h (class Object): Define Symbols.  Declare virtual
9706         do_get_global_symbols.
9707         (Object::get_global_symbols): New function.
9708         * object.cc (Input_objects::add_object): Pass object to cref_ if
9709         --cref.
9710         (Input_objects::archive_start): Likewise.
9711         (Input_objects::archive_stop): Likewise.
9712         (Input_objects::print_cref): New function.
9713         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9714         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9715         --cref.
9716         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9717         function.
9718         * plugin.h (class Sized_pluginobj): Update declarations.
9719
9720 2010-01-05  Ian Lance Taylor  <iant@google.com>
9721
9722         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9723         to is_default_version.  Rename insdef to insdefault.
9724         (Symbol_table::add_from_relobj): Rename def to is_default_version
9725         and local to is_forced_local.
9726         (Symbol_table::add_from_pluginobj): Likewise.
9727         (Symbol_table::add_from_dynobj): Likewise.
9728         (Symbol_table::define_special_symbol): Rename insdef to
9729         insdefault.
9730
9731 2010-01-04  Ian Lance Taylor  <iant@google.com>
9732
9733         PR 10980
9734         * options.h (class General_options): Add
9735         --allow-multiple-definition and -z muldefs.
9736         * resolve.cc (Symbol_table::should_override): Don't warn about a
9737         multiple symbol definition if --allow-multiple-definition or -z
9738         muldefs.
9739
9740         PR 10980
9741         * options.h (class General_options): Add --add-needed and
9742         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9743         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9744         error if --copy-dt-needed-entries aka --add-needed is used and
9745         would cause a change in behaviour.
9746
9747         PR 10980
9748         * options.h (class General_options): Add -G as a short version of
9749         --shared.  Add no-op options -assert, -g, and -i.
9750
9751 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9752
9753         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9754         check for .text or .gnu.linkonce.t sections.
9755         * icf.cc (Icf::find_identical_sections): Ditto.
9756         Change the detection for mangled function name within the section
9757         name.
9758         * icf.h (is_section_foldable_candidate): New function.
9759
9760 2009-12-30  Ian Lance Taylor  <iant@google.com>
9761
9762         PR 10980
9763         * options.h (class General_options): Permit two dashes with
9764         --retain-symbols-file.
9765
9766 2009-12-30  Ian Lance Taylor  <iant@google.com>
9767
9768         PR 10979
9769         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9770         don't put the file header and segment headers in the text
9771         segment.
9772
9773         PR 10979
9774         * common.cc (Sort_commons::operator()): Stabilize sort when both
9775         entries are NULL.
9776         (Symbol_table::do_allocate_commons_list): When allocating common
9777         symbols, skip a symbol which is no longer common.
9778         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9779         an object before checking its type.
9780         * testsuite/common_test_2.c: New file.
9781         * testsuite/common_test_3.c: New file.
9782         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9783         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9784         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9785         (common_test_2_pic.o, common_test_2.so): New targets.
9786         (common_test_3_pic.o, common_test_3.so): New targets.
9787         * testsuite/Makefile.in: Rebuild.
9788
9789         PR 10979
9790         * script.cc (read_input_script): If we see a new SECTIONS clause,
9791         and we have added an input section, give an error.
9792         * layout.h (class Layout): Add have_added_input_section function.
9793         Add have_added_input_section_ field.
9794         * layout.cc (Layout::Layout): Initialize
9795         have_added_input_section_.
9796         (Layout::layout): Set have_added_input_section_.
9797         (Layout::layout_eh_frame): Likewise.
9798
9799 2009-12-30  Ian Lance Taylor  <iant@google.com>
9800
9801         PR 10931
9802         * options.h (class General_options): Add --sort-common option.
9803         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9804         * common.cc (Sort_common): Add sort_order parameter to
9805         constructor.  Add sort_order_ field.
9806         (Sort_commons::operator): Check sort_order_.
9807         (Symbol_table::allocate_commons): Determine the sort order.
9808         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9809         Change all callers.
9810         (Symbol_table::do_allocate_commons_list): Likewise.
9811
9812 2009-12-30  Ian Lance Taylor  <iant@google.com>
9813
9814         PR 10916
9815         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9816         symbols from this object, don't change the visibility of an
9817         undefined symbol.
9818         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9819
9820 2009-12-30  Ian Lance Taylor  <iant@google.com>
9821
9822         PR 10861
9823         * script.h (class Version_script_info): Define Language enum.
9824         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9825         new fields globals_, locals_, and is_finalized_.
9826         * script.cc: Various formatting fixes.
9827         (class Parser_closure): Change language_stack_ from a vector of
9828         std::string to one of Version_script_info::Language.  Adjust all
9829         uses accordingly.
9830         (class Lazy_demangler): Remove.
9831         (struct Version_expression): Change language from std::string to
9832         Version_script_info::Language.
9833         (Version_script_info::Version_script_info): New function.
9834         (Version_script_info::~Version_script_info): Don't call clear.
9835         (Version_script_info::finalize): New function.
9836         (Version_script_info::build_lookup_tables): New function.
9837         (Version_script_info::build_expression_list_lookup): New
9838         function.
9839         (Version_script_info::get_symbol_version_helper): Rewrite to use
9840         lookup tables.
9841         (Version_script_info::print_expression_list): Adjust to use
9842         Version_script_info::Language.
9843         (script_push_lex_into_version_mode): Check that the version script
9844         has not been finalized.
9845         (version_script_push_lang): Change language string to
9846         Version_script_info::Language.
9847         * options.cc (Command_line::version_script): New function.
9848         * options.h (class General_options): Add finalize_dynamic_list
9849         function.  Change version_script from declaration to definition.
9850         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9851         * testsuite/version_script.map: Remove duplicate def of foo.
9852         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9853         version_script.map.
9854         * testsuite/Makefile.in: Rebuild.
9855
9856 2009-12-30  Ian Lance Taylor  <iant@google.com>
9857
9858         PR 10843
9859         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9860         if the input symbol index is 0, make the output symbol index 0.
9861
9862 2009-12-30  Ian Lance Taylor  <iant@google.com>
9863
9864         PR 10670
9865         * options.h (class General_options): Add -x/--discard-all.
9866         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9867         --discard-all.  If the local symbol needs a dynamic entry, check
9868         that before handling --discard-locals.
9869
9870 2009-12-30  Ian Lance Taylor  <iant@google.com>
9871
9872         PR 10450
9873         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9874         flags to PF_R.
9875         (Output_segment::add_output_section): Don't change the flags if
9876         the type is PT_TLS.
9877
9878         PR 10450
9879         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9880         GNU hash table if they need a dynamic value.  Otherwise, don't add
9881         them if they are defined in a dynamic object or are forced local.
9882
9883 2009-12-29  Ian Lance Taylor  <iant@google.com>
9884
9885         PR 10450
9886         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9887         .gnu.hash table for a 32-bit target.
9888
9889         PR 10450
9890         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9891         regular and a dynamic object only needs a dynamic symbol table
9892         entry if it is externally visible.
9893
9894         PR 10450
9895         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9896         constructor.  Add global_offset_table_ field.
9897         (Target_i386::got_section): Set global_offset_table_.
9898         (Target_i386::do_finalize_sections): Set global_offset_table_
9899         size.
9900         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9901         in constructor.  Add global_offset_table_ field.
9902         (Target_x86_64::got_section): Set global_offset_table_.
9903         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9904         size.
9905
9906         * layout.cc (Layout::Layout): Initialize increase_relro_.
9907         (Layout::get_output_section): Add is_relro, is_last_relro, and
9908         is_first_non_relro parameters.  Change all callers.
9909         (Layout::choose_output_section): Likewise.
9910         (Layout::add_output_section_data): Likewise.
9911         (Layout::make_output_section): Likewise.
9912         (Layout::set_segment_offsets): Clear increase_relro when using a
9913         linker script.
9914         * layout.h (class Layout): Add increase_relro method.  Add
9915         increase_relro_ field.  Update declarations.
9916         * output.cc (Output_section::Output_section): Initialize
9917         is_last_relro_ and is_first_non_relro_.
9918         (Output_segment::add_output_section): Group relro sections is
9919         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9920         (Output_segment::maximum_alignment): Remove relro handling.
9921         (Output_segment::set_section_addresses): Add increase_relro
9922         parameter.  Change all callers.  Add initial alignment to align
9923         relro sections on separate page.  Remove old relro handling.
9924         (Output_segment::set_section_list_addresses): Remove in_relro
9925         parameter.  Change all callers.
9926         (Output_segment::set_offset): Add increase parameter.  Change all
9927         callers.  Remove old relro handling.
9928         * output.h (class Output_section): Add new methods: is_last_relro,
9929         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9930         Add is_last_relro_ and is_first_non_relro_ fields.
9931         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9932         Create separate .got.plt section.  Call increase_relro.
9933         * x86_64.cc (Target_x86_64::got_section): Likewise.
9934         * testsuite/relro_script_test.t: Add .got.plt.
9935
9936         PR 10450
9937         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9938         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9939         (Layout::finalize): Call set_dynamic_symbol_size.
9940         (Layout::set_dynamic_symbol_size): New function.
9941         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9942         set_dynamic_symbol_size.
9943
9944         PR 10450
9945         * output.h (class Output_section): Add is_entsize_zero_ field.
9946         * output.cc (Output_section::Output_section): Initialize
9947         is_entsize_zero_.
9948         (Output_section::set_entsize): If two different entsizes are
9949         requested, force it to zero.
9950         (Output_section::add_input_section): Set flags for .debug_str
9951         before updating section flags.  Set entsize.
9952         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9953         and SHF_STRING if all input sections have those flags.
9954
9955 2009-12-29   Rafael Espindola  <espindola@google.com>
9956
9957         * main.cc (main): Fix the sys time reporting.
9958         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9959         reporting.
9960
9961 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9962
9963         * options.cc (General_options::parse_version): Allow -v to exit
9964         without an error if there is nothing to link.
9965
9966 2009-12-29  Ian Lance Taylor  <iant@google.com>
9967
9968         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9969         using a version of gcc before 4.1.
9970         * configure: Rebuild.
9971
9972 2009-12-28  Chris Demetriou  <cgd@google.com>
9973
9974         * attributes.cc (Output_attributes_section_data::do_write): Use
9975         std::vector::front rather than std::vector::data.
9976
9977 2009-12-28  Ian Lance Taylor  <iant@google.com>
9978
9979         * symtab.h (class Symbol_table): Add enum Defined.
9980         * resolve.cc (Symbol_table::should_override): Add defined
9981         parameter.  Change all callers.  Test whether object is NULL
9982         before calling a method on it.
9983         (Symbol_table::report_resolve_problem): Add defined parameter.
9984         Change all callers.
9985         (Symbol_table::should_override_with_special): Likewise.
9986         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9987         parameter.  Change all callers.
9988         (Symbol_table::do_define_in_output_data): Likewise.
9989         (Symbol_table::define_in_output_segment): Likewise.
9990         (Symbol_table::do_define_in_output_segment): Likewise.
9991         (Symbol_table::define_as_constant): Likewise.
9992         (Symbol_table::do_define_as_constant): Likewise.
9993         * script.h (class Symbol_assignment): Add is_defsym parameter to
9994         constructor; change all callers.
9995         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9996         parameter.  Change all callers.  Add is_defsym_ field.
9997         (class Parser_closure): Add parsing_defsym parameter to
9998         constructor; change all callers.  Add parsing_defsym accessor
9999         function.  Add parsing_defsym_ field.
10000
10001 2009-12-28  Ian Lance Taylor  <iant@google.com>
10002
10003         * gold.cc (queue_middle_tasks): Fix formatting.
10004         * object.cc (Relobj::is_section_name_included): Likewise.
10005
10006 2009-12-23  Ian Lance Taylor  <iant@google.com>
10007
10008         * i386.cc (Target_i386::do_calls_non_split): Recognize
10009         -fsplit-stack prologue for a function with a static chain.
10010         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10011         -fsplit-stack prologue when using %r11.
10012
10013 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10014
10015         * options.cc (General_options::parse_version): Make -v continue and do
10016         the link like GNU ld does.
10017
10018 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10019
10020         * Makefile.am (CCFILES): Add timer.cc.
10021         (HFILES): Add timer.h.
10022         * configure.ac: Check for sysconf and times.
10023         * main.cc: include timer.h.
10024         (main): Use Timer instead of get_run_time.
10025         * timer.cc: New.
10026         * timer.h: New.
10027         * workqueue.cc: include timer.h.
10028         (Workqueue::find_and_run_task):
10029         Report user, sys and wall time.
10030         * Makefile.in: Regenerate.
10031         * config.in: Regenerate.
10032         * configure: Regenerate.
10033
10034 2009-12-16  Doug Kwan  <dougkwan@google.com>
10035
10036         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10037         sections.
10038         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10039         relaxed input sections.
10040         * output.cc (Output_section::find_relaxed_input_section): Change
10041         return type to Output_relaxed_input_section pointer.  Adjust code
10042         for new type of relaxed_input_section_map_.
10043         * output.h (Output_section::find_relaxed_input_section): Change
10044         return type to Output_relaxed_input_section pointer.
10045         (Output_section::Output_relaxed_input_section_by_input_section_map):
10046         New type.
10047         (Output_section::relaxed_input_section_map_): Change type to
10048         Output_section::Output_relaxed_input_section_by_input_section_map.
10049         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10050         input section.
10051
10052 2009-12-15  Ian Lance Taylor  <iant@google.com>
10053
10054         * layout.cc (Layout::create_shstrtab): Only write out after input
10055         sections if we are compressing debug sections.
10056
10057 2009-12-15  Ian Lance Taylor  <iant@google.com>
10058
10059         * archive.cc (Archive::add_symbols): Only look up a symbol without
10060         a version if there is, in fact, a version.
10061
10062 2009-12-14  Ian Lance Taylor  <iant@google.com>
10063
10064         Revert -Wshadow changes, all changes from:
10065         2009-12-11  Doug Kwan  <dougkwan@google.com>
10066         2009-12-11  Nick Clifton  <nickc@redhat.com>
10067         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10068
10069 2009-12-11  Doug Kwan  <dougkwan@google.com>
10070
10071         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10072         due to -Wshadow.
10073         * attributes.cc (Object_attribute::size): Ditto.
10074         (Attributes_section_data::size): Ditto.
10075         (Attributes_section_data::Attributes_section_data): Ditto.
10076         (Output_attributes_section_data::do_write): Ditto.
10077         * attributes.h (Object_attribute::set_type): Ditto.
10078         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10079
10080 2009-12-11  Nick Clifton  <nickc@redhat.com>
10081
10082         * archive.cc: Fix shadowed variable warnings.
10083         * arm.cc: Likewise.
10084         * compressed_output.cc: Likewise.
10085         * compressed_output.h: Likewise.
10086         * configure: Likewise.
10087         * dwarf_reader.cc: Likewise.
10088         * dynobj.cc: Likewise.
10089         * dynobj.h: Likewise.
10090         * ehframe.cc: Likewise.
10091         * ehframe.h: Likewise.
10092         * errors.cc: Likewise.
10093         * expression.cc: Likewise.
10094         * fileread.cc: Likewise.
10095         * fileread.h: Likewise.
10096         * freebsd.h: Likewise.
10097         * i386.cc: Likewise.
10098         * icf.cc: Likewise.
10099         * incremental.h: Likewise.
10100         * layout.cc: Likewise.
10101         * layout.h: Likewise.
10102         * mapfile.cc: Likewise.
10103         * merge.cc: Likewise.
10104         * merge.h: Likewise.
10105         * object.cc: Likewise.
10106         * object.h: Likewise.
10107         * options.h: Likewise.
10108         * output.cc: Likewise.
10109         * output.h: Likewise.
10110         * parameters.cc: Likewise.
10111         * plugin.cc: Likewise.
10112         * powerpc.cc: Likewise.
10113         * reduced_debug_output.cc: Likewise.
10114         * reduced_debug_output.h: Likewise.
10115         * reloc.cc: Likewise.
10116         * reloc.h: Likewise.
10117         * resolve.cc: Likewise.
10118         * script-sections.cc: Likewise.
10119         * script.cc: Likewise.
10120         * script.h: Likewise.
10121         * sparc.cc: Likewise.
10122         * symtab.cc: Likewise.
10123         * symtab.h: Likewise.
10124         * target-select.cc: Likewise.
10125         * target-select.h: Likewise.
10126         * token.h: Likewise.
10127         * workqueue.cc: Likewise.
10128         * workqueue.h: Likewise.
10129         * x86_64.cc: Likewise.
10130
10131 2009-12-10  Doug Kwan  <dougkwan@google.com>
10132
10133         * arm.cc (attributes.h): New include.
10134         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10135         (Arm_relobj::~Arm_relobj): Delete object pointed by
10136         attributes_section_data_.
10137         (Arm_relobj::attributes_section_data): New method definition.
10138         (Arm_relobj::attributes_section_data_): New data member declaration.
10139         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10140         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10141         attributes_section_data_.
10142         (Arm_dynobj::attributes_section_data): New method definition.
10143         (Arm_dynobj::attributes_section_data_): New data member declaration.
10144         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10145         initialization value of may_use_blx_ to false.
10146         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10147         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10148         object attributes to compute results instead of hard-coding.
10149         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10150         Target_arm::get_secondary_compatible_arch,
10151         Target_arm::set_secondary_compatible_arch
10152         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10153         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10154         New method declarations.
10155         (Target_arm::get_aeabi_object_attribute): New method definition.
10156         (Target_arm::attributes_section_data_): New data member declaration.
10157         (read_arm_attributes_section): New template definition.
10158         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10159         (Arm_dynobj::do_read_symbols): Ditto.
10160         (Target_arm::do_finalize_sections): Merge attributes sections from
10161         input.  Check for BLX use after attributes section merging.
10162         Fix __exidx_start and __exidx_end visibility.  Create an
10163         .ARM.attributes section if necessary.
10164         (Target_arm::get_secondary_compatible_arch,
10165         Target_arm::set_secondary_compatible_arch,
10166         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10167         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10168         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10169         New method definitions.
10170
10171 2009-12-09  Ian Lance Taylor  <iant@google.com>
10172
10173         * plugin.cc (Plugin::load): Don't cast from void* to a function
10174         pointer.
10175
10176 2009-12-09  Ian Lance Taylor  <iant@google.com>
10177
10178         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10179         information fields.
10180
10181 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10182
10183         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10184         Replace two_file_shared_1.so with two_file_shared_2.so.
10185         * testsuite/Makefile.in: Regenerated.
10186
10187 2009-12-08  Doug Kwan  <dougkwan@google.com>
10188
10189         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10190         (HFILES): Add attributes.h and int_encoding.h.
10191         * Makefile.in: Regenerate.
10192         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10193         function definitions to int_encoding.cc
10194         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10195         prototypes to int_encoding.h
10196         * reduced_debug_output.cc (int_encoding.h): New include.
10197         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10198         function definitions to int_encoding.cc
10199         (insert_into_vector, read_from_pointer): Move template definitions to
10200         int_encoding.h
10201         * attributes.cc: New file.
10202         * attributes.h: New file.
10203         * int_encoding.cc: New file.
10204         * int_encoding.h: New file.
10205
10206 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10207
10208         PR gold/11055
10209         * incremental-dump.cc (dump_incremental_inputs): New.
10210         (main): Use dump_incremental_inputs.
10211
10212 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10213
10214         PR gold/10893
10215         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10216         checking elfcpp::STT_FUNC.
10217         (Target_i386::Relocate::relocate): Likewise.
10218         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10219
10220         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10221         symbols from shared libraries into normal FUNC symbols.
10222
10223         * symtab.h (Symbol): Add is_func and use it.
10224
10225 2009-12-05  Doug Kwan  <dougkwan@google.com>
10226
10227         * arm.cc (Target_arm::arm_info): Initialize new fields
10228         attributes_section and attributes_vendor.
10229         * i386.cc (Target_i386::i386_info): Same.
10230         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10231         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10232         fields attributes_section and attributes_vendor.
10233         * sparc.cc (Target_sparc::sparc_info): Same.
10234         * target.h (Target::attributes_section, Target::attributes_vendor,
10235         Target::is_attributes_section, Target::attribute_arg_type,
10236         Target::attributes_order): New method definitions.
10237         (Target::Target_info::attributes_section,
10238         Target::Target_info::attributes_vendor): New fields.
10239         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10240         virtual method definitions.
10241         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10242         attributes_section and attributes_vendor.
10243         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10244
10245 2009-12-05  Doug Kwan  <dougkwan@google.com>
10246
10247         * arm.cc: Update comments about interworking and stub generation.
10248         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10249         considered as non-PIC.
10250         (Arm_relocate_functions::base_abs): Fix formatting.
10251         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10252         of function to use GOT entry address instead of offset.
10253         (Target_arm::Scan::global): Issue an error if a symbol would need a
10254         PLT does not get one because it is untyped.  Remove code to create
10255         dynamic symbols for relative branches.
10256         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10257         takes unsigned integer instead of boolean.
10258
10259 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10260
10261         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10262         (two_file_test_LDADD): Likewise.
10263         (common_test_1_LDADD): Likewise.
10264         (exception_test_LDADD) Likewise.
10265         (weak_test_LDADD): Likewise.
10266         (many_sections_test_LDADD): Likewise.
10267         (initpri1_LDADD): Likewise.
10268         (script_test_1_LDADD): Likewise.
10269         (script_test_2_LDADD): Likewise.
10270         (justsyms_LDADD): Likewise.
10271         (binary_test_LDADD): Likewise.
10272         (large_LDADD): Likewise.
10273         * testsuite/Makefile.in: Regenerated.
10274
10275 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10276
10277         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10278         (Symbol_table::override_with_special): Likewise.
10279         (Symbol_table::add_from_object): Likewise.
10280
10281 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10282
10283         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10284         Don't set the data_offset twice.
10285
10286 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10287
10288         * testsuite/Makefile.in: Regenerate.
10289
10290 2009-12-03  Doug Kwan  <dougkwan@google.com>
10291
10292         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10293         (Target_arm::do_finalize_sections): Add parameter for symbol table
10294         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10295         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10296         parameter for symbol table pointer.
10297         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10298         an additional parameter for a pointer to symbol table.
10299         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10300         parameter for a symbol table pointer.
10301         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10302         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10303         Ditto.
10304         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10305         parameter for a symbol table pointer.
10306
10307 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10308
10309         * incremental.cc (Incremental_inputs_header)
10310         (Incremental_inputs_header_write, Incremental_inputs_entry)
10311         (Incremental_inputs_entry_write): Move ...
10312         * incremental.h (Incremental_inputs_header)
10313         (Incremental_inputs_header_write, Incremental_inputs_entry)
10314         (Incremental_inputs_entry_write): here.
10315
10316 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10317
10318         * incremental.cc (make_sized_incremental_binary): Set the target.
10319         Error if it is incompatible.
10320         * output.h (Output_file): Add filename method.
10321
10322 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10323
10324         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10325         from the get_* methods.
10326
10327 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10328
10329         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10330         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10331         Write 0 for the data_offset of scripts.
10332
10333 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10334
10335         * testsuite/Makefile.am: Add the incremental_test.sh test.
10336         * testsuite/incremental_test.sh: New.
10337         * testsuite/incremental_test_1.c: New.
10338         * testsuite/incremental_test_2.c: New.
10339
10340 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10341
10342         * incremental-dump.cc (main): Fix typos.
10343
10344 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10345
10346         PR gold/11025
10347         * incremental-dump.cc (main): Use llu to print 64 bit values.
10348
10349 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10350             H.J. Lu  <hongjiu.lu@intel.com>
10351
10352         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10353         $(LIBDL).
10354         (incremental_dump_LDADD): Likewise.
10355         * Makefile.in: Regenerated.
10356
10357 2009-11-25  Doug Kwan  <dougkwan@google.com>
10358
10359         Revert:
10360
10361         2009-11-25  Doug Kwan  <dougkwan@google.com>
10362
10363                 * arm.cc (Target_arm::Target_arm): Move method definition
10364                 outside of class definition.  Add code to handle
10365                 --target1-rel, --target1-abs and --target2= options.
10366                 (Target_arm::get_reloc_reloc_type): Change method to be
10367                 non-static and const.
10368                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10369                 New data member declaration.
10370                 (Target_arm::Scan::local, Target_arm::Scan::global,
10371                 Target_arm::Relocate::relocate,
10372                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10373                 Adjust call to Target_arm::get_real_reloc_type.
10374                 (Target_arm::get_real_reloc_type): Use command line options
10375                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10376                 * options.h (--target1-rel, --target1-abs, --target2): New
10377                 ARM-only options.
10378
10379 2009-11-25  Doug Kwan  <dougkwan@google.com>
10380
10381         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10382         class definition.  Add code to handle --target1-rel, --target1-abs
10383         and --target2= options.
10384         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10385         and const.
10386         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10387         member declaration.
10388         (Target_arm::Scan::local, Target_arm::Scan::global,
10389         Target_arm::Relocate::relocate,
10390         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10391         call to Target_arm::get_real_reloc_type.
10392         (Target_arm::get_real_reloc_type): Use command line options to
10393         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10394         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10395         options.
10396
10397 2009-11-25  Doug Kwan  <dougkwan@google.com>
10398
10399         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10400         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10401         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10402         formatting.
10403         (Arm_relocate_functions::thm_call): Replace body with a call to
10404         Arm_relocate_functions::thumb_branch_common.
10405         (Arm_relocate_functions::thm_jump24,
10406         Arm_relocate_functions::thm_xpc22): New method definitions.
10407         (Arm_relocate_functions::thumb_branch_common): New method definition.
10408         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10409         operator.
10410         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10411         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10412
10413 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10414
10415         * Makefile.am: Build incremental-dump
10416         * Makefile.in: Regenerate.
10417         * incremental-dump.cc: New.
10418         * incremental.cc (Incremental_inputs_header_data,
10419         Incremental_inputs_entry_data): Move to incremental.h
10420         * incremental.h: (Incremental_inputs_header_data,
10421         Incremental_inputs_entry_data): Move from incremental.cc
10422
10423 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10424
10425         * incremental.cc (Incremental_inputs_header,
10426         Incremental_inputs_header_write, Incremental_inputs_entry,
10427         Incremental_inputs_entry_write): Add a typedef with the data type.
10428
10429 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10430
10431         * incremental.cc (Incremental_inputs_header,
10432         Incremental_inputs_header_write, Incremental_inputs_entry,
10433         Incremental_inputs_entry_write): Update comment about which
10434         type has the filed descriptions.
10435
10436 2009-11-15  Doug Kwan  <dougkwan@google.com>
10437
10438         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10439         (Arm_relocate_functions::arm_branch_common): Change method defintion
10440         in class definition to a method declaration and update list of formal
10441         parameters.
10442         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10443         Arm_relocation_functions::jump24): Adjust call to
10444         Arm_relocate_functions::arm_branch_common.  Update list of formal
10445         parameters.
10446         (Arm_relocate_functions::xpc25): New method definition.
10447         (Arm_relocate_functions::arm_branch_common): Move method defintion
10448         out from class definition.  Use stubs for mode-switching and extending
10449         branch ranges.
10450         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10451         specially.  Change code to enable use of stubs in ARM branches.
10452
10453 2009-11-10  Doug Kwan  <dougkwan@google.com>
10454
10455         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10456         in method declaration.
10457         (Target_arm::relocate_stub): New method declaration.
10458         (Target_arm::default_target): Change to return a pointer instead of
10459         a const reference.
10460         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10461         Target_arm::default_target.
10462         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10463         method definition.
10464         (Target_arm::relocate_section): Adjust view.
10465         (Target_arm::relocate_stub): New method definition.
10466
10467 2009-11-10  Doug Kwan  <dougkwan@google.com>
10468
10469         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10470         a format warning.
10471         * incremental.cc (open_incremental_binary): Initialized local
10472         variables to avoid warnings.
10473         * object.cc (make_elf_object): Ditto.
10474         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10475         a format warning.
10476
10477 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10478
10479         PR gold/10930
10480         * testsuite/plugin_test.c: Include "config.h".
10481
10482 2009-11-09  Doug Kwan  <dougkwan@google.com>
10483
10484         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10485         (arm_symbol_value): Remove.
10486         (Arm_relocate_functions::arm_branch_common,
10487         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10488         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10489         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10490         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10491         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10492         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10493         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10494         Arm_relocate_functions::thm_mobw_abs_nc,
10495         Arm_relocate_functions::thm_mov_abs,
10496         Arm_relocate_functions::movw_prel_nc,
10497         Arm_relocate_functions::thm_movt_abs,
10498         Arm_relocate_functions::movt_prel,
10499         Arm_relocate_functions::thm_movw_prel_nc,
10500         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10501         (Target_arm::Relocate::relocate): Only decompose address into two
10502         parts if relocation type uses the thumb-bit and pass the actual
10503         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10504         calls to methods in Arm_relocate_functions for this change.
10505
10506 2009-11-08  Ian Lance Taylor  <iant@google.com>
10507
10508         PR 10925
10509         * reloc.cc: Instantiate
10510         Sized_relobj::initialize_input_to_output_maps and
10511         Sized_relobj:free_input_to_output_maps.
10512
10513 2009-11-06  Ian Lance Taylor  <iant@google.com>
10514
10515         PR 10876
10516         * defstd.cc (in_segment): Set only_if_ref true for "end".
10517
10518 2009-11-06  Doug Kwan  <dougkwan@google.com>
10519
10520         * arm.cc (class Reloc_stub): Correct a comment.
10521         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10522         (Target_arm::scan_section_for_stubs): New method declaration.
10523         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10524         Change methods from private to protected.
10525         (Target_arm::do_may_relax): New method definition.
10526         (Target_arm::do_relax, Target_arm::group_sections,
10527         Target_arm::scan_reloc_for_stub,
10528         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10529         (Target_arm::arm_input_section_map_): New data member declaration.
10530         (Target_arm::scan_reloc_for_stub,
10531         Target_arm::scan_reloc_section_for_stubs,
10532         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10533         Target_arm::do_relax): New method definitions.
10534
10535 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10536
10537         * configure.ac: Check for (struct stat)::st_mtim
10538         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10539         * config.in: Regenerate.
10540         * configure: Regenerate.
10541
10542 2009-11-05  Ian Lance Taylor  <iant@google.com>
10543
10544         PR 10910
10545         * output.cc (Output_segment::add_output_section): Add missing
10546         return statement.
10547
10548 2009-11-04  Ian Lance Taylor  <iant@google.com>
10549
10550         PR 10880
10551         * object.h (class Object): Add is_needed and set_is_needed
10552         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10553         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10554         defined in a dynamic object and referenced by a regular object,
10555         set is_needed for the dynamic object.
10556         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10557         if the file is marked with as_needed and it is not needed.
10558
10559 2009-11-04  Ian Lance Taylor  <iant@google.com>
10560
10561         PR 10887
10562         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10563         tags if data is discarded by linker script.
10564         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10565         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10566         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10567         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10568
10569 2009-11-04  Ian Lance Taylor  <iant@google.com>
10570
10571         * layout.cc (Layout::get_output_section): Add is_interp and
10572         is_dynamic_linker_section parameters.  Change all callers.
10573         (Layout::choose_output_section): Likewise.
10574         (Layout::make_output_section): Likewise.
10575         (Layout::add_output_section_data): Add is_dynamic_linker_section
10576         parameter.  Change all callers.
10577         * layout.h (class Layout): Update declarations.
10578         * output.h (class Output_section): Add is_interp, set_is_interp,
10579         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10580         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10581         generate_code_fills_at_write_ to a bitfield.
10582         * output.cc (Output_section::Output_sections): Initialize new
10583         fields.
10584         (Output_segment::add_output_section): Add do_sort parameter.
10585         Change all callers.
10586
10587 2009-11-03  Ian Lance Taylor  <iant@google.com>
10588
10589         PR 10860
10590         * options.h (class General_options): Add --warn-common.
10591         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10592         merging two common symbols.
10593         (Symbol_table::should_override): Handle --warn-common when merging
10594         a common symbol with a defined symbol.  Use report_resolve_problem
10595         for multiple definitions.
10596         (Symbol_table::report_resolve_problem): New function.
10597         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10598
10599 2009-11-03  Doug Kwan  <dougkwan@google.com>
10600
10601         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10602         stub_factory_.
10603         (Target_arm::stub_factory): New method definition.
10604         (Target_arm::new_arm_input_section,
10605         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10606         Target_arm::reloc_uses_thumb_bit): New method declarations.
10607         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10608         New type definitions.
10609         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10610         member declarations.
10611         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10612         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10613         New method definitions.
10614
10615 2009-11-03  Ian Lance Taylor  <iant@google.com>
10616
10617         * options.h (class General_options): Add --warn_constructors.
10618
10619 2009-11-03  Ian Lance Taylor  <iant@google.com>
10620
10621         PR 10893
10622         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10623         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10624
10625 2009-11-03  Ian Lance Taylor  <iant@google.com>
10626
10627         PR 10895
10628         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10629         --msgid-bugs-address.
10630         (install-pdf): New target.
10631         (install-data_yes): Look up one directory to find mkinstalldirs.
10632
10633 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10634
10635         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10636         tree.
10637
10638 2009-10-30  Doug Kwan  <dougkwan@google.com>
10639
10640         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10641
10642 2009-10-30  Doug Kwan  <dougkwan@google.com>
10643
10644         * arm.cc (Stub_addend_reader): New struct template definition
10645         and partial specializations.
10646         (Stub_addend_reader::operator()): New method definition for a
10647         partially specialized template.
10648
10649 2009-10-30  Doug Kwan  <dougkwan@google.com>
10650
10651         * arm.cc (Arm_relobj::processor_specific_flags): New method
10652         definition.
10653         (Arm_relobj::do_read_symbols): New method declaration.
10654         (Arm_relobj::processor_specific_flags_): New data member declaration.
10655         (Arm_dynobj): New class definition.
10656         (Target_arm::do_finalize_sections): Add input_objects parameter.
10657         (Target_arm::do_adjust_elf_header): New method declaration.
10658         (Target_arm::are_eabi_versions_compatible,
10659         (Target_arm::merge_processor_specific_flags): New method declaration.
10660         (Target_arm::do_make_elf_object): New overloaded method definitions
10661         and declaration.
10662         (Arm_relobj::do_read_symbols): New method definition.
10663         (Arm_dynobj::do_read_symbols): Ditto.
10664         (Target_arm::do_finalize_sections): Add input_objects parameters.
10665         Merge processor-specific flags from all input objects.
10666         (Target_arm::are_eabi_versions_compatible,
10667         Target_arm::merge_processor_specific_flags,
10668         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10669         New method definitions.
10670         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10671         Input_objects pointer type parameter.
10672         * layout.cc (Layout::finalize): Pass input objects to target's.
10673         finalize_sections function.
10674         * output.cc (Output_file_header::do_sized_write): Set ELF file
10675         header's processor-specific flags.
10676         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10677         Input_objects pointer type parameter.
10678         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10679         * target.h (Input_objects): New forward class declaration.
10680         (Target::processor_specific_flags,
10681         Target::are_processor_specific_flags_sect): New method definitions.
10682         (Target::finalize_sections): Add input_objects parameter.
10683         (Target::Target): Initialize processor_specific_flags_ and
10684         are_processor_specific_flags_set_.
10685         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10686         parameter.
10687         (Target::set_processor_specific_flags): New method definition.
10688         (Target::processor_specific_flags_,
10689         Target::are_processor_specific_flags_set_): New data member
10690         declarations.
10691         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10692         Input_objects pointer type parameter.
10693
10694 2009-10-30  Doug Kwan  <dougkwan@google.com>
10695
10696         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10697
10698 2009-10-28  Ian Lance Taylor  <iant@google.com>
10699
10700         * object.h (class Relobj): Drop options parameter from
10701         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10702         do_scan_relocs, do_relocate.  Change all callers.
10703         (class Sized_relobj): Drop options parameters from
10704         do_gc_process_relocs, do_scan_relocs, do_relocate,
10705         do_relocate_sections, relocate_sections, emit_relocs_scan,
10706         emit_relocs_scan_reltype.  Change all callers.
10707         (struct Relocate_info): Remove options field and all references to
10708         it.
10709         * reloc.h (class Read_relocs): Remove options constructor
10710         parameter and options_ field.  Change all callers.
10711         (class Gc_process_relocs, class Scan_relocs): Likewise.
10712         (class Relocate_task): Likewise.
10713         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10714         all callers.
10715         (scan_relocatable_relocs): Likewise.
10716         * target.h (class Sized_target): Remove options parameter from
10717         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10718         all callers.
10719         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10720         callers.
10721         * arm.cc: Update functions to remove options parameters.
10722         * i386.cc: Likewise.
10723         * powerpc.cc: Likewise.
10724         * sparc.cc: Likewise.
10725         * x86_64.cc: Likewise.
10726         * testsuite/testfile.cc: Likewise.
10727
10728 2009-10-28  Doug Kwan  <dougkwan@google.com>
10729
10730         * arm.cc (Arm_relobj): New class definition.
10731         (Arm_relobj::scan_sections_for_stubs,
10732         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10733         New method definitions.
10734
10735 2009-10-28  Cary Coutant  <ccoutant@google.com>
10736
10737         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10738         (Plugin::cleanup_done_): New member.
10739         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10740         (Plugin_manager::cleanup_done_): Remove.
10741         (Plugin_manager::add_input_file): Edit error message.
10742         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10743         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10744
10745 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10746
10747         * fileread.cc: (File_read::View::~View): Use the new
10748         data_ownership_ filed.
10749         (File_read::~File_read): Dispose the new whole_file_view_.
10750         (File_read::open): Mmap the whole file if needed.
10751         (File_read::open): Use whole_file_view_ instead of contents_.
10752         (File_read::find_view): Use whole_file_view_ if applicable.
10753         (File_read::do_read): Use whole_file_view_ instead of contents_.
10754         (File_read::make_view): Use whole_file_view_ instead of contents_,
10755         update File_read::View::View call.
10756         (File_read::find_or_make_view): Update File_read::View::View
10757         call.
10758         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10759         remove contents_
10760         (File_read::View::Data_ownership): New enum.
10761         (File_read::View::View): Replace bool mapped_ with Data_ownership
10762         argument.
10763         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10764         (File_read::View::data_ownership_): New field.
10765         (File_read::contents_): Remove (replaced by whole_file_view_).
10766         (File_read::whole_file_view_): New field.
10767         * options.h (class General_options): Add --keep-files-mapped.
10768
10769 2009-10-27  Cary Coutant  <ccoutant@google.com>
10770
10771         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10772         * testsuite/Makefile.am (plugin_test_5): New test case.
10773         * testsuite/Makefile.in: Regenerate.
10774
10775 2009-10-25  Doug Kwan  <dougkwan@google.com>
10776
10777         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10778         from private to protected to allow access by child class.
10779         (Sized_relobj::do_relocate_sections): New method declaration.
10780         (Sized_relobj::relocate_sections): Virtualize.
10781         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10782         Sized_relobj::relocate_sections.  Instantiate template explicitly
10783         for different target sizes and endianity.
10784
10785 2009-10-24  Doug Kwan  <dougkwan@google.com>
10786
10787         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10788         (Arm_input_section::as_arm_input_section): New method.
10789         (Arm_output_section): New class definition.
10790         (Arm_output_section::create_stub_group,
10791         Arm_output_section::group_sections): New method definitions.
10792
10793 2009-10-22  Doug Kwan  <dougkwan@google.com>
10794
10795         * arm.cc (Arm_input_section): New class definition.
10796         (Arm_input_section::init, Arm_input_section:do_write,
10797         Arm_input_section::set_final_data_size,
10798         Arm_input_section::do_reset_address_and_file_offset): New method
10799         definitions.
10800
10801 2009-10-21  Doug Kwan  <dougkwan@google.com>
10802
10803         * arm.cc (Stub_table, Arm_input_section): New forward class
10804         declarations.
10805         (Stub_table): New class defintion.
10806         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10807         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10808         New method definition.
10809
10810 2009-10-21  Doug Kwan  <dougkwan@google.com>
10811
10812         * arm.cc: Update copyright comments.
10813         (Target_arm): New forward class template declaration.
10814         (Arm_address): New type.
10815         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10816         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10817         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10818         constants.
10819         (Insn_template): Same.
10820         (DEF_STUBS): New macro.
10821         (Stub_type): New enum type.
10822         (Stub_template): New class definition.
10823         (Stub): Same.
10824         (Reloc_stub): Same.
10825         (Stub_factory): Same.
10826         (Target_arm::Target_arm): Initialize may_use_blx_ and
10827         should_force_pic_veneer_.
10828         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10829         Target_arm::should_force_pic_veneer,
10830         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10831         Target_arm::using_thumb_only, Target_arm:;default_target): New
10832         method defintions.
10833         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10834         New data member declarations.
10835         (Insn_template::size, Insn_template::alignment): New method defintions.
10836         (Stub_template::Stub_template): New method definition.
10837         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10838         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10839         (Stub_factory::Stub_factory): New method definition.
10840         * gold.h (string_hash): New template.
10841         * output.h (Input_section_specifier::hash_value): Use
10842         gold::string_hash.
10843         (Input_section_specifier::string_hash): Remove.
10844         * stringpool.cc (Stringpool_template::string_hash): Use
10845         gold::string_hash.
10846
10847 2009-10-20  Doug Kwan  <dougkwan@google.com>
10848
10849         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10850         symbols of relaxed input sections.
10851         * output.h (Output_section::find_relaxed_input_section): Make
10852         method public.
10853
10854 2009-10-16  Doug Kwan  <dougkwan@google.com>
10855
10856         * dynobj.cc (Versions::Versions): Initialize version_script_.
10857         Only insert base version symbol definition for a shared object
10858         if version script defines any version versions.
10859         (Versions::define_base_version): New method definition.
10860         (Versions::add_def): Check that base version is not needed.
10861         (Versions::add_need): Define base version lazily.
10862         * dynobj.h (Versions::define_base_version): New method declaration.
10863         (Versions::needs_base_version_): New data member declaration.
10864         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10865         (check_DATA): Add no_version_test.stdout.
10866         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10867         New make rules.
10868         * testsuite/Makefile.in: Regenerate.
10869         * testsuite/no_version_test.c: New file.
10870         * testsuite/no_version_test.sh: Ditto.
10871
10872 2009-10-16  Doug Kwan  <dougkwan@google.com>
10873
10874         * expression.cc (class Segment_start_expression): New class definition.
10875         (Segment_start_expression::value): New method definition.
10876         (script_exp_function_segment_start): Return a new
10877         Segment_start_expression.
10878         * gold/script-c.h (script_saw_segment_start_expression): New function
10879         prototype.
10880         * script-sections.cc (Script_sections::Script_sections): Initialize
10881         SAW_SEGMENT_START_EXPRESSION_ to false.
10882         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10883         and -Tbbs options to specify section addresses if given in
10884         command line and no SEGMENT_START expression is seen in a script.
10885         * script-sections.h (Script_sections::saw_segment_start_expression,
10886         Script_sections::set_saw_segment_start_expression): New method
10887         definition.
10888         (Script_sections::saw_segment_start_expression_): New data member
10889         declaration.
10890         * script.cc (script_saw_segment_start_expression): New function.
10891         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10892         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10893         script_test_7.sh and script_test_8.sh.
10894         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10895         script_test_8.stdout.
10896         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10897         (script_test_6, script_test_6.stdout, script_test_7,
10898         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10899         * Makefile.in: Regenerate.
10900         * testsuite/script_test_6.sh: New file.
10901         * testsuite/script_test_6.t: Same.
10902         * testsuite/script_test_7.sh: Same.
10903         * testsuite/script_test_7.t: Same.
10904         * testsuite/script_test_8.sh: Same.
10905
10906 2009-10-16  Doug Kwan  <dougkwan@google.com>
10907
10908         * output.cc (Output_segment::set_section_list_address): Cast
10909         expressions to unsigned long long type to avoid format warnings.
10910
10911 2009-10-15  Ian Lance Taylor  <iant@google.com>
10912
10913         * script.cc (Script_options::add_symbol_assignment): Always add a
10914         dot assignment to script_sections_.
10915         * script-sections.cc (Script_sections::add_dot_assignment):
10916         Initialize if necessary.
10917
10918         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10919         program headers with no load segment if there is a linker script.
10920
10921         * layout.cc (Layout::set_segment_offsets): Align the file offset
10922         to the segment aligment for -N or -n with no load segment.
10923         * output.cc (Output_segment::add_output_section): Don't crash if
10924         the first section is a TLS section.
10925         (Output_segment::set_section_list_addresses): Print an error
10926         message if the address moves backward in a linker script.
10927         * script-sections.cc
10928         (Output_section_element_input::set_section_addresses): Don't
10929         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10930         (Orphan_output_section::set_section_addresses): Likewise.
10931
10932 2009-10-15  Doug Kwan  <dougkwan@google.com>
10933
10934         * layout.cc (Layout::finish_dynamic_section): Generate tags
10935         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10936         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10937         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10938
10939 2009-10-14  Ian Lance Taylor  <iant@google.com>
10940
10941         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10942         fields.
10943         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10944         data_shdr fields of relinfo.
10945         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10946         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10947         R_386_TLS_LDO_32, adjust based on section flags.
10948         (Target_i386::Relocate::fix_up_ldo): Remove.
10949
10950 2009-10-13  Ian Lance Taylor  <iant@google.com>
10951
10952         Add support for -pie.
10953         * options.h (class General_options): Add -pie and
10954         --pic-executable.
10955         (General_options::output_is_position_independent): Test -pie.
10956         (General_options::output_is_executable): Return true if not shared
10957         and not relocatable.
10958         (General_options::output_is_pie): Remove.
10959         * options.cc (General_options::finalize): Reject incompatible uses
10960         of -pie.
10961         * gold.cc (queue_middle_tasks): A -pie link is not static.
10962         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10963         * symtab.cc (Symbol::final_value_is_known): Return false if
10964         output_is_position_independent.
10965         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10966         output_is_position_independent.
10967         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10968         output_is_position_independent.
10969         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10970         output_is_position_independent.
10971         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10972         two_file_pie_test.
10973         (basic_pie_test.o, basic_pie_test): New targets.
10974         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10975         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10976         (two_file_pie_test): New target.
10977         * testsuite/Makefile.in: Rebuild.
10978         * README: Remove note saying that -pie is not supported.
10979
10980 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10981
10982         * options.h (class General_options): Add -init and -fini.
10983         * layout.cc (Layout::finish_dynamic_section): Emit
10984         given init and fini functions.
10985
10986 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10987
10988         * gc.h (gc_process_relocs): Check if icf is enabled using new
10989         function.
10990         * gold.cc (queue_initial_tasks): Likewise.
10991         (queue_middle_tasks): Likewise.
10992         * object.cc (do_layout): Likewise.
10993         * symtab.cc (is_section_folded): Likewise.
10994         * main.cc (main): Likewise.
10995         * reloc.cc (Read_relocs::run): Likewise.
10996         (Sized_relobj::do_scan_relocs): Likewise.
10997         * icf.cc (is_function_ctor_or_dtor): New function.
10998         (Icf::find_identical_sections): Check if function is ctor or dtor when
10999         safe icf is chosen.
11000         * options.h (General_options::icf): Change option to be an enum.
11001         (Icf_status): New enum.
11002         (icf_enabled): New method.
11003         (icf_safe_folding): New method.
11004         (set_icf_status): New method.
11005         (icf_status_): New variable.
11006         * (options.cc) (General_options::finalize): Set icf_status_.
11007         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11008         icf_test and icf_keep_unique_test to use the --icf enum flag.
11009         * testsuite/icf_safe_test.sh: New file.
11010         * testsuite/icf_safe_test.cc: New file.
11011
11012 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11013
11014         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11015         includes to gc.h and icf.h.
11016         * arm.cc: Include gc.h.
11017         * gold.cc: Likewise.
11018         * i386.cc: Likewise.
11019         * powerpc.cc: Likewise.
11020         * sparc.cc: Likewise.
11021         * x86_64.cc: Likewise.
11022         * gc.h: Include icf.h.
11023
11024 2009-10-11  Ian Lance Taylor  <iant@google.com>
11025
11026         * plugin.cc: Include "gold.h" before other header files.
11027
11028 2009-10-10  Chris Demetriou  <cgd@google.com>
11029
11030         * options.h (Input_file_argument::Input_file_type): New enum.
11031         (Input_file_argument::is_lib_): Replace with...
11032         (Input_file_argument::type_): New member.
11033         (Input_file_argument::Input_file_argument): Take Input_file_type
11034         'type' rather than boolean 'is_lib' as second argument.
11035         (Input_file_argument::is_lib): Use type_.
11036         (Input_file_argument::is_searched_file): New function.
11037         (Input_file_argument::may_need_search): Handle is_searched_file.
11038         * options.cc (General_options::parse_library): Support -l:filename.
11039         (General_options::parse_just_symbols): Update for Input_file_argument
11040         changes.
11041         (Command_line::process): Likewise.
11042         * archive.cc (Archive::get_file_and_offset): Likewise.
11043         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11044         * script.cc (read_script_file, script_add_file): Likewise.
11045         * fileread.cc (Input_file::Input_file): Likewise.
11046         (Input_file::will_search_for): Handle is_searched_file.
11047         (Input_file::open): Likewise.
11048         * readsyms.cc (Read_symbols::get_name): Likewise.
11049         * testsuite/Makefile.am (searched_file_test): New test.
11050         * testsuite/Makefile.in: Regenerate.
11051         * testsuite/searched_file_test.cc: New file.
11052         * testsuite/searched_file_test_lib.cc: New file.
11053
11054 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11055             Ian Lance Taylor  <iant@google.com>
11056
11057         * descriptor.cc: Include <cstdio> and "binary-io.h".
11058         (Descriptors::open): Open the files in binary mode always.
11059         * script.cc (Lex::get_token): Treat \r as whitespace.
11060
11061 2009-10-09  Ian Lance Taylor  <iant@google.com>
11062
11063         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11064
11065 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11066             Ian Lance Taylor  <iant@google.com>
11067
11068         * configure.ac: Check for readv function also.
11069         * fileread.cc (readv): Define if not HAVE_READV.
11070         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11071         does not exist.
11072         * config.in: Regenerate.
11073         * configure: Regenerate.
11074
11075 2009-10-09  Doug Kwan  <dougkwan@google.com>
11076
11077         * layout.cc (Layout::make_output_section): Call target hook to make
11078         ordinary output section.
11079         (Layout::finalize): Adjust parameter list of call the
11080         Target::may_relax().
11081         * layout.h (class Layout::section_list): New method.
11082         * merge.h (Output_merge_base::entsize): Change visibility to public.
11083         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11084         New methods.
11085         (Output_merge_string::do_is_string): New method.
11086         * object.cc (Sized_relobj::do_setup): renamed from
11087         Sized_relobj::set_up.
11088         * object.h (Sized_relobj::adjust_shndx,
11089         Sized_relobj::initializ_input_to_output_maps,
11090         Sized_relobj::free_input_to_output_maps): Change visibilities to
11091         protected.
11092         (Sized_relobj::setup): Virtualize.
11093         (Sized_relobj::do_setup): New method declaration.
11094         (Sized_relobj::invalidate_section_offset,
11095         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11096         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11097         * options.cc (parse_int): New function.
11098         * options.h (parse_int): New declaration.
11099         (DEFINE_int): New macro.
11100         (stub_group_size): New option.
11101         * output.cc (Output_section::Output_section): Initialize memebers
11102         merge_section_map_, merge_section_by_properties_map_,
11103         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11104         (Output_section::add_input_section): Handled deferred code-fill
11105         generation and remove an old comment.
11106         (Output_section::add_relaxed_input_section): New method definition.
11107         (Output_section::add_merge_input_section): Use merge section by
11108         properties map to speed to search.  Update merge section maps
11109         as appropriate.
11110         (Output_section::build_relaxation_map): New method definition.
11111         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11112         Same.
11113         (Output_section::relax_input_section): Renamed to
11114         Output_section::convert_input_sections_to_relaxed_sections and change
11115         interface to take a vector of pointers to relaxed sections.
11116         (Output_section::find_merge_section,
11117         Output_section::find_relaxed_input_section): New method definitions.
11118         (Output_section::is_input_address_mapped,
11119         Output_section::output_offset, Output_section::output_address):
11120         Use output section data maps to speed up searching.
11121         (Output_section::find_starting_output_address): Add comments.
11122         (Output_section::do_write,
11123         Output_section::write_to_postprocessing_buffer): Do code-fill
11124         generation as appropriate.
11125         (Output_section::get_input_sections): Invalidate relaxed input section
11126         map.
11127         (Output_section::restore_states): Adjust type of checkpoint .
11128         Invalidate relaxed input section map.
11129         * output.h (Output_merge_base): New class declaration.
11130         (Input_section_specifier): New class defintion.
11131         (class Output_relaxed_input_section) Change base class to
11132         Output_section_data_build.
11133         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11134         base class initializer.
11135         (Output_section::add_relaxed_input_section): New method declaration.
11136         (Output_section::Input_section): Change visibility to protected.
11137         (Output_section::Input_section::relobj,
11138         Output_section::Input_section::shndx): Handle relaxed input sections.
11139         Output_section::input_sections) Change visibility to protected.  Also
11140         define overload to return a non-const pointer.
11141         (Output_section::Merge_section_properties): New class defintion.
11142         (Output_section::Merge_section_by_properties_map,
11143         Output_section::Output_section_data_by_input_section_map,
11144         Output_section::Relaxation_map): New types.
11145         (Output_section::relax_input_section): Rename method to
11146         Output_section::convert_input_sections_to_relaxed_sections and change
11147         interface to take a vector of relaxed section pointers.
11148         (Output_section::find_merge_section,
11149         Output_section::find_relaxed_input_section,
11150         Output_section::build_relaxation_map,
11151         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11152         New method declarations.
11153         (Output_section::merge_section_map_
11154         Output_section::merge_section_by_properties_map_,
11155         Output_section::relaxed_input_section_map_,
11156         Output_section::is_relaxed_input_section_map_valid_,
11157         Output_section::generate_code_fills_at_write_): New data members.
11158         * script-sections.cc
11159         (Output_section_element_input::set_section_addresses): Call
11160         current_data_size and addralign methods of relaxed input sections.
11161         (Orphan_output_section::set_section_addresses): Call current_data_size
11162         and addralign methods of relaxed input sections.
11163         * symtab.cc (Symbol_table::compute_final_value): Extract template
11164         from the body of Symbol_table::sized_finalize_symbol.
11165         (Symbol_table::sized_finalized_symbol): Call
11166         Symbol_table::compute_final_value.
11167         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11168         (Symbol_table::compute_final_value): New templated method declaration.
11169         * target.cc (Target::do_make_output_section): New method defintion.
11170         * target.h (Target::make_output_section): New method declaration.
11171         (Target::relax): Add more parameters for input objects, symbol table
11172         and layout.  Adjust call to do_relax.
11173         (Target::do_make_output_section): New method declaration.
11174         (Target::do_relax): Add parameters for input objects, symbol table
11175         and layout.
11176
11177 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11178
11179         * pread.c: Include stdio.h.
11180
11181 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11182
11183         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11184         defined.
11185
11186 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11187
11188         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11189         Change read_shndx type to unsigned int.
11190         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11191         int.
11192         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11193         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11194         Change read_shndx type to unsigned int.
11195         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11196         int.
11197         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11198         * layout.cc (Layout::create_symtab_sections): Cast the result of
11199         local_symcount * symsize to off_t in the gold_assert.
11200
11201 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11202
11203         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11204         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11205         R_ARM_BASE_ABS.
11206         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11207         (Arm_relocate_functions::thm_abs5): New function.
11208         (Arm_relocate_functions::abs12): New function.
11209         (Arm_relocate_functions::abs16): New function.
11210         (Arm_relocate_functions::base_abs): New function.
11211         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11212         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11213         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11214         R_ARM_BASE_ABS.
11215         (Scan::global): Likewise.
11216         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11217         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11218         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11219         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11220         R_ARM_BASE_ABS.
11221
11222 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11223
11224         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11225         (Arm_relocate_functions::movt_prel): New function.
11226         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11227         (Arm_relocate_functions::thm_movt_prel): New function.
11228         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11229         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11230         (Scan::global, Relocate::relocate): Likewise.
11231         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11232
11233 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11234
11235         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11236         Incremental_checker.
11237         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11238         unsigned int.
11239         (class Incremental_inputs_header): New class.
11240         (Incremental_inputs_header_writer): Edit comment.
11241         (Incremental_inputs_entry): New class.
11242         (Incremental_inputs_entry_writer): Edit comment.
11243         (Sized_incremental_binary::do_find_incremental_inputs_section):
11244         Add *strtab_shndx parameter, fill it.
11245         (Sized_incremental_binary::do_check_inputs): New method.
11246         (Incremental_checker::can_incrementally_link_output_file): Use
11247         Sized_incremental_binary::check_inputs.
11248         (Incremental_inputs::report_command_line): Save command line in
11249         command_line_.
11250         * incremental.h:
11251         (Incremental_binary::find_incremental_inputs_section): New
11252         method.
11253         (Incremental_binary::do_find_incremental_inputs_section): Add
11254         strtab_shndx parameter.
11255         (Incremental_binary::do_check_inputs): New pure virtual method.
11256         (Sized_incremental_binary::do_check_inputs): Declare.
11257         (Incremental_checker::Incremental_checker): Add incremental_inputs
11258         parameter, use it to initialize incremental_inputs_.
11259         (Incremental_checker::incremental_inputs_): New field.
11260         (Incremental_checker::command_line): New method.
11261         (Incremental_checker::inputs): New method.
11262         (Incremental_checker::command_line_): New field.
11263
11264 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11265
11266         * incremental.cc: Include <cstdarg> and "target-select.h".
11267         (vexplain_no_incremental): New function.
11268         (explain_no_incremental): New function.
11269         (Incremental_binary::error): New method.
11270         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11271         method.
11272         (make_sized_incremental_binary): New function.
11273         (open_incremental_binary): New function.
11274         (can_incrementally_link_file): Add checks if output is ELF and has
11275         inputs section.
11276         * incremental.h: Include "elfcpp_file.h" and "output.h".
11277         (Incremental_binary): New class.
11278         (Sized_incremental_binary): New class.
11279         (open_incremental_binary): Declare.
11280         * object.cc (is_elf_object): Use
11281         elfcpp::Elf_recognizer::is_elf_file.
11282         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11283         * output.h (Output_file::filesize): New method.
11284
11285 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11286
11287         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11288         New function.
11289         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11290         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11291         function.
11292         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11293         function.
11294         (Arm_relocate_functions::movw_abs_nc): New function.
11295         (Arm_relocate_functions::movt_abs): New function.
11296         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11297         (Arm_relocate_functions::thm_movt_abs): New function.
11298         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11299         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11300         (Scan::global): Likewise.
11301         (Relocate::relocate): Likewise.
11302         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11303
11304 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11305
11306         * arm.cc (Arm_relocate_functions::got_prel) New function.
11307         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11308         (Relocate::relocate): Likewise.
11309         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11310
11311 2009-10-06  Ian Lance Taylor  <iant@google.com>
11312
11313         * options.h (class General_options): Define
11314         split_stack_adjust_size parameter.
11315         * object.h (class Object): Add uses_split_stack_ and
11316         has_no_split_stack_ fields.  Add uses_split_stack and
11317         has_no_split_stack accessor functions.  Declare
11318         handle_split_stack_section.
11319         (class Reloc_symbol_changes): Define.
11320         (class Sized_relobj): Define Function_offsets.  Declare
11321         split_stack_adjust, split_stack_adjust_reltype, and
11322         find_functions.
11323         * object.cc (Object::handle_split_stack_section): New function.
11324         (Sized_relobj::do_layout): Call handle_split_stack_section.
11325         * dynobj.cc (Sized_dynobj::do_layout): Call
11326         handle_split_stack_section.
11327         * reloc.cc (Sized_relobj::relocate_sections): Call
11328         split_stack_adjust for executable sections in split_stack
11329         objects.  Pass reloc_map to relocate_section.
11330         (Sized_relobj::split_stack_adjust): New function.
11331         (Sized_relobj::split_stack_adjust_reltype): New function.
11332         (Sized_relobj::find_functions): New function.
11333         * target-reloc.h: Include "object.h".
11334         (relocate_section): Add reloc_symbol_changes parameter.  Change
11335         all callers.
11336         * target.h (class Target): Add calls_non_split method.  Declare
11337         do_calls_non_split virtual method.  Declare match_view and
11338         set_view_to_nop.
11339         * target.cc: Include "elfcpp.h".
11340         (Target::do_calls_non_split): New function.
11341         (Target::match_view): New function.
11342         (Target::set_view_to_nop): New function.
11343         * gold.cc (queue_middle_tasks): Give an error if mixing
11344         split-stack and non-split-stack objects with -r.
11345         * i386.cc (Target_i386::relocate_section): Add
11346         reloc_symbol_changes parameter.
11347         (Target_i386::do_calls_non_split): New function.
11348         * x86_64.cc (Target_x86_64::relocate_section): Add
11349         reloc_symbol_changes parameter.
11350         (Target_x86_64::do_calls_non_split): New function.
11351         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11352         parameter.
11353         * powerpc.cc (Target_powerpc::relocate_section): Add
11354         reloc_symbol_changes parameter.
11355         * sparc.cc (Target_sparc::relocate_section): Add
11356         reloc_symbol_changes parameter.
11357         * configure.ac: Call AM_CONDITIONAL for the default target.
11358         * configure: Rebuild.
11359         * testsuite/Makefile.am (TEST_AS): New variable.
11360         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11361         (check_DATA): Add split_i386 and split_x86_64 files.
11362         (SPLIT_DEFSYMS): Define.
11363         (split_i386_[1234n].o): New targets.
11364         (split_i386_[124]): New targets.
11365         (split_i386_[1234r].stdout): New targets.
11366         (split_x86_64_[1234n].o): New targets.
11367         (split_x86_64_[124]): New targets.
11368         (split_x86_64_[1234r].stdout): New targets.
11369         (MOSTLYCLEANFILES): Add new executables.
11370         * testsuite/split_i386.sh: New file.
11371         * testsuite/split_x86_64.sh: New file.
11372         * testsuite/split_i386_1.s: New file.
11373         * testsuite/split_i386_2.s: New file.
11374         * testsuite/split_i386_3.s: New file.
11375         * testsuite/split_i386_4.s: New file.
11376         * testsuite/split_i386_n.s: New file.
11377         * testsuite/split_x86_64_1.s: New file.
11378         * testsuite/split_x86_64_2.s: New file.
11379         * testsuite/split_x86_64_3.s: New file.
11380         * testsuite/split_x86_64_4.s: New file.
11381         * testsuite/split_x86_64_n.s: New file.
11382         * testsuite/testfile.cc (Target_test): Update relocation_section
11383         function.
11384         * testsuite/Makefile.in: Rebuild.
11385
11386 2009-10-06  Ian Lance Taylor  <iant@google.com>
11387
11388         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11389         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11390         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11391         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11392         the address on ldo_addrs_.
11393         (Target_i386::Relocate::fix_up_ldo): New function.
11394
11395 2009-10-06   Rafael Espindola  <espindola@google.com>
11396
11397         * plugin.cc (add_input_library): New.
11398         (Plugin::load): Add add_input_library to tv.
11399         (Plugin_manager::add_input_file): Add the is_lib argument.
11400         (add_input_file): Update call to Plugin_manager::add_input_file.
11401         (add_input_library): New.
11402         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11403
11404 2009-09-30  Doug Kwan  <dougkwan@google.com>
11405
11406         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11407         symbol and call Symbol::may_need_copy_reloc to determine if
11408         a copy reloc is needed.
11409         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11410         nocopyreloc is given in command line.
11411         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11412         given in command line.
11413         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11414         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11415         of the removed Target_i386::may_need_copy_reloc.
11416         * options.h (copyreloc): New option with default value false.
11417         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11418         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11419         instead of the removed Target_powerpc::may_need_copy_reloc.
11420         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11421         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11422         instead of the removed Target_sparc::may_need_copy_reloc.
11423         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11424         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11425         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11426         instead of the removed Target_x86_64::may_need_copy_reloc.
11427
11428 2009-09-30  Ian Lance Taylor  <iant@google.com>
11429
11430         * object.h (class Object): Remove target_ field, and target,
11431         sized_target, and set_target methods.
11432         (Object::sized_target): Remove.
11433         (class Sized_relobj): Update declarations.  Remove sized_target.
11434         * object.cc (Sized_relobj::setup): Remove target parameter.
11435         Change all callers.
11436         (Input_objects::add_object): Don't do anything with the target.
11437         (make_elf_sized_object): Add punconfigured parameter.  Change all
11438         callers.  Set or test parameter target.
11439         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11440         Change all callers.
11441         * parameters.cc (Parameters::set_target): Change parameter type to
11442         be non-const.
11443         (Parameters::default_target): Remove.
11444         (set_parameters_target): Change parameter type to be non-const.
11445         (parameters_force_valid_target): New function.
11446         (parameters_clear_target): New function.
11447         * parameters.h (class Parameters): Update declarations.  Remove
11448         default_target method.  Add sized_target and clear_target
11449         methods.  Change target_ to be non-const.
11450         (set_parameters_target): Update declaration.
11451         (parameters_force_valid_target): Declare.
11452         (parameters_clear_target): Declare.
11453         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11454         as NULL if we aren't searching.
11455         (Add_symbols::run): Don't check for compatible target.
11456         * fileread.cc (Input_file::open_binary): Call
11457         parameters_force_valid_target.
11458         * gold.cc (queue_middle_tasks): Likewise.
11459         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11460         set_target on object.
11461         * dynobj.h (class Sized_dynobj): Update declarations.
11462         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11463         make_elf_object returns NULL.
11464         (Archive::include_member): Don't check whether object target is
11465         compatible.
11466         * output.cc (Output_section::add_input_section): Get target from
11467         parameters.
11468         (Output_section::relax_input_section): Likewise.
11469         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11470         parameters.
11471         (Sized_relobj::do_scan_relocs): Likewise.
11472         (Sized_relobj::relocate_sections): Likewise.
11473         * resolve.cc (Symbol_table::resolve): Likewise.
11474         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11475         parameter.  Change all callers.
11476         (Symbol_table::add_from_object): Get target from parameters.
11477         (Symbol_table::add_from_relobj): Don't check object target.
11478         (Symbol_table::add_from_dynobj): Likewise.
11479         (Symbol_table::define_special_symbol): Get target from
11480         parameters.
11481         * symtab.h (class Symbol_table): Update declaration.
11482         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11483         parameter.  Change all callers.  Clear parameter target.
11484         (Binary_test): Test target here.
11485         * testsuite/object_unittest.cc (gold_testsuite): Remove
11486         target_test_pointer parameter.  Change all callers.
11487         (Object_test): Test target here.
11488
11489 2009-09-26  Ian Lance Taylor  <iant@google.com>
11490
11491         * testsuite/initpri1.c: Don't try to use constructor priorities if
11492         compiling with gcc before 4.3.
11493
11494 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11495
11496         * testsuite/retain_symbols_file_test.sh (check_present): Change
11497         output file name to retain_symbols_file_test.stdout.
11498         (check_absent): Likewise.
11499
11500 2009-09-18  Craig Silverstein  <csilvers@google.com>
11501
11502         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11503         * options.cc: Include <cerrno> and <fstream>.
11504         (General_options::finalize): Parse -retain-symbols-file tag.
11505         * options.h: New flag.
11506         (General_options): New method should_retain_symbol, new
11507         variable symbols_to_retain.
11508         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11509         should_retain_symbol map.
11510         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11511         * testsuite/Makefile.in: Regenerate.
11512         * testsuite/retain_symbols_file_test.sh: New file.
11513
11514 2009-09-18  Nick Clifton  <nickc@redhat.com>
11515
11516         * po/es.po: Updated Spanish translation.
11517
11518 2009-09-17  Doug Kwan  <dougkwan@google.com>
11519
11520         * debug.h (DEBUG_RELAXATION): New constant.
11521         (DEBUG_ALL): Add DEBUG_RELAXATION.
11522         (debug_string_to_enum): Add relaxation debug option.
11523         * layout.cc
11524         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11525         Layout::Relaxation_debug_check::read_sections,
11526         Layout::Relaxation_debug_check::read_sections): New method definitions.
11527         (Layout::Layout): Initialize data members
11528         record_output_section_data_from_scrips_,
11529         script_output_section_data_list_ and relaxation_debug_check_.
11530         (Layout::save_segments, Layout::restore_segments,
11531         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11532         Layout::relaxation_loop_body): New method definitions.
11533         (Layout::finalize): Support relaxation.  Move section layout code to
11534         Layout::relaxation_loop_body.
11535         (Layout::set_asection_address_from_script): Move code for orphan
11536         section placement out.
11537         (Layout::place_orphan_sections_in_script): New method definition.
11538         * layout.h (Output_segment_headers, Output_file_header):
11539         New forward class declarations.
11540         (Layout::~Layout): Define.
11541         (Layout::new_output_section_data_from_script): New method definition.
11542         (Layout::place_orphan_sections_in_script): New method declaration.
11543         (Layout::Segment_states): New type declaration.
11544         (Layout::save_segments, Layout::restore_segments,
11545         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11546         Layout::relaxation_loop_body): New method declarations.
11547         (Layout::Output_section_data_list): New type declaration.
11548         (Layout::Relaxation_debug_check): New class definition.
11549         (Layout::record_output_section_data_from_script_,
11550         Layout::script_output_section_data_list_, Layout::segment_states_,
11551         Layout::relaxation_debug_check_): New data members.
11552         * output.cc: (Output_section_headers::do_size): New method definition.
11553         (Output_section_headers::Output_section_headers): Move size
11554         computation to Output_section_headers::do_size.
11555         (Output_segment_headers::do_size): New method definition.
11556         (Output_file_header::Output_file_header): Move size computation to
11557         Output_file_header::do_size and call it.
11558         (Output_file_header::do_size): New method definition.
11559         (Output_data_group::Output_data_group): Adjust call to
11560         Output_section_data.
11561         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11562         (Output_symtab_xindex::do_write): Add array bound check.
11563         (Output_section::Input_section::print_to_mapfile): Handle
11564         RELAXED_INPUT_SECTION_CODE.
11565         (Output_section::Output_section): Initialize data member checkpoint_.
11566         (Output_section::~Output_section): Delete checkpoint object pointed
11567         by checkpoint_.
11568         (Output_section::add_input_section): Always add an Input_section if
11569         relaxing.
11570         (Output_section::add_merge_input_section): Add assert.
11571         (Output_section::relax_input_section): New method definition.
11572         (Output_section::set_final_data_size): Set load address to zero for
11573         an unallocated section.
11574         (Output_section::do_address_and_file_offset_have_reset_values):
11575         New method definition.
11576         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11577         Handle relaxed input section.
11578         (Output_section::sort_attached_input_sections): Checkpoint input
11579         section list lazily.
11580         (Output_section::get_input_sections): Change type of input_sections to
11581         list of Simple_input_section pointers.  Checkpoint input section list
11582         lazily.  Also handle relaxed input sections.
11583         (Output_section::add_input_section_for_script): Take a reference to
11584         a Simple_input_section object instead of Relobj pointer and section
11585         index as parameter.  Handle relaxed input sections.
11586         (Output_section::save_states, Output_section::restore_states): New
11587         method definitions.
11588         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11589         (Output_data::is_data_size_fixed): New method definition.
11590         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11591         if it is fixed.
11592         (Output_data::address_and_file_offset_have_reset_values): New method
11593         definition.
11594         (Output_data::do_address_and_file_offset_have_reset_values): New method
11595         definition.
11596         (Output_data::set_data_size): Check that data size is not fixed.
11597         (Output_data::fix_data_size): New method definition.
11598         (Output_data::is_data_size_fixed_): New data member.
11599         (Output_section_headers::set_final_data_size): New method definition.
11600         (Output_section_headers::do_size): New method declaration.
11601         (Output_segment_headers::set_final_data_size): New method definition.
11602         (Output_segment_headers::do_size): New method declaration.
11603         (Output_file_header::set_final_data_size)::New method definition.
11604         (Output_file_header::do_size)::New method declaration.
11605         (Output_section_data::Output_section_data): Add new parameter
11606         is_data_size_fixed and use it to fix data size.
11607         (Output_data_const::Output_data_const): Adjust call to base class
11608         constructor and fix data size.
11609         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11610         base class constructor and fix data size.
11611         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11612         base class constructor and fix data size.
11613         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11614         class constructor and fix data size.
11615         (Output_data_group::set_final_data_size): New method definition.
11616         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11617         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11618         class constructor and fix data size.
11619         (Output_relaxed_input_section): New class definition.
11620         (Output_section::Simple_input_section): New class definition.
11621         (Output_section::get_input_sections): Adjust parameter list.
11622         (Output_section::add_input_section_for_script): Same.
11623         (Output_section::save_states, Output_section::restore_states,
11624         Output_section::do_address_and_file_offset_have_reset_values,
11625         (Output_section::Input_section::Input_section): Handle
11626         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11627         Output_relaxed_input_section.
11628         (Output_section::Input_section::is_input_section,
11629         Output_section::Input_section::set_output_section): Handle relaxed
11630         input section.
11631         (Output_section::Input_section::is_relaxed_input_section,
11632         Output_section::Input_section::output_section_data,
11633         Output_section::Input_section::relaxed_input_section): New method
11634         definitions.
11635         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11636         value.
11637         (Output_section::Input_section::u1_): Update comments.
11638         (Output_section::Input_section::u2_): Add new union member poris.
11639         (Output_section::Checkpoint_output_section): New classs definition.
11640         (Output_section::relax_input_section): New method declaration.
11641         (Output_section::checkpoint_): New data member.
11642         (Output_segment): Update comments.
11643         (Output_segment::Output_segment): Un-privatize copy constructor.
11644         (Output_segment::operator=): Un-privatize.
11645         * script-sections.cc (Output_section_element::Input_section_list):
11646         Change element type to Output_section::Simple_input_section.
11647         (Output_section_element_dot_assignment::set_section_addresses):
11648         Register output section data for relaxation clean up.
11649         (Output_data_exression::Output_data_expression): Adjust call to base
11650         constructor to fix data size.
11651         (Output_section_element_data::set_section_addresses): Register
11652         Output_data_expression object for relaxation clean up.
11653         (struct Input_section_info): Replace Relobj pointer and section index
11654         pair with Output_section::Simple_input_section and Convert struct to a
11655         class.
11656         (Input_section_sorter::operator()): Adjust access to
11657         Input_section_info data member to use accessors.
11658         (Output_section_element_input::set_section_addresses): Use layout
11659         parameter.  Adjust code to use Output_section::Simple_input_section
11660         and Input_secction_info classes.  Register filler for relaxation
11661         clean up.
11662         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11663         and section index pair with Output_section::Simple_input_section
11664         class.  Adjust code accordingly.
11665         (Phdrs_element::release_segment): New method definition.
11666         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11667         segment list.
11668         (Script_sections::release_segments): New method definition.
11669         * gold/script-sections.h (Script_sections::release_segments): New
11670         method declaration.
11671         * gold/target.h (Target::may_relax, Target::relax,
11672         Target::do_may_relax, Target::do_relax): New method definitions.
11673
11674 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11675
11676         * arm.cc (has_signed_unsigned_overflow): New function.
11677         (Arm_relocate_functions::abs8): New function.
11678         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11679         (Target_arm::Scan::global): Likewise.
11680         (Target_arm::relocate::relocate): Likewise.
11681         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11682         Likewise.
11683
11684 2009-09-16  Cary Coutant  <ccoutant@google.com>
11685
11686         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11687         * testsuite/Makefile.in: Regenerate.
11688
11689 2009-09-11  Nick Clifton  <nickc@redhat.com>
11690
11691         * po/gold.pot: Updated by the Translation project.
11692
11693 2009-09-08  Cary Coutant  <ccoutant@google.com>
11694
11695         * output.cc (Output_file::open): Add execute permission to empty file.
11696         * testsuite/Makefile.am (permission_test): New test.
11697         * testsuite/Makefile.in: Regenerate.
11698
11699 2009-09-02  Ian Lance Taylor  <iant@google.com>
11700
11701         * output.cc (Output_file::resize): Call map_no_anonymous rather
11702         than map.
11703
11704 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11705
11706         * gold.cc: Include "incremental.h".
11707         (queue_initial_tasks): Call Incremental_checker methods.
11708         * incremental.cc: Include "output.h".
11709         (Incremental_checker::can_incrementally_link_output_file): New
11710         method.
11711         * incremental.h (Incremental_checker): New class.
11712
11713         * output.cc (Output_file::open_for_modification): New method.
11714         (Output_file::map_anonymous): Changed return type to bool.  Record
11715         map in base_ field.
11716         (Output_file::map_no_anonymous): New method, broken out of map.
11717         (Output_file::map): Use map_no_anonymous and map_anonymous.
11718         * output.h (class Output_file): Update declarations.
11719
11720 2009-08-24  Cary Coutant  <ccoutant@google.com>
11721
11722         * options.h (Command_line::Pre_options): New class.
11723         (Command_line::pre_options): New member.
11724         * options.cc (gold::options::ready_to_register): New variable.
11725         (One_option::register_option): Do nothing if not registering options.
11726         Assert if same short option registered twice.
11727         (General_options::General_options): Turn off option registration when
11728         done constructing.
11729         (Command_line::Pre_options::Pre_options): New constructor.
11730
11731 2009-08-24  Cary Coutant  <ccoutant@google.com>
11732
11733         * options.h (General_options::no_keep_memory): Remove incorrect
11734         short option.
11735
11736 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11737
11738         * Makefile.am (am__skiplex, am__skipyacc): New.
11739         * Makefile.in: Regenerate.
11740
11741 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11742
11743         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11744         (INCLUDES): ... this.
11745         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11746         (AM_CPPFLAGS): Renamed from ...
11747         (INCLUDE): ... this.
11748         * Makefile.in, testsuite/Makefile.in: Regenerate.
11749
11750         * Makefile.in: Regenerate.
11751         * aclocal.m4: Likewise.
11752         * config.in: Likewise.
11753         * configure: Likewise.
11754         * testsuite/Makefile.in: Likewise.
11755
11756         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11757         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11758         * Makefile.in: Regenerate.
11759         * testsuite/Makefile.in: Regenerate.
11760
11761 2009-08-19  Cary Coutant  <ccoutant@google.com>
11762
11763         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11764         symbols in shared libraries overridden by hidden or internal symbols
11765         in the main program.
11766
11767 2009-08-19  Chris Demetriou  <cgd@google.com>
11768
11769         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11770         checking source file names in error messages.
11771
11772 2009-08-18  Doug Kwan  <dougkwan@google.com>
11773
11774         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11775         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11776         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11777         an elfcpp::Ehdr as parameter.
11778         * object.cc (Object::set_target): Remove the version that looks up
11779         a target and sets it.
11780         (Sized_relobj::setup): Take a Target object instead of
11781         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11782         (make_elf_sized_object): Find target and ask target to
11783         make an ELF object.
11784         * object.h: (Object::set_target): Remove the version that looks up
11785         a target and sets it.
11786         (Sized_relobj::setup): Take a Target object instead of
11787         an elfcpp:Ehdr as parameter.
11788         * target.cc: Include dynobj.h.
11789         (Target::do_make_elf_object_implementation): New.
11790         (Target::do_make_elf_object): New.
11791         * target.h (Target::make_elf_object): New template declaration.
11792         (Target::do_make_elf_object): New method declarations.
11793         (Target::do_make_elf_object_implementation): New template declaration.
11794
11795 2009-08-14  Ian Lance Taylor  <iant@google.com>
11796
11797         * gold.h (FUNCTION_NAME): Define.
11798         (gold_unreachable): Use FUNCTION_NAME.
11799
11800 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11801
11802         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11803         symbol in the --keep-unique list is not found.
11804
11805 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11806
11807         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11808         been maked as --keep-unique.
11809         (Icf::unfold_section): New function.
11810         * icf.h (Icf::unfold_section): New function.
11811         * options.h (General_options::keep_unique): New option.
11812         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11813         * testsuite/Makefile.in: Regenerate.
11814         * testsuite/icf_keep_unique_test.sh: New file.
11815         * testsuite/icf_keep_unique_test.cc: New file.
11816
11817 2009-08-12  Cary Coutant  <ccoutant@google.com>
11818
11819         PR 10471
11820         * resolve.cc (Symbol_table::resolve): Check for references from
11821         dynamic objects to hidden and internal symbols.
11822         * testsuite/Makefile.am (hidden_test.sh): New test.
11823         * testsuite/Makefile.in: Regenerate.
11824         * testsuite/hidden_test.sh: New script.
11825         * testsuite/hidden_test_1.c: New test source.
11826         * testsuite/hidden_test_main.c: New test source.
11827
11828 2009-08-11  Doug Kwan  <dougkwan@google.com>
11829
11830         * arm.cc: Update comments.
11831         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11832         segment to locate the .ARM.exidx section if present.
11833
11834 2009-08-09  Doug Kwan  <dougkwan@google.com>
11835
11836         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11837         patch.
11838
11839 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11840         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11841         compiler warnings.
11842
11843 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11844
11845         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11846         valid tls_segment only for non-debug-section relocations.
11847         * testsuite/Makefile.am: Add gc_tls_test.
11848         * testsuite/Makefile.in: Regenerate.
11849         * testsuite/gc_tls_test.cc: New file.
11850         * testsuite/gc_tls_test.sh: New file.
11851
11852 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11853
11854         * icf.cc: New file.
11855         * icf.h: New file.
11856         * Makefile.am (CCFILES): Add icf.cc.
11857         (HFILES): Add icf.h
11858         * Makefile.in: Regenerate.
11859         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11860         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11861         section, symbol and addend information for the relocs.
11862         * gold.cc (queue_middle_tasks): Call identical code folding.
11863         * gold.h: Add defines for multimap.
11864         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11865         to the call of finalize_local_symbols.
11866         * main.cc (main): Create object of class Icf.
11867         * object.cc (Sized_relobj::do_layout): Allow this function to be
11868         called twice during icf.
11869         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11870         to sections marked as identical by icf.
11871         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11872         when available.
11873         (Sized_relobj::do_section_entsize): New function.
11874         * object.h (Object::section_entsize): New function.
11875         (Object::do_section_entsize): New pure virtual function.
11876         (Relobj::finalize_local_symbols): Add new parameter.
11877         (Relobj::do_section_entsize): New function.
11878         * options.h (General_options::icf): New option.
11879         (General_options::icf_iterations): New option.
11880         (General_options::print_icf_sections): New option.
11881         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11882         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11883         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11884         icf.
11885         * symtab.cc (Symbol_table::is_section_folded): New function.
11886         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11887         to sections marked as identical by icf.
11888         * symtab.h (Symbol_table::set_icf): New function.
11889         (Symbol_table::icf): New function.
11890         (Symbol_table::is_section_folded): New function.
11891         (Symbol_table::icf_): New data member.
11892         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11893         * testsuite/Makefile.am: Add commands to build icf_test.
11894         * testsuite/Makefile.in: Regenerate.
11895         * testsuite/icf_test.sh: New file.
11896         * testsuite/icf_test.cc: New file.
11897
11898 2009-07-24  Chris Demetriou  <cgd@google.com>
11899
11900         * layout.cc (is_compressible_debug_section): Fix incorrect
11901         comment about compressed section names.
11902
11903 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11904
11905         PR 10419
11906         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11907
11908 2009-07-16  Ian Lance Taylor  <iant@google.com>
11909
11910         PR 10400
11911         * layout.h: #include <map>.
11912         (class Kept_section): Change from struct to class.  Add accessors
11913         and setters.  Add section size to Comdat_group mapping.  Change
11914         Comdat_group to std::map.  Add is_comdat_ field.  Add
11915         linkonce_size field in union.
11916         (class Layout): Update declaration of find_or_add_kept_section.
11917         Don't declare find_kept_object.
11918         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11919         parameter.  Add object, shndx, is_comdat, and is_group_name
11920         parameters.  Change all callers.  Adjust for new Kept_section.
11921         (Layout::find_kept_object): Remove.
11922         * object.cc (Sized_relobj::include_section_group): Update use of
11923         Kept_section.  Rename secnum to shndx.  Only record
11924         Kept_comdat_section if sections are the same size.
11925         (Sized_relobj::include_linkonce_section): Update use of
11926         Kept_section.  Only record Kept_comdat_section if sections are the
11927         same size.  Set size of linkonce section.
11928         (Sized_relobj::map_to_kept_section): Update call to
11929         get_kept_comdat_section.
11930         * object.h (class Sized_relobj): Rename fields in
11931         Kept_comdat_section to drop trailing underscores; change object
11932         field to Relobj*.  Change Kept_comdat_section_table to store
11933         struct rather than pointer.
11934         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11935         Add kept_object and kept_shndx parameters.  Change all callers.
11936         (Sized_relobj::get_kept_comdat_section): Change return type to
11937         bool.  Add kept_object and kept_shndx parameters.  Change all
11938         callers.
11939         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11940         Layout::find_or_add_kept_section.
11941
11942 2009-07-09  Ian Lance Taylor  <iant@google.com>
11943
11944         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11945         Reserve space in the hash table.
11946
11947 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11948
11949         * fileread.cc (File_read::get_mtime): New method.
11950         * fileread.h (Timespec): New structure.
11951         (File_read::get_mtime): New method.
11952         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11953         Renamed from timestamp_nsec.
11954         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11955         Elf_Xword.
11956         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11957         timestamp_nsec.
11958         (Incremental_inputs::report_archive): Save mtime; style fix.
11959         (Incremental_inputs::report_obejct): Save mtime; style fix.
11960         (Incremental_inputs::report_script): Save mtime; style fix.
11961         (Incremental_inputs::finalize_inputs): Style fix.
11962         (Incremental_inputs::finalize): Style fix.
11963         (Incremental_inputs::create_input_section_data): Store inputs
11964         mtime.
11965         * incremental.h (Incremental_inputs::report_script): Add mtime
11966         argument.
11967         (Incremental_inputs::Input_info::Input_info): Intialize only one
11968         union member.
11969         (Incremental_inputs::Input_info::archive): Move to nameless
11970         union.
11971         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11972         (Incremental_inputs::Input_info::script): Move to nameless union.
11973         (Incremental_inputs::mtime): New field.
11974         * script.cc (read_input_script): Pass file mtime to
11975         Incremental_input.
11976         * script.h (Script_info::inputs): Style fix.
11977
11978 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11979
11980         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11981         instead of 32.
11982
11983 2009-06-24  Ian Lance Taylor  <iant@google.com>
11984
11985         PR 10156
11986         * layout.cc (Layout::choose_output_section): If we find an
11987         existing section, update the flags.
11988         (Layout::create_notes): New function, broken out of
11989         Layout::finalize.
11990         (Layout::finalize): Don't create note sections.
11991         (Layout::create_note): Don't crash if linker script discards
11992         section.
11993         (Layout::create_gold_note): Likewise.
11994         (Layout::create_build_id): Likewise.  Don't set
11995         after_input_sections on the section.
11996         (Layout::create_executable_stack_info): Remove target parameter.
11997         Change caller.
11998         * layout.h (class Layout): Declare create_notes.  Update
11999         declaration of create_executable_stack_info.
12000         * gold.cc (queue_middle_tasks): Call create_notes.
12001         * output.cc (Output_section::update_flags_for_input_section): Move
12002         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12003         invalid.
12004         * output.h (Output_data::mark_address_invalid): New function.
12005         (class Output_section): Only declare, not define,
12006         update_flags_for_input_section.  Remove set_flags.
12007
12008 2009-06-24  Ian Lance Taylor  <iant@google.com>
12009
12010         * script-sections.cc (Output_section_definition::
12011         set_section_addresses): Rename shadowing local load_address to
12012         laddr.
12013
12014 2009-06-24  Ian Lance Taylor  <iant@google.com>
12015
12016         PR 10244
12017         * reloc.cc (relocate_sections): Skip empty relocation sections.
12018
12019 2009-06-23  Ian Lance Taylor  <iant@google.com>
12020
12021         PR 10156
12022         * layout.cc (Layout::create_note): Use choose_output_section
12023         rather than make_output_section.
12024
12025 2009-06-23  Ian Lance Taylor  <iant@google.com>
12026
12027         PR 10237
12028         * options.cc (General_options::parse_V): Set printed_version_.
12029         (General_options::General_options): Initialize printed_version_.
12030         * options.h (class General_options): Add printed_version_ field.
12031         * gold.cc (queue_initial_tasks): If there are no input files,
12032         don't give a fatal error if we printed the version information.
12033         (queue_middle_tasks): If using -r with a shared object, give a
12034         fatal error rather than an ordinary error.
12035
12036 2009-06-23  Ian Lance Taylor  <iant@google.com>
12037
12038         PR 10219
12039         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12040         (Layout::make_output_section): Set have_stabstr_section_ if we see
12041         a .stab*str section.
12042         (Layout::finalize): Call link_stabs_sections.
12043         (Layout::link_stabs_sections): New file.
12044         * layout.h (class Layout): Add have_stabstr_section_ field.
12045         Declare link_stabs_sections.
12046
12047 2009-06-23  Doug Kwan  <dougkwan@google.com>
12048
12049         * Makefile.am (libgold_a_LIBADD): New.
12050         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12051         * Makefile.in: Regenerate.
12052         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12053         * configure: Regenerate.
12054         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12055         * fileread.cc: Include sys/state.h
12056         * gold.h: Declare memmem and strndup if found missing.
12057         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12058
12059 2009-06-23  Ian Lance Taylor  <iant@google.com>
12060
12061         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12062         * configure: Rebuild.
12063
12064 2009-06-23  Ian Lance Taylor  <iant@google.com>
12065
12066         PR 10147
12067         * object.cc (Object::section_contents): Don't try to get a view if
12068         the section has length zero.
12069         (Object::handle_gnu_warning_section): If the section is empty, use
12070         the name of the section as the warning.
12071
12072 2009-06-23  Ian Lance Taylor  <iant@google.com>
12073
12074         PR 10133
12075         * stringpool.h (class Stringpool_template): Add optimize_ field.
12076         (Stringpool_template::set_optimize): New function.
12077         * stringpool.cc (Stringpool_template::Stringpool_template):
12078         Initialize optimize_ field.
12079         (Stringpool_template::set_string_offsets): Test local optimize
12080         fild rather than parameter.
12081         * layout.cc (Layout::Layout): Call set_optimize on the section
12082         name stringpool.
12083
12084 2009-06-22  Ian Lance Taylor  <iant@google.com>
12085
12086         PR 10030
12087         * yyscript.y: Parse TARGET.
12088         * script.cc (script_set_target): New function.
12089         * script-c.h (script_set_target): Declare.
12090         * options.cc (General_options::string_to_object_format): Rename
12091         from string_to_object_format in anonymous namespace.  Change
12092         callers.
12093         * options.h (class General_options): Declare
12094         string_to_object_format.
12095
12096 2009-06-22  Ian Lance Taylor  <iant@google.com>
12097
12098         * script-sections.cc (Script_sections::create_segments): Don't put
12099         program headers in a PT_LOAD segment if -n or -N.
12100
12101 2009-06-22  Ian Lance Taylor  <iant@google.com>
12102
12103         PR 10141
12104         * options.h (class General_options): Add -z lazy and -z now.  Sort
12105         -z options into alphabetical order.
12106         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12107
12108 2009-06-21  Ian Lance Taylor  <iant@google.com>
12109
12110         * layout.cc (Layout::make_output_section): Call
12111         Target::new_output_section.
12112         (Layout::attach_allocated_section_to_segment): Put large section
12113         sections in a separate load segment with the large segment flag
12114         set.
12115         (Layout::segment_precedes): Sort large data segments after other
12116         load segments.
12117         (align_file_offset): New static function.
12118         (Layout::set_segment_offsets): Use align_file_offset.
12119         * output.h (class Output_section): Add is_small_section_ and
12120         is_large_section_ fields.
12121         (Output_section::is_small_section): New function.
12122         (Output_section::set_is_small_section):  New function.
12123         (Output_section::is_large_section): New function.
12124         (Output_section::set_is_large_section): New function.
12125         (Output_section::is_large_data_section): New function.
12126         (class Output_segment): Add is_large_data_segment_ field.
12127         (Output_segment::is_large_data_segment): New function.
12128         (Output_segment::set_is_large_data_segment): New function.
12129         * output.cc (Output_section::Output_section): Initialize new
12130         fields.
12131         (Output_segment::Output_segment): Likewise.
12132         (Output_segment::add_output_section): Add assertion that large
12133         data sections always go in large data segments.  Force small data
12134         sections to the end of the list of data sections.  Force small BSS
12135         sections to the start of the list of BSS sections.  For large BSS
12136         sections to the end of the list of BSS sections.
12137         * symtab.h (class Symbol): Declare is_common_shndx.
12138         (Symbol::is_defined): Check Symbol::is_common_shndx.
12139         (Symbol::is_common): Likewise.
12140         (class Symbol_table): Define enum Commons_section_type.  Update
12141         declarations.  Add small_commons_ and large_commons_ fields.
12142         * symtab.cc (Symbol::is_common_shndx): New function.
12143         (Symbol_table::Symbol_table): Initialize new fields.
12144         (Symbol_table::add_from_object): Put small and large common
12145         symbols in the right list.
12146         (Symbol_table::sized_finalized_symbol): Check
12147         Symbol::is_common_shndx.
12148         (Symbol_table::sized_write_globals): Likewise.
12149         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12150         common symbol lists.  Don't call do_allocate_commons_list if the
12151         list is empty.
12152         (Symbol_table::do_allocate_commons_list): Remove is_tls
12153         parameter.  Add comons_section_type parameter.  Change all
12154         callers.  Handle small and large common symbols.
12155         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12156         Symbol::is_common_shndx.
12157         * resolve.cc (symbol_to_bits): Likewise.
12158         * target.h (Target::small_common_shndx): New function.
12159         (Target::small_common_section_flags): New function.
12160         (Target::large_common_shndx): New function.
12161         (Target::large_common_section_flags): New function.
12162         (Target::new_output_section): New function.
12163         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12164         small_common_section_flags, and large_common_section_flags
12165         fields.
12166         (Target::do_new_output_section): New virtual function.
12167         * arm.cc (Target_arm::arm_info): Initialize new fields.
12168         * i386.cc (Target_i386::i386_info): Likewise.
12169         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12170         Likewise.
12171         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12172         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12173         (Target_x86_64::do_new_output_section): New function.
12174         * configure.ac: Define conditional MCMODEL_MEDIUM.
12175         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12176         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12177         (large_LDFLAGS): Define.
12178         * testsuite/large.c: New file.
12179         * testsuite/testfile.cc (Target_test::test_target_info):
12180         Initialize new fields.
12181         * configure, testsuite/Makefile.in: Rebuild.
12182
12183 2009-06-05  Doug Kwan  <dougkwan@google.com>
12184
12185         * Makefile.am (CCFILES): Add target.cc.
12186         * Makefile.in: Regenerate.
12187         * i386.cc (class Target_i386): Define new virtual method to
12188         override do_is_local_label_name in parent.
12189         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12190         local symbols if --discard-locals or -X is given.
12191         * options.h (class General_options): Declare new options
12192         '--discard-locals' and '-X' for discarding locals.
12193         * target.h (class Target): Define new methods is_local_label_name.
12194         Declare new virtual method do_is_local_label_name.
12195         * target.cc: New file.
12196         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12197         (check_SCRIPTS): Add discard_locals_test.sh.
12198         (check_DATA): Add discard_local_tests.syms.
12199         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12200         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12201         * testsuite/Makefile.in: Regenerate.
12202         * testsuite/discard_locals_test.c: New file.
12203         * testsuite/discard_locals_test.sh: Same.
12204
12205 2009-06-05  Doug Kwan  <dougkwan@google.com>
12206
12207         * object.cc (Sized_relobj::Sized_relobj): Initialize
12208         discarded_eh_frame_shndx_ to -1U.
12209         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12210         section.
12211         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12212         a discarded .eh_frame section.
12213         (Sized_relobj::do_finalize_local_symbols): Ditto.
12214         * object.h (class Sized_relobj): Declare new member
12215         discarded_eh_frame_shndx_.
12216         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12217         (local_labels_test.o, local_labels_test): New rules.
12218         * testsuite/Makefile.in: Regenerate.
12219
12220 2009-06-04  Doug Kwan  <dougkwan@google.com>
12221
12222         * layout.cc (Layout::section_name_mapping): Add mapping for
12223         special ARM sections.
12224
12225 2009-06-03  Doug Kwan  <dougkwan@google.com>
12226
12227         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12228         (utils::has_overflow): Same.
12229
12230 2009-06-03  Ian Lance Taylor  <iant@google.com>
12231
12232         * layout.cc (Layout::section_name_mapping): New array, replacing
12233         Layout::linkonce_mapping.
12234         (Layout::section_name_mapping_count): New variable, replacing
12235         Layout::linkonce_mapping_count.
12236         (Layout::linkonce_output_name): Remove.
12237         (Layout::output_section_name): Rewrite.
12238         * layout.h (class Layout): Rename Linkonce_mapping to
12239         Section_name_mapping, linkonce_mapping to section_name_mapping,
12240         linkonce_mapping_count to section_name_mapping_count.  Don't
12241         declare linkonce_output_name.
12242
12243 2009-06-03  Doug Kwan  <dougkwan@google.com>
12244
12245         * gold/arm.cc (namespace utils): New.
12246         (Target_arm::reloc_is_non_pic): Define new method.
12247         (class Arm_relocate_functions): New.
12248         (Target_arm::Relocate::relocate): Handle relocation types used by
12249         Android.
12250
12251 2009-06-03  Ian Lance Taylor  <iant@google.com>
12252
12253         * arm.cc (Target_arm::scan::global): Use || instead of |.
12254
12255 2009-06-02  Doug Kwan  <dougkwan@google.com>
12256
12257         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12258         issued_non_pic_error_.
12259         (class Target_arm::Scan): Declare new method check_non_pic.
12260         Define new method symbol_needs_plt_entry.
12261         Declare new data member issued_non_pic_error_.
12262         (class Target_arm::Relocate): Declare new method
12263         should_apply_static_reloc.
12264         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12265         (Target_arm::Scan::check_non_pic): Define new method.
12266         (Target_arm::Scan::local): Handle a small subset of reloc types used
12267         by Android.
12268         (Target_arm::Scan::local): Same.
12269         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12270
12271 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12272
12273         * incremental.cc (Incremental_inputs::report_command_line): Filter
12274         out --incremental-* options.
12275
12276 2009-05-29  Doug Kwan  <dougkwan@google.com>
12277
12278         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12279         template class.
12280         (class Target_arm): Update comment.
12281         (Target_arm::Target_arm): Initialize new data members GOT_,
12282         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12283         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12284         and Target_arm::rel_dyn_section.
12285         Declare new_enum Target_arm::Got_type.
12286         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12287         and DYNBSS_.
12288         Update commments for member do_dynsym_value.
12289         (Target_arm::got_size, Target_arm::plt_section,
12290         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12291         new methods inside class defintion.
12292         (Target_arm::got_section): Define new method.
12293         (Target_arm::rel_dyn_section): Same.
12294         (Output_data_plt_arm): New template class.
12295         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12296         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12297         (Output_data_plt_arm::add_entry): Same.
12298         (Output_data_plt_arm::first_plt_entry): Define new
12299         static data member for PLT instruction template.
12300         (Output_data_plt_arm::plt_entry): Same.
12301         (Output_data_plt_arm::do_write): Define new method.
12302         (Target_arm::make_plt_entry): Same.
12303         (Target_arm::do_finalize_sections): Same.
12304         (Target_arm::do_dynsym_value): Same.
12305
12306 2009-05-28  Doug Kwan  <dougkwan@google.com>
12307
12308         * Makefile.am (TARGETSOURCES): Add arm.cc.
12309         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12310         * Makefile.in: Regenerate.
12311         * arm.cc: New file.
12312         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12313
12314 2009-05-26  Doug Kwan  <dougkwan@google.com>
12315
12316         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12317         (General_options::check_excluded_libs): Strip off directories in
12318         archive name before matching like GNU ld does.
12319         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12320         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12321         (exclude_libs_test_LDFLAGS): Add linker option
12322         -Wl,--exclude-libs,libexclude_libs_test_3
12323         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12324         an explicit archive without using -l.
12325         (alt/libexclude_libs_test_3.a): New make rule.
12326         * testsuite/Makefile.in: Regenerate.
12327         * testsuite/exclude_libs_test.c : Declare lib3_default().
12328         (main): Call it.
12329         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12330         * exclude_libs_test_3.c: New file.
12331
12332 2009-05-26  Nick Clifton  <nickc@redhat.com>
12333
12334         * po/id.po: New Indonesian translation.
12335         * po/gold.pot: Updated template file.
12336
12337 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12338
12339         * testsuite/Makefile.am: Add -ffunction-sections to compile
12340         gc_comdat_test files.  Add -Wl,--gc-sections to build
12341         gc_comdat_test.
12342         * testsuite/Makefile.in: Regenerate.
12343         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12344
12345 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12346
12347         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12348         kept comdat section was garbage collected.
12349         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12350         * testsuite/Makefile.in: Regenerate.
12351         * testsuite/gc_comdat_test.sh: New file.
12352         * testsuite/gc_comdat_test_1.cc: New file.
12353         * testsuite/gc_comdat_test_2.cc: New file.
12354
12355 2009-05-19  Doug Kwan  <dougkwan@google.com>
12356
12357         * archive.cc (Archive::Archive): Move constructor from archive.h
12358         to here.  Initialize no_export_.
12359         (Archive::get_elf_object_for_member): Set no_export flag of object.
12360         * archive.h (Archive::Archive): Move constructor body to
12361         archive.cc.
12362         (Archive::no_export): New method.
12363         (Archive::no_export_): New field.
12364         * object.h (Object::Object): Initialize no_export_ to false.
12365         (Object::no_export, Object::set_no_export): New methods.
12366         (Object::no_export_): New field.
12367         * options.cc (General_options::parse_exclude_libs): New method.
12368         (General_options::check_excluded_libs) Same.
12369         * options.h (exclude_libs): New option.
12370         (General_options::check_excluded_libs): New method declaration.
12371         (General_options::excluded_libs_): New field.
12372         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12373         default or protected visibility if an object has no-export flag set.
12374         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12375         (check_SCRIPTS): Add exclude_libs_test.sh.
12376         (check_DATA): Add exclude_libs_test.syms.
12377         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12378         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12379         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12380         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12381         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12382         libexclude_libs_test_2.a): New rules.
12383         * testsuite/Makefile.in: Regenerate.
12384         * testsuite/exclude_libs_test.c: New file.
12385         * testsuite/exclude_libs_test.sh: Ditto.
12386         * testsuite/exclude_libs_test_1.c: Ditto.
12387         * testsuite/exclude_libs_test_2.c: Ditto.
12388
12389 2009-05-15  Ian Lance Taylor  <iant@google.com>
12390
12391         * configure.ac: Check for declarations for cases where libiberty.h
12392         checks HAVE_DECL_xxx.
12393         * configure, config.in: Rebuild.
12394
12395 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12396
12397         * gold.h (Incremental_argument_list): Remove (invalid) forward
12398         declaration.
12399         * incremental.cc (Incremental_inputs::report_achive): New method.
12400         (Incremental_inputs::report_object): New method.
12401         (Incremental_inputs::report_script): New method.
12402         (Incremental_inputs::finalize_inputs): New method.
12403         (Incremental_inputs::finalize): Call finalize_inputs().
12404         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12405         Create inputs entries.
12406         * incremental.h (Incremental_input_type): New enum.
12407         (Incremental_inputs::Incremental_input): Initialize new fields.
12408         (Incremental_inputs::report_inputs): New method.
12409         (Incremental_inputs::report_achive): New method.
12410         (Incremental_inputs::report_object): New method.
12411         (Incremental_inputs::report_script): New method.
12412         (Incremental_inputs::finalize_inputs): New method.
12413         (Incremental_inputs::Input_info): New struct.
12414         (Incremental_inputs::Input_info_map): New typedef.
12415         (Incremental_inputs::lock_): New field.
12416         (Incremental_inputs::Inputs_): New field.
12417         (Incremental_inputs::Inputs_map): New field.
12418         * main.cc (main): Call Incremental_input::report_inputs.
12419         * options.h (Input_argument_list): Typedef moved from
12420         Input_arguments.
12421         (Input_file_group::Files): Remove, use ::Input_argument_list.
12422         (Input_file_group::Input_argument_list): Remove, use
12423         ::Input_argument_list.
12424         * plugin.cc (Plugin_manager::add_input_file): Add error in
12425         incremental build.
12426         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12427         functions.
12428         * script.cc (read_input_script): Call
12429         Incremental_input::report_script.
12430         * script.h (Script_info): New class.
12431
12432 2009-04-27  Ian Lance Taylor  <iant@google.com>
12433
12434         * x86_64.cc (do_adjust_output_section): Set entsize to
12435         plt_entry_size.
12436
12437 2009-04-23  Elliott Hughes  <enh@google.com>
12438
12439         * output.cc (Output_file::close): After short writes, continue
12440         writing from the correct offset in the buffer being written.
12441
12442 2009-04-23  Chris Demetriou  <cgd@google.com>
12443
12444         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12445         * configure: Regenerate.
12446         * config.in: Regenerate.
12447         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12448         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12449
12450 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12451
12452         * incremental.cc (Incremental_inputs_header_data): Renamed from
12453         Incremental_input_header_data.
12454         (Incremental_inputs_header_data::data_size): New field.
12455         (Incremental_inputs_header_data::put_input_file_count): Renamed
12456         from input_file_count.
12457         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12458         from command_line_offset.
12459         (Incremental_inputs_header_data::put_reserved): Renamed from
12460         put_reserved.
12461         (Incremental_inputs_entry_data): Renamed from
12462         Incremental_input_entry_data.
12463         (Incremental_inputs_entry_data::data_size): New field.
12464         (Incremental_inputs::report_command_line): New method.
12465         (Incremental_inputs::finalize): New method.
12466         (Incremental_inputs::create_incremental_inputs_data): New method.
12467         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12468         * incremental.h: New file.
12469         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12470         (Layout::finalize): Create incremental inputs section in
12471         incremental builds.
12472         (Layout::create_incremental_info_sections): New method.
12473         * layout.h (Layout::incremental_inputs): New method.
12474         (Layout::create_incremental_info_sections): New method.
12475         (Layout::incremental_inputs_): New field.
12476         * main.cc (main): Notify Incremental_input of the command line.
12477
12478 2009-04-01  Ian Lance Taylor  <iant@google.com>
12479             Mikolaj Zalewski  <mikolajz@google.com>
12480
12481         * gold.h (reserve_unordered_map): Define, three versions, one for
12482         each version of Unordered_map.
12483         * layout.cc (Layout::Layout): Remove options parameter.  Add
12484         number_of_input_files parameter.  Don't initialize options_.
12485         Initialize number_of_input_files_ and resized_signatures_.  Move
12486         sections_are_attached_.
12487         (Layout::layout_group): Reserve space for group_signatures_.
12488         (Layout::find_or_add_kept_section): Change name parameter to be a
12489         reference.  Resize signatures_ map when it gets large enough.
12490         (Layout::layout_eh_frame): Use parameters->options() instead of
12491         this->options_.
12492         (Layout::make_output_section): Likewise.
12493         (Layout::attach_allocated_section_to_segment): Likewise.
12494         (Layout::finalize, Layout::create_executable_stack): Likewise.
12495         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12496         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12497         * layout.h (class Layout): Update declarations.  Remove options_
12498         field.  Add number_of_input_files_ and resized_signatures_
12499         fields.  Move sections_are_attached_ field.
12500         * main.cc (main): Pass number of input files to Layout
12501         constructor.  Don't pass options.
12502
12503 2009-03-30  Ian Lance Taylor  <iant@google.com>
12504
12505         * ffsll.c (ffsll): Correct implementation.
12506
12507 2009-03-27  Ian Lance Taylor  <iant@google.com>
12508
12509         * ffsll.c: New file.
12510         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12511         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12512         * ftruncate.c (ftruncate): Declare before definition.
12513         * mremap.c (mremap): Likewise.
12514         * pread.c (pread): Likewise.
12515         * configure, Makefile.in, config.in: Rebuild.
12516
12517         * mremap.c: New file.
12518         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12519         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12520         (mremap): Declare if HAVE_MREMAP is not defined.
12521         * configure, Makefile.in, config.in: Rebuild.
12522
12523 2009-03-27  Cary Coutant  <ccoutant@google.com>
12524
12525         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12526         position independent.
12527         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12528         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12529
12530 2009-03-24  Cary Coutant  <ccoutant@google.com>
12531
12532         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12533         an executable.
12534         (needs_dynamic_reloc): Likewise.
12535
12536 2009-03-24  Ian Lance Taylor  <iant@google.com>
12537
12538         * yyscript.y (file_cmd): Recognize EXTERN.
12539         (extern_name_list, extern_name_list_body): New nonterminals.
12540         * script.cc (script_add_extern): Define.
12541         * script-c.h (script_add_extern): Declare.
12542
12543 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12544
12545         * object.cc (is_elf_object): Define.
12546         * object.h (is_elf_object): Declare.
12547         * archive.cc (Archive::get_elf_object_for_member): Call
12548         is_elf_object.
12549         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12550
12551 2009-03-24  Elliott Hughes  <enh@google.com>
12552
12553         * output.cc (Output_file::map_anonymous): Define.
12554         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12555         try an anonymous one.  Report the size if the mmap fails.
12556         * output.h (class Output_file): Declare map_anonymous.
12557
12558 2009-03-24  Ian Lance Taylor  <iant@google.com>
12559
12560         * target-select.cc (instantiate_target): Don't acquire the lock if
12561         the instantiated_target_ field has already been set.
12562
12563 2009-03-23  Ian Lance Taylor  <iant@google.com>
12564
12565         * gold-threads.h (class Initialize_lock): Define.
12566         * gold-threads.cc (class Initialize_lock_once): Define.
12567         (initialize_lock_control): New static variable.
12568         (initialize_lock_pointer): New static variable.
12569         (initialize_lock_once): New static function.
12570         (Initialize_lock::Initialize_lock): Define.
12571         (Initialize_lock::initialize): Define.
12572         * target-select.h: Include "gold-threads.h".
12573         (class Target_selector): Add lock_ and initialize_lock_ fields.
12574         Don't define instantiate_target, just declare it.
12575         * target-select.cc (Target_selector::Target_selector): Initialize
12576         new fields.
12577         (Target_selector::instantiate_target): Define.
12578         * descriptors.h: Include "gold-threads.h".
12579         (class Descriptors): Add initialize_lock_ field.
12580         * descriptors.cc (Descriptors::Descriptors): Initialize new
12581         field.
12582         (Descriptors::open): Use initialize_lock_ field
12583         * errors.h (class Errors): Add initialize_lock_ field.
12584         * errors.cc (Errors::Errors): Initialize new field.
12585         (Errors::initialize_lock): Use initialize_lock_ field.
12586         * powerpc.cc (class Target_selector_powerpc): Remove
12587         instantiated_target_ field.  In do_recognize call
12588         instantiate_target rather than do_instantiate_target.  In
12589         do_instantiate_target just allocate a new target.
12590         * sparc.cc (class Target_selector_sparc): Likewise.
12591
12592         * freebsd.h: New file.
12593         * i386.cc: Include "freebsd.h".
12594         (Target_i386): Derive from Target_freebsd rather than
12595         Sized_target.
12596         (Target_selector_i386): Derive from Target_selector_freebsd rather
12597         than Target_selector.
12598         * x86_64.cc: Include "freebsd.h".
12599         (Target_x86_64): Derive from Target_freebsd rather than
12600         Sized_target.
12601         (Target_selector_x86_64): Derive from Target_selector_freebsd
12602         rather than Target_selector.
12603         * target.h (class Target): Add adjust_elf_header and
12604         do_adjust_elf_header.
12605         * output.cc (Output_file_header:: do_sized_write): Call target
12606         adjust_elf_header routine.
12607         * configure.tgt: Set targ_osabi.
12608         * configure.ac: Define GOLD_DEFAULT_OSABI.
12609         * parameters.cc (Parameters::default_target): Pass
12610         GOLD_DEFAULT_OSABI to select_target.
12611         * target-select.h (class Target_selector): Make instantiate_target
12612         protected rather than private.
12613         * Makefile.am (HFILES): Add freebsd.h.
12614         * configure, Makefile.in, config.in: Rebuild.
12615
12616         * merge.cc (do_add_input_section): Correct pend value.  Change
12617         message about last entry not being null terminated from error to
12618         warning.
12619
12620 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12621
12622         * incremental.cc: New file.
12623         * Makefile.am (CCFILES): Add incremental.cc.
12624         * Makefile.in: Rebuild.
12625
12626 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12627
12628         * layout.cc (Layout::output_section_name): Preserve names
12629         of '.note.' sections.
12630
12631 2009-03-19  Ian Lance Taylor  <iant@google.com>
12632
12633         * descriptors.cc (Descriptors::open): Check that the options are
12634         valid before using them.
12635
12636 2009-03-18  Ian Lance Taylor  <iant@google.com>
12637
12638         * script-sections.h: Include <list>.
12639         (class Script_sections): Change Sections_elements from std::vector
12640         to std::list.  Typedef public Elements_iterator.  Add
12641         orphan_section_placement_, data_segment_align_start_, and
12642         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12643         field.
12644         * script-sections.cc (class Orphan_section_placement): New class.
12645         (class Sections_element): Add virtual functions is_relro and
12646         orphan_section_init.  Remove virtual function place_orphan_here.
12647         (class Output_section_definition): Add is_relro and
12648         orphan_section_init.  Remove place_orphan_here.
12649         (class Orphan_output_section): Likewise.
12650         (Script_sections::Script_sections): Update for field changes.
12651         (Script_sections::data_segment_align): Set saw_data_segment_align_
12652         and data_segment_align_start_, not data_segment_align_index.
12653         (Script_sections::data_segment_relro_end): Check
12654         saw_data_segment_align_.  Use data_segment_align_start_ rather
12655         than data_segment_align_index_.
12656         (Script_sections::place_orphan): Rewrite to use
12657         Orphan_section_placement.
12658
12659 2009-03-17  Ian Lance Taylor  <iant@google.com>
12660
12661         * archive.cc (Archive::add_symbols): Check for a version attached
12662         to the symbol name in the archive map.
12663         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12664         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12665         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12666         (ver_test_11.a): New target.
12667         * testsuite/Makefile.in: Rebuild.
12668
12669         * configure.ac: Check for chsize and posix_fallocate.  Replace
12670         ftruncate.
12671         * ftruncate.c: New file, from gnulib.
12672         * output.cc (posix_fallocate): Define dummy version if not
12673         HAVE_POSIX_FALLOCATE.
12674         (Output_file::map): Call posix_fallocate rather than lseek and
12675         write.
12676         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12677         * configure, Makefile.in, config.in: Rebuild.
12678
12679 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12680
12681         * layout.h (Layout::create_note): Add section_name parameter.
12682         * layout.cc (Layout::create_note): Likewise.
12683         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12684
12685 2009-03-17  Ian Lance Taylor  <iant@google.com>
12686
12687         * descriptors.cc: Include "options.h".
12688         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12689         (Descriptors::open): Always use O_CLOEXEC when opening a new
12690         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12691         then set FD_CLOEXEC.
12692
12693         * sparc.cc (class Target_sparc): Add has_got_section.
12694         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12695         make sure we have a GOT section.
12696
12697         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12698         (Target_sparc::Scan::local): Likewise.
12699         (Target_sparc::Scan::global): Likewise.
12700         (Target_sparc::Relocate::relocate): Likewise.
12701         (Target_sparc::Relocate::relocate_tls): Likewise.
12702
12703         * symtab.cc (Symbol_table::define_default_version): New function,
12704         broken out of add_from_object.
12705         (Symbol_table::add_from_object): Call define_default_version.
12706         (Symbol_table::define_special_symbol): Add resolve_oldsym
12707         parameter.  Change all callers.  If the version for a symbol comes
12708         from a version script, resolve it with the symbol with the same
12709         name with no version.  Also add the symbol without a version if
12710         appropriate.
12711         (do_define_in_output_data): If resolving with oldsym, don't delete
12712         sym.
12713         (do_define_in_output_segment): Likewise.
12714         (do_define_as_constant): Likewise.
12715         * symtab.h (class Symbol_table): Update declarations.
12716
12717 2009-03-13  Ian Lance Taylor  <iant@google.com>
12718
12719         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12720         (Read_symbols::requeue): New function.
12721         (Read_symbols::do_read_symbols): If make_elf_object fails because
12722         the target type is not configured, and the file was searched for,
12723         issue a warning and retry with the next directory.
12724         (Add_symbols::run): If the file has an incompatible format, and
12725         it was searched for, requeue the Read_symbols task.  On error,
12726         release the object.
12727         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12728         dirindex parameter to constructor.  Change all callers.  Declare
12729         incompatible_warning and requeue.
12730         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12731         input_argument_ and input_group_ fields.  Add them to
12732         constructor.  Change all callers.
12733         (class Read_script): Add dirindex_ field.  Add it to constructor.
12734         Change all callers.
12735         * archive.cc (Archive::setup): Remove input_objects parameter.
12736         Change all callers.
12737         (Archive::get_file_and_offset): Likewise.
12738         (Archive::read_all_symbols): Likewise.
12739         (Archive::read_symbols): Likewise.
12740         (Archive::get_elf_object_for_member): Remove input_objects
12741         parameter.  Add punconfigured parameter.  Change all callers.
12742         (Archive::add_symbols): Change return type to bool.  Check return
12743         value of include_member.
12744         (Archive::include_all_members): Likewise.
12745         (Archive::include_member): Change return type to bool.  Return
12746         false if first included object has incompatible target.  Set
12747         included_member_ field.
12748         (Add_archive_symbols::run): If add_symbols returns false, requeue
12749         Read_symbols task.
12750         * archive.h (class Archive): Add included_member_ field.
12751         Initialize it in constructor.  Add input_file and searched_for
12752         methods.  Update declarations.
12753         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12754         input_argument_ fields.  Add them to constructor.  Change all
12755         callers.
12756         * script.cc: Include "target-select.h".
12757         (class Parser_closure): Add skip_on_incompatible_target_ and
12758         found_incompatible_target_ fields.  Add
12759         skip_on_incompatible_target parameter to constructor.  Change all
12760         callers.  Add methods skip_on_incompatible_target,
12761         clear_skip_on_incompatible_target, found_incompatible_target, and
12762         set_found_incompatible_target.
12763         (read_input_script): Add dirindex parameter.  Change all callers.
12764         If parser finds an incompatible target, requeue Read_symbols
12765         task.
12766         (script_set_symbol): Clear skip_on_incompatible_target in
12767         closure.
12768         (script_add_assertion, script_parse_option): Likewise.
12769         (script_start_sections, script_add_phdr): Likewise.
12770         (script_check_output_format): New function.
12771         * script.h (read_input_script): Update declaration.
12772         * script-c.h (script_check_output_format): Declare.
12773         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12774         (ignore_cmd): Remove OUTPUT_FORMAT.
12775         * fileread.cc (Input_file::Input_file): Add explicit this.
12776         (Input_file::will_search_for): New function.
12777         (Input_file::open): Add pindex parameter.  Change all callers.
12778         * fileread.h (class Input_file): Add input_file_argument method.
12779         Declare will_search_for.  Update declarations.
12780         * object.cc (make_elf_object): Add punconfigured parameter.
12781         Change all callers.
12782         * object.h (class Object): Make input_file public.  Add
12783         searched_for method.
12784         (make_elf_object): Update declaration.
12785         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12786         restart search.
12787         * dirsearch.h (class Dirsearch): Update declaration.
12788         * options.h (class General_options): Add --warn-search-mismatch.
12789         * parameters.cc (Parameters::is_compatible_target): New function.
12790         * parameters.h (class Parameters): Declare is_compatible_target.
12791         * workqueue.cc (Workqueue::add_blocker): New function.
12792         * workqueue.h (class Workqueue): Declare add_blocker.
12793
12794         * fileread.cc (Input_file::open): Remove options parameter.
12795         Change all callers.
12796         (Input_file::open_binary): Likewise.
12797         * script.cc (read_input_script): Likewise.
12798         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12799         options parameter from constructor.  Change all callers.
12800         (class Read_script): Likewise.
12801         * fileread.h (class Input_file): Update declarations.
12802         * script.h (read_input_script): Update declaration.
12803
12804 2009-03-10  Nick Clifton  <nickc@redhat.com>
12805
12806         * po/es.po: New Spanish translation.
12807
12808 2009-03-06  Cary Coutant  <ccoutant@google.com>
12809
12810         * options.cc (parse_short_option): Keep dash_z from registering itself.
12811
12812 2009-03-03  Ian Lance Taylor  <iant@google.com>
12813
12814         PR 9918
12815         * target-reloc.h (relocate_section): Pass output_section to
12816         relocate.
12817         * i386.cc (Target_i386::should_apply_static_reloc): Add
12818         output_section parameter.  Change all callers.
12819         (Target_i386::Relocate::relocate): Add output_section parameter.
12820         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12821         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12822         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12823         * testsuite/two_file_shared.sh: New script.
12824         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12825         (check_DATA): Add two_file_shared.dbg.
12826         (two_file_shared.dbg): New target.
12827         * testsuite/Makefile.in: Rebuild.
12828
12829 2009-03-01  Ian Lance Taylor  <iant@google.com>
12830
12831         * configure.ac: Check for byteswap.h.
12832         * configure: Rebuild.
12833         * config.in: Rebuild.
12834
12835 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12836
12837         * layout.cc (Layout::find_or_add_kept_section): New function.
12838         (Layout::add_comdat): Removed.
12839         * layout.h (struct Kept_section): Move out of class Layout.
12840         Remove trailing underscores from field names.  Add group_sections
12841         field.  Rename group_ field to is_group.  Change all uses.
12842         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12843         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12844         comdat_groups_ field.
12845         (Sized_relobj::include_section_group): Use
12846         find_or_add_kept_section and Kept_section::group_sections.
12847         (Sized_relobj::include_linkonce_section): Likewise.
12848         * object.cc (class Sized_relobj): Don't define Comdat_group or
12849         Comdat_group_table.  Remove find_comdat_group and
12850         add_comdat_group.  Remove comdat_groups_ field.
12851         * plugin.cc (include_comdat_group): Use
12852         Layout::find_or_add_kept_section.
12853
12854 2009-02-28  Ian Lance Taylor  <iant@google.com>
12855
12856         * README: --gc-sections and map files are now supported.  Document
12857         some build requirements.
12858
12859         PR 6992
12860         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12861         relocatable link set the value of the section symbol to zero.
12862         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12863         relocatable link don't include the section address in the local
12864         symbol value.
12865
12866 2009-02-27  Ian Lance Taylor  <iant@google.com>
12867
12868         PR 6811
12869         * options.h (class Search_directory): Add is_system_directory.
12870         (class General_options): Declare is_in_system_directory.
12871         * options.cc (get_relative_sysroot): Make static.
12872         (get_default_sysroot): Make static.
12873         (General_optoins::is_in_system_directory): New function.
12874         * fileread.cc (Input_file::is_in_system_directory): New function.
12875         * fileread.h (class Input_file): Declare is_in_system_directory.
12876         * object.h (class Object): Add is_in_system_directory.
12877         (class Input_objects): Remove system_library_directory_ field.
12878         * object.cc (Input_objects::add_object): Don't set
12879         system_library_directory_.
12880         (input_objects::found_in_system_library_directory): Remove.
12881         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12882         parameter.  Change all callers.
12883         (Symbol_table::sized_write_globals): Likewise.
12884         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12885         Call Object::is_in_system_directory.
12886         * symtab.h (class Symbol_table): Update declarations.
12887
12888         PR 5990
12889         * descriptors.h (Open_descriptor): Add is_on_stack field.
12890         * descriptors.cc (Descriptors::open): If the descriptor is on the
12891         top of the stack, remove it.  Initialize is_on_stack field.
12892         (Descriptors::release): Only add pod to stack if it is not on the
12893         stack already.
12894         (Descriptors::close_some_descriptor): Clear stack_next and
12895         is_on_stack fields.
12896
12897         PR 7091
12898         * output.cc (Output_section::find_starting_output_address): Rename
12899         from starting_output_address; add PADDR parameter; change return
12900         type.
12901         * output.h (class Output_section): Declare
12902         find_starting_output_address instead of starting_output_address.
12903         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12904         section symbol for which we can't find a merge section.
12905
12906         PR 9836
12907         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12908         hidden or internal, force the symbol to be local.
12909         * resolve.cc (Symbol::override_visibility): Define.
12910         (Symbol::override_base): Use override_visibility.
12911         (Symbol_table::resolve): Likewise.
12912         (Symbol::override_base_with_special): Likewise.
12913         (Symbol_table::override_with_special): If the visibility is hidden
12914         or internal, force the symbol to be local.
12915         * symtab.h (class Symbol): Add set_visibility and
12916         override_visibility.
12917         * testsuite/ver_test_1.sh: New file.
12918         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12919         (check_DATA): Add ver_test_1.syms.
12920         (ver_test_1.syms): New target.
12921         * testsuite/Makefile.in: Rebuild.
12922
12923 2009-02-25  Cary Coutant  <ccoutant@google.com>
12924
12925         * layout.cc (Layout::choose_output_section): Don't rename sections
12926         when using a linker script that has a SECTIONS clause.
12927         * Makefile.in: Regenerate.
12928
12929         * testsuite/Makefile.am (script_test_5.sh): New test case.
12930         * testsuite/Makefile.in: Regenerate.
12931         * testsuite/script_test_5.cc: New file.
12932         * testsuite/script_test_5.sh: New file.
12933         * testsuite/script_test_5.t: New file.
12934
12935 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12936
12937         * archive.cc (Archive::include_member): Update calls to add_symbols.
12938         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12939         the Layout argument.
12940         * dynobj.h (do_add_symbols): Add the Layout argument.
12941         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12942         Layout argument.
12943         * object.h (Object::add_symbols): Add the Layout argument.
12944         (Object::do_add_symbols): Add the Layout argument.
12945         (Sized_relobj::do_add_symbols): Add the Layout argument.
12946         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12947         Unify the two versions.
12948         (Add_plugin_symbols): Remove.
12949         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12950         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12951         (Add_plugin_symbols): Remove.
12952         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12953         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12954         (Add_symbols::run): Make it work with Pulginobj.
12955
12956 2009-02-06  Ian Lance Taylor  <iant@google.com>
12957
12958         * object.cc (Sized_relobj::do_layout): Make info message start
12959         with lower case letter.
12960
12961 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12962
12963         * binary.cc: Fix file comment.
12964
12965         * options.h (enum Incremental_disposition): Define.
12966         (class General_options): Add new options: --incremental,
12967         --incremental_changed, --incremental_unchanged,
12968         --incremental_unknown.  Add incremental_disposition_ and
12969         implicit_incremental_ fields.
12970         (General_options::incremental_disposition): New function.
12971         (class Position_dependent_options): Add incremental_disposition
12972         option.
12973         (Position_dependent_options::copy_from_options): Set incremental
12974         dispositions.
12975         * options.cc (General_options::parse_incremental_changed): New
12976         function.
12977         (General_options::parse_incremental_unchanged): New function.
12978         (General_options::parse_incremental_unknown): New function.
12979         (General_options::General_options): Initialize new fields
12980         incremental_disposition_ and implicit_incremental_.
12981         (General_options::finalize): Check for uasge of --incremental-*
12982         without --incremental.
12983
12984 2009-02-06  Chris Demetriou  <cgd@google.com>
12985
12986         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12987         pointer and to report location as the file name associated with
12988         the symbol.
12989         (gold_undefined_symbol_at_location): New function to replace the
12990         old gold_undefined_symbol functionality.
12991         * target-reloc.h (relocate_section): Update to use
12992         gold_undefined_symbol_at_location.
12993         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12994         Call gold_undefined_symbol function rather than gold_error.
12995         * errors.h (Errors::undefined_symbol): Take location as a
12996         string, rather than calculating it from a relocation.
12997         * errors.cc (Errors::fatal): Print "fatal error:" before the
12998         formatted message.
12999         (Errors::error, Errors::error_at_location): Print "error: "
13000         before the formatted message.
13001         (Errors::undefined_symbol): Take location as a string, rather
13002         than calculating it from a relocation.
13003         (gold_undefined_symbol_at_location): New function akin to
13004         old gold_undefined_symbol, calculates location from relocation.
13005         (gold_undefined_symbol): Change to take only a Symbol pointer
13006         and to report location as the file name associated with the symbol.
13007         * testsuite/debug_msg.sh: Update for changed error messages.
13008         * testsuite/undef_symbol.sh: Likewise.
13009
13010 2009-02-04  Duncan Sands  <baldrick@free.fr>
13011
13012         PR 9812
13013         * reduced_debug_output.h
13014         (Output_reduced_debug_abbrev_section::failed): Use format for
13015         gold_warning.
13016         (Output_reduced_debug_info_section::faild): Likewise.
13017
13018 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13019
13020         * script.cc (Lazy_demangler): New class.
13021         (Version_script_info::get_symbol_version_helper): Demangle a
13022         symbol only once.
13023
13024 2009-01-29  Cary Coutant  <ccoutant@google.com>
13025
13026         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13027         to __tls_get_addr.
13028         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13029
13030 2009-01-28  Ian Lance Taylor  <iant@google.com>
13031
13032         * version.cc (version_string): Bump to 1.9.
13033
13034         * gold.h: Include <cstring> and <stdint.h>.
13035         * version.cc: Include <cstdio>.
13036         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13037         warning.
13038         * reduced_debug_output.cc (insert_into_vector): Rename from
13039         Insert_into_vector; change all callers.  Use Swap_unaligned to
13040         avoid aliasing issue; remove union since it is unnecessary.
13041
13042 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13043
13044         * Makefile.am (CCFILES): Add gc.cc.
13045         (HFILES): Add gc.h.
13046         * Makefile.in: Regenerate.
13047         * gold.cc (Gc_runner): New class.
13048         (queue_initial_tasks): Call garbage collection related tasks
13049         when corresponding options are invoked.
13050         (queue_middle_gc_tasks): New function.
13051         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13052         processed early before laying out sections during garbage collection.
13053         * gold.h (queue_middle_gc_tasks): New function.
13054         (is_prefix_of): Move from "layout.cc".
13055         * i386.cc (Target_i386::gc_process_relocs): New function.
13056         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13057         * main.cc (main): Create object of class "Garbage_collection".
13058         * object.cc (Relobj::copy_symbols_data): New function.
13059         (Relobj::is_section_name_included): New function.
13060         (Sized_relobj::do_layout): Allow this function to be called twice
13061         during garbage collection and defer layout of section during the
13062         first call.
13063         * object.h (Relobj::get_symbols_data): New function.
13064         (Relobj::is_section_name_included): New function.
13065         (Relobj::copy_symbols_data): New function.
13066         (Relobj::set_symbols_data): New function.
13067         (Relobj::get_relocs_data): New function.
13068         (Relobj::set_relocs_data): New function.
13069         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13070         (Relobj::gc_process_relocs): New function.
13071         (Relobj::do_gc_process_relocs): New pure virtual function.
13072         (Relobj::sd_): New data member.
13073         (Sized_relobj::is_output_section_offset_invalid): New function.
13074         (Sized_relobj::do_gc_process_relocs): New function.
13075         * options.h (General_options::gc_sections): Modify to not be a no-op.
13076         (General_options::print_gc_sections): New option.
13077         * plugin.cc (Plugin_finish::run): Remove function call to
13078         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13079         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13080         * reloc.cc (Read_relocs::run): Add task to process relocs and
13081         determine unreferenced sections when doing garbage collection.
13082         (Gc_process_relocs): New class.
13083         (Sized_relobj::do_gc_process_relocs): New function.
13084         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13085         sections that are garbage collected.
13086         * reloc.h (Gc_process_relocs): New class.
13087         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13088         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13089         symbols whose corresponding sections are garbage collected.
13090         (Symbol_table::Symbol_table): Add new parameter for the garbage
13091         collection object.
13092         (Symbol_table::gc_mark_undef_symbols): New function.
13093         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13094         (Symbol_table::gc_mark_dyn_syms): New function.
13095         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13096         as garbage.
13097         (Symbol_table::add_from_object): Likewise.
13098         (Symbol_table::add_from_relobj): When building shared objects, do not
13099         treat externally visible symbols as garbage.
13100         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13101         table information for static and relocatable links.
13102         * symtab.h (Symbol_table::set_gc): New function.
13103         (Symbol_table::gc): New function.
13104         (Symbol_table::gc_mark_undef_symbols): New function.
13105         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13106         (Symbol_table::gc_mark_dyn_syms): New function.
13107         (Symbol_table::gc_): New data member.
13108         * target.h (Sized_target::gc_process_relocs): New pure virtual
13109         function.
13110         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13111         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13112
13113 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13114
13115         * options.h (General_options::gc_sections): Define as a no-op for now.
13116         (General_options::no_keep_memory): Ditto.
13117         (General_options::Bshareable): Define.
13118         * options.cc (General_options::finalize): Honor -Bshareable.
13119
13120 2009-01-20  Andreas Schwab  <schwab@suse.de>
13121
13122         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13123         read the value in the contents, since we don't use it.  Use the
13124         template endianness when writing.
13125         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13126
13127 2009-01-19  Andreas Schwab  <schwab@suse.de>
13128
13129         * configure.tgt (powerpc64-*): Fix targ_obj.
13130
13131 2009-01-15  Ian Lance Taylor  <iant@google.com>
13132
13133         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13134         local symbols when stripping all symbols.
13135
13136 2009-01-14  Cary Coutant  <ccoutant@google.com>
13137
13138         * output.cc (Output_reloc): Add explicit instantiations.
13139
13140 2009-01-14  Cary Coutant  <ccoutant@google.com>
13141
13142         * archive.cc (Archive::get_elf_object_for_member): Remove call
13143         to File_read::claim_for_plugin.
13144         * descriptors.cc (Descriptors::open): Remove reference to
13145         is_claimed.
13146         (Descriptors::claim_for_plugin): Remove.
13147         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13148         (Descriptors::is_claimed): Remove.
13149         (claim_descriptor_for_plugin): Remove.
13150         * fileread.cc (File_read::claim_for_plugin): Remove.
13151         * fileread.h (File_read::claim_for_plugin): Remove.
13152         (File_read::descriptor): Reopen descriptor if necessary.
13153         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13154         (Plugin_manager::all_symbols_read): Add task parameter. Change
13155         all callers.
13156         (Plugin_manager::get_input_file): New function.
13157         (Plugin_manager::release_input_file): New function.
13158         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13159         corresponding data member.
13160         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13161         and pass to base constructor. Change all callers.
13162         (get_input_file, release_input_file): New functions.
13163         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13164         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13165         (Plugin_manager::all_symbols_read): Add task parameter.
13166         (Plugin_manager::get_input_file): New function.
13167         (Plugin_manager::release_input_file): New function.
13168         (Plugin_manager::task_): New data member.
13169         (Pluginobj::Pluginobj): Add filesize parameter.
13170         (Pluginobj::filename): New function.
13171         (Pluginobj::descriptor): New function.
13172         (Pluginobj::filesize): New function.
13173         (Pluginobj::filesize_): New data member.
13174         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13175         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13176         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13177
13178         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13179         with archive libraries.
13180         * testsuite/Makefile.in: Regenerate.
13181         * testsuite/plugin_test.c (struct sym_info): New type.
13182         (get_input_file, release_input_file): New static variables.
13183         (onload): Capture new transfer vector entries.
13184         (claim_file_hook): Stop reading at end of file according to filesize.
13185         Factor out parsing of readelf output into separate function.
13186         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13187         APIs and get the source file name from the symbol table.  Convert
13188         source file name to corresponding object file name.  Print info
13189         message when adding new input files.
13190         (parse_readelf_line): New function.
13191         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13192         * testsuite/plugin_test_2.sh: Likewise.
13193         * testsuite/plugin_test_3.sh: Likewise.
13194         * testsuite/plugin_test_4.sh: New test case.
13195
13196 2009-01-07  Ian Lance Taylor  <iant@google.com>
13197
13198         * version.cc (version_string): Bump to 1.8.
13199
13200 2008-12-23  Cary Coutant  <ccoutant@google.com>
13201
13202         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13203         * plugin.cc (Plugin_manager::finish): Rename as
13204         layout_deferred_objects.  Move cleanup to separate function.
13205         (Plugin_manager::cleanup): New function.
13206         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13207         separately.
13208         * plugin.h (Plugin_manager::finish): Rename as
13209         layout_deferred_objects.
13210         (Plugin_manager::cleanup): New function.
13211         (Plugin_manager::cleanup_done): New field.
13212
13213 2008-12-23  Cary Coutant  <ccoutant@google.com>
13214
13215         * plugin.cc (is_visible_from_outside): New function.
13216         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13217         so we don't return "IR only" status for exported symbols or -r links.
13218
13219         * testsuite/Makefile.am (plugin_test_3): New test case.
13220         * testsuite/Makefile.in: Regenerate.
13221         * testsuite/plugin_test_3.sh: New file.
13222
13223 2008-12-22  Cary Coutant  <ccoutant@google.com>
13224
13225         * object.cc (Sized_relobj::layout_section): New function.
13226         (Sized_relobj::do_layout): Defer layout of input sections until after
13227         plugin has provided replacement files.
13228         (Sized_relobj::do_layout_deferred_sections): New function.
13229         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13230         (Relobj::layout_deferred_sections): New function.
13231         (Relobj::do_layout_deferred_sections): New function.
13232         (Sized_relobj::do_layout_deferred_sections): New function.
13233         (Sized_relobj::layout_section): New function.
13234         (Sized_relobj::Deferred_layout): New structure.
13235         (Sized_relobj::deferred_layout_): New field.
13236         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13237         Change all callers.  Layout deferred sections.
13238         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13239         references.
13240         (Plugin_hook::run): Move code from do_plugin_hook inline.
13241         (Plugin_hook::do_plugin_hook): Remove.
13242         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13243         (Plugin_manager::finish): Renamed, was cleanup.
13244         (Plugin_manager::should_defer_layout): New function.
13245         (Plugin_manager::add_deferred_layout_object): New function.
13246         (Plugin_manager::Deferred_layout_list): New type.
13247         (Plugin_manager::deferred_layout_objects_): New field.
13248         (Plugin_hook::do_plugin_hook): Remove.
13249
13250 2008-12-17  Ian Lance Taylor  <iant@google.com>
13251
13252         * options.h (class General_options): Add --no case for
13253         --export-dynamic.
13254
13255 2008-12-16  Cary Coutant  <ccoutant@google.com>
13256
13257         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13258         vector.
13259         (Plugin_manager::claim_file): Create plugin object even if
13260         plugin did not call the add_symbols callback.
13261         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13262         asking for more symbols than were added.
13263         * testsuite/Makefile.am (plugin_test_1): Add test case with
13264         no global symbols.
13265         (empty.syms): New target.
13266         * testsuite/Makefile.in: Regenerate.
13267         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13268         message. Don't call add_symbols if no globals.
13269         (all_symbols_read_hook): Don't provide replacement for empty
13270         claimed file.
13271
13272 2008-12-12  Ian Lance Taylor  <iant@google.com>
13273
13274         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13275         r_type == 0 for a local symbol with r_sym == 0.
13276         (scan_relocatable_relocs): Pass r_sym to
13277         local_non_section_strategy.
13278         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13279         r_sym parameter.
13280
13281         * configure.ac: Update test for TLS descriptors: they are
13282         supported as of glibc 2.9.
13283         * configure: Rebuild.
13284
13285 2008-12-11  Ian Lance Taylor  <iant@google.com>
13286
13287         PR 7091
13288         * target-reloc.h (Default_scan_relocatable_relocs): For each
13289         function, map r_type == 0 to RELOC_DISCARD.
13290
13291 2008-12-10  Cary Coutant  <ccoutant@google.com>
13292
13293         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13294         object to override a kept COMDAT group from a plugin object.
13295
13296 2008-12-09  Ian Lance Taylor  <iant@google.com>
13297
13298         PR 7088
13299         * yyscript.y (file_cmd): Handle INPUT.
13300
13301         * testsuite/initpri1.c: Change all declarations to be full
13302         prototypes by adding void, to avoid compiler warnings.
13303
13304 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13305
13306         * options.cc (General_options::parse_plugin_opt): New.
13307         (General_options::add_plugin): The argument now is just the filename.
13308         (General_options::add_plugin_option): New.
13309         * options.h (plugin_opt): New.
13310         (add_plugin): Change argument name.
13311         (add_plugin_option): New.
13312         * plugin.cc (Plugin::load): Don't parse the plugin option.
13313         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13314         (Plugin::add_option): New.
13315         (Plugin::args_): Change type.
13316         (Plugin::filename_): New.
13317         (Plugin_manager::add_plugin_option): New.
13318         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13319         * testsuite/Makefile.in: Regenerate.
13320
13321 2008-12-05  Cary Coutant  <ccoutant@google.com>
13322
13323         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13324         Handle --strip-lto-sections option.
13325         * options.h (strip_lto_sections): New option.
13326
13327 2008-12-01  Cary Coutant  <ccoutant@google.com>
13328
13329         * plugin.cc (ld_plugin_message): Change format parameter to const.
13330         Fix mismatch between new[] and delete.
13331
13332 2008-11-14  Cary Coutant  <ccoutant@google.com>
13333
13334         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13335         instead of -1U.
13336
13337 2008-11-05  Craig Silverstein  <csilvers@google.com>
13338
13339         * options.cc (General_options::parse_dynamic_list): New function.
13340         * options.h (General_options): New flags dynamic_list,
13341         dynamic_list_data, dynamic_list_cpp_new, and
13342         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13343         (General_options::in_dynamic_list): New function.
13344         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13345         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13346         (Lex::can_continue_name): Likewise.
13347         (yylex): Likewise.
13348         (read_script_file): New parameter script_options.
13349         (read_dynamic_list): New function.
13350         (Script_options::define_dynamic_list): New function.
13351         (dynamic_list_keyword_parsecodes): New variable.
13352         (dynamic_list_keywords): New variable.
13353         * script.h (Script_options::define_dynamic_list): New function
13354         prototype.
13355         (read_dynamic_list): New function prototype.
13356         * symtab.cc (strprefix): New macro.
13357         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13358         dynamic_list_data, dynamic_list_cpp_new, and
13359         dynamic_list_cpp_typeinfo.
13360         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13361         (dynamic_list_expr): New rule.
13362         (dynamic_list_nodes): Likewise.
13363         (dynamic_list_node): Likewise.
13364         * testsuite/Makefile.am (dynamic_list): New test.
13365         * testsuite/Makefile.in: Regenerated.
13366         * testsuite/dynamic_list.t: New file.
13367         * testsuite/dynamic_list.sh: New file.
13368
13369 2008-11-05  Craig Silverstein  <csilvers@google.com>
13370
13371         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13372         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13373         (t11_last): Likewise.
13374         * testsuite/ver_test_6.c (main): Likewise.
13375
13376 2008-10-07  Cary Coutant  <ccoutant@google.com>
13377
13378         * options.c (General_options::finalize): Add check for -static and
13379         -shared.
13380         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13381         is not empty.
13382
13383 2008-10-02  Cary Coutant  <ccoutant@google.com>
13384
13385         * plugin.cc (make_sized_plugin_object): Fix conditional
13386         compilation to work when not all targets are enabled.
13387
13388 2008-09-29  Cary Coutant  <ccoutant@google.com>
13389
13390         * archive.cc (Archive::get_file_and_offset): Use filename instead
13391         of name to get library path.
13392         (Archive::include_member): Unlock external member of a thin archive.
13393
13394         * testsuite/Makefile.am (TEST_AR): New variable.
13395         (thin_archive_test_1): New test.
13396         (thin_archive_test_2): New test.
13397         * testsuite/Makefile.in: Regenerate.
13398         * testsuite/thin_archive_main.cc: New file.
13399         * testsuite/thin_archive_test_1.cc: New file.
13400         * testsuite/thin_archive_test_2.cc: New file.
13401         * testsuite/thin_archive_test_3.cc: New file.
13402         * testsuite/thin_archive_test_4.cc: New file.
13403
13404 2008-09-29  Cary Coutant  <ccoutant@google.com>
13405
13406         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13407         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13408         instead of -1U.
13409         (Sized_relobj::do_finalize_local_symbols): Likewise.
13410         (Sized_relobj::map_to_kept_section): Likewise.
13411         * object.h (Sized_relobj::invalid_address): New constant.
13412         (Sized_relobj::do_output_section_offset): Check for invalid_address
13413         and return -1ULL.
13414         * output.cc (Output_reloc::local_section_offset): Use constant
13415         invalid_address instead of -1U.
13416         (Output_reloc::get_address): Likewise.
13417         (Output_section::output_address): Change -1U to -1ULL.
13418         * output.h (Output_reloc::invalid_address): New constant.
13419         * reloc.cc (Sized_relobj::write_sections): Use constant
13420         invalid_address instead of -1U.
13421         (Sized_relobj::relocate_sections): Likewise.
13422         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13423         values for merge sections.
13424         * target-reloc.h (relocate_for_relocatable): Use constant
13425         invalid_address instead of -1U.
13426
13427 2008-09-19  Cary Coutant  <ccoutant@google.com>
13428
13429         Add plugin functionality for link-time optimization (LTO).
13430         * configure.ac (plugins): Add --enable-plugins option.
13431         * configure: Regenerate.
13432         * config.in: Regenerate.
13433         * Makefile.am (LIBDL): New variable.
13434         (CCFILES): Add plugin.cc.
13435         (HFILES): Add plugin.h.
13436         (ldadd_var): Add LIBDL.
13437         * Makefile.in: Regenerate.
13438
13439         * archive.cc: Include "plugin.h".
13440         (Archive::setup): Don't preread archive symbols when using a plugin.
13441         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13442         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13443         files.
13444         (Archive::include_member): Add symbols from plugin objects.
13445         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13446         * descriptors.cc (Descriptors::open): Check for file descriptors
13447         abandoned by plugins.
13448         (Descriptors::claim_for_plugin): New function.
13449         * descriptors.h (Descriptors::claim_for_plugin): New function.
13450         (Open_descriptor::is_claimed): New field.
13451         (claim_descriptor_for_plugin): New function.
13452         * fileread.cc (File_read::claim_for_plugin): New function.
13453         * fileread.h (File_read::claim_for_plugin): New function.
13454         (File_read::descriptor): New function.
13455         * gold.cc: Include "plugin.h".
13456         (queue_initial_tasks): Add task to call plugin hooks for generating
13457         new object files.
13458         * main.cc: Include "plugin.h".
13459         (main): Load plugin libraries.
13460         * object.h (Pluginobj): Declare.
13461         (Object::pluginobj): New function.
13462         (Object::do_pluginobj): New function.
13463         (Object::set_target): New function.
13464         * options.cc: Include "plugin.h".
13465         (General_options::parse_plugin): New function.
13466         (General_options::General_options): Initialize plugins_ field.
13467         (General_options::add_plugin): New function.
13468         * options.h (Plugin_manager): Declare.
13469         (General_options): Add --plugin option.
13470         (General_options::has_plugins): New function.
13471         (General_options::plugins): New function.
13472         (General_options::add_plugin): New function.
13473         (General_options::plugins_): New field.
13474         * plugin.cc: New file.
13475         * plugin.h: New file.
13476         * readsyms.cc: Include "plugin.h".
13477         (Read_symbols::do_read_symbols): Check for archive before checking
13478         for ELF file.  Call plugin hooks to claim files.
13479         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13480         from a real object file; force override when processing replacement
13481         files.
13482         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13483         (Symbol::init_base_object): Likewise.
13484         (Symbol::init_base_output_data): Likewise.
13485         (Symbol::init_base_output_segment): Likewise.
13486         (Symbol::init_base_constant): Likewise.
13487         (Symbol::init_base_undefined): Likewise.
13488         (Symbol::output_section): Assert that object is not a plugin.
13489         (Symbol_table::add_from_pluginobj): New function.
13490         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13491         undefined.
13492         (Symbol_table::sized_write_globals): Likewise.
13493         (Symbol_table::add_from_pluginobj): Instantiate template.
13494         * symtab.h (Sized_pluginobj): Declare.
13495         (Symbol::in_real_elf): New function.
13496         (Symbol::set_in_real_elf): New function.
13497         (Symbol::in_real_elf_): New field.
13498         (Symbol_table::add_from_pluginobj): New function.
13499
13500         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13501         (LIBDL): New variable.
13502         (LDADD): Add LIBDL.
13503         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13504         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13505         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13506         (MOSTLYCLEANFILES): Likewise.
13507         * testsuite/Makefile.in: Regenerate.
13508         * testsuite/plugin_test.c: New file.
13509         * testsuite/plugin_test_1.sh: New file.
13510         * testsuite/plugin_test_2.sh: New file.
13511
13512 2008-09-16  Ian Lance Taylor  <iant@google.com>
13513
13514         * target-reloc.h (relocate_section): Check whether a symbol is
13515         defined by the ABI before reporting an undefined symbol error.
13516         * target.h (Target::is_defined_by_abi): Make parameter const.
13517         (Target::do_is_defined_by_abi): Likewise.
13518         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13519         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13520         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13521         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13522         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13523         * testsuite/Makefile.in: Rebuild.
13524
13525         * fileread.cc (make_view): Add casts to avoid warning.
13526
13527 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13528
13529         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13530         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13531
13532 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13533
13534         * options.h (General_options::output_is_executable): New.
13535         (General_options::output_is_pie): New.
13536         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13537         for shared libraries.
13538         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13539
13540 2008-09-11  Chris Demetriou  <cgd@google.com>
13541
13542         * options.h (origin): New -z option.
13543         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13544         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13545         in DT_FLAGS_1.
13546
13547 2008-09-05  Cary Coutant  <ccoutant@google.com>
13548
13549         * fileread.cc (File_read::make_view): Add check for attempt to map
13550         beyond end of file.
13551
13552 2008-09-05  Cary Coutant  <ccoutant@google.com>
13553
13554         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13555         explicit instantiations.
13556
13557 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13558
13559         PR gold/6858
13560         * options.cc (General_options::finalize): Allow undefined symbols
13561         in shlibs if linking -shared.
13562
13563         PR gold/6859
13564         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13565         symbols as not needing a dynsym entry.
13566
13567 2008-08-20  Craig Silverstein  <csilvers@google.com>
13568
13569         * fileread.cc (File_read::open): Do not lock the file unless it
13570         was successfully opened.
13571
13572 2008-08-14  Cary Coutant  <ccoutant@google.com>
13573
13574         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13575         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13576         * testsuite/tls_test.cc (struct int128): 128-bit struct
13577         for testing TLS relocs with non-zero addend.
13578         (v12): New TLS variable.
13579         (t12): New test.
13580         (t_last): Add check for v12.
13581         * testsuite/tls_test.h (t12): New function.
13582         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13583
13584 2008-08-13  Ian Lance Taylor  <iant@google.com>
13585
13586         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13587         set tls_segment_ or relro_segment_.
13588         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13589         when appropriate.
13590         * output.h (Output_section::clear_is_relro): New function.
13591         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13592         sections specially even when output_data_ is empty.
13593         (Output_segment::maximum_alignment): When first section is relro,
13594         only force alignment for PT_LOAD segments.
13595         * script.cc (script_data_segment_align): New function.
13596         (script_data_segment_relro_end): New function.
13597         * script-c.h (script_data_segment_align): Declare.
13598         (script_data_segment_relro_end): Declare.
13599         * script-sections.h (class Script_sections): Declare
13600         data_segment_align and data_segment_relro_end.  Add fields
13601         segment_align_index_ and saw_relro_end_.
13602         * script-sections.cc (class Sections_element): Add set_is_relro
13603         virtual function.  Add new bool* parameter to place_orphan_here.
13604         Add get_output_section virtual function.
13605         (class Output_section_definition): Add set_is_relro.  Add new
13606         bool* parameter to place_orphan_here.  Add get_output_section.
13607         Add is_relro_ field.
13608         (Output_section_definition::Output_section_definition): Initialize
13609         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13610         and is_relro_ fields.
13611         (Output_section_definition::place_orphan_here): Add is_relro
13612         parameter.
13613         (Output_section_definition::set_section_addresses): Set relro for
13614         output section.
13615         (Output_section_definition::alternate_constraint): Likewise.
13616         (class Orphan_output_section): Add new bool* parameter to
13617         place_orphan_here.  Add get_output_section.
13618         (Orphan_output_section::place_orphan_here): Add is_relro
13619         parameter.
13620         (Script_sections::Script_sections): Initialize
13621         data_segment_align_index_ and saw_relro_end_.
13622         (Script_sections::data_segment_align): New function.
13623         (Script_sections::data_segment_relro_end): New function.
13624         (Script_sections::place_orphan): Set or clear is_relro.
13625         (Script_sections::set_section_addresses): Force alignment of first
13626         TLS section.
13627         * yyscript.y (exp): Call script_data_segment_align and
13628         script_data_segment_relro_end.
13629         * testsuite/relro_script_test.t: New file.
13630         * testsuite/relro_test.cc (using_script): Declare.
13631         (t1, t2): Test using_script.
13632         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13633         (relro_script_test_SOURCES): Define.
13634         (relro_script_test_DEPENDENCIES): Define.
13635         (relro_script_test_LDFLAGS): Define.
13636         (relro_script_test_LDADD): Define.
13637         (relro_script_test.so): New target.
13638         * testsuite/Makefile.in: Rebuild.
13639
13640 2008-08-06  Cary Coutant <ccoutant@google.com>
13641
13642         * archive.cc (Archive::total_archives, Archive::total_members)
13643         (Archive::total_members_loaded): New variables.
13644         (Archive::setup): Add parameter.  Add option to preread
13645         archive symbols.
13646         (Archive::read_armap): Add counter.
13647         (Archive::get_file_and_offset): New function.
13648         (Archive::get_elf_object_for_member): New function.
13649         (Archive::read_all_symbols): New function.
13650         (Archive::read_symbols): New function.
13651         (Archive::add_symbols): Add counters.
13652         (Archive::include_all_members): Use armap to find members if it's
13653         already built.
13654         (Archive::include_member): Skip reading symbols if already read.
13655         Factored code into Archive::get_file_and_offset and
13656         Archive::get_elf_object_for_member.  Changed call to
13657         Mapfile::report_include_archive_member.
13658         (Archive::print_stats): New function.
13659         * archive.h: Declare Object and Read_symbols_data classes.
13660         (Archive::Archive): Add initializers for new members.
13661         (Archive::setup): Add parameter.
13662         (Archive::print_stats): New function.
13663         (Archive::total_archives, Archive::total_members)
13664         (Archive::total_members_loaded): New variables.
13665         (Archive::get_file_and_offset): New function.
13666         (Archive::get_elf_object_for_member): New function.
13667         (Archive::read_all_symbols): New function.
13668         (Archive::read_symbols): New function.
13669         (Archive::Archive_member): New class.
13670         (Archive::members_): New member.
13671         (Archive::num_members_): New member.
13672         * main.cc: Include archive.h.
13673         (main): Call Archive::print_stats.
13674         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13675         archive parameter; member_name is now the fully-decorated name.
13676         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13677         * options.h: (General_options): Add --preread-archive-symbols option.
13678         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13679         Archive::setup.
13680
13681 2008-08-04  Ian Lance Taylor  <iant@google.com>
13682
13683         * symtab.h (Symbol::use_plt_offset): New function.
13684         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13685         * powerpc.cc (Relocate::relocate): Likewise.
13686         * sparc.cc (Relocate::relocate): Likewise.
13687         * x86_64.cc (Relocate::relocate): Likewise.
13688         * testsuite/weak_plt.sh: New test.
13689         * testsuite/weak_plt_main.cc: New test.
13690         * testsuite/weak_plt_shared.cc: New test.
13691         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13692         (check_PROGRAMS): Add weak_plt.
13693         (check_DATA): Add weak_plt_shared.so.
13694         (weak_plt_main_pic.o, weak_plt): New targets.
13695         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13696         * testsuite/Makefile.in: Rebuild.
13697
13698         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13699         gcctestdir/ld.
13700         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13701         * testsuite/Makefile.in: Rebuild.
13702
13703 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13704
13705         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13706         * Makefile.in: Regenerate.
13707         * po/POTFILES.in: Regenerate.
13708
13709 2008-07-29  Ian Lance Taylor  <iant@google.com>
13710
13711         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13712         symbols before other symbols.
13713         * testsuite/script_test_2.cc (test_addr): Declare.
13714         (test_addr_alias): Declare.
13715         (main): Check that test_addr and test_addr_alias have the right
13716         values.
13717         * testsuite/script_test_2.t: Define test_addr_alias and
13718         test_addr.
13719
13720 2008-07-24  Ian Lance Taylor  <iant@google.com>
13721
13722         PR 5990
13723         * descriptors.cc: New file.
13724         * descriptors.h: New file.
13725         * gold-threads.h (class Hold_optional_lock): New class.
13726         * fileread.cc: Include "descriptors.h".
13727         (File_read::~File_read): Release descriptor rather than closing
13728         it.
13729         (File_read::open) [file]: Call open_descriptor rather than open.
13730         Set is_descriptor_opened_.
13731         (File_read::open) [memory]: Assert that descriptor is not open.
13732         (File_read::reopen_descriptor): New function.
13733         (File_read::release): Release descriptor.
13734         (File_read::do_read): Make non-const.  Reopen descriptor.
13735         (File_read::read): Make non-const.
13736         (File_read::make_view): Reopen descriptor.
13737         (File_read::do_readv): Likewise.
13738         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13739         Update declarations.
13740         * layout.cc: Include "descriptors.h".
13741         (Layout::create_build_id): Use open_descriptor rather than open.
13742         * output.cc: Include "descriptors.h".
13743         (Output_file::open): Use open_descriptor rather than open.
13744         * archive.cc (Archive::const_iterator): Change Archive to be
13745         non-const.
13746         (Archive::begin, Archive::end): Make non-const.
13747         (Archive::count_members): Likewise.
13748         * archive.h (class Archive): Update declarations.
13749         * object.h (Object::read): Make non-const.
13750         * Makefile.am (CCFILES): Add descriptors.cc.
13751         (HFILES): Add descriptors.h.
13752         * Makefile.in: Rebuild.
13753
13754         PR 6716
13755         * gold.h: Always include <clocale>.  Add Solaris workarounds
13756         following code in binutils/sysdep.h.
13757
13758         PR 6048
13759         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13760         this->eh_frame_hdr_ is NULL before using it.
13761
13762         * dynobj.cc (Versions::Versions): Update comment.
13763
13764         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13765         the base version name.
13766
13767         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13768         array size plus one.
13769         (Stringpool_template::set_string_offsets): Subtract one from key
13770         before using it as an array index.
13771         (Stringpool_template::get_offset_with_length): Likewise.
13772         (Stringpool_template::write_to_buffer): Likewise.
13773         * stringpool.h (Stringpool_template::get_offset_from_key):
13774         Likewise.
13775
13776 2008-07-23  Ian Lance Taylor  <iant@google.com>
13777
13778         PR 6658
13779         * object.h (Merged_symbol_value::value): Do our best to handle a
13780         negative addend.
13781
13782         PR 6647
13783         * script.cc (Version_script_info::get_versions): Don't add empty
13784         version tag to return value.
13785         (Version_script_info::get_symbol_version_helper): Change return
13786         type to bool.  Add pversion parameter.  Change all callers.
13787         (script_register_vers_node): Don't require a non-NULL tag.
13788         * script.h (class Version_script_info): Update declarations.
13789         (Version_script_info::get_symbol_version): Change return type to
13790         bool.  Add version parameter.  Change all callers.
13791         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13792         handling.  Handle an empty version from a version script.
13793         (Symbol_table::define_special_symbol): Likewise.
13794         * testsuite/ver_test_10.script: New file.
13795         * testsuite/ver_test_10.sh: New file.
13796         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13797         (check_DATA): Add ver_test_10.syms.
13798         (ver_test_10.syms, ver_test_10.so): New target.
13799         * testsuite/Makefile.in: Rebuild.
13800
13801 2008-07-23  Simon Baldwin  <simonb@google.com>
13802
13803         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13804         to zero for undefined symbols from dynamic libraries.
13805
13806 2008-07-23  Ian Lance Taylor  <iant@google.com>
13807
13808         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13809         Change all callers.
13810         * symtab.h (class Symbol_table): Update declaration.
13811         * testsuite/ver_test_9.cc: New file.
13812         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13813         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13814         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13815         (ver_test_9.so, ver_test_9.o): New targets.
13816         * testsuite/Makefile.in: Rebuild.
13817
13818 2008-07-22  Ian Lance Taylor  <iant@google.com>
13819
13820         * options.h (class General_options): Define --check-sections.
13821         * layout.cc (Layout::set_segment_offsets): Handle
13822         --check-sections.
13823
13824         * options.h (class General_options): Define -n/--nmagic and
13825         -N/--omagic.
13826         * options.cc (General_options::finalize): For -n/--nmagic or
13827         -N/--omagic, set -static.
13828         * layout.cc (Layout::attach_allocated_section_to_segment): If
13829         -N/--omagic, don't put read-only and read-write sections in
13830         different segments.
13831         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13832         finding a read-only segment.
13833         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13834         don't set the minimum segment alignment to the common page size,
13835         and don't set the file offset to the address modulo the page size.
13836         * script-sections.cc (Script_sections::create_segments): If
13837         -n/--omagic, don't put read-only and read-write sections in
13838         different segments.
13839
13840         * cref.cc: New file.
13841         * cref.h: New file.
13842         * options.h (class General_options): Add --print-symbol-counts.
13843         * main.cc (main): Issue defined symbol report if requested.
13844         * archive.cc (Archive::interpret_header): Make into a const member
13845         function.
13846         (Archive::add_symbols): Call Input_objects::archive_start and
13847         archive_stop.
13848         (Archive::const_iterator): Define new class.
13849         (Archive::begin, Archive::end): New functions.
13850         (Archive::include_all_members): Rewrite to use iterator.
13851         (Archive::count_members): New function.
13852         * archive.h (class Archive): Update declarations.
13853         (Archive::filename): New function.
13854         * object.cc: Include "cref.h".
13855         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13856         (Sized_relobj::do_get_global_symbol_counts): New function.
13857         (Input_objects::add_object): Add object to cross-referencer.
13858         (Input_objects::archive_start): New function.
13859         (Input_objects::archive_stop): New function.
13860         (Input_objects::print_symbol_counts): New function.
13861         * object.h: Declare Cref and Archive.
13862         (Object::get_global_symbol_counts): New function.
13863         (Object::do_get_global_symbol_counts): New pure virtual function.
13864         (class Sized_relobj): Add defined_count_ field.  Update
13865         declarations.
13866         (class Input_objects): Add cref_ field.  Update constructor.
13867         Update declarations.
13868         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13869         defined_count_.
13870         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13871         symbol counts.
13872         (Sized_dynobj::do_get_global_symbol_counts): New function.
13873         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13874         defined_count_.  Update declarations.  Define Symbols typedef.
13875         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13876         parameter.  Change all callers.
13877         (Symbol_table::add_from_dynobj): Add sympointers and defined
13878         parameters.  Change all callers.
13879         * symtab.h (class Symbol_table): Update declarations.
13880         * Makefile.am (CCFILES): Add cref.cc.
13881         (HFILES): Add cref.h.
13882         * Makefile.in: Rebuild.
13883
13884 2008-07-22  Simon Baldwin  <simonb@google.com>
13885
13886         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13887         to zero when writing undefined symbols.
13888
13889 2008-07-22  Ian Lance Taylor  <iant@google.com>
13890
13891         * output.cc (Output_section::add_input_section): Don't try to
13892         merge empty merge sections.
13893
13894 2008-07-21  Craig Silverstein  <csilvers@google.com>
13895
13896         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13897         Include symbol version in error message.
13898
13899 2008-07-20  Chris Demetriou  <cgd@google.com>
13900
13901         * configure.ac (gold_cv_c_random_seed): New configured variable.
13902         (RANDOM_SEED_CFLAGS): New substituted variable.
13903         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13904         * configure: Rebuild.
13905         * Makefile.in: Likewise.
13906         * testsuite/Makefile.in: Likewise.
13907
13908 2008-07-18  Ian Lance Taylor  <iant@google.com>
13909
13910         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13911         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13912         * testsuite/ver_test_main.cc (main): Call t4.
13913         (t4, t4_2a): Define.
13914         * testsuite/ver_test_2.cc (t4_2): Define.
13915         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13916         * testsuite/ver_test_4.cc (t4_2a): Define.
13917         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13918         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13919
13920 2008-07-17  Ian Lance Taylor  <iant@google.com>
13921
13922         * dynobj.cc (Versions::add_def): If we give an error about a
13923         missing version, go ahead and create the version anyhow.
13924
13925 2008-07-10  Ian Lance Taylor  <iant@google.com>
13926
13927         Handle output sections with more than 0x7fffffff bytes.
13928         * object.h (class Relobj): Change map_to_output_ to
13929         output_sections_, and just keep a section pointer.  Change all
13930         uses.  Move comdat group support to Sized_relobj.
13931         (Relobj::is_section_specially_mapped): Remove.
13932         (Relobj::output_section): Remove poff parameter.  Change all
13933         callers.
13934         (Relobj::output_section_offset): New function.
13935         (Relobj::set_section_offset): Rewrite.
13936         (Relobj::map_to_output): Remove.
13937         (Relobj::output_sections): New function.
13938         (Relobj::do_output_section_offset): New pure virtual function.
13939         (Relobj::do_set_section_offset): Likewise.
13940         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13941         group support from Relobj.  Update declarations.
13942         (Sized_relobj::get_output_section_offset): New function.
13943         (Sized_relobj::do_output_section_offset): New function.
13944         (Sized_relobj::do_set_section_offset): New function.
13945         * object.cc (Relobj::output_section_address): Remove.
13946         (Sized_relobj::Sized_relobj): Initialize new fields.
13947         (Sized_relobj::include_section_group): Cast find_kept_object to
13948         Sized_relobj.
13949         (Sized_relobj::include_linkonce_section): Likewise.
13950         (Sized_relobj::do_layout): Use separate arrays for output section
13951         and output offset.
13952         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13953         output_sections.
13954         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13955         output_sections and section_offsets.
13956         (Sized_relobj::write_local_symbols): Likewise.
13957         (map_to_kept_section): Compute output address directly.
13958         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13959         output_sections and section_offsets.
13960         (Sized_relobj::write_sections): Likewise.
13961         (Sized_relobj::relocate_sections): Likewise.
13962         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13963         * output.h (class Output_reloc): Update declarations.  Change
13964         u2_.relobj to Sized_relobj*.
13965         (class Output_data_reloc): Change add functions to use
13966         Sized_relobj*.
13967         * output.cc (Output_reloc::Output_reloc): Change relobj to
13968         Sized_relobj*.
13969         (Output_reloc::local_section_offset): Change return type to
13970         Elf_Addr.  Use get_output_section_offset.
13971         (Output_reloc::get_address): Likewise.
13972         (Output_section::is_input_address_mapped): Don't call
13973         is_section_specially_mapped.
13974         (Output_section::output_offset): Likewise.
13975         (Output_section::output_address): Likewise.
13976         (Output_section::starting_output_address): Likewise.
13977         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13978         parameter to Sized_relobj*.
13979         (Copy_relocs::need_copy_reloc): Likewise.
13980         (Copy_relocs::save): Likewise.
13981         * copy-relocs.h (class Copy_relocs): Update declarations.
13982         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13983         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13984         * target-reloc.h (relocate_for_relocatable): Change
13985         offset_in_output_section type to Elf_Addr.  Change code that uses
13986         it as well.
13987         * layout.cc (Layout::layout): Always set *off.
13988         * mapfile.cc (Mapfile::print_input_section): Use
13989         output_section_offset.
13990         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13991         Sized_relobj*.
13992         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13993         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13994         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13995
13996 2008-07-03  Ian Lance Taylor  <iant@google.com>
13997
13998         * layout.cc (Layout::include_section): Do not discard unrecognized
13999         SHT_STRTAB sections.
14000
14001 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14002
14003         * script.cc (Lex::can_continue_name): Make '?' allowable in
14004         version-script names.
14005         * testsuite/version_script.map: Change glob pattern to use '?'
14006
14007 2008-06-30  Manish Singh  <yosh@gimp.org>
14008
14009         PR 6585
14010         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14011         Correct typo.
14012
14013 2008-06-30  Ian Lance Taylor  <iant@google.com>
14014
14015         PR 6660
14016         PR 6682
14017         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14018         versions]: Don't try to read the value in the contents, since we
14019         don't use it.  Use the template endianness when writing.
14020
14021 2008-06-25  Cary Coutant  <ccoutant@google.com>
14022
14023         * fileread.cc (File_read::make_view): Assert on zero-length view.
14024         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14025         symbol table when there are no symbols to read.
14026
14027 2008-06-23  Craig Silverstein  <csilvers@google.com>
14028
14029         * version.cc (version_string): Bump to 1.7
14030
14031 2008-06-18  Craig Silverstein  <csilvers@google.com>
14032
14033         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14034         constant 0xFFFF to type Valtype.
14035         (Powerpc_relocate_functions::rel16_ha): Likewise.
14036
14037 2008-06-17  Ian Lance Taylor  <iant@google.com>
14038
14039         * output.h (Output_section::Input_section): Initialize p2align_ to
14040         zero for Output_section_data constructors.
14041         (Output_section::Input_section::addralign): If not an input
14042         section, return the alignment of the Output_section_data.
14043         * testsuite/copy_test.cc: New file.
14044         * testsuite/copy_test_1.cc: New file.
14045         * testsuite/copy_test_2.cc: New file.
14046         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14047         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14048         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14049         (copy_test_1_pic.o, copy_test_1.so): New targets.
14050         (copy_test_2_pic.o, copy_test_2.so): New targets.
14051         * testsuite/Makefile.in: Rebuild.
14052
14053         * script-sections.cc (Script_sections::place_orphan): Initialize
14054         local variable exact.
14055
14056 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14057
14058         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14059
14060 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14061             David S. Miller  <davem@davemloft.net>
14062
14063         * powerpc.cc: New file.
14064         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14065         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14066         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14067         * Makefile.in: Rebuild.
14068
14069 2008-06-09  Ian Lance Taylor  <iant@google.com>
14070
14071         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14072         <exception>.
14073         (throwing, orig_terminate): New static variables.
14074         (terminate_handler): New static function.
14075         (t2): Set terminate handler.
14076
14077 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14078
14079         PR 6584
14080         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14081         alignment.
14082
14083 2008-05-30  Cary Coutant  <ccoutant@google.com>
14084
14085         * archive.cc (Archive::include_all_members) Correct to step
14086         over symbol table and extended name table in thin archives.
14087
14088 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14089
14090         PR 6407
14091         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14092         calculation.
14093
14094 2008-05-28  Caleb Howe  <cshowe@google.com>
14095
14096         * reduced_debug_output.cc: New file.
14097         * reduced_debug_output.h: New file.
14098         * options.h (class General_options): Add --strip-debug-non-line.
14099         * options.cc (General_options::finalize): Add strip_debug_non_line
14100         to the strip heirarchy.
14101         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14102         fields.
14103         * layout.cc: Include "reduced_debug_output.h".
14104         (Layout::Layout): Initialize new fields.
14105         (line_only_debug_sections): New static array.
14106         (is_lines_only_debug_sections): New static inline function.
14107         (Layout::include_section): Handle --strip-debug-non-line.
14108         (Layout::make_output_section): If --strip-debug-non-line, build
14109         new output sections for .debug_abbrev and .debug_info.
14110         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14111         gold.  Warn about possible overflow.
14112         (read_signed_LEB_128): Likewise.
14113         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14114         (read_signed_LEB_128): Declare.
14115         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14116         (HFILES): Add reduced_debug_output.h.
14117         * Makefile.in: Rebuild.
14118
14119 2008-05-21  Ian Lance Taylor  <iant@google.com>
14120
14121         * mapfile.cc: New file.
14122         * mapfile.h: New file.
14123         * options.h (class General_options): Add -M/--print-map and -Map.
14124         * options.cc (General_options::finalize): Make -M equivalent to
14125         -Map -.
14126         * main.cc: Include <cstdio> and "mapfile.h".
14127         (main): Open mapfile if requested.
14128         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14129         constructor.  Change caller.
14130         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14131         (queue_middle_tasks): Likewise.
14132         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14133         declarations.
14134         * archive.cc: Include "mapfile.h".
14135         (Archive::add_symbols): Add mapfile parameter.  Change all
14136         callers.  Pass mapfile, symbol, and reason to include_member.
14137         (Archive::include_all_members): Add mapfile parameter.  Change all
14138         callers.
14139         (Archive::include_member): Add mapfile, sym, and why parameters.
14140         Change all callers.  Report inclusion to map file.
14141         * archive.h: Include "fileread.h".
14142         (class Archive): Update declarations.
14143         (Archive::file): New const method.
14144         (class Add_archive_symbols): Add mapfile_ field.  Update
14145         constructor.  Change all callers.
14146         * readsyms.h (class Read_symbols): Likewise.
14147         (class Finish_group): Likewise.
14148         (class Read_script): Likewise.
14149         * common.cc: Include "mapfile.h".
14150         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14151         all callers.
14152         (Symbol_table::do_allocate_commons): Likewise.
14153         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14154         symbol allocation to mapfile.
14155         * common.h (class Allocate_commons_task): Add mapfile_ field.
14156         Update constructor.  Change all callers.
14157         * symtab.h (class Symbol_table): Update declarations.
14158         * layout.cc: Include "mapfile.h".
14159         (Layout_task_runner::run): Print information to mapfile.
14160         (Layout::create_gold_note): Change Output_data_fixed_space to
14161         Output_data_zero_fill.
14162         (Layout::create_build_id): Likewise.
14163         (Layout::print_to_mapfile): New function.
14164         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14165         constructor.  Change caller.
14166         (class Layout): Declare print_to_mapfile.
14167         * output.cc (Output_section::Input_section::print_to_mapfile): New
14168         function.
14169         (Output_section::add_input_section): If producing a map, always
14170         add to input_sections_ list.
14171         (Output_section::do_print_to_mapfile): New function.
14172         (Output_segment::print_sections_to_mapfile): New function.
14173         (Output_segment::print_section_list_to_mapfile): New function.
14174         * output.h: Include "mapfile.h".
14175         (Output_data::print_to_mapfile): New function.
14176         (Output_data::do_print_to_mapfile): New virtual function.
14177         (Output_segment_headers::do_print_to_mapfile): New function.
14178         (Output_file_header::do_print_to_mapfile): New function.
14179         (Output_data_const::do_print_to_mapfile): New function.
14180         (class Output_data_const_buffer): Add map_name_ field.  Update
14181         constructor.  Change all callers.  Add do_print_to_mapfile
14182         function.
14183         (class Output_data_fixed_space): Likewise.
14184         (class Output_data_space): Likewise.
14185         (class Output_data_zero_fill): New class.
14186         (Output_data_strtab::do_print_to_mapfile): New function.
14187         (Output_data_reloc_base::do_print_to_mapfile): New function.
14188         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14189         (Output_data_group::do_print_to_mapfile): New function.
14190         (Output_data_got::do_print_to_mapfile): New function.
14191         (Output_data_dynamic::do_print_to_mapfile): New function.
14192         (Output_symtab_xindex::do_print_to_mapfile): New function.
14193         (class Output_section): Declare do_print_to_mapflie.  Declare
14194         print_to_mapfile in Input_section.
14195         (class Output_segment): Declare new functions.
14196         * object.h (Sized_relobj::symbol_count): New function.
14197         * script-sections.cc
14198         (Output_section_element_dot_assignment::set_section_addresses):
14199         Change Output_data_fixed_space to Output_data_zero_fill.
14200         (Output_data_expression::do_print_to_mapfile): New function.
14201         * script.cc (read_input_script): Add mapfile parameter.  Change
14202         all callers.
14203         * script.h (read_input_script): Update declaration.
14204         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14205         (Eh_frame::do_print_to_mapfile): New function.
14206         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14207         (Output_merge_string::do_print_to_mapfile): New function.
14208         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14209         function.
14210         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14211         function.
14212         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14213         function.
14214         * Makefile.am (CCFILES): Add mapfile.cc.
14215         (HFILES): Add mapfile.h.
14216         * Makefile.in: Rebuild.
14217
14218 2008-05-19  Ian Lance Taylor  <iant@google.com>
14219
14220         * options.h (class General_options): Add -z relro.
14221         * layout.cc (Layout::Layout): Initialize relro_segment_.
14222         (Layout::add_output_section_data): Return the output section.
14223         (Layout::make_output_section): Rcognize relro sections and mark
14224         them appropriately.
14225         (Layout::attach_allocated_section_to_segment): Put relro sections
14226         in a PT_GNU_RELRO segment.
14227         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14228         section as relro.
14229         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14230         PT_TLS segments.
14231         (Layout::linkonce_mapping): Map d.rel.ro.local to
14232         .data.rel.ro.local.
14233         (Layout::output_section_name): Us .data.rel.ro.local for any
14234         section which begins with that.
14235         * layout.h (class Layout): Update add_output_section_data
14236         declaration.  Add relro_segment_ field.
14237         * output.cc (Output_section::Output_section): Initialize is_relro_
14238         and is_relro_local_ fields.
14239         (Output_segment::add_output_section): Group relro sections.
14240         (Output_segment::is_first_section_relro): New function.
14241         (Output_segment::maximum_alignment): If there is a relro section,
14242         align the segment to the common page size.
14243         (Output_segment::set_section_addresses): Track whether we are
14244         looking at relro sections.  If the last section is a relro
14245         section, align to the common page size.
14246         (Output_segment::set_section_list_addresses): Add in_relro
14247         parameter.  Change all callers.  Align to the page size when
14248         moving from relro to non-relro section.
14249         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14250         segment.
14251         * output.h (class Output_section): Add is_relro_ and
14252         is_relro_local_ fields.
14253         (Output_section::is_relro): New function.
14254         (Output_section::set_is_relro): New function.
14255         (Output_section::is_relro_local): New function.
14256         (Output_section::set_is_relro_local): New function.
14257         (class Output_segment): Update declarations.
14258         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14259         * sparc.cc (Target_sparc::got_section): Likewise.
14260         * x86_64.cc (Target_x86_64::got_section): Likewise.
14261         * testsuite/relro_test_main.cc: New file.
14262         * testsuite/relro_test.cc: New file.
14263         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14264         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14265         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14266         (relro_test.so, relro_test_pic.o): New targets.
14267         * testsuite/Makefile.in: Rebuild.
14268
14269 2008-05-16  Ian Lance Taylor  <iant@google.com>
14270
14271         * output.cc (Output_segment::add_output_section): Remove front
14272         parameter.
14273         * output.h (class Output_segment): Remove
14274         add_initial_output_section and overloaded add_output_section.
14275         Update declaration of remaining add_output_section.
14276         * layout.cc (Layout::create_interp): Call add_output_section
14277         rather than add_initial_output_section.
14278         (Layout::finish_dynamic_section): Likewise.
14279
14280         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14281         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14282         know the dynamic type.
14283         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14284         field.  Initialize it in constructor.
14285         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14286         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14287         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14288         reloc.
14289
14290         * output.cc (Output_reloc::get_address): Change return type to
14291         Elf_Addr.
14292         * output.h (class Output_reloc): Update get_address declaration.
14293         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14294         for section addresses.
14295
14296 2008-05-09  Ian Lance Taylor  <iant@google.com>
14297
14298         PR 6493
14299         * gold.cc (gold_nomem): Use return value of write.
14300
14301 2008-05-08  Ian Lance Taylor  <iant@google.com>
14302
14303         * symtab.c (Symbol::init_base_output_data): Add version
14304         parameter.  Change all callers.
14305         (Symbol::init_base_output_segment): Likewise.
14306         (Symbol::init_base_constant): Likewise.
14307         (Symbol::init_base_undefined): Likewise.
14308         (Sized_symbol::init_output_data): Likewise.
14309         (Sized_symbol::init_output_segment): Likewise.
14310         (Sized_symbol::init_constant): Likewise.
14311         (Sized_symbol::init_undefined): Likewise.
14312         (Symbol_table::do_define_in_output_data): If the new symbol has a
14313         version, mark it as the default.
14314         (Symbol_table::do_define_in_output_segment): Likewise.
14315         (Symbol_table::do_define_as_constant): Likewise.
14316         * symtab.h (class Symbol): Update declarations.
14317         (class Sized_symbol): Likewise.
14318         * resolve.cc (Symbol::override_version): New function.
14319         (Symbol::override_base): Call override_version.
14320         (Symbol::override_base_with_special): Likewise.
14321         * testsuite/ver_script_8.script: New file.
14322         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14323         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14324         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14325         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14326
14327 2008-05-06  Ian Lance Taylor  <iant@google.com>
14328
14329         PR 6049
14330         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14331         functions.
14332         (class General_options): Remove existing --undefined, and add
14333         --no-undefined instead.  Add new --undefined as synonym for -u.
14334         * archive.cc (Archive::add_symbols): Check whether symbol was
14335         named with -u.
14336         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14337         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14338         all uses.  Add IS_UNDEFINED.  Update declarations to split
14339         different versions of init_base.  Declare init_base_undefined.
14340         (Symbol::is_defined): Handle IS_UNDEFINED.
14341         (Symbol::is_undefined): Likewise.
14342         (Symbol::is_weak_undefined): Call is_undefined.
14343         (Symbol::is_absolute): Handle IS_CONSTANT.
14344         (class Sized_symbol): Update declarations to split different
14345         versions of init.  Declare init_undefined.
14346         (class Symbol_table): Declare new functions.
14347         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14348         Change all callers.
14349         (Symbol::init_base_output_data): Likewise.
14350         (Symbol::init_base_output_segment): Likewise.
14351         (Symbol::init_base_constant): Likewise.
14352         (Symbol::init_base_undefined): New function.
14353         (Sized_symbol::init_object): Rename from init.  Change all
14354         callers.
14355         (Sized_symbol::init_output_data): Likewise.
14356         (Sized_symbol::init_output_segment): Likewise.
14357         (Sized_symbol::init_constant): Likewise.
14358         (Sized_symbol::init_undefined): New function.
14359         (Symbol_table::add_undefined_symbols_from_command_line): New
14360         function.
14361         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14362         function.
14363         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14364         (Symbol::output_section): Likewise.
14365         (Symbol::set_output_section): Likewise.
14366         (Symbol_table::sized_finalize_symbol): Likewise.
14367         (Symbol_table::sized_write_globals): Likewise.
14368         * resolve.cc (Symbol_table::should_override): Likewise.
14369         (Symbol::override_base_with_special): Likewise.
14370
14371         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14372         symbol, change it to have default visibility.
14373         * testsuite/protected_1.cc: New file.
14374         * testsuite/protected_2.cc: New file.
14375         * testsuite/protected_3.cc: New file.
14376         * testsuite/protected_main_1.cc: New file.
14377         * testsuite/protected_main_2.cc: New file.
14378         * testsuite/protected_main_3.cc: New file.
14379         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14380         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14381         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14382         (protected_1.so): New target.
14383         (protected_1_pic.o, protected_2_pic.o): New targets.
14384         (protected_3_pic.o): New target.
14385         (check_PROGRAMS): Add protected_2.
14386         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14387         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14388         * testsuite/Makefile.in: Rebuild.
14389
14390         * options.h (DEFINE_var): Add set_user_set_##varname__.
14391         (DEFINE_bool_alias): New macro.
14392         (class General_options): Define -Bstatic using DEFINE_bool_alias
14393         rather than DEFINE_special.  Add --undefined as an alias for -z
14394         defs.
14395         * options.cc (General_options::parse_Bstatic): Remove.
14396
14397         * options.h (class General_options): Add --fatal-warnings.
14398         * main.cc (main): Implement --fatal-warnings.
14399         * errors.h (Errors::warning_count): New function.
14400
14401         * options.h (class General_options): Add -Bsymbolic-functions.
14402         * symtab.h (Symbol::is_preemptible): Check for
14403         -Bsymbolic-functions.
14404
14405 2008-05-05  Ian Lance Taylor  <iant@google.com>
14406
14407         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14408         as noVARNAME rather than no-VARNAME.
14409         (class General_options): Add option -z combreloc.
14410         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14411         get_address.
14412         (Output_reloc::sort_before) [SHT_REL]: New function.
14413         (Output_reloc::sort_before) [SHT_RELA]: New function.
14414         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14415         Sort_relocs_comparison.
14416         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14417         parameter.  Change all callers.
14418         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14419         sort_relocs parameter.  Change all callers.
14420         * output.cc (Output_reloc::get_address): New function, broken out
14421         of write_rel.
14422         (Output_reloc::write_rel): Call it.
14423         (Output_reloc::compare): New function.
14424         (Output_data_reloc_base::do_write): Optionally sort relocs.
14425
14426         * configure.ac: If targ_extra_obj is set, link it in.
14427         * configure.tgt: Initialize all variables.
14428         (x86_64*): Set targ_extra_obj and targ_extra_size.
14429         * configure: Rebuild.
14430
14431         * object.cc (Sized_relobj::include_section_group): Adjust section
14432         indexes read from group data.  Build vector to pass to
14433         layout_group.
14434         * layout.cc (Layout::layout_group): Add flags and shndxes
14435         parameters.  Remove contents parameter.  Change caller.  Update
14436         explicit instantiations.
14437         * layout.h (class Layout): Update layout_group declaration.
14438         * output.cc (Output_data_group::Output_data_group): Add flags and
14439         input_shndxes parameters.  Remove contents parameter.  Change
14440         caller.
14441         (Output_data_group::do_write): Change input_sections_ to
14442         input_shndxes_.
14443         * output.h (class Output_data_group): Update constructor
14444         declaration.  Rename input_sections_ to input_shndxes_.
14445         * testsuite/many_sections_test.cc: Add template.
14446
14447 2008-04-30  Cary Coutant  <ccoutant@google.com>
14448
14449         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14450
14451         * layout.cc (Layout::include_section): Refactored check for debug
14452         info section.
14453         (Layout::add_comdat): Add new parameters.  Change type
14454         of signature parameter.  Add object and shndx to signatures table.
14455         (Layout::find_kept_object): New function.
14456         * layout.h: Include <cstring>.
14457         (Layout::is_debug_info_section): New function.
14458         (Layout::add_comdat): Add new parameters.
14459         (Layout::find_kept_object): New function.
14460         (Layout::Kept_section): New struct.
14461         (Layout::Signatures): Change type of map range.
14462         * object.cc (Relobj::output_section_address): New function.
14463         (Sized_relobj::include_section_group): Add new parameters.  Change
14464         calls to Layout::add_comdat.  Change to build table of kept comdat
14465         groups and table mapping discarded sections to kept sections.
14466         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14467         (Sized_relobj::do_layout): Change calls to include_section_group and
14468         include_linkonce_section.
14469         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14470         value to zero when section is discarded.
14471         (Sized_relobj::map_to_kept_section): New function.
14472         * object.h (Relobj::output_section_address): New function.
14473         (Relobj::Comdat_group): New type.
14474         (Relobj::find_comdat_group): New function.
14475         (Relobj::Comdat_group_table): New type.
14476         (Relobj::Kept_comdat_section): New type.
14477         (Relobj::Kept_comdat_section_table): New type.
14478         (Relobj::add_comdat_group): New function.
14479         (Relobj::set_kept_comdat_section): New function.
14480         (Relobj::get_kept_comdat_section): New function.
14481         (Relobj::comdat_groups_): New field.
14482         (Relobj::kept_comdat_sections_): New field.
14483         (Symbol_value::input_value): Update comment.
14484         (Sized_relobj::map_to_kept_section) New function.
14485         (Sized_relobj::include_linkonce_section): Add new parameter.
14486         * target-reloc.h (Comdat_behavior): New type.
14487         (get_comdat_behavior): New function.
14488         (relocate_section): Add code to map a discarded section to the
14489         corresponding kept section when applying a relocation.
14490
14491 2008-04-30  Craig Silverstein  <csilvers@google.com>
14492
14493         * dwarf_reader.cc (next_generation_count): New static var.
14494         (Addr2line_cache_entry): New struct.
14495         (addr2line_cache): New static var.
14496         (Dwarf_line_info::one_addr2line): Added caching.
14497         (Dwarf_line_info::clear_addr2line_cache): New function.
14498         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14499         cache-size parameter.
14500         (Dwarf_line_info::one_addr2line_cache): New function.
14501         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14502         new cache-size argument to one_addr2line(), and clear cache.
14503
14504 2008-04-28  Cary Coutant  <ccoutant@google.com>
14505
14506         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14507         R_386_PC8 relocations.
14508
14509 2008-04-23  Ian Lance Taylor  <iant@google.com>
14510
14511         * object.cc (Sized_relobj::include_section_group): Check for
14512         invalid section group.
14513
14514         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14515         header size.
14516
14517         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14518         than read for file header.
14519         * archive.cc (Archive::include_member): Likewise.
14520
14521 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14522
14523         * aclocal.m4: Regenerate.
14524         * configure: Regenerate.
14525
14526 2008-04-19  Ian Lance Taylor  <iant@google.com>
14527
14528         * version.cc (version_string): Bump to 1.6.
14529
14530         * testsuite/Makefile.am (many_sections_r_test): New target.
14531         (many_sections_r_test_SOURCES): Remove.
14532         (many_sections_r_test_DEPENDENCIES): Remove.
14533         (many_sections_r_test_LDFLAGS): Remove.
14534         (many_sections_r_test_LDADD): Remove.
14535
14536         * object.cc (Sized_relobj::do_add_symbols): Always pass
14537         local_symbol_count_ to add_from_relobj.
14538
14539         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14540         every thousand variables.
14541         * testsuite/Makefile.in: Rebuild.
14542
14543         * object.cc (Xindex::initialize_symtab_xindex): New function.
14544         (Xindex::read_symtab_xindex): New function.
14545         (Xindex::sym_xindex_to_shndx): New function.
14546         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14547         available.
14548         (Sized_relobj::do_initialize_xindex): New function.
14549         (Sized_relobj::do_read_symbols): Adjust section links.
14550         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14551         parameter.  Change all callers.
14552         (Sized_relobj::include_section_group): Adjust section links and
14553         symbol section indexes.
14554         (Sized_relobj::do_layout): Adjust section links.
14555         (Sized_relobj::do_count_local_symbols): Adjust section links and
14556         symbol section indexes.
14557         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14558         ordinary and special symbols.
14559         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14560         dynsym_xindex parameters.  Change all callers.  Adjust section
14561         links.  Use SHN_XINDEX when needed.
14562         (Sized_relobj::get_symbol_location_info): Adjust section links.
14563         Don't get fooled by special symbols.
14564         * object.h (class Xindex): Define.
14565         (class Object): Add xindex_ parameter.  Declare virtual functoin
14566         do_initialize_xindex.
14567         (Object::adjust_sym_shndx): New function.
14568         (Object::set_xindex): New protected function.
14569         (class Symbol_value): Add is_ordinary_shndx_ field.
14570         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14571         (Symbol_value::value): Assert ordinary section.
14572         (Symbol_value::initialize_input_to_output_map): Likewise.
14573         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14574         Change all callers.
14575         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14576         all callers.
14577         (class Sized_relobj): Update declarations.
14578         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14579         parameter.  Change all callers.
14580         (Sized_relobj::adjust_shndx): New function.
14581         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14582         field.
14583         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14584         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14585         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14586         (Sized_dynobj::read_dynsym_section): Adjust section links.
14587         (Sized_dynobj::read_dynamic): Likewise.
14588         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14589         section links.
14590         (Sized_dynobj::do_initialize_xindex): New function.
14591         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14592         do_initialize_xindex.
14593         (Sized_dynobj::adjust_shndx): New function.
14594         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14595         dynsym_xindex_ fields.
14596         (Layout::finalize): Add a call to set_section_indexes before
14597         creating the symtab sections.
14598         (Layout::set_section_indexes): Don't do anything if the section
14599         already has a section index.
14600         (Layout::create_symtab_sections): Add shnum parameter.  Change
14601         caller.  Create .symtab_shndx section if needed.
14602         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14603         caller.
14604         (Layout::allocated_output_section_count): New function.
14605         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14606         needed.
14607         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14608         fields.  Update declarations.
14609         (Layout::symtab_xindex): New function.
14610         (Layout::dynsym_xindex): New function.
14611         (class Write_symbols_task): Add layout_ field.
14612         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14613         Change caller.
14614         * output.cc (Output_section_headers::Output_section_headers): Add
14615         shstrtab_section parameter.  Change all callers.
14616         (Output_section_headers::do_sized_write): Store overflow values
14617         for section count and section string table section index in
14618         section header zero.
14619         (Output_file_header::do_sized_write): Check for overflow of
14620         section count and section string table section index.
14621         (Output_symtab_xindex::do_write): New function.
14622         (Output_symtab_xindex::endian_do_write): New function.
14623         * output.h (class Output_section_headers): Add shstrtab_section_.
14624         Update declarations.
14625         (class Output_symtab_xindex): Define.
14626         (Output_section::has_out_shndx): New function.
14627         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14628         field.
14629         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14630         Change all callers.
14631         (Sized_symbol::init): Likewise.
14632         (Symbol::output_section): Check for ordinary symbol.
14633         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14634         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14635         callers.
14636         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14637         Change all callers.  Simplify handling of symbols from sections
14638         not included in the link.
14639         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14640         distinction.
14641         (Weak_alias_sorter::operator()): Assert that symbols are
14642         ordinary.
14643         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14644         distinction.
14645         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14646         parameters.  Change all callers.
14647         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14648         symbol distinction.  Use SHN_XINDEX when needed.
14649         (Symbol_table::write_section_symbol): Add symtab_xindex
14650         parameter.  Change all callers.
14651         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14652         SHN_XINDEX when needed.
14653         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14654         declarations.
14655         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14656         (Symbol::is_defined): Check is_ordinary.
14657         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14658         (Symbol::is_absolute, Symbol::is_common): Likewise.
14659         (class Sized_symbol): Update declarations.
14660         (class Symbol_table): Update declarations.
14661         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14662         parameters.  Change all callers.
14663         (Sized_symbol::override): Likewise.
14664         (Symbol_table::override): Likewise.
14665         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14666         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14667         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14668         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14669         to be in an ordinary section.
14670         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14671         object and is_ordinary parameters.  Change all callers.
14672         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14673         Change all callers.  Don't add undefined or non-ordinary symbols
14674         to reloc_map_.
14675         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14676         Change all callers.
14677         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14678         declarations.
14679         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14680         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14681         (Sized_relobj::relocate_sections): Likewise.
14682         * target-reloc.h (scan_relocs): Adjust section symbol index.
14683         (scan_relocatable_relocs): Likewise.
14684         * i386.cc (Scan::local): Check for ordinary symbols.
14685         * sparc.cc (Scan::local): Likewise.
14686         * x86_64.cc (Scan::local): Likewise.
14687         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14688         to symbol_section_and_value.
14689         * testsuite/many_sections_test.cc: New file.
14690         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14691         (check_PROGRAMS): Add many_sections_test.
14692         (many_sections_test_SOURCES): Define.
14693         (many_sections_test_DEPENDENCIES): Define.
14694         (many_sections_test_LDFLAGS): Define.
14695         (BUILT_SOURCES): Add many_sections_define.h.
14696         (many_sections_define.h): New target.
14697         (BUILT_SOURCES): Add many_sections_check.h.
14698         (many_sections_check.h): New target.
14699         (check_PROGRAMS): Add many_sections_r_test.
14700         (many_sections_r_test_SOURCES): Define.
14701         (many_sections_r_test_DEPENDENCIES): Define.
14702         (many_sections_r_test_LDFLAGS): Define.
14703         (many_sections_r_test_LDADD): Define.
14704         (many_sections_r_test.o): New target.
14705         * testsuite/Makefile.in: Rebuild.
14706
14707 2008-04-17  Cary Coutant  <ccoutant@google.com>
14708
14709         * errors.cc (Errors::info): New function.
14710         (gold_info): New function.
14711         * errors.h (Errors::info): New function.
14712         * gold.h (gold_info): New function.
14713         * object.cc (Input_objects::add_object): Print trace output.
14714         * options.cc (options::parse_set): New function.
14715         (General_options::parse_wrap): Deleted.
14716         (General_options::General_options): Deleted initializer.
14717         * options.h (options::String_set): New typedef.
14718         (options::parse_set): New function.
14719         (DEFINE_set): New macro.
14720         (General_options::wrap): Changed to use DEFINE_set. Changed
14721         callers of any_wrap_symbols and is_wrap_symbol.
14722         (General_options::trace, General_options::trace_symbol):
14723         New options.
14724         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14725         (General_options::wrap_symbols_): Deleted.
14726         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14727
14728 2008-04-17  David S. Miller  <davem@davemloft.net>
14729
14730         * options.cc (General_options::parse_V): New function.
14731         * options.h: Add entries for -V and -Qy.
14732
14733 2008-04-17  Ian Lance Taylor  <iant@google.com>
14734
14735         * common.cc (Symbol_table::allocate_commons): Remove options
14736         parameter.  Change caller.
14737         (Symbol_table::do_allocate_commons): Remove options parameter.
14738         Change caller.  Just call do_allocate_commons_list twice.
14739         (Symbol_table::do_allocate_commons_list): New function, broken out
14740         of do_allocate_commons.
14741         * common.h (class Allocate_commons_task): Remove options_ field.
14742         Update constructor.
14743         * symtab.cc (Symbol_table::Symbol_table): Initialize
14744         tls_commons_.
14745         (Symbol_table::add_from_object): Put TLS common symbols on
14746         tls_commons_ list.
14747         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14748         which are IN_OUTPUT_DATA.
14749         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14750         allocate_commons and do_allocate_commons declarations.  Declare
14751         do_allocate_commons_list.
14752         * gold.cc (queue_middle_tasks): Update creation of
14753         Allocate_commons_task to not pass options.
14754         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14755         (TLS_TEST_C_FLAGS): New variable.
14756         (tls_test_c_pic.o): New target.
14757         (tls_test_shared.so): Link in tls_test_c_pic.o.
14758         (tls_test_c_pic_ie.o): New target.
14759         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14760         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14761         (tls_test_c.o): New target.
14762         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14763         (tls_pic_test_LDADD): Likewise.
14764         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14765         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14766         (tls_test_c_gnu2.o): New target.
14767         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14768         tls_test_c_gnu2.o.
14769         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14770         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14771         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14772         * testsuite/tls_test.cc: Include "config.h".
14773         (t_last): Call t11_last.
14774         * testsuite/tls_test.h (t11, t11_last): Declare.
14775         * testsuite/tls_test_c.c: New file.
14776         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14777         * configure.ac: Check for OpenMP support.
14778         * configure, config.in, Makefile.in: Rebuild.
14779         * testsuite/Makefile.in: Rebuild.
14780
14781 2008-04-16  Cary Coutant  <ccoutant@google.com>
14782
14783         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14784         (Target_i386::tls_base_symbol_defined_): New field.
14785         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14786         (Target_i386::Scan::global): Likewise.
14787         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14788         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14789         (Target_x86_64::tls_base_symbol_defined_): New field.
14790         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14791         (Target_x86_64::Scan::global): Likewise.
14792
14793 2008-04-16  Cary Coutant  <ccoutant@google.com>
14794
14795         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14796         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14797         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14798         building shared libraries.
14799         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14800         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14801         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14802         * testsuite/Makefile.in: Rebuild.
14803         * testsuite/weak_undef.h: New file.
14804         * testsuite/weak_undef_file1.cc: Add extra test cases.
14805         * testsuite/weak_undef_file2.cc: Likewise.
14806         * testsuite/weak_undef_test.cc: Likewise.
14807
14808 2008-04-16  David S. Miller  <davem@davemloft.net>
14809
14810         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14811         Add issued_non_pic_error_ field.  Declare check_non_pic.
14812         (Target_sparc::Scan::check_non_pic): New function.
14813         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14814         (Target_sparc::Scan::global): Likewise.
14815
14816         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14817         * configure: Rebuild.
14818
14819         * options.h (DEFINE_enable): New macro.
14820         (new_dtags): New enable option.
14821         (initfirst, interpose, loadfltr, nodefaultlib,
14822         nodelete, nodlopen, nodump): New -z options.
14823         * layout.cc (Layout:finish_dynamic_section): If new
14824         dtags enabled, emit DT_RUNPATH.  Also, emit a
14825         DT_FLAGS_1 containing any specified -z flags.
14826
14827 2008-04-16  Ian Lance Taylor  <iant@google.com>
14828
14829         * copy-relocs.cc: New file.
14830         * copy-relocs.h: New file.
14831         * reloc.cc: Remove Copy_relocs code.
14832         * reloc.h: Likewise.
14833         * reloc-types.h (struct Reloc_types) [both versions]: Add
14834         get_reloc_addend_noerror.
14835         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14836         variants of add_global which take an addend which must be zero.
14837         * i386.cc: Include "copy-relocs.h".
14838         (class Target_i386): Change type of copy_relocs_ to variable,
14839         update initializer.
14840         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14841         Change all callers.
14842         (Target_i386::do_finalize_sections): Change handling of
14843         copy_relocs_.
14844         * sparc.cc: Include "copy-relocs.h".
14845         (class Target_sparc): Change type of copy_relocs_ to variable,
14846         update initializer.
14847         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14848         Change all callers.
14849         (Target_sparc::do_finalize_sections): Change handling of
14850         copy_relocs_.
14851         * x86_64.cc: Include "copy-relocs.h".
14852         (class Target_x86_64): Change type of copy_relocs_ to variable,
14853         update initializer.
14854         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14855         class.  Change all callers.
14856         (Target_x86_64::do_finalize_sections): Change handling of
14857         copy_relocs_.
14858         * Makefile.am (CCFILES): Add copy-relocs.cc.
14859         (HFILES): Add copy-relocs.h.
14860
14861         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14862
14863         * testsuite/script_test_4.sh: Permit leading zeroes.
14864
14865 2008-04-15  Ian Lance Taylor  <iant@google.com>
14866
14867         * script-sections.cc (Script_sections::create_segments): Use
14868         header_size_adjustment even when there is enough room for the
14869         headers.
14870         * testsuite/script_test_4.sh: New file.
14871         * testsuite/script_test_4.t: New file.
14872         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14873         (check_DATA): Add script_test_4.stdout.
14874         (MOSTLYCLEANFILES): Likewise.
14875         (script_test_4): New target.
14876         (script_test_4.stdout): New target.
14877         * testsuite/Makefile.in: Rebuild.
14878
14879         * sparc.cc: Add definitions for Output_data_plt_sparc class
14880         constants.
14881
14882 2008-04-14  David S. Miller  <davem@davemloft.net>
14883
14884         * sparc.cc: New file.
14885         * Makefile.am (TARGETSOURCES): Add sparc.cc
14886         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14887         * configure.tgt: Document targ_extra_size and
14888         targ_extra_big_endian.  Add entries for sparc-* and
14889         sparc64-*.
14890         * configure.ac: Handle targ_extra_size and
14891         targ_extra_big_endian.
14892         * Makefile.in: Rebuild.
14893         * configure: Likewise.
14894         * po/POTFILES.in: Likewise.
14895         * po/gold.pot: Likewise.
14896
14897 2008-04-14  Ian Lance Taylor  <iant@google.com>
14898
14899         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14900         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14901         in the name/type/flags to section mapping.  Don't call
14902         allocate_output_section.
14903         (Layout::choose_output_section): Change parameter from adjust_name
14904         to is_input_section.  Don't permit input sections after sections
14905         are attached to segments.  Don't call allocate_output_section.
14906         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14907         not write_enable_output_section.
14908         (Layout::make_output_section): Don't push to
14909         unattached_section_list_ nor call attach_to_segment.  Call
14910         attach_section_to_segment if sections are attached.
14911         (Layout::attach_sections_to_segments): New function.
14912         (Layout::attach_section_to_segment): New function.
14913         (Layout::attach_allocated_section_to_segment): Rename from
14914         attach_to_segment.  Remove flags parameter.
14915         (Layout::allocate_output_section): Remove function.
14916         (Layout::write_enable_output_section): Remove function.
14917         * layout.h (class Layout): Update for above changes.  Add new
14918         field sections_are_attached_.
14919         * output.h (Output_section::update_flags_for_input_section): New
14920         function.
14921         * output.cc (Output_section::add_input_section): Call
14922         update_flags_for_input_section.
14923         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14924
14925 2008-04-11  Cary Coutant  <ccoutant@google.com>
14926
14927         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14928         thought unnecessary.
14929         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14930
14931 2008-04-11  Ian Lance Taylor  <iant@google.com>
14932
14933         * output.h (class Output_section_data): Remove inline definition
14934         of set_addralign.
14935         * output.cc (Output_section_data::set_addralign): New function.
14936
14937 2008-04-11  Cary Coutant  <ccoutant@google.com>
14938
14939         Add support for TLS descriptors for i386 and x86_64.
14940         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14941         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14942         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14943         GOT_TYPE_TLS_DESC.
14944         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14945         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14946         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14947         relocations.
14948         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14949         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14950         Fix problem with initial-exec relocations.
14951         (Target_i386::Relocate::relocate_tls): Likewise.
14952         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14953         relaxation.
14954         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14955         support for section-plus-offset dynamic table entries.
14956         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14957         (Output_data_dynamic::Dynamic_entry): Add support for
14958         section-plus-offset dynamic table entries.
14959         (Output_data_dynamic::Classification): Likewise.
14960         (Output_data_dynamic::classification_): Renamed offset_.
14961         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14962         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14963         (Target_x86_64::make_plt_section): New function.
14964         (Target_x86_64::reserve_tlsdesc_entries): New function.
14965         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14966         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14967         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14968         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14969         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14970         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14971         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14972         add extra PLT entry for TLS descriptors.
14973         (Output_data_plt_x86_64::got_): New field.
14974         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14975         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14976         fields.
14977         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14978         descriptors.
14979         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14980         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14981         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14982         R_386_TLS_DESC_CALL relocations.
14983         (Target_x86_64::Scan::global): Likewise.
14984         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14985         for TLS descriptors.
14986         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14987         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14988         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14989         GD-to-IE relaxation.
14990         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14991         and TLS_DESCRIPTORS.
14992         * Makefile.in: Rebuild.
14993         * configure: Rebuild.
14994         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14995         (tls_test_shared2.so): New target.
14996         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14997         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14998         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14999         (tls_shared_gd_to_ie_test_LDADD): New variable.
15000         (tls_shared_gnu2_gd_to_ie_test): New target.
15001         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15002         New targets.
15003         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15004         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15005         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15006         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15007         (tls_shared_gnu2_test): New target.
15008         (tls_test_gnu2_shared.so): New target.
15009         (tls_shared_gnu2_test_SOURCES): New variable.
15010         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15011         (tls_shared_gnu2_test_LDFLAGS): New variable.
15012         (tls_shared_gnu2_test_LDADD): New variable.
15013         * testsuite/Makefile.in: Rebuild.
15014         * testsuite/Makefile.
15015
15016 2008-04-11  Ian Lance Taylor  <iant@google.com>
15017
15018         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15019         justsyms.t.
15020         * testsuite/Makefile.in: Rebuild.
15021
15022         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15023         long.
15024         * testsuite/script_test_2.cc (main): Adjust test.
15025
15026 2008-04-11  David S. Miller  <davem@davemloft.net>
15027             Ian Lance Taylor  <iant@google.com>
15028
15029         * options.h (General_options): Add entries for '-Y' and
15030         '-relax'.
15031         * options.cc (General_options:finalize): If -Y was used, add those
15032         entries to the library path instead of the default "/lib" and
15033         "/usr/lib".
15034
15035 2008-04-11  David S. Miller  <davem@davemloft.net>
15036
15037         * testsuite/justsyms.t: Start at 0x100.
15038         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15039         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15040         long.
15041         * testsuite/script_test_2.cc: Adjust string and section length
15042         checks.
15043
15044 2008-04-09  Ian Lance Taylor  <iant@google.com>
15045
15046         PR gold/5996
15047         * script-sections.cc (Sections_element::allocate_to_segment): Add
15048         orphan parameter.
15049         (Output_section_definition::allocate_to_segment): Likewise.
15050         (Orphan_output_section::allocate_to_segment): Likewise.
15051         (Script_sections::attach_sections_using_phdrs_clause): Don't
15052         propagate non-PT_LOAD segments to orphan sections.
15053         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15054         readelf rather than objdump.
15055         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15056         .interp section and PT_INTERP segment are the same size.
15057         * testsuite/Makefile.in: Rebuild.
15058
15059         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15060         aliases for symbols defined in the same object.
15061         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15062         (weak_alias_test_SOURCES): New variable.
15063         (weak_alias_test_DEPENDENCIES): New variable.
15064         (weak_alias_test_LDFLAGS): New variable.
15065         (weak_alias_test_LDADD): New variable.
15066         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15067         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15068         (weak_alias_test_3.o): New target.
15069         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15070         * testsuite/weak_alias_test_main.cc: New file.
15071         * testsuite/weak_alias_test_1.cc: New file.
15072         * testsuite/weak_alias_test_2.cc: New file.
15073         * testsuite/weak_alias_test_3.cc: New file.
15074
15075 2008-04-08  Ian Lance Taylor  <iant@google.com>
15076
15077         * options.h (class General_options): Add --noinhibit-exec option.
15078         * main.cc (main): Check --noinhibit-exec.
15079
15080         * options.h (class General_options): Define --wrap as a special
15081         option.  Add wrap_symbols_ field.
15082         (General_options::any_wrap_symbols): New function.
15083         (General_options::is_wrap_symbol): New function.
15084         * options.cc (General_options::parse_wrap): New function.
15085         (General_options::General_options): Initialize wrap_symbols_.
15086         * symtab.cc (Symbol_table::wrap_symbol): New function.
15087         (Symbol_table::add_from_object): Handle --wrap.
15088         * symtab.h (class Symbol_table): Declare wrap_symbol.
15089         * target.h (Target::wrap_char): New function.
15090         (Target::Target_info): Add wrap_char field.
15091         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15092         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15093         * testsuite/testfile.cc (Target_test::test_target_info):
15094         Likewise.
15095
15096         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15097         there is one.
15098
15099         * layout.h (class Layout): Add added_eh_frame_data_ field.
15100         * layout.cc (Layout::Layout): Initialize new field.
15101         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15102         output section until we find a section we merged successfully.
15103         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15104         that the size be non-zero.
15105
15106         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15107         qualifier.
15108
15109 2008-04-08  Craig Silverstein  <csilvers@google.com>
15110
15111         * configure.ac: Export new conditional variable HAVE_ZLIB.
15112         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15113         on HAVE_ZLIB.
15114         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15115         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15116
15117 2008-04-07  Ian Lance Taylor  <iant@google.com>
15118
15119         * version.cc (version_string): Set to "1.5".
15120
15121         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15122         Add issued_non_pic_error_ field.  Declare check_non_pic.
15123         (Target_x86_64::Scan::check_non_pic): New function.
15124         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15125         (Target_x86_64::Scan::global): Likewise.
15126
15127         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15128         addend parameter.  Change caller.  Handle merge sections.
15129         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15130         Address to Addend.  Don't add in the result of
15131         local_section_offset, pass down the addend and use the returned
15132         value.
15133         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15134         Update declarations of local_section_offset and symbol_value.
15135         * testsuite/two_file_test_1.cc (t18): New function.
15136         * testsuite/two_file_test_2.cc (f18): New function.
15137         * testsuite/two_file_test_main.cc (main): Call t18.
15138         * testsuite/two_file_test.h (t18, f18): Declare.
15139
15140         * configure.ac: Don't test for objdump, c++filt, or readelf.
15141         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15142         conditionals.
15143         (TEST_READELF): New variable.
15144         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15145         (check_PROGRAMS): Add two_file_strip_test.
15146         (two_file_strip_test): New target.
15147         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15148         (two_file_same_shared_strip_test_SOURCES): New variable.
15149         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15150         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15151         (two_file_same_shared_strip_test_LDADD): New variable.
15152         (two_file_shared_strip.so): New target.
15153         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15154         (ver_test_5.syms, ver_test_7.syms): Likewise.
15155         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15156         (strip_test_3.stdout): Use TEST_OBJDUMP.
15157         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15158
15159 2008-04-04  Cary Coutant  <ccoutant@google.com>
15160
15161         * symtab.h (Symbol::is_weak_undefined): New function.
15162         (Symbol::is_strong_undefined): New function.
15163         (Symbol::is_absolute): New function.
15164         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15165         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15166         absolute symbols.
15167         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15168         (weak_undef_test): New target.
15169         * testsuite/Makefile.in: Rebuild.
15170         * testsuite/weak_undef_file1.cc: New file.
15171         * testsuite/weak_undef_file2.cc: New file.
15172         * testsuite/weak_undef_test.cc: New file.
15173
15174 2008-04-03  Craig Silverstein  <csilvers@google.com>
15175
15176         * compressed_output.h (class Output_compressed_section): Use
15177         unsigned buffer.
15178         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15179         add zlib header.
15180         (zlib_compressed_suffix): Removed.
15181         (Output_compressed_section::set_final_data_size): Use unsigned
15182         buffers.
15183         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15184         Fix linker invocation.
15185         (flagstest_o_specialfile_and_compress_debug_sections):
15186         Likewise.
15187         * testsuite/Makefile.in: Regenerated.
15188
15189 2008-04-02  David S. Miller  <davem@davemloft.net>
15190
15191         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15192         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15193
15194 2008-04-02  Craig Silverstein  <csilvers@google.com>
15195
15196         * TODO: New file.
15197
15198 2008-04-02  Ian Lance Taylor  <iant@google.com>
15199
15200         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15201         parameters.  Update for new key type to views_.  Change all
15202         callers.
15203         (File_read::read): Adjust for byteshift in returned view.
15204         (File_read::add_view): New function, broken out of
15205         find_and_make_view.
15206         (File_read::make_view): New function, broken out of
15207         find_and_make_view.
15208         (File_read::find_or_make_view): Add offset and aligned
15209         parameters.  Rewrite accordingly.  Change all callers.
15210         (File_read::get_view): Add offset and aligned parameters.  Adjust
15211         for byteshift in return value.
15212         (File_read::get_lasting_view): Likewise.
15213         * fileread.h (class File_read): Update declarations.
15214         (class File_read::View): Add byteshift_ field.  Add byteshift to
15215         constructor.  Add byteshift method.
15216         * archive.h (Archive::clear_uncached_views): New function.
15217         (Archive::get_view): Add aligned parameter.  Change all callers.
15218         * object.h (Object::get_view): Add aligned parameter.  Change all
15219         callers.
15220         (Object::get_lasting_view): Likewise.
15221
15222         * fileread.cc (File_read::release): Don't call clear_views if
15223         there are multiple objects.
15224         * fileread.h (File_read::clear_uncached_views): New function.
15225         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15226         on the archive.
15227
15228 2008-03-31  Cary Coutant  <ccoutant@google.com>
15229
15230         Add thin archive support.
15231         * archive.cc (Archive::armagt): New const.
15232         (Archive::setup): Remove task parameter and calls to unlock.
15233         (Archive::unlock_nested_archives): New function.
15234         (Archive::read_header): Add nested_off parameter. Change
15235         all callers.
15236         (Archive::interpret_header): Likewise.
15237         (Archive::include_all_members): Change to handle thin
15238         archives.
15239         (Archive::include_member): Likewise.
15240         * archive.h (Archive::Archive): Add new parameters and
15241         initializers.
15242         (Archive::armagt): New const.
15243         (Archive::setup): Remove task parameter.
15244         (Archive::unlock_nested_archives): New function.
15245         (Archive::read_header): Add nested_off parameter.
15246         (Archive::interpret_header): Likewise.
15247         (Archive::Nested_archive_table): New typedef.
15248         (Archive::is_thin_archive_): New field.
15249         (Archive::nested_archives_): New field.
15250         (Archive::options_): New field.
15251         (Archive::dirpath_): New field.
15252         (Archive::task_): New field.
15253         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15254         for thin archives.  Pass additional parameters to
15255         Archive::Archive.  Unlock the archive file after calling
15256         Archive::setup.
15257
15258 2008-03-29  Ian Lance Taylor  <iant@google.com>
15259
15260         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15261         version symbol to be local.
15262         * testsuite/ver_test_4.sh: New file.
15263         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15264         (check_DATA): Add ver_test_4.syms.
15265         (ver_test_4.syms): New target.
15266         * testsuite/Makefile.in: Rebuild.
15267
15268         * output.cc
15269         (Output_section::Input_section_sort_entry::has_priority): New
15270         function.
15271         (Output_section::Input_section_sort_entry::match_file_name): New
15272         function.
15273         (Output_section::Input_section_sort_entry::match_section_name):
15274         Remove.
15275         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15276         Remove.
15277         (Output_section::Input_section_sort_entry::match_section_file):
15278         Remove.
15279         (Output_section::Input_section_sort_compare::operator()): Rewrite
15280         using new Input_section_sort_entry functions.  Sort crtbegin and
15281         crtend first.  Sort sections with no priority before sections with
15282         a priority.
15283         * testsuite/initpri1.c (d3): Check j != 4.
15284         (cd5): New constructor/destructor function.
15285         (main): Check j != 2.
15286
15287         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15288         new symbol when resolving, don't call set_is_default.
15289         * testsuite/ver_test_7.cc: New file.
15290         * testsuite/ver_test_7.sh: New file.
15291         * testsuite/Makefile.am (ver_test_7.so): New target.
15292         (ver_test_7.o): New target.
15293         (check_SCRIPTS): Add ver_test_7.sh.
15294         (check_DATA): Add ver_test_7.syms.
15295         (ver_test_7.syms): New target.
15296
15297 2008-03-28  Ian Lance Taylor  <iant@google.com>
15298
15299         * layout.cc (Layout::layout): If we see an input section with a
15300         name that needs sorting, set the must_sort flag for the output
15301         section.
15302         (Layout::make_output_section): If the name of the output section
15303         indicates that it might require sorting, set the may_sort flag.
15304         * output.h (Output_section::may_sort_attached_input_sections): New
15305         function.
15306         (Output_section::set_may_sort_attached_input_sections): New
15307         function.
15308         (Output_section::must_sort_attached_input_sections): New
15309         function.
15310         (Output_section::set_must_sort_attached_input_sections): New
15311         function.
15312         (class Output_section): Declare Input_section_sort_entry.  Define
15313         Input_section_sort_compare.  Declare
15314         sort_attached_input_sections.  Add new fields:
15315         may_sort_attached_input_sections_,
15316         must_sort_attached_input_sections_,
15317         attached_input_sections_are_sorted_.
15318         * output.cc (Output_section::Output_section): Initialize new
15319         fields.
15320         (Output_section::add_input_section): Add an entry to
15321         input_sections_ if may_sort or must_sort are true.
15322         (Output_section::set_final_data_size): Call
15323         sort_attached_input_sections if necessary.
15324         (Output_section::Input_section_sort_entry): Define new class.
15325         (Output_section::Input_section_sort_compare::operator()): New
15326         function.
15327         (Output_section::sort_attached_input_sections): New function.
15328         * configure.ac: Check whether the compiler supports constructor
15329         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15330         * testsuite/initpri1.c: New file.
15331         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15332         CONSTRUCTOR_PRIORITY.
15333         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15334         (initpri1_LDFLAGS): New variable.
15335         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15336
15337 2008-03-27  Ian Lance Taylor  <iant@google.com>
15338
15339         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15340         * testsuite/common_test_1.c: New file.
15341         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15342         (common_test_1_SOURCES): New variable.
15343         (common_test_1_DEPENDENCIES): New variable.
15344         (common_test_1_LDFLAGS): New variable.
15345
15346         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15347         and commons_ correctly when NAME/VERSION does not override
15348         NAME/NULL.
15349         * testsuite/ver_test_6.c: New file.
15350         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15351         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15352         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15353
15354 2008-03-26  Ian Lance Taylor  <iant@google.com>
15355
15356         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15357         of an undefined symbol from a version script.
15358         * testsuite/Makefile.am (ver_test_5.so): New target.
15359         (ver_test_5.o): New target.
15360         (check_SCRIPTS): Add ver_test_5.sh.
15361         (check_DATA): Add ver_test_5.syms.
15362         (ver_test_5.syms): New target.
15363         * testsuite/ver_test_5.cc: New file.
15364         * testsuite/ver_test_5.script: New file.
15365         * testsuite/ver_test_5.sh: New file.
15366         * Makefile.in, testsuite/Makefile.in: Rebuild.
15367
15368         PR gold/5986
15369         Fix problems building gold with gcc 4.3.0.
15370         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15371         (gold_error_at_location, gold_warning_at_location): Use it.
15372         * configure.ac: Check whether we can compile and use a template
15373         function with a printf attribute.
15374         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15375         when jumping over bytes.
15376         * object.cc: Instantiate Object::read_section_data.
15377         * debug.h: Include <cstring>
15378         * dwarf_reader.cc: Include <algorithm>
15379         * main.cc: Include <cstring>.
15380         * options.cc: Include <cstring>.
15381         * output.cc: Include <cstring>.
15382         * script.cc: Include <cstring>.
15383         * script.h: Include <string>.
15384         * symtab.cc: Include <cstring> and <algorithm>.
15385         * target-select.cc: Include <cstring>.
15386         * version.cc: Include <string>.
15387         * testsuite/testmain.cc: Include <cstdlib>.
15388         * configure, config.in: Rebuild.
15389
15390 2008-03-25  Ian Lance Taylor  <iant@google.com>
15391
15392         * options.cc: Include "../bfd/bfdver.h".
15393         (options::help): Print bug reporting address.
15394
15395         * version.cc (print_version): Adjust output for current value of
15396         BFD_VERSION_STRING.
15397
15398         * NEWS: New file.
15399
15400         * options.cc (options::help): Print list of supported targets.
15401         * target-select.h: Include <vector>.
15402         (class Target_selector): Make machine_, size_, and is_big_endian_
15403         fields const.  Add bfd_name_ and instantiated_target_ fields.
15404         (Target_selector::Target_selector): Add bfd_name parameter.
15405         (Target_selector::recognize): Make non-virtual, call
15406         do_recognize.
15407         (Target_selector::recognize_by_name): Make non-virtual, call
15408         do_recognize_by_name.
15409         (Target_selector::supported_names): New function.
15410         (Target_selector::bfd_name): New function.
15411         (Target_selector::do_instantiate_target): New pure virtual
15412         function.
15413         (Target_selector::do_recognize): New virtual function.
15414         (Target_selector::do_recognize_by_name): New virtual function.
15415         (Target_selector::instantiate_target): New private function.
15416         (supported_target_names): Declare.
15417         * target-select.cc (Target_selector::Target_selector): Update for
15418         new parameter and fields.
15419         (select_target_by_name): Check that the name matches before
15420         calling recognize_by_name.
15421         (supported_target_names): New function.
15422         * i386.cc (class Target_selector_i386): Update Target_selector
15423         constructor call.  Remove recognize and recognize_by_name.  Add
15424         do_instantiate_target.
15425         * x86_64.cc (class Target_selector_x86_64): Likewise.
15426         * testsuite/testfile.cc (class Target_selector_test): Update for
15427         changes to Target_selector.
15428
15429         * README: Rewrite, with some notes on unsupported features.
15430
15431 2008-03-24  Cary Coutant  <ccoutant@google.com>
15432
15433         * i386.cc (Target_i386::Got_type): New enum declaration.
15434         (Target_i386::Scan::local): Updated callers of Output_data_got
15435         member functions.
15436         (Target_i386::Scan::global): Likewise.
15437         (Target_i386::Relocate::relocate): Likewise.
15438         (Target_i386::Relocate::relocate_tls): Likewise.
15439         * object.h (Got_offset_list): New class.
15440         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15441         (Sized_relobj::local_got_offset): Likewise.
15442         (Sized_relobj::set_local_got_offset): Likewise.
15443         (Sized_relobj::local_has_tls_got_offset): Removed.
15444         (Sized_relobj::local_tls_got_offset): Removed.
15445         (Sized_relobj::set_local_tls_got_offset): Removed.
15446         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15447         * output.cc (Output_data_got::add_global): Added got_type parameter.
15448         (Output_data_got::add_global_with_rel): Likewise.
15449         (Output_data_got::add_global_with_rela): Likewise.
15450         (Output_data_got::add_global_pair_with_rel): New function.
15451         (Output_data_got::add_global_pair_with_rela): New function.
15452         (Output_data_got::add_local): Added got_type parameter.
15453         (Output_data_got::add_local_with_rel): Likewise.
15454         (Output_data_got::add_local_with_rela): Likewise.
15455         (Output_data_got::add_local_pair_with_rel): New function.
15456         (Output_data_got::add_local_pair_with_rela): New function.
15457         (Output_data_got::add_global_tls): Removed.
15458         (Output_data_got::add_global_tls_with_rel): Removed.
15459         (Output_data_got::add_global_tls_with_rela): Removed.
15460         (Output_data_got::add_local_tls): Removed.
15461         (Output_data_got::add_local_tls_with_rel): Removed.
15462         (Output_data_got::add_local_tls_with_rela): Removed.
15463         * output.h (Output_data_got::add_global): Added got_type parameter.
15464         (Output_data_got::add_global_with_rel): Likewise.
15465         (Output_data_got::add_global_with_rela): Likewise.
15466         (Output_data_got::add_global_pair_with_rel): New function.
15467         (Output_data_got::add_global_pair_with_rela): New function.
15468         (Output_data_got::add_local): Added got_type parameter.
15469         (Output_data_got::add_local_with_rel): Likewise.
15470         (Output_data_got::add_local_with_rela): Likewise.
15471         (Output_data_got::add_local_pair_with_rel): New function.
15472         (Output_data_got::add_local_pair_with_rela): New function.
15473         (Output_data_got::add_global_tls): Removed.
15474         (Output_data_got::add_global_tls_with_rel): Removed.
15475         (Output_data_got::add_global_tls_with_rela): Removed.
15476         (Output_data_got::add_local_tls): Removed.
15477         (Output_data_got::add_local_tls_with_rel): Removed.
15478         (Output_data_got::add_local_tls_with_rela): Removed.
15479         * resolve.cc (Symbol::override_base_with_special): Removed
15480         reference to has_got_offset_ field.
15481         * symtab.cc (Symbol::init_fields): Replaced initialization
15482         of got_offset_ with got_offsets_.  Removed initialization
15483         of has_got_offset_
15484         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15485         (Symbol::got_offset): Likewise.
15486         (Symbol::set_got_offset): Likewise.
15487         (Symbol::has_tls_got_offset): Removed.
15488         (Symbol::tls_got_offset): Removed.
15489         (Symbol::set_tls_got_offset): Removed.
15490         (Symbol::got_offset_): Removed.
15491         (Symbol::tls_mod_got_offset_): Removed.
15492         (Symbol::tls_pair_got_offset_): Removed.
15493         (Symbol::got_offsets_): New field.
15494         (Symbol::has_got_offset): Removed.
15495         (Symbol::has_tls_mod_got_offset): Removed.
15496         (Symbol::has_tls_pair_got_offset): Removed.
15497         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15498         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15499         member functions.
15500         (Target_x86_64::Scan::global): Likewise.
15501         (Target_x86_64::Relocate::relocate): Likewise.
15502         (Target_x86_64::Relocate::relocate_tls): Likewise.
15503
15504 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15505
15506         * yyscript.y: Fix spelling error in comment.
15507
15508 2008-03-24  Ian Lance Taylor  <iant@google.com>
15509
15510         * options.h (class General_options): Define build_id option.
15511         * layout.h (class Layout): Declare write_build_id, create_note,
15512         create_build_id.  Add build_id_note_ member.
15513         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15514         "libiberty.h", "md5.h", "sha1.h".
15515         (Layout::Layout): Initialize eh_frame_data_,
15516         eh_frame_hdr_section_, and build_id_note_.
15517         (Layout::finalize): Call create_build_id.
15518         (Layout::create_note): New function, broken out of
15519         Layout::create_gold_note.
15520         (Layout::create_gold_note): Call create_note.
15521         (Layout::create_build_id): New function.
15522         (Layout::write_build_id): New function.
15523         (Close_task_runner::run): Call write_build_id.
15524
15525         * x86_64.cc: Correct license to GPLv3.
15526
15527 2008-03-23  Ian Lance Taylor  <iant@google.com>
15528
15529         * options.cc: Include "demangle.h".
15530         (parse_optional_string): New function.
15531         (parse_long_option): Handle takes_optional_argument.
15532         (parse_short_option): Update dash_z initializer.  Handle
15533         takes_optional_argument.
15534         (General_options::General_options): Initialize do_demangle_.
15535         (General_options::finalize): Set do_demangle_.  Handle demangling
15536         style.
15537         * options.h (parse_optional_string): Declare.
15538         (struct One_option): Add optional_arg field.  Update constructor.
15539         Update call constructor calls.  Add takes_optional_argument
15540         function.
15541         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15542         (DEFINE_optional_string): Define.
15543         (General_options::demangle): Change from DEFINE_bool to
15544         DEFINE_optional_string.
15545         (General_options::no_demangle): New function.
15546         (General_options::do_demangle): New function.
15547         (General_options::set_do_demangle): New function.
15548         (General_options::execstack_status_): Move definition to end of
15549         class definition.
15550         (General_options::static_): Likewise.
15551         (General_options::do_demangle_): New field.
15552         * object.cc (big_endian>::get_symbol_location_info): Call
15553         Options::do_demangle, not Options::demangle.
15554         * symtab.cc (demangle): Likewise.
15555
15556 2008-03-22  Ian Lance Taylor  <iant@google.com>
15557
15558         * gold.h: Include <cstddef> and <sys/types.h>
15559         * options.h: Include <cstring>.
15560
15561 2008-03-21  Ian Lance Taylor  <iant@google.com>
15562
15563         * Added source code to GNU binutils.
15564 \f
15565 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15566
15567 Copying and distribution of this file, with or without modification,
15568 are permitted in any medium without royalty provided the copyright
15569 notice and this notice are preserved.
15570
15571 Local Variables:
15572 mode: change-log
15573 left-margin: 8
15574 fill-column: 74
15575 version-control: never
15576 End: