Update ChangeLog from earlier patch.
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-02-10  Alan Modra  <amodra@gmail.com>
2
3         * po/gold.pot: Regenerate.
4
5 2014-02-06  Cary Coutant  <ccoutant@google.com>
6
7         Fix problem where -u is ignored when a weak undef is seen.
8
9         * archive.cc (Library_base::should_include_member): Reorder
10         code to check for -u option if a weak undef has already been seen.
11         * testsuite/Makefile.am (weak_undef_test_2): New test case.
12         * testsuite/Makefile.in: Regenerate.
13         * testsuite/weak_undef_file3.cc: New file.
14         * testsuite/weak_undef_file4.cc: New file.
15         * testsuite/weak_undef_test_2.cc: New file.
16
17 2014-02-05  Cary Coutant  <ccoutant@google.com>
18
19         Fix issues with gold undefined symbol diagnostics.
20
21         PR binutils/15435
22         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
23         check to here.
24         * target-reloc.h (is_strong_undefined): New function.
25         (relocate_section): Move undef vtable symbol check from here.
26         Check for is_strong_undefined.
27
28 2014-02-05  Cary Coutant  <ccoutant@google.com>
29     
30         Fix problems with the --dynamic-list option.
31
32         PR gold/13577
33         * options.cc (General_options::parse_dynamic_list):
34         Set have_dynamic_list_.
35         (General_options::General_options): Initialize have_dynamic_list_.
36         (General_options::finalize): Turn off -Bsymbolic and
37         -Bsymbolic-functions if --dynamic-list provided.
38         * options.h (General_options::have_dynamic_list): New function.
39         (General_options::have_dynamic_list_): New data member.
40         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
41         correctly.
42    
43         PR gold/16530
44         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
45         in --dynamic-list, mark it.
46    
47         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
48         (dynamic_list_2): New test case.
49         * testsuite/Makefile.in: Regenerate.
50         * testsuite/dynamic_list_2.cc: New file.
51         * testsuite/dynamic_list_2.t: New file.
52         * testsuite/dynamic_list_lib1.cc: New file.
53         * testsuite/dynamic_list_lib2.cc: New file.
54         * testsuite/gc_dynamic_list_test.c: New file.
55         * testsuite/gc_dynamic_list_test.sh: New file.
56         * testsuite/gc_dynamic_list_test.t: New file.
57
58 2014-01-28  Cary Coutant  <ccoutant@google.com>
59
60         Add .gdb_index version 7 support.
61
62         * gold/dwarf_reader.cc: include <utility> (for make_pair).
63         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
64         debug sections.
65         (Dwarf_ranges_table::read_ranges_table): Likewise.
66         (Dwarf_pubnames_table::read_section): Check for GNU-style
67         sections, and for compressed debug sections.
68         (Dwarf_pubnames_table::read_header): Compute end address of table.
69         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
70         for end of list by offset, not by offset == 0.
71         (Dwarf_info_reader::do_read_string_table): Check for compressed
72         debug sections.
73         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
74         Initialize new data members.
75         (Dwarf_pubnames_table::next_name): return flag_byte.
76         (Dwarf_pubnames_table::end_of_table_): New data member.
77         (Dwarf_pubnames_table::is_gnu_style_): New data member.
78         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
79         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
80         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
81         read skeleton type unit DIEs.
82         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
83         (Gdb_index::do_write): Write flag_byte.
84         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
85         (Gdb_index::Cu_vector): Store flags along with cu indexes.
86         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
87         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
88
89 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
90
91         * version.cc (print_version): Update copyright year to 2014.
92
93 2013-12-19  Dimitry Andric  <dimitry@andric.com>
94
95         * stringpool.cc (Stringpool_template::reserve): Add
96         HAVE_UNORDERED_MAP case.
97         * stringpool.cc (Stringpool_template::print_stats): Likewise.
98
99 2013-12-18  Cary Coutant  <ccoutant@google.com>
100
101         * configure.ac: Check for <unordered_set> and <unordered_map>.
102         * config.in: Regenerate.
103         * configure: Regenerate.
104         * system.h: Use <unordered_set> and <unordered_map> if available.
105
106 2013-12-10  Roland McGrath  <mcgrathr@google.com>
107
108         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
109         with $(INSTALL_PROGRAM_ENV).
110         * Makefile.in: Regenerate.
111
112 2013-11-22  Cary Coutant  <ccoutant@google.com>
113
114         * configure.ac: Add check for which library is needed for
115         dlopen.
116         * configure: Regenerate.
117
118 2013-11-22  Cary Coutant  <ccoutant@google.com>
119
120         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
121         assembler.
122         * testsuite/Makefile.in: Regenerate.
123
124 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
125
126         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
127         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
128         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
129         (Target_x86_64<size>::Scan::local): Likewise.
130         (Target_x86_64<size>::Scan::global): Likewise.
131         (Target_x86_64<size>::Relocate::relocate): Likewise.
132         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
133         Likewise.
134         (Target_x86_64<size>::Scan::check_non_pic(): Handle
135         R_X86_64_PC32_BND.
136
137         * testsuite/Makefile.am (check_PROGRAMS): Add
138         exception_x86_64_bnd_test.
139         (exception_x86_64_bnd_test_SOURCES): New macro.
140         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
141         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
142         (exception_x86_64_bnd_test_LDADD): Likewise.
143         (exception_x86_64_bnd_1.o): New rule.
144         (exception_x86_64_bnd_2.o): Likewise.
145         * testsuite/Makefile.in: Regenerated.
146
147 2013-11-15  Alan Modra  <amodra@gmail.com>
148
149         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
150         accessor.
151         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
152         Only call ppc64_local_entry_offset for 64-bit.  Restrict
153         symval_for_branch lookup to ELFv1.
154         (Stub_table::add_plt_call_entry): Use unsigned int off.
155         (Output_data_glink::Address, invalid_address): New.
156         (Output_data_glink::add_eh_frame): Move out of line.  Add
157         support for ELFv2.
158         (Output_data_glink::add_global_entry, find_global_entry,
159         global_entry_address): New functions.
160         (Output_data_glink::global_entry_stubs_, end_branch_table_,
161         ge_size): New variables.
162         (Output_data_glink::set_final_data_size): Add global entry
163         stub sizing.
164         (Output_data_glink::do_write): Write global entry stubs.
165         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
166         parameter.  Return true for ELFv2.  Adjust callers.
167         (Target_powerpc::Scan::local, global): Restrict opd lookup to
168         ELFv1.  Similarly for ifunc and dynamic relocation processing
169         specific to ELFv1.  Recognize that symbols are defined on
170         their plt entries for ELFv2.
171         (Target_powerpc::symval_for_branch): Assert if called for
172         ELFv2 or ppc32.
173         (Target_powerpc::Relocate::relocate): Use global entry plt
174         stub for symbol value if such exists on ELFv2.
175         (Target_powerpc::Relocate::relocate): Don't call
176         symval_for_branch when ELFv2.  Do adjust for local entry
177         offset when ELFv2.
178         (Target_powerpc::do_dynsym_value): Set symbols to global entry
179         plt stub for ELFv2.
180         (Target_powerpc::do_plt_address_for_global): Similarly.
181
182 2013-11-14  Cary Coutant  <ccoutant@google.com>
183
184         Revert patch -- this did not fix the problem, and there is
185         no race there.
186
187         2013-11-14  Cary Coutant  <ccoutant@google.com>
188
189             PR gold/14860
190             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
191             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
192             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
193             updating fde_offsets_.
194             (Eh_frame_hdr::lock_): New data member.
195
196 2013-11-14  Cary Coutant  <ccoutant@google.com>
197
198         * dwp.cc (Dwo_file_entry): New type.
199         (File_list): Use Dwo_file_entry.
200         (Dwo_file::verify): New function.
201         (Dwo_file::verify_dwo_list): New function.
202         (Dwo_file::sized_verify_dwo_list): New function.
203         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
204         list.
205         (Dwp_options): New enum type.
206         (dwp_options): Add --verify-only.
207         (usage): Likewise.
208         (main): Likewise.
209         * dwp.h (gold_info): Add declaration.
210
211 2013-11-14  Cary Coutant  <ccoutant@google.com>
212
213         PR gold/14860
214         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
215         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
216         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
217         updating fde_offsets_.
218         (Eh_frame_hdr::lock_): New data member.
219
220 2013-11-06  Cary Coutant  <ccoutant@google.com>
221
222         PR gold/15758
223         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
224         before reloc sections.
225
226 2013-11-04  Alan Modra  <amodra@gmail.com>
227
228         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
229         (Symbol::needs_dynamic_reloc): Test new flag.
230         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
231         (Target_powerpc::Scan::get_reference_flags): Add target param.
232         Return FUNC_DESC_ABI for 64-bit ELFv1.
233         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
234         call.
235         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
236         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
237
238 2013-10-31  Cary Coutant  <ccoutant@google.com>
239
240         Restore support for dwp v2 DWARF package file format.
241
242         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
243         tu_length parameter.  Adjust all callers.
244         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
245         * dwp.cc: Include dwarf.h.
246         (Section_bounds): New struct type.
247         (Unit_set): New struct type.
248         (Dwo_file::Dwo_file): Initialize new data member.
249         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
250         Combine and rename to...
251         (Dwo_file::read_unit_index): ...this.
252         (Dwo_file::sized_read_compunit_index)
253         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
254         (Dwo_file::sized_read_unit_index): ...this.
255         (Dwo_file::copy_section): Remove section_name, is_str_offsets
256         parameters; add section_id parameter.
257         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
258         (Dwo_file::add_unit_set): ...this.
259         (Dwo_file::shndx_map_): Remove.
260         (Dwo_file::sect_offsets_): New data member.
261         (Dwp_output_file::Dwp_output_file): Initialize new data members.
262         (Dwp_output_file::add_section): Rename to...
263         (Dwp_output_file::add_contribution): ...this.
264         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
265         (Dwp_output_file::add_tu_set): Likewise.
266         (Dwp_output_file::Contribution): New type.
267         (Dwp_output_file::Section::contributions): New data member.
268         (Dwp_output_file::Cu_or_tu_set): Remove.
269         (Dwp_output_file::Section::Section): New ctor.
270         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
271         (Dwp_output_file::Dwp_index::Section_table): New type.
272         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
273         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
274         parameter.
275         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
276         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
277         (Dwp_output_file::Dwp_index::section_table): New member function.
278         (Dwp_output_file::Dwp_index::section_table_end): New member function.
279         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
280         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
281         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
282         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
283         (Dwp_output_file::Dwp_index::section_table_): New data member.
284         (Dwp_output_file::Dwp_index::section_mask_): New data member.
285         (Dwp_output_file::add_output_section): New member function.
286         (Dwp_output_file::write_new_section): New member function.
287         (Dwp_output_file::write_contributions): New member function.
288         (Dwp_output_file::section_id_map_): New data member.
289         (class Dwo_id_info_reader): Remove.
290         (class Unit_reader): New class.
291         (get_dwarf_section_name): New function.
292         (Dwo_file::read_executable): Adjust initializations of class data.
293         (Dwo_file::read): Add support for v2 package file format.
294         (Dwo_file::read_unit_index): Likewise.
295         (Dwo_file::sized_read_unit_index): Likewise.
296         (Dwo_file::copy_section): Likewise.
297         (Dwo_file::add_unit_set): Likewise.
298         (Dwp_output_file::add_output_section): Likewise.
299         (Dwp_output_file::add_contribution): Likewise.
300         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
301         for empty slot.
302         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
303         file format.
304         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
305         slot.
306         (Dwp_output_file::initialize): Remove unused function.
307         (Dwp_output_file::finalize): Add support for v2 package file format.
308         (Dwp_output_file::write_index): Likewise.
309         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
310         function prototype.
311
312 2013-10-31  Cary Coutant  <ccoutant@google.com>
313
314         * configure.ac: Fix check for -fmerge-constants.
315         * configure.ac: Regenerate.
316
317 2013-10-30  Roland McGrath  <mcgrathr@google.com>
318
319         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
320         Correct 9-byte nop sequence to match what the assembler generates.
321
322 2013-10-30  Alan Modra  <amodra@gmail.com>
323
324         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
325         ppc64_local_entry_offset, ppc64_local_entry_offset,
326         do_read_symbols): New functions.
327         (Powerpc_relobj::e_flags_, st_other_): New vars.
328         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
329         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
330         (Powerpc_relobj::e_flags_): New var.
331         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
332         and adjust for ELFv2.
333         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
334         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
335         (Powerpc_dynobj::do_find_special_sections): Likewise.
336         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
337         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
338         to ELFv2 local entry.
339         (Target_powerpc::do_relax): No thread safe barriers needed for
340         ELFv2.
341         (Output_data_plt_powerpc::initial_plt_entry_size_,
342         plt_entry_size): Delete.  Replace all uses with
343         first_plt_entry_offset() and plt_entry_size().
344         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
345         reserved_size parm.  Update callers.
346         (Output_data_plt_powerpc::entry_count): Update.
347         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
348         and use Target_powerpc::first_plt_entry_offset().
349         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
350         rename to plt_entry_size.
351         (Output_data_plt_powerpc::add_ifunc_entry,
352         add_local_ifunc_entry): Adjust reloc for ELFv2.
353         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
354         (glink_eh_frame_fde_64v2): New.
355         (Stub_table::plt_call_size): Support ELFv2 sizing.
356         (Output_data_glink::add_eh_frame): Use the new FDE.
357         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
358         (Stub_table::do_write): Write ELFv2 stubs and glink.
359         (Target_powerpc::Relocate::relocate): Replaces nop after call
360         with ld 2,24(1) and adjust local offset destination for ELFv2.
361
362 2013-10-30  Alan Modra  <amodra@gmail.com>
363
364         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
365         (Target_powerpc::Scan::global, local): Likewise.
366         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
367         on all ppc64 @h and @ha relocs.
368
369 2013-10-14  Alan Modra  <amodra@gmail.com>
370
371         * output.h (Output_data_got::add_constant): Tidy.
372         (Output_data_got::add_constant_pair): New function.
373         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
374         methods used so as to first call reserve_ent().
375
376 2013-10-11  Roland McGrath  <mcgrathr@google.com>
377
378         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
379         add_got_entry and add_got_entry_pair.
380
381         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
382         (HAVE_PUBNAMES): Likewise.
383         * configure: Regenerate.
384
385         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
386         * testsuite/Makefile.in: Regenerate.
387
388         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
389         Remove const from declaration.
390         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
391         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
392         * output.h (Output_file_header): Remove const from member target_
393         and corresponding constructor argument.
394         * output.cc (Output_file_header::Output_file_header): Update prototype.
395         (Output_file_header::do_sized_write): Use this->target_ in place
396         of parameters()->target().
397
398         * testsuite/undef_symbol.cc (Foo::get_a): New method.
399
400         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
401         * configure: Regenerate.
402         * Makefile.in: Regenerate.
403         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
404         * testsuite/merge_string_literals_2.c: Likewise.
405         * testsuite/Makefile.am
406         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
407         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
408         literal -fmerge-constants.
409         * testsuite/Makefile.in: Regenerate.
410
411         * i386.cc (Target_i386): Remove unused member dynbss_.
412         * arm.cc (Target_arm): Likewise.
413         * powerpc.cc (Target_powerpc): Likewise.
414         * sparc.cc (Target_sparc): Likewise.
415         * tilegx.cc (Target_tilegx): Likewise.
416         * x86_64.cc (Target_x86_64): Likewise.
417         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
418         type_signature_, type_offset_.
419         * plugin.h (Plugin_hook): Remove unused member layout_.
420         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
421         mapfile_.
422         (Read_member): Remove unused members input_objects_, symtab_,
423         mapfile_, layout_.
424         (Check_library): Remove unused member symtab_.
425         * archive.h (Lib_group): Remove unused member lib_.
426         * archive.cc (Lib_group::Lib_group): Update initializer.
427         * incremental.h (Incremental_binary): Remove unused member target_.
428         (Incremental_script_entry): Removed unused member script_.
429         * layout.h (Write_symbols_task): Remove unused member input_objects_.
430         * icf.h (Icf): Remove unused member num_tracked_relocs.
431
432         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
433         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
434         its only use.
435         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
436
437         * archive.h: Use struct rather than class for forward declaration
438         of Read_symbols_data.
439
440 2013-10-07  Cary Coutant  <ccoutant@google.com>
441
442         PR gold/16010
443         * testsuite/Makefile.am (icf_test): Fix dependencies.
444         (icf_safe_test): Likewise.
445         (icf_safe_so_test): Likewise.
446         (large_symbol_alignment): Add empty _LDADD rule.
447         * testsuite/Makefile.in: Regenerate.
448
449 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
450
451         PR gold/15927
452         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
453         relocation for R_X86_64_32 on x32.
454
455 2013-08-27  Roland McGrath  <mcgrathr@google.com>
456
457         * output.cc (Output_segment::set_section_addresses): Take new
458         Target* argument.  If target->isolate_execinstr() and the segment
459         is executable and starts at a target->abi_pagesize() boundary,
460         pad its end out to a target->abi_pagesize() boundary with code fill.
461         * output.h (Output_segment::set_section_addresses): Update decl.
462         * layout.h (Layout::check_output_data_for_reset_values): Take new
463         argument RELAX_OUTPUTS.
464         (Layout): New member relax_output_list_.
465         (Layout::add_relax_output): New method.
466         * layout.cc (Layout::Layout): Update constructor.
467         (Layout::reset_relax_output): New method.
468         (Layout::clean_up_after_relaxation): Call it.
469         (Layout::prepare_for_relaxation): Update caller.
470         (Layout::set_segment_offsets): Update callers of set_section_addresses.
471         Call reset_relax_output before re-processing segments for
472         isolate_execinstr case.
473         (Layout::write_data): Handle relax_output_list_.
474         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
475         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
476
477 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
478
479         PR binutils/15834
480         * object.h: Fix typos.
481
482 2013-08-16  Roland McGrath  <mcgrathr@google.com>
483
484         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
485         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
486
487 2013-08-07  Cary Coutant  <ccoutant@google.com>
488
489         Revert support for v2 DWP files:
490
491         2013-03-01  Cary Coutant  <ccoutant@google.com>
492
493             Add dwp support for v2 DWARF package file format.
494             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
495             tu_length parameter.  Adjust all callers.
496             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
497             * dwp.cc: Include dwarf.h.
498             (Section_bounds): New struct type.
499             (Unit_set): New struct type.
500             (Dwo_file::Dwo_file): Initialize new data member.
501             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
502             Combine and rename to...
503             (Dwo_file::read_unit_index): ...this.
504             (Dwo_file::sized_read_compunit_index)
505             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
506             (Dwo_file::sized_read_unit_index): ...this.
507             (Dwo_file::copy_section): Remove section_name, is_str_offsets
508             parameters; add section_id parameter.
509             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
510             (Dwo_file::add_unit_set): ...this.
511             (Dwo_file::shndx_map_): Remove.
512             (Dwo_file::sect_offsets_): New data member.
513             (Dwp_output_file::Dwp_output_file): Initialize new data members.
514             (Dwp_output_file::add_section): Rename to...
515             (Dwp_output_file::add_contribution): ...this.
516             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
517             (Dwp_output_file::add_tu_set): Likewise.
518             (Dwp_output_file::Contribution): New type.
519             (Dwp_output_file::Section::contributions): New data member.
520             (Dwp_output_file::Cu_or_tu_set): Remove.
521             (Dwp_output_file::Section::Section): New ctor.
522             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
523             (Dwp_output_file::Dwp_index::Section_table): New type.
524             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
525             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
526             parameter.
527             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
528             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
529             (Dwp_output_file::Dwp_index::section_table): New member function.
530             (Dwp_output_file::Dwp_index::section_table_end): New member function.
531             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
532             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
533             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
534             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
535             (Dwp_output_file::Dwp_index::section_table_): New data member.
536             (Dwp_output_file::Dwp_index::section_mask_): New data member.
537             (Dwp_output_file::add_output_section): New member function.
538             (Dwp_output_file::write_new_section): New member function.
539             (Dwp_output_file::write_contributions): New member function.
540             (Dwp_output_file::section_id_map_): New data member.
541             (class Dwo_id_info_reader): Remove.
542             (class Unit_reader): New class.
543             (get_dwarf_section_name): New function.
544             (Dwo_file::read_executable): Adjust initializations of class data.
545             (Dwo_file::read): Add support for v2 package file format.
546             (Dwo_file::read_unit_index): Likewise.
547             (Dwo_file::sized_read_unit_index): Likewise.
548             (Dwo_file::copy_section): Likewise.
549             (Dwo_file::add_unit_set): Likewise.
550             (Dwp_output_file::add_output_section): Likewise.
551             (Dwp_output_file::add_contribution): Likewise.
552             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
553             for empty slot.
554             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
555             file format.
556             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
557             slot.
558             (Dwp_output_file::initialize): Remove unused function.
559             (Dwp_output_file::finalize): Add support for v2 package file format.
560             (Dwp_output_file::write_index): Likewise.
561             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
562             function prototype.
563
564 2013-07-31  Cary Coutant  <ccoutant@google.com>
565
566         * object.cc (Sized_relobj::do_output_section_address): New function.
567         (Sized_relobj): Instantiate explicitly.
568         * object.h (Object::output_section_address): New function.
569         (Object::do_output_section_address): New function.
570         (Sized_relobj::do_output_section_address): New function.
571         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
572
573 2013-07-30  Cary Coutant  <ccoutant@google.com>
574             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
575
576         * parameters.cc (Parameters::entry): Return target-specific entry
577         symbol name.
578         * target.h (Target::entry_symbol_name): New function.
579         (Target_info::entry_symbol_name): New data member.
580
581         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
582         * i386.cc (Target_i386::i386_info): Likewise.
583         (Target_i386_nacl::i386_nacl_info): Likewise.
584         * sparc.cc (Target_sparc::sparc_info): Likewise.
585         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
586         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
587         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
588         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
589
590 2013-07-22  Sterling Augustine  <saugustine@google.com>
591
592         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
593         Convert parameter shndx to local variable. Add parameters symtab
594         and symtab_size.  Scan over section names.  Find relocation
595         section corresponding to current section.  Create and initialize
596         reloc_mapper_ and reloc_type_.
597         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
598         unit_length to off_t.  Initialize member unit_length_.  Fill in field
599         cu_offset_.
600         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
601         Initialize new fields unit_length_ and cu_offset_.
602         (Dwarf_pubnames_table::read_section): Update prototype.
603         (Dwarf_pubnames_table::cu_offset): New member function.
604         (Dwarf_pubnames_table::subsection_size): Likewise.
605         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
606         New fields.
607         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
608         member functions public.
609         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
610         Update comment.  Rework logic.  Move repeated parts to...
611         (Gdb_index_info_reader::read_pubtable): ...here. New function.
612         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
613         pubtypes_table_, and stmt_list_offset.
614         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
615         Gdb_index::find_pubtype_offset,
616         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
617         (Gdb_index::pubnames_read): Update prototype and rework logic.
618         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
619         Forward declare.
620         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
621         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
622         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
623         Gdb_index::map_pubtable_to_dies):
624         Declare functions.
625         (Gdb_index::pubnames_read): Update declaration.
626         (Gdb_index::Pubname_offset_map): New type.
627         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
628         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
629         Gdb_index::stmt_list_offset): Declare.
630         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
631         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
632         Gdb_index::pubtypes_offset_): Remove.
633
634 2013-07-19  Roland McGrath  <mcgrathr@google.com>
635
636         * options.h (General_options): Add -Trodata-segment option.
637         * parameters.cc (Parameters::check_rodata_segment): New function.
638         (Parameters::set_target_once): Call it.
639         * parameters.h (Parameters): Declare it (private member function).
640         * layout.cc (load_seg_unusable_for_headers): New function, broken
641         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
642         then validate rodata segment rather than text segment.
643         (relaxation_loop_body): Call that.
644         (is_text_segment): New function.  Don't admit a non-executable
645         segment if TARGET->isolate_execinstr().
646         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
647
648 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
649
650         PR gold/15070
651         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
652         * nacl.h (Sniff_file::View::View): Request aligned view.
653
654 2013-07-11  Cary Coutant  <ccoutant@google.com>
655
656         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
657         correct BRLT entry size.
658
659 2013-07-03  Alan Modra  <amodra@gmail.com>
660
661         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
662         comment.
663
664 2013-07-01  Cary Coutant  <ccoutant@google.com>
665
666         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
667         reloc_type_.
668         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
669         (Dwarf_ranges_table::lookup_reloc): New function.
670         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
671         reloc_type_.
672         (Dwarf_ranges_table::lookup_reloc): New function.
673         (Dwarf_ranges_table::reloc_type_): New data member.
674
675 2013-06-27  Jing Yu  <jingyu@google.com>
676
677         PR gold/15662
678         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
679         function.
680         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
681         (Target_powerpc::do_relax): Call the above.
682
683 2013-06-27  Cary Coutant  <ccoutant@google.com>
684
685         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
686         on garbage collected .opd section.
687
688 2013-06-27  Alan Modra  <amodra@gmail.com>
689
690         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
691         is non-zero.
692         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
693         (Target_powerpc::do_function_location): Likewise for loc->shndx.
694
695 2013-06-14  Cary Coutant  <ccoutant@google.com>
696
697         * resolve.cc (Symbol::override_base): Don't override st_type
698         from plugin placeholder symbols.
699         (Symbol_table::resolve): Likewise.
700         (Symbol_table::should_override): Don't complain about TLS mismatch
701         if the TO symbol is a plugin placeholder.
702         * testsuite/Makefile.am (plugin_test_tls): New test.
703         * testsuite/Makefile.in: Regenerate.
704         * testsuite/plugin_test_tls.sh: New test script.
705         * testsuite/two_file_test_2_tls.cc: New test source.
706         * testsuite/two_file_test_tls.cc: New test source.
707
708 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
709
710         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
711         the maximum segment alignment is larger than the page size.
712         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
713         correctly aligns the symbols with large alignemnt.
714         * testsuite/Makefile.in: Regenerate.
715         * testsuite/large_symbol_alignment.cc: New file.
716
717 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
718             Sriraman Tallam  <tmsriram@google.com>
719
720         * options.h (sort_section): New option.
721         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
722         Rename from Input_section_sort_section_name_special_ordering_compare.
723         (Input_section_sort_section_name_compare): New struct.
724         * output.cc (Output_section::Input_section_sort_section_name_compare::
725         operator()): New function.
726         (Output_section::sort_attached_input_sections): Use new sort function
727         for .text if --sort-section=name is specified.
728         * layout.cc (Layout::make_output_section):
729         Add sorting by name when --sort-section=name is specified.
730         * testsuite/Makefile.am (text_section_grouping): Test option
731         --sort-section=name.
732         * testsuite/Makefile.in: Regenerate.
733         * testsuite/section_sorting_name.cc: New file.
734         * testsuite/section_sorting_name.sh: New file.
735
736 2013-05-21  Cary Coutant  <ccoutant@google.com>
737
738         * symtab.h (Symbol::is_cxx_vtable): New function.
739         * target-reloc.h (relocate_section): Check for vtable symbol.
740         * testsuite/Makefile.am (missing_key_func.sh): New test case.
741         * testsuite/Makefile.in: Regenerate.
742         * testsuite/missing_key_func.cc: New test source.
743         * testsuite/missing_key_func.sh: New test script.
744
745 2013-05-21  Cary Coutant  <ccoutant@google.com>
746
747         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
748         type of enclosing symbol.
749         (Relocate_info::location): Check symbol type when describing symbol.
750         * object.h (Symbol_location_info): Remove unused line_number;
751         add enclosing_symbol_type.
752         * testsuite/debug_msg.sh: Adjust expected output.
753
754 2013-05-13  Cary Coutant  <ccoutant@google.com>
755
756         * configure.ac: Export DEFAULT_TARGET.
757         * configure: Regenerate.
758         * Makefile.in: Regenerate.
759         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
760         * testsuite/Makefile.in: Regenerate.
761         * testsuite/debug_msg.sh: Delete duplicate tests.
762         Don't check undef_int error message match for powerpc where the
763         source file and line number aren't available.
764
765 2013-05-10  Roland McGrath  <mcgrathr@google.com>
766
767         * options.h (General_options): Add --rosegment-gap option.
768         * options.cc (finalize): --rosegment-gap implies --rosegment.
769         * layout.cc (set_segment_offsets): Let user option override
770         target->rosegment_gap().
771
772 2013-05-10  Roland McGrath  <mcgrathr@google.com>
773
774         * options.h (General_options): Remove leading space from help
775         messages for -nostdlib and --rosegment.
776
777 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
778
779         PR ld/15365
780         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
781
782 2013-05-03  Alan Modra  <amodra@gmail.com>
783
784         * merge.cc (Output_merge_string::do_add_input_section): Correct
785         scan for number of strings.  Rename vars to avoid shadowing.
786         Include missing terminator in input_size_.
787
788 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
789
790         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
791         Restore empty string handling.
792
793 2013-05-01  Cary Coutant  <ccoutant@google.com>
794
795         * stringpool.cc (Stringpool_template::new_key_offset): Fix
796         uninitialized warning.
797
798 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
799
800         * output.cc (Output_section::add_merge_input_section): Allow
801         to merge sections if the alignment is more than character size.
802         * merge.h (Output_merge_string::Output_merge_string): Remove
803         assert.
804         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
805         only not-null strings. Check the alignment of strings.
806         * stringpool.h
807         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
808         alignment as the argument.
809         (Stringpool_template<Stringpool_char>::addralign_): New class member.
810         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
811         Align non-zero length strings according to the addralign_.
812         (Stringpool_template<Stringpool_char>::set_string_offsets):
813         Updating offsets according to the given alignment.
814         * testsuite/Makefile.am (text_section_grouping): Test if string
815         literals are getting merged.
816         * testsuite/Makefile.in: Regenerate.
817         * testsuite/merge_string_literals_1.c: New file.
818         * testsuite/merge_string_literals_2.c: Ditto.
819         * testsuite/merge_string_literals.sh: Ditto.
820
821 2013-04-26  Ian Lance Taylor  <iant@google.com>
822
823         * target-reloc.h (relocate_section): If the reloc offset is out of
824         range, pass VIEW as NULL to relocate.relocate.
825         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
826         * i386.cc (Target_i386::Relocate::relocate): Likewise.
827         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
828         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
829         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
830         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
831
832 2013-04-26  Geoff Pike  <gpike@chromium.org>
833
834         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
835         * layout.cc (Hash_task): New class.
836         (Layout::queue_build_id_tasks): New function.
837         (Layout::write_build_id): Handle single-thread portion of build ID
838         computation.  (In some cases, all of it is single-threaded.)  Replace
839         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
840         functionality in fewer lines of code.
841         * layout.h (Layout::queue_build_id_tasks): New function declaration.
842         * options.h (General_options): make "--build-id" default to tree
843         rather than sha1.  Add two new options related to --build-id=tree:
844         --build-id-chunk-size-for-treehash and
845         --build-id-min-file-size-for-treehash.
846         * Makefile.am: add testing of --build-id=tree and related new options
847         (these tests will be invoked by "make check").
848         * Makefile.in: Regenerate.
849
850 2013-04-25  Alan Modra  <amodra@gmail.com>
851
852         * configure.tgt: Add powerpcle and powerpc64le.
853
854 2013-04-22  Alan Modra  <amodra@gmail.com>
855
856         PR gold/15355
857         * layout.cc (Layout::segment_precedes): Allow more than one
858         segment with the same type and flags.
859
860 2013-04-15  Cary Coutant  <ccoutant@google.com>
861
862         * layout.cc (Layout::set_relocatable_section_offsets): Don't
863         allocate space in file for BSS sections.
864
865 2013-04-15  Cary Coutant  <ccoutant@google.com>
866
867         * script-sections.cc (Orphan_output_section): Reset address
868         to zero after each orphaned section for relocatable links.
869
870 2013-04-15  Cary Coutant  <ccoutant@google.com>
871
872         * symtab.cc (Symbol_table::sized_write_globals): Subtract
873         section starting address for relocatable link.
874         * testsuite/Makefile.am (script_test_11): New test.
875         * testsuite/Makefile.in: Regenerate.
876         * testsuite/script_test_11.c: New source file.
877         * testsuite/script_test_11.t: New linker script.
878
879 2013-04-13  Alan Modra  <amodra@gmail.com>
880
881         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
882         owner when sections are not adjacent and exceed group size.
883         (Target_powerpc::group_sections): Handle corner case.
884         (Target_powerpc::Branch_info::make_stub): Handle case where
885         stub table doesn't exist due to branches in non-exec sections.
886         (Target_powerpc::Relocate::relocate): Likewise.
887
888 2013-04-11  Alan Modra  <amodra@gmail.com>
889
890         PR gold/15354
891         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
892         .branch_lt to match bfd ld.  Adjust comments throughout file.
893
894 2013-04-04  Ian Lance Taylor  <iant@google.com>
895
896         GCC PR c++/56840
897         * object.cc (do_layout_deferred_sections): Handle .eh_frame
898         sections before checking whether they are included in the link.
899
900 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
901
902         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
903         object before calling the plugin claim_file handler.  Pass the elf
904         object of the archive to the plugin. Delete the elf object if the
905         plugin claims the file.
906
907 2013-03-21  Alan Modra  <amodra@gmail.com>
908
909         * layout.cc (Layout::set_segment_offsets): Accept writable .text
910         segment when omagic.
911
912 2013-03-21  Alan Modra  <amodra@gmail.com>
913
914         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
915         comparison warning.
916         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
917         uninitialized" warning.
918
919 2013-03-20  Alan Modra  <amodra@gmail.com>
920
921         * symtab.h (Symbol::clear_version): New function.
922         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
923         is_needed by weak references.  Clear version for symbols defined
924         in as-needed objects that are not needed.
925
926 2013-03-15  Alan Modra  <amodra@gmail.com>
927
928         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
929         static and public.  Add report_err param.  Return false for data refs.
930         (Target_powerpc::rela_dyn_section): New overloaded function.
931         (Target_powerpc::plt_, iplt_): Elucidate.
932         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
933         (Output_data_plt_powerpc::do_write): Don't write .iplt.
934         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
935         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
936         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
937         push_branch and make_plt_entry for ifunc syms when
938         reloc_needs_plt_for_ifunc.
939         (Target_powerpc::Relocate::relocate): Don't use plt entry value
940         for ifunc unless reloc_needs_plt_for_ifunc.
941
942 2013-03-15  Alan Modra  <amodra@gmail.com>
943
944         * gc.h (gc_process_relocs): Don't look through function descriptors.
945         * icf.cc (get_section_contents): Do so here instead.
946
947 2013-03-13  Alan Modra  <amodra@gmail.com>
948
949         * powerpc.cc (is_branch_reloc): Forward declare.
950         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
951         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
952         false for 64-bit, true for 32-bit non-branch relocs.
953         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
954         * testsuite/Makefile.am (icf_test): Use linker map file instead of
955         nm output.
956         (icf_safe_test): Generate linker map file as well as nm output.
957         (icf_safe_so_test): Likewise.
958         * testsuite/Makefile.in: Regenerate.
959         * testsuite/icf_test.sh: Parse linker map file to determine
960         section folding.
961         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
962         * testsuite/icf_safe_so_test.sh: Likewise.
963         (X86_32_or_ARM_specific_safe_fold): Merge into..
964         (arch_specific_safe_fold): ..this.
965         (X86_64_specific_safe_fold): Delete unused function.
966
967 2013-03-12  Alan Modra  <amodra@gmail.com>
968
969         * gc.h (gc_process_relocs): Look through function descriptors
970         to determine shndx, symvalue and addend used by ICF.  Tidy
971         variable duplication.
972
973 2013-03-11  Alan Modra  <amodra@gmail.com>
974
975         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
976         * layout.cc (Layout_task_runner::run): ..to here.
977         * symtab.h (struct Symbol_location): Extract from..
978         (class Symbol_table): ..here.
979         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
980         * target.h (class Target): Add function_location and
981         do_function_location functions.
982         (class Sized_target): Add do_function_location.
983         * object.h (class Sized_relobj_file): Move find_shdr..
984         (class Object): ..to here.
985         * object.cc: Likewise.  Update to suit.  Instantiate.
986         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
987         * powerpc.cc (class Powerpc_dynobj): New.
988         (Target_powerpc::do_function_location): New function.
989         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
990         (Powerpc_dynobj::do_read_symbols): New function.
991         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
992
993 2013-03-08  Ian Lance Taylor  <iant@google.com>
994
995         * options.cc (General_options::string_to_object_format): Accept
996         "default".
997
998 2013-03-08  Alan Modra  <amodra@gmail.com>
999
1000         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1001         pointer to Post_fde.
1002         (struct Post_fde): Move definition to here..
1003         * ehframe.cc (struct Post_fde): ..from here.
1004         (Cie::write): Don't alloc Post_fde.
1005         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1006
1007 2013-03-07  Alan Modra  <amodra@gmail.com>
1008
1009         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1010         relocation referencing .LC0.
1011         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1012
1013 2013-03-07  Alan Modra  <amodra@gmail.com>
1014
1015         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1016         always_inline.  Add assembly for powerpc to avoid GOT.
1017
1018 2013-03-07  Alan Modra  <amodra@gmail.com>
1019
1020         * testsuite/script_test_10.sh: Don't test .bss section
1021         header number.
1022
1023 2013-03-06  Alan Modra  <amodra@gmail.com>
1024
1025         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1026         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1027         all callers.  Handle folded sections.
1028         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1029         to Powerpc_relobj.
1030         (Global_symbol_visitor_opd::operator()): Likewise.
1031
1032 2013-03-04  Alan Modra  <amodra@gmail.com>
1033
1034         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1035         * testsuite/Makefile.in: Regenerate.
1036
1037 2013-03-01  Cary Coutant  <ccoutant@google.com>
1038
1039         Add dwp support for v2 DWARF package file format.
1040         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1041         tu_length parameter.  Adjust all callers.
1042         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1043         * dwp.cc: Include dwarf.h.
1044         (Section_bounds): New struct type.
1045         (Unit_set): New struct type.
1046         (Dwo_file::Dwo_file): Initialize new data member.
1047         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1048         Combine and rename to...
1049         (Dwo_file::read_unit_index): ...this.
1050         (Dwo_file::sized_read_compunit_index)
1051         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1052         (Dwo_file::sized_read_unit_index): ...this.
1053         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1054         parameters; add section_id parameter.
1055         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1056         (Dwo_file::add_unit_set): ...this.
1057         (Dwo_file::shndx_map_): Remove.
1058         (Dwo_file::sect_offsets_): New data member.
1059         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1060         (Dwp_output_file::add_section): Rename to...
1061         (Dwp_output_file::add_contribution): ...this.
1062         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1063         (Dwp_output_file::add_tu_set): Likewise.
1064         (Dwp_output_file::Contribution): New type.
1065         (Dwp_output_file::Section::contributions): New data member.
1066         (Dwp_output_file::Cu_or_tu_set): Remove.
1067         (Dwp_output_file::Section::Section): New ctor.
1068         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1069         (Dwp_output_file::Dwp_index::Section_table): New type.
1070         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1071         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1072         parameter.
1073         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1074         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1075         (Dwp_output_file::Dwp_index::section_table): New member function.
1076         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1077         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1078         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1079         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1080         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1081         (Dwp_output_file::Dwp_index::section_table_): New data member.
1082         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1083         (Dwp_output_file::add_output_section): New member function.
1084         (Dwp_output_file::write_new_section): New member function.
1085         (Dwp_output_file::write_contributions): New member function.
1086         (Dwp_output_file::section_id_map_): New data member.
1087         (class Dwo_id_info_reader): Remove.
1088         (class Unit_reader): New class.
1089         (get_dwarf_section_name): New function.
1090         (Dwo_file::read_executable): Adjust initializations of class data.
1091         (Dwo_file::read): Add support for v2 package file format.
1092         (Dwo_file::read_unit_index): Likewise.
1093         (Dwo_file::sized_read_unit_index): Likewise.
1094         (Dwo_file::copy_section): Likewise.
1095         (Dwo_file::add_unit_set): Likewise.
1096         (Dwp_output_file::add_output_section): Likewise.
1097         (Dwp_output_file::add_contribution): Likewise.
1098         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1099         for empty slot.
1100         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1101         file format.
1102         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1103         slot.
1104         (Dwp_output_file::initialize): Remove unused function.
1105         (Dwp_output_file::finalize): Add support for v2 package file format.
1106         (Dwp_output_file::write_index): Likewise.
1107         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1108         function prototype.
1109
1110 2013-03-01  Cary Coutant  <ccoutant@google.com>
1111
1112         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1113         function into class definition in header file.
1114         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1115         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1116         New function.
1117         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1118
1119 2013-02-28  Alan Modra  <amodra@gmail.com>
1120
1121         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1122         * target.cc (Target::do_plt_fde_location): New function.
1123         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1124         accessor function, and constructor param.
1125         (struct Post_fde, Post_fdes): Declare.
1126         (Cie::write): Add post_fdes param.
1127         * ehframe.cc (Fde::write): Use plt_fde_location.
1128         (struct Post_fde): Define.
1129         (Cie::write): Stash FDEs added post merge mapping.
1130         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1131         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1132         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1133         other FDEs.
1134         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1135         (Target_powerpc::has_glink): New function.
1136         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1137         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1138         glink_eh_frame_fde_32, default_fde): New data.
1139         (Stub_table::eh_frame_added_): New var.
1140         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1141         Make const.
1142         (Stub_table::add_eh_frame): New function.
1143         (Output_data_glink::add_eh_frame): New function.
1144         (Target_powerpc::make_glink_section): Call add_eh_frame.
1145
1146 2013-02-15  Ian Lance Taylor  <iant@google.com>
1147
1148         * options.h (DEFINE_uint64_alias): Define.
1149         (class General_options): Add -Ttext-segment as an alias for
1150         -Ttext.
1151
1152 2013-02-15  Alan Modra  <amodra@gmail.com>
1153
1154         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1155         (Stub_table::do_write): ..here, two places.
1156         (Stub_table::plt_call_size): Use it here too.
1157
1158 2013-02-11  Ian Lance Taylor  <iant@google.com>
1159
1160         * descriptors.cc (Descriptors::close_all): New function.
1161         * descriptors.h (class Descriptors): Declare close_all.
1162         (close_all_descriptors): New inline function.
1163         * plugin.cc: Include "descriptors.h".
1164         (Plugin_manager::cleanup): Call close_all_descriptors.
1165
1166 2013-02-06  Alan Modra  <amodra@gmail.com>
1167
1168         * README: Update coding style link.
1169
1170 2013-01-28  Cary Coutant  <ccoutant@google.com>
1171
1172         * dwp.cc (File_list): New typedef.
1173         (Dwo_name_info_reader): New class.
1174         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1175         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1176         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1177         (Dwo_file::read_executable): New function.
1178         (Dwo_file::read): Move common setup code to ...
1179         (Dwo_file::make_object): ... here.
1180         (dwp_options): Add --exec/-e.
1181         (usage): Likewise.
1182         (main): Likewise.
1183
1184 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1185
1186         * layout.cc (Layout::layout): Check for option text_reorder.
1187         (Layout::make_output_section): Ditto.
1188         * options.h (text_reorder): New option.
1189         * output.cc (Input_section_sort_compare): Remove special ordering
1190         of section names.
1191         (Output_section::
1192          Input_section_sort_section_name_special_ordering_compare::
1193          operator()): New function.
1194         (Output_section::sort_attached_input_sections): Use new sort function
1195         for .text.
1196         * output.h (Input_section_sort_section_name_special_ordering_compare):
1197         New struct.
1198         * testsuite/Makefile.am (text_section_grouping): Test option
1199         --no-text-reorder
1200         * testsuite/Makefile.in: Regenerate.
1201         * testsuite/text_section_grouping.sh: Check order of functions without
1202         default text reordering.
1203
1204 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1205
1206         * options.h (General_options): Change default to true for new_dtags.
1207
1208 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1209
1210         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1211         when enable_new_dtags is false.  Only add DT_RUNPATH when
1212         enable_new_dtags is true.
1213
1214 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1215
1216         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1217         used in declaration and definition consistent.
1218         (Target_powerpc::symval_for_branch): Ditto.
1219
1220 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1221
1222         * testsuite/plugin_final_layout.cc: Fix comment.
1223
1224 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1225
1226         * layout.cc (Layout::layout): Do not do default sorting for
1227         text sections when section ordering is specified.
1228         (make_output_section): Ditto.
1229         * testsuite/plugin_final_layout.cc: Name the function sections
1230         to catch reordering issues.
1231
1232 2013-01-15  Alan Modra  <amodra@gmail.com>
1233
1234         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1235         plt-thread-safe.
1236
1237 2013-01-15  Alan Modra  <amodra@gmail.com>
1238
1239         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1240         * testsuite/Makefile.in: Regenerate.
1241
1242 2013-01-14  Alan Modra  <amodra@gmail.com>
1243
1244         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1245         * testsuite/Makefile.in: Regenerate.
1246
1247 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1248
1249         PR bfd/14430
1250         Fix mingw gold build with plugins enabled
1251         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1252         * configure.ac: Export DLOPEN_LIBS and add headers check.
1253         * plugin.cc: Handle non-dlfcn case.
1254         * Makefile.in: Regenerate.
1255         * config.in: Regenerate.
1256         * configure: Regenerate.
1257         * testsuite/Makefile.in: Regenerate.
1258
1259 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1260
1261         * output.h (sort_attached_input_sections): Change to be public.
1262         * script-sections.cc
1263         (Output_section_definition::set_section_addresses): Sort
1264         attached input sections according to section order before linker
1265         script assigns section addresses.
1266         (Orphan_output_section::set_section_addresses): Sort
1267         attached input sections according to section order before linker
1268         script assigns section addresses.
1269         * Makefile.am (final_layout.sh): Use a simple linker script to
1270         check if section ordering still works.
1271         * Makefile.in: Regenerate.
1272
1273 2013-01-09  Ben Cheng  <bccheng@google.com>
1274
1275         * arm.cc (Target_arm::attributes_accept_div): New function.
1276         (Target_arm::attributes_forbid_div): New function.
1277         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1278         attribute using the same new functions as what bfd/elf32_arm.c
1279         does.
1280
1281 2013-01-07  Cary Coutant  <ccoutant@google.com>
1282
1283         PR gold/14993
1284         * output.cc (Output_section::add_input_section): For incremental
1285         updates, don't track input sections that are allocated from patch
1286         space.
1287
1288 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1289             Ian Lance Taylor  <iant@google.com>
1290
1291         PR gold/14897
1292         * configure.ac (--enable-ld): Removed.
1293         (install_as_default): Set to yes only for --enable-gold=default
1294         or --disable-ld.
1295         * configure: Regenerated.
1296
1297 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1298
1299         * options.h (General_options): Add -fuse-ld= for GCC linker
1300         option compatibility.
1301
1302 2013-01-04  Cary Coutant  <ccoutant@google.com>
1303
1304         * configure.ac: Fix typo restoring CXXFLAGS.
1305         * configure: Regenerate.
1306
1307 2013-01-04  Cary Coutant  <ccoutant@google.com>
1308
1309         * testsuite/Makefile.am (CXXLINK_S): New macro.
1310         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1311         * testsuite/Makefile.in: Regenerate.
1312
1313 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1314
1315         * version.cc (print_version): Update copyright year to 2013.
1316
1317 2012-12-20  Ian Lance Taylor  <iant@google.com>
1318
1319         * layout.cc (Layout::special_ordering_of_input_section): New
1320         function.
1321         (Layout::layout): If input section requires special ordering, must
1322         sort input sections.
1323         (Layout::make_output_section): May sort .text input sections.
1324         (Layout::is_section_name_prefix_grouped): Remove.
1325         * layout.h (class Layout): Declare
1326         special_ordering_of_input_section.  Don't declare
1327         is_section_name_prefix_grouped.
1328         * output.cc (Output_section::add_input_section): Revert last
1329         change.
1330         (Output_section::Input_section_sort::match_file_name): Don't crash
1331         if called on output section data.
1332         (Output_section::Input_section_sort_compare): Sort based on
1333         special ordering.
1334         (Output_section::Input_section_sort_section_order_index_compare):
1335         Revert last patch.
1336         (Output_section::sort_attached_input_sections): Likewise.
1337
1338 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1339
1340         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1341         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1342         * output.cc (Output_section::add_input_section): Check if section
1343         name contains special prefix.  Keep input sections to sort such
1344         sections.
1345         (Output_section::Input_section_sort_section_order_index_compare
1346          ::operator()): Group sections according to prefixes.
1347         (Output_section::sort_attached_input_sections): Add condition to
1348         Input_section_entry constructor call.
1349         * testsuite/Makefile.am (text_section_grouping): New test.
1350         * testsuite/Makefile.in: Regenerate.
1351         * testsuite/text_section_grouping.cc: New file.
1352         * testsuite/text_section_grouping.sh: New file.
1353
1354 2012-12-17  Nick Clifton  <nickc@redhat.com>
1355
1356         * Makefile.am: Add copyright notice.
1357         * NEWS: Likewise.
1358         * README: Likewise.
1359         * configure.ac: Likewise.
1360         * ftruncate.c: Likewise.
1361         * Makefile.in: Regenerate.
1362
1363 2012-12-14  Cary Coutant  <ccoutant@google.com>
1364
1365         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1366         --no-as-needed flag.
1367         (exception_separate_shared_12_test): Likewise.
1368         (incremental_copy_test): Likewise.
1369         * testsuite/Makefile.in: Regenerate.
1370
1371 2012-12-14  Cary Coutant  <ccoutant@google.com>
1372
1373         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1374         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1375
1376 2012-12-12  Alan Modra  <amodra@gmail.com>
1377
1378         * powerpc.cc (class Track_tls): New.
1379         (class Relocate, class Scan): Inherit Track_tls.
1380         (Target_powerpc::Scan::local, global): Track tls optimization
1381         and avoid creating plt entry for __tls_get_addr if all uses
1382         are optimized away.
1383         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1384
1385 2012-12-12  Alan Modra  <amodra@gmail.com>
1386
1387         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1388         Replace no_toc_optimize with toc_optimize.
1389         * output.h (Output_section::input_sections): Provide non-const variant.
1390         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1391         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1392         accessors.
1393         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1394         (class Sort_toc_sections): New.
1395         (Target_powerpc::do_finalize_sections): Sort toc sections.
1396         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1397
1398 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1399
1400         * testsuite/binary_unittest.cc (read_all): New function.
1401         (Sized_binary_test): Use it instead of ::read.
1402         * fileread.cc (do_read): Don't assume pread always reads the whole
1403         amount in a single call.
1404
1405 2012-12-10  Alan Modra  <amodra@gmail.com>
1406
1407         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1408         Set EM_PPC64 or EM_PPC here.
1409         (Target_selector_powerpc::do_recognize): Delete.
1410
1411 2012-12-10  Alan Modra  <amodra@gmail.com>
1412
1413         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1414         stub_table_.
1415         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1416
1417 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1418
1419         * testsuite/binary_unittest.cc (Sized_binary_test):
1420         Use open_descriptor rather than ::open.
1421
1422 2012-12-07  Alan Modra  <amodra@gmail.com>
1423
1424         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1425         typedef and invalid_address constant.
1426         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1427         instantiate constants.
1428
1429 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1430
1431         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1432         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1433         * aclocal.m4: Regenerate.
1434         * configure: Regenerate.
1435         * Makefile.in: Regenerate.
1436         * testsuite/Makefile.in: Regenerate.
1437
1438 2012-12-07  Alan Modra  <amodra@gmail.com>
1439
1440         * options.h (General_options): Add no_toc_optimize.
1441         * powerpc.cc (ok_lo_toc_insn): New function.
1442         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1443
1444 2012-12-06  Alan Modra  <amodra@gmail.com>
1445
1446         * options.h (General_options): Add plt_align, plt_static_chain,
1447         plt_thread_safe.  Update stub_group_size help text.
1448         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1449         for new plt_thread_safe_ var.
1450         (use_plt_offset): Correct comments.
1451         (Target_powerpc::do_relax): Look for thread creation symbols to
1452         determine default plt_thread_safe value.  Clear plt call stubs
1453         as well as branch stubs each iteration.
1454         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1455         insn constants.
1456         (l, hi, ha, write_insn): Move earlier.
1457         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1458         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1459         plt stubs too.
1460         (Stub_table::update_size): Adjust.
1461         (Stub_table::prev_size, set_prev_size): Delete.
1462         (Stub_table::stub_align): Let --plt-align affect result.
1463         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1464         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1465         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1466         (Stub_table::do_write): Support more stub variants.
1467
1468 2012-12-04  Alan Modra  <amodra@gmail.com>
1469
1470         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1471         (Target_powerpc::do_define_standard_symbols): New function.
1472
1473 2012-12-03  Alan Modra  <amodra@gmail.com>
1474
1475         * output.h: Formatting, whitespace.
1476
1477 2012-12-03  Alan Modra  <amodra@gmail.com>
1478
1479         * layout.h (Layout::get_executable_sections): Declare.
1480         * layout.cc (Layout::get_executable_sections): New function.
1481         * arm.cc (Target_arm::group_sections): Use it.
1482         (Arm_output_section::group_sections): Delete now redundant test.
1483         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1484         param to handle relative relocs.
1485         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1486         (Output_data_reloc::add_absolute): Adjust.
1487         (Output_data_reloc::add_relative): New function.
1488         (Output_data::reset_data_size): New function.
1489         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1490         (Output_section::set_addralign): New function.
1491         (Output_section::checkpoint_set_addralign): New function.
1492         (Output_section::clear_section_offsets_need_adjustment): New function.
1493         (Output_section::input_sections): Make public.
1494         * powerpc.cc (class Output_data_brlt_powerpc): New.
1495         (class Stub_table, class Stub_control): New.
1496         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1497         stub_table_, set_stub_table, stub_table): New vectors and accessor
1498         functions.
1499         (Target_powerpc::do_may_relax, do_relax, push_branch,
1500         new_stub_table, stub_tables, brlt_section, group_sections,
1501         add_branch_lookup_table, find_branch_lookup_table,
1502         write_branch_lookup_table, make_brlt_section): New functions.
1503         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1504         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1505         branch_info_): New vars.
1506         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1507         make call stubs here.
1508         (Output_data_glink): Remove all call stub handling from this class.
1509         (Target_powerpc::Scan::local, global): Save interesting branch
1510         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1511         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1512         functions on final link.
1513         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1514         Handle long branch destinations too.
1515         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1516         do_plt_address_for_local): Adjust lookup of plt call stubs.
1517
1518 2012-11-30  Alan Modra  <amodra@gmail.com>
1519
1520         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1521         relocs against protected symbols when building 32-bit shared libs.
1522
1523 2012-11-30  Alan Modra  <amodra@gmail.com>
1524
1525         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1526         param.  Call got_section() to make .got.  Update all callers
1527         and their callers and so on.
1528
1529 2012-11-30  Alan Modra  <amodra@gmail.com>
1530
1531         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1532         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1533         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1534         value if it already exists.
1535
1536 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1537
1538         PR gold/14858
1539         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1540
1541 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1542
1543         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1544         than bfc instruction for data sandboxing.
1545
1546 2012-11-08  Alan Modra  <amodra@gmail.com>
1547
1548         * po/POTFILES.in: Regenerate.
1549
1550 2012-11-05  Alan Modra  <amodra@gmail.com>
1551
1552         * configure.ac: Apply 2012-09-10 change to config.in here.
1553         * configure: Regenerate.
1554
1555 2012-11-05  Alan Modra  <amodra@gmail.com>
1556
1557         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1558         (struct Opd_ent): Use "Address" rather than "Offset".
1559         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1560         (Target_powerpc::got_section): Make public.
1561         (Target_powerpc::scan_relocs): Move code setting symbols..
1562         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1563         Create _SDA_BASE_ only when referenced.
1564
1565 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1566
1567         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1568         from last change.
1569
1570 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1571
1572         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1573         for offset_in_output_section parameter.
1574         (Sized_target::relocate_special_relocatable): Likewise.
1575         * arm.cc (Target_arm::relocate_relocs): Likewise.
1576         (Target_arm::relocate_special_relocatable): Likewise.
1577         * i386.cc (Target_i386::relocate_relocs): Likewise.
1578         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1579         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1580         * target-reloc.h (relocate_relocs): Likewise.
1581         * testsuite/testfile.cc (Target_test): Likewise.
1582         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1583         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1584
1585         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1586         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1587
1588         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1589         parameter, which is unused in the [!F_SETFD] case.
1590
1591         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1592         SYMNDX to off_t before comparing it to this->data_size().
1593         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1594         * incremental.cc (Output_section_incremental_inputs::do_write):
1595         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1596
1597         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1598
1599 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1600
1601         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1602         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1603         in EABI_VER5.
1604
1605 2012-10-29  Cary Coutant  <ccoutant@google.com>
1606
1607         * dwp.cc (usage): Add file and exit status parameters;
1608         add --help and --version options.
1609         (print_version): New function.
1610         (main): Add --help and --version options.
1611
1612 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1613
1614         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1615         final_layout_sequence.txt.
1616         * testsuite/Makefile.in: Regenerated.
1617
1618 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1619
1620         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1621         COMPILE generated by automake.
1622         (LINK1): Likewise.
1623         (CXXCOMPILE1): Likewise.
1624         (CXXLINK1): Likewise.
1625         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1626         (LINK): Likewise.
1627         (CXXCOMPILE): Likewise.
1628         (CXXLINK): Likewise.
1629         * testsuite/Makefile.in: Regenerated.
1630
1631 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1632
1633         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1634         on bad fwrite return.
1635
1636 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1637
1638         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1639         on val.
1640
1641 2012-10-23  Cary Coutant  <ccoutant@google.com>
1642
1643         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1644         * testsuite/Makefile.in: Regenerate.
1645         * testsuite/dwp_test.h: New source file.
1646         * testsuite/dwp_test_1.cc: New source file.
1647         * testsuite/dwp_test_1.s: New source file.
1648         * testsuite/dwp_test_1.sh: New source file.
1649         * testsuite/dwp_test_1b.cc: New source file.
1650         * testsuite/dwp_test_1b.s: New source file.
1651         * testsuite/dwp_test_2.cc: New source file.
1652         * testsuite/dwp_test_2.s: New source file.
1653         * testsuite/dwp_test_2.sh: New source file.
1654         * testsuite/dwp_test_main.cc: New source file.
1655         * testsuite/dwp_test_main.s: New source file.
1656
1657 2012-10-23  Cary Coutant  <ccoutant@google.com>
1658
1659         * dwp.h: New header file.
1660         * dwp.cc: New source file.
1661         * gold.h: Move shared declarations to system.h.
1662         * system.h: New header file.
1663         * Makefile.am: Add dwp.
1664         * Makefile.in: Regenerate.
1665
1666 2012-10-23  Cary Coutant  <ccoutant@google.com>
1667
1668         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1669         Dwarf_info_reader::read_from_pointer.
1670         (Dwarf_pubnames_table::read_header): Likewise.
1671         (Dwarf_pubnames_table::next_name): Likewise.
1672         (Dwarf_die::read_attributes): Likewise.
1673         (Dwarf_die::skip_attributes): Likewise.
1674         (Dwarf_info_reader::read_from_pointer): New function template.
1675         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1676         (Dwarf_pubnames_table): Likewise.
1677         (Dwarf_info_reader::read_from_pointer): New function template.
1678         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1679         Dwarf_pubnames_table ctor.
1680
1681 2012-10-23  Cary Coutant  <ccoutant@google.com>
1682
1683         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1684         abbrev_shndx.
1685         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1686         abbrev_shndx_.
1687         (Dwarf_info_reader::set_abbrev_shndx): New method.
1688         (Dwarf_info_reader::abbrev_shndx_): New data member.
1689
1690 2012-10-23  Cary Coutant  <ccoutant@google.com>
1691
1692         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1693         from object, not parameters.
1694         (Dwarf_info_reader::parse): Likewise.
1695         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1696         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1697         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1698         methods.
1699
1700 2012-10-23  Cary Coutant  <ccoutant@google.com>
1701
1702         * fileread.cc (Input_file::Input_file): New constructor.
1703         * fileread.h (class Input_file): Add new constructor.
1704
1705 2012-10-18  Alan Modra  <amodra@gmail.com>
1706
1707         PR gold/14727
1708         * object.cc (Relobj::is_section_name_included): Also match
1709         .sdata personality section.
1710
1711 2012-10-18  Alan Modra  <amodra@gmail.com>
1712
1713         * target-reloc.h (class Default_comdat_behavior): New, package up..
1714         (get_comdat_behaviour): ..this.
1715         (relocate_section): Add Relocate_comdat_behavior template arg,
1716         adjust code to suit.
1717         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1718         (Target_arm::scan_reloc_section): Likewise.
1719         * i386.cc (Target_i386::relocate_section): Likewise.
1720         * sparc.cc (Target_sparc::relocate_section): Likewise.
1721         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1722         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1723         * powerpc.cc (class Relocate_comdat_behavior): New.
1724         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1725         gold::relocate_section with new template arg.
1726
1727 2012-10-18  Alan Modra  <amodra@gmail.com>
1728
1729         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1730         dynamic relocs for GOT_TPREL got entries, without symbol if
1731         resolving locally.
1732         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1733         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1734         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1735
1736 2012-10-17  Alan Modra  <amodra@gmail.com>
1737
1738         PR gold/14726
1739         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1740
1741 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1742
1743         * layout.cc (Layout::include_section): Keep sections marked
1744         SHF_EXCLUDE when doing relocatable links.
1745
1746 2012-10-16  Alan Modra  <amodra@gmail.com>
1747
1748         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1749         (Target_powerpc::do_finalize_sections): Call it.
1750         (Output_data_save_res): New class and supporting functions.
1751         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1752         normal symbols defined in object files.
1753
1754 2012-10-12  Alan Modra  <amodra@gmail.com>
1755
1756         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1757         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1758         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1759         section if scan_opd_relocs not yet called.
1760         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1761
1762 2012-10-12  Alan Modra  <amodra@gmail.com>
1763
1764         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1765         add_local_ifunc_entry): Revert last change.
1766         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1767
1768 2012-10-05  Alan Modra  <amodra@gmail.com>
1769
1770         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1771         do_plt_address_for_global): New functions.
1772         (Output_data_got_powerpc::do_write): Don't segfault when linking
1773         statically.
1774         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1775         add_local_ifunc_entry): Return true on adding entry..
1776         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1777         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1778         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1779         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1780         set up symbols here.
1781         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1782         syms here.  Do so even when no .iplt.  Don't segfault when linking
1783         statically.
1784         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1785         new variants without reloc param.
1786         (Glink_sym_ent::Glink_sym_ent): Likewise.
1787         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1788         reloc when refs will resolve to plt call stub.
1789         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1790         R_PPC_PLTREL24 to resolve locally.
1791         (Target_powerpc::Scan::global): Correct ifunc handling.
1792         (Target_powerpc::Relocate::relocate): Correct local sym glink
1793         lookup.  Don't destroy "value" when we have a plt call stub,
1794         and when checking plt call validity.
1795         (Target_powerpc::do_dynsym_value): Simplify.
1796
1797 2012-10-05  Alan Modra  <amodra@gmail.com>
1798
1799         * i386.cc (Output_data_plt_i386::address_for_global,
1800         address_for_local): Add plt offset to returned value.  Adjust uses.
1801         * sparc.cc (Output_data_plt_sparc::address_for_global,
1802         address_for_local): Likewise.
1803         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1804         address_for_local): Likewise.
1805         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1806         address_for_local): Likewise.
1807         * target.h (Target::plt_address_for_global, plt_address_for_local):
1808         Update comment.
1809         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1810         (Output_data_got::Got_entry::write): Nor here.
1811         * output.h: Comment fix.
1812
1813 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1814
1815         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1816         global_offset_table_ value for larget got.
1817         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1818
1819 2012-09-29  Alan Modra  <amodra@gmail.com>
1820
1821         * powerpc.cc (Target_powerpc::iplt_): New output section.
1822         (Target_powerpc::iplt_section, make_iplt_section,
1823         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1824         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1825         Target_powerpc::plt_entry_count): Count iplt entries too.
1826         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1827         reloc section in constructor.  New params.
1828         (Target_powerpc::make_plt_section): Create reloc section here instead.
1829         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1830         functions.
1831         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1832         (Output_data_glink::add_entry, find_entry): New functions to
1833         deal with local syms.
1834         (Glink_sym_ent): Add support for local syms.
1835         (Output_data_glink::do_write): Handle ifunc plt entries.
1836         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1837         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1838         (Target_powerpc::Relocate::relocate): Likewise.
1839         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1840
1841 2012-09-25  Alan Modra  <amodra@gmail.com>
1842
1843         * object.h (Sized_relobj_file::adjust_local_symbol,
1844         do_adjust_local_symbol): New functions.
1845         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1846         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1847         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1848         and irregular opd entry spacing.
1849         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1850         (Global_symbol_visitor_opd): New functor.
1851         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1852         on deleted opd entries.
1853
1854 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1855
1856         * tilegx.cc: New file.
1857         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1858         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1859         * configure.tgt: Add entries for tilegx*.
1860         * configure.ac: Likewise.
1861         * Makefile.in: Rebuild.
1862         * configure: Likewise.
1863         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1864         tilegx.
1865
1866 2012-09-13  Alan Modra  <amodra@gmail.com>
1867
1868         * target-reloc.h (scan_relocs): Call scan.local for relocs
1869         against symbols in discarded sections.  Pass is_discarded
1870         param.
1871         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1872         Add is_discarded param.
1873         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1874         is_discarded to flag opd entry as discarded.  Don't emit dyn
1875         relocs on such entries.
1876         (Target_powerpc::Scan::global): Similarly detect and handle
1877         such opd entries.
1878         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1879         opd_ent_.  Update all uses.
1880         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1881         (Target_powerpc::relocate_section): Zero out discarded opd
1882         entry relocs.
1883
1884 2012-09-12  Ian Lance Taylor  <iant@google.com>
1885
1886         PR gold/14570
1887         * output.cc: Rename Output_data_got template parameter from size
1888         to got_size for all functions.  Compile all variants of
1889         Output_data_got.
1890         (Output_data_got::Got_entry::write): Correct use of size for
1891         symbol value.  Use local_is_tls rather than casting to
1892         Sized_relobj_file.
1893         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1894         (class Sized_relobj_file): Add do_local_is_tls.
1895         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1896
1897 2012-09-11  Alan Modra  <amodra@gmail.com>
1898
1899         PR gold/14566
1900         * layout.cc (Layout::set_segment_offsets): When using
1901         common-page-size alignment, ensure we are on a new max-page-size
1902         page.
1903         * output.cc (Output_segment::set_section_addresses): Use
1904         abi_pagesize, not common_pagesize for relro boundary.
1905         (Output_segment::set_offset): Likewise.
1906
1907 2012-09-11  Alan Modra  <amodra@gmail.com>
1908
1909         * output.h (Output_data_got::add_global_tls, add_local_tls,
1910         add_local_tls_pair): New functions.
1911         (Output_data_got::add_local_pair_with_rel): Remove second
1912         reloc param.  Expand comment.
1913         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1914         use_plt_or_tls_offset_, similarly for constructor param.
1915         (Output_data_got::Got_entry::write): Add got_index param.
1916         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1917         add_local_tls_pair): New functions.
1918         (Output_data_got::Got_entry::write): Handle tls symbols
1919         with use_plt_or_tls_offset_ set specially.
1920         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1921         (Output_data_got::do_write): Replace iterator with index, pass
1922         index to entry write function.
1923         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1924         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1925         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1926         call.
1927         * i386.cc (Target_i386::Scan::local): Likewise.
1928         * sparc.cc (Target_sparc::Scan::local): Likewise.
1929         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1930         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1931         do_tls_offset_for_global): New functions.
1932         (Target_powerpc::Scan::local): Correct TLS relocations and got
1933         entry values.
1934         (Target_powerpc::Scan::global): Don't emit unnecessary
1935         dynamic relocations on TLS GOT entries.
1936
1937 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1938
1939         * config.in: Disable sanity check for kfreebsd.
1940
1941 2012-09-10  Sterling Augustine  <saugustine@google.com>
1942
1943         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1944         (Gdb_index::pubtypes_read): New parameter.
1945         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1946         to calls.
1947         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1948         pubtypes_object_.
1949
1950 2012-09-09  Alan Modra  <amodra@gmail.com>
1951
1952         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1953         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1954         * gc.h (gc_process_relocs): Call target gc_add_reference.
1955         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1956         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1957         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1958         unnecessary cast.
1959         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1960         to cater for when we don't need code offset.  Update use.
1961         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1962         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1963         set_opd_valid): New functions.
1964         (Target_powerpc::do_gc_add_reference): New function.
1965         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1966         stashed refs.
1967         (Target_powerpc::do_gc_mark_symbol): New function.
1968
1969 2012-09-06  Cary Coutant  <ccoutant@google.com>
1970
1971         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1972         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1973         (Dwarf_die::skip_attributes): Likewise.
1974         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1975         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1976         (main): Call it.
1977         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1978
1979 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1980
1981         * testsuite/script_test_3.t: Add .got.plt output section
1982         statement.
1983         * testsuite/script_test_4.t: Likewise.
1984
1985 2012-09-05  Alan Modra  <amodra@gmail.com>
1986
1987         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1988         update all uses and lose "enum" when using type.
1989
1990 2012-09-05  Alan Modra  <amodra@gmail.com>
1991
1992         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1993         * configure: Regenerate.
1994         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1995         (plugin_final_layout.stdout): Likewise.
1996         (memory_test): Set page sizes to 0x1000.
1997         * testsuite/Makefile.in: Regenerate.
1998         * testsuite/discard_locals_test.sh: Add FIXME comment.
1999         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2000         * testsuite/pr14265.t: Add .got output section statement.
2001         * testsuite/script_test_2.t: Likewise.
2002         * testsuite/script_test_3.t: Likewise.
2003         * testsuite/script_test_4.t: Likewise.
2004         * testsuite/script_test_5.t: Likewise.
2005         * testsuite/script_test_6.t: Likewise.
2006         * testsuite/script_test_7.t: Likewise.
2007         * testsuite/script_test_9.t: Likewise.
2008
2009 2012-09-05  Alan Modra  <amodra@gmail.com>
2010
2011         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2012         (Powerpc_relocate_functions::Status): New typedef.
2013         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2014         (Target_powerpc::Scan::local): Handle REL64.
2015         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2016         for REL32 and REL64.
2017         (Target_powerpc::symval_for_branch): New function, extracted from..
2018         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2019         checks.  Report overflow errors.
2020
2021 2012-09-05  Alan Modra  <amodra@gmail.com>
2022
2023         * object.h (Sized_relobj_file::emit_relocs): Delete.
2024         (Sized_relobj_file::emit_relocs_reltype): Delete.
2025         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2026         relocate_relocs for --emit-relocs.
2027         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2028         * output.h: Update comment.
2029         (Output_segment::first_section): New function.
2030         (Output_segment::first_section_load_address): Use first_section.
2031         * output.cc (Output_segment::first_section): New function extracted..
2032         (Output_segment::first_section_load_address): ..from here.  Delete.
2033         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2034         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2035         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2036         adjust call to target.h function.
2037         * i386.cc (Target_i386): Likewise.
2038         * sparc.cc (Target_sparc): Likewise.
2039         * x86_64.cc (Target_x86_64): Likewise.
2040         * powerpc.cc (Target_powerpc): Likewise.
2041         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2042         first tls section has section symbol for optimised local dynamic
2043         output relocs.
2044         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2045         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2046         optimised tls code.
2047         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2048         Rename to relocate_relocs.  Update error message.
2049
2050 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2051
2052         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2053         --just-symbols.
2054
2055 2012-08-31  Alan Modra  <amodra@gmail.com>
2056
2057         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2058         (Powerpc_relobj::toc_base_offset): New stub function.
2059         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2060         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2061         (Target_powerpc::Relocate::enum skip_tls): New.
2062         (Target_powerpc::call_tls_get_addr_): New var.
2063         (Target_powerpc::is_branch_reloc): Move to file scope.
2064         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2065         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2066         New functions.
2067         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2068         (powerpc_info): Correct common_pagesize for ppc64.
2069         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2070         (Powerpc_relocate_functions): Add overflow check enums and functions.
2071         Add non-shift version of rela, rela_ua.  Delete all rel public
2072         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2073         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2074         addr16_ha3, addr14 functions.
2075         (Output_data_got_powerpc::add_constant_pair): New function.
2076         (Output_data_got_powerpc::got_base_offset): Likewise.
2077         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2078         (instruction constants): Sort, add some more.
2079         (Output_data_glink::do_write): Add and use Address typedef.  Use
2080         object->toc_base_offset() stub for 64-bit.
2081         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2082         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2083         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2084         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2085         Always treat .opd relocs as against locally defined symbol.
2086         Correct condition for RELATIVE relocs.
2087         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2088         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2089         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2090         calculations.  Handle TLS relocs, and more.  Add overflow
2091         checking and adjust for Powerpc_relocate_functions changes.
2092         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2093         Reinstate --emit-relocs code with FIXME.
2094
2095 2012-08-30  Alan Modra  <amodra@gmail.com>
2096
2097         * layout.cc (Layout::set_segment_offsets): Set p_align to
2098         abi_pagesize, not common_pagesize.
2099         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2100         to determine whether file header can go in segment.
2101
2102 2012-08-30  Alan Modra  <amodra@gmail.com>
2103
2104         * output.h (Output_reloc::Output_reloc <output section>): Add
2105         is_relative param.  Adjust calls.
2106         (Output_reloc::add_output_section_relative): New functions.
2107         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2108         is_relative.
2109         (Output_reloc::symbol_value): Handle SECTION_CODE.
2110
2111 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2112
2113         * gold.cc (queue_middle_tasks): Call layout again when unique
2114         segments for sections is desired.
2115         * layout.cc (Layout::Layout): Initialize new members.
2116         (Layout::get_output_section_flags): New function.
2117         (Layout::choose_output_section): Call get_output_section_flags.
2118         (Layout::layout): Make output section for mapping to a unique segment.
2119         (Layout::insert_section_segment_map): New function.
2120         (Layout::attach_allocated_section_to_segment): Make unique segment for
2121         output sections marked so.
2122         (Layout::segment_precedes): Check for unique segments when sorting.
2123         * layout.h (Layout::Unique_segment_info): New struct.
2124         (Layout::Section_segment_map): New typedef.
2125         (Layout::insert_section_segment_map): New function.
2126         (Layout::get_output_section_flags): New function.
2127         (Layout::is_unique_segment_for_sections_specified): New function.
2128         (Layout::set_unique_segment_for_sections_specified): New function.
2129         (Layout::unique_segment_for_sections_specified_): New member.
2130         (Layout::section_segment_map_): New member.
2131         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2132         Rename is_gc_pass_one to is_pass_one.
2133         Rename is_gc_pass_two to is_pass_two.
2134         Rename is_gc_or_icf to is_two_pass.
2135         Check for which pass based on whether symbols data is present.
2136         Make it two pass when unique segments for sections is desired.
2137         * output.cc (Output_section::Output_section): Initialize new
2138         members.
2139         * output.h (Output_section::is_unique_segment): New function.
2140         (Output_section::set_is_unique_segment): New function.
2141         (Output_section::is_unique_segment_): New member.
2142         (Output_section::extra_segment_flags): New function.
2143         (Output_section::set_extra_segment_flags): New function.
2144         (Output_section::extra_segment_flags_): New member.
2145         (Output_section::segment_alignment): New function.
2146         (Output_section::set_segment_alignment): New function.
2147         (Output_section::segment_alignment_): New member.
2148         (Output_segment::Output_segment): Initialize is_unique_segment_.
2149         (Output_segment::is_unique_segment): New function.
2150         (Output_segment::set_is_unique_segment): New function.
2151         (Output_segment::is_unique_segment_): New member.
2152         * plugin.cc (allow_unique_segment_for_sections): New function.
2153         (unique_segment_for_sections): New function.
2154         (Plugin::load): Add new functions to transfer vector.
2155         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2156         * Makefile.in: Regenerate.
2157         * testsuite/plugin_final_layout.sh: Check if unique segment
2158         functionality works.
2159         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2160         are available.
2161         (allow_unique_segment_for_sections): New global.
2162         (unique_segment_for_sections): New global.
2163         (claim_file_hook): Call allow_unique_segment_for_sections.
2164         (all_symbols_read_hook): Call unique_segment_for_sections.
2165
2166 2012-08-22  Cary Coutant  <ccoutant@google.com>
2167
2168         * layout.cc (Layout::include_section): Don't assert on GROUP
2169         sections with --emit-relocs.
2170
2171 2012-08-21  Cary Coutant  <ccoutant@google.com>
2172
2173         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2174         if --export-dynamic-symbol names an undef symbol.
2175
2176 2012-08-18  Alan Modra  <amodra@gmail.com>
2177
2178         * powerpc.cc: Formatting and white space.
2179         (Powerpc_relobj): Rename got2_section_ to special_.
2180         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2181         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2182         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2183         (Target_powerpc): Add Address typedef and invalid_address.  Use
2184         throughout.
2185         (Target_powerpc::is_branch_reloc): New function.
2186         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2187         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2188         for dst_mask, value and addend.
2189         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2190         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2191         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2192         uint16_t for 24-bit offset.  Use get_output_section_offset and
2193         check return.
2194         (Target_powerpc::Scan::local): Handle more relocs.
2195         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2196         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2197         Plug in toc restoring insn after plt calls.  Translate branches
2198         to function descriptor symbols to corresponding entry point.
2199         (Target_powerpc::relocate_for_relocatable): Check return from
2200         get_output_section_offset.
2201         * symtab.h: Comment typo.
2202
2203 2012-08-14  Ian Lance Taylor  <iant@google.com>
2204
2205         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2206         unsupported_relocal_local to call unsupported_reloc_global.
2207
2208 2012-08-14  Nick Clifton  <nickc@redhat.com>
2209
2210         PR ld/14265
2211         * script-sections.cc (Sections_element::output_section_name): Add
2212         keep return parameter.
2213         (Output_section_element::match_name): Add keep return parameter.
2214         Return the value of the keep_ member.
2215         * script-sections.h (class Output_section): Update
2216         output_section_name prototype.
2217         * layout.cc (Layout::keep_input_section): New public member
2218         function.
2219         (Layout::choose_output_section): Pass keep parameter to
2220         output_section_name.
2221         * layout.h (class Layout): Add keep_input_section.
2222         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2223         sections.
2224         * testsuite/Makefile.am: Add a test.
2225         * testsuite/Makefile.in: Regenerate.
2226         * testsuite/pr14265.c: Source file for the test.
2227         * testsuite/pr14265.t: Linker script for the test.
2228         * testsuite/pr14265.sh: Shell script for the test.
2229
2230 2012-08-14  Alan Modra  <amodra@gmail.com>
2231
2232         * target.h (Target::output_section_name): New function.
2233         (Target::do_output_section_name): New function.
2234         * layout.cc (Layout::choose_output_section): Call the above.
2235         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2236
2237 2012-08-14  Alan Modra  <amodra@gmail.com>
2238
2239         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2240         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2241         for replace_constant call.
2242         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2243         (Output_data_glink::do_print_to_mapfile): New function.
2244         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2245         (Target_powerpc::Relocate::relocate): Likewise.
2246
2247 2012-08-14  Alan Modra  <amodra@gmail.com>
2248
2249         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2250         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2251         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2252         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2253         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2254         here.
2255         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2256         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2257         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2258         here.
2259         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2260         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2261
2262 2012-08-12  Alan Modra  <amodra@gmail.com>
2263
2264         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2265         (glink insn constants): Use uint32_t.
2266         (Output_data_glink::add_entry): Use insert, not [] operator.
2267
2268 2012-08-11  Alan Modra  <amodra@gmail.com>
2269
2270         * object.h (Sized_relobj_file::find_shdr): New function.
2271         (Sized_relobj_file::find_special_sections): New function.
2272         * object.cc (Sized_relobj_file::find_shdr): New function.
2273         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2274         (Sized_relobj_file::find_special_sections): New function, split out..
2275         (Sized_relobj_file::do_read_symbols): ..from here.
2276         * output.h (Output_data_got::replace_constant): New function.
2277         (Output_data_got::num_entries): New function.
2278         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2279         (Output_data_got::got_offset): Protected rather than private.
2280         (Output_data_got::replace_got_entry): New function.
2281         * output.cc (Output_data_got::replace_got_entry): New function.
2282         * powerpc.cc (class Powerpc_relobj): New.
2283         (class Powerpc_relocate_functions): Delete all psymval variants or
2284         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2285         Implement _ha functions using corresponding _hi function.
2286         (Powerpc_relobj::find_special_sections): New function.
2287         (Target_powerpc::do_make_elf_object): New function.
2288         (class Output_data_got_powerpc): New.
2289         (class Output_data_glink): New.
2290         (class Powerpc_scan_relocatable_reloc): New.
2291         Many more changes througout file.
2292
2293 2012-08-09  Nick Clifton  <nickc@redhat.com>
2294
2295         * po/vi.po: Updated Vietnamese translation.
2296
2297 2012-08-07  Ian Lance Taylor  <iant@google.com>
2298
2299         * layout.cc (Layout::add_target_dynamic_tags): If
2300         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2301         plt_rel.
2302
2303 2012-07-30  Nick Clifton  <nickc@redhat.com>
2304
2305         * po/gold.pot: Updated template.
2306         * po/es.po: Updated Spanish translation.
2307
2308 2012-07-18  Cary Coutant  <ccoutant@google.com>
2309
2310         PR gold/14344
2311         * configure.ac: Add check for -gpubnames support.
2312         * configure: Regenerate.
2313         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2314         support; force -gno-pubnames.
2315         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2316         support.
2317         (gdb_index_test_4): New test.
2318         * testsuite/Makefile.in: Regenerate.
2319         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2320         * testsuite/gdb_index_test_2.sh: Likewise.
2321         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2322         * testsuite/gdb_index_test_4.sh: New script.
2323         * testsuite/gdb_index_test_comm.sh: New script with common code;
2324         don't look for space after colon.
2325
2326 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2327
2328         * gold.cc (queue_middle_tasks): Update function order only after
2329         deferred objects due to plugins are processed.
2330
2331 2012-07-11  Ian Lance Taylor  <iant@google.com>
2332
2333         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2334         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2335         (Target_arm::scan_reloc_for_stub): Likewise.
2336         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2337         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2338         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2339         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2340         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2341
2342 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2343             Ian Lance Taylor  <iant@google.com>
2344
2345         PR gold/14309
2346         * configure.ac: Test whether std::tr1::hash<off_t> works.
2347         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2348         needed.
2349         * output.h (class Output_fill): Add virtual destructor.
2350         * configure, config.in: Rebuild.
2351
2352 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2353
2354         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2355
2356 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2357
2358         * plugin.cc (Plugin::load): Handle position independent executables.
2359
2360 2012-06-06  Cary Coutant  <ccoutant@google.com>
2361
2362         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2363         add .debug_macro.
2364         (lines_only_debug_sections): Likewise.
2365         (gdb_fast_lookup_sections): New static array.
2366         (is_gdb_debug_section): Rename formal parameter.
2367         (is_lines_only_debug_section): Likewise.
2368         (is_gdb_fast_lookup_section): New function.
2369         (Layout::include_section): Check for ".zdebug_" prefix; pass
2370         section name suffix to is_gdb_debug_section, et al.; check for
2371         fast-lookup sections when building .gdb_index.
2372         * options.h (--strip-debug-gdb): Update GDB version number.
2373
2374 2012-06-06  Cary Coutant  <ccoutant@google.com>
2375
2376         * configure.ac: Add check for fallocate.
2377         * configure: Regenerate.
2378         * config.in: Regenerate.
2379
2380         * options.h (class General_options): Add --mmap-output-file and
2381         --posix-fallocate options.
2382         * output.cc: (posix_fallocate): Remove; replace with...
2383         (gold_fallocate): New function.
2384         (Output_file::map_no_anonymous): Call gold_fallocate.
2385         (Output_file::map): Check --mmap-output-file option.
2386
2387 2012-06-05  Jing Yu  <jingyu@google.com>
2388
2389         * gold.h (textdomain): Add do {} to empty while(0).
2390         (bindtextdomain): Likewise.
2391
2392 2012-06-04  Cary Coutant  <ccoutant@google.com>
2393
2394         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2395         has_dynsym_index.
2396
2397 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2398
2399         * symtab.cc (Symbol_table::define_special_symbol):
2400         Initialize *poldsym to prevent uninitialized variable errors.
2401
2402 2012-05-23  Cary Coutant  <ccoutant@google.com>
2403
2404         * layout.cc (Layout::section_name_mapping): Add rules to handle
2405         exact match on .data.rel.ro.local or .data.rel.ro.
2406         (Layout::output_section_name): Check for exact matches.
2407
2408 2012-05-23  Cary Coutant  <ccoutant@google.com>
2409
2410         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2411         more carefully.
2412
2413 2012-05-22  Cary Coutant  <ccoutant@google.com>
2414
2415         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2416         object before exporting symbol.
2417
2418 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2419
2420         * testsuite/tls_test.cc: Include "config.h" first.
2421         * testsuite/tls_test_c.c: Likewise.
2422
2423 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2424             Nick Clifton  <nickc@redhat.com>
2425
2426         PR 14072
2427         * configure.in: Add check that sysdep.h has been included before
2428         any system header files.
2429         * configure: Regenerate.
2430         * config.in: Regenerate.
2431
2432 2012-05-14  Cary Coutant  <ccoutant@google.com>
2433
2434         * layout.cc (Layout::make_output_section): Mark .tdata section
2435         as RELRO.
2436         * testsuite/relro_test.cc: Add a TLS variable.
2437
2438 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2439
2440         PR gold/14091
2441         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2442         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2443         R_X86_64_64.
2444
2445 2012-05-08  Cary Coutant  <ccoutant@google.com>
2446
2447         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2448         (lines_only_debug_sections): Likewise.
2449
2450 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2451
2452         * nacl.cc: New file.
2453         * nacl.h: New file.
2454         * Makefile.am (CCFILES, HFILES): Add them.
2455         * Makefile.in: Regenerate.
2456         * i386.cc (Output_data_plt_i386_nacl): New class.
2457         (Output_data_plt_i386_nacl_exec): New class.
2458         (Output_data_plt_i386_nacl_dyn): New class.
2459         (Target_i386_nacl): New class.
2460         (Target_selector_i386_nacl): New class.
2461         (target_selector_i386): Use it instead of Target_selector_i386.
2462         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2463         (Target_x86_64_nacl): New class.
2464         (Target_selector_x86_64_nacl): New class.
2465         (target_selector_x86_64, target_selector_x32): Use it instead of
2466         Target_selector_x86_64.
2467         * arm.cc (Output_data_plt_arm_nacl): New class.
2468         (Target_arm_nacl): New class.
2469         (Target_selector_arm_nacl): New class.
2470         (target_selector_arm, target_selector_armbe): Use it instead of
2471         Target_selector_arm.
2472
2473         * target-select.cc (select_target): Take new Input_file* and off_t
2474         arguments, pass them on to recognize method of selector.
2475         * object.cc (make_elf_sized_object): Update caller.
2476         * parameters.cc (parameters_force_valid_target): Likewise.
2477         * incremental.cc (make_sized_incremental_binary): Likewise.
2478         * target-select.h: Update decl.
2479         (Target_selector::recognize): Take new Input_file* argument,
2480         pass it on to do_recognize.
2481         (Target_selector::do_recognize): Take new Input_file* argument.
2482         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2483         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2484         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2485         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2486
2487         * target.h (Target::Target_info): New members isolate_execinstr
2488         and rosegment_gap.
2489         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2490         * arm.cc (Target_arm::arm_info): Update initializer.
2491         * i386.cc (Target_i386::i386_info): Likewise.
2492         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2493         * sparc.cc (Target_sparc::sparc_info): Likewise.
2494         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2495         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2496         * layout.cc (Layout::attach_allocated_section_to_segment):
2497         Take new const Target* argument.  If target->isolate_execinstr(), act
2498         like --rosegment.
2499         (Layout::find_first_load_seg): Take new const Target* argument;
2500         if target->isolate_execinstr(), reject PF_X segments.
2501         (Layout::relaxation_loop_body): Update caller.
2502         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2503         reset file offset to zero when we hit LOAD_SEG, and then do a second
2504         loop over the segments before LOAD_SEG to reassign offsets after
2505         addresses have been determined.  Handle target->rosegment_gap().
2506         (Layout::attach_section_to_segment): Take new const Target* argument;
2507         pass it to attach_allocated_section_to_segment.
2508         (Layout::make_output_section): Update caller.
2509         (Layout::attach_sections_to_segments): Take new const Target* argument;
2510         pass it to attach_section_to_segment.
2511         * gold.cc (queue_middle_tasks): Update caller.
2512         * layout.h (Layout): Update method decls with new arguments.
2513
2514         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2515         Target_info pointer to use.
2516         (Target_arm::do_make_data_plt): New virtual method.
2517         (Target_arm::make_data_plt): New method that calls it.
2518         (Target_arm::make_plt_entry): Use it.
2519         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2520         for the section alignment.
2521         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2522         method.
2523         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2524         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2525         method.
2526         (Output_data_plt_arm::get_plt_entry_size): Call it.
2527         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2528         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2529         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2530         method.
2531         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2532         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2533         method instead of sizeof(plt_entry).
2534         (Output_data_plt_arm::add_entry): Likewise.
2535         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2536         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2537         than static method.
2538         (Target_arm::plt_entry_size): Likewise.
2539         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2540         Move to ...
2541         (Output_data_plt_arm_standard): ... here, new class.
2542         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2543         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2544         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2545
2546         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2547         Take additional argument for the PLT entry size.
2548         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2549         Use get_plt_entry_size method rather than plt_entry_size variable.
2550         (Output_data_plt_x86_64::reserve_slot): Likewise.
2551         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2552         (Output_data_plt_x86_64::add_entry): Likewise.
2553         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2554         (Output_data_plt_x86_64::address_for_global): Likewise.
2555         (Output_data_plt_x86_64::address_for_local): Likewise.
2556         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2557         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2558         Make method non-static.
2559         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2560         method.
2561         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2562         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2563         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2564         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2565         virtual method.
2566         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2567         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2568         virtual method.
2569         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2570         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2571         virtual method.
2572         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2573         (Output_data_plt_x86_64::plt_entry_size)
2574         (Output_data_plt_x86_64::first_plt_entry)
2575         (Output_data_plt_x86_64::plt_entry)
2576         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2577         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2578         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2579         (Output_data_plt_x86_64_standard): ... here, new class.
2580         (Target_x86_64::Target_x86_64): Take optional argument for the
2581         Target_info pointer to use.
2582         (Target_x86_64::do_make_data_plt): New virtual method.
2583         (Target_x86_64::make_data_plt): New method to call it.
2584         (Target_x86_64::init_got_plt_for_update): Use that.
2585         Call this->plt_->add_eh_frame method here.
2586         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2587         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2588         rather than static method.
2589         (Target_x86_64::plt_entry_size): Likewise.
2590         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2591         rather than plt_entry_size variable.  Move guts of PLT filling to...
2592         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2593         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2594         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2595
2596         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2597         additional argument for the section alignment.
2598         Don't do add_eh_frame_for_plt here.
2599         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2600         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2601         variable.
2602         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2603         method.
2604         (Output_data_plt_i386::get_plt_entry_size): Call it.
2605         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2606         (Output_data_plt_i386::add_eh_frame): New method to call it.
2607         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2608         method.
2609         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2610         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2611         method.
2612         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2613         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2614         method instead of plt_entry_size.
2615         (Output_data_plt_i386::plt_entry_size)
2616         (Output_data_plt_i386::plt_eh_frame_fde_size)
2617         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2618         (Output_data_plt_i386_standard): ... here, new class.
2619         (Output_data_plt_i386_exec): New class.
2620         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2621         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2622         (Output_data_plt_i386::exec_plt_entry): Move to ...
2623         (Output_data_plt_i386_exec::plt_entry): ... here.
2624         (Output_data_plt_i386_dyn): New class.
2625         (Output_data_plt_i386::first_plt_entry): Move to ...
2626         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2627         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2628         (Output_data_plt_i386_dyn::plt_entry): ... here.
2629         (Target_i386::Target_i386): Take optional argument for the Target_info
2630         pointer to use.
2631         (Target_i386::do_make_data_plt): New virtual method.
2632         (Target_i386::make_data_plt): New method to call it.
2633         (Target_i386::make_plt_section): Use that.
2634         Call this->plt_->add_eh_frame method here.
2635         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2636         rather than plt_entry_size variable.
2637         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2638         (Output_data_plt_i386::address_for_local): Likewise.
2639         (Output_data_plt_i386::do_write): Likewise.
2640         Move guts of PLT filling to...
2641         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2642         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2643         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2644         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2645
2646 2012-05-01  Cary Coutant  <ccoutant@google.com>
2647
2648         * dwarf_reader.cc (Dwarf_die::read_attributes)
2649         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2650         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2651         * reduced_debug_output.cc
2652         (Output_reduced_debug_info_section::get_die_end): Remove
2653         DW_FORM_GNU_ref_index.  Add default case.
2654
2655 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2656
2657         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2658         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2659         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2660         DW_AT_high_pc as offset from DW_AT_low_pc.
2661
2662         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2663         * testsuite/Makefile.in: Regenerate.
2664         * testsuite/gdb_index_test_3.c: New test source file.
2665         * testsuite/gdb_index_test_3.sh: New test source file.
2666
2667 2012-04-25  Ian Lance Taylor  <iant@google.com>
2668
2669         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2670         pointer.
2671         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2672         as a class, not a struct.
2673         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2674         (Target_arm::apply_cortex_a8_workaround): Likewise.
2675         * gc.h: Declare Reloc_types as a struct, not a class.
2676         * object.h: Declare Symbols_data as a struct.
2677         * reloc.h: Declare Read_relocs_data as a struct.
2678         * target.h: Declare Relocate_info as a struct.
2679
2680 2012-04-24  David S. Miller  <davem@davemloft.net>
2681
2682         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2683         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2684         and R_SPARC_WPLT30.
2685
2686 2012-04-24  Cary Coutant  <ccoutant@google.com>
2687
2688         * incremental-dump.cc (find_input_containing_global): Replace
2689         magic number with symbolic constant.
2690         (dump_incremental_inputs): Update version number.
2691         * incremental.cc (Output_section_incremental_inputs): Update version
2692         number; import symbolic constants from Incremental_inputs_reader.
2693         (Incremental_inputs::create_data_sections): Align relocations
2694         section correctly for 64-bit targets.
2695         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2696         constants; add padding.
2697         (Output_section_incremental_inputs::write_header): Add assert for
2698         header_size.
2699         (Output_section_incremental_inputs::write_input_files): Add assert
2700         for input_entry_size.
2701         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2702         add assert for object_info_size, input_section_entry_size,
2703         global_sym_entry_size.
2704         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2705         for data structure sizes; use them.
2706         (Incremental_input_entry_reader): Import symbolic constants from
2707         Incremental_inputs_reader; use them.
2708
2709 2012-04-23  David S. Miller  <davem@davemloft.net>
2710
2711         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2712         and elf_flags_set_.
2713         (Target_sparc::Target_sparc): Initialize new fields.
2714         (Target_sparc::do_make_elf_object): New function.
2715         (Target_sparc::do_adjust_elf_header): New function.
2716
2717 2012-04-23  Cary Coutant  <ccoutant@google.com>
2718
2719         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2720         CU range table of gdb index.
2721
2722 2012-04-20  David S. Miller  <davem@davemloft.net>
2723
2724         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2725         instead of false.
2726
2727 2012-04-16  David S. Miller  <davem@davemloft.net>
2728
2729         * sparc.cc (Target_sparc::got_address): New function.
2730         (Sparc_relocate_functions::gdop_hix22): New function.
2731         (Sparc_relocate_functions::gdop_lox10): New function.
2732         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2733         relocs.
2734         (Target_sparc::Scan::local): Likewise if the global symbol is not
2735         preemptible and is not IFUNC.
2736         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2737         transformations for local and non-preemptible non-IFUNC global
2738         symbols.
2739
2740         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2741         writing out 64-bit part of ranges.
2742
2743         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2744         -fpic and -fpie respectively.
2745         * Makefile.in: Regenerate.
2746
2747         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2748         (Target_sparc::Target_sparc): Initialize new field.
2749         (Target_sparc::do_plt_section_for_global): New function.
2750         (Target_sparc::do_plt_section_for_local): New function.
2751         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2752         (Target_sparc::make_plt_section): New function, broken out of
2753         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2754         (Target_sparc::make_plt_entry): Call make_plt_section.
2755         (Target_sparc::make_local_ifunc_plt_entry): New function.
2756         (Target_sparc::rela_ifunc_section): New function.
2757         (Target_sparc::plt_section): Remove const.
2758         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2759         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2760         and ifunc_count_ fields.
2761         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2762         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2763         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2764         (Output_data_plt_sparc::rela_ifunc): New function.
2765         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2766         (Output_data_plt_sparc::has_ifunc_section): New function.
2767         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2768         (Output_data_plt_sparc::address_for_global): New function.
2769         (Output_data_plt_sparc::address_for_local): New function.
2770         (Output_data_plt_sparc::plt_index_to_offset): New function.
2771         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2772         and entry_count.
2773         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2774         entry_count.
2775         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2776         R_SPARC_JMP_IREL to switch.
2777         (Target_sparc::Scan::check_non_pic): Likewise.
2778         (Target_sparc::Scan::local): Handle IFUNC symbols.
2779         (Target_sparc::Scan::local): Likewise.
2780         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2781         and plt_address_for_local.
2782         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2783         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2784
2785         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2786         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2787         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2788         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2789         global relocs too.
2790         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2791         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2792         calls.
2793         * sparc.cc (Target_sparc::Scan::global): Likewise.
2794         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2795
2796 2012-04-16  Cary Coutant  <ccoutant@google.com>
2797
2798         * archive.cc (Library_base::should_include_member): Check for
2799         --export-dynamic-symbol.
2800         * options.h (class General_options): Add --export-dynamic-symbol.
2801         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2802         --export-dynamic-symbol.
2803         (Symbol_table::gc_mark_undef_symbols): Likewise.
2804         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2805
2806 2012-04-12  David S. Miller  <davem@davemloft.net>
2807
2808         * sparc.cc (Reloc::wdisp10): New relocation method.
2809         (Reloc::h34): Likewise.
2810         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2811         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2812         R_SPARC_WDISP10.
2813         (Target_sparc::Scan::local): Likewise.
2814         (Target_sparc::Scan::global): Likewise.
2815         (Target_sparc::Relocate::relocate): Likewise.
2816
2817 2012-04-09  Cary Coutant  <ccoutant@google.com>
2818
2819         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2820         low_pc == 0.
2821
2822 2012-04-06  Ian Lance Taylor  <iant@google.com>
2823
2824         * timer.cc: #include <unistd.h>.
2825
2826 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2827
2828         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2829         * config.in: Regenerate.
2830         * configure: Regenerate.
2831
2832 2012-04-05  Nick Clifton  <nickc@redhat.com>
2833
2834         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2835         (AM_LC_MESSAGES): Add.
2836         * aclocal.m4: Regenerate.
2837         * config.in: Regenerate.
2838         * configure: Regenerate.
2839
2840 2012-03-21  Cary Coutant  <ccoutant@google.com>
2841
2842         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2843         * Makefile.in: Regenerate.
2844         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2845         (Sized_elf_reloc_mapper::symbol_section): New function.
2846         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2847         (make_elf_reloc_mapper): New function.
2848         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2849         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2850         (Dwarf_abbrev_table::do_get_abbrev): New function.
2851         (Dwarf_ranges_table::read_ranges_table): New function.
2852         (Dwarf_ranges_table::read_range_list): New function.
2853         (Dwarf_pubnames_table::read_section): New function.
2854         (Dwarf_pubnames_table::read_header): New function.
2855         (Dwarf_pubnames_table::next_name): New function.
2856         (Dwarf_die::Dwarf_die): New function.
2857         (Dwarf_die::read_attributes): New function.
2858         (Dwarf_die::skip_attributes): New function.
2859         (Dwarf_die::set_name): New function.
2860         (Dwarf_die::set_linkage_name): New function.
2861         (Dwarf_die::attribute): New function.
2862         (Dwarf_die::string_attribute): New function.
2863         (Dwarf_die::int_attribute): New function.
2864         (Dwarf_die::uint_attribute): New function.
2865         (Dwarf_die::ref_attribute): New function.
2866         (Dwarf_die::child_offset): New function.
2867         (Dwarf_die::sibling_offset): New function.
2868         (Dwarf_info_reader::check_buffer): New function.
2869         (Dwarf_info_reader::parse): New function.
2870         (Dwarf_info_reader::do_parse): New function.
2871         (Dwarf_info_reader::do_read_string_table): New function.
2872         (Dwarf_info_reader::lookup_reloc): New function.
2873         (Dwarf_info_reader::get_string): New function.
2874         (Dwarf_info_reader::visit_compilation_unit): New function.
2875         (Dwarf_info_reader::visit_type_unit): New function.
2876         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2877         Sized_elf_reloc_mapper.
2878         (Sized_dwarf_line_info::symbol_section): Remove function.
2879         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2880         (Sized_dwarf_line_info::read_line_mappings): Remove object
2881         parameter, adjust callers.
2882         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2883         * dwarf_reader.h: Include <sys/types.h>.
2884         (class Track_relocs): Remove forward declaration.
2885         (class Elf_reloc_mapper): New class.
2886         (class Sized_elf_reloc_mapper): New class.
2887         (class Dwarf_abbrev_table): New class.
2888         (class Dwarf_range_list): New class.
2889         (class Dwarf_ranges_table): New class.
2890         (class Dwarf_pubnames_table): New class.
2891         (class Dwarf_die): New class.
2892         (class Dwarf_info_reader): New class.
2893         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2894         (Sized_dwarf_line_info::symbol_section): Remove member function.
2895         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2896         base class.
2897         * gdb-index.cc: New source file.
2898         * gdb-index.h: New source file.
2899         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2900         and .debug_types sections, call Layout::add_to_gdb_index.
2901         (Sized_relobj_incr::do_section_name): Implement.
2902         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2903         return type; Implement.
2904         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2905         return type.
2906         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2907         parameter list and return type.
2908         (Sized_incr_dynobj::do_section_contents): Likewise.
2909         * layout.cc: Include gdb-index.h.
2910         (Layout::Layout): Initialize gdb_index_data_.
2911         (Layout::init_fixed_output_section): Check for .gdb_index section.
2912         (Layout::add_to_gdb_index): New function. Instantiate.
2913         * layout.h: Add forward declaration for class Gdb_index.
2914         (Layout::add_to_gdb_index): New member function.
2915         (Layout::gdb_index_data_): New data member.
2916         * main.cc: Include gdb-index.h.
2917         (main): Print statistics for gdb index.
2918         * object.cc (Object::section_contents): Move code into
2919         do_section_contents.
2920         (need_decompressed_section): Check for sections needed when building
2921         gdb index.
2922         (build_compressed_section_map): Likewise.
2923         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2924         gdb index.
2925         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2926         sections; call Layout::add_to_gdb_index.
2927         (Sized_relobj_file::do_decompressed_section_contents): Call
2928         do_section_contents directly.
2929         * object.h (Object::do_section_contents): Adjust parameter list and
2930         return type.
2931         (Object::do_decompressed_section_contents): Call do_section_contents
2932         directly.
2933         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2934         return type.
2935         * options.h (class General_options): Add --gdb-index option.
2936         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2937         list and return type.
2938         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2939         * reloc.h (Track_relocs::checkpoint): New function.
2940         (Track_relocs::reset): New function.
2941
2942         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2943         New test cases.
2944         * testsuite/Makefile.in: Regenerate.
2945         * testsuite/gdb_index_test.cc: New test source file.
2946         * testsuite/gdb_index_test_1.sh: New test source file.
2947         * testsuite/gdb_index_test_2.sh: New test source file.
2948
2949 2012-03-19  Doug Kwan  <dougkwan@google.com>
2950
2951         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2952         (Target_arm::do_finalize_sections): Remove code which defines
2953         __exidx_start and __exidx_end.  Make symbol table parameter
2954         anonymous as it is not used.
2955         * gold.cc (queue_middle_tasks): Call target hook to define any
2956         target-specific symbols.
2957         * target.h (Target::define_standard_symbols): New method.
2958         (Target::do_define_standard_symbols): Same.
2959         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2960         * testsuite/Makefile.in: Regenerate.
2961         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2962         and __exidx_end.
2963         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2964         relocations are generated for __exidx_start and __exidx_end.
2965
2966 2012-03-16  Doug Kwan  <dougkwan@google.com>
2967
2968         * testsuite/Makefile.am: Disable test initpri3b.
2969         * testsuite/Makefile.in: Regenerate.
2970
2971 2012-03-15  Doug Kwan  <dougkwan@google.com>
2972
2973         * arm.cc (Target_arm::got_section): Make .got section read-only
2974         if -z now is given.
2975
2976 2012-03-15  Ian Lance Taylor  <iant@google.com>
2977
2978         PR gold/13850
2979         * layout.cc (Layout::make_output_section): Correctly mark
2980         SHT_INIT_ARRAY, et. al., as relro.
2981
2982 2012-03-14  Doug Kwan  <dougkwan@google.com>
2983
2984         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2985         dynamic relocations for protected symbols in shared objects.
2986
2987 2012-03-13  Ian Lance Taylor  <iant@google.com>
2988
2989         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2990         keep the larger alignment.
2991
2992 2012-03-12  Cary Coutant  <ccoutant@google.com>
2993
2994         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2995         handling of DW_LNE_define_file.
2996
2997 2012-03-12  Cary Coutant  <ccoutant@google.com>
2998
2999         * reduced_debug_output.cc
3000         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3001         codes to switch.
3002
3003 2012-02-29  Cary Coutant  <ccoutant@google.com>
3004
3005         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3006
3007 2012-02-29  Cary Coutant  <ccoutant@google.com>
3008
3009         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3010         Call Object::decompressed_section_contents.
3011         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3012         New dtor.
3013         (Sized_dwarf_line_info::buffer_start_): New data member.
3014         * merge.cc (Output_merge_data::do_add_input_section): Call
3015         Object::decompressed_section_contents.
3016         (Output_merge_string::do_add_input_section): Likewise.
3017         * object.cc (need_decompressed_section): New function.
3018         (build_compressed_section_map): Decompress sections needed later.
3019         (Sized_relobj_file::do_decompressed_section_contents): New function.
3020         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3021         * object.h (Object::decompressed_section_contents): New function.
3022         (Object::discard_decompressed_sections): New function.
3023         (Object::do_decompressed_section_contents): New function.
3024         (Object::do_discard_decompressed_sections): New function.
3025         (Compressed_section_info): New type.
3026         (Compressed_section_map): Include decompressed section contents.
3027         (Sized_relobj_file::do_decompressed_section_contents): New function.
3028         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3029
3030 2012-02-16  Cary Coutant  <ccoutant@google.com>
3031
3032         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3033         * testsuite/Makefile.in: Regenerate.
3034
3035 2012-02-14  Cary Coutant  <ccoutant@google.com>
3036
3037         * options.cc (General_options::finalize): Disallow -pie and -static.
3038
3039 2012-02-03  Doug Kwan  <dougkwan@google.com>
3040
3041         * arm.cc (Arm_relocate_functions::abs8,
3042         Arm_relocate_functions::abs16): Use
3043         Bits::has_signed_unsigned_overflow32.
3044         (Arm_relocate_functions::thm_abs8): Correct range of
3045         overflow check.
3046         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3047         in assertions.
3048
3049 2012-02-02  Doug Kwan  <dougkwan@google.com>
3050
3051         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3052         position independent outputs, not just shared objects.
3053
3054 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3055
3056         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3057         * configure: Regenerated.
3058
3059 2012-01-27  Ian Lance Taylor  <iant@google.com>
3060
3061         * reloc.h (Bits): New class with static functions, copied from
3062         namespace utils in arm.cc.
3063         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3064         instead.
3065
3066 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3067
3068         * incremental.cc (write_info_blocks): Correct relocation offset.
3069
3070 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3071
3072         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3073         (Relocate::tls_gd_to_le): Likewise.
3074
3075 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3076
3077         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3078
3079 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3080
3081         * configure.ac: Check if -mcmodel=medium works.
3082         * configure: Regenerated.
3083
3084 2012-01-24  Cary Coutant  <ccoutant@google.com>
3085
3086         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3087         definition and ...
3088         (read_unsigned_LEB_128_x): ... this new function.
3089         (read_signed_LEB_128): Replaced with inline definition and ...
3090         (read_signed_LEB_128_x): ... this new function.
3091         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3092         (read_unsigned_LEB_128): Add inline definition.
3093         (read_signed_LEB_128_x): New function.
3094         (read_signed_LEB_128): Add inline definition.
3095         * testsuite/Makefile.am (leb128_unittest): New unit test.
3096         * testsuite/Makefile.in: Regenerate.
3097         * testsuite/leb128_unittest.cc: New unit test.
3098
3099 2012-01-23  Ian Lance Taylor  <iant@google.com>
3100
3101         PR gold/13617
3102         * i386.cc (Target_i386::do_code_fill): When using a jmp
3103         instruction, pad with nop instructions.
3104         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3105
3106 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3107
3108         * x86_64.cc (gc_process_relocs): Add typename on types used in
3109         template.
3110         (scan_relocs): Likewise.
3111         (relocate_section): Likewise.
3112         (apply_relocation): Likewise.
3113
3114 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3115
3116         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3117         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3118         under x32.
3119
3120 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3121
3122         * x86_64.cc: Initial support for x32.
3123
3124 2012-01-03  Cary Coutant  <ccoutant@google.com>
3125
3126         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3127         Use abstract base class for GOT.
3128         * gold/output.h (class Output_data_got_base): New abstract base class.
3129         (class Output_data_got): Derive from new base class, adjust ctors.
3130         (Output_data_got::reserve_slot): Make virtual; rename to
3131         do_reserve_slot; Adjust callers.
3132         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3133         pointer to abstract base class.
3134         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3135
3136 2011-12-18  Ian Lance Taylor  <iant@google.com>
3137
3138         * object.h (Relobj::local_symbol_value): New function.
3139         (Relobj::local_plt_offset): New function.
3140         (Relobj::local_has_got_offset): New function.
3141         (Relobj::local_got_offset): New function.
3142         (Relobj::set_local_got_offset): New function.
3143         (Relobj::do_local_symbol_value): New pure virtual function.
3144         (Relobj::do_local_plt_offset): Likewise.
3145         (Relobj::do_local_has_got_offset): Likewise.
3146         (Relobj::do_local_got_offset): Likewise.
3147         (Relobj::do_set_local_got_offset): Likewise.
3148         (Sized_relobj::do_local_has_got_offset): Rename from
3149         local_has_got_offset.
3150         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3151         (Sized_relobj::do_set_local_got_offset): Rename from
3152         set_local_got_offset.
3153         (Sized_relobj_file::do_local_plt_offset): Rename from
3154         local_plt_offset.
3155         (Sized_relobj_file::do_local_symbol_value): New function.
3156         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3157         local_plt_offset.
3158         * output.cc (Output_data_got::Got_entry::write): Change object to
3159         Relobj.  Use local_symbol_value.
3160         (Output_data_got::add_global_with_rel): Change rel_dyn to
3161         Output_data_reloc_generic*.  Use add_global_generic.
3162         (Output_data_got::add_global_with_rela): Remove.  Change all
3163         callers to use add_global_with_rel.
3164         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3165         Output_data_reloc_generic*.  Use add_global_generic.
3166         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3167         callers to use add_global_pair_with_rel.
3168         (Output_data_got::add_local): Change object to Relobj*.
3169         (Output_data_got::add_local_plt): Likewise.
3170         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3171         change rel_dyn to Output_data_reloc_generic*.  Use
3172         add_local_generic.
3173         (Output_data_got::add_local_with_rela): Remove.  Change all
3174         callers to use all_local_with_rel.
3175         (Output_data_got::add_local_pair_with_rel): Change object to
3176         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3177         add_output_section_generic.
3178         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3179         callers to use add_local_pair_with_rel.
3180         (Output_data_got::reserve_local): Change object to Relobj*.
3181         * output.h: (class Output_data_reloc_generic): Add pure virtual
3182         declarations for add_global_generic, add_local_generic,
3183         add_output_section_generic.
3184         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3185         functions for Output_data_reloc_generic.  Update declarations for
3186         changes listed in output.cc.
3187         (class Output_data_got): Change template parameter to got_size.
3188         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3189         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3190         function.
3191         (Sized_relobj_incr::do_local_plt_offset): New function.
3192         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3193         add_global_generic.
3194
3195 2011-12-17  Cary Coutant  <ccoutant@google.com>
3196
3197         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3198         * resolve.cc (Symbol_table::resolve): Likewise.
3199         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3200         arrays.
3201         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3202
3203 2011-12-16  Ian Lance Taylor  <iant@google.com>
3204
3205         * output.h (Output_data_reloc_generic::add): Only call
3206         add_dynamic_reloc if this is a dynamic reloc section.
3207
3208 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3209
3210         PR gold/13505
3211         * target-reloc.h (apply_relocation): Replace <64, false> with
3212         <size, big_endian>.
3213
3214 2011-11-25  Nick Clifton  <nickc@redhat.com>
3215
3216         * po/it.po: New Italian translation.
3217
3218 2011-11-17  Sterling Augustine  <saugustine@google.com>
3219
3220         * script.cc (script_include_directive): Implement.
3221         (read_script_file): New local variables name and search_path. Update
3222         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3223         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3224         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3225
3226 2011-11-11  Sterling Augustine  <saugustine@google.com>
3227
3228         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3229         (file_or_sections_cmd): Likewise.
3230
3231 2011-11-11  Doug Kwan  <dougkwan@google.com>
3232
3233         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3234         if --just-symbols is given.
3235
3236 2011-11-10  Doug Kwan  <dougkwan@google.com>
3237
3238         PR gold/13362
3239         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3240         when processing data relocs.
3241         * reloc.h (Relocate_functions::rel_unaligned): New method.
3242         (Relocate_functions::pcrel_unaligned): Ditto.
3243         (Relocate_functions::rel32_unaligned): Ditto.
3244         (Relocate_functions::pcrel32_unaligned): Ditto.
3245
3246 2011-11-09  Doug Kwan  <dougkwan@google.com>
3247
3248         PR gold/13362
3249         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3250         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3251         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3252         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3253         (Relocate_functions::rel_unaligned): New.
3254         (Relocate_functions::rel32_unaligned): New.
3255         * target-reloc.h (relocate_for_relocatable): Add code to handle
3256         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3257         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3258         arm_unaligned_reloc_r): New targets.
3259         * testsuite/Makefile.in: Regenerate.
3260         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3261         linking.
3262
3263 2011-11-02  Ian Lance Taylor  <iant@google.com>
3264
3265         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3266         NATIVE_LINKER.
3267         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3268         * options.cc (General_options::finalize): Use library search path
3269         from configure script if specified.  If not native and no sysroot,
3270         only search TOOLLIBDIR.
3271         * options.h (Search_directory::Search_directory): Change name to
3272         const std::string&.
3273         (General_options::add_to_library_path_with_sysroot): Change arg to
3274         const std::string&.
3275         * configure, Makefile.in, config.in: Rebuild.
3276
3277 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3278
3279         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3280         we are working around the ARM1176 Erratum.
3281         * options.h (General_options::fix_arm1176): Add option.
3282         * testsuite/Makefile.am: Add testcases, and keep current ones
3283         working.
3284         * testsuite/Makefile.in: Regenerate.
3285         * testsuite/arm_fix_1176.s: New file.
3286         * testsuite/arm_fix_1176.sh: Likewise.
3287
3288 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3289
3290         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3291         may_use_blx_.
3292         (Target_arm::may_use_blx): Remove method.
3293         (Target_arm::set_may_use_blx): Likewise.
3294         (Target_arm::may_use_v4t_interworking): New method.
3295         (Target_arm::may_use_v5t_interworking): Likewise.
3296         (Target_arm::may_use_blx_): Remove member variable.
3297         (Arm_relocate_functions::arm_branch_common): Check for v5T
3298         interworking.
3299         (Arm_relocate_functions::thumb_branch_common): Likewise.
3300         (Reloc_stub::stub_type_for_reloc): Likewise.
3301         (Target_arm::do_finalize_sections): Correct interworking checks.
3302         * testsuite/Makefile.am: Add new tests.
3303         * testsuite/Makefile.in: Regenerate.
3304         * testsuite/arm_farcall_arm_arm.s: New test.
3305         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3306         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3307         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3308         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3309         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3310         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3311         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3312
3313 2011-10-31  Cary Coutant  <ccoutant@google.com>
3314
3315         PR gold/13023
3316         * expression.cc (Expression::eval_with_dot): Add
3317         is_section_dot_assignment parameter.
3318         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3319         absolute and assigning to dot within a section.
3320         * script-sections.cc
3321         (Output_section_element_assignment::set_section_addresses): Pass
3322         dot_section to set_if_absolute.
3323         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3324         as is_section_dot_assignment flag to eval_with_dot.
3325         (Output_section_element_dot_assignment::set_section_addresses):
3326         Likewise.
3327         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3328         parameter.  Also set value if relative to dot_section; set the
3329         symbol's output_section.
3330         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3331         parameter.  Adjust all callers.
3332         (Expression::eval_maybe_dot): Likewise.
3333         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3334         Adjust all callers.
3335         * testsuite/script_test_2.t: Test assignment of an absolute value
3336         to dot within an output section element.
3337
3338 2011-10-31  Cary Coutant  <ccoutant@google.com>
3339
3340         * options.h (class General_options): Add --[no-]gnu-unique options.
3341         * symtab.cc (Symbol_table::sized_write_globals): Convert
3342         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3343
3344 2011-10-31  Cary Coutant  <ccoutant@google.com>
3345
3346         PR gold/13359
3347         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3348         unnecessary assertion.
3349         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3350
3351 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3352
3353         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3354         gc_mark_symbol.
3355         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3356         gc_mark_symbol.
3357         Change to just keep the section associated with symbol.
3358         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3359         they are externally visible and --export-dynamic is turned on.
3360         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3361
3362 2011-10-19  Ian Lance Taylor  <iant@google.com>
3363
3364         PR gold/13163
3365         * script-sections.cc
3366         (Output_section_element_dot_assignment::needs_output_section): New
3367         function.
3368
3369 2011-10-19  Ian Lance Taylor  <iant@google.com>
3370
3371         PR gold/13204
3372         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3373         --section-start option was seen.
3374         * options.h (General_options::any_section_start): New function.
3375
3376 2011-10-18  David S. Miller  <davem@davemloft.net>
3377
3378         PR binutils/13301
3379         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3380         member to track relocation locations that have moved during TLS
3381         reloc optimizations.
3382         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3383         (Target_sparc::Relocate::relocate): Adjust view down by 4
3384         bytes if it matches reloc_adjust_addr_.
3385         (Target_sparc::Relocate::relocate_tls): Always move the
3386         __tls_get_addr call delay slot instruction forward 4 bytes when
3387         performing relaxation.
3388
3389 2011-10-18  Cary Coutant  <ccoutant@google.com>
3390
3391         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3392         (Output_file::map_no_anonymous): Check for non-zero
3393         return code from posix_fallocate.
3394
3395 2011-10-17  Cary Coutant  <ccoutant@google.com>
3396
3397         PR gold/13245
3398         * plugin.cc (is_visible_from_outside): Check for symbols
3399         referenced from dynamic objects.
3400         * resolve.cc (Symbol_table::resolve): Don't count references
3401         from dynamic objects as references from real ELF files.
3402         * testsuite/plugin_test_2.sh: Adjust expected result.
3403
3404 2011-10-17  Cary Coutant  <ccoutant@google.com>
3405
3406         * gold.cc: Include timer.h.
3407         (queue_middle_tasks): Stamp time.
3408         (queue_final_tasks): Likewise.
3409         * main.cc (main): Store timer in parameters.  Print timers
3410         for each pass.
3411         * parameters.cc (Parameters::Parameters): Initialize timer_.
3412         (Parameters::set_timer): New function.
3413         (set_parameters_timer): New function.
3414         * parameters.h (Parameters::set_timer): New function.
3415         (Parameters::timer): New function.
3416         (Parameters::timer_): New data member.
3417         (set_parameters_timer): New function.
3418         * timer.cc (Timer::stamp): New function.
3419         (Timer::get_pass_time): New function.
3420         * timer.h (Timer::stamp): New function.
3421         (Timer::get_pass_time): New function.
3422         (Timer::pass_times_): New data member.
3423
3424 2011-10-17  Cary Coutant  <ccoutant@google.com>
3425
3426         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3427         task for members of lib groups.
3428
3429 2011-10-17  Cary Coutant  <ccoutant@google.com>
3430
3431         PR gold/13288
3432         * fileread.cc (File_read::find_view): Add assert.
3433         (File_read::make_view): Move bounds check (replace with assert)...
3434         (File_read::find_or_make_view): ... to here.
3435
3436 2011-10-12  Cary Coutant  <ccoutant@google.com>
3437
3438         * output.cc (Output_file::open_base_file): Handle case where
3439         ::read returns less than requested size.
3440
3441 2011-10-10  Cary Coutant  <ccoutant@google.com>
3442
3443         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3444         Initialize defined_count_.
3445         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3446         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3447         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3448         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3449         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3450         * incremental.h (Sized_relobj_incr::defined_count_): New data
3451         member.
3452         (Sized_incr_dynobj::defined_count_): New data member.
3453         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3454         Return zeroes instead of internal error.
3455
3456 2011-10-10  Cary Coutant  <ccoutant@google.com>
3457
3458         PR gold/13249
3459         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3460         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3461         * output.h (class Output_reloc): Add use_plt_offset flag.
3462         (Output_reloc::type_): Adjust size of bit field.
3463         (Output_reloc::use_plt_offset_): New bit field.
3464         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3465         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3466         flag.  Adjust all callers.
3467         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3468         creating RELATIVE relocations.
3469
3470 2011-10-10  Nick Clifton  <nickc@redhat.com>
3471
3472         * po/es.po: Updated Spanish translation.
3473         * po/fi.po: Updated Finnish translation.
3474
3475 2011-10-03   Diego Novillo  <dnovillo@google.com>
3476
3477         * options.cc (parse_uint): Fix dereference of RETVAL.
3478
3479 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3480
3481         * layout.h (section_order_map_): New member.
3482         (get_section_order_map): New member function.
3483         * output.cc (Output_section::add_input_section): Check for patterns
3484         only when --section-ordering-file is specified.
3485         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3486         output_sections have been formed.
3487         * layout.cc (Layout_Layout): Initialize section_order_map_.
3488         * plugin.cc (update_section_order): Store order in order_map. Do not
3489         update the order.
3490         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3491         * testsuite/Makefile.in: Regenerate.
3492         * testsuite/plugin_section_order.c: New file.
3493         * testsuite/plugin_final_layout.cc: New file.
3494         * testsuite/plugin_final_layout.sh: New file.
3495
3496 2011-09-29  Cary Coutant  <ccoutant@google.com>
3497
3498         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3499         Check for NULL.
3500         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3501         symbols during incremental update.
3502         (Symbol_table::add_from_dynobj): Likewise.
3503
3504 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3505             Ian Lance Taylor  <iant@google.com>
3506
3507         * symtab.cc (Symbol_table::define_special_symbol): Always
3508         canonicalize version string.
3509
3510 2011-09-26  Cary Coutant  <ccoutant@google.com>
3511
3512         * gold.cc (queue_initial_tasks): Move option checks ...
3513         * options.cc (General_options::finalize): ... to here. Disable
3514         some options; make others fatal.
3515
3516 2011-09-26  Cary Coutant  <ccoutant@google.com>
3517
3518         gcc PR lto/47247
3519         * plugin.cc (get_symbols_v2): New function.
3520         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3521         (is_referenced_from_outside): New function.
3522         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3523         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3524         (get_symbols): Pass version parameter.
3525         (get_symbols_v2): New function.
3526         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3527         parameter.
3528         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3529         (onload): Add LDPT_GET_SYMBOLS_V2.
3530         (all_symbols_read_hook): Use get_symbols_v2; check for
3531         LDPR_PREVAILING_DEF_IRONLY_EXP.
3532         * testsuite/plugin_test_3.sh: Update expected results.
3533
3534 2011-09-23  Simon Baldwin  <simonb@google.com>
3535
3536         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3537         configuration options.
3538         * configure: Regenerate.
3539         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3540         * Makefile.in: Regenerate.
3541         * testsuite/Makefile.in: Regenerate.
3542
3543 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3544
3545         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3546
3547 2011-09-19  Cary Coutant  <ccoutant@google.com>
3548
3549         * incremental.cc (can_incremental_update): Fix typo in comment.
3550         * incremental.h (can_incremental_update): Likewise.
3551
3552 2011-09-18  Cary Coutant  <ccoutant@google.com>
3553
3554         * incremental.cc (can_incremental_update): New function.
3555         * incremental.h (can_incremental_update): New function.
3556         * layout.cc (Layout::init_fixed_output_section): Call it.
3557         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3558         * object.cc (Sized_relobj_file::do_layout): Call
3559         can_incremental_update.
3560
3561 2011-09-13  Cary Coutant  <ccoutant@google.com>
3562
3563         * configure.ac: Check for glibc support for gnu_indirect_function
3564         support with static linking, setting automake conditional
3565         IFUNC_STATIC.
3566         * Makefile.in: Regenerate.
3567         * configure: Regenerate.
3568
3569         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3570         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3571         for IFUNC_STATIC.
3572         * testsuite/Makefile.in: Regenerate.
3573
3574 2011-09-13  Cary Coutant  <ccoutant@google.com>
3575
3576         * incremental.cc (Sized_relobj_incr::do_layout): Call
3577         report_comdat_group for kept comdat sections.
3578         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3579         * testsuite/Makefile.in: Regenerate.
3580         * testsuite/incr_comdat_test_1.cc: New source file.
3581         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3582         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3583         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3584
3585 2011-09-13  Ian Lance Taylor  <iant@google.com>
3586
3587         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3588         variable external_symbols_offset.
3589
3590 2011-09-12  Ian Lance Taylor  <iant@google.com>
3591
3592         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3593         triggered if object has no symbols.
3594
3595 2011-09-09  David S. Miller  <davem@davemloft.net>
3596
3597         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3598         (Output_fill_debug_line::do_write): Likewise.
3599
3600 2011-08-29  Cary Coutant  <ccoutant@google.com>
3601
3602         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3603         casts to match formatting specs.
3604         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3605
3606 2011-08-26  Cary Coutant  <ccoutant@google.com>
3607
3608         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3609         remaining hole size when allocating.
3610         (Layout::make_output_section): Set fill methods for debug sections.
3611         * layout.h (Free_list::Free_list_node): Move from private to
3612         public.
3613         (Free_list::set_min_hole_size): New function.
3614         (Free_list::begin, Free_list::end): New functions.
3615         (Free_list::min_hole_): New data member.
3616         * output.cc: Include dwarf.h.
3617         (Output_fill_debug_info::do_minimum_hole_size): New function.
3618         (Output_fill_debug_info::do_write): New function.
3619         (Output_fill_debug_line::do_minimum_hole_size): New function.
3620         (Output_fill_debug_line::do_write): New function.
3621         (Output_section::Output_section): Initialize new data member.
3622         (Output_section::set_final_data_size): Ensure patch space is larger
3623         than minimum hole size.
3624         (Output_section::do_write): Fill holes in debug sections.
3625         * output.h (Output_fill): New class.
3626         (Output_fill_debug_info): New class.
3627         (Output_fill_debug_line): New class.
3628         (Output_section::set_free_space_fill): New function.
3629         (Output_section::free_space_fill_): New data member.
3630         * testsuite/Makefile.am (incremental_test_3): Add
3631         --incremental-patch option.
3632         (incremental_test_4): Likewise.
3633         (incremental_test_5): Likewise.
3634         (incremental_test_6): Likewise.
3635         (incremental_copy_test): Likewise.
3636         (incremental_common_test_1): Likewise.
3637         * testsuite/Makefile.in: Regenerate.
3638
3639 2011-08-26  Nick Clifton  <nickc@redhat.com>
3640
3641         * po/es.po: Updated Spanish translation.
3642
3643 2011-08-01  Cary Coutant  <ccoutant@google.com>
3644
3645         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3646         * gold/testsuite/Makefile.in: Regenerate.
3647         * gold/testsuite/justsyms_exec.c: New source file.
3648         * gold/testsuite/justsyms_lib.c: New source file.
3649
3650 2011-08-01  Cary Coutant  <ccoutant@google.com>
3651
3652         * layout.cc (Layout::set_segment_offsets): Don't realign text
3653         segment if -Ttext was specified.
3654         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3655         file type.
3656         * object.h (Sized_relobj_file::e_type): New function.
3657         (Sized_relobj_file::e_type_): New data member.
3658         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3659         base address for ET_EXEC files.
3660         * target.cc (Target::do_make_elf_object_implementation): Allow
3661         ET_EXEC files with --just-symbols option.
3662
3663 2011-07-28  Cary Coutant  <ccoutant@google.com>
3664
3665         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3666         Add thread_number parameter.
3667         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3668         * workqueue-threads.cc
3669         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3670         current thread if its thread number is greater than desired thread
3671         count.
3672         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3673         Add thread_number parameter.
3674         (Workqueue::should_cancel_thread): Likewise.
3675         (Workqueue::find_runnable_or_wait): Pass thread_number to
3676         should_cancel_thread.
3677         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3678         parameter.
3679
3680 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3681
3682         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3683         only after checking if it cannot be forced local.
3684         * symtab.h (is_externally_visible): Check if the symbol is not forced
3685         local.
3686
3687 2011-07-15  Ian Lance Taylor  <iant@google.com>
3688
3689         * options.h (class General_options): Add --print-output-format.
3690         Move -EL next to -EB, for  better --help output.
3691         * target-select.cc: Include <cstdio>, "options.h", and
3692         "parameters.h".
3693         (Target_selector::do_target_bfd_name): New function.
3694         (print_output_format): New function.
3695         * target-select.h (class Target_selector): Update declarations.
3696         (Target_selector::target_bfd_name): New function.
3697         (print_output_format): Declare.
3698         * main.cc: Include "target-select.h".
3699         (main): Handle --print-output-format.
3700         * gold.cc: Include "target-select.h".
3701         (queue_initial_tasks): Handle --print-output-format when there are
3702         no input files.
3703         * parameters.cc (parameters_force_valid_target): Give a better
3704         error message if -EB/-EL does not match target.
3705         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3706         function.
3707
3708 2011-07-15  Ian Lance Taylor  <iant@google.com>
3709
3710         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3711         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3712         (Output_data_plt_i386::do_write): Write address of .dynamic
3713         section to first entry in .got.plt section.
3714         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3715         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3716         Initialize layout_.
3717         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3718         section to first entry in .got.plt section.
3719         * layout.h (Layout::dynamic_section): New function.
3720
3721 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3722
3723         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3724         to claim_file call.
3725         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3726         input_section_position_, and input_section_glob_.
3727         (read_layout_from_file): Call function section_ordering_specified.
3728         * layout.h (is_section_ordering_specified): New function.
3729         (section_ordering_specified): New function.
3730         (section_ordering_specified_): New boolean member.
3731         * main.cc(main): Call load_plugins after layout object is defined.
3732         * output.cc (Output_section::add_input_section): Use
3733         function section_ordering_specified to check if section ordering is
3734         needed.
3735         * output.cc (Output_section::add_relaxed_input_section): Use
3736         function section_ordering_specified to check if section ordering is
3737         needed.
3738         (Output_section::update_section_layout): New function.
3739         (Output_section::sort_attached_input_sections): Check if input section
3740         must be reordered.
3741         * output.h (Output_section::update_section_layout): New function.
3742         * plugin.cc (get_section_count): New function.
3743         (get_section_type): New function.
3744         (get_section_name): New function.
3745         (get_section_contents): New function.
3746         (update_section_order): New function.
3747         (allow_section_ordering): New function.
3748         (Plugin::load): Add the new interfaces to the transfer vector.
3749         (Plugin_manager::load_plugins): New parameter.
3750         (Plugin_manager::all_symbols_read): New parameter.
3751         (Plugin_manager::claim_file): New parameter. Save the elf object for
3752         unclaimed objects.
3753         (Plugin_manager::get_elf_object): New function.
3754         (Plugin_manager::get_view): Change to directly use the bool to check
3755         if get_view is called from claim_file_hook.
3756         * plugin.h (input_objects): New function
3757         (Plugin__manager::load_plugins): New parameter.
3758         (Plugin_manager::claim_file): New parameter.
3759         (Plugin_manager::get_elf_object): New function.
3760         (Plugin_manager::in_claim_file_handler): New function.
3761         (Plugin_manager::in_claim_file_handler_): New member.
3762         (layout): New function.
3763         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3764         handler with an extra parameter. Make the elf object before calling
3765         claim_file handler.
3766         * testsuite/plugin_test.c (get_section_count): New function pointer.
3767         (get_section_type): New function pointer.
3768         (get_section_name): New function pointer.
3769         (get_section_contents): New function pointer.
3770         (update_section_order): New function pointer.
3771         (allow_section_ordering): New function pointer.
3772         (onload): Check if the new interfaces exist.
3773
3774 2011-07-13  Ian Lance Taylor  <iant@google.com>
3775
3776         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3777         relro section.
3778         * x86_64.cc (Target_x86_64::got_section): Likewise.
3779         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3780         (relro_now_test_SOURCES): New variable.
3781         (relro_now_test_DEPENDENCIES): New variable.
3782         (relro_now_test_LDFLAGS): New variable.
3783         (relro_now_test_LDADD): New variable.
3784         (relro_now_test.so): New target.
3785         * testsuite/Makefile.in: Rebuild.
3786
3787 2011-07-12  Ian Lance Taylor  <iant@google.com>
3788
3789         PR gold/12980
3790         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3791         GLOB_DAT relocation rather than a RELATIVE relocation for a
3792         protected symbol when creating a shared library.
3793         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3794         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3795         * testsuite/protected_main_1.cc (main): Test that protected
3796         function has same address.
3797
3798 2011-07-11  Ian Lance Taylor  <iant@google.com>
3799
3800         PR gold/12979
3801         * options.h (class General_options): Add -Bgroup.
3802         * options.cc (General_options::finalize): If -Bgroup is set,
3803         default to --unresolved-symbols=report-all.
3804         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3805         * target-reloc.h (issue_undefined_symbol_error): Handle
3806         --unresolved-symbols=report-all.
3807
3808 2011-07-08  Ian Lance Taylor  <iant@google.com>
3809
3810         PR gold/11985
3811         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3812         if linker script discards key sections.
3813         (Layout::create_dynamic_symtab): Likewise.
3814         (Layout::assign_local_dynsym_offsets): Likewise.
3815         (Layout::sized_create_version_sections): Likewise.
3816         (Layout::create_interp): Likewise.
3817         (Layout::finish_dynamic_section): Likewise.
3818         (Layout::set_dynamic_symbol_size): Likewise.
3819
3820 2011-07-08  Ian Lance Taylor  <iant@google.com>
3821
3822         PR gold/12386
3823         * options.h (class General_options): Add --unresolved-symbols.
3824         * target-reloc.h (issue_undefined_symbol_error): Check
3825         --unresolved-symbols.  Add comments.
3826
3827 2011-07-08  Ian Lance Taylor  <iant@google.com>
3828
3829         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3830         expression more complex.
3831
3832 2011-07-08  Ian Lance Taylor  <iant@google.com>
3833
3834         PR gold/11317
3835         * target-reloc.h (issue_undefined_symbol_error): New inline
3836         function, broken out of relocate_section.
3837         (relocate_section): Call issue_undefined_symbol_error.
3838         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3839         there is no TLS segment if we are about to issue an undefined
3840         symbol error.
3841         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3842
3843 2011-07-08  Ian Lance Taylor  <iant@google.com>
3844
3845         PR gold/12279
3846         * resolve.cc (Symbol_table::should_override): Add fromtype
3847         parameter.  Change all callers.  Give error when linking together
3848         TLS and non-TLS symbol.
3849         (Symbol_table::should_override_with_special): Add fromtype
3850         parameter.  Change all callers.
3851         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3852         there is no TLS segment if we have reported some errors.
3853         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3854
3855 2011-07-08  Ian Lance Taylor  <iant@google.com>
3856
3857         PR gold/12372
3858         * target.h (Target::plt_address_for_global): New function.
3859         (Target::plt_address_for_local): New function.
3860         (Target::plt_section_for_global): Remove.
3861         (Target::plt_section_for_local): Remove.
3862         (Target::do_plt_address_for_global): New virtual function.
3863         (Target::do_plt_address_for_local): New virtual function.
3864         (Target::do_plt_section_for_global): Remove.
3865         (Target::do_plt_section_for_local): Remove.
3866         (Target::register_global_plt_entry): Add Symbol_table and Layout
3867         parameters.
3868         * output.cc (Output_data_got::Got_entry::write): Use
3869         plt_address_for_global and plt_address_for_local.
3870         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3871         address of output section.
3872         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3873         got_irelative_, and irelative_count_ fields.  Update
3874         declarations.
3875         (Output_data_plt_i386::has_irelative_section): New function.
3876         (Output_data_plt_i386::entry_count): Add irelative_count_.
3877         (Output_data_plt_i386::set_final_data_size): Likewise.
3878         (class Target_i386): Add got_irelative_ and rel_irelative_
3879         fields.  Update declarations.
3880         (Target_i386::Target_i386): Initialize new fields.
3881         (Target_i386::do_plt_address_for_global): New function replacing
3882         do_plt_section_for_global.
3883         (Target_i386::do_plt_address_for_local): New function replacing
3884         do_plt_section_for_local.
3885         (Target_i386::got_section): Create got_irelative_.
3886         (Target_i386::rel_irelative_section): New function.
3887         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3888         fields.  Don't define __rel_iplt_{start,end}.
3889         (Output_data_plt_i386::add_entry): Add symtab and layout
3890         parameters.  Change all callers.  Use different PLT and GOT for
3891         IFUNC symbols.
3892         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3893         layout parameters.  Change all callers.  Use different PLT and
3894         GOT.
3895         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3896         (Output_data_plt_i386::rel_irelative): New function.
3897         (Output_data_plt_i386::address_for_global): New function.
3898         (Output_data_plt_i386::address_for_local): New function.
3899         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3900         IRELATIVE GOT when changing IFUNC GOT entries.
3901         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3902         reloc.
3903         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3904         if we didn't create an IRELATIVE GOT.
3905         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3906         plt_address_for_local.
3907         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3908         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3909         got_irelative_, and irelative_count_ fields.  Update
3910         declarations.
3911         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3912         Initialize new fields.  Remove symtab parameter.  Change all
3913         callers.
3914         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3915         irelative_count_.
3916         (Output_data_plt_x86_64::has_irelative_section): New function.
3917         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3918         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3919         fields.  Update declarations.
3920         (Target_x86_64::Target_x86_64): Initialize new fields.
3921         (Target_x86_64::do_plt_address_for_global): New function replacing
3922         do_plt_section_for_global.
3923         (Target_x86_64::do_plt_address_for_local): New function replacing
3924         do_plt_section_for_local.
3925         (Target_x86_64::got_section): Create got_irelative_.
3926         (Target_x86_64::rela_irelative_section): New function.
3927         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3928         all callers.  Don't create __rel_iplt_{start,end}.
3929         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3930         parameters.  Change all callers.  Use different PLT and GOT for
3931         IFUNC symbols.
3932         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3933         layout parameters.  Change all callers.  Use different PLT and
3934         GOT.
3935         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3936         parameters.  Change all callers.  Use different PLT and GOT for
3937         IFUNC symbols.
3938         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3939         (Output_data_plt_x86_64::rela_irelative): New function.
3940         (Output_data_plt_x86_64::address_for_global): New function.
3941         (Output_data_plt_x86_64::address_for_local): New function.
3942         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3943         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3944         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3945         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3946         parameters.
3947         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3948         reloc.
3949         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3950         symbols if we didn't create an IRELATIVE GOT.
3951         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3952         plt_address_for_local.
3953         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3954         * testsuite/ifuncvar1.c: New test file.
3955         * testsuite/ifuncvar2.c: New test file.
3956         * testsuite/ifuncvar3.c: New test file.
3957         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3958         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3959         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3960         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3961         * testsuite/Makefile.in: Rebuild.
3962
3963 2011-07-07  Cary Coutant  <ccoutant@google.com>
3964
3965         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3966         (two_file_test_1_ndebug.o): Likewise.
3967         (two_file_test_1b_ndebug.o): Likewise.
3968         (two_file_test_2_ndebug.o): Likewise.
3969         (two_file_test_main_ndebug.o): Likewise.
3970         (incremental_test_2): Link with no-debug versions.
3971
3972 2011-07-06  Cary Coutant  <ccoutant@google.com>
3973
3974         * gold/incremental.cc
3975         (Output_section_incremental_inputs::write_info_blocks): Check for
3976         hidden and internal symbols.
3977
3978 2011-07-06  Cary Coutant  <ccoutant@google.com>
3979
3980         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3981         Check disposition for startup file.
3982         (Incremental_inputs::report_command_line): Ignore
3983         --incremental-startup-unchanged option.
3984         * options.cc (General_options::parse_incremental_startup_unchanged):
3985         New function.
3986         (General_options::General_options): Initialize new data member.
3987         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3988         (General_options): Add --incremental-startup-unchanged option.
3989         (General_options::incremental_startup_disposition): New function.
3990         (General_options::incremental_startup_disposition_): New data member.
3991
3992 2011-07-06  Cary Coutant  <ccoutant@google.com>
3993
3994         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3995         input file index to Script_info ctor.
3996         (Sized_incremental_binary::do_file_has_changed): Find the
3997         command-line argument for files named in scripts.
3998         * incremental.h (Script_info::Script_info): New ctor
3999         with input file index.
4000         (Script_info::input_file_index): New function.
4001         (Script_info::input_file_index_): New data member.
4002         (Incremental_binary::get_library): Add const.
4003         (Incremental_binary::get_script_info): Add const.
4004         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4005         * testsuite/Makefile.am (incremental_test_5): New test case.
4006         (incremental_test_6): New test case.
4007         * testsuite/Makefile.in: Regenerate.
4008
4009 2011-07-06  Cary Coutant  <ccoutant@google.com>
4010
4011         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4012         debug output when command lines differ.
4013
4014 2011-07-06  Cary Coutant  <ccoutant@google.com>
4015
4016         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4017         --incremental-patch option.
4018         * layout.cc (Free_list::allocate): Extend allocation beyond original
4019         end if enabled.
4020         (Layout::make_output_section): Mark sections that should get
4021         patch space.
4022         * options.cc (parse_percent): New function.
4023         * options.h (parse_percent): New function.
4024         (DEFINE_percent): New macro.
4025         (General_options): Add --incremental-patch option.
4026         * output.cc (Output_section::Output_section): Initialize new data
4027         members.
4028         (Output_section::add_input_section): Print section name when out
4029         of patch space.
4030         (Output_section::add_output_section_data): Likewise.
4031         (Output_section::set_final_data_size): Add patch space when
4032         doing --incremental-full.
4033         (Output_section::do_reset_address_and_file_offset): Remove patch
4034         space.
4035         (Output_segment::set_section_list_addresses): Print debug output
4036         only if --incremental-update.
4037         * output.h (Output_section::set_is_patch_space_allowed): New function.
4038         (Output_section::is_patch_space_allowed_): New data member.
4039         (Output_section::patch_space_): New data member.
4040         * parameters.cc (Parameters::incremental_full): New function.
4041         * parameters.h (Parameters::incremental_full): New function
4042         * testsuite/Makefile.am (incremental_test_2): Add test for
4043         --incremental-patch option.
4044         * testsuite/Makefile.in: Regenerate.
4045         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4046         (t18): Remove function body.
4047
4048 2011-07-05  Doug Kwan  <dougkwan@google.com>
4049
4050         PR gold/12771
4051         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4052         Arm_Address type for relocation result.
4053         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4054         overflow check.
4055         (Arm_relocate_functions::abs32): Use unaligned access.
4056         (Arm_relocate_functions::rel32): Ditto.
4057         (Arm_relocate_functions::prel31): Ditto.
4058         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4059         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4060         static data relocations.
4061         * testsuite/Makefile.in: Regnerate.
4062         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4063
4064 2011-07-05  Ian Lance Taylor  <iant@google.com>
4065
4066         PR gold/12392
4067         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4068         symbols if necessary.
4069         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4070
4071 2011-07-05  Ian Lance Taylor  <iant@google.com>
4072
4073         PR gold/12952
4074         * resolve.cc (Symbol::override_base_with_special): Simply override
4075         version with special symbol version, ignoring previous version.
4076
4077 2011-07-05  Ian Lance Taylor  <iant@google.com>
4078
4079         * object.cc (Sized_relobj_file::include_section_group): Add
4080         information to comment about signature location.
4081
4082 2011-07-02  Ian Lance Taylor  <iant@google.com>
4083
4084         PR gold/12957
4085         * options.h (class General_options): Add -f and -F.
4086         * options.cc (General_options::finalize): Fatal error if -f/-F
4087         are used without -shared.
4088         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4089
4090 2011-07-02  Ian Lance Taylor  <iant@google.com>
4091
4092         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4093
4094 2011-07-01  Ian Lance Taylor  <iant@google.com>
4095
4096         PR gold/12525
4097         PR gold/12952
4098         * resolve.cc (Symbol::override_base_with_special): Don't override
4099         the version if the overriding symbol has a different name.
4100         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4101         all callers.  If we give an error about an undefined version,
4102         define the base version if necessary.
4103         * dynobj.h (class Versions): Update declaration.
4104         * testsuite/weak_alias_test_5.cc: New file.
4105         * testsuite/weak_alias_test.script: New file.
4106         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4107         and versioned_alias have the right value, and call t2.
4108         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4109         weak_alias_test_5.so.
4110         (weak_alias_test_LDADD): Likewise.
4111         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4112         * testsuite/Makefile.in: Rebuild.
4113
4114 2011-07-01  Ian Lance Taylor  <iant@google.com>
4115
4116         PR gold/12525
4117         * options.h (class General_options): Support -z notext.
4118         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4119         -Wl,-z,notext.
4120         (two_file_shared_nonpic.so): Likewise.
4121         (two_file_shared_mixed.so): Likewise.
4122         (two_file_shared_mixed_1.so): Likewise.
4123         (weak_undef_lib_nonpic.so): Likewise.
4124         (alt/weak_undef_lib_nonpic.so): Likewise.
4125         (tls_test_shared_nonpic.so): Likewise.
4126         * testsuite/Makefile.in: Rebuild.
4127
4128 2011-07-01  Ian Lance Taylor  <iant@google.com>
4129
4130         PR gold/12525
4131         * configure.ac: Test whether static linking works, setting
4132         the automake conditional HAVE_STATIC.
4133         * testsuite/Makefile.am: Disable tests using -static if
4134         HAVE_STATIC is not true.
4135         * configure, testsuite/Makefile.in: Rebuild.
4136
4137 2011-07-01  Ian Lance Taylor  <iant@google.com>
4138
4139         PR gold/12525
4140         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4141         Assert if we see DW_EH_PE_indirect.
4142         * target.h (Target::ehframe_datarel_base): New function.
4143         (Target::do_ehframe_datarel_base): New target function.
4144         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4145         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4146         function.
4147
4148 2011-07-01  Ian Lance Taylor  <iant@google.com>
4149
4150         PR gold/12571
4151         * options.h (class General_options): Add
4152         --ld-generated-unwind-info.
4153         * ehframe.cc (Fde::write): Add address parameter.  Change all
4154         callers.  If associated with PLT, fill in address and size.
4155         (Cie::set_output_offset): Only add merge mapping if there is an
4156         object.
4157         (Cie::write): Add address parameter.  Change all callers.
4158         (Eh_frame::add_ehframe_for_plt): New function.
4159         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4160         input_offset_ fields into union u_, with new plt field.
4161         (Fde::Fde): Adjust for new union field.
4162         (Fde::Fde) [Output_data version]: New constructor.
4163         (Fde::add_mapping): Only add merge mapping if there is an object.
4164         (class Cie): Update declarations.
4165         (class Eh_frame): Declare add_ehframe_for_plt.
4166         * layout.cc (Layout::layout_eh_frame): Break out code into
4167         make_eh_frame_section, and call it.
4168         (Layout::make_eh_frame_section): New function.
4169         (Layout::add_eh_frame_for_plt): New function.
4170         * layout.h (class Layout): Update declarations.
4171         * merge.cc (Merge_map::add_mapping): Add assertion.
4172         * i386.cc: Include "dwarf.h".
4173         (class Output_data_plt_i386): Make first_plt_entry,
4174         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4175         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4176         and plt_eh_frame_fde.
4177         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4178         boundary.  Call add_eh_frame_for_plt if appropriate.
4179         * x86_64.cc: Include "dwarf.h".
4180         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4181         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4182         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4183         and plt_eh_frame_fde.
4184         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4185         appropriate.
4186
4187 2011-06-29  Ian Lance Taylor  <iant@google.com>
4188
4189         PR gold/12629
4190         * object.cc (Sized_relobj_file::layout_section): Change shdr
4191         parameter to be const.
4192         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4193         out of do_layout.
4194         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4195         appropriate.  Call layout_eh_frame_section.
4196         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4197         sections.
4198         * object.h (class Sized_relobj_file): Update declarations.
4199
4200 2011-06-29  Ian Lance Taylor  <iant@google.com>
4201
4202         PR gold/12652
4203         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4204         modifier.
4205         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4206
4207 2011-06-29  Ian Lance Taylor  <iant@google.com>
4208
4209         PR gold/12675
4210         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4211         SHT_X86_64_UNWIND.
4212         * layout.cc (Layout::layout_eh_frame): Likewise.
4213
4214 2011-06-29  Ian Lance Taylor  <iant@google.com>
4215
4216         PR gold/12695
4217         * layout.cc (Layout::symtab_section_shndx): New function.
4218         * layout.h (class Layout): Declare symtab_section_shndx.
4219         * output.cc (Output_section::write_header): Call it.
4220
4221 2011-06-29  Ian Lance Taylor  <iant@google.com>
4222
4223         PR gold/12818
4224         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4225         symbols which are not used in a relocation.
4226
4227 2011-06-28  Ian Lance Taylor  <iant@google.com>
4228
4229         PR gold/12898
4230         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4231         script create indistinguishable segments.
4232         (Layout::set_segment_offsets): Use stable_sort when sorting
4233         segments.  Pass this to Compare_segments constructor.
4234         * layout.h (class Layout): Make segment_precedes non-static.
4235         (class Compare_segments): Change from struct to class.  Add
4236         layout_ field.  Add constructor.
4237         * script-sections.cc
4238         (Script_sections::attach_sections_using_phdrs_clause): Rename
4239         local orphan to is_orphan.  Don't report failure to put empty
4240         section in segment.  On attachment failure, report name of
4241         section, and attach to first PT_LOAD segment.
4242
4243 2011-06-28  Ian Lance Taylor  <iant@google.com>
4244
4245         PR gold/12934
4246         * target-select.cc (Target_selector::Target_selector): Add
4247         emulation parameter.  Change all callers.
4248         (select_target_by_bfd_name): Rename from select_target_by_name.
4249         Change all callers.
4250         (select_target_by_emulation): New function.
4251         (supported_emulation_names): New function.
4252         * target-select.h (class Target_selector): Add emulation_ field.
4253         Update declarations.
4254         (Target_selector::recognize_by_bfd_name): Rename from
4255         recognize_by_name.  Change all callers.
4256         (Target_selector::supported_bfd_names): Rename from
4257         supported_names.  Change all callers.
4258         (Target_selector::recognize_by_emulation): New function.
4259         (Target_selector::supported_emulations): New function.
4260         (Target_selector::emulation): New function.
4261         (Target_selector::do_recognize_by_bfd_name): Rename from
4262         do_recognize_by_name.  Change all callers.
4263         (Target_selector::do_supported_bfd_names): Rename from
4264         do_supported_names.  Change all callers.
4265         (Target_selector::do_recognize_by_emulation): New function.
4266         (Target_selector::do_supported_emulations): New function.
4267         (select_target_by_bfd_name): Change name in declaration.
4268         (select_target_by_emulation): Declare.
4269         (supported_emulation_names): Declare.
4270         * parameters.cc (parameters_force_valid_target): Try to find
4271         target based on emulation from -m option.
4272         * options.h (class General_options): Change doc string for -m.
4273         * options.cc (help): Print emulations.
4274         (General_options::parse_V): Likewise.
4275         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4276         Add emulation parameter.  Change all callers.
4277
4278 2011-06-28  Ian Lance Taylor  <iant@google.com>
4279
4280         * target.h (class Target): Add osabi_ field.
4281         (Target::osabi): New function.
4282         (Target::set_osabi): New function.
4283         (Target::Target): Initialize osabi_.
4284         (Target::do_adjust_elf_header): Make pure virtual.
4285         (Sized_target::do_adjust_elf_header): Declare.
4286         * target.cc (Sized_target::do_adjust_elf_header): New function.
4287         (class Sized_target): Instantiate all versions.
4288         * freebsd.h (class Target_freebsd): Remove.
4289         (Target_selector_freebsd::do_recognize): Call set_osabi on
4290         Target.
4291         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4292         (Target_selector_freebsd::set_osabi): Remove.
4293         * i386.cc (class Target_i386): Inherit from Sized_target rather
4294         than Target_freebsd.
4295         * x86_64.cc (class Target_x86_64): Likewise.
4296
4297 2011-06-28  Ian Lance Taylor  <iant@google.com>
4298
4299         * target.h (Target::can_check_for_function_pointers): Rewrite.
4300         Make non-virtual.
4301         (Target::can_icf_inline_merge_sections): Likewise.
4302         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4303         (Target::Target_info): Add can_icf_inline_merge_sections field.
4304         (Target::do_can_check_for_function_pointers): New virtual
4305         function.
4306         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4307         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4308         from can_check_for_function_pointers, move in file.
4309         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4310         section_may_have_icf_unsafe_poineters, move in file.
4311         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4312         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4313         Rename from can_check_for_function_pointers, move in file.
4314         (Target_i386::can_icf_inline_merge_sections): Remove.
4315         (Target_i386::i386_info): Initialize
4316         can_icf_inline_merge_sections.
4317         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4318         Initialize can_icf_inline_merge_sections.
4319         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4320         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4321         Rename from can_check_for_function_pointers, move in file.
4322         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4323         (Target_x86_64::x86_64_info): Initialize
4324         can_icf_inline_merge_sections.
4325         * testsuite/testfile.cc (Target_test::test_target_info):
4326         Likewise.
4327         * icf.cc (get_section_contents): Correct formatting.
4328
4329 2011-06-27  Ian Lance Taylor  <iant@google.com>
4330
4331         * symtab.cc (Symbol::versioned_name): New function.
4332         (Symbol_table::add_to_final_symtab): Use versioned_name when
4333         appropriate.
4334         (Symbol_table::sized_write_symbol): Likewise.
4335         * symtab.h (class Symbol): Declare versioned_name.
4336         * stringpool.h (class Stringpool_template): Add variant of add
4337         which takes a std::basic_string.
4338         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4339         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4340         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4341         (ver_test_12.o): New target.
4342         * testsuite/Makefile.in: Rebuild.
4343
4344 2011-06-27  Doug Kwan  <dougkwan@google.com>
4345
4346         * arm.cc (Arm_relocate_functions::thm_jump8,
4347         Arm_relocate_functions::thm_jump11): Use a wider signed
4348         type to compute offset.
4349         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4350         arm_thm_jump8.
4351         * testsuite/Makefile.in: Regenerate.
4352         * testsuite/arm_branch_in_range.sh: Check test results of
4353         arm_thm_jump11 and arm_thm_jump8.
4354         * testsuite/arm_thm_jump11.s: New test source file.
4355         * testsuite/arm_thm_jump11.t: New linker script.
4356         * testsuite/arm_thm_jump8.s: New test source file.
4357         * testsuite/arm_thm_jump8.t: New linker script.
4358
4359 2011-06-24  Ian Lance Taylor  <iant@google.com>
4360
4361         * layout.cc: Include "object.h".
4362         (ctors_sections_in_init_array): New static variable.
4363         (Layout::is_ctors_in_init_array): New function.
4364         (Layout::layout): Add entry to ctors_sections_in_init_array if
4365         appropriate.
4366         * layout.h (class Layout): Declare is_ctors_in_init_array.
4367         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4368         is_ctors_reverse_view is set.
4369         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4370         all callers.  Set is_ctors_reverse_view field of View_size.
4371         (Sized_relobj_file::reverse_words): New function.
4372         * object.h (Sized_relobj_file::View_size): Add
4373         is_ctors_reverse_view field.
4374         (class Sized_relobj_file): Update declarations.
4375         * testsuite/initpri3.c: New test.
4376         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4377         initpri3b.
4378         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4379         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4380         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4381         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4382         * testsuite/Makefile.in: Rebuild.
4383
4384 2011-06-24  Cary Coutant  <ccoutant@google.com>
4385
4386         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4387         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4388         (debug_msg_cdebug.err): New targets.
4389         * testsuite/Makefile.in: Regenerate.
4390         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4391         Fix checks for link with shared library.
4392
4393 2011-06-24  Doug Kwan  <dougkwan@google.com>
4394
4395         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4396         skip empty text sections.
4397         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4398
4399 2011-06-22  Ian Lance Taylor  <iant@google.com>
4400
4401         PR gold/12910
4402         * options.h (class General_options): Add --ctors-in-init-array.
4403         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4404         friends as SHT_PROGBITS for merging sections.
4405         (Layout::layout): Remove special handling of .init_array and
4406         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4407         and .dtors if ctors_in_init_array.
4408         (Layout::make_output_section): Force correct section types for
4409         .init_array and friends.  Don't sort if doing relocatable link,
4410         Don't sort .ctors and .dtors if ctors_in_init_array.
4411         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4412         (Layout::output_section_name): Add relobj parameter.  Change all
4413         callers.  Handle .ctors. and .dtors. in code rather than table.
4414         Handle .ctors and .dtors if ctors_in_init_array.
4415         (Layout::match_file_name): New function, moved from output.cc.
4416         * layout.h (class Layout): Update declarations.
4417         * output.cc: Include "layout.h".
4418         (Input_section_sort_entry::get_priority): New function.
4419         (Input_section_sort_entry::match_file_name): Just call
4420         Layout::match_file_name.
4421         (Output_section::Input_section_sort_init_fini_compare::operator()):
4422         Handle .ctors and .dtors.  Sort by explicit priority rather than
4423         by name.
4424         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4425         * testsuite/initpri2.c: New test.
4426         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4427         (check_PROGRAMS): Add initpri2.
4428         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4429         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4430         * configure, testsuite/Makefile.in: Rebuild.
4431
4432 2011-06-19  Ian Lance Taylor  <iant@google.com>
4433
4434         PR gold/12880
4435         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4436         .interp section to a PT_INTERP segment even if we have seen a
4437         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4438         clause in a linker script.
4439         (Layout::finalize): Don't create a .interp section if we've
4440         already create a PT_INTERP segment.
4441         (Layout::create_interp): Always call choose_output_section (revert
4442         patch of 2011-06-17).  Don't create PT_INTERP segment.
4443         * script-sections.cc
4444         (Script_sections::create_note_and_tls_segments): Add a .interp
4445         section to a PT_INTERP segment even if we have seen a
4446         --dynamic-linker option.
4447
4448 2011-06-18  Ian Lance Taylor  <iant@google.com>
4449
4450         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4451         merely because a non-PT_LOAD segment has a dynamic reloc.
4452
4453 2011-06-18  Ian Lance Taylor  <iant@google.com>
4454
4455         * layout.cc (Layout::finish_dynamic_section): Don't create
4456         DT_FLAGS entry if not needed.
4457
4458 2011-06-18  Ian Lance Taylor  <iant@google.com>
4459
4460         PR gold/12745
4461         * layout.cc (Layout::layout_eh_frame): Correct handling of
4462         writable .eh_frame section.
4463
4464 2011-06-17  Ian Lance Taylor  <iant@google.com>
4465
4466         PR gold/12893
4467         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4468         symbol is redefined with the exact same object and value.
4469
4470 2011-06-17  Ian Lance Taylor  <iant@google.com>
4471
4472         PR gold/12880
4473         * layout.h (class Layout): Add interp_segment_ field.
4474         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4475         (Layout::attach_allocated_section_to_segment): If making shared
4476         library, put .interp section in PT_INTERP segment.
4477         (Layout::finalize): Also call create_interp if -dynamic-linker
4478         option was used.
4479         (Layout::create_interp): Assert that there is no PT_INTERP
4480         segment.  If not using a SECTIONS clause, use make_output_section.
4481         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4482         * script-sections.cc
4483         (Script_sections::create_note_and_tls_segments): If making shared
4484         library, put .interp section in PT_INTERP segment.
4485
4486 2011-06-17  Ian Lance Taylor  <iant@google.com>
4487
4488         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4489         when making a shared library.
4490
4491 2011-06-17  Ian Lance Taylor  <iant@google.com>
4492
4493         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4494         parameter.  Change all callers.  Don't issue warning about PC32
4495         against locally defined symbol.
4496
4497 2011-06-16  Ian Lance Taylor  <iant@google.com>
4498
4499         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4500         occurs in same object.
4501
4502 2011-06-14  Alan Modra  <amodra@gmail.com>
4503
4504         * po/POTFILES.in: Regenerate.
4505
4506 2011-06-09  Ian Lance Taylor  <iant@google.com>
4507
4508         * script-sections.cc
4509         (Orphan_output_section::set_section_addresses): For a relocatable
4510         link set address to 0.
4511
4512 2011-06-09  Cary Coutant  <ccoutant@google.com>
4513
4514         PR gold/12804
4515         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4516         used with --compress-debug-sections.
4517         * gold/object.cc (Sized_relobj_file::do_layout): Report
4518         uncompressed size of compressed input sections.
4519
4520 2011-06-08  Cary Coutant  <ccoutant@google.com>
4521
4522         PR gold/12804
4523         * testsuite/two_file_test_2_v1.cc: Change initialization of
4524         v2 to keep it in .data.
4525
4526 2011-06-07  Cary Coutant  <ccoutant@google.com>
4527
4528         * common.cc (Symbol_table::do_allocate_commons_list): Call
4529         gold_fallback.
4530         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4531         (Errors::fallback): New function.
4532         (gold_fallback): New function.
4533         * errors.h (Errors::fallback): New function.
4534         * gold.cc (gold_exit): Change status parameter to enum; adjust
4535         all callers.
4536         (queue_initial_tasks): Call gold_fallback.
4537         * gold.h: Include cstdlib.
4538         (Exit_status): New enum type.
4539         (gold_exit): Change status parameter to enum.
4540         (gold_fallback): New function.
4541         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4542         (Layout::create_symtab_sections): Likewise.
4543         (Layout::create_shdrs): Likewise.
4544         * main.cc (main): Adjust call to gold_exit.
4545         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4546         (Output_data_got::add_got_entry_pair): Likewise.
4547         (Output_section::add_input_section): Likewise.
4548         (Output_section::add_output_section_data): Likewise.
4549         (Output_segment::set_section_list_addresses): Likewise.
4550         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4551
4552 2011-06-07  Cary Coutant  <ccoutant@google.com>
4553
4554         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4555         for incremental links.
4556         * output.cc (Output_segment::set_section_list_addresses): Remove
4557         FIXME and test for TLS or BSS.
4558
4559 2011-06-07  Cary Coutant  <ccoutant@google.com>
4560
4561         * testsuite/Makefile.am: Add incremental_copy_test,
4562         incremental_common_test_1.
4563         * testsuite/Makefile.in: Regenerate.
4564         * testsuite/common_test_1_v1.c: New source file.
4565         * testsuite/common_test_1_v2.c: New source file.
4566         * testsuite/copy_test_v1.cc: New source file.
4567
4568 2011-06-07  Cary Coutant  <ccoutant@google.com>
4569
4570         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4571         update, allocate common from bss section's free list.
4572         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4573         linker-defined symbols.
4574         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4575         Skip GOT and PLT entries that are no longer referenced.
4576         (Output_section_incremental_inputs::write_info_blocks): Mark
4577         linker-defined symbols.
4578         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4579         * output.cc (Output_section::allocate): New function.
4580         * output.h (Output_section::allocate): New function.
4581         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4582         linker-defined symbols.
4583         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4584         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4585         (Symbol::init_base_output_data): Likewise.
4586         (Symbol::init_base_output_segment): Likewise.
4587         (Symbol::init_base_constant): Likewise.
4588         (Sized_symbol::init_output_data): Likewise.
4589         (Sized_symbol::init_output_segment): Likewise.
4590         (Sized_symbol::init_constant): Likewise.
4591         (Symbol_table::do_define_in_output_data): Likewise.
4592         (Symbol_table::do_define_in_output_segment): Likewise.
4593         (Symbol_table::do_define_as_constant): Likewise.
4594         * symtab.h (Symbol::is_predefined): New function.
4595         (Symbol::init_base_output_data): Add is_predefined parameter.
4596         (Symbol::init_base_output_segment): Likewise.
4597         (Symbol::init_base_constant): Likewise.
4598         (Symbol::is_predefined_): New data member.
4599         (Sized_symbol::init_output_data): Add is_predefined parameter.
4600         (Sized_symbol::init_output_segment): Likewise.
4601         (Sized_symbol::init_constant): Likewise.
4602         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4603
4604 2011-06-07  Cary Coutant  <ccoutant@google.com>
4605
4606         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4607         instead of emit_copy_reloc.
4608         (Copy_relocs::emit_copy_reloc): Refactor.
4609         (Copy_relocs::make_copy_reloc): New function.
4610         (Copy_relocs::add_copy_reloc): Remove.
4611         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4612         section.
4613         (Copy_relocs::make_copy_reloc): New function.
4614         (Copy_relocs::add_copy_reloc): Remove.
4615         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4616         unchanged input files.
4617         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4618         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4619         Reserve BSS space for COPY relocations.
4620         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4621         (Output_section_incremental_inputs::write_info_blocks): Record
4622         whether a symbol is copied from a shared object.
4623         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4624         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4625         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4626         (Incremental_input_entry_reader::get_output_symbol_index): Add
4627         is_copy parameter.
4628         (Incremental_binary::emit_copy_relocs): New function.
4629         (Incremental_binary::do_emit_copy_relocs): New function.
4630         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4631         new data member.
4632         (Sized_incremental_binary::add_copy_reloc): New function.
4633         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4634         (Sized_incremental_binary::Copy_reloc): New struct.
4635         (Sized_incremental_binary::Copy_relocs): New typedef.
4636         (Sized_incremental_binary::copy_relocs_): New data member.
4637         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4638         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4639         * target.h (Sized_target::emit_copy_reloc): New function.
4640         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4641
4642 2011-06-02  Cary Coutant  <ccoutant@google.com>
4643
4644         PR gold/12163
4645         * gold/archive.cc (Archive::Archive): Initialize new data member.
4646         (Archive::include_all_members): Return if archive has already been
4647         included.
4648         * gold/archive.h (Archive::include_all_members_): New data member.
4649
4650 2011-06-02  Nick Clifton  <nickc@redhat.com>
4651
4652         * dynobj.h: Fix spelling mistake in comment.
4653         * output.cc: Likewise.
4654
4655 2011-05-31  Doug Kwan  <dougkwan@google.com>
4656             Asier Llano
4657
4658         PR gold/12826
4659         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4660         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4661         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4662         redundant arm_exidx_test.so.
4663         * testsuite/Makefile.in: Regenerate.
4664         (check_SCRIPTS): Add pr12826.sh
4665         (check_DATA): Add pr12826.stdout
4666         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4667         * testsuite/pr12826.sh: New file.
4668         * testsuite/pr12826_1.s: Ditto.
4669         * testsuite/pr12826_1.s: Ditto.
4670
4671 2011-05-30  Ian Lance Taylor  <iant@google.com>
4672
4673         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4674         sections.
4675
4676 2011-05-29  Ian Lance Taylor  <iant@google.com>
4677
4678         PR gold/12804
4679         * testsuite/Makefile.am: Use different file name for two_file_test
4680         temporary file for each incremental test.
4681         * testsuite/Makefile.in: Rebuild.
4682
4683 2011-05-29  Ian Lance Taylor  <iant@google.com>
4684
4685         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4686         binary input file is empty.
4687
4688 2011-05-27  Ian Lance Taylor  <iant@google.com>
4689
4690         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4691         (ver_test_9.so): Likewise.
4692         * testsuite/Makefile.in: Rebuild.
4693
4694 2011-05-26 Cary Coutant  <ccoutant@google.com>
4695
4696         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4697         * incremental.cc (Incremental_inputs::report_input_section): Fix
4698         comment, indentation.
4699         (Incremental_inputs::report_comdat_group): New function.
4700         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4701         of data for incremental input file entry.
4702         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4703         group count, COMDAT group signatures.
4704         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4705         an unchanged input file.
4706         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4707         Initialize new data member.
4708         (Incremental_object_entry::add_comdat_group): New function.
4709         (Incremental_object_entry::get_comdat_group_count): New function.
4710         (Incremental_object_entry::get_comdat_signature_key): New function.
4711         (Incremental_object_entry::groups_): New data member.
4712         (Incremental_inputs::report_comdat_group): New function.
4713         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4714         data for incremental input file entry.
4715         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4716         (Incremental_input_entry_reader::get_input_section): Adjust size of
4717         data for incremental input file entry.
4718         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4719         (Incremental_input_entry_reader::get_comdat_group_signature): New
4720         function.
4721         * object.cc (Sized_relobj::include_section_group): Report kept
4722         COMDAT groups for incremental links.
4723
4724 2011-05-24  David Meyer  <pdox@google.com>
4725
4726         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4727         with name parameter.  Add found_name parameter.
4728         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4729         * dirsearch.h (class Dirsearch): Update declaration.
4730
4731 2011-05-24  Ian Lance Taylor  <iant@google.com>
4732
4733         * archive.cc (Library_base::should_include_member): Pull in object
4734         from archive if it defines the entry symbol.
4735         * parameters.cc (Parameters::entry): New function.
4736         * parameters.h (class Parameters): Declare entry.
4737         * output.h (class Output_file_header): Remove entry_ field.
4738         * output.cc (Output_file_header::Output_file_header): Remove entry
4739         parameter.  Change all callers.
4740         (Output_file_header::entry): Use parameters->entry.
4741         * gold.cc (queue_middle_tasks): Likewise.
4742         * plugin.cc (Plugin_hook::run): Likewise.
4743
4744 2011-05-24 Cary Coutant  <ccoutant@google.com>
4745
4746         * gold.cc (queue_initial_tasks): Pass incremental base filename
4747         to Output_file::open_base_file; don't print error message.
4748         * incremental-dump.cc (main): Adjust call to
4749         Output_file::open_for_modification.
4750         * incremental-dump.cc (main): Likewise.
4751         * incremental.cc (Incremental_inputs::report_command_line):
4752         Ignore --incremental-base option when comparing command lines.
4753         Ignore parameter when given as separate argument.
4754         * options.h (class General_options): Add --incremental-base.
4755         * output.cc (Output_file::Output_file):
4756         (Output_file::open_base_file): Add base_name and writable parameters;
4757         read base file into new file; print error message here.
4758         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4759         callers.
4760         * output.h (Output_file::open_for_modification): Rename to...
4761         (Output_file::open_base_file): ...this; add base_name and
4762         writable parameters; adjust all callers.
4763         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4764         callers.
4765         * testsuite/Makefile.am (incremental_test_4): Test
4766         --incremental-base.
4767         * testsuite/Makefile.in: Regenerate.
4768
4769 2011-05-24 Cary Coutant  <ccoutant@google.com>
4770
4771         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4772         incremental_test_4.
4773         * testsuite/Makefile.in: Regenerate.
4774         * testsuite/two_file_test_1_v1.cc: New test source file.
4775         * testsuite/two_file_test_1b_v1.cc: New test source file.
4776         * testsuite/two_file_test_2_v1.cc: New test source file.
4777
4778 2011-05-24 Cary Coutant  <ccoutant@google.com>
4779
4780         * dynobj.h (Dynobj::do_dynobj): New function.
4781         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4782         flag and soname for shared objects.
4783         * incremental.cc (Incremental_inputs::report_object): Make
4784         either Incremental_object_entry or Incremental_dynobj_entry; add
4785         soname to string table.
4786         (Incremental_inputs::report_input_section): Add assertion.
4787         (Output_section_incremental_inputs::set_final_data_size): Adjust
4788         type of input file entry for shared libraries; adjust size of
4789         shared library info entry.
4790         (Output_section_incremental_inputs::write_input_files): Write
4791         as_needed flag for shared libraries.
4792         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4793         of input file entry for shared libraries; write soname.
4794         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4795         soname from incremental info.
4796         * incremental.h (enum Incremental_input_flags): Add
4797         INCREMENTAL_INPUT_AS_NEEDED.
4798         (Incremental_input_entry::Incremental_input_entry): Initialize new
4799         data member.
4800         (Incremental_input_entry::set_as_needed): New function.
4801         (Incremental_input_entry::as_needed): New function.
4802         (Incremental_input_entry::do_dynobj_entry): New function.
4803         (Incremental_input_entry::as_needed_): New data member.
4804         (Incremental_object_entry::Incremental_object_entry): Don't check
4805         for shared library.
4806         (Incremental_object_entry::do_type): Likewise.
4807         (class Incremental_dynobj_entry): New class.
4808         (Incremental_input_entry_reader::as_needed): New function.
4809         (Incremental_input_entry_reader::get_soname): New function.
4810         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4811         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4812         size of shared library info entry.
4813         * layout.cc (Layout::finish_dynamic_section): Don't test for
4814         incremental link when adding DT_NEEDED entries.
4815         * object.h (Object::Object): Initialize new data member.
4816         (Object::dynobj): New function.
4817         (Object::set_as_needed): New function.
4818         (Object::as_needed): New function.
4819         (Object::do_dynobj): New function.
4820         (Object::as_needed_): New data member.
4821
4822 2011-05-24 Cary Coutant  <ccoutant@google.com>
4823
4824         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4825         info; adjust display of GOT entries.
4826         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4827         vector of input objects; remove file_status_.
4828         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4829         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4830         got_plt reader; call target hooks to reserve GOT entries.
4831         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4832         of input file info header and GOT info entry.
4833         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4834         relocation info.
4835         (Got_plt_view_info::got_descriptor): Remove.
4836         (Got_plt_view_info::sym_index): New data member.
4837         (Got_plt_view_info::input_index): New data member.
4838         (Local_got_offset_visitor::visit): Write input file index.
4839         (Global_got_offset_visitor::visit): Write 0 for input file index.
4840         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4841         with sym_index and input_index.
4842         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4843         incremental info GOT entry; replace got_descriptor with input_index.
4844         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4845         map from input file index to object.
4846         (Sized_relobj_incr::do_layout): Replace direct data member reference
4847         with accessor function.
4848         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4849         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4850         Adjust size of input file info header.
4851         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4852         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4853         (Incremental_input_entry_reader::get_input_section): Adjust size of
4854         input file info header.
4855         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4856         of incremental info GOT entry.
4857         (Incremental_got_plt_reader::get_got_desc): Remove.
4858         (Incremental_got_plt_reader::get_got_symndx): New function.
4859         (Incremental_got_plt_reader::get_got_input_index): New function.
4860         (Sized_incremental_binary::Sized_incremental_binary): Remove
4861         file_status_; add input_objects_.
4862         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4863         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4864         (Sized_incremental_binary::file_is_unchanged): Remove.
4865         (Sized_incremental_binary::set_input_object): New function.
4866         (Sized_incremental_binary::input_object): New function.
4867         (Sized_incremental_binary::file_status_): Remove.
4868         (Sized_incremental_binary::input_objects_): New data member.
4869         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4870         references.
4871         (Sized_relobj_incr::invalid_address): Move to base class.
4872         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4873         class.
4874         (Sized_relobj_incr::do_output_section_offset): Likewise.
4875         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4876         (Sized_relobj_incr::section_offsets_): Likewise.
4877         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4878         function.
4879         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4880         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4881         with accessor function.
4882         (Sized_relobj_file::do_layout): Likewise.
4883         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4884         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4885         (Sized_relobj_file::compute_final_local_value): Replace refs to
4886         section_offsets_ with accessor function.
4887         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4888         * object.h (Relobj::Relobj): Initialize new data members.
4889         (Relobj::add_dyn_reloc): New function.
4890         (Relobj::first_dyn_reloc): New function.
4891         (Relobj::dyn_reloc_count): New function.
4892         (Relobj::first_dyn_reloc_): New data member.
4893         (Relobj::dyn_reloc_count_): New data member.
4894         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4895         references.
4896         (Sized_relobj::Address): New typedef.
4897         (Sized_relobj::invalid_address): Move here from child class.
4898         (Sized_relobj::Sized_relobj): Initialize new data members.
4899         (Sized_relobj::sized_relobj): New function.
4900         (Sized_relobj::is_output_section_offset_invalid): Move here from
4901         child class.
4902         (Sized_relobj::get_output_section_offset): Likewise.
4903         (Sized_relobj::local_has_got_offset): Likewise.
4904         (Sized_relobj::local_got_offset): Likewise.
4905         (Sized_relobj::set_local_got_offset): Likewise.
4906         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4907         (Sized_relobj::clear_got_offsets): New function.
4908         (Sized_relobj::section_offsets): Move here from child class.
4909         (Sized_relobj::do_output_section_offset): Likewise.
4910         (Sized_relobj::do_set_section_offset): Likewise.
4911         (Sized_relobj::Local_got_offsets): Likewise.
4912         (Sized_relobj::local_got_offsets_): Likewise.
4913         (Sized_relobj::section_offsets_): Likewise.
4914         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4915         references.
4916         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4917         class.
4918         (Sized_relobj_file::sized_relobj): New function
4919         (Sized_relobj_file::local_has_got_offset): Move to base class.
4920         (Sized_relobj_file::local_got_offset): Likewise.
4921         (Sized_relobj_file::set_local_got_offset): Likewise.
4922         (Sized_relobj_file::get_output_section_offset): Likewise.
4923         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4924         (Sized_relobj_file::do_output_section_offset): Likewise.
4925         (Sized_relobj_file::do_set_section_offset): Likewise.
4926         (Sized_relobj_file::Local_got_offsets): Likewise.
4927         (Sized_relobj_file::local_got_offsets_): Likewise.
4928         (Sized_relobj_file::section_offsets_): Likewise.
4929         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4930         (all constructors).
4931         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4932         (Output_reloc::get_symbol_index): Likewise.
4933         (Output_reloc::local_section_offset): Likewise.
4934         (Output_reloc::get_address): Likewise.
4935         (Output_reloc::symbol_value): Likewise.
4936         (Output_data_got::reserve_slot): Move to class definition.
4937         (Output_data_got::reserve_local): New function.
4938         (Output_data_got::reserve_slot_for_global): Remove.
4939         (Output_data_got::reserve_global): New function.
4940         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4941         (all constructors, two instantiations).
4942         (Output_reloc::get_relobj): New function (two instantiations).
4943         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4944         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4945         (Output_data_reloc::add_global): Adjust type of relobj.
4946         (Output_data_reloc::add_global_relative): Likewise.
4947         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4948         (Output_data_reloc::add_local): Likewise.
4949         (Output_data_reloc::add_local_relative): Likewise.
4950         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4951         (Output_data_reloc::add_local_section): Likewise.
4952         (Output_data_reloc::add_output_section): Likewise.
4953         (Output_data_reloc::add_absolute): Likewise.
4954         (Output_data_reloc::add_target_specific): Likewise.
4955         (Output_data_got::reserve_slot): Move definition here.
4956         (Output_data_got::reserve_local): New function.
4957         (Output_data_got::reserve_global): New function.
4958         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4959         section_offsets_ with accessor function.
4960         (Sized_relobj_file::write_sections): Likewise.
4961         (Sized_relobj_file::do_relocate_sections): Likewise.
4962         * target.h (Sized_target::reserve_local_got_entry): New function.
4963         (Sized_target::reserve_global_got_entry): New function.
4964         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4965         (Target_x86_64::reserve_global_got_entry): New function.
4966         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4967
4968 2011-05-23 Cary Coutant  <ccoutant@google.com>
4969
4970         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4971         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4972         bit when checking got_type.
4973         * incremental.cc (Sized_incremental_binary::setup_readers):
4974         Store symbol table and string table locations; initialize bit vector
4975         of file status flags.
4976         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4977         unchanged files.
4978         (Sized_incremental_binary::do_process_got_plt): New function.
4979         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4980         (Output_section_incremental_inputs::set_final_data_size): Record
4981         file index for each input file.
4982         (Output_section_incremental_inputs::write_got_plt): Store file index
4983         instead of input entry offset for each GOT entry.
4984         * incremental.h
4985         (Incremental_input_entry::Incremental_input_entry): Initialize new
4986         data member.
4987         (Incremental_input_entry::set_offset): Store file index.
4988         (Incremental_input_entry::get_file_index): New function.
4989         (Incremental_input_entry::file_index_): New data member.
4990         (Incremental_binary::process_got_plt): New function.
4991         (Incremental_binary::do_process_got_plt): New function.
4992         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4993         data members.
4994         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4995         (Sized_incremental_binary::set_file_is_unchanged): New function.
4996         (Sized_incremental_binary::file_is_unchanged): New function.
4997         (Sized_incremental_binary::do_process_got_plt): New function.
4998         (Sized_incremental_binary::file_status_): New data member.
4999         (Sized_incremental_binary::main_symtab_loc_): New data member.
5000         (Sized_incremental_binary::main_strtab_loc_): New data member.
5001         * output.cc (Output_data_got::Got_entry::write): Add case
5002         RESERVED_CODE.
5003         (Output_data_got::add_global): Call add_got_entry.
5004         (Output_data_got::add_global_plt): Likewise.
5005         (Output_data_got::add_global_with_rel): Likewise.
5006         (Output_data_got::add_global_with_rela): Likewise.
5007         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5008         (Output_data_got::add_global_pair_with_rela): Likewise.
5009         (Output_data_got::add_local): Call add_got_entry.
5010         (Output_data_got::add_local_plt): Likewise.
5011         (Output_data_got::add_local_with_rel): Likewise.
5012         (Output_data_got::add_local_with_rela): Likewise.
5013         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5014         (Output_data_got::add_local_pair_with_rela): Likewise.
5015         (Output_data_got::reserve_slot): New function.
5016         (Output_data_got::reserve_slot_for_global): New function.
5017         (Output_data_got::add_got_entry): New function.
5018         (Output_data_got::add_got_entry_pair): New function.
5019         (Output_section::add_output_section_data): Edit FIXME.
5020         * output.h
5021         (Output_section_data_build::Output_section_data_build): New
5022         constructor with size parameter.
5023         (Output_data_space::Output_data_space): Likewise.
5024         (Output_data_got::Output_data_got): Initialize new data member; new
5025         constructor with size parameter.
5026         (Output_data_got::add_constant): Call add_got_entry.
5027         (Output_data_got::reserve_slot): New function.
5028         (Output_data_got::reserve_slot_for_global): New function.
5029         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5030         (Output_data_got::add_got_entry): New function.
5031         (Output_data_got::add_got_entry_pair): New function.
5032         (Output_data_got::free_list_): New data member.
5033         * target.h (Sized_target::init_got_plt_for_update): New function.
5034         (Sized_target::register_global_plt_entry): New function.
5035         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5036         Initialize new data member; call init; add constructor with PLT count.
5037         (Output_data_plt_x86_64::init): New function.
5038         (Output_data_plt_x86_64::add_relocation): New function.
5039         (Output_data_plt_x86_64::reserve_slot): New function.
5040         (Output_data_plt_x86_64::free_list_): New data member.
5041         (Target_x86_64::init_got_plt_for_update): New function.
5042         (Target_x86_64::register_global_plt_entry): New function.
5043         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5044         incremental updates.
5045         (Output_data_plt_x86_64::add_relocation): New function.
5046         * testsuite/object_unittest.cc (Object_test): Set default options.
5047
5048 2011-05-16  Ian Lance Taylor  <iant@google.com>
5049
5050         * options.h (class General_options): Make -i a synonym for -r.
5051
5052 2011-05-16  Ian Lance Taylor  <iant@google.com>
5053
5054         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5055
5056 2011-05-10 Cary Coutant  <ccoutant@google.com>
5057
5058         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5059         strip_all (-s).
5060
5061 2011-05-06  Ian Lance Taylor  <iant@google.com>
5062
5063         * layout.cc (Layout::layout): If the output section flags change,
5064         update the ordering.
5065
5066 2011-04-25 Cary Coutant  <ccoutant@google.com>
5067
5068         * incremental-dump.cc (dump_incremental_inputs): Print local
5069         symbol info for each input file.
5070         * incremental.cc
5071         (Output_section_incremental_inputs::set_final_data_size): Add local
5072         symbol info to input file entries in incremental info.
5073         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5074         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5075         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5076         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5077         implementation.
5078         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5079         (Sized_incr_relobj::do_relocate): Write the local symbols.
5080         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5081         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5082         Adjust size of input file header.
5083         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5084         (Incremental_inputs_reader::get_local_symbol_count): New function.
5085         (Incremental_inputs_reader::get_input_section): Adjust size of input
5086         file header.
5087         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5088         (Sized_incr_relobj::This): New typedef.
5089         (Sized_incr_relobj::sym_size): New const data member.
5090         (Sized_incr_relobj::Local_symbol): New struct.
5091         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5092         (Sized_incr_relobj::do_local_symbol_offset): New function.
5093         (Sized_incr_relobj::local_symbol_count_): New data member.
5094         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5095         (Sized_incr_relobj::local_symbol_index_): New data member.
5096         (Sized_incr_relobj::local_symbol_offset_): New data member.
5097         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5098         (Sized_incr_relobj::local_symbols_): New data member.
5099         * object.h (Relobj::output_local_symbol_count): New function.
5100         (Relobj::local_symbol_offset): New function.
5101         (Relobj::do_output_local_symbol_count): New function.
5102         (Relobj::do_local_symbol_offset): New function.
5103         (Sized_relobj::do_output_local_symbol_count): New function.
5104         (Sized_relobj::do_local_symbol_offset): New function.
5105
5106 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5107
5108         * descriptors.cc (set_close_on_exec): New function.
5109         (Descriptors::open): Use set_close_on_exec.
5110         * output.cc (S_ISLNK): Define if not defined.
5111
5112 2011-04-22 Cary Coutant  <ccoutant@google.com>
5113
5114         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5115         global symbol map.
5116         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5117         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5118         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5119         relocations.
5120         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5121         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5122         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5123         * incremental.h
5124         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5125         function.
5126         (Incremental_binary::apply_incremental_relocs): New function.
5127         (Incremental_binary::do_apply_incremental_relocs): New function.
5128         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5129         data member.
5130         (Sized_incremental_binary::add_global_symbol): New function.
5131         (Sized_incremental_binary::global_symbol): New function.
5132         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5133         (Sized_incremental_binary::symbol_map_): New data member.
5134         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5135         * target.h (Sized_target::apply_relocation): New function.
5136         * target-reloc.h (apply_relocation): New function.
5137         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5138
5139 2011-04-22  Doug Kwan  <dougkwan@google.com>
5140
5141         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5142         flag of a SHT_ARM_EXIDX section.
5143         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5144         * testsuite/Makefile.in: Regenerate.
5145         * testsuite/arm_exidx_test.s: New file.
5146         * testsuite/arm_exidx_test.sh: Same.
5147
5148 2011-04-20 Cary Coutant  <ccoutant@google.com>
5149
5150         PR gold/12689
5151         * archive.h (Incremental_archive_entry::Archive_member):
5152         Initialize arg_serial_ (second constructor).
5153
5154 2011-04-17  Ian Lance Taylor  <iant@google.com>
5155
5156         * object.cc (Relocate_info::location): Simplify location string.
5157         * errors.cc (Errors::error_at_location): Don't print program
5158         name.
5159         (Errors::warning_at_location): Likewise.
5160         (Errors::undefined_symbol): Likewise.
5161         * testsuite/debug_msg.sh: Update accordingly.
5162
5163 2011-04-14 Cary Coutant  <ccoutant@google.com>
5164
5165         * gold/layout.cc (Layout::symtab_section_offset): New function.
5166         * gold/layout.h (Layout::symtab_section_offset): New function.
5167         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5168
5169 2011-04-12  Ian Lance Taylor  <iant@google.com>
5170
5171         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5172         with MREMAP_MAYMOVE.
5173         * output.h (class Output_file): Add map_is_allocated_ field.
5174         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5175         not available, provide stubs.  If mremap is not available, #define
5176         it to gold_mremap.
5177         (MREMAP_MAYMOVE): Define if not defined.
5178         (Output_file::Output_file): Initialize map_is_allocated_.
5179         (Output_file::resize): Check map_is_allocated_.
5180         (Output_file::map_anonymous): If mmap fails, use malloc.
5181         (Output_file::unmap): Don't do anything for an anonymous map.
5182         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5183         is not available, provide stubs.
5184         (File_read::View::~View): Use free rather than delete[].
5185         (File_read::make_view): Use malloc rather than new[].  If mmap
5186         fails, use malloc.
5187         (File_read::find_or_make_view): Use malloc rather than new[].
5188         * gold.h: Remove HAVE_REMAP code.
5189         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5190         exists.  Rename mremap to gold_mremap.  If mmap is not available
5191         don't do anything.
5192         * configure, config.in: Rebuild.
5193
5194 2011-04-11  Ian Lance Taylor  <iant@google.com>
5195
5196         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5197         initialize local variable v.
5198
5199 2011-04-11  Cary Coutant  <ccoutant@google.com>
5200
5201         * archive.cc (Archive::include_member): Adjust call to
5202         report_object.
5203         (Add_archive_symbols::run): Track argument serial numbers.
5204         (Lib_group::include_member): Likewise.
5205         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5206         * archive.h (Incremental_archive_entry::Archive_member):
5207         Initialize arg_serial_.
5208         (Archive_member::arg_serial_): New data member.
5209         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5210         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5211         incremental link.
5212         (Sized_dynobj::do_for_all_local_got_entries): New function.
5213         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5214         function.
5215         * fileread.cc (get_mtime): New function.
5216         * fileread.h (get_mtime): New function.
5217         * gold.cc (queue_initial_tasks): Check for incremental update.
5218         (process_incremental_input): New function.
5219         (queue_middle_tasks): Don't force valid target for incremental
5220         update.
5221         * incremental-dump.cc (find_input_containing_global): Adjust
5222         size of symbol info entry.
5223         (dump_incremental_inputs): Dump argument serial number and
5224         in_system_directory flag; bias shndx by 1; print symbol names
5225         when dumping per-file symbol lists; use new symbol info readers.
5226         * incremental.cc
5227         (Output_section_incremental_inputs:update_data_size): New function.
5228         (Sized_incremental_binary::setup_readers): Setup input readers
5229         for each input file; build maps for files added from libraries
5230         and scripts.
5231         (Sized_incremental_binary::check_input_args): New function.
5232         (Sized_incremental_binary::do_check_inputs): Build map of argument
5233         serial numbers to input arguments.
5234         (Sized_incremental_binary::do_file_has_changed): Rename
5235         do_file_is_unchanged to this; compare file modification times.
5236         (Sized_incremental_binary::do_init_layout): New function.
5237         (Sized_incremental_binary::do_reserve_layout): New function.
5238         (Sized_incremental_binary::do_get_input_reader): Remove.
5239         (Sized_incremental_binary::get_symtab_view): New function.
5240         (Incremental_checker::can_incrementally_link_output_file): Remove.
5241         (Incremental_inputs::report_command_line): Exclude --debug options.
5242         (Incremental_inputs::report_archive_begin): Add parameter; track
5243         argument serial numbers; don't put input file entry for archive
5244         before archive members.
5245         (Incremental_inputs::report_archive_end): Put input file entry
5246         for archive after archive members.
5247         (Incremental_inputs::report_object): Add parameter; track argument
5248         serial numbers and in_system_directory flag.
5249         (Incremental_inputs::report_script): Add parameter; track argument
5250         serial numbers.
5251         (Output_section_incremental_inputs::set_final_data_size): Adjust
5252         size of symbol info entry; check for forwarding symbols.
5253         (Output_section_incremental_inputs::write_input_files): Write
5254         in_system_directory flag and argument serial number.
5255         (Output_section_incremental_inputs::write_info_blocks): Map section
5256         indices between incremental info and original input file; store
5257         input section index for each symbol.
5258         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5259         change operator() to visit().
5260         (class Global_got_offset_visitor): Likewise.
5261         (class Global_symbol_visitor_got_plt):
5262         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5263         classes.
5264         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5265         (Sized_incr_relobj::do_read_symbols): New function.
5266         (Sized_incr_relobj::do_layout): New function.
5267         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5268         (Sized_incr_relobj::do_add_symbols): New function.
5269         (Sized_incr_relobj::do_should_include_member): New function.
5270         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5271         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5272         (Sized_incr_relobj::do_section_size): New function.
5273         (Sized_incr_relobj::do_section_name): New function.
5274         (Sized_incr_relobj::do_section_contents): New function.
5275         (Sized_incr_relobj::do_section_flags): New function.
5276         (Sized_incr_relobj::do_section_entsize): New function.
5277         (Sized_incr_relobj::do_section_address): New function.
5278         (Sized_incr_relobj::do_section_type): New function.
5279         (Sized_incr_relobj::do_section_link): New function.
5280         (Sized_incr_relobj::do_section_info): New function.
5281         (Sized_incr_relobj::do_section_addralign): New function.
5282         (Sized_incr_relobj::do_initialize_xindex): New function.
5283         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5284         (Sized_incr_relobj::do_read_relocs): New function.
5285         (Sized_incr_relobj::do_gc_process_relocs): New function.
5286         (Sized_incr_relobj::do_scan_relocs): New function.
5287         (Sized_incr_relobj::do_count_local_symbols): New function.
5288         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5289         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5290         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5291         (Sized_incr_relobj::do_relocate): New function.
5292         (Sized_incr_relobj::do_set_section_offset): New function.
5293         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5294         (Sized_incr_dynobj::do_read_symbols): New function.
5295         (Sized_incr_dynobj::do_layout): New function.
5296         (Sized_incr_dynobj::do_add_symbols): New function.
5297         (Sized_incr_dynobj::do_should_include_member): New function.
5298         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5299         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5300         (Sized_incr_dynobj::do_section_size): New function.
5301         (Sized_incr_dynobj::do_section_name): New function.
5302         (Sized_incr_dynobj::do_section_contents): New function.
5303         (Sized_incr_dynobj::do_section_flags): New function.
5304         (Sized_incr_dynobj::do_section_entsize): New function.
5305         (Sized_incr_dynobj::do_section_address): New function.
5306         (Sized_incr_dynobj::do_section_type): New function.
5307         (Sized_incr_dynobj::do_section_link): New function.
5308         (Sized_incr_dynobj::do_section_info): New function.
5309         (Sized_incr_dynobj::do_section_addralign): New function.
5310         (Sized_incr_dynobj::do_initialize_xindex): New function.
5311         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5312         (make_sized_incremental_object): New function.
5313         (Incremental_library::copy_unused_symbols): New function.
5314         (Incremental_library::do_for_all_unused_symbols): New function.
5315         * incremental.h (enum Incremental_input_flags): New type.
5316         (class Incremental_checker): Remove.
5317         (Incremental_input_entry::Incremental_input_entry): Add argument
5318         serial number.
5319         (Incremental_input_entry::arg_serial): New function.
5320         (Incremental_input_entry::set_is_in_system_directory): New function.
5321         (Incremental_input_entry::is_in_system_directory): New function.
5322         (Incremental_input_entry::arg_serial_): New data member.
5323         (Incremental_input_entry::is_in_system_directory_): New data member.
5324         (class Script_info): Move here from script.h.
5325         (Script_info::Script_info): Add filename parameter.
5326         (Script_info::filename): New function.
5327         (Script_info::filename_): New data member.
5328         (Incremental_script_entry::Incremental_script_entry): Add argument
5329         serial number.
5330         (Incremental_object_entry::Incremental_object_entry): Likewise.
5331         (Incremental_object_entry::add_input_section): Build list of input
5332         sections with map to original shndx.
5333         (Incremental_object_entry::get_input_section_index): New function.
5334         (Incremental_object_entry::shndx_): New data member.
5335         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5336         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5337         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5338         serial number.
5339         (Incremental_inputs::report_archive_begin): Likewise.
5340         (Incremental_inputs::report_object): Likewise.
5341         (Incremental_inputs::report_script): Likewise.
5342         (class Incremental_global_symbol_reader): New class.
5343         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5344         and store flags and input file type.
5345         (Incremental_input_entry_reader::arg_serial): New function.
5346         (Incremental_input_entry_reader::type): Extract type from flags.
5347         (Incremental_input_entry_reader::is_in_system_directory): New function.
5348         (Incremental_input_entry_reader::get_input_section_count): Call
5349         accessor function for type.
5350         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5351         function for type; adjust size of global symbol entry.
5352         (Incremental_input_entry_reader::get_global_symbol_count): Call
5353         accessor function for type.
5354         (Incremental_input_entry_reader::get_object_count): Likewise.
5355         (Incremental_input_entry_reader::get_object_offset): Likewise.
5356         (Incremental_input_entry_reader::get_member_count): Likewise.
5357         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5358         (Incremental_input_entry_reader::get_member_offset): Likewise.
5359         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5360         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5361         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5362         (Incremental_input_entry_reader::get_global_symbol_reader): New
5363         function.
5364         (Incremental_input_entry_reader::get_output_symbol_index): New
5365         function.
5366         (Incremental_input_entry_reader::type_): Remove.
5367         (Incremental_input_entry_reader::flags_): New data member.
5368         (Incremental_inputs_reader::input_file_offset): New function.
5369         (Incremental_inputs_reader::input_file_index): New function.
5370         (Incremental_inputs_reader::input_file): Call input_file_offset.
5371         (Incremental_inputs_reader::input_file_at_offset): New function.
5372         (Incremental_relocs_reader::get_r_type): Reformat.
5373         (Incremental_relocs_reader::get_r_shndx): Reformat.
5374         (Incremental_relocs_reader::get_r_offset): Reformat.
5375         (Incremental_relocs_reader::data): New function.
5376         (Incremental_binary::Incremental_binary): Initialize new data members.
5377         (Incremental_binary::check_inputs): Add cmdline parameter.
5378         (Incremental_binary::file_is_unchanged): Remove.
5379         (Input_reader::arg_serial): New function.
5380         (Input_reader::get_unused_symbol_count): New function.
5381         (Input_reader::get_unused_symbol): New function.
5382         (Input_reader::do_arg_serial): New function.
5383         (Input_reader::do_get_unused_symbol_count): New function.
5384         (Input_reader::do_get_unused_symbol): New function.
5385         (Incremental_binary::input_file_count): New function.
5386         (Incremental_binary::get_input_reader): Change signature to use
5387         index instead of filename.
5388         (Incremental_binary::file_has_changed): New function.
5389         (Incremental_binary::get_input_argument): New function.
5390         (Incremental_binary::get_library): New function.
5391         (Incremental_binary::get_script_info): New function.
5392         (Incremental_binary::init_layout): New function.
5393         (Incremental_binary::reserve_layout): New function.
5394         (Incremental_binary::output_file): New function.
5395         (Incremental_binary::do_check_inputs): New function.
5396         (Incremental_binary::do_file_is_unchanged): Remove.
5397         (Incremental_binary::do_file_has_changed): New function.
5398         (Incremental_binary::do_init_layout): New function.
5399         (Incremental_binary::do_reserve_layout): New function.
5400         (Incremental_binary::do_input_file_count): New function.
5401         (Incremental_binary::do_get_input_reader): Change signature.
5402         (Incremental_binary::input_args_map_): New data member.
5403         (Incremental_binary::library_map_): New data member.
5404         (Incremental_binary::script_map_): New data member.
5405         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5406         new data members.
5407         (Sized_incremental_binary::output_section): New function.
5408         (Sized_incremental_binary::inputs_reader): Add const.
5409         (Sized_incremental_binary::symtab_reader): Add const.
5410         (Sized_incremental_binary::relocs_reader): Add const.
5411         (Sized_incremental_binary::got_plt_reader): Add const.
5412         (Sized_incremental_binary::get_symtab_view): New function.
5413         (Sized_incremental_binary::Inputs_reader): New typedef.
5414         (Sized_incremental_binary::Input_entry_reader): New typedef.
5415         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5416         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5417         (Sized_incremental_binary::do_file_has_changed): New function.
5418         (Sized_incremental_binary::do_init_layout): New function.
5419         (Sized_incremental_binary::do_reserve_layout): New function.
5420         (Sized_input_reader::Inputs_reader): Remove.
5421         (Sized_input_reader::Input_entry_reader): Remove.
5422         (Sized_input_reader::do_arg_serial): New function.
5423         (Sized_input_reader::do_get_unused_symbol_count): New function.
5424         (Sized_input_reader::do_get_unused_symbol): New function.
5425         (Sized_incremental_binary::do_input_file_count): New function.
5426         (Sized_incremental_binary::do_get_input_reader): Change signature;
5427         use index instead of filename.
5428         (Sized_incremental_binary::section_map_): New data member.
5429         (Sized_incremental_binary::input_entry_readers_): New data member.
5430         (class Sized_incr_relobj): New class.
5431         (class Sized_incr_dynobj): New class.
5432         (make_sized_incremental_object): New function.
5433         (class Incremental_library): New class.
5434         * layout.cc (Free_list::num_lists): New static data member.
5435         (Free_list::num_nodes): New static data member.
5436         (Free_list::num_removes): New static data member.
5437         (Free_list::num_remove_visits): New static data member.
5438         (Free_list::num_allocates): New static data member.
5439         (Free_list::num_allocate_visits): New static data member.
5440         (Free_list::init): New function.
5441         (Free_list::remove): New function.
5442         (Free_list::allocate): New function.
5443         (Free_list::dump): New function.
5444         (Free_list::print_stats): New function.
5445         (Layout_task_runner::run): Resize output file for incremental updates.
5446         (Layout::Layout): Initialize new data members.
5447         (Layout::set_incremental_base): New function.
5448         (Layout::init_fixed_output_section): New function.
5449         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5450         incremental updates.
5451         (Layout::create_gold_note): Do not create gold note section for
5452         incremental updates.
5453         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5454         for incremental updates.
5455         (Layout::set_section_offsets): For incremental updates, allocate space
5456         from free list.
5457         (Layout::create_symtab_sections): Layout with offsets relative to
5458         start of section; for incremental updates, allocate space from free
5459         list.
5460         (Layout::create_shdrs): For incremental updates, allocate space from
5461         free list.
5462         (Layout::finish_dynamic_section): For incremental updates, do not
5463         check --as-needed (fixed in subsequent patch).
5464         * layout.h (class Free_list): New class.
5465         (Layout::set_incremental_base): New function.
5466         (Layout::incremental_base): New function.
5467         (Layout::init_fixed_output_section): New function.
5468         (Layout::allocate): New function.
5469         (Layout::incremental_base_): New data member.
5470         (Layout::free_list_): New data member.
5471         * main.cc (main): Print Free_list statistics.
5472         * object.cc (Relobj::finalize_incremental_relocs): Add
5473         clear_counts parameter; clear counts only when clear_counts is set.
5474         (Sized_relobj::Sized_relobj): Initialize new base class.
5475         (Sized_relobj::do_layout): Don't report special sections.
5476         (Sized_relobj::do_for_all_local_got_entries): New function.
5477         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5478         symtab_off to all symbol table offsets.
5479         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5480         * object.h (class Got_offset_list): Move to top of file.
5481         (Object::Object): Allow case where input_file == NULL.
5482         (Object::~Object): Likewise.
5483         (Object::input_file): Assert that input_file != NULL.
5484         (Object::lock): Allow case where input_file == NULL.
5485         (Object::unlock): Likewise.
5486         (Object::is_locked): Likewise.
5487         (Object::token): Likewise.
5488         (Object::release): Likewise.
5489         (Object::is_incremental): New function.
5490         (Object::get_mtime): New function.
5491         (Object::for_all_local_got_entries): New function.
5492         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5493         (Object::set_is_in_system_directory): New function.
5494         (Object::is_in_system_directory): New function.
5495         (Object::do_is_incremental): New function.
5496         (Object::do_get_mtime): New function.
5497         (Object::do_for_all_local_got_entries): New function.
5498         (Object::is_in_system_directory_): New data member.
5499         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5500         (class Sized_relobj_base): New class.
5501         (class Sized_relobj): Derive from Sized_relobj_base.
5502         (class Sized_relobj::Symbols): Redeclare from base class.
5503         (class Sized_relobj::local_got_offset_list): Remove.
5504         (class Sized_relobj::Output_sections): Redeclare from base class.
5505         (class Sized_relobj::do_for_all_local_got_entries): New function.
5506         (class Sized_relobj::write_local_symbols): Add offset parameter.
5507         (class Sized_relobj::local_symbol_offset_): Update comment.
5508         (class Sized_relobj::local_dynsym_offset_): Update comment.
5509         * options.cc (Input_arguments::add_file): Remove const.
5510         * options.h (Input_file_argument::Input_file_argument):
5511         Initialize arg_serial_ (all constructors).
5512         (Input_file_argument::set_arg_serial): New function.
5513         (Input_file_argument::arg_serial): New function.
5514         (Input_file_argument::arg_serial_): New data member.
5515         (Input_arguments::Input_arguments): Initialize file_count_.
5516         (Input_arguments::add_file): Remove const.
5517         (Input_arguments::number_of_input_files): New function.
5518         (Input_arguments::file_count_): New data member.
5519         (Command_line::number_of_input_files): Call
5520         Input_arguments::number_of_input_files.
5521         * output.cc (Output_segment_headers::Output_segment_headers):
5522         Set current size.
5523         (Output_section::Input_section::current_data_size): New function.
5524         (Output_section::Output_section): Initialize new data members.
5525         (Output_section::add_input_section): Don't do merge sections for
5526         an incremental link; allocate space from free list for an
5527         incremental update.
5528         (Output_section::add_output_section_data): Allocate space from
5529         free list for an incremental update.
5530         (Output_section::update_data_size): New function.
5531         (Output_section::set_fixed_layout): New function.
5532         (Output_section::reserve): New function.
5533         (Output_segment::set_section_addresses): Remove const.
5534         (Output_segment::set_section_list_addresses): Remove const; allocate
5535         space from free list for an incremental update.
5536         (Output_segment::set_offset): Adjust size of RELRO segment for an
5537         incremental update.
5538         * output.h (Output_data::current_data_size): Move here from
5539         child classes.
5540         (Output_data::pre_finalize_data_size): New function.
5541         (Output_data::update_data_size): New function.
5542         (Output_section_headers::update_data_size): new function.
5543         (Output_section_data_build::current_data_size): Move to Output_data.
5544         (Output_data_strtab::update_data_size): New function.
5545         (Output_section::current_data_size): Move to Output_data.
5546         (Output_section::set_fixed_layout): New function.
5547         (Output_section::has_fixed_layout): New function.
5548         (Output_section::reserve): New function.
5549         (Output_section::update_data_size): New function.
5550         (Output_section::has_fixed_layout_): New data member.
5551         (Output_section::free_list_): New data member.
5552         (Output_segment::set_section_addresses): Remove const.
5553         (Output_segment::set_section_list_addresses): Remove const.
5554         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5555         New function.
5556         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5557         New function.
5558         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5559         parameter when calling Add_symbols constructor; store argument
5560         serial number for members of a lib group.
5561         (Add_symbols::locks): Allow case where token == NULL.
5562         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5563         (Read_member::~Read_member): New function.
5564         (Read_member::is_runnable): New function.
5565         (Read_member::locks): New function.
5566         (Read_member::run): New function.
5567         (Check_script::~Check_script): New function.
5568         (Check_script::is_runnable): New function.
5569         (Check_script::locks): New function.
5570         (Check_script::run): New function.
5571         (Check_library::~Check_library): New function.
5572         (Check_library::is_runnable): New function.
5573         (Check_library::locks): New function.
5574         (Check_library::run): New function.
5575         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5576         (Add_symbols::library_): New data member.
5577         (class Read_member): New class.
5578         (class Check_script): New class.
5579         (class Check_library): New class.
5580         * reloc.cc (Read_relocs::is_runnable): Allow case where
5581         token == NULL.
5582         (Read_relocs::locks): Likewise.
5583         (Scan_relocs::locks): Likewise.
5584         (Relocate_task::locks): Likewise.
5585         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5586         to clear counters.
5587         (Sized_relobj::incremental_relocs_scan): Fix comment.
5588         (Sized_relobj::do_relocate): Pass output file offset to
5589         write_local_symbols.
5590         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5591         from class declaration.
5592         * script.cc (read_input_script): Allocate Script_info; pass
5593         argument serial number to report_script.
5594         * script.h (class Script_info): Move to incremental.h.
5595         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5596         * symtab.h (Symbol_table::add_from_incrobj): New function.
5597         (Symbol_table::set_file_offset): New function.
5598
5599 2011-04-05  Cary Coutant  <ccoutant@google.com>
5600
5601         * incremental-dump.cc (dump_incremental_inputs): Change signature
5602         to take a Sized_incremental_binary; change caller.  Use readers
5603         in Sized_incremental_binary.
5604         * incremental.cc
5605         (Sized_incremental_binary::find_incremental_inputs_sections):
5606         Rename do_find_incremental_inputs_sections to this.
5607         (Sized_incremental_binary::setup_readers): New function.
5608         (Sized_incremental_binary::do_check_inputs): Check
5609         has_incremental_info_ flag; move setup code to setup_readers;
5610         use input readers.
5611         (Sized_incremental_binary::do_file_is_unchanged): New function.
5612         (Sized_incremental_binary::do_get_input_reader): New function.
5613         * incremental.h (class Incremental_binary): Move to end of file.
5614         (Incremental_binary::file_is_unchanged): New function.
5615         (Incremental_binary::do_file_is_unchanged): New function.
5616         (Incremental_binary::Input_reader): New class.
5617         (Incremental_binary::get_input_reader): New function.
5618         (class Sized_incremental_binary): Move to end of file.
5619         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5620         input section reader classes.
5621         (Sized_incremental_binary::has_incremental_info): New function.
5622         (Sized_incremental_binary::inputs_reader): New function.
5623         (Sized_incremental_binary::symtab_reader): New function.
5624         (Sized_incremental_binary::relocs_reader): New function.
5625         (Sized_incremental_binary::got_plt_reader): New function.
5626         (Sized_incremental_binary::do_file_is_unchanged): New function.
5627         (Sized_incremental_binary::Sized_input_reader): New class.
5628         (Sized_incremental_binary::get_input_reader): New function.
5629         (Sized_incremental_binary::find_incremental_inputs_sections):
5630         Rename do_find_incremental_inputs_sections to this.
5631         (Sized_incremental_binary::setup_readers): New function.
5632         (Sized_incremental_binary::has_incremental_info_): New data member.
5633         (Sized_incremental_binary::inputs_reader_): New data member.
5634         (Sized_incremental_binary::symtab_reader_): New data member.
5635         (Sized_incremental_binary::relocs_reader_): New data member.
5636         (Sized_incremental_binary::got_plt_reader_): New data member.
5637         (Sized_incremental_binary::current_input_file_): New data member.
5638
5639 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5640
5641         PR gold/12640
5642         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5643         violation.
5644
5645 2011-03-30  Cary Coutant  <ccoutant@google.com>
5646
5647         * archive.cc (Archive::include_member): Adjust call to report_object.
5648         (Add_archive_symbols::run): Add script_info to call to
5649         report_archive_begin.
5650         (Lib_group::include_member): Adjust call to report_object.
5651         (Add_lib_group_symbols::run): Adjust call to report_object.
5652         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5653         blocks.  Add object count for script input files.
5654         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5655         script_info parameter; change all callers.
5656         (Incremental_inputs::report_object): Add script_info parameter;
5657         change all callers.
5658         (Incremental_inputs::report_script): Store backpointer to
5659         incremental info entry.
5660         (Output_section_incremental_inputs::set_final_data_size): Record
5661         additional information for scripts.
5662         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5663         * incremental.h (Incremental_script_entry::add_object): New function.
5664         (Incremental_script_entry::get_object_count): New function.
5665         (Incremental_script_entry::get_object): New function.
5666         (Incremental_script_entry::objects_): New data member; adjust
5667         constructor.
5668         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5669         (Incremental_inputs::report_object): Add script_info parameter.
5670         (Incremental_inputs_reader::get_object_count): New function.
5671         (Incremental_inputs_reader::get_object_offset): New function.
5672         * options.cc (Input_arguments::add_file): Return reference to
5673         new input argument.
5674         * options.h (Input_argument::set_script_info): New function.
5675         (Input_argument::script_info): New function.
5676         (Input_argument::script_info_): New data member; adjust all
5677         constructors.
5678         (Input_file_group::add_file): Return reference to new input argument.
5679         (Input_file_lib::add_file): Likewise.
5680         (Input_arguments::add_file): Likewise.
5681         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5682         * script.cc (Parser_closure::Parser_closure): Add script_info
5683         parameter; adjust all callers.
5684         (Parser_closure::script_info): New function.
5685         (Parser_closure::script_info_): New data member.
5686         (read_input_script): Report scripts earlier to incremental info.
5687         (script_add_file): Set script_info in Input_argument.
5688         (script_add_library): Likewise.
5689         * script.h (Script_options::Script_info): Rewrite class.
5690
5691 2011-03-29  Cary Coutant  <ccoutant@google.com>
5692
5693         * archive.cc (Library_base::should_include_member): Move
5694         method here from class Archive.
5695         (Archive::Archive): Initialize base class.
5696         (Archive::should_include_member): Move to base class.
5697         (Archive::do_for_all_unused_symbols): New function.
5698         (Add_archive_symbols::run): Remove redundant access to
5699         incremental_inputs.
5700         (Lib_group::Lib_group): Initialize base class.
5701         (Lib_group::do_filename): New function.
5702         (Lib_group::include_member): Pass pointer to Lib_group to
5703         report_object.
5704         (Lib_group::do_for_all_unused_symbols): New function.
5705         (Add_lib_group_symbols::run): Report archive information for
5706         incremental links.
5707         * archive.h (class Library_base): New base class.
5708         (class Archive): Derive from Library_base.
5709         (Archive::filename): Move to base class.
5710         (Archive::set_incremental_info): Likewise.
5711         (Archive::incremental_info): Likewise.
5712         (Archive::Should_include): Likewise.
5713         (Archive::should_include_member): Likewise.
5714         (Archive::Armap_entry): Remove.
5715         (Archive::Unused_symbol_iterator): Remove.
5716         (Archive::unused_symbols_begin): Remove.
5717         (Archive::unused_symbols_end): Remove.
5718         (Archive::do_filename): New function.
5719         (Archive::do_get_mtime): New function.
5720         (Archive::do_for_all_unused_symbols): New function.
5721         (Archive::task_): Move to base class.
5722         (Archive::incremental_info_): Likewise.
5723         (class Lib_group): Derive from Library_base.
5724         (Lib_group::do_filename): New function.
5725         (Lib_group::do_get_mtime): New function.
5726         (Lib_group::do_for_all_unused_symbols): New function.
5727         (Lib_group::task_): Move to base class.
5728         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5729         function.
5730         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5731         function.
5732         * incremental.cc (Incremental_inputs::report_archive_begin):
5733         Use Library_base; call library's get_mtime; add incremental inputs
5734         entry before members.
5735         (class Unused_symbol_visitor): New class.
5736         (Incremental_inputs::report_archive_end): Use Library_base; use
5737         visitor class to record unused symbols; don't add incremental inputs
5738         entry after members.
5739         (Incremental_inputs::report_object): Use Library_base.
5740         * incremental.h
5741         (Incremental_archive_entry::Incremental_archive_entry): Remove
5742         unused Archive parameter.
5743         (Incremental_inputs::report_archive_begin): Use Library_base.
5744         (Incremental_inputs::report_archive_end): Likewise.
5745         (Incremental_inputs::report_object): Likewise.
5746         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5747         function.
5748         * object.h (Object::for_all_global_symbols): New function.
5749         (Object::do_for_all_global_symbols): New function.
5750         (Sized_relobj::do_for_all_global_symbols): New function.
5751         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5752         function.
5753         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5754         function.
5755
5756 2011-03-27  Ian Lance Taylor  <iant@google.com>
5757
5758         * archive.cc (Archive::interpret_header): Return -1 if something
5759         goes wrong.  Change callers accordingly.
5760
5761 2011-03-25  Cary Coutant  <ccoutant@google.com>
5762
5763         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5764         * testsuite/Makefile.in: Regenerate.
5765
5766 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5767
5768         * plugin.cc (get_view): New.
5769         (Plugin::load): Pass get_view to the plugin.
5770         (Plugin_manager::get_view): New.
5771
5772 2011-03-21  Ian Lance Taylor  <iant@google.com>
5773
5774         * testsuite/final_layout.sh: Rewrite to not use dc.
5775         * testsuite/relro_test.sh: Fail if dc is not present.
5776
5777 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5778
5779         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5780         Change == to -eq.
5781         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5782         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5783         Change == to -eq.
5784         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5785         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5786
5787 2011-03-14  Ian Lance Taylor  <iant@google.com>
5788
5789         * script-sections.cc (Sort_output_sections::script_compare):
5790         Rename from is_before, change return type.
5791         (Sort_output_sections::operator()): Adjust accordingly.
5792
5793 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5794
5795         PR gold/12572
5796         * testsuite/odr_violation2.cc: Add comment to make all error line
5797         numbers double digits.
5798         * testsuite/debug_msg.sh: Adjust expected errors.
5799
5800 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5801
5802         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5803         but mark earlier ones as non-canonical
5804         (offset_to_iterator): Update search target and example
5805         (do_addr2line): Return extra lines in a vector*
5806         (format_file_lineno): Extract from do_addr2line
5807         (one_addr2line): Add vector* out-param
5808         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5809         when a lineno entry appeared last for its instruction
5810         (Dwarf_line_info): Add vector* out-param
5811         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5812         * symtab.cc (Odr_violation_compare): Include the lineno in the
5813         comparison again.
5814         (linenos_from_loc): New. Combine the canonical line for an
5815         address with its other lines.
5816         (True_if_intersect): New. Helper functor to make
5817         std::set_intersection a query.
5818         (detect_odr_violations): Compare sets of lines instead of just
5819         one line for each function. This became less deterministic, but
5820         has fewer false positives.
5821         * symtab.h: Declarations.
5822         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5823         mix an optimized and non-optimized object in the same binary
5824         (odr_violation2.so): Same.
5825         * testsuite/Makefile.in: Regenerate from Makefile.am.
5826         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5827         * testsuite/debug_msg.sh: Update line numbers and add
5828         assertions.
5829         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5830         non-optimized context.
5831         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5832         isn't inlined, and use OdrDerived in an optimized context.
5833         * testsuite/odr_header1.h: Defines OdrDerived, where
5834         optimization will change the
5835         first-instruction-in-the-destructor's file and line number.
5836         * testsuite/odr_header2.h: Defines OdrBase.
5837
5838 2011-03-09  Ian Lance Taylor  <iant@google.com>
5839
5840         * fileread.cc (File_read::clear_views): Don't delete the whole
5841         file view.
5842
5843 2011-03-08  Ian Lance Taylor  <iant@google.com>
5844
5845         PR gold/12525
5846         * fileread.cc: #include <climits>.
5847         (GOLD_IOV_MAX): Define.
5848         (File_read::read_multiple): Limit number of entries by iov_max.
5849         * fileread.h (class File_read): Always set max_readv_entries to
5850         128.
5851
5852 2011-03-07  Ian Lance Taylor  <iant@google.com>
5853
5854         PR gold/12525
5855         * options.h (class General_options): Add -dy and -dn.
5856
5857 2011-03-02  Cary Coutant  <ccoutant@google.com>
5858
5859         * testsuite/script_test_9.t: Add TLS segment.
5860
5861 2011-03-02  Simon Baldwin  <simonb@google.com>
5862
5863         * configure.ac: Add check for gnu_indirect_function support in
5864         the toolchain building binutils.
5865         * configure: Rebuild.
5866
5867 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5868
5869         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5870         plugin only symbols.
5871         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5872         in plugin files as not needed in the symbol table.
5873
5874 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5875
5876         * output.cc (Output_section::add_input_section): Delay fill
5877         generation for section ordering.
5878
5879 2011-02-09  Ian Lance Taylor  <iant@google.com>
5880
5881         PR gold/12316
5882         * object.h (class Sized_relobj): Remove clear_local_symbols.
5883         * reloc.cc (Sized_relobj::do_relocate): Don't call
5884         clear_local_symbols.
5885
5886 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5887
5888         * plugin.cc (is_visible_from_outside): Return true for symbols
5889         in the -u option.
5890
5891 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5892
5893         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5894         filename.
5895
5896 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5897
5898         * icf.h (is_section_foldable_candidate): Change type of parameter
5899         to std::string.
5900         * icf.cc (Icf::find_identical_sections): Change type of local variable
5901         section_name to be std::string.
5902         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5903
5904 2011-01-25  Ian Lance Taylor  <iant@google.com>
5905
5906         * script.cc (script_add_extern): Rewrite to use
5907         add_symbol_reference.
5908
5909 2011-01-25  Doug Kwan  <dougkwan@google.com>
5910
5911         * icf.cc (get_section_contents): Always lock section's object.
5912
5913 2011-01-24  Ian Lance Taylor  <iant@google.com>
5914
5915         * options.h (class General_options): Accept
5916         --no-detect-odr-violations.
5917
5918 2011-01-24  Ian Lance Taylor  <iant@google.com>
5919
5920         * version.cc (version_string): Bump to 1.11.
5921
5922 2011-01-24  Ian Lance Taylor  <iant@google.com>
5923
5924         * plugin.cc (class Plugin_rescan): Define new class.
5925         (Plugin_manager::claim_file): Set any_claimed_.
5926         (Plugin_manager::save_archive): New function.
5927         (Plugin_manager::save_input_group): New function.
5928         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5929         necessary.
5930         (Plugin_manager::new_undefined_symbol): New function.
5931         (Plugin_manager::rescan): New function.
5932         (Plugin_manager::rescannable_defines): New function.
5933         (Plugin_manager::add_input_file): Set any_added_.
5934         * plugin.h (class Plugin_manager): define new fields rescannable_,
5935         undefined_symbols_, any_claimed_, and any_added_.  Declare
5936         Plugin_rescan as friend.  Declare new functions.
5937         (Plugin_manager::Rescannable): Define type.
5938         (Plugin_manager::Rescannable_list): Define type.
5939         (Plugin_manager::Undefined_symbol_list): Define type.
5940         (Plugin_manager::Plugin_manager): Initialize new fields.
5941         * archive.cc (Archive::defines_symbol): New function.
5942         (Add_archive_symbols::run): Pass archive to plugins if any.
5943         * archive.h (class Archive): Declare defines_symbol.
5944         * readsyms.cc (Input_group::~Input_group): New function.
5945         (Finish_group::run): Pass input_group to plugins if any.
5946         * readsyms.h (class Input_group): Declare destructor.
5947         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5948         any.
5949
5950 2011-01-10  Ian Lance Taylor  <iant@google.com>
5951
5952         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5953         section as relro.
5954         (Layout::set_segment_offsets): Reset increase_relro before calling
5955         set_section_addresses a second time.
5956
5957 2011-01-04  Cary Coutant  <ccoutant@google.com>
5958
5959         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5960         sections before NOBITS sections.
5961
5962 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5963
5964         * version.cc (print_version): Update copyright to 2011.
5965
5966 2010-12-23  Cary Coutant  <ccoutant@google.com>
5967
5968         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5969         of OS to this->add.  Add OD parameter to second form of the function.
5970
5971 2010-12-20  Ian Lance Taylor  <iant@google.com>
5972
5973         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5974         second of two consecutive entries with same offset.
5975
5976 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5977
5978         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5979         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5980         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5981         to avoid unneeded links against $(LDADD).
5982         * testsuite/Makefile.in: Regenerate.
5983
5984 2010-12-15  Ian Lance Taylor  <iant@google.com>
5985
5986         PR gold/12324
5987         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5988         for R_X86_64_32 and R_X86_64_PC32.
5989         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5990         ver_matching_def_pic.o.
5991         (ver_matching_def_pic.o): New target.
5992
5993 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5994
5995         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5996         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5997         Move definition before File_read::View member definitions.
5998         (File_read::View::~View): Initialize and hold lock before
5999         updating current_mapped_bytes.
6000
6001 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6002
6003         * dwarf_reader.cc: Remove outdated comment.
6004         * gold-threads.cc: Fix typo in error message.
6005         * archive.cc: Fix typos in comments.
6006         * archive.h: Likewise.
6007         * arm-reloc-property.cc: Likewise.
6008         * arm-reloc-property.h: Likewise.
6009         * arm-reloc.def: Likewise.
6010         * arm.cc: Likewise.
6011         * attributes.h: Likewise.
6012         * cref.cc: Likewise.
6013         * ehframe.cc: Likewise.
6014         * fileread.h: Likewise.
6015         * gold.h: Likewise.
6016         * i386.cc: Likewise.
6017         * icf.cc: Likewise.
6018         * incremental.h: Likewise.
6019         * int_encoding.cc: Likewise.
6020         * layout.h: Likewise.
6021         * main.cc: Likewise.
6022         * merge.h: Likewise.
6023         * object.cc: Likewise.
6024         * object.h: Likewise.
6025         * options.cc: Likewise.
6026         * readsyms.cc: Likewise.
6027         * reduced_debug_output.cc: Likewise.
6028         * reloc.cc: Likewise.
6029         * script-sections.cc: Likewise.
6030         * sparc.cc: Likewise.
6031         * symtab.h: Likewise.
6032         * target-reloc.h: Likewise.
6033         * target.cc: Likewise.
6034         * target.h: Likewise.
6035         * timer.cc: Likewise.
6036         * timer.h: Likewise.
6037         * x86_64.cc: Likewise.
6038
6039 2010-12-09  Cary Coutant  <ccoutant@google.com>
6040
6041         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6042         stack.
6043         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6044         parameter; change all callers.
6045         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6046         * options.h (warn_execstack): New option.
6047
6048 2010-12-07  Doug Kwan  <dougkwan@google.com>
6049
6050         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6051         like function call relocations.
6052
6053 2010-12-07  Ian Lance Taylor  <iant@google.com>
6054
6055         * archive.cc (Archive::get_elf_object_for_member): Permit
6056         punconfigured to be NULL.
6057         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6058         (Archive::include_member): Pass NULL to get_elf_object_for_member
6059         if we searched for the archive and this is the first included
6060         object.
6061
6062 2010-12-01  Ian Lance Taylor  <iant@google.com>
6063
6064         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6065         track_relocs_type_ field.
6066         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6067         Set track_relocs_type_.
6068         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6069         contents when using RELA relocs.
6070         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6071         reloc_map_.
6072         * reloc.cc (Track_relocs::next_addend): New function.
6073         * reloc.h (class Track_relocs): Declare next_addend.
6074
6075 2010-12-01  Ian Lance Taylor  <iant@google.com>
6076
6077         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6078         virtual destructor.
6079
6080 2010-12-01  Ian Lance Taylor  <iant@google.com>
6081
6082         * README: Update compilers known to work and fail.
6083
6084 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6085
6086         * configure.in: For --enable-gold, handle value `default' instead of
6087         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6088         not the default.
6089         * configure: Regenerate.
6090
6091 2010-11-18  Doug Kwan  <dougkwan@google.com>
6092
6093         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6094         and right_alignment to be zero.  Store result alignment only if it is
6095         greater than existing alignment.
6096
6097 2010-11-16  Cary Coutant  <ccoutant@google.com>
6098
6099         PR gold/12220
6100         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6101         Check for ".zdebug_line".
6102
6103 2010-11-16  Doug Kwan  <dougkwan@google.com>
6104             Cary Coutant  <ccoutant@google.com>
6105
6106         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6107         by reference; adjust all callers.
6108         * output.cc (Output_segment::set_section_addresses): Adjust references
6109         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6110         list is empty.
6111         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6112         end at page boundary.
6113
6114 2010-11-16  Cary Coutant  <ccoutant@google.com>
6115
6116         PR gold/12220
6117         * layout.cc (Layout::choose_output_section): Transform names of
6118         compressed sections even when using a script with a SECTIONS clause.
6119         (Layout::output_section_name): Remove code to transform
6120         compressed debug section names.
6121         * output.cc (Output_section::add_input_section): Use uncompressed
6122         section size when tracking input sections.
6123
6124 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6125
6126         * symtab.h (Symbol::NON_PIC_REF): Remove.
6127         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6128         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6129         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6130         (Symbol::use_plt_offset): Take a flags argument and pass it
6131         directly to needs_dynamic_reloc.  Restrict check for undefined
6132         weak symbols to function calls.
6133         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6134         (Target_arm::Scan::global): Use it.
6135         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6136         (Target_arm::Relocate::relocate): Likewise.
6137         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6138         parameter with an r_type parameter.  Use get_reference_flags
6139         to get the flags.
6140         (Target_arm::Relocate::relocate): Update accordingly.
6141         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6142         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6143         (Target_i386::Scan::global): Likewise.
6144         (Target_i386::Relocate::relocate): Likewise.
6145         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6146         parameter with an r_type parameter.  Use get_reference_flags
6147         to get the flags.
6148         (Target_i386::Relocate::relocate): Update accordingly.
6149         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6150         (Target_powerpc::Scan::global): Use it.
6151         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6152         (Target_powerpc::Relocate::relocate): Likewise.
6153         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6154         (Target_sparc::Scan::global): Use it.
6155         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6156         (Target_sparc::Relocate::relocate): Likewise.
6157         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6158         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6159         (Target_x86_64::Scan::global): Likewise.
6160         (Target_x86_64::Relocate::relocate): Likewise.
6161
6162 2010-11-08  Doug Kwan  <dougkwan@google.com>
6163             Cary Coutant  <ccoutant@google.com>
6164
6165         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6166         (Arm_exidx_merge_section::section_contents_): New data member.
6167         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6168         (Arm_input_section::~Arm_input_section): De-allocate memory.
6169         (Arm_input_section::original_contents_): New data member.
6170         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6171         in parameters instead of calling Object::section_contents without
6172         locking.
6173         (Arm_output_section::group_section): New parameter TASK.  Pass it
6174         to callees that need locking objects.
6175         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6176         to lock EXIDX input sections.  Fix a formatting issue.  Call
6177         Arm_exidx_merged_section::build_contents to create merged section
6178         contents.
6179         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6180         to lock object of stub table owner.
6181         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6182         TEXT_SIZE to initialize data member TEXT_SIZE_.
6183         (Arm_exidx_input_section::addralign): Fix typo in comment.
6184         (Arm_exidx_input_section::text_size): New method.
6185         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6186         that require locking objects.  Lock objects before scanning for stubs
6187         and updating local symbols.
6188         (Arm_input_section<big_endian>::init): Copy contents of original
6189         input section.
6190         (Arm_input_section<big_endian>::do_write): Use saved contents of
6191         original input section instead of calling Object::section_contents
6192         without locking.
6193         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6194         size without calling Object::section_size().
6195         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6196         for size.  Allocate a buffer for merged EXIDX entries.
6197         (Arm_exidx_merged_section::build_contents): New method.
6198         (Arm_exidx_merged_section::do_write): Move merge section contents
6199         building code to Arm_exidx_merged_section::build_contetns.  Write
6200         out contetns in buffer instead of building it on the fly.
6201         (Arm_relobj::make_exidx_input_section): Also pass text section size
6202         to Arm_exidx_input_section constructor.
6203         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6204         (Arm_dynobj::do_read_symbols): Fix memory leak.
6205         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6206         * target.h: (class Task): Add forward declaration.
6207         (Target::relax): Add new parameter TASK and pass it to
6208         Target::do_relax().
6209         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6210
6211 2010-11-05  Cary Coutant  <ccoutant@google.com>
6212
6213         PR gold/10708
6214         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6215         object when reading from the file.
6216         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6217         second layout pass.
6218         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6219         when reading section contents.
6220         (get_section_contents): Likewise.
6221         (icf::find_identical_sections): Likewise.
6222         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6223         object when reading from the file.
6224         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6225         the object when doing deferred section layout.
6226
6227 2010-11-03  Nick Clifton  <nickc@redhat.com>
6228
6229         PR gold/12001
6230         * script.h (class Symbol_assignment: name): New member.  Returns
6231         the name of the symbol.
6232         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6233         Returns true if the given symbol name is on the list of
6234         assignments wating to be processed.
6235         * archive.cc (should_incldue_member): If the symbol is undefined,
6236         check to see if it is on the list of symbols pending assignment.
6237
6238 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6239
6240         * script-sections.cc (Script_sections::find_memory_region): Check
6241         for a NULL output section pointer.
6242
6243 2010-10-29  Doug Kwan  <dougkwan@google.com>
6244
6245         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6246         Output_section::add_relaxed_input_section.
6247         * output.cc (Output_section::add_relaxed_input_section): Add new
6248         arguments LAYOUT and NAME.  Set section order index.
6249         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6250         Copy section order index.
6251         * output.h (Output_section::add_relaxed_input_section): Add new
6252         arguments LAYOUT and NAME.
6253
6254 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6255
6256         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6257         NATIVE_OR_CROSS_LINKER.
6258         * testsuite/Makefile.in: Regenerate.
6259
6260 2010-10-20  Doug Kwan  <dougkwan@google.com>
6261
6262         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6263         without SHF_LINK_ORDER flags.
6264         * layout.cc (Layout::choose_output_section): Do not filter
6265         SHF_LINK_ORDER flag in a relocatable link.
6266
6267 2010-10-17  Cary Coutant  <ccoutant@google.com>
6268
6269         * output.h (Output_segment::set_section_addresses): Change function
6270         signature.  Update all callers.
6271         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6272         sections.
6273         (Output_segment::set_section_addresses): Align after last TLS
6274         section.  Add padding before last relro section instead of after.
6275
6276 2010-10-17  Doug Kwan  <dougkwan@google.com>
6277
6278         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6279         GOT output section to be writable.
6280
6281 2010-10-14  Cary Coutant  <ccoutant@google.com>
6282
6283         * debug.h (DEBUG_INCREMENTAL): New flag.
6284         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6285         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6286         mode.
6287         * incremental.cc (report_command_line): Ignore all forms of
6288         --incremental.
6289         * layout.cc (Layout::Layout): Check parameters for incremental link
6290         mode.
6291         * options.cc (General_options::parse_incremental): New function.
6292         (General_options::parse_no_incremental): New function.
6293         (General_options::parse_incremental_full): New function.
6294         (General_options::parse_incremental_update): New function.
6295         (General_options::incremental_mode_): New data member.
6296         (General_options::finalize): Check incremental_mode_.
6297         * options.h (General_options): Update help text for --incremental.
6298         Add --no-incremental, --incremental-full, --incremental-update.
6299         (General_options::Incremental_mode): New enum type.
6300         (General_options::incremental_mode): New function.
6301         (General_options::incremental_mode_): New data member.
6302         * parameters.cc (Parameters::incremental_mode_): New data member.
6303         (Parameters::set_options): Set incremental_mode_.
6304         (Parameters::set_incremental_full): New function.
6305         (Parameters::incremental): New function.
6306         (Parameters::incremental_update): New function.
6307         (set_parameters_incremental_full): New function.
6308         * parameters.h (Parameters::set_incremental_full): New function.
6309         (Parameters::incremental): New function.
6310         (Parameters::incremental_update): New function.
6311         (Parameters::incremental_mode_): New data member.
6312         (set_parameters_incremental_full): New function.
6313         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6314         incremental link mode.
6315         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6316         (Sized_relobj::do_relocate_sections): Likewise.
6317         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6318         option.
6319         * testsuite/Makefile.in: Regenerate.
6320         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6321
6322 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6323
6324         * script-sections.h (class Script_sections): Make
6325         Sections_elements typedef public.
6326         * script-sections.cc (class Sort_output_sections): Add elements_
6327         field.  Add constructor which sets it; change all callers.
6328         (Sort_output_sections::is_before): New function.
6329         (Sort_output_sections::operator()): Call is_before.
6330         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6331         conditional.
6332         * testsuite/script_test_10.sh: New test. Test script section
6333         order.
6334         * testsuite/script_test_10.t: Likewise.
6335         * testsuite/script_test_10.s: Likewise.
6336         * testsuite/Makefile.am: Wrap the cross linker tests and the
6337         common tests into NATIVE_OR_CROSS_LINKER.
6338         (check_SCRIPTS): Add script_test_10.sh.
6339         (check_DATA): Add script_test_10.stdout.
6340         (script_test_10.o, script_test_10): New targets.
6341         (script_test_10.stdout): New target.
6342         * configure, testsuite/Makefile.in: Regenerate.
6343
6344 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6345
6346         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6347         error for the deprecated relocations.
6348         (Target_arm::Scan::global): Likewise.
6349         (Target_arm::Relocate::relocate): Likewise.
6350
6351 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6352
6353         * fileread.cc (Input_file::find_file): Initialize *found_name
6354         and *namep when using the fallback search for case 4.
6355
6356 2010-10-11  Cary Coutant  <ccoutant@google.com>
6357
6358         * options.h (class General_options): Redefine -z lazy as an alias for
6359         the negation of -z now.
6360
6361 2010-10-11  Ian Lance Taylor  <iant@google.com>
6362
6363         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6364         binding.
6365
6366 2010-10-06  Nick Clifton  <nickc@redhat.com>
6367
6368         * script-sections.cc(class Memory_region): Remove
6369         current_lma_offset_ field.  Rename current_vma_offset_ to
6370         current_offset_.  Add last_section_ field.
6371         (Memory_region::get_current_vma_address): Rename to
6372         get_current_address.
6373         (Memory_region::get_current_lma_address): Delete.
6374         (Memory_region::increment_vma_offset): Rename to
6375         increment_offset.
6376         (Memory_region::increment_lma_offset): Delete.
6377         (Memory_region::attributes_compatible): New method.  Returns
6378         true if the provided section is compatible with the region.
6379         (Memory_region::get_last_section): New method.  Returns the last
6380         section to use the region.
6381         (Memory_region::set_last_section): New method.  Stores the last
6382         section to use the region.
6383         (Script_sections::block_in_region): New method.  Returns true if
6384         a block of memory is contained within a region.
6385         (Script_sections::find_memory_region): New method.  Locates a
6386         memory region to be used to set a VMA or LMA address.
6387         (Output_section_definition::set_section_addresses): Add code to
6388         check for addresses set by memory regions.
6389         (Output_segment::set_section_addresses): Remove memory region
6390         walking code.
6391         (Script_sections::create_segment): Add a warning if a header
6392         segment is created outside of any region.
6393         * script-sections.h (class Script_sections): Add prototypes for
6394         find_memory_region and block_in_region methods.
6395         * testsuite/memory_test.s: Use .long instead of .word.
6396         * testsuite/memory_test.t: Add some more output sections.
6397         * testsuite/memory_test.sh: Update expected output.
6398
6399 2010-10-02  Doug Kwan  <dougkwan@google.com>
6400
6401         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6402         defintion to symtab.h
6403         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6404         declaration to defintion.
6405
6406 2010-10-01  Nick Clifton  <nickc@redhat.com>
6407
6408         * expression.cc (eval): Replace dummy argument with NULL.
6409         (eval_maybe_dot): Check for a NULL result section pointer.
6410         (Symbol_expression::value): Likewise.
6411         (Dot_expression::value): Likewise.
6412         (BINARY_EXPRESSION): Likewise.
6413         (Max_expression::value): Likewise.
6414         (Min_expression::value): Likewise.
6415         (Absolute_expression::value): Likewise.
6416         (Addr_expression::value_from_output_section): Likewise.
6417         (Loaddddr_expression::value_from_output_section): Likewise.
6418         (Segment_start_expression::value): Likewise.
6419         * script-sections.cc
6420         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6421         argument with NULL.
6422         (Sections_elememt_dot_assignment::set_section_addresses):
6423         Likewise.
6424         (Output_data_expression::do_write_to_buffer): Likewise.
6425         (Output_section_definition::finalize_symbols): Likewise.
6426         (Output_section_definition::set_section_addresses): Likewise.
6427
6428 2010-09-30  Doug Kwan  <dougkwan@google.com>
6429
6430         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6431
6432 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6433
6434         * target.h (Target::can_icf_inline_merge_sections): New virtual
6435         function.
6436         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6437         virtual function.
6438         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6439         virtual function.
6440         * icf.cc (get_section_contents): Inline merge sections only when
6441         target allows it.
6442
6443 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6444
6445         * configure: Regenerate.
6446
6447 2010-09-17  Ian Lance Taylor  <iant@google.com>
6448
6449         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6450         * testsuite/Makefile.am (memory_test.o): New target.
6451         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6452         memory_test.t.
6453         * testsuite/Makefile.in: Rebuild.
6454
6455 2010-09-17  Doug Kwan  <dougkwan@google.com>
6456
6457         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6458         defintion if relocation uses GOT entries of the symbol.
6459         * testsuite/icf_safe_test.sh: Fix test.
6460         * testsuite/icf_safe_so_test.sh: Fix test.
6461
6462 2010-09-16  Cary Coutant  <ccoutant@google.com>
6463
6464         * script_sections.cc (class Memory_region): Remove "NULL" from
6465         vector initializations.
6466
6467 2010-09-15  Cary Coutant  <ccoutant@google.com>
6468
6469         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6470         Resolve forwarding symbols.
6471
6472 2010-09-15  Doug Kwan  <dougkwan@google.com>
6473
6474         * gold/testsuite/script_test_3.t: Add ARM special sections.
6475         * gold/testsuite/script_test_4.t: Same.
6476         * gold/testsuite/script_test_5.t: Same.
6477         * gold/testsuite/script_test_6.t: Same.
6478         * gold/testsuite/script_test_7.t: Same.
6479         * gold/testsuite/script_test_7.t: Same.
6480         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6481
6482 2010-09-14  Cary Coutant  <ccoutant@google.com>
6483
6484         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6485         (Target_x86_64::Relocate::relocate_tls): Replace check for
6486         saw_tls_block_reloc_ with test for executable section.
6487
6488 2010-09-12  Cary Coutant  <ccoutant@google.com>
6489
6490         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6491         position-independent executables to shared libraries need dynamic
6492         relocations.
6493         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6494         position-independent executables.
6495         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6496         * testsuite/Makefile.in: Regenerate.
6497
6498 2010-09-10  Nick Clifton  <nickc@redhat.com>
6499
6500         PR gold/11997
6501         * testsuite/memory_test.t: Discard any sections that are not
6502         needed.
6503
6504 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6505
6506         PR gold/11996
6507         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6508         "This::" to work around a bug in gcc 4.2.
6509
6510         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6511
6512 2010-09-09  Rafael Espindola  <espindola@google.com>
6513
6514         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6515         sections with different PF_X flags in the same segment.
6516         (Layout::find_first_load_seg): Search all segments to find the first
6517         one.
6518         * options.h (rosegment): New.
6519
6520 2010-09-08  Rafael Espindola  <espindola@google.com>
6521
6522         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6523
6524 2010-09-08  Doug Kwan  <dougkwan@google.com>
6525
6526         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6527         (Arm_relobj::do_relocate_sections): Add new parameter for output
6528         file to match the parent.
6529         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6530         of local symbols instead of input values.  Update code to track
6531         changes in gold::relocate_section.
6532         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6533         (Sized_relobj::compute_final_local_value_internal): New methods.
6534         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6535         body into private version of Sized_relobj::compute_final_local_value.
6536         Call the inline method.
6537         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6538         merged symbol value if there is one.
6539         (Symbol_value::has_output_value): New method defintiion.
6540         (Sized_relobj::Compute_final_local_value_status): New enum type.
6541         (Sized_relobj::compute_final_local_value): New methods.
6542         (Sized_relobj::compute_final_local_value_internal): New methods.
6543         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6544         and arm_cortex_a8.sh.
6545         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6546         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6547         New tests.
6548         * Makefile.in: Regenerate.
6549         * testsuite/arm_bl_out_of_range.s: Update test.
6550         * testsuite/thumb_bl_out_of_range.s: Ditto.
6551         * testsuite/thumb_blx_out_of_range.s: Ditto.
6552         * testsuite/arm_branch_out_of_range.sh: New file.
6553         * testsuite/arm_cortex_a8.sh: Ditto.
6554         * testsuite/arm_cortex_a8_b.s: Ditto.
6555         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6556         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6557         * testsuite/arm_cortex_a8_bl.s: Ditto.
6558         * testsuite/arm_cortex_a8_blx.s: Ditto.
6559         * testsuite/arm_cortex_a8_local.s: Ditto.
6560         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6561         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6562
6563 2010-09-08  Rafael Espindola  <espindola@google.com>
6564
6565         * Makefile.am (memory_test.stdout): Run readelf with -W.
6566         * Makefile.in: Regenerate.
6567         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6568         64 bit output.
6569
6570 2010-09-08  Rafael Espindola  <espindola@google.com>
6571
6572         * script-sections.cc (Script_sections::add_memory_region): Convert
6573         field precision to int.
6574         * script.cc (script_set_section_region, script_set_section_region):
6575         Convert field precision to int.
6576
6577 2010-09-08  Rafael Espindola  <espindola@google.com>
6578
6579         * arm.cc (do_finalize_sections): Create the __exidx_start and
6580         __exdix_end symbols even when the section is missing.
6581
6582 2010-09-08  Nick Clifton  <nickc@redhat.com>
6583
6584         * README: Remove claim that MEMORY is not supported.
6585         * expression.cc (script_exp_function_origin)
6586         (script_exp_function_length): Move from here to ...
6587         * script.cc: ... here.
6588         (script_set_section_region, script_add_memory)
6589         (script_parse_memory_attr, script_include_directive): New
6590         functions.
6591         * script-sections.cc
6592         (class Memory_region): New class.
6593         (class Output_section_definition): Add set_memory_region,
6594         set_section_vma, set_section_lma and get_section_name methods.
6595         (class Script_Sections): Add add_memory_region,
6596         find_memory_region, find_memory_region_origin,
6597         find_memory_region_length and set_memory_region methods.
6598         Have set_section_addresses method walk the list of set memory
6599         regions.
6600         Extend the print methos to display memory regions.
6601         * script-sections.h: Add prototypes for new methods.
6602         Add enum for MEMORY region attributes.
6603         * yyscript.y: Add support for parsing MEMORY regions.
6604         * script-c.h: Add prototypes for new functions.
6605         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6606         * testsuite/Makefile.in: Regenerate.
6607         * testsuite/memory_test.sh: New script.
6608         * testsuite/memory_test.s: New assembler source file.
6609         * testsuite/memory_test.t: New linker script.
6610
6611 2010-08-27  Doug Kwan  <dougkwan@google.com>
6612
6613         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6614         reference override an existing dynamic weak reference.
6615         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6616         * testsuite/Makefile.in: Regenerate.
6617         * testsuite/dyn_weak_ref.sh: New file.
6618         * testsuite/dyn_weak_ref_1.c: Ditto.
6619         * testsuite/dyn_weak_ref_2.c: Ditto.
6620
6621 2010-08-27  Ian Lance Taylor  <iant@google.com>
6622
6623         * incremental.h (class Incremental_input_entry): Add virtual
6624         destructor.
6625
6626 2010-08-27  Ian Lance Taylor  <iant@google.com>
6627
6628         * testsuite/start_lib_test_3.c: Mark t3 as used.
6629
6630 2010-08-27  Nick Clifton  <nickc@redhat.com>
6631
6632         * options.cc (version_script): Fix small typo in previous
6633         whitespace tidyup.
6634
6635 2010-08-25  Nick Clifton  <nickc@redhat.com>
6636
6637         * archive.cc: Formatting fixes: Remove whitespace between
6638         typename and following asterisk.  Remove whitespace between
6639         function name and opening parenthesis.
6640         * archive.h: Likewise.
6641         * arm.cc: Likewise.
6642         * attributes.cc: Likewise.
6643         * attributes.h: Likewise.
6644         * common.cc: Likewise.
6645         * copy-relocs.cc: Likewise.
6646         * dirsearch.h: Likewise.
6647         * dynobj.cc: Likewise.
6648         * ehframe.cc: Likewise.
6649         * ehframe.h: Likewise.
6650         * expression.cc: Likewise.
6651         * fileread.cc: Likewise.
6652         * fileread.h: Likewise.
6653         * gc.h: Likewise.
6654         * gold-threads.cc: Likewise.
6655         * gold.cc: Likewise.
6656         * i386.cc: Likewise.
6657         * icf.h: Likewise.
6658         * incremental-dump.cc: Likewise.
6659         * incremental.cc: Likewise.
6660         * layout.cc: Likewise.
6661         * layout.h: Likewise.
6662         * main.cc: Likewise.
6663         * merge.cc: Likewise.
6664         * merge.h: Likewise.
6665         * object.cc: Likewise.
6666         * object.h: Likewise.
6667         * options.cc: Likewise.
6668         * options.h: Likewise.
6669         * output.cc: Likewise.
6670         * output.h: Likewise.
6671         * plugin.cc: Likewise.
6672         * plugin.h: Likewise.
6673         * powerpc.cc: Likewise.
6674         * reloc.cc: Likewise.
6675         * script-c.h: Likewise.
6676         * script-sections.cc: Likewise.
6677         * script.cc: Likewise.
6678         * stringpool.cc: Likewise.
6679         * symtab.cc: Likewise.
6680         * symtab.h: Likewise.
6681         * target.cc: Likewise.
6682         * timer.cc: Likewise.
6683         * timer.h: Likewise.
6684         * version.cc: Likewise.
6685         * x86_64.cc: Likewise.
6686
6687 2010-08-24  Nick Clifton  <nickc@redhat.com>
6688
6689         PR 11899
6690         * layout.cc (segment_precedes): Sort segments by their physical
6691         addresses, if they have been set.
6692
6693 2010-08-23  Cary Coutant  <ccoutant@google.com>
6694
6695         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6696         symbols data.
6697         (Lib_group::include_member): Unlock object after deleting its
6698         symbols data.
6699         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6700         the bug fixed here.
6701
6702 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6703             Cary Coutant  <ccoutant@google.com>
6704
6705         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6706         constructor, and set_blocker.
6707         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6708         readsyms_blocker_.
6709         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6710         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6711         * testsuite/Makefile.am (start_lib_test): New test case.
6712         * testsuite/Makefile.in: Regenerate.
6713         * testsuite/start_lib_test_main.c: New file.
6714         * testsuite/start_lib_test_1.c: New file.
6715         * testsuite/start_lib_test_2.c: New file.
6716         * testsuite/start_lib_test_3.c: New file.
6717
6718 2010-08-19  Ian Lance Taylor  <iant@google.com>
6719
6720         * Makefile.in: Rebuild with automake 1.11.1.
6721         * aclocal.m4: Likewise.
6722         * testsuite/Makefile.in: Likewise.
6723
6724 2010-08-19  Ian Lance Taylor  <iant@google.com>
6725
6726         PR 10893
6727         * i386.cc (class Output_data_plt_i386): Update declarations.
6728         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6729         local_ifuncs_ fields.
6730         (Target_i386::do_plt_section_for_global): New function.
6731         (Target_i386::do_plt_section_for_local): New function.
6732         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6733         parameter; change all callers.  Initialize global_ifuncs_ and
6734         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6735         __rel_iplt_end.
6736         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6737         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6738         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6739         symbols.
6740         (Target_i386::make_plt_section): New function, broken out of
6741         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6742         (Target_i386::make_plt_entry): Call make_plt_section.
6743         (Target_i386::make_local_ifunc_plt_entry): New function.
6744         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6745         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6746         R_386_IRELATIVE to switch.
6747         (Target_i386::Scan::global): Likewise.
6748         (Target_i386::Relocate::relocate): Likewise.
6749         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6750         switch.
6751         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6752         (Target_x86_64::do_plt_section_for_global): New function.
6753         (Target_x86_64::do_plt_section_for_local): New function.
6754         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6755         parameter; change all callers.  If doing a static link define
6756         __rela_iplt_start and __rela_iplt_end.
6757         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6758         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6759         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6760         to point to .plt.
6761         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6762         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6763         switch.
6764         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6765         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6766         R_X86_64_IRELATIVE to switch.
6767         (Target_x86_64::Scan::global): Likewise.
6768         (Target_x86_64::Relocate::relocate): Likewise.
6769         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6770         switch.
6771         * target.h (class Target): Add plt_section_for_global and
6772         plt_section_for_local functions.  Add do_plt_section_for_global
6773         and do_plt_section_for_local virtual functions.
6774         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6775         clarifying comments.
6776         (Symbol::use_plt_offset): Handle IFUNC symbol.
6777         * object.cc (Sized_relobj::Sized_relobj): Initialize
6778         local_plt_offsets_.
6779         (Sized_relobj::local_has_plt_offset): New function.
6780         (Sized_relobj::local_plt_offset): New function.
6781         (Sized_relobj::set_local_plt_offset): New function.
6782         (Sized_relobj::do_count): Handle IFUNC symbol.
6783         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6784         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6785         is_ifunc_symbol functions.
6786         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6787         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6788         local_plt_offsets_ field.
6789         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6790         * output.h (class Output_section_data): Add non-const
6791         output_section function.
6792         (class Output_data_got): Update declarations.
6793         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6794         Add use_plt_offset parameter to global and local constructors.
6795         Change all callers.  Change local_sym_index_ field to 31 bits.
6796         Change GSYM_CODE and CONSTANT_CODE accordingly.
6797         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6798         doing a static link don't set sh_link field.
6799         (Output_data_got::Got_entry::write): Use PLT offset if
6800         appropriate.
6801         (Output_data_got::add_global_plt): New function.
6802         (Output_data_got::add_local_plt): New function.
6803         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6804         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6805         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6806         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6807         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6808         IFUNC conditional.
6809         * testsuite/ifunc-sel.h: New file.
6810         * testsuite/ifuncmain1.c: New file.
6811         * testsuite/ifuncmain1vis.c: New file.
6812         * testsuite/ifuncmod1.c: New file.
6813         * testsuite/ifuncdep2.c: New file.
6814         * testsuite/ifuncmain2.c: New file.
6815         * testsuite/ifuncmain3.c: New file.
6816         * testsuite/ifuncmod3.c: New file.
6817         * testsuite/ifuncmain4.c: New file.
6818         * testsuite/ifuncmain5.c: New file.
6819         * testsuite/ifuncmod5.c: New file.
6820         * testsuite/ifuncmain6pie.c: New file.
6821         * testsuite/ifuncmod6.c: New file.
6822         * testsuite/ifuncmain7.c: New file.
6823         * configure, testsuite/Makefile.in: Rebuild.
6824
6825 2010-08-18  Ian Lance Taylor  <iant@google.com>
6826
6827         * incremental.cc
6828         (Output_section_incremental_inputs::write_input_files): Add cast
6829         to avoid signed/unsigned comparison warning.
6830         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6831
6832 2010-08-12  Cary Coutant  <ccoutant@google.com>
6833
6834         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6835
6836 2010-08-13  Ian Lance Taylor  <iant@google.com>
6837
6838         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6839
6840 2010-08-12  Cary Coutant  <ccoutant@google.com>
6841             Doug Kwan  <dougkwan@google.com>
6842
6843         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6844         defintion overrides non-weak undef, remember that the original undef
6845         is not weak.
6846         * symtab.cc (Symbol_table::sized_write_global): For undef without
6847         an original weak binding, set binding to global in output.
6848         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6849         * testsuite/Makefile.in: Regenerate.
6850         * testsuite/strong_ref_weak_def.sh: New file.
6851         * testsuite/strong_ref_weak_def_1.c: Ditto.
6852         * testsuite/strong_ref_weak_def_2.c: Ditto.
6853
6854 2010-08-12  Cary Coutant  <ccoutant@google.com>
6855
6856         * testsuite/incremental_test.sh: Rewrite.
6857         * testsuite/incremental_test_1.c: Rewrite.
6858         * testsuite/incremental_test_2.c: Rewrite.
6859
6860 2010-08-12  Cary Coutant  <ccoutant@google.com>
6861
6862         * arm.cc (Target_arm::got_size): Add const.
6863         (Target_arm::got_entry_count): New function.
6864         (Target_arm::plt_entry_count): New function.
6865         (Target_arm::first_plt_entry_offset): New function.
6866         (Target_arm::plt_entry_size): New function.
6867         (Output_data_plt_arm::entry_count): New function.
6868         (Output_data_plt_arm::first_plt_entry_offset): New function.
6869         (Output_data_plt_arm::get_plt_entry_size): New function.
6870         * i386.cc (Target_i386::got_size): Add const.
6871         (Target_i386::got_entry_count): New function.
6872         (Target_i386::plt_entry_count): New function.
6873         (Target_i386::first_plt_entry_offset): New function.
6874         (Target_i386::plt_entry_size): New function.
6875         (Output_data_plt_i386::entry_count): New function.
6876         (Output_data_plt_i386::first_plt_entry_offset): New function.
6877         (Output_data_plt_i386::get_plt_entry_size): New function.
6878         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6879         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6880         * incremental.cc: Include target.h.
6881         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6882         parameter.  Adjust all callers.  Find incremental_got_plt section.
6883         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6884         section.
6885         (Output_section_incremental_inputs::set_final_data_size): Calculate
6886         size of incremental_got_plt section.
6887         (Output_section_incremental_inputs::do_write): Write the
6888         incremental_got_plt section.
6889         (Got_plt_view_info): New struct.
6890         (Local_got_offset_visitor): New class.
6891         (Global_got_offset_visitor): New class.
6892         (Global_symbol_visitor_got_plt): New class.
6893         (Output_section_incremental_inputs::write_got_plt): New function.
6894         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6895         Add parameter.  Adjust all callers.
6896         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6897         (Incremental_inputs::got_plt_section): New function.
6898         (Incremental_inputs::got_plt_section_): New data member.
6899         (Incremental_got_plt_reader): New class.
6900         * layout.cc (Layout::create_incremental_info_sections): Add the
6901         incremental_got_plt section.
6902         * object.h (Got_offset_list::get_list): New function.
6903         (Got offset_list::for_all_got_offsets): New function.
6904         (Sized_relobj::local_got_offset_list): New function.
6905         * powerpc.cc (Target_powerpc::got_size): Add const.
6906         (Target_powerpc::got_entry_count): New function.
6907         (Target_powerpc::plt_entry_count): New function.
6908         (Target_powerpc::first_plt_entry_offset): New function.
6909         (Target_powerpc::plt_entry_size): New function.
6910         (Output_data_plt_powerpc::entry_count): New function.
6911         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6912         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6913         * sparc.cc (Target_sparc::got_size): Add const.
6914         (Target_sparc::got_entry_count): New function.
6915         (Target_sparc::plt_entry_count): New function.
6916         (Target_sparc::first_plt_entry_offset): New function.
6917         (Target_sparc::plt_entry_size): New function.
6918         (Output_data_plt_sparc::entry_count): New function.
6919         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6920         (Output_data_plt_sparc::get_plt_entry_size): New function.
6921         * symtab.h (Symbol::got_offset_list): New function.
6922         (Symbol_table::for_all_symbols): New function.
6923         * target.h (Sized_target::got_entry_count): New function.
6924         (Sized_target::plt_entry_count): New function.
6925         (Sized_target::plt_entry_size): New function.
6926         * x86_64.cc (Target_x86_64::got_size): Add const.
6927         (Target_x86_64::got_entry_count): New function.
6928         (Target_x86_64::plt_entry_count): New function.
6929         (Target_x86_64::first_plt_entry_offset): New function.
6930         (Target_x86_64::plt_entry_size): New function.
6931         (Output_data_plt_x86_64::entry_count): New function.
6932         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6933         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6934
6935 2010-08-12  Cary Coutant  <ccoutant@google.com>
6936
6937         * archive.cc: Include incremental.h.
6938         (Archive::Archive): Initialize incremental_info_.
6939         (Archive::include_member): Record archive members in incremental info.
6940         (Add_archive_symbols::run): Record begin and end of an archive in
6941         incremental info.
6942         (Lib_group::include_member): Record objects in incremental info.
6943         * archive.h (Incremental_archive_entry): Forward declaration.
6944         (Archive::set_incremental_info): New member function.
6945         (Archive::incremental_info): New member function.
6946         (Archive::Unused_symbol_iterator): New class.
6947         (Archive::unused_symbols_begin): New member function.
6948         (Archive::unused_symbols_end): New member function.
6949         (Archive::incremental_info_): New data member.
6950         * incremental-dump.cc (find_input_containing_global): New function.
6951         (dump_incremental_inputs): Dump new incremental info sections.
6952         * incremental.cc: Include symtab.h.
6953         (Output_section_incremental_inputs): New class.
6954         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6955         new incremental info sections.
6956         (Sized_incremental_binary::do_check_inputs): Likewise.
6957         (Incremental_inputs::report_archive): Remove.
6958         (Incremental_inputs::report_archive_begin): New function.
6959         (Incremental_inputs::report_archive_end): New function.
6960         (Incremental_inputs::report_object): New function.
6961         (Incremental_inputs::finalize_inputs): Remove.
6962         (Incremental_inputs::report_input_section): New function.
6963         (Incremental_inputs::report_script): Rewrite.
6964         (Incremental_inputs::finalize): Do nothing but finalize string table.
6965         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6966         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6967         (Incremental_inputs::create_data_sections): New function.
6968         (Incremental_inputs::relocs_entsize): New function.
6969         (Output_section_incremental_inputs::set_final_data_size): New function.
6970         (Output_section_incremental_inputs::do_write): New function.
6971         (Output_section_incremental_inputs::write_header): New function.
6972         (Output_section_incremental_inputs::write_input_files): New function.
6973         (Output_section_incremental_inputs::write_info_blocks): New function.
6974         (Output_section_incremental_inputs::write_symtab): New function.
6975         * incremental.h (Incremental_script_entry): Forward declaration.
6976         (Incremental_object_entry): Forward declaration.
6977         (Incremental_archive_entry): Forward declaration.
6978         (Incremental_inputs): Forward declaration.
6979         (Incremental_inputs_header_data): Remove.
6980         (Incremental_inputs_header): Remove.
6981         (Incremental_inputs_header_write): Remove.
6982         (Incremental_inputs_entry_data): Remove.
6983         (Incremental_inputs_entry): Remove.
6984         (Incremental_inputs_entry_write): Remove.
6985         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6986         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6987         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6988         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6989         Likewise.
6990         (Incremental_input_entry): New class.
6991         (Incremental_script_entry): New class.
6992         (Incremental_object_entry): New class.
6993         (Incremental_archive_entry): New class.
6994         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6995         (Incremental_inputs::report_inputs): Remove.
6996         (Incremental_inputs::report_archive): Remove.
6997         (Incremental_inputs::report_archive_begin): New function.
6998         (Incremental_inputs::report_archive_end): New function.
6999         (Incremental_inputs::report_object): Change prototype.
7000         (Incremental_inputs::report_input_section): New function.
7001         (Incremental_inputs::report_script): Change prototype.
7002         (Incremental_inputs::get_reloc_count): New function.
7003         (Incremental_inputs::set_reloc_count): New function.
7004         (Incremental_inputs::create_data_sections): New function.
7005         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7006         (Incremental_inputs::inputs_section): New function.
7007         (Incremental_inputs::symtab_section): New function.
7008         (Incremental_inputs::relocs_section): New function.
7009         (Incremental_inputs::get_stringpool): Add const.
7010         (Incremental_inputs::command_line): Add const.
7011         (Incremental_inputs::inputs): Remove.
7012         (Incremental_inputs::command_line_key): New function.
7013         (Incremental_inputs::input_file_count): New function.
7014         (Incremental_inputs::input_files): New function.
7015         (Incremental_inputs::relocs_entsize): New function.
7016         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7017         (Incremental_inputs::finalize_inputs): Remove.
7018         (Incremental_inputs::Input_info): Remove.
7019         (Incremental_inputs::lock_): Remove.
7020         (Incremental_inputs::inputs_): Change type.
7021         (Incremental_inputs::inputs_map_): Remove.
7022         (Incremental_inputs::current_object_entry_): New data member.
7023         (Incremental_inputs::inputs_section_): New data member.
7024         (Incremental_inputs::symtab_section_): New data member.
7025         (Incremental_inputs::relocs_section_): New data member.
7026         (Incremental_inputs::reloc_count_): New data member.
7027         (Incremental_inputs_reader): New class.
7028         (Incremental_symtab_reader): New class.
7029         (Incremental_relocs_reader): New class.
7030         * layout.cc (Layout::finalize): Move finalization of incremental info
7031         and creation of incremental info sections to follow finalization of
7032         symbol table.  Set offsets for postprocessing sections.
7033         (Layout::create_incremental_info_sections): Call
7034         Incremental_inputs::create_data_sections.  Add incremental symtab
7035         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7036         sections to layout after input sections.
7037         * layout.h (struct Timespec): Forward declaration.
7038         (Layout::incremental_inputs): Add const.
7039         (Layout::create_incremental_info_sections): Add parameter.
7040         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7041         * object.cc: Include incremental.h.
7042         (Relobj::finalize_incremental_relocs): New function.
7043         (Sized_relobj::do_layout): Record input sections in incremental info.
7044         * object.h (Object::output_section): New function.
7045         (Object::output_section_offset): Moved from Relobj.
7046         (Object::get_incremental_reloc_base): New function.
7047         (Object::get_incremental_reloc_count): New function.
7048         (Object::do_output_section): New function.
7049         (Object::do_output_section_offset): Moved from Relobj.
7050         (Object::do_get_incremental_reloc_base): New function.
7051         (Object::do_get_incremental_reloc_count): New function.
7052         (Object::Object): Initialize new data members.
7053         (Relobj::output_section): Renamed do_output_section and moved to
7054         protected.
7055         (Relobj::output_section_offset): Moved to Object.
7056         (Relobj::do_get_incremental_reloc_base): New function.
7057         (Relobj::do_get_incremental_reloc_count): New function.
7058         (Relobj::allocate_incremental_reloc_counts): New function.
7059         (Relobj::count_incremental_reloc): New function.
7060         (Relobj::finalize_incremental_relocs): New function.
7061         (Relobj::next_incremental_reloc_index): New function.
7062         (Relobj::reloc_counts_): New data member.
7063         (Relobj::reloc_bases_): New data member.
7064         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7065         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7066         (Sized_relobj::incremental_relocs_scan): New function.
7067         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7068         (Sized_relobj::incremental_relocs_write): New function.
7069         (Sized_relobj::incremental_relocs_write_reltype): New function.
7070         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7071         incremental link.
7072         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7073         archives and object files elsewhere.
7074         (Add_symbols::run): Report object files here.
7075         (Finish_group::run): Report end of archive at end of group.
7076         * reloc.cc: Include layout.h, incremental.h.
7077         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7078         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7079         (Sized_relobj::incremental_relocs_scan): New function.
7080         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7081         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7082         (Sized_relobj::incremental_relocs_write): New function.
7083         (Sized_relobj::incremental_relocs_write_reltype): New function.
7084         * script.cc (read_input_script): Rewrite test for incremental link.
7085         Change call to Incremental_inputs::report_script.
7086         * symtab.h (Symbol_table::first_global_index): New function.
7087         (Symbol_table::output_count): New function.
7088
7089 2010-08-12  Doug Kwan  <dougkwan@google.com>
7090
7091         * arm.cc (Target_arm::merge_object_attributes): Check command line
7092         options --no-wchar-size-warning and --no-enum-size-warning.
7093         * options.h (General_options): Add ld-compatible options
7094         --no-enum-size-warning and --no-wchar-size-warning.
7095
7096 2010-08-04  Ian Lance Taylor  <iant@google.com>
7097
7098         * x86_64.cc (Target_x86_64::Scan::local): Use
7099         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7100         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7101         (Target_x86_64::Scan::global): Likewise.
7102         (Target_x86_64::Relocate::relocate): Likewise.
7103         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7104         Likewise.
7105
7106 2010-08-03  Cary Coutant  <ccoutant@google.com>
7107
7108         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7109         to reserve space in merged_strings vector. Keep total input size
7110         for stats.
7111         (Output_merge_string::do_print_merge_stats): Print total input size.
7112         * merge.h (Output_merge_string): Add input_size_ field.
7113         * stringpool.cc (Stringpool_template::string_length): Move
7114         implementations out of Stringpool_template class and place in
7115         stringpool.h.
7116         * stringpool.h (string_length): Move out of Stringpool_template.
7117
7118 2010-08-03  Ian Lance Taylor  <iant@google.com>
7119
7120         PR 11712
7121         * layout.cc (relaxation_loop_body): If address of load segment is
7122         set, adjust address to include headers if possible.
7123
7124 2010-08-03  Ian Lance Taylor  <iant@google.com>
7125
7126         * version.cc (version_string): Bump to 1.10.
7127
7128 2010-08-03  Ian Lance Taylor  <iant@google.com>
7129
7130         PR 11805
7131         * layout.h (enum Output_section_order): Define.
7132         (class Layout): Update declarations.
7133         * layout.cc (Layout::get_output_section): Add order parameter.
7134         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7135         is_first_non_relro parameters.  Change all callers.
7136         (Layout::choose_output_section): Likewise.
7137         (Layout::add_output_section_data): Likewise.
7138         (Layout::make_output_section): Likewise.  Set order.
7139         (Layout::default_section_order): New function.
7140         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7141         * output.cc (Output_section::Output_section): Initialize order_.
7142         Don't initialize deleted fields.
7143         (Output_segment::Output_segment): Don't initialize deleted
7144         fields.
7145         (Output_segment::add_output_section_to_load): New function
7146         replacing add_output_section.  Change all callers to call this or
7147         add_output_section_to_nonload.
7148         (Output_segment::add_output_section_to_nonload): New function.
7149         (Output_segment::remove_output_section): Rewrite.
7150         (Output_segment::add_initial_output_data): Likewise.
7151         (Output_segment::has_any_data_sections): Likewise.
7152         (Output_segment::is_first_section_relro): Likewise.
7153         (Output_segment::maximum_alignment): Likewise.
7154         (Output_segment::has_dynamic_reloc): New function replacing
7155         dynamic_reloc_count.  Change all callers.
7156         (Output_segment::has_dynamic_reloc_list): New function replacing
7157         dynamic_reloc_count_list.  Change all callers.
7158         (Output_segment::set_section_addresses): Rewrite.
7159         (Output_segment::set_offset): Rewrite.
7160         (Output_segment::find_first_and_last_list): Remove.
7161         (Output_segment::set_tls_offsets): Rewrite.
7162         (Output_segment::first_section_load_address): Likewise.
7163         (Output_segment::output_section_count): Likewise.
7164         (Output_segment::section_with_lowest_load_address): Likewise.
7165         (Output_segment::write_section_headers): Likewise.
7166         (Output_segment::print_sections_to_map): Likewise.
7167         * output.h (class Output_data): Remove dynamic_reloc_count_
7168         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7169         (Output_data::add_dynamic_reloc): Rewrite.
7170         (Output_data::has_dynamic_reloc): New function.
7171         (Output_data::dynamic_reloc_count): Remove.
7172         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7173         is_last_relro_, is_first_non_relro_, is_interp_,
7174         is_dynamic_linker_section_ fields.  Add order and set_order
7175         functions.  Remove is_relro_local, set_is_relro_local,
7176         is_last_relro, set_is_last_relro, is_first_non_relro,
7177         set_is_first_non_relro functions, is_interp, set_is_interp,
7178         is_dynamic_linker_section, and set_is_dynamic_linker_section
7179         functions.
7180         (class Output_segment): Change Output_data_list from std::list to
7181         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7182         output_bss_ fields.  Update declarations.
7183
7184 2010-08-02  Ian Lance Taylor  <iant@google.com>
7185
7186         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7187         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7188         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7189
7190 2010-08-02  Ian Lance Taylor  <iant@google.com>
7191
7192         PR 11855
7193         * script.cc (Script_options::Script_options): Initialize
7194         symbol_definitions_ and symbol_references_.
7195         (Script_options::add_symbol_assignment): Update
7196         symbol_definitions_ and symbol_references_.
7197         (Script_options::add_symbol_reference): New function.
7198         (script_symbol): New function.
7199         * script.h (class Script_options): Add symbol_definitions_ and
7200         symbol_references_ fields.
7201         (Script_options::referenced_const_iterator): New type.
7202         (Script_options::referenced_begin): New function.
7203         (Script_options::referenced_end): New function.
7204         (Script_options::is_referenced): New function.
7205         (Script_options::any_unreferenced): New function.
7206         * script-c.h (script_symbol): Declare.
7207         * yyscript.y (exp): Call script_symbol.
7208         * symtab.cc: Include "script.h".
7209         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7210         Change all callers.  Check symbols referenced by scripts.
7211         (Symbol_table::add_undefined_symbols_from_command_line): Add
7212         layout parameter.  Change all callers.
7213         (Symbol_table::do_add_undefined_symbols_from_command_line):
7214         Likewise.  Break out loop body.  Check symbols referenced by
7215         scripts.
7216         (Symbol_table::add_undefined_symbol_from_command_line): New
7217         function broken out of
7218         do_add_undefined_symbols_from_command_line.
7219         * symtab.h (class Symbol_table): Update declarations.
7220         * archive.cc: Include "layout.h".
7221         (Archive::should_include_member): Add layout parameter.  Change
7222         all callers.  Check for symbol mentioned in expression.
7223         * archive.h (class Archive): Update declaration.
7224         * object.cc (Sized_relobj::do_should_include_member): Add layout
7225         parameter.
7226         * object.h (Object::should_include_member): Add layout parameter.
7227         Change all callers.
7228         (Object::do_should_include_member): Add layout parameter.
7229         (class Sized_relobj): Update declaration.
7230         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7231         parameter.
7232         * dynobj.h (class Sized_dynobj): Update declaration.
7233         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7234         layout parameter.
7235         * plugin.h (class Sized_pluginobj): Update declaration.
7236
7237 2010-08-02  Ian Lance Taylor  <iant@google.com>
7238
7239         PR 11866
7240         * output.cc (Output_segment::set_offset): Search for the first and
7241         last sections rather than assuming that the list is in order.
7242         (Output_segment::find_first_and_last_list): New function.
7243         * output.h (class Output_segment): Update declarations.
7244         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7245         (relro_strip_test_SOURCES): New variable.
7246         (relro_strip_test_DEPENDENCIES): New variable.
7247         (relro_strip_test_LDFLAGS): New variable.
7248         (relro_strip_test_LDADD): New variable.
7249         (relro_strip_test.so): New target.
7250
7251 2010-08-02  Ian Lance Taylor  <iant@google.com>
7252
7253         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7254         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7255         (Target_i386::got_tlsdesc_section): New function.
7256         (Target_i386::got_section): Create space for GOT entries for
7257         TLSDESC relocations.
7258         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7259         R_386_TLS_GOTDESC.
7260         (Target_i386::Scan::global): Likewise.
7261         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7262         using TLSDESC GOT.
7263         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7264         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7265         (Target_x86_64::got_tlsdesc_section): New function.
7266         (Target_x86_64::got_section): Create space for GOT entries for
7267         TLSDESC relocations.
7268         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7269         R_386_TLS_GOTDESC.
7270         (Target_x86_64::Scan::global): Likewise.
7271         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7272         using TLSDESC GOT.
7273
7274 2010-08-02  Ian Lance Taylor  <iant@google.com>
7275
7276         * testsuite/final_layout.sh: Use dc to convert from hex to
7277         decimal.
7278
7279 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7280
7281         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7282         paramter to the call to gold::gc_process_relocs.
7283         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7284         paramter to the call to gold::gc_process_relocs.
7285         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7286         parameter to the call to gold::gc_process_relocs.
7287         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7288         template parameter to the call to gold::gc_process_relocs.
7289         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7290         paramter to the call to gold::gc_process_relocs.
7291         * gc.h (get_embedded_addend_size): New function.
7292         (gc_process_relocs): Save the size of the reloc for use by ICF.
7293         * icf.cc (get_section_contents): Get the addend from the text section
7294         for SHT_REL relocation sections.
7295         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7296         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7297         * int_encoding.h (read_from_pointer): New overloaded function.
7298         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7299         * testsuite/icf_sht_rel_addend_test.sh: New file.
7300         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7301         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7302
7303 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7304
7305         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7306         * Makefile.in: Regenerate.
7307         * testsuite/Makefile.in: Regenerate.
7308
7309 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7310
7311         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7312         * gold/testsuite/debug_msg.cc: Likewise.
7313         * gold/testsuite/odr_violation1.cc
7314         * gold/testsuite/odr_violation2.cc
7315
7316 2010-07-21  Cary Coutant  <ccoutant@google.com>
7317
7318         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7319         string, and length fields.
7320         (Output_merge_string::Merged_strings_list): New type.
7321         (Output_merge_string::Merged_strings_lists): New typedef.
7322         (Output_merge_string): Replace merged_strings_ with
7323         merged_strings_lists_.
7324         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7325         Merged_strings_list per input object and section.  Don't store pointer
7326         to the string.  Don't store length with each merged string entry.
7327         (Output_merge_string::finalize_merged_data): Loop over list of merged
7328         strings lists.  Recompute length of each merged string.
7329
7330 2010-07-15  Cary Coutant  <ccoutant@google.com>
7331
7332         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7333         here.
7334
7335 2010-07-14  Ian Lance Taylor  <iant@google.com>
7336
7337         * descriptors.cc (Descriptors::open): Report correct name in error
7338         message.
7339
7340 2010-07-13  Doug Kwan  <dougkwan@google.com>
7341
7342         * arm.cc (Arm_input_section::Arm_input_section): For a
7343         SHT_ARM_EXIDX section, always keeps the input sections.
7344         (Arm_input_section::set_exidx_section_link): New method.
7345         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7346         has_errors_ to false.
7347         (Arm_exidx_input_section::has_errors,
7348         Arm_exidx_input_section::set_has_errors): New methods.
7349         (Arm_exidx_input_section::has_errors_): New data member.
7350         (Arm_relobj::get_exidx_shndx_list): New method.
7351         (Arm_output_section::append_text_sections_to_list): Do not skip
7352         section without SHF_EXECINSTR.
7353         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7354         errors.
7355         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7356         section header.  Make error messages more verbose.  Check for
7357         a non-executable section linked to an EXIDX section.
7358         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7359         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7360         check that there is no deferred EXIDX section if we exit early.
7361         Instead of not making an EXIDX section in case of an error, make one
7362         and set the has_errors flag of it.
7363         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7364         in a relocatable link.
7365         (Target_arm::do_relax): Look for the EXIDX output section instead of
7366         assuming that it is called .ARM.exidx.
7367         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7368         section list.  Do not check for SHF_EXECINSTR section flags but
7369         skip any input section with errors.
7370         * output.cc (Output_section::Output_section): Initialize
7371         always_keeps_input_sections_ to false.
7372         (Output_section::add_input_section): Check for
7373         always_keeps_input_sections_.
7374         *  output.h (Output_section::always_keeps_input_sections,
7375         Output_section::set_always_keeps_input_sections): New methods.
7376         (Output_section::always_keeps_input_sections): New data member.
7377
7378 2010-07-13  Rafael Espindola  <espindola@google.com>
7379
7380         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7381         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7382
7383 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7384             Ian Lance Taylor  <iant@google.com>
7385
7386         * output.h (Output_section_lookup_maps::add_merge_section):
7387         Correct check of whether value was inserted.
7388         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7389         (Output_section_lookup_maps::add_relaxed_input_section):
7390         Likewise.
7391         * arm.cc (Target_arm::got_section): Remove used local os.
7392         * i386.cc (Target_i386::got_section): Likewise.
7393         * x86_64.cc (Target_x86_64::got_section): Likewise.
7394         * sparc.cc (Target_sparc::got_section): Likewise.
7395         (Target_sparc::relocate): Remove unused local have_got_offset.
7396         * powerpc.cc (Target_powerpc::relocate): Likewise.
7397
7398 2010-07-13  Ian Lance Taylor  <iant@google.com>
7399
7400         * compressed_output.cc (zlib_decompress): Fix signature in
7401         !HAVE_ZLIB_H case.
7402
7403         * archive.cc (Archive::include_member): Unlock an external member
7404         of a thin archive.  Don't bother to delete an object we know is
7405         NULL.
7406
7407 2010-07-12  Cary Coutant  <ccoutant@google.com>
7408
7409         * compressed_output.cc (zlib_decompress): New function.
7410         (get_uncompressed_size): New function.
7411         (decompress_input_section): New function.
7412         * compressed_output.h (get_uncompressed_size): New function.
7413         (decompress_input_section): New function.
7414         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7415         Handle compressed debug sections.
7416         * layout.cc (is_compressed_debug_section): New function.
7417         (Layout::output_section_name): Map compressed section names to
7418         canonical names.
7419         * layout.h (is_compressed_debug_section): New function.
7420         (is_debug_info_section): Recognize compressed debug sections.
7421         * merge.cc: Include compressed_output.h.
7422         (Output_merge_data::do_add_input_section): Handle compressed
7423         debug sections.
7424         (Output_merge_string::do_add_input_section): Handle compressed
7425         debug sections.
7426         * object.cc: Include compressed_output.h.
7427         (Sized_relobj::Sized_relobj): Initialize new data members.
7428         (build_compressed_section_map): New function.
7429         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7430         * object.h (Object::section_is_compressed): New method.
7431         (Object::do_section_is_compressed): New method.
7432         (Sized_relobj::Compressed_section_map): New type.
7433         (Sized_relobj::do_section_is_compressed): New method.
7434         (Sized_relobj::compressed_sections_): New data member.
7435         * output.cc (Output_section::add_input_section): Handle compressed
7436         debug sections.
7437         * reloc.cc: Include compressed_output.h.
7438         (Sized_relobj::write_sections): Handle compressed debug sections.
7439
7440 2010-07-08  Cary Coutant  <ccoutant@google.com>
7441
7442         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7443         weak when resolving to a dynamic def.
7444         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7445         for weak undef/dynamic def cases. Adjust callers.
7446         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7447         undef_binding_weak_.
7448         (Symbol_table::sized_write_globals): Adjust symbol binding.
7449         (Symbol_table::sized_write_symbol): Add binding parameter.
7450         * symtab.h (Symbol::set_undef_binding): New method.
7451         (Symbol::is_undef_binding_weak): New method.
7452         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7453         (Symbol_table::should_override): Add new parameter.
7454         (Symbol_table::sized_write_symbol): Add new parameter.
7455
7456         * testsuite/weak_undef_file1.cc: Add new test case.
7457         * testsuite/weak_undef_file2.cc: Fix header comment.
7458         * testsuite/weak_undef_test.cc: Add new test case.
7459
7460 2010-06-29  Doug Kwan  <dougkwan@google.com>
7461
7462         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7463         Initialize USE_SYMBOL_.
7464         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7465         definition.
7466         (Arm_reloc_property::uses_symbol_): New data member declaration.
7467         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7468         uses symbol value and symbol is undefined but not weakly undefined.
7469
7470 2010-06-28  Rafael Espindola  <espindola@google.com>
7471
7472         * plugin.cc (Plugin::load): Use dlerror.
7473
7474 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7475
7476         * symtab.cc (detect_odr_violations): When reporting an ODR
7477         violation, report an object where the symbol is defined.
7478
7479 2010-06-25  Doug Kwan  <dougkwan@google.com>
7480
7481         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7482         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7483         definition.
7484         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7485         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7486         target hook to detect function points.
7487         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7488         * icf.h (Icf::check_section_for_function_pointers): Change type of
7489         parameter SECTION_NAME to const reference to std::string.  Use
7490         target hook to determine if section may have unsafe pointers.
7491         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7492         method definition.
7493
7494 2010-06-21  Rafael Espindola  <espindola@google.com>
7495
7496         * fileread.cc (Input_file::find_fie): New
7497         (Input_file::open): Use Input_file::find_fie.
7498         * fileread.h (Input_file::find_fie): New
7499         * plugin.cc (set_extra_library_path): New.
7500         (Plugin::load): Add set_extra_library_path to the transfer vector.
7501         (Plugin_manager::set_extra_library_path): New.
7502         (Plugin_manager::add_input_file): Use the extra search path if set.
7503         (set_extra_library_path(): New.
7504         * plugin.h (Plugin_manager): Add set_extra_library_path and
7505         extra_search_path_.
7506
7507 2010-06-19  Cary Coutant  <ccoutant@google.com>
7508
7509         * layout.cc (gdb_sections): Add .debug_types.
7510         (lines_only_debug_sections): Likewise.
7511
7512 2010-06-18  Rafael Espindola  <espindola@google.com>
7513
7514         * plugin.cc (add_input_file,add_input_library)
7515         (Plugin_manager::add_input_file): Make filename arguments const.
7516         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7517         const.
7518
7519 2010-06-16  Doug Kwan  <dougkwan@google.com>
7520
7521         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7522         .ARM.attributes section if we have not merged any input
7523         attributes sections.
7524
7525 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7526
7527         * arm.cc: Allow combining objects with no EABI version
7528         information.
7529
7530 2010-06-15  Rafael Espindola  <espindola@google.com>
7531
7532         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7533
7534 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7535
7536         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7537         (struct iovec): Correct !HAVE_READV definition.
7538
7539 2010-06-10  Cary Coutant  <ccoutant@google.com>
7540
7541         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7542         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7543         reloc sections.
7544         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7545
7546         PR 11683
7547         * symtab.h (Symbol::is_placeholder): New member function.
7548         * target-reloc.h (relocate_section): Check for placeholder symbols.
7549
7550         * testsuite/Makefile.am (plugin_test_8): New test.
7551         (plugin_test_9): New test.
7552         * testsuite/Makefile.in: Regenerate.
7553
7554 2010-06-09  Nick Clifton  <nickc@redhat.com>
7555
7556         * yyscript.y (input_list_element): Allow strings prefixed with
7557         the '-' character.  Treat these as libraries.
7558         * script.cc (script_add_library): New function.  Adds a library
7559         specified by "-l<name>" found in an input script.
7560         * script-c.h: Add prototype for script_add_library.
7561
7562 2010-06-07  Doug Kwan  <dougkwan@google.com>
7563
7564         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7565         Restrict stub-group size to be within long conditional branch
7566         range when working around cortex-A8 erratum.
7567
7568 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7569
7570         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7571         #ifdef typo.
7572
7573 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7574
7575         PR gold/11658
7576         * output.cc
7577         (Output_section::Input_section_sort_entry::compare_section_ordering):
7578         Change to return non-zero correctly.
7579         (Output_section::Input_section_sort_section_order_index_compare
7580         ::operator()): Change to fix ambiguity in comparisons.
7581
7582 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7583
7584         * gold.h (is_wildcard_string): New function.
7585         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7586         (Layout::layout_eh_frame): Ditto.
7587         (Layout::find_section_order_index): New method.
7588         (Layout::read_layout_from_file): New method.
7589         * layout.h (Layout::find_section_order_index): New method.
7590         (Layout::read_layout_from_file): New method.
7591         (Layout::input_section_position_): New private member.
7592         (Layout::input_section_glob_): New private member.
7593         * main.cc (main): Call read_layout_from_file here.
7594         * options.h (--section-ordering-file): New option.
7595         * output.cc (Output_section::input_section_order_specified_): New
7596         member.
7597         (Output_section::Output_section): Initialize new member.
7598         (Output_section::add_input_section): Add new parameter.
7599         Keep input sections when --section-ordering-file is used.
7600         (Output_section::set_final_data_size): Sort input sections when
7601         section ordering file is specified.
7602         (Output_section::Input_section_sort_entry): Add new parameter.
7603         Check sorting type.
7604         (Output_section::Input_section_sort_entry::compare_section_ordering):
7605         New method.
7606         (Output_section::Input_section_sort_compare::operator()): Change to
7607         consider section_order_index.
7608         (Output_section::Input_section_sort_init_fini_compare::operator()):
7609         Change to consider section_order_index.
7610         (Output_section::Input_section_sort_section_order_index_compare
7611         ::operator()): New method.
7612         (Output_section::sort_attached_input_sections): Change to sort
7613         according to section order when specified.
7614         (Output_section::add_input_section<32, true>): Add new parameter.
7615         (Output_section::add_input_section<64, true>): Add new parameter.
7616         (Output_section::add_input_section<32, false>): Add new parameter.
7617         (Output_section::add_input_section<64, false>): Add new parameter.
7618         * output.h (Output_section::add_input_section): Add new parameter.
7619         (Output_section::input_section_order_specified): New
7620         method.
7621         (Output_section::set_input_section_order_specified): New method.
7622         (Input_section::Input_section): Initialize section_order_index_.
7623         (Input_section::section_order_index): New method.
7624         (Input_section::set_section_order_index): New method.
7625         (Input_section::section_order_index_): New member.
7626         (Input_section::Input_section_sort_section_order_index_compare): New
7627         struct.
7628         (Output_section::input_section_order_specified_): New member.
7629         * script-sections.cc (is_wildcard_string): Delete and move modified
7630         method to gold.h.
7631         (Output_section_element_input::Output_section_element_input): Modify
7632         call to is_wildcard_string.
7633         (Output_section_element_input::Input_section_pattern
7634         ::Input_section_pattern): Ditto.
7635         (Output_section_element_input::Output_section_element_input): Ditto.
7636         * testsuite/Makefile.am (final_layout): New test case.
7637         * testsuite/Makefile.in: Regenerate.
7638         * testsuite/final_layout.cc: New file.
7639         * testsuite/final_layout.sh: New file.
7640
7641 2010-06-01  Rafael Espindola  <espindola@google.com>
7642
7643         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7644
7645 2010-06-01  Rafael Espindola  <espindola@google.com>
7646
7647         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7648         visibility of symbols.
7649
7650 2010-05-27  Doug Kwan  <dougkwan@google.com>
7651
7652         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7653         from start of output section instead of address for a local symbol
7654         in a merged or relaxed section when doing a relocatable link.
7655
7656 2010-05-26  Rafael Espindola  <espindola@google.com>
7657
7658         PR 11604
7659         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7660         adding sections the garbage collector removed.
7661         * gold/testsuite/Makefile.am: Add test.
7662         * gold/testsuite/Makefile.in: Regenerate.
7663         * gold/testsuite/plugin_test_7.sh: New.
7664         * gold/testsuite/plugin_test_7_1.c: New.
7665         * gold/testsuite/plugin_test_7_2.c: New.
7666
7667 2010-05-26  Rafael Espindola  <espindola@google.com>
7668
7669         * script-sections.cc (Output_section_definition::set_section_addresses):
7670         Check for --section-start.
7671
7672 2010-05-26  Doug Kwan  <dougkwan@google.com>
7673
7674         * arm.cc (Arm_scan_relocatable_relocs): New class.
7675         (Target_arm::relocate_special_relocatable): New method.
7676         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7677         (Arm_relocate_functions::thumb_branch_common): Same.
7678         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7679         instead of Default_scan_relocatable_relocs.
7680         * target-reloc.h (relocate_for_relocatable): Let target handle
7681         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7682         * target.h (Sized_target::relocate_special_relocatable): New method.
7683
7684 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7685
7686         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7687
7688 2010-05-23  Doug Kwan  <dougkwan@google.com>
7689
7690         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7691         instead of a cast.
7692         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7693         with a direct branch, not a conditional branch, to a stub.
7694         * merge.cc (Output_merge_base::record_input_section): New method
7695         defintion.
7696         (Output_merge_data::do_add_input_section): Record input section if
7697         keeps-input-sections flag is set.
7698         (Output_merge_string::do_add_input_section): Ditto.
7699         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7700         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7701         INPUT_SECTIONS_.
7702         (Output_merge_base::keeps_input_sections,
7703         Output_merge_base::set_keeps_input_sections,
7704         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7705         method definitions.
7706         (Output_merge_base::Input_sections): New type declaration.
7707         (Output_merge_base::input_sections_begin,
7708         Output_merge_base::input_sections_end,
7709         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7710         (Output_merge_base::bool keeps_input_sections_,
7711         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7712         Output_merge_base::input_sections_): New data members.
7713         (Output_merge_data::do_set_keeps_input_sections): New method
7714         defintion.
7715         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7716         * output.cc (Output_section::Input_section::relobj): Move method
7717         defintion from class declaration to here and handle merge sections.
7718         (Output_section::Input_section::shndx): Ditto.
7719         (Output_section::Output_section): Remove initializations of removed
7720         data members and initialize new data member LOOKUP_MAPS_.
7721         (Output_section::add_input_section): Set keeps-input-sections flag
7722         for a newly created merge output section as appropriate.  Adjust code
7723         to use Output_section_lookup_maps class.
7724         (Output_section::add_relaxed_input_section): Adjst code for lookup
7725         maps code refactoring.
7726         (Output_section::add_merge_input_section): Add a new parameter
7727         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7728         class.  If adding input section to a newly created merge output
7729         section fails, remove the new merge section.
7730         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7731         Adjust code for use of the Output_section_lookup_maps class.
7732         (Output_section::find_merge_section): Ditto.
7733         (Output_section::build_lookup_maps): New method defintion.
7734         (Output_section::find_relaxed_input_section): Adjust code to use
7735         Output_section_lookup_maps class.
7736         (Output_section::get_input_sections): Export merge sections.  Adjust
7737         code to use Output_section_lookup_maps class.
7738         (Output_section:::add_script_input_section): Adjust code to use
7739         Output_section_lookup_maps class.  Update lookup maps for merge
7740         sections also.
7741         (Output_section::discard_states): Use Output_section_lookup_maps.
7742         (Output_section::restore_states): Same.
7743         * output.h (Merge_section_properties): Move class defintion out of
7744         Output_section.
7745         (Output_section_lookup_maps): New class.
7746         (Output_section::Input_section::is_merge_section): New method
7747         defintion.
7748         (Output_section::Input_section::relobj): Move defintion out of class
7749         defintion.  Declare method only.
7750         (Output_section::Input_section::shndx): Ditto.
7751         (Output_section::Input_section::output_merge_base): New method defintion.
7752         (Output_section::Input_section::u2_.pomb): New union field.
7753         (Output_section::Merge_section_by_properties_map,
7754         Output_section::Output_section_data_by_input_section_map,
7755         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7756         Remove types.
7757         (Output_section::add_merge_input_section): Add new parameter
7758         KEEPS_INPUT_SECTIONS.
7759         (Output_section::build_lookup_maps): New method declaration.
7760         (Output_section::merge_section_map_,
7761         Output_section::merge_section_by_properties_map_,
7762         Output_section::relaxed_input_section_map_,
7763         Output_section::is_relaxed_input_section_map_valid_): Remove data
7764         members.
7765         (Output_section::lookup_maps_): New data member.
7766
7767 2010-05-21  Doug Kwan  <dougkwan@google.com>
7768
7769         PR gold/11619
7770         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7771         avoid a compilation error.
7772
7773 2010-05-19  Rafael Espindola  <espindola@google.com>
7774
7775         * script-sections.cc (Output_section_definition::allocate_to_segment):
7776         Update the phdrs_list even when the output section is NULL.
7777         * testsuite/Makefile.am: Add test.
7778         * testsuite/Makefile.in: Regenerate.
7779         * testsuite/script_test_9.cc: New.
7780         * testsuite/script_test_9.sh: New.
7781         * testsuite/script_test_9.t: New.
7782
7783 2010-05-19  Doug Kwan  <dougkwan@google.com>
7784
7785         * arm.cc (Arm_input_section::original_size): New method.
7786         (Arm_input_section::do_addralign): Add a cast.
7787         (Arm_input_section::do_output_offset): Remove static cast.
7788         (Arm_input_section::original_addralign,
7789          Arm_input_section::original_size_): Change type to uint32_t.
7790         (Arm_input_section::init): Add safe casts for section alignment
7791         and size.
7792         (Arm_input_section::set_final_data_size): Do not set address and
7793         offset of stub table.
7794         (Arm_output_section::fix_exidx_coverage): Change use of of
7795         Output_section::Simple_input_section to that of
7796         Output_section::Input_section.
7797         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7798         except for the first pass.
7799         * output.cc (Output_section::get_input_sections): Change type of
7800         input_sections to std::list<Input_section>.
7801         (Output_section::add_script_input_section): Rename from
7802         Output_section::add_simple_input_section.  Change type of SIS
7803         parameter from Simple_input_section to Input_section.
7804         * output.h (Output_section::Simple_input_section): Remove class.
7805         (Output_section::Input_section): Change class visibility to public.
7806         (Output_section::Input_section::addralign): Use stored alignments
7807         for special input sections if set.
7808         (Output_section::Input_section::set_addralign): New method.
7809         (Output_section::get_input_sections): Change parameter type from
7810         list of Simple_input_section to list of Input_section.
7811         (Output_section::add_script_input_section): Rename from
7812         Output_section::add_simple_input_section. Change first parameter's
7813         type from Simple_input_section to Input_section and remove the
7814         second and third parameters.
7815         * script-sections.cc (Input_section::Input_section_list): Change
7816         type to list of Output_section::Input_section/
7817         (Input_section_info::Input_section_info): Change parameter type of
7818         INPUT_SECTION to Output_section::Input_section.
7819         (Input_section_info::input_section): Change return type.
7820         (Input_section_info::input_section_): Change type to
7821         Output_section::Input_section.
7822         (Output_section_element_input::set_section_addresses): Adjust code
7823         to use Output_section::Input_section instead of
7824         Output_section::Simple_input_section.  Adjust code for renaming
7825         of Output_section::add_simple_input_section.
7826         (Orphan_output_section::set_section_addresses): Ditto.
7827
7828 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7829
7830         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7831         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7832
7833 2010-05-18  Rafael Espindola  <espindola@google.com>
7834
7835         * options.cc (General_options::finalize): Handle -nostdlib.
7836         * options.h (nostdlib): New option.
7837         * script.cc (script_add_search_dir): Handle -nostdlib.
7838
7839 2010-05-12  Doug Kwan  <dougkwan@google.com>
7840
7841         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7842         attributes section only if there no attributes section after merging.
7843         (Target_arm::merge_object_attributes): Move value of
7844         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7845         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7846         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7847         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7848         and arm_attr_merge_7.stdout.
7849         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7850         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7851         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7852         arm_attr_merge_7b.o): New rules.
7853         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7854         arm_attr_merge_7
7855         * testsuite/Makefile.in: Regenerate.
7856         * testsuite/arm_attr_merge.sh: New file.
7857         * testsuite/arm_attr_merge_[67][ab].s: Same.
7858
7859 2010-05-05  Nick Clifton  <nickc@redhat.com>
7860
7861         * po/es.po: Updated Spanish translation.
7862
7863 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7864
7865         * Makefile.am (install-exec-local): Properly install gold as
7866         default cross linker.
7867         * Makefile.in: Regenerated.
7868
7869 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7870             Nick Clifton  <nickc@redhat.com>
7871
7872         * configure.ac (install_as_default): Define and set to false
7873         unless --enable-gold or --enable-gold=both/gold has been
7874         specified.
7875         * configure: Regenerate.
7876
7877         * Makefile.am (install-exec-local): Install the executable as
7878         'ld.gold'.  If install_as_default is true then also install it as
7879         'ld'.
7880         * Makefile.in: Regenerated.
7881
7882 2010-04-24  Ian Lance Taylor  <iant@google.com>
7883
7884         * layout.cc (Layout::layout_reloc): In relocatable link don't
7885         combine reloc sections for grouped sections.
7886
7887 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7888
7889         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7890         sections that are not ordinary to icf.
7891         * icf.cc (get_section_contents): Handle relocation pointing to section
7892         with no object or shndx information.
7893         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7894         * testsuite/Makefile.in: Regenerate.
7895         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7896         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7897
7898 2010-04-22  Ian Lance Taylor  <iant@google.com>
7899
7900         * expression.cc (Expression::Expression_eval_info): Add
7901         result_alignment_pointer field.
7902         (Expression::eval_with_dot): Add result_alignment_pointer
7903         parameter.  Change all callers.
7904         (Expression::eval_maybe_dot): Likewise.
7905         (class Binary_expression): Add alignment_pointer parameter to
7906         left_value and right_value.  Change all callers.
7907         (BINARY_EXPRESSION): Set result alignment.
7908         (class Trinary_expression): Add alignment_pointer parameter to
7909         arg2_value and arg3_value.  Change all callers.
7910         (Trinary_cond::value): Set result alignment.
7911         (Max_expression::value, Min_expression::value): Likewise.
7912         (Align_expression::value): Likewise.
7913         * script-sections.cc (class Sections_element): Add dot_alignment
7914         parameter to set_section_addresses virtual function.  Update
7915         instantiations.
7916         (class Output_section_element): Likewise.
7917         (Script_sections::create_segments): Add dot_alignment parameter.
7918         Change all callers.
7919         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7920         (Script_sections::set_phdrs_clause_addresses): Likewise.
7921         * script-sections.h: Update declarations.
7922         * script.h: Update declarations.
7923         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7924         min_p_align.
7925         * testsuite/script_test_3.t: Set large alignment.
7926         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7927         segment has expected alignment.
7928
7929 2010-04-22  Nick Clifton  <nickc@redhat.com>
7930
7931         * po/gold.pot: Updated by the Translation project.
7932         * po/vi.po: Updated Vietnamese translation.
7933
7934 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7935
7936         * testsuite/Makefile.am (check_PROGRAMS): Add
7937         icf_virtual_function_folding_test.
7938         * testsuite/Makefile.in: Regenerated.
7939
7940 2010-04-15  Andrew Haley  <aph@redhat.com>
7941
7942         * options.h (merge_exidx_entries): New option.
7943         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7944         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7945         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7946         (Target_arm::merge_exidx_entries): New function.
7947         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7948         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7949         to Arm_exidx_fixup constructor.
7950         Add new arg, merge_exidx_entries.
7951         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7952         Arm_output_section::fix_exidx_coverage.
7953
7954 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7955
7956         * icf.cc (get_section_contents): Check for preemptible functions.
7957         Ignore addend when appropriate.
7958         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7959         section folded.
7960         (add_from_relobj): Check for section folded.
7961         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7962         * symtab.h (should_add_dynsym_entry): Add new parameter.
7963         * target-reloc.h (scan_relocs): Check for section folded.
7964         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7965         Check reloc types for function pointers in shared objects.
7966         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7967         case.
7968         (icf_preemptible_functions_test): New test case.
7969         (icf_string_merge_test): New test case.
7970         * testsuite.Makefile.in: Regenerate.
7971         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7972         bar_glob.  Refactor code.
7973         * testsuite/icf_preemptible_functions_test.cc: New file.
7974         * testsuite/icf_preemptible_functions_test.sh: New file.
7975         * testsuite/icf_string_merge_test.cc: New file.
7976         * testsuite/icf_string_merge_test.sh: New file.
7977         * testsuite/icf_virtual_function_folding_test.cc: New file.
7978         * testsuite/icf_virtual_function_folding_test.sh: New file.
7979
7980 2010-04-14  Doug Kwan  <dougkwan@google.com>
7981
7982         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7983         for local symbol recounting if we remove a section due to ICF.
7984         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7985         there are no regular objects in input.
7986
7987 2010-04-13  Doug Kwan  <dougkwan@google.com>
7988
7989         * arm.cc (Arm_input_section::set_final_data_size): Compute
7990         accurate final data size instead of using current data size.
7991
7992 2010-04-09  Doug Kwan  <dougkwan@google.com>
7993
7994         * layout.cc (Layout::choose_output_section): Handle script section
7995         types.
7996         (Layout::make_output_section_for_script): Add section type parameter.
7997         Handle script section types.
7998         * layout.h (Layout::make_output_section_for_script): Add section
7999         type parameter.
8000         * output.cc (Output_section::Output_section): Initialize data member
8001         is_noload_.
8002         (Output_section::do_reset_address_and_file_offset): Do not set address
8003         to 0 if section is a NOLOAD section.
8004         * output.h (Output_section::is_noload): New method.
8005         (Output_section::set_is_noload): Ditto.
8006         (Output_section::is_noload_): New data member.
8007         * script-c.h (Script_section_type): New enum type.
8008         (struct Parser_output_section_header): Add new file section_type.
8009         * script-sections.cc (Sections_element::output_section_name): Add
8010         parameter for returning script section type.
8011         (Output_section_definition::output_section_name): Ditto.
8012         (Output_section_definition::section_type)P; New method.
8013         (Output_section_definiton::script_section_type_name): Ditto.
8014         (Output_section_definition::script_section_type_): New data member.
8015         (Output_section_definition::Output_section_definition): Initialize
8016         data member Output_section_definition::script_section_type_.
8017         (Output_section_definition::create_sections): Pass script section type
8018         to Layout::make_output_section_for_script.
8019         (Output_section_definition::output_section_name): Return script
8020         section type to caller.
8021         (Output_section_definition::set_section_address): Do not advance
8022         dot value and load address if section type is NOLOAD.  Set address
8023         of NOLOAD sections regardless of section flags.
8024         (Output_section_definition::print): Print section type if it is
8025         not SCRIPT_SECTION_TYPE_NONE.
8026         (Output_section_definition::section_type): New method.
8027         (Output_section_definition::script_section_type_name): Ditto.
8028         (Script_sections::output_section_name): Add new parameter
8029         PSECTION_TYPE for returning script section type.  Pass it to
8030         section elements.  Handle discard sections.
8031         (Sort_output_sections::operator()): Handle NOLOAD sections.
8032         * script-sections.h (Script_sections::Section_type): New enum type.
8033         (Script_sections::output_section_name): Add a new parameter for
8034         returning script section type.
8035         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8036         INFO and NOLOAD.
8037         * yyscript.y (union): Add new field SECTION_TYPE.
8038         (COPY, DSECT, INFO, NOLOAD): New tokens.
8039         (opt_address_and_section_type): Change type to output_section_header.
8040         (section_type): New non-terminal
8041         (section_header): Handle section type.
8042         (opt_address_and_section_type): Return section type value.
8043
8044 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8045
8046         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8047         * testsuite/plugin_common_test_2.c (foo): Likewise.
8048
8049 2010-04-08  Doug Kwan  <dougkwan@google.com>
8050
8051         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8052         Output_merge_data.
8053         * output.cc (Output_section::add_merge_input_section): Simplify
8054         code and return status of Output_merge_base::add_input_section.
8055         Update merge section map only if Output_merge_base::add_input_section
8056         returns true.
8057
8058 2010-04-07  Doug Kwan  <dougkwan@google.com>
8059
8060         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8061         if section is marked as containing instructions but has no mapping
8062         symbols.
8063         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8064         correct section index.
8065         (Arm_relobj::find_linked_text_section): Ditto.
8066
8067 2010-04-07  Cary Coutant  <ccoutant@google.com>
8068
8069         * archive.cc (include_member): Destroy Read_symbols_data object before
8070         releasing file.
8071         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8072         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8073         (Read_symbols_data::~Read_symbols_data) New destructor.
8074         (Section_relocs::Section_relocs) New constructor.
8075         (Section_relocs::~Section_relocs) New destructor.
8076         (Read_relocs_data::Read_relocs_data) New constructor.
8077         (Read_relocs_data::~Read_relocs_data) New destructor.
8078         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8079         pointers to NULL after deleting.
8080
8081 2010-04-07  Doug Kwan  <dougkwan@google.com>
8082
8083         * arm.cc: Replace "endianity" with "endianness" in comments.
8084         (Arm_exidx_cantunwind): Ditto.
8085         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8086         (Arm_relobj::merge_flags_and_attributes): New method.
8087         (Arm_relobj::merge_flags_and_attributes_): New data member.
8088         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8089         (Arm_relobj::scan_sections_for_stubs): Ditto.
8090         (Arm_relobj::do_read_symbols): Check to see if we really want to
8091         merge processor-specific flags and attributes.  Exit early if
8092         an object is empty except for section names and the undefined symbol.
8093         (Target_arm::do_finalize_sections): Move check for ELF format to
8094         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8095         attributes from a regular object only when we have determined that
8096         it is aapropriate.  Do not create an .ARM.attributes section in
8097         output if there is no regular input object.
8098         (Target_arm::merge_processor_specific_flags): Check
8099         --warn-mismatch before printing any error.
8100         (Target_arm::merge_object_attributes): Ditto.
8101         * gold.cc (queue_middle_tasks): Handle the case in which there is
8102         no regular object in input.
8103         * options.cc (General_options::parse_EB): New method.
8104         (General_options::parse_EL): Same.
8105         (General_options::General_options): Initialize endianness_.
8106         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8107         New options.
8108         (General_options::Endianness): New enum.
8109         (General_options::endianness): New method.
8110         (General_options::endianness_): New data member.
8111         * parameters.cc (Parameters::set_options): Check target endianness.
8112         (Parameters::set_target_once): Ditto.
8113         (Parameters::check_target_endianness): New method.
8114         (parameters_force_valid_target): If either -EL or -EB is specified,
8115         use it to define endianness of default target.
8116         * parameters.h (Parameters::check_target_endianness): New method
8117         declaration.
8118         * target.h (class Target): Change "endianity" to "endianness"
8119         in comments.
8120
8121 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8122
8123         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8124         * configure: Regenerate.
8125         * Makefile.in: Regenerate.
8126         * testsuite/Makefile.in: Regenerate.
8127
8128 2010-04-06  Cary Coutant  <ccoutant@google.com>
8129
8130         gcc PR lto/42757
8131         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8132         prevailing definitions of common symbols.
8133         * testsuite/plugin_test_6.sh: New test case.
8134         * testsuite/plugin_common_test_1.c: New test case.
8135         * testsuite/plugin_common_test_2.c: New test case.
8136         * testsuite/Makefile.am (plugin_test_6): New test case.
8137         * testsuite/Makefile.in: Regenerate.
8138
8139 2010-04-06  Nick Clifton  <nickc@redhat.com>
8140
8141         * po/vi.po: New Vietnamese translation.
8142
8143 2010-03-30  Doug Kwan  <dougkwan@google.com>
8144
8145         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8146
8147 2010-03-25  Doug Kwan  <dougkwan@google.com>
8148
8149         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8150         to avoid a conversion warning on a 32-bit host.
8151
8152 2010-03-24  Ian Lance Taylor  <iant@google.com>
8153
8154         * testsuite/script_test_3.t: Add a TLS segment.
8155         * testsuite/Makefile.am (check_PROGRAMS): Add
8156         tls_phdrs_script_test.
8157         (tls_phdrs_script_test_SOURCES): Define.
8158         (tls_phdrs_script_test_DEPENDENCIES): Define.
8159         (tls_phdrs_script_test_LDFLAGS): Define.
8160         (tls_phdrs_script_test_LDADD): Define.
8161         * testsuite/Makefile.in: Rebuild.
8162
8163 2010-03-23  Cary Coutant  <ccoutant@google.com>
8164
8165         * fileread.cc (find_or_make_view): Fix comment.
8166
8167 2010-03-23  Ian Lance Taylor  <iant@google.com>
8168
8169         * script-sections.cc (class Orphan_section_placement): Define
8170         PLACE_TLS and PLACE_TLS_BSS.
8171         (Orphan_section_placement::Orphan_section_placement): Initialize
8172         new places.
8173         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8174         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8175         (tls_script_test_SOURCES): Define.
8176         (tls_script_test_DEPENDENCIES): Define.
8177         (tls_script_test_LDFLAGS): Define.
8178         (tls_script_test_LDADD): Define.
8179         * testsuite/Makefile.in: Rebuild.
8180
8181 2010-03-22  Doug Kwan  <dougkwan@google.com>
8182
8183         * arm.cc (Arm_relocate_functions::abs8,
8184         Arm_relocate_functions::abs16): Use correct check for overflow
8185         specified in the ARM ELF specs.
8186         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8187         target of a BLX instruction specially.
8188         (Reloc_stub::stub_type_for_reloc): Ditto.
8189         (Relocate::relocate): Use symbolic names instead of numeric relocation
8190         codes to report error.
8191         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8192         workaround.
8193         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8194         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8195         thumb2_blx_out_of_range.stdout
8196         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8197         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8198         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8199         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8200         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8201         thumb2_blx_in_range, thumb2_blx_in_range.o,
8202         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8203         thumb2_blx_out_of_range.o): New rules.
8204         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8205         thumb2_blx_in_range and thumb2_blx_out_of_range.
8206         * testsuite/Makefile.in: Regenerate.
8207         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8208         * testsuite/thumb_blx_in_range.s: New file.
8209         * testsuite/thumb_blx_out_of_range.s: New file.
8210
8211 2010-03-22  Rafael Espindola  <espindola@google.com>
8212
8213         * archive.cc (Should_include): Move to archive.h.
8214         (should_include_member): Make it a member of Archive.
8215         (Lib_group): New.
8216         (Add_lib_group_symbols): New.
8217         * archive.h: Include options.h.
8218         (Archive_member): Moved from Archive.
8219         (Should_include): Moved from archive.cc.
8220         (Lib_group): New.
8221         (Add_lib_group_symbols): New.
8222         * dynobj.cc (do_should_include_member): New.
8223         * dynobj.h (do_should_include_member): New.
8224         * gold.cc (queue_initial_tasks): Update call to queue.
8225         * main.cc (main): Print lib group stats.
8226         * object.cc (do_should_include_member): New.
8227         * object.h: Include archive.h.
8228         (Object::should_include_member): New.
8229         (Object::do_should_include_member): New.
8230         (Sized_relobj::do_should_include_member): New.
8231         * options.cc (General_options::parse_start_lib): New.
8232         (General_options::parse_end_lib): New.
8233         (Input_arguments::add_file): Handle lib groups.
8234         (Input_arguments::start_group): Check we are not in a lib.
8235         (Input_arguments::start_lib): New.
8236         (Input_arguments::end_lib): New.
8237         * options.h (General_options): Add start_lib and end_lib.
8238         (Input_argument::lib_): New.
8239         (Input_argument::lib): New.
8240         (Input_argument::is_lib): New.
8241         (Input_file_lib): New.
8242         (Input_arguments::in_lib_): New.
8243         (Input_arguments::in_lib): New.
8244         (Input_arguments::start_lib): New.
8245         (Input_arguments::end_lib_): New.
8246         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8247         in unused members as preempted.
8248         (Sized_pluginobj::do_should_include_member): New.
8249         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8250         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8251         return the blocker.
8252         (Read_symbols::do_whole_lib_group): New.
8253         (Read_symbols::do_lib_group): New.
8254         (Read_symbols::do_read_symbols): Handle lib groups.
8255         (Read_symbols::get_name): Handle lib groups.
8256         * readsyms.h (Read_symbols): Add an archive member pointer.
8257         (Read_symbols::do_whole_lib_group): New.
8258         (Read_symbols::do_lib_group): New.
8259         (Read_symbols::member_): New.
8260         * script.cc (read_input_script): Update call to queue_soon.
8261
8262 2010-03-19  Doug Kwan  <dougkwan@google.com>
8263
8264         * arm.cc (Stub_table::Stub_table): Initialize new data members
8265         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8266         (Stub_table::add_reloc_stub): Assign stub offset and update
8267         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8268         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8269         New data members.
8270         (Stub_table::update_data_size_and_addralign): Use
8271         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8272         instead of going over all reloc stubs.
8273         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8274         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8275         Stringpool_template::offset_ to size of Stringpool_char.
8276         (Stringpool_template::new_key_offset): Remove code to initialize
8277         Stringpool_template::offset_.
8278         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8279         Stringpool_template::offset_ to zero.
8280
8281 2010-03-15  Doug Kwan  <dougkwan@google.com>
8282
8283         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8284         offset_.
8285         (Stringpool_template::new_key_offset): New method.
8286         (Stringpool_template::add_string): Assign offsets when adding new
8287         strings.
8288         (Stringpool_template::set_string_offsets): Do not set string offsets
8289         when not optimizing.
8290         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8291         member size_.
8292         (Chunked_vector::clear): Clear size_.
8293         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8294         (Chunked_vector::size): Return size_.
8295         (Chunked_vector::push_back): Use size_ to find insert position.
8296         (Chunked_vector::size_): New data member.
8297         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8298         (Stringpool_template::new_key_offset): New method declaration.
8299         (Stringpool_template::offset_): New data member.
8300
8301 2010-03-15   Rafael Espindola  <espindola@google.com>
8302
8303         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8304         Add_symbols' constructor.
8305         * readsyms.h (Add_symbols): Remove the input_group member.
8306
8307 2010-03-10  Ian Lance Taylor  <iant@google.com>
8308
8309         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8310         target to ask whether a reference to a symbol requires a stack
8311         split.
8312         * target.h (Target::is_call_to_non_split): New function.
8313         (Target::do_is_call_to_non_split): Declare virtual function.
8314         * target.cc: Include "symtab.h".
8315         (Target::do_is_call_to_non_split): New function.
8316         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8317
8318 2010-03-10  Cary Coutant  <ccoutant@google.com>
8319
8320         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8321         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8322         (File_read::open[2]): Add whole_file_view_ to list of views.
8323         (File_read::make_view): Remove test of whole_file_view_.
8324         (File_read::find_or_make_view): Create whole_file_view_ if
8325         necessary.
8326         (File_read::clear_views): Replace bool parameter with enum;
8327         adjust all callers.  Don't delete views with permanent data;
8328         do delete cached views and views from archives if
8329         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8330         if clearing the corresponding view.
8331         * fileread.h (File_read::Clear_views_mode): New enum.
8332         (File_read::View::is_permanent_view): New method.
8333         (File_read::clear_views): Replace bool parameter
8334         with enum; adjust all callers.
8335         * options.h (General_options): Change keep_files_mapped option;
8336         add map_whole_files.
8337         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8338         releasing the file.
8339         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8340         the file.
8341
8342 2010-03-10  David S. Miller  <davem@davemloft.net>
8343
8344         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8345
8346 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8347
8348         * icf.cc (get_section_contents): Add '@' marker after processing the
8349         merge reloc.
8350
8351 2010-03-08  Doug Kwan  <dougkwan@google.com>
8352
8353         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8354         due to a conversion warning.
8355         (Arm_relobj::update_output_local_symbol_count): Check for local
8356         symbol with unset output index.
8357
8358 2010-03-05  Ian Lance Taylor  <iant@google.com>
8359
8360         * options.h (class General_options): Add --spare-dynamic-tags.
8361         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8362         --spare-dynamic-tags.
8363
8364 2010-03-05  Ian Lance Taylor  <iant@google.com>
8365
8366         * incremental.cc: Include "libiberty.h".
8367
8368 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8369
8370         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8371         function, is_info_ member.
8372         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8373         (Versions::Versions): Update caller.
8374         (Versions::define_base_version): Likewise.
8375         (Versions::add_def): Likewise.
8376
8377 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8378
8379         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8380         (Scan::possible_function_pointer_reloc): New function.
8381         (Scan::local_reloc_may_be_function_pointer): Change to call
8382         possible_function_pointer_reloc.
8383         (Scan::global_reloc_may_be_function_pointer): Ditto.
8384         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8385         relocations in ".data.rel.ro._ZTV" section.
8386         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8387         * testsuite/icf_safe_so_test.cc: Ditto.
8388         * testsuite/icf_safe_test.cc: Ditto.
8389         * testsuite/icf_safe_test.sh: Ditto.
8390
8391 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8392             Ian Lance Taylor  <iant@google.com>
8393
8394         * target-reloc.h (relocate_section): Check the symbol table index
8395         for -1U before setting the local symbol index.
8396         (scan_relocatable_relocs): If copying the relocation, record that
8397         the local symbol is required.
8398         * object.h (Symbol_value::is_output_symtab_index_set): New
8399         function.
8400         (Symbol_value::may_be_discarded_from_output_symtab): New
8401         function.
8402         (Symbol_value::has_output_symtab_entry): New function.
8403         (Symbol_value::needs_output_symtab_entry): Remove.
8404         (Symbol_value::output_symtab_index): Make sure the symbol index is
8405         set.
8406         (Symbol_value::set_output_symtab_index): Make sure the symbol
8407         index is not set.  Make sure the new index is valid.
8408         (Symbol_value::set_must_have_output_symtab_entry): New function.
8409         (Symbol_value::has_output_dynsym_entry): New function.
8410         (Symbol_value::set_output_dynsym_index): Make sure the new index
8411         is valid.
8412         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8413         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8414         local symbol if permitted.
8415         (Sized_relobj::do_finalize_local_symbols): Call
8416         is_output_symtab_index_set rather than needs_output_symtab_entry.
8417         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8418         rather than needs_output_symtab_entry.  Call
8419         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8420         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8421         is_output_symtab_index_set rather than needs_output_symtab_entry.
8422         * testsuite/discard_locals_relocatable_test.c: New file.
8423         * testsuite/discard_locals_test.sh: Test -r.
8424         * testsuite/Makefile.am (check_DATA): Add
8425         discard_locals_relocatable_test1.syms,
8426         discard_local_relocatable_test2.syms.
8427         (MOSTLYCLEANFILES): Likewise.  Also add
8428         discard_locals_relocatable_test1.lout and
8429         discard_locals_relocatable_test2.out.
8430         (discard_locals_relocatable_test1.syms): New target.
8431         (discard_locals_relocatable_test.o): New target.
8432         (discard_locals_relocatable_test1.out): New target.
8433         (discard_locals_relocatable_test2.syms): New target.
8434         (discard_locals_relocatable_test2.out): New target.
8435         (various): Add missing ../ld-new dependencies.
8436         * testsuite/Makefile.in: Rebuild.
8437
8438 2010-03-03  Nick Clifton  <nickc@redhat.com>
8439
8440         * po/fi.po: New Finnish translation.
8441
8442 2010-03-01  Doug Kwan  <dougkwan@google.com>
8443
8444         * layout.cc (Layout::Layout): Force section types of .init_array*,
8445         .preinit_array* and .fini_array* sections.
8446         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8447         Fix check of return value of std::string::find.().
8448         (Output_section::Input_section_sort_compare::operator()): Remove
8449         comment about .init_array.
8450         (Output_section::Input_section_sort_init_fini_compare::operator()):
8451         New method.
8452         (Output_section::sort_attached_input_sections): Handle .init_array
8453         and .fini_array specially.
8454         * output.h (Output_section::Inut_section_sort_compare): Update
8455         comment.
8456         (Output_section::Input_section_sort_init_fini_compare): New struct.
8457
8458 2010-02-26  Doug Kwan  <dougkwan@google.com>
8459
8460         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8461         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8462         * testsuite/debug_msg.sh: Avoid matching source line number for
8463         use of global variable undef_int.
8464
8465 2010-02-26  Doug Kwan  <dougkwan@google.com>
8466
8467         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8468         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8469         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8470         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8471         * options.cc (General_options::General_options): Initialize member
8472         fix_v4bx_.
8473         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8474         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8475         and rm_no_fix_v4bx.stdout
8476         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8477         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8478         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8479         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8480         and arm_no_fix_v4bx.
8481         * Makefile.in: Regenerate.
8482         * testsuite/arm_fix_v4bx.s: New file.
8483         * testsuite/arm_fix_v4bx.sh: Ditto.
8484
8485 2010-02-24  Doug Kwan  <dougkwan@google.com>
8486
8487         * arm.cc (Target_arm::got_section): Make the .got section the first
8488         non RELRO section in the data segment.
8489         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8490         suffixes of section names.
8491
8492 2010-02-24  Doug Kwan  <dougkwan@google.com>
8493
8494         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8495         flags and attributes merging if an input file is a binary file.
8496         * fileread.cc (Input_file::open): Record format of original file.
8497         * fileread.h (Input_file::Format): New enum type.
8498         (Input_file::Input_file): Initialize data member format_.
8499         (Input_file::format): New method definition.
8500         (Input_file::format_):: New data member.
8501
8502 2010-02-24  Doug Kwan  <dougkwan@google.com>
8503
8504         * arm.cc (Arm_output_data_got): New class.
8505         (ARM_TCB_SIZE): New constant
8506         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8507         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8508         If user uses a script with a SECTIONS clause, issue only a warning
8509         for a misplaced EXIDX input section.  Otherwise, issue an error.
8510         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8511         garbage collection.
8512         (Target_arm::got_mode_index_entry): Handle static linking.
8513         (Target_arm::Scan::local): Ditto.
8514         (Target_arm::Scan::global): Ditto.
8515         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8516         all incorrectly implemented relocations.
8517         (Target_arm::fix_exidx_coverage): Pass layout to
8518         Arm_output_section::fix_exidx_coverage.
8519         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8520         from ".ARM.exidx." and ".ARM.extab.".
8521
8522 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8523
8524         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8525         section if it does not already exist.
8526         * attributes.cc (Attributes_section_data::Attributes_section_data):
8527         Don't crash if size is zero.
8528
8529 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8530             Ian Lance Taylor  <iant@google.com>
8531
8532         * gold.cc (queue_middle_tasks): If no input files were opened,
8533         exit.
8534         * workqueue.h (Task_function::Task_function): Assert that there is
8535         a blocker.
8536
8537 2010-02-22  Doug Kwan  <dougkwan@google.com>
8538
8539         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8540         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8541         types to avoid warnings due to different uint64_t implementations
8542         on different hosts.
8543
8544 2010-02-21  Doug Kwan  <dougkwan@google.com>
8545
8546         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8547         handling of the maximum backward branch offset.
8548         (Arm_relocate_functions::thumb_branch_common): Ditto.
8549         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8550         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8551         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8552         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8553         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8554         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8555         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8556         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8557         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8558         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8559         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8560         thumb2_bl_out_of_range.o): New rules.
8561         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8562         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8563         thumb2_bl_out_of_range
8564         * testsuite/Makefile.in: Regenerate.
8565         * testsuite/arm_bl_in_range.s: New file.
8566         * testsuite/arm_bl_out_of_range.s: Ditto.
8567         * testsuite/arm_branch_in_range.sh: Ditto.
8568         * testsuite/arm_branch_range.t: Ditto.
8569         * testsuite/thumb2_branch_range.t: Ditto.
8570         * testsuite/thumb_bl_in_range.s: Ditto.
8571         * testsuite/thumb_bl_out_of_range.s: Ditto.
8572         * testsuite/thumb_branch_range.t: Ditto.
8573
8574 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8575
8576         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8577         Add reloc offset information.
8578         * icf.cc (get_section_contents): Change iterators to point to the new
8579         vectors. Add reloc offset information to the contents.
8580         * icf.h (Icf::Sections_reachable_info): New typedef.
8581         (Icf::Sections_reachable_list): New typedef.
8582         (Icf::Offset_info): New typedef.
8583         (Icf::Reloc_info): New struct typedef.
8584         (Icf::Reloc_info_list): New typedef.
8585         (Icf::symbol_reloc_list): Delete method.
8586         (Icf::addend_reloc_list): Delete method.
8587         (Icf::section_reloc_list): Delete method.
8588         (Icf::reloc_info_list): New method.
8589         (Icf::reloc_info_list_): New member.
8590
8591 2010-02-19  Doug Kwan  <dougkwan@google.com>
8592
8593         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8594         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8595         * arm.cc (Arm_relocation_functions): New forward declaration.
8596         (Target_arm::Target_arm): Initialize new data members
8597         got_mod_index_offset_ and tls_base_symbol_defined_.
8598         (Target_arm::Relocate::relocate_tls): New method.
8599         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8600          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8601         New methods.
8602         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8603         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8604         (Target_arm::got_mod_index_offset_,
8605         Target_arm::tls_base_symbol_defined_): New data members.
8606         (Target_arm::Scan::local, Target::Scan::global,
8607         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8608         relocations.
8609
8610 2010-02-18  Doug Kwan  <dougkwan@google.com>
8611
8612         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8613         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8614         text section as a parameter becuase some broken tools may not set
8615         the link in section header.
8616         (Target_arm::has_got_section): New method.
8617         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8618         without any mapping symbol as data only.  Remove warning.
8619         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8620         link in its section header, try to discover the link by inspecting the
8621         REL31 relocation at the beginning of the section.
8622         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8623         in error message.
8624         (Target_arm::Scan::global): Treat any reference to the symbol
8625         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8626
8627 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8628
8629         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8630         (Scan::global_reloc_may_be_function_pointer): New function.
8631         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8632         (Scan::global_reloc_may_be_function_pointer): New function.
8633         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8634         (Scan::global_reloc_may_be_function_pointer): New function.
8635         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8636         (Scan::global_reloc_may_be_function_pointer): New function.
8637         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8638         (Scan::global_reloc_may_be_function_pointer): New function.
8639         (Scan::possible_function_pointer_reloc): New function.
8640         (Target_x86_64::can_check_for_function_pointers): New function.
8641         * gc.h (gc_process_relocs): Scan relocation types to determine if
8642         function pointers were taken for targets that support it.
8643         * icf.cc (Icf::find_identical_sections): Include functions for
8644         folding in safe ICF whose pointer is not taken.
8645         * icf.h (Secn_fptr_taken_set): New typedef.
8646         (fptr_section_id_): New member.
8647         (section_has_function_pointers): New function.
8648         (set_section_has_function_pointers): New function.
8649         (check_section_for_function_pointers): New function.
8650         * options.h: Fix comment for safe ICF option.
8651         * target.h (can_check_for_function_pointers): New function.
8652         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8653         Modify icf_safe_test for X86-64.
8654         * testsuite/Makefile.in: Regenerate.
8655         * testsuite/icf_safe_so_test.cc: New file.
8656         * testsuite/icf_safe_so_test.sh: New file.
8657         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8658         (main): Change to take pointer to function kept_func_3.
8659         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8660         folding is done correctly for X86-64.
8661
8662 2010-02-12  David S. Miller  <davem@davemloft.net>
8663
8664         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8665         is_symbolless parameter.
8666         (Output_reloc<SHT_REL>::is_symbolless): New.
8667         (Output_reloc<SHT_REL>::is_symbolless_): New.
8668         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8669         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8670         (Output_reloc<SHT_RELA>::is_symbolless): New.
8671         (Output_data_reloc::add_global): Handle is_symbolless.
8672         (Output_data_reloc::add_global_relative): Likewise.
8673         (Output_data_reloc::add_local): Likewise.
8674         (Output_data_reloc::add_local_relative): Likewise.
8675         (Output_data_reloc::add_symbolless_global_addend): New.
8676         (Output_data_reloc::add_symbolless_local_addend): New.
8677         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8678         is_symbolless.
8679         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8680         instead of ->is_relative_
8681         (Output_reloc::write): Likewise.
8682         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8683         (Output_reloc::write_rel): Simplify.
8684
8685         * sparc.cc (Target_sparc::Scan::local): Use
8686         ->add_symbolless_local_addend as needed.
8687         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8688         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8689         based upon relocation offset.
8690
8691 2010-02-11  Doug Kwan  <dougkwan@google.com>
8692
8693         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8694         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8695         beginning of function.
8696         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8697         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8698         parameter is_32bit in calls to should_apply_static_reloc.
8699         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8700         (check_DATA): Add arm_abs_global.stdout.
8701         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8702         arm_abs_global.stdout): New rules.
8703         (MOSTLLYCLEANFILES): Add arm_abs_global
8704         * Makefile.in: Regenerate.
8705         * testsuite/arm_abs_global.s: New file.
8706         * testsuite/arm_abs_global.sh: Ditto.
8707         * testsuite/arm_abs_lib.s: Ditto.
8708
8709 2010-02-11  Ian Lance Taylor  <iant@google.com>
8710
8711         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8712         Read_relocs task.
8713         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8714         Allocate_commons_task first.
8715         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8716         task, rather than symtab_lock_.
8717         (Gc_process_relocs::~Gc_process_relocs): New function.
8718         (Gc_process_relocs::is_runnable): Check this_blocker_.
8719         (Gc_process_relocs::locks): Use next_blocker_ rather than
8720         blocker_.
8721         (Scan_relocs::~Scan_relocs): New function.
8722         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8723         symtab_lock_.
8724         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8725         next_blocker_.
8726         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8727         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8728         constructor accordingly.
8729         (class Gc_process_relocs): Likewise.
8730         (class Scan_relocs): Likewise.
8731         * common.h (class Allocate_commons_task): Remove symtab_lock_
8732         field, and corresponding constructor parameter.
8733         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8734         symtab_lock_.
8735         (Allocate_commons_task::locks): Likewise.
8736
8737 2010-02-11  Ian Lance Taylor  <iant@google.com>
8738
8739         * gold-threads.h (class Once): Define.
8740         (class Initialize_lock): Rewrite as child of Once.
8741         * gold-threads.cc (class Once_initialize): Define.
8742         (once_pointer_control): New static variable.
8743         (once_pointer, once_arg): New static variables.
8744         (c_run_once): New static function.
8745         (Once::Once, Once::run_once, Once::internal_run): New functions.
8746         (class Initialize_lock_once): Remove.
8747         (initialize_lock_control): Remove.
8748         (initialize_lock_pointer): Remove.
8749         (initialize_lock_once): Remove.
8750         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8751         (Initialize_lock::initialize): Rewrite.
8752         (Initialize_lock::do_run_once): New function.
8753         * archive.cc (Archive::interpret_header): Only clear name if it is
8754         not already empty.
8755         * fileread.cc: Include "gold-threads.h"
8756         (file_counts_lock): New static variable.
8757         (file_counts_initialize_lock): Likewise.
8758         (File_read::release): Only increment counts when using --stats.
8759         Use a lock around the increment.
8760         * parameters.cc (class Set_parameters_target_once): Define.
8761         (set_parameters_target_once): New static variable.
8762         (Parameters::Parameters): Move here from parameters.h.
8763         (Parameters::set_target): Rewrite.
8764         (Parameters::set_target_once): New function.
8765         (Parameters::clear_target): Move here and rewrite.
8766         * parameters.h (class Parameters): Update declarations.  Add
8767         set_parameters_target_once_ field.
8768         (Parameters::Parameters): Move to parameters.cc.
8769         (Parameters::clear_target): Likewise.
8770         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8771         task.
8772         (Start_group::~Start_group): New function.
8773         (Start_group::is_runnable): New function.
8774         (Start_group::locks, Start_group::run): New functions.
8775         (Finish_group::run): Change saw_undefined to size_t.
8776         * readsyms.h (class Start_group): Define.
8777         (class Finish_group): Change saw_undefined_ field to size_t.
8778         (Finish_group::Finish_group): Remove saw_undefined and
8779         this_blocker parameters.  Change all callers.
8780         (Finish_group::set_saw_undefined): New function.
8781         (Finish_group::set_blocker): New function.
8782         * symtab.h (class Symbol_table): Change saw_undefined to return
8783         size_t.  Change saw_undefined_ field to size_t.
8784         * target-select.cc (Set_target_once::do_run_once): New function.
8785         (Target_selector::Target_selector): Initialize set_target_once_
8786         field.  Don't initialize lock_ and initialize_lock_ fields.
8787         (Target_selector::instantiate_target): Rewrite.
8788         (Target_selector::set_target): New function.
8789         * target-select.h (class Set_target_once): Define.
8790         (class Target_selector): Update declarations.  Make
8791         Set_target_once a friend.  Remove lock_ and initialize_lock_
8792         fields.  Add set_target_once_ field.
8793
8794 2010-02-10  Ian Lance Taylor  <iant@google.com>
8795
8796         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8797         queueing any tasks.
8798         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8799         (queue_middle_tasks): Add all blockers before queueing any tasks.
8800         (queue_final_tasks): Likewise.
8801         * token.h (Task_token::add_blockers): New function.
8802         * object.h (Input_objects::number_of_relobjs): New function.
8803
8804 2010-02-10  Ian Lance Taylor  <iant@google.com>
8805
8806         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8807         shared, not if not position independent.
8808         * x86_64.cc (Relocate::relocate_tls): Likewise.
8809         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8810         (tls_pie_pic_test): New target.
8811         * testsuite/Makefile.in: Rebuild.
8812
8813         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8814         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8815         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8816         * testsuite/Makefile.in: Rebuild.
8817
8818 2010-02-09  David S. Miller  <davem@davemloft.net>
8819
8820         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8821         R_SPARC_RELATIVE using ->add_local_relative().
8822         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8823
8824         * output.h (Output_data_dynamic::add_section_size): New method
8825         that takes two Output_data objects.
8826         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8827         entry param.  Handle it in initializers.
8828         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8829         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8830         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8831         arg.
8832         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8833         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8834         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8835         for dynrel_includes_plt.
8836         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8837         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8838         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8839         before .rela.plt
8840         (Target_sparc::do_finalize_sections): Update to pass true for
8841         dynrel_includes_plt.
8842         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8843         output before .rela.plt
8844         (Target_powerpc::do_finalize_sections): Update to pass true for
8845         dynrel_includes_plt when 32-bit.
8846
8847 2010-02-08  Doug Kwan  <dougkwan@google.com>
8848
8849         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8850         method.
8851         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8852         Arm_relobj::scan_section_for_cortex_a8_stubs,
8853         Arm_relobj::do_relocation_section): Instead of calling
8854         Output_section::output_address, use faster
8855         Arm_relobj::simple_input_section_output_address.
8856
8857 2010-02-08  David S. Miller  <davem@davemloft.net>
8858
8859         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8860         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8861         relocation helper function.
8862
8863         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8864         just like R_SPARC_GOT{10,13,22}.
8865         (Target_sparc::Scan::local): Likewise.
8866         (Target_sparc::Relocate:relocate): Likewise.
8867
8868 2010-02-06  Ian Lance Taylor  <iant@google.com>
8869
8870         * configure.ac: Rewrite targetobjs duplicate removal code to use
8871         only shell constructs.
8872         * configure: Rebuild.
8873
8874 2010-02-05  Doug Kwan  <dougkwan@google.com>
8875
8876         PR 11247
8877         * arm.cc (Arm_relobj::section_is_scannable): New method.
8878         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8879         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8880
8881 2010-02-04  Doug Kwan  <dougkwan@google.com>
8882
8883         PR 11247
8884         * arm-reloc-property.cc (cstdio): Include.
8885         * configure.ac (targetobjs): Remove duplicates.
8886         * configure: Regenerate.
8887         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8888         big and little endian version for a given address size.
8889
8890 2010-02-03  Doug Kwan  <dougkwan@google.com>
8891
8892         * arm-reloc-property.cc
8893         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8894         definition.
8895         * arm-reloc-property.h
8896         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8897         New method definition.
8898         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8899         declaration.
8900         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8901         overflow to N.
8902         (GOT_PREL): Change implemented to Y.
8903         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8904         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8905         (Arm_relocate_functions::movw_abs_nc): Remove method.
8906         (Arm_relocate_functions::movt_abs): Ditto.
8907         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8908         (Arm_relocate_functions::thm_movt_abs): Ditto.
8909         (Arm_relocate_functions::movw_rel_nc): Ditto.
8910         (Arm_relocate_functions::movw_rel): Ditto.
8911         (Arm_relocate_functions::movt_rel): Ditto.
8912         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8913         (Arm_relocate_functions:thm_movw_rel): Ditto.
8914         (Arm_relocate_functions:thm_movt_rel): Ditto.
8915         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8916         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8917         New method definitions.
8918         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8919         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8920         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8921         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8922         (Target_arm::Relocate::relocate): Check for non-static or
8923         unimplemented relocation code and exit early.  Change calls to
8924         Target_arm::reloc_uses_thumb_bit and
8925         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8926         instead.  Refactor code to handle similar relocations to increase
8927         code sharing.  Remove check for unsupported relocation code in switch
8928         statement.
8929         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8930         relocation property table to find out size.  Change error message to
8931         print out the name of a relocation code instead of the numeric value.
8932         (Target_arm::scan_reloc_for_stub): Use relocation property table
8933         instead of calling Target_arm::reloc_uses_thumb_bit().
8934
8935 2010-02-02  Doug Kwan  <dougkwan@google.com>
8936
8937         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8938         types of relaxed input section.
8939
8940 2010-02-02  Doug Kwan  <dougkwan@google.com>
8941
8942         * Makefile.am (HFILES): Add arm-reloc-property.h.
8943         (DEFFILES): New.
8944         (TARGETSOURCES): Add arm-reloc-property.cc
8945         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8946         (libgold_a_SOURCES): $(DEFFILES)
8947         * Makefile.in: Regenerate.
8948         * arm-reloc-property.cc: New file.
8949         * arm-reloc-property.h: New file.
8950         * arm-reloc.def: New file.
8951         * arm.cc: Update comments.
8952         (arm-reloc-property.h): New included header.
8953         (arm_reloc_property_table): New global variable.
8954         (Target_arm::do_select_as_default_target): New method definition.
8955         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8956         arm-reloc-property to targ_extra_obj.
8957         * parameters.cc (set_parameters_target): Call
8958         Target::select_as_default_target().
8959         * target.h (Target::select_as_default_target): New method definition.
8960         (Target::do_select_as_default_target): Same.
8961
8962 2010-02-01  Doug Kwan  <dougkwan@google.com>
8963
8964         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8965         first_output_text_section_.
8966         (Arm_exidx_fixup::first_output_text_section): New method definition.
8967         (Arm_exidx_fixup::first_output_text_section_): New data member.
8968         (Arm_exidx_fixup::process_exidx_section): Record the first text
8969         output section seen.
8970         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8971         and entsize in output section header.
8972
8973 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8974
8975         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8976         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8977         (Arm_relocate_functions::thm_alu11): New Method.
8978         (Arm_relocate_functions::thm_pc8): New Method.
8979         (Arm_relocate_functions::thm_pc12): New Method.
8980         (Target_arm::Scan::local): Handle the relocations.
8981         (Target_arm::Scan::global): Likewise.
8982         (Target_arm::Relocate::relocate): Likewise.
8983         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8984
8985 2010-01-29  Doug Kwan  <dougkwan@google.com>
8986
8987         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8988         of relocation types as ld.
8989
8990 2010-01-29  Doug Kwan  <dougkwan@google.com>
8991
8992         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8993         to public.
8994         (Arm_relocate_functions::thumb_branch_common): Ditto.
8995         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8996         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8997         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8998         Arm_relocate_functions::jump24): Remove.
8999         (Target_arm::Relocate::relocate): Adjust code to call
9000         Arm_relocation_functions::arm_branch_common and
9001         Arm_relocation_functions::thumb_branch_common instead of their removed
9002         wrappers.  Merge switch-cases together to reduce source code size.
9003
9004 2010-01-29  Doug Kwan  <dougkwan@google.com>
9005
9006         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9007         output_local_symbol_count_needs_update_.
9008         (Arm_relobj::output_local_symbol_count_needs_update,
9009          Arm_relobj::set_output_local_symbol_count_needs_update,
9010          Arm_relobj::update_output_local_symbol_count): New methods.
9011         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9012         member.
9013         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9014         of pointed function as in a R_ARM_PREL31 relocation.
9015         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9016         for output local symbol count updating.
9017         (Target_arm::do_relax): Update output local symbol counts in objects
9018         if necessary.
9019         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9020
9021 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9022
9023         * arm.cc: Added support for the ARM relocations:
9024         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9025         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9026         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9027         movw_prel_nc).
9028         (Arm_relocate_functions::movw_rel): New method.
9029         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9030         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9031         thm_movw_prel_nc).
9032         (Arm_relocate_functions::thm_movw_rel): New method.
9033         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9034         thm_movt_prel).
9035         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9036         relocations.
9037         (Target_arm::Scan::global): Likewise.
9038         (Target_arm::Relocate::relocate): Likewise.
9039         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9040         Likewise.
9041
9042 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9043
9044         * arm.cc: Added support for ARM group relocations.
9045         (Target_arm::reloc_needs_sym_origin): New method.
9046         (Arm_relocate_functions::calc_grp_kn): New method.
9047         (Arm_relocate_functions::calc_grp_residual): New method.
9048         (Arm_relocate_functions::calc_grp_gn): New method.
9049         (Arm_relocate_functions::arm_grp_alu): New Method.
9050         (Arm_relocate_functions::arm_grp_ldr): New Method.
9051         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9052         (Arm_relocate_functions::arm_grp_ldc): New Method.
9053         (Target_arm::Scan::local): Handle the ARM group relocations.
9054         (Target_arm::Scan::global): Likewise.
9055         (Target_arm::Relocate::relocate): Likewise.
9056         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9057         Likewise.
9058
9059 2010-01-26  Doug Kwan  <dougkwan@google.com>
9060
9061         * arm.cc (set): Include.
9062         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9063         pointer type.
9064         (Arm_output_section::Text_section_list): New type.
9065         (Arm_output_section::append_text_sections_to_list): New method.
9066         (Arm_output_section::fix_exidx_coverage): Ditto.
9067         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9068         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9069         Relobj::set_section_offset() instead of
9070         Sized_relobj::invalidate_section_offset().
9071         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9072         parameter for section headers. Ignore relocation sections for
9073         unallocated sections and EXIDX sections.
9074         (Target_arm::fix_exidx_coverage): New method.
9075         (Target_arm::output_section_address_less_than): New type.
9076         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9077         linked text section instead of the EXIDX section.
9078         (Arm_output_section::create_stub_group): Add an assertion to check
9079         that this is not an EXIDX output section.
9080         (Arm_output_section::append_text_sections_to_list): New method.
9081         (Arm_output_section::fix_exidx_coverage): Ditto.
9082         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9083         Arm_relobj::section_needs_reloc_stub_scanning.
9084         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9085         first pass.
9086         (Target_arm::fix_exidx_coverage): New method.
9087         * object.h (Relobj::set_output_section): New method.
9088         (Sized_relobj::invalidate_section_offset): Remove method.
9089         (Sized_relobj::do_invalidate_section_offset): Remove method.
9090         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9091
9092 2010-01-25  Doug Kwan  <dougkwan@google.com>
9093
9094         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9095         Fix warning due to signed and unsigned comparison on a 32-bit host.
9096
9097 2010-01-22  Doug Kwan  <dougkwan@google.com>
9098
9099         * arm.cc (Target_arm::do_relax): Record an output section for section
9100         offset adjustment it contains any stub table that has changed.
9101         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9102         offsets in an output section if necessary.
9103         * output.cc (Output_section::Output_section): Initialize
9104         section_offsets_need_adjustments_.
9105         (Output_section::add_input_section_for_script): Renamed to
9106         Output_section::add_simple_input_section.
9107         (Output_section::save_states): Add a comment.
9108         (Output_section::discard_states): New method defintion.
9109         (Output_section::adjust_section_offsets): Same.
9110         * output.h (Output_section::add_input_section_for_script): Renamed to
9111         Output_section::add_simple_input_section.
9112         (Output_section::discard_states): New method declaration.
9113         (Output_section::adjust_section_offsets): Same.
9114         (Output_section::section_offsets_need_adjustment,
9115         Output_section::set_section_offsets_need_adjustment): New method
9116         definitions.
9117         (Output_section::section_offsets_need_adjustment_): New data member.
9118         * script-sections.cc
9119         (Output_section_element_input::set_section_address): Adjust code for
9120         renaming of Output_section::add_input_section_for_script.
9121         (Orphan_output_section::set_section_address): Same.
9122
9123 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9124
9125         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9126         Fix_v4bx enum values .
9127         * gold/options.h (General_options): New option definitions.
9128         (General_options::fix_v4bx): New method.
9129         (General_options::Fix_v4bx): New enum.
9130         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9131         (General_options::parse_fix_v4bx_interworking): New method.
9132
9133 2010-01-22  Doug Kwan  <dougkwan@google.com>
9134
9135         * arm.cc (Arm_exidx_fixup): New class.
9136
9137 2010-01-21  Doug Kwan  <dougkwan@google.com>
9138
9139         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9140         classes.
9141         (Arm_exidx_section_offset_map): New type.
9142
9143 2010-01-21  Doug Kwan  <dougkwan@google.com>
9144
9145         * arm.cc (Arm_exidx_input_section): New class.
9146         (Arm_relobj::exidx_input_section_by_link,
9147         Arm_relobj::exidx_input_section_by_shndx,
9148         Arm_relobj::make_exidx_input_section): New methods.
9149         (read_arm_attributes_section): Remove.
9150         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9151         information about them.
9152         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9153         to here.
9154
9155 2010-01-20  Doug Kwan  <dougkwan@google.com>
9156
9157         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9158         Input_section_specifier to Section_id.
9159         (Target_arm::new_arm_input_section: Adjust code for change of key
9160         type.
9161         (Target_arm::find_arm_input_section): Ditto.
9162         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9163         (Section_id): Remove.
9164         (Garbage_collection::Section_id_hash): Remove.
9165         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9166         (Section_id): Remove.
9167         (Icf::Section_id_hash): Remove.
9168         * object.h (Section_id, Const_section_id, Section_id_hash,
9169         Const_section_id_hash): New type definitions.
9170         * output.cc (Output_section::add_relaxed_input_section): Change to
9171         use Const_section_id instead of Input_section_specifier as key type.
9172         (Output_section::add_merge_input_section): Ditto.
9173         (Output_section::build_relaxation_map): Change to use Section_id
9174         instead of Input_section_specifier as key type.
9175         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9176         Ditto.
9177         (Output_section::convert_input_sections_to_relaxed_sections): Change
9178         to use Const_section_id instead of Input_section_specifier as key type.
9179         (Output_section::find_merge_section): Ditto.
9180         (Output_section::find_relaxed_input_section): Ditto.
9181         * output.h (Input_section_specifier): Remove class.
9182         (Output_section::Output_section_data_by_input_section_map): Change
9183         key type to Const_section_id.
9184         (Output_section::Output_relaxed_input_section_by_input_section_map):
9185         Ditto.
9186         (Output_section::Relaxation_map): Change key type to Section_id.
9187
9188 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9189
9190         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9191         (class Arm_v4bx_stub): New class.
9192         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9193         (Stub_factory::make_arm_v4bx_stub): New method.
9194         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9195         (Stub_table::empty): Handle v4bx stubs.
9196         (Stub_table::add_arm_v4bx_stub): New method.
9197         (Stub_table::find_arm_v4bx_stub): New method.
9198         (Arm_relocate_functions::v4bx): New method.
9199         (Target_arm::fix_v4bx): New method.
9200         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9201         (Stub_table::relocate_stubs): Likewise.
9202         (Stub_table::do_write): Likewise.
9203         (Stub_table::update_data_size_and_addralign): Likewise.
9204         (Stub_table::finalize_stubs):  Likewise.
9205         (Target_arm::Scan::local): Likewise.
9206         (Target_arm::Scan::global): Likewise.
9207         (Target_arm::do_finalize_sections): Likewise.
9208         (Target_arm::Relocate::relocate): Likewise.
9209         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9210         Likewise.
9211         (Target_arm::scan_reloc_for_stub): Likewise.
9212         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9213
9214 2010-01-19  Ian Lance Taylor  <iant@google.com>
9215
9216         * output.cc (Output_section_headers::do_sized_write): Write large
9217         segment count to sh_info field.
9218         (Output_file_header::do_sized_write): For large segment count,
9219         write PN_XNUM to e_phnum field.
9220
9221 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9222
9223         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9224         (Arm_relocate_functions::thm_jump8): New function.
9225         (Arm_relocate_functions::thm_jump11): New function.
9226         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9227         R_ARM_THM_JUMP11.
9228         (Target_arm::Scan::global): Likewise.
9229         (Target_arm::Relocate::relocate): Likewise.
9230         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9231         Likewise.
9232
9233 2010-01-14  Doug Kwan  <dougkwan@google.com>
9234
9235         * arm.cc (map, utility): Include headers.
9236         (Target_arm::apply_cortex_a8_workaround): New method.
9237         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9238         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9239         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9240         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9241         the --[no-]fix-cortex-a8 command line options.
9242         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9243         (Target_arm::relocate_stub): Use addend in instruction template.
9244         * options.h (DEFINE_bool): Set the user-set flag.
9245         (General_options): Add --[no-]-fix-cortex options.
9246         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9247         : Update fast look-up map after conversion.
9248
9249 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9250
9251         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9252         in the first pass of do_layout.
9253
9254 2010-01-13  Doug Kwan  <dougkwan@google.com>
9255
9256         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9257         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9258         apparent compiler problem of not folding static constant integral
9259         data members of elfcpp::Elf_sizes<32>.
9260
9261 2010-01-13  Doug Kwan  <dougkwan@google.com>
9262
9263         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9264         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9265         Arm_relobj::scan_section_for_cortex_a8_erratum,
9266         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9267         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9268         sections to scan for relocation stubs into a new method
9269         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9270         relocation and Cortex-A8 stub scanning.
9271         (Target_arm::do_relax): Force stubs to be after stubbed sections
9272         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9273         the beginning of a new relaxation pass.  Update a comment.
9274         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9275
9276 2010-01-12  Ian Lance Taylor  <iant@google.com>
9277
9278         * target-reloc.h (visibility_error): New inline function.
9279         (relocate_section): Call visibility_error.
9280         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9281         (MOSTLYCLEANFILES): Likewise.
9282         (protected_4_pic.o, protected_3.err): New targets.
9283         * testsuite/protected_4.cc: New file.
9284
9285 2010-01-12  Doug Kwan  <dougkwan@google.com>
9286
9287         * arm.cc (Cortex_a8_reloc): New class.
9288         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9289         and cortex_a8_relocs_info_.
9290         (Target_arm::fix_cortex_a8): New method definition.
9291         (Target_arm::Cortex_a8_relocs_info): New type.
9292         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9293         New data member declarations.
9294         (Target_arm::scan_reloc_for_stub): Record information about
9295         relocations for THUMB branches that might be exempted from the
9296         Cortex-A8 workaround.
9297         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9298         at the beginning of a relaxation pass.
9299
9300 2010-01-12  Doug Kwan  <dougkwan@google.com>
9301
9302         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9303         (Arm_relobj::Mapping_symbol_position,
9304          Arm_reloj::Mapping_symbol_position_less,
9305          Arm_relobj::Mapping_symbols_info): New types.
9306         (Target_arm::is_mapping_symbol_name): New method definition.
9307         (Arm_relobj::do_count_local_symbols): Save information about mapping
9308         symbols.
9309
9310 2010-01-11  Doug Kwan  <dougkwan@google.com>
9311
9312         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9313         Arm_relocate_functions::thumb32_branch_upper,
9314         Arm_relocate_functions::thumb32_branch_lower,
9315         Arm_relocate_functions::thumb32_cond_branch_offset,
9316         Arm_relocate_functions::thumb32_cond_branch_upper,
9317         Arm_relocate_functions::thumb32_cond_branch_lower,
9318         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9319         branch offset encoding.
9320         (Arm_relocate_functions::thumb_branch_common): Use new branch
9321         offset encoding methods to avoid code duplication.
9322         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9323         (Stub_addend_reader::operator()): Use new branch encoding method
9324         to avoid code duplication.
9325
9326 2010-01-11  Doug Kwan  <dougkwan@google.com>
9327
9328         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9329         (Target_arm::do_finalize_sections): Define special EXIDX section
9330         symbols only if referenced.
9331         * gc.h (Garbage_collection::add_reference): New method.
9332         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9333         code duplication.
9334
9335 2010-01-11  Ian Lance Taylor  <iant@google.com>
9336
9337         * script.cc (Version_script_info::build_expression_list_lookup):
9338         Change complaing about duplicate wildcard match from error to
9339         warning.
9340
9341         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9342         of 2009-12-30.
9343         (Version_script_info::Version_script_info): Initialize globs_,
9344         default_version_, default_is_global_, and exact_.  Don't
9345         initialize globals_ or locals_.
9346         (Version_script_info::build_lookup_tables): Build local symbols
9347         first.
9348         (Version_script_info::unquote): New function.
9349         (Version_script_info::add_exact_match): New function.
9350         (Version_script_info::build_expression_list_lookup): Remove lookup
9351         parameter.  Add is_global parameter.  Change all callers.  Handle
9352         wildcard pattern specially.  Unquote pattern.  Call
9353         add_exact_match.
9354         (Version_script_info::get_name_to_match): New function.
9355         (Version_script_info::get_symbol_version): New function.
9356         (Version_script_info::get_symbol_version_helper): Remove.
9357         (Version_script_info::check_unmatched_names): Call unquote.
9358         * script.h (class Version_script_info): Change get_symbol_version
9359         to be non-inline and add is_global parameter; change all callers.
9360         Rewrite symbol_is_local.  Update declarations.  Define struct
9361         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9362         Remove globals_ and locals_ members.  Add exact_, globs_,
9363         default_version_, is_global_.
9364         (Version_script_info::Glob): Remove pattern, add expression and
9365         is_global.  Update constructor.  Change all callers.
9366         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9367         default version.
9368         (Versions::symbol_section_contents): If a symbol is undefined, or
9369         defined in a dynamic object, set the version index to
9370         VER_NDX_LOCAL.
9371         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9372         symbol_is_local.
9373         (Symbol_table::add_from_pluginobj): Likewise.
9374         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9375
9376 2010-01-11  Doug Kwan  <dougkwan@google.com>
9377
9378         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9379         (incremental_dump_LDADD): Add linking option for libintl.
9380         * Makefile.in: Regenerate.
9381
9382 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9383
9384         PR gold/11144
9385         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9386         instead of -Ds.
9387         * testsuite/Makefile.in: Regenerated.
9388
9389 2010-01-10  Doug Kwan  <dougkwan@google.com>
9390
9391         * options.h (DEFINE_var): Use parentheses around argument varname__
9392         in macro body to avoid any unintended subsequent substitutions.
9393
9394 2010-01-10  Ian Lance Taylor  <iant@google.com>
9395
9396         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9397         candidates before doing symbol resolution.
9398
9399         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9400         ODR candidates if only one is weak.
9401
9402 2010-01-08  Ian Lance Taylor  <iant@google.com>
9403
9404         * script.cc (Version_script_info::build_expression_list_lookup):
9405         Don't warn about ambiguous version, just record the ambiguity.
9406         (Version_script_info::get_symbol_version_helper): Give error if
9407         version is ambiguous.
9408
9409 2010-01-08  Doug Kwan  <dougkwan@google.com>
9410
9411         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9412         prev_data_size_ and prev_addralign_.  Remove initializer for
9413         deleted data member has_been_changed_.
9414         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9415         to determine if the table is empty.
9416         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9417         Remove.
9418         (Stub_table::add_reloc_stub): Define method in class definition
9419         instead of just declaring it there.
9420         (Stub_table::add_cortex_a8_stub): New method definition.
9421         (Stub_table::update_data_size_and_addralign): Ditto.
9422         (Stub_table::finalize_stubs): Ditto.
9423         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9424         (Stub_table::do_addralign_): Return address alignment in the
9425         (Stub_table::do_reset_address_and_file_offset): Define method in
9426         class definition instead of declaring it there.  Set current data
9427         size to be the data size of the previous pass.
9428         (Stub_table::set_final_data_size): Use current data size as the
9429         final data size.
9430         (Stub_table::relocate_stub): Change parameter type of stub from
9431         Reloc_stub pointer to Stub pointer.
9432         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9433         (Stub_table::Cortex_a8_stub_list): New typedef.
9434         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9435          Stub_table::prev_addralign_): New data member.
9436         (Arm_relobj::Arm_relobj): Initialize data member
9437         section_has_cortex_a8_workaround_.
9438         (Arm_relobj::section_has_cortex_a8_workaround,
9439          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9440          definitions.
9441         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9442         declarations.
9443         (Target_arm::relocate_stub): Change parameter type of stub from
9444         Reloc_stub pointer to Stub pointer.
9445         (Insn_template::size, Insn_template::alignment): Handle
9446         THUMB16_SPECIAL_TYPE.
9447         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9448          Stub_table::update_data_size_and_addralign,
9449          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9450         definitions.
9451         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9452         (Stub_table::do_write): Ditto.
9453         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9454
9455 2010-01-08  Ian Lance Taylor  <iant@google.com>
9456
9457         PR 11108
9458         * symtab.h (class Symbol): Remove fields is_target_special_ and
9459         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9460         (Symbol::is_defined_in_discarded_section): New function.
9461         (Symbol::set_is_defined_in_discarded_section): New function.
9462         (Symbol::has_plt_offset): Rewrite.
9463         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9464         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9465         Don't initialize is_target_special_ or has_plt_offset_.
9466         Initialize is_defined_in_discarded_section_.
9467         (Symbol_table::add_from_relobj): If appropriate, set
9468         is_defined_in_discarded_section.
9469         * resolve.cc (Symbol::override_base_with_special): Don't test
9470         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9471         * target-reloc.h (relocate_section): Do special handling for
9472         symbols defined in discarded sections for global symbols as well
9473         as local symbols.
9474
9475 2010-01-08  Ian Lance Taylor  <iant@google.com>
9476
9477         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9478         the SHT_SYMTAB case.
9479
9480 2010-01-08  Ian Lance Taylor  <iant@google.com>
9481
9482         * object.cc (Sized_relobj::do_layout): Don't get confused if
9483         layout_eh_frame returns NULL.
9484
9485 2010-01-08  Ian Lance Taylor  <iant@google.com>
9486
9487         PR 11084
9488         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9489         dynamic symbol table, use the normal symbol table.
9490         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9491         symbol table.
9492
9493 2010-01-08  Ian Lance Taylor  <iant@google.com>
9494
9495         PR 11072
9496         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9497         sections.
9498
9499 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9500
9501         * version.cc (print_version): Change to "Copyright 2010".
9502
9503 2010-01-08  Ian Lance Taylor  <iant@google.com>
9504
9505         PR 10287
9506         PR 11063
9507         * i386.cc (class Target_i386): Change return type of plt_section
9508         to be non-const.
9509         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9510         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9511         tls_desc_rel_ field.
9512         (Output_data_plt_i386::rel_tls_desc): New function.
9513         (Target_i386::rel_tls_desc_section): New function.
9514         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9515         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9516         R_386_TLS_DESC reloc in rel_tls_desc_section.
9517         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9518         Define struct Tlsdesc_info.
9519         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9520         (Target_x86_64::do_reloc_symbol_index): New function.
9521         (Target_x86_64::add_tlsdesc_info): New function.
9522         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9523         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9524         tlsdesc_rel_ field.
9525         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9526         all callers.
9527         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9528         (Target_x86_64::rela_tlsdesc_section): New function.
9529         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9530         handling.
9531         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9532         (Target_x86_64::do_reloc_addend): New function.
9533         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9534         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9535         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9536         (Output_reloc::type): New function.
9537         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9538         (Output_reloc::is_target_specific): New function.
9539         (Output_reloc::target_arg): New function.
9540         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9541         absolute relocs and target specific relocs.
9542         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9543         add_target_specific.
9544         (class Output_data_reloc) [SHT_RELA]: Likewise.
9545         * output.cc (Output_reloc::Output_reloc): Add four new versions
9546         for absolute relocs and target specific relocs.
9547         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9548         (Output_reloc::get_symbol_index): Likewise.
9549         (Output_reloc::local_section_offset): Check that local_sym_index_
9550         is not TARGET_CODE or 0.
9551         (Output_reloc::symbol_value): Likewise.
9552         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9553         reloc.
9554         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9555         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9556         functions.
9557         * layout.cc (add_target_dynamic_tags): Use output section for
9558         DT_PLTRELSZ and DT_JMPREL.
9559
9560 2010-01-07  Ian Lance Taylor  <iant@google.com>
9561
9562         PR 11061
9563         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9564         function.
9565         (class Output_data_reloc_generic): Define.
9566         (class Output_data_reloc_base): Change base class to
9567         Output_data_reloc_generic.  Change add() method to call
9568         bump_relative_reloc_count for a relative reloc.  Remove
9569         sort_relocs_ field.
9570         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9571         to sort_relocs().
9572         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9573         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9574         appropriate.
9575         * layout.h (class Layout): Update declaration.
9576
9577 2010-01-07  Ian Lance Taylor  <iant@google.com>
9578
9579         * output.h (class Output_data): Add const version of
9580         output_section and do_output_section.
9581         (class Output_section_data): Add const version of
9582         do_output_section.
9583         (class Output_section): Likewise.
9584         * layout.cc (Layout::add_target_dynamic_tags): New function.
9585         * layout.h (class Layout): Update declarations.
9586         * arm.cc (Target_arm::do_finalize_sections): Use
9587         add_target_dynamic_tags.
9588         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9589         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9590         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9591         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9592
9593 2010-01-07  Ian Lance Taylor  <iant@google.com>
9594
9595         PR 11042
9596         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9597         object as needed.
9598
9599 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9600             Ian Lance Taylor  <iant@google.com>
9601
9602         PR 11019
9603         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9604         Xindex::read_symtab_xindex.
9605
9606 2010-01-07  Doug Kwan  <dougkwan@google.com>
9607
9608         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9609         (Insn_template::thumb16_bcond_insn): New method declaration.
9610         (Insn_template): Fix spelling.
9611         (Stub::thumb16_special): New method declaration.
9612         (Stub::do_write): Define virtual method which was previously pure
9613         virtual.
9614         (Stub::do_thumb16_special): New method declaration.
9615         (Stub::do_fixed_endian_write): New template member.
9616         (Reloc_stub::do_write): Remove.
9617         (Reloc_stub::do_fixed_endian_write): Remove.
9618         (Cortex_a8_stub): New class definition.
9619         (Stub_factory::make_cortex_a8_stub): New method definition.
9620         (Stub_factory::Stub_factory): Add missing static storage class
9621         qualifier for elf32_arm_stub_a8_veneer_blx.
9622
9623 2010-01-07  Ian Lance Taylor  <iant@google.com>
9624
9625         PR 10980
9626         * options.h (class General_options): Add --warn-unresolved-symbols
9627         and --error-unresolved-symbols.
9628         * errors.cc (Errors::undefined_symbol): Implement
9629         --warn-unresolved-symbols.
9630
9631         * options.h (class General_options): Add -z text and -z textoff.
9632         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9633
9634 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9635
9636         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9637         (Garbage_collection::cident_sections): New function.
9638         (Garbage_collection::add_cident_section): New function.
9639         (Garbage_collection::cident_sections_): New member.
9640         (gc_process_relocs): Add references to sections whose names are C
9641         identifiers.
9642         * gold.h (cident_section_start_prefix): New constant.
9643         (cident_section_stop_prefix): New constant.
9644         (is_cident): New function.
9645         * layout.cc (Layout::define_section_symbols): Replace string constants
9646         with the newly defined constants.
9647         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9648         C identifiers.
9649         * testsuite/Makefile.am: Add gc_orphan_section_test.
9650         * testsuite/Makefile.in: Regenerate.
9651         * testsuite/gc_orphan_section_test.cc: New file.
9652         * testsuite/gc_orphan_section_test.sh: New file.
9653
9654 2010-01-06  Ian Lance Taylor  <iant@google.com>
9655
9656         PR 10980
9657         * options.h (class General_options): Add --warn-shared-textrel.
9658         * layout.cc (Layout::finish_dynamic_section): Implement
9659         --warn-shared-textrel.
9660
9661         PR 10980
9662         * options.h (class General_options): Add --warn-multiple-gp.
9663
9664 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9665
9666         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9667         $(THREADSLIB) and $(LIBDL).
9668         * Makefile.in: Rebuild.
9669
9670 2010-01-06  Ian Lance Taylor  <iant@google.com>
9671
9672         PR 10980
9673         * options.cc (General_options::parse_section_start): New function.
9674         (General_options::section_start): New function.
9675         (General_options::General_options): Initialize all members.
9676         * options.h: Include <map>
9677         (class General_options): Add --section-start.  Add section_starts_
9678         member.
9679         * layout.cc (Layout::attach_allocated_section_to_segment): If
9680         --section-start was used, set the address of the segment.  Remove
9681         local sort_sections.
9682         (Layout::relaxation_loop_body): If the address of the load segment
9683         has been set by --section-start, don't use it.
9684         * output.h (Output_segment::update_flags_for_output_section): New
9685         function.
9686         * output.cc (Output_segment::add_output_section): Call
9687         update_flags_for_output_section.
9688
9689 2010-01-05  Ian Lance Taylor  <iant@google.com>
9690
9691         PR 10980
9692         * options.h (class General_options): Add --undefined-version.
9693         * script.cc (struct Version_expression): Add was_matched_by_symbol
9694         field.
9695         (Version_script_info::matched_symbol): New function.
9696         (Version_script_info::get_symbol_version_helper): Call
9697         matched_symbol.
9698         (Version_script_info::check_unmatched_names): New function.
9699         * script.h (class Version_script_info): Update declarations.
9700         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9701
9702         * options.h (class General_options): Use DEFINE_bool_alias for
9703         allow_multiple_definition.
9704         * resolve.cc (Symbol_table::should_override): Don't test
9705         allow_multiple_definition.
9706
9707         PR 10980
9708         * options.h (class General_options): Add --cref.
9709         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9710         until after printing cref table.
9711         * cref.cc: Include "symtab.h".
9712         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9713         (Cref_table_compare::operator()): New function.
9714         (Cref_inputs::gather_cref): New function.
9715         (filecol): New static const.
9716         (Cref_inputs::print_cref): New function.
9717         (Cref::print_cref): New function.
9718         * cref.h: Include <cstdio>.
9719         (class Cref): Update declarations.
9720         * mapfile.h (Mapfile::file): New function.
9721         * object.h (class Object): Define Symbols.  Declare virtual
9722         do_get_global_symbols.
9723         (Object::get_global_symbols): New function.
9724         * object.cc (Input_objects::add_object): Pass object to cref_ if
9725         --cref.
9726         (Input_objects::archive_start): Likewise.
9727         (Input_objects::archive_stop): Likewise.
9728         (Input_objects::print_cref): New function.
9729         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9730         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9731         --cref.
9732         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9733         function.
9734         * plugin.h (class Sized_pluginobj): Update declarations.
9735
9736 2010-01-05  Ian Lance Taylor  <iant@google.com>
9737
9738         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9739         to is_default_version.  Rename insdef to insdefault.
9740         (Symbol_table::add_from_relobj): Rename def to is_default_version
9741         and local to is_forced_local.
9742         (Symbol_table::add_from_pluginobj): Likewise.
9743         (Symbol_table::add_from_dynobj): Likewise.
9744         (Symbol_table::define_special_symbol): Rename insdef to
9745         insdefault.
9746
9747 2010-01-04  Ian Lance Taylor  <iant@google.com>
9748
9749         PR 10980
9750         * options.h (class General_options): Add
9751         --allow-multiple-definition and -z muldefs.
9752         * resolve.cc (Symbol_table::should_override): Don't warn about a
9753         multiple symbol definition if --allow-multiple-definition or -z
9754         muldefs.
9755
9756         PR 10980
9757         * options.h (class General_options): Add --add-needed and
9758         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9759         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9760         error if --copy-dt-needed-entries aka --add-needed is used and
9761         would cause a change in behaviour.
9762
9763         PR 10980
9764         * options.h (class General_options): Add -G as a short version of
9765         --shared.  Add no-op options -assert, -g, and -i.
9766
9767 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9768
9769         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9770         check for .text or .gnu.linkonce.t sections.
9771         * icf.cc (Icf::find_identical_sections): Ditto.
9772         Change the detection for mangled function name within the section
9773         name.
9774         * icf.h (is_section_foldable_candidate): New function.
9775
9776 2009-12-30  Ian Lance Taylor  <iant@google.com>
9777
9778         PR 10980
9779         * options.h (class General_options): Permit two dashes with
9780         --retain-symbols-file.
9781
9782 2009-12-30  Ian Lance Taylor  <iant@google.com>
9783
9784         PR 10979
9785         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9786         don't put the file header and segment headers in the text
9787         segment.
9788
9789         PR 10979
9790         * common.cc (Sort_commons::operator()): Stabilize sort when both
9791         entries are NULL.
9792         (Symbol_table::do_allocate_commons_list): When allocating common
9793         symbols, skip a symbol which is no longer common.
9794         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9795         an object before checking its type.
9796         * testsuite/common_test_2.c: New file.
9797         * testsuite/common_test_3.c: New file.
9798         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9799         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9800         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9801         (common_test_2_pic.o, common_test_2.so): New targets.
9802         (common_test_3_pic.o, common_test_3.so): New targets.
9803         * testsuite/Makefile.in: Rebuild.
9804
9805         PR 10979
9806         * script.cc (read_input_script): If we see a new SECTIONS clause,
9807         and we have added an input section, give an error.
9808         * layout.h (class Layout): Add have_added_input_section function.
9809         Add have_added_input_section_ field.
9810         * layout.cc (Layout::Layout): Initialize
9811         have_added_input_section_.
9812         (Layout::layout): Set have_added_input_section_.
9813         (Layout::layout_eh_frame): Likewise.
9814
9815 2009-12-30  Ian Lance Taylor  <iant@google.com>
9816
9817         PR 10931
9818         * options.h (class General_options): Add --sort-common option.
9819         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9820         * common.cc (Sort_common): Add sort_order parameter to
9821         constructor.  Add sort_order_ field.
9822         (Sort_commons::operator): Check sort_order_.
9823         (Symbol_table::allocate_commons): Determine the sort order.
9824         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9825         Change all callers.
9826         (Symbol_table::do_allocate_commons_list): Likewise.
9827
9828 2009-12-30  Ian Lance Taylor  <iant@google.com>
9829
9830         PR 10916
9831         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9832         symbols from this object, don't change the visibility of an
9833         undefined symbol.
9834         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9835
9836 2009-12-30  Ian Lance Taylor  <iant@google.com>
9837
9838         PR 10861
9839         * script.h (class Version_script_info): Define Language enum.
9840         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9841         new fields globals_, locals_, and is_finalized_.
9842         * script.cc: Various formatting fixes.
9843         (class Parser_closure): Change language_stack_ from a vector of
9844         std::string to one of Version_script_info::Language.  Adjust all
9845         uses accordingly.
9846         (class Lazy_demangler): Remove.
9847         (struct Version_expression): Change language from std::string to
9848         Version_script_info::Language.
9849         (Version_script_info::Version_script_info): New function.
9850         (Version_script_info::~Version_script_info): Don't call clear.
9851         (Version_script_info::finalize): New function.
9852         (Version_script_info::build_lookup_tables): New function.
9853         (Version_script_info::build_expression_list_lookup): New
9854         function.
9855         (Version_script_info::get_symbol_version_helper): Rewrite to use
9856         lookup tables.
9857         (Version_script_info::print_expression_list): Adjust to use
9858         Version_script_info::Language.
9859         (script_push_lex_into_version_mode): Check that the version script
9860         has not been finalized.
9861         (version_script_push_lang): Change language string to
9862         Version_script_info::Language.
9863         * options.cc (Command_line::version_script): New function.
9864         * options.h (class General_options): Add finalize_dynamic_list
9865         function.  Change version_script from declaration to definition.
9866         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9867         * testsuite/version_script.map: Remove duplicate def of foo.
9868         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9869         version_script.map.
9870         * testsuite/Makefile.in: Rebuild.
9871
9872 2009-12-30  Ian Lance Taylor  <iant@google.com>
9873
9874         PR 10843
9875         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9876         if the input symbol index is 0, make the output symbol index 0.
9877
9878 2009-12-30  Ian Lance Taylor  <iant@google.com>
9879
9880         PR 10670
9881         * options.h (class General_options): Add -x/--discard-all.
9882         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9883         --discard-all.  If the local symbol needs a dynamic entry, check
9884         that before handling --discard-locals.
9885
9886 2009-12-30  Ian Lance Taylor  <iant@google.com>
9887
9888         PR 10450
9889         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9890         flags to PF_R.
9891         (Output_segment::add_output_section): Don't change the flags if
9892         the type is PT_TLS.
9893
9894         PR 10450
9895         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9896         GNU hash table if they need a dynamic value.  Otherwise, don't add
9897         them if they are defined in a dynamic object or are forced local.
9898
9899 2009-12-29  Ian Lance Taylor  <iant@google.com>
9900
9901         PR 10450
9902         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9903         .gnu.hash table for a 32-bit target.
9904
9905         PR 10450
9906         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9907         regular and a dynamic object only needs a dynamic symbol table
9908         entry if it is externally visible.
9909
9910         PR 10450
9911         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9912         constructor.  Add global_offset_table_ field.
9913         (Target_i386::got_section): Set global_offset_table_.
9914         (Target_i386::do_finalize_sections): Set global_offset_table_
9915         size.
9916         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9917         in constructor.  Add global_offset_table_ field.
9918         (Target_x86_64::got_section): Set global_offset_table_.
9919         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9920         size.
9921
9922         * layout.cc (Layout::Layout): Initialize increase_relro_.
9923         (Layout::get_output_section): Add is_relro, is_last_relro, and
9924         is_first_non_relro parameters.  Change all callers.
9925         (Layout::choose_output_section): Likewise.
9926         (Layout::add_output_section_data): Likewise.
9927         (Layout::make_output_section): Likewise.
9928         (Layout::set_segment_offsets): Clear increase_relro when using a
9929         linker script.
9930         * layout.h (class Layout): Add increase_relro method.  Add
9931         increase_relro_ field.  Update declarations.
9932         * output.cc (Output_section::Output_section): Initialize
9933         is_last_relro_ and is_first_non_relro_.
9934         (Output_segment::add_output_section): Group relro sections is
9935         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9936         (Output_segment::maximum_alignment): Remove relro handling.
9937         (Output_segment::set_section_addresses): Add increase_relro
9938         parameter.  Change all callers.  Add initial alignment to align
9939         relro sections on separate page.  Remove old relro handling.
9940         (Output_segment::set_section_list_addresses): Remove in_relro
9941         parameter.  Change all callers.
9942         (Output_segment::set_offset): Add increase parameter.  Change all
9943         callers.  Remove old relro handling.
9944         * output.h (class Output_section): Add new methods: is_last_relro,
9945         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9946         Add is_last_relro_ and is_first_non_relro_ fields.
9947         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9948         Create separate .got.plt section.  Call increase_relro.
9949         * x86_64.cc (Target_x86_64::got_section): Likewise.
9950         * testsuite/relro_script_test.t: Add .got.plt.
9951
9952         PR 10450
9953         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9954         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9955         (Layout::finalize): Call set_dynamic_symbol_size.
9956         (Layout::set_dynamic_symbol_size): New function.
9957         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9958         set_dynamic_symbol_size.
9959
9960         PR 10450
9961         * output.h (class Output_section): Add is_entsize_zero_ field.
9962         * output.cc (Output_section::Output_section): Initialize
9963         is_entsize_zero_.
9964         (Output_section::set_entsize): If two different entsizes are
9965         requested, force it to zero.
9966         (Output_section::add_input_section): Set flags for .debug_str
9967         before updating section flags.  Set entsize.
9968         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9969         and SHF_STRING if all input sections have those flags.
9970
9971 2009-12-29   Rafael Espindola  <espindola@google.com>
9972
9973         * main.cc (main): Fix the sys time reporting.
9974         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9975         reporting.
9976
9977 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9978
9979         * options.cc (General_options::parse_version): Allow -v to exit
9980         without an error if there is nothing to link.
9981
9982 2009-12-29  Ian Lance Taylor  <iant@google.com>
9983
9984         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9985         using a version of gcc before 4.1.
9986         * configure: Rebuild.
9987
9988 2009-12-28  Chris Demetriou  <cgd@google.com>
9989
9990         * attributes.cc (Output_attributes_section_data::do_write): Use
9991         std::vector::front rather than std::vector::data.
9992
9993 2009-12-28  Ian Lance Taylor  <iant@google.com>
9994
9995         * symtab.h (class Symbol_table): Add enum Defined.
9996         * resolve.cc (Symbol_table::should_override): Add defined
9997         parameter.  Change all callers.  Test whether object is NULL
9998         before calling a method on it.
9999         (Symbol_table::report_resolve_problem): Add defined parameter.
10000         Change all callers.
10001         (Symbol_table::should_override_with_special): Likewise.
10002         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10003         parameter.  Change all callers.
10004         (Symbol_table::do_define_in_output_data): Likewise.
10005         (Symbol_table::define_in_output_segment): Likewise.
10006         (Symbol_table::do_define_in_output_segment): Likewise.
10007         (Symbol_table::define_as_constant): Likewise.
10008         (Symbol_table::do_define_as_constant): Likewise.
10009         * script.h (class Symbol_assignment): Add is_defsym parameter to
10010         constructor; change all callers.
10011         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10012         parameter.  Change all callers.  Add is_defsym_ field.
10013         (class Parser_closure): Add parsing_defsym parameter to
10014         constructor; change all callers.  Add parsing_defsym accessor
10015         function.  Add parsing_defsym_ field.
10016
10017 2009-12-28  Ian Lance Taylor  <iant@google.com>
10018
10019         * gold.cc (queue_middle_tasks): Fix formatting.
10020         * object.cc (Relobj::is_section_name_included): Likewise.
10021
10022 2009-12-23  Ian Lance Taylor  <iant@google.com>
10023
10024         * i386.cc (Target_i386::do_calls_non_split): Recognize
10025         -fsplit-stack prologue for a function with a static chain.
10026         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10027         -fsplit-stack prologue when using %r11.
10028
10029 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10030
10031         * options.cc (General_options::parse_version): Make -v continue and do
10032         the link like GNU ld does.
10033
10034 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10035
10036         * Makefile.am (CCFILES): Add timer.cc.
10037         (HFILES): Add timer.h.
10038         * configure.ac: Check for sysconf and times.
10039         * main.cc: include timer.h.
10040         (main): Use Timer instead of get_run_time.
10041         * timer.cc: New.
10042         * timer.h: New.
10043         * workqueue.cc: include timer.h.
10044         (Workqueue::find_and_run_task):
10045         Report user, sys and wall time.
10046         * Makefile.in: Regenerate.
10047         * config.in: Regenerate.
10048         * configure: Regenerate.
10049
10050 2009-12-16  Doug Kwan  <dougkwan@google.com>
10051
10052         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10053         sections.
10054         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10055         relaxed input sections.
10056         * output.cc (Output_section::find_relaxed_input_section): Change
10057         return type to Output_relaxed_input_section pointer.  Adjust code
10058         for new type of relaxed_input_section_map_.
10059         * output.h (Output_section::find_relaxed_input_section): Change
10060         return type to Output_relaxed_input_section pointer.
10061         (Output_section::Output_relaxed_input_section_by_input_section_map):
10062         New type.
10063         (Output_section::relaxed_input_section_map_): Change type to
10064         Output_section::Output_relaxed_input_section_by_input_section_map.
10065         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10066         input section.
10067
10068 2009-12-15  Ian Lance Taylor  <iant@google.com>
10069
10070         * layout.cc (Layout::create_shstrtab): Only write out after input
10071         sections if we are compressing debug sections.
10072
10073 2009-12-15  Ian Lance Taylor  <iant@google.com>
10074
10075         * archive.cc (Archive::add_symbols): Only look up a symbol without
10076         a version if there is, in fact, a version.
10077
10078 2009-12-14  Ian Lance Taylor  <iant@google.com>
10079
10080         Revert -Wshadow changes, all changes from:
10081         2009-12-11  Doug Kwan  <dougkwan@google.com>
10082         2009-12-11  Nick Clifton  <nickc@redhat.com>
10083         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10084
10085 2009-12-11  Doug Kwan  <dougkwan@google.com>
10086
10087         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10088         due to -Wshadow.
10089         * attributes.cc (Object_attribute::size): Ditto.
10090         (Attributes_section_data::size): Ditto.
10091         (Attributes_section_data::Attributes_section_data): Ditto.
10092         (Output_attributes_section_data::do_write): Ditto.
10093         * attributes.h (Object_attribute::set_type): Ditto.
10094         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10095
10096 2009-12-11  Nick Clifton  <nickc@redhat.com>
10097
10098         * archive.cc: Fix shadowed variable warnings.
10099         * arm.cc: Likewise.
10100         * compressed_output.cc: Likewise.
10101         * compressed_output.h: Likewise.
10102         * configure: Likewise.
10103         * dwarf_reader.cc: Likewise.
10104         * dynobj.cc: Likewise.
10105         * dynobj.h: Likewise.
10106         * ehframe.cc: Likewise.
10107         * ehframe.h: Likewise.
10108         * errors.cc: Likewise.
10109         * expression.cc: Likewise.
10110         * fileread.cc: Likewise.
10111         * fileread.h: Likewise.
10112         * freebsd.h: Likewise.
10113         * i386.cc: Likewise.
10114         * icf.cc: Likewise.
10115         * incremental.h: Likewise.
10116         * layout.cc: Likewise.
10117         * layout.h: Likewise.
10118         * mapfile.cc: Likewise.
10119         * merge.cc: Likewise.
10120         * merge.h: Likewise.
10121         * object.cc: Likewise.
10122         * object.h: Likewise.
10123         * options.h: Likewise.
10124         * output.cc: Likewise.
10125         * output.h: Likewise.
10126         * parameters.cc: Likewise.
10127         * plugin.cc: Likewise.
10128         * powerpc.cc: Likewise.
10129         * reduced_debug_output.cc: Likewise.
10130         * reduced_debug_output.h: Likewise.
10131         * reloc.cc: Likewise.
10132         * reloc.h: Likewise.
10133         * resolve.cc: Likewise.
10134         * script-sections.cc: Likewise.
10135         * script.cc: Likewise.
10136         * script.h: Likewise.
10137         * sparc.cc: Likewise.
10138         * symtab.cc: Likewise.
10139         * symtab.h: Likewise.
10140         * target-select.cc: Likewise.
10141         * target-select.h: Likewise.
10142         * token.h: Likewise.
10143         * workqueue.cc: Likewise.
10144         * workqueue.h: Likewise.
10145         * x86_64.cc: Likewise.
10146
10147 2009-12-10  Doug Kwan  <dougkwan@google.com>
10148
10149         * arm.cc (attributes.h): New include.
10150         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10151         (Arm_relobj::~Arm_relobj): Delete object pointed by
10152         attributes_section_data_.
10153         (Arm_relobj::attributes_section_data): New method definition.
10154         (Arm_relobj::attributes_section_data_): New data member declaration.
10155         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10156         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10157         attributes_section_data_.
10158         (Arm_dynobj::attributes_section_data): New method definition.
10159         (Arm_dynobj::attributes_section_data_): New data member declaration.
10160         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10161         initialization value of may_use_blx_ to false.
10162         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10163         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10164         object attributes to compute results instead of hard-coding.
10165         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10166         Target_arm::get_secondary_compatible_arch,
10167         Target_arm::set_secondary_compatible_arch
10168         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10169         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10170         New method declarations.
10171         (Target_arm::get_aeabi_object_attribute): New method definition.
10172         (Target_arm::attributes_section_data_): New data member declaration.
10173         (read_arm_attributes_section): New template definition.
10174         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10175         (Arm_dynobj::do_read_symbols): Ditto.
10176         (Target_arm::do_finalize_sections): Merge attributes sections from
10177         input.  Check for BLX use after attributes section merging.
10178         Fix __exidx_start and __exidx_end visibility.  Create an
10179         .ARM.attributes section if necessary.
10180         (Target_arm::get_secondary_compatible_arch,
10181         Target_arm::set_secondary_compatible_arch,
10182         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10183         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10184         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10185         New method definitions.
10186
10187 2009-12-09  Ian Lance Taylor  <iant@google.com>
10188
10189         * plugin.cc (Plugin::load): Don't cast from void* to a function
10190         pointer.
10191
10192 2009-12-09  Ian Lance Taylor  <iant@google.com>
10193
10194         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10195         information fields.
10196
10197 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10198
10199         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10200         Replace two_file_shared_1.so with two_file_shared_2.so.
10201         * testsuite/Makefile.in: Regenerated.
10202
10203 2009-12-08  Doug Kwan  <dougkwan@google.com>
10204
10205         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10206         (HFILES): Add attributes.h and int_encoding.h.
10207         * Makefile.in: Regenerate.
10208         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10209         function definitions to int_encoding.cc
10210         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10211         prototypes to int_encoding.h
10212         * reduced_debug_output.cc (int_encoding.h): New include.
10213         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10214         function definitions to int_encoding.cc
10215         (insert_into_vector, read_from_pointer): Move template definitions to
10216         int_encoding.h
10217         * attributes.cc: New file.
10218         * attributes.h: New file.
10219         * int_encoding.cc: New file.
10220         * int_encoding.h: New file.
10221
10222 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10223
10224         PR gold/11055
10225         * incremental-dump.cc (dump_incremental_inputs): New.
10226         (main): Use dump_incremental_inputs.
10227
10228 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10229
10230         PR gold/10893
10231         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10232         checking elfcpp::STT_FUNC.
10233         (Target_i386::Relocate::relocate): Likewise.
10234         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10235
10236         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10237         symbols from shared libraries into normal FUNC symbols.
10238
10239         * symtab.h (Symbol): Add is_func and use it.
10240
10241 2009-12-05  Doug Kwan  <dougkwan@google.com>
10242
10243         * arm.cc (Target_arm::arm_info): Initialize new fields
10244         attributes_section and attributes_vendor.
10245         * i386.cc (Target_i386::i386_info): Same.
10246         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10247         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10248         fields attributes_section and attributes_vendor.
10249         * sparc.cc (Target_sparc::sparc_info): Same.
10250         * target.h (Target::attributes_section, Target::attributes_vendor,
10251         Target::is_attributes_section, Target::attribute_arg_type,
10252         Target::attributes_order): New method definitions.
10253         (Target::Target_info::attributes_section,
10254         Target::Target_info::attributes_vendor): New fields.
10255         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10256         virtual method definitions.
10257         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10258         attributes_section and attributes_vendor.
10259         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10260
10261 2009-12-05  Doug Kwan  <dougkwan@google.com>
10262
10263         * arm.cc: Update comments about interworking and stub generation.
10264         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10265         considered as non-PIC.
10266         (Arm_relocate_functions::base_abs): Fix formatting.
10267         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10268         of function to use GOT entry address instead of offset.
10269         (Target_arm::Scan::global): Issue an error if a symbol would need a
10270         PLT does not get one because it is untyped.  Remove code to create
10271         dynamic symbols for relative branches.
10272         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10273         takes unsigned integer instead of boolean.
10274
10275 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10276
10277         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10278         (two_file_test_LDADD): Likewise.
10279         (common_test_1_LDADD): Likewise.
10280         (exception_test_LDADD) Likewise.
10281         (weak_test_LDADD): Likewise.
10282         (many_sections_test_LDADD): Likewise.
10283         (initpri1_LDADD): Likewise.
10284         (script_test_1_LDADD): Likewise.
10285         (script_test_2_LDADD): Likewise.
10286         (justsyms_LDADD): Likewise.
10287         (binary_test_LDADD): Likewise.
10288         (large_LDADD): Likewise.
10289         * testsuite/Makefile.in: Regenerated.
10290
10291 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10292
10293         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10294         (Symbol_table::override_with_special): Likewise.
10295         (Symbol_table::add_from_object): Likewise.
10296
10297 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10298
10299         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10300         Don't set the data_offset twice.
10301
10302 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10303
10304         * testsuite/Makefile.in: Regenerate.
10305
10306 2009-12-03  Doug Kwan  <dougkwan@google.com>
10307
10308         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10309         (Target_arm::do_finalize_sections): Add parameter for symbol table
10310         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10311         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10312         parameter for symbol table pointer.
10313         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10314         an additional parameter for a pointer to symbol table.
10315         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10316         parameter for a symbol table pointer.
10317         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10318         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10319         Ditto.
10320         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10321         parameter for a symbol table pointer.
10322
10323 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10324
10325         * incremental.cc (Incremental_inputs_header)
10326         (Incremental_inputs_header_write, Incremental_inputs_entry)
10327         (Incremental_inputs_entry_write): Move ...
10328         * incremental.h (Incremental_inputs_header)
10329         (Incremental_inputs_header_write, Incremental_inputs_entry)
10330         (Incremental_inputs_entry_write): here.
10331
10332 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10333
10334         * incremental.cc (make_sized_incremental_binary): Set the target.
10335         Error if it is incompatible.
10336         * output.h (Output_file): Add filename method.
10337
10338 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10339
10340         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10341         from the get_* methods.
10342
10343 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10344
10345         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10346         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10347         Write 0 for the data_offset of scripts.
10348
10349 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10350
10351         * testsuite/Makefile.am: Add the incremental_test.sh test.
10352         * testsuite/incremental_test.sh: New.
10353         * testsuite/incremental_test_1.c: New.
10354         * testsuite/incremental_test_2.c: New.
10355
10356 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10357
10358         * incremental-dump.cc (main): Fix typos.
10359
10360 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10361
10362         PR gold/11025
10363         * incremental-dump.cc (main): Use llu to print 64 bit values.
10364
10365 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10366             H.J. Lu  <hongjiu.lu@intel.com>
10367
10368         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10369         $(LIBDL).
10370         (incremental_dump_LDADD): Likewise.
10371         * Makefile.in: Regenerated.
10372
10373 2009-11-25  Doug Kwan  <dougkwan@google.com>
10374
10375         Revert:
10376
10377         2009-11-25  Doug Kwan  <dougkwan@google.com>
10378
10379                 * arm.cc (Target_arm::Target_arm): Move method definition
10380                 outside of class definition.  Add code to handle
10381                 --target1-rel, --target1-abs and --target2= options.
10382                 (Target_arm::get_reloc_reloc_type): Change method to be
10383                 non-static and const.
10384                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10385                 New data member declaration.
10386                 (Target_arm::Scan::local, Target_arm::Scan::global,
10387                 Target_arm::Relocate::relocate,
10388                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10389                 Adjust call to Target_arm::get_real_reloc_type.
10390                 (Target_arm::get_real_reloc_type): Use command line options
10391                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10392                 * options.h (--target1-rel, --target1-abs, --target2): New
10393                 ARM-only options.
10394
10395 2009-11-25  Doug Kwan  <dougkwan@google.com>
10396
10397         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10398         class definition.  Add code to handle --target1-rel, --target1-abs
10399         and --target2= options.
10400         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10401         and const.
10402         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10403         member declaration.
10404         (Target_arm::Scan::local, Target_arm::Scan::global,
10405         Target_arm::Relocate::relocate,
10406         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10407         call to Target_arm::get_real_reloc_type.
10408         (Target_arm::get_real_reloc_type): Use command line options to
10409         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10410         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10411         options.
10412
10413 2009-11-25  Doug Kwan  <dougkwan@google.com>
10414
10415         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10416         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10417         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10418         formatting.
10419         (Arm_relocate_functions::thm_call): Replace body with a call to
10420         Arm_relocate_functions::thumb_branch_common.
10421         (Arm_relocate_functions::thm_jump24,
10422         Arm_relocate_functions::thm_xpc22): New method definitions.
10423         (Arm_relocate_functions::thumb_branch_common): New method definition.
10424         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10425         operator.
10426         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10427         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10428
10429 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10430
10431         * Makefile.am: Build incremental-dump
10432         * Makefile.in: Regenerate.
10433         * incremental-dump.cc: New.
10434         * incremental.cc (Incremental_inputs_header_data,
10435         Incremental_inputs_entry_data): Move to incremental.h
10436         * incremental.h: (Incremental_inputs_header_data,
10437         Incremental_inputs_entry_data): Move from incremental.cc
10438
10439 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10440
10441         * incremental.cc (Incremental_inputs_header,
10442         Incremental_inputs_header_write, Incremental_inputs_entry,
10443         Incremental_inputs_entry_write): Add a typedef with the data type.
10444
10445 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10446
10447         * incremental.cc (Incremental_inputs_header,
10448         Incremental_inputs_header_write, Incremental_inputs_entry,
10449         Incremental_inputs_entry_write): Update comment about which
10450         type has the filed descriptions.
10451
10452 2009-11-15  Doug Kwan  <dougkwan@google.com>
10453
10454         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10455         (Arm_relocate_functions::arm_branch_common): Change method defintion
10456         in class definition to a method declaration and update list of formal
10457         parameters.
10458         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10459         Arm_relocation_functions::jump24): Adjust call to
10460         Arm_relocate_functions::arm_branch_common.  Update list of formal
10461         parameters.
10462         (Arm_relocate_functions::xpc25): New method definition.
10463         (Arm_relocate_functions::arm_branch_common): Move method defintion
10464         out from class definition.  Use stubs for mode-switching and extending
10465         branch ranges.
10466         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10467         specially.  Change code to enable use of stubs in ARM branches.
10468
10469 2009-11-10  Doug Kwan  <dougkwan@google.com>
10470
10471         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10472         in method declaration.
10473         (Target_arm::relocate_stub): New method declaration.
10474         (Target_arm::default_target): Change to return a pointer instead of
10475         a const reference.
10476         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10477         Target_arm::default_target.
10478         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10479         method definition.
10480         (Target_arm::relocate_section): Adjust view.
10481         (Target_arm::relocate_stub): New method definition.
10482
10483 2009-11-10  Doug Kwan  <dougkwan@google.com>
10484
10485         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10486         a format warning.
10487         * incremental.cc (open_incremental_binary): Initialized local
10488         variables to avoid warnings.
10489         * object.cc (make_elf_object): Ditto.
10490         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10491         a format warning.
10492
10493 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10494
10495         PR gold/10930
10496         * testsuite/plugin_test.c: Include "config.h".
10497
10498 2009-11-09  Doug Kwan  <dougkwan@google.com>
10499
10500         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10501         (arm_symbol_value): Remove.
10502         (Arm_relocate_functions::arm_branch_common,
10503         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10504         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10505         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10506         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10507         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10508         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10509         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10510         Arm_relocate_functions::thm_mobw_abs_nc,
10511         Arm_relocate_functions::thm_mov_abs,
10512         Arm_relocate_functions::movw_prel_nc,
10513         Arm_relocate_functions::thm_movt_abs,
10514         Arm_relocate_functions::movt_prel,
10515         Arm_relocate_functions::thm_movw_prel_nc,
10516         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10517         (Target_arm::Relocate::relocate): Only decompose address into two
10518         parts if relocation type uses the thumb-bit and pass the actual
10519         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10520         calls to methods in Arm_relocate_functions for this change.
10521
10522 2009-11-08  Ian Lance Taylor  <iant@google.com>
10523
10524         PR 10925
10525         * reloc.cc: Instantiate
10526         Sized_relobj::initialize_input_to_output_maps and
10527         Sized_relobj:free_input_to_output_maps.
10528
10529 2009-11-06  Ian Lance Taylor  <iant@google.com>
10530
10531         PR 10876
10532         * defstd.cc (in_segment): Set only_if_ref true for "end".
10533
10534 2009-11-06  Doug Kwan  <dougkwan@google.com>
10535
10536         * arm.cc (class Reloc_stub): Correct a comment.
10537         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10538         (Target_arm::scan_section_for_stubs): New method declaration.
10539         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10540         Change methods from private to protected.
10541         (Target_arm::do_may_relax): New method definition.
10542         (Target_arm::do_relax, Target_arm::group_sections,
10543         Target_arm::scan_reloc_for_stub,
10544         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10545         (Target_arm::arm_input_section_map_): New data member declaration.
10546         (Target_arm::scan_reloc_for_stub,
10547         Target_arm::scan_reloc_section_for_stubs,
10548         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10549         Target_arm::do_relax): New method definitions.
10550
10551 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10552
10553         * configure.ac: Check for (struct stat)::st_mtim
10554         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10555         * config.in: Regenerate.
10556         * configure: Regenerate.
10557
10558 2009-11-05  Ian Lance Taylor  <iant@google.com>
10559
10560         PR 10910
10561         * output.cc (Output_segment::add_output_section): Add missing
10562         return statement.
10563
10564 2009-11-04  Ian Lance Taylor  <iant@google.com>
10565
10566         PR 10880
10567         * object.h (class Object): Add is_needed and set_is_needed
10568         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10569         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10570         defined in a dynamic object and referenced by a regular object,
10571         set is_needed for the dynamic object.
10572         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10573         if the file is marked with as_needed and it is not needed.
10574
10575 2009-11-04  Ian Lance Taylor  <iant@google.com>
10576
10577         PR 10887
10578         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10579         tags if data is discarded by linker script.
10580         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10581         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10582         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10583         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10584
10585 2009-11-04  Ian Lance Taylor  <iant@google.com>
10586
10587         * layout.cc (Layout::get_output_section): Add is_interp and
10588         is_dynamic_linker_section parameters.  Change all callers.
10589         (Layout::choose_output_section): Likewise.
10590         (Layout::make_output_section): Likewise.
10591         (Layout::add_output_section_data): Add is_dynamic_linker_section
10592         parameter.  Change all callers.
10593         * layout.h (class Layout): Update declarations.
10594         * output.h (class Output_section): Add is_interp, set_is_interp,
10595         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10596         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10597         generate_code_fills_at_write_ to a bitfield.
10598         * output.cc (Output_section::Output_sections): Initialize new
10599         fields.
10600         (Output_segment::add_output_section): Add do_sort parameter.
10601         Change all callers.
10602
10603 2009-11-03  Ian Lance Taylor  <iant@google.com>
10604
10605         PR 10860
10606         * options.h (class General_options): Add --warn-common.
10607         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10608         merging two common symbols.
10609         (Symbol_table::should_override): Handle --warn-common when merging
10610         a common symbol with a defined symbol.  Use report_resolve_problem
10611         for multiple definitions.
10612         (Symbol_table::report_resolve_problem): New function.
10613         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10614
10615 2009-11-03  Doug Kwan  <dougkwan@google.com>
10616
10617         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10618         stub_factory_.
10619         (Target_arm::stub_factory): New method definition.
10620         (Target_arm::new_arm_input_section,
10621         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10622         Target_arm::reloc_uses_thumb_bit): New method declarations.
10623         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10624         New type definitions.
10625         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10626         member declarations.
10627         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10628         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10629         New method definitions.
10630
10631 2009-11-03  Ian Lance Taylor  <iant@google.com>
10632
10633         * options.h (class General_options): Add --warn_constructors.
10634
10635 2009-11-03  Ian Lance Taylor  <iant@google.com>
10636
10637         PR 10893
10638         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10639         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10640
10641 2009-11-03  Ian Lance Taylor  <iant@google.com>
10642
10643         PR 10895
10644         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10645         --msgid-bugs-address.
10646         (install-pdf): New target.
10647         (install-data_yes): Look up one directory to find mkinstalldirs.
10648
10649 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10650
10651         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10652         tree.
10653
10654 2009-10-30  Doug Kwan  <dougkwan@google.com>
10655
10656         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10657
10658 2009-10-30  Doug Kwan  <dougkwan@google.com>
10659
10660         * arm.cc (Stub_addend_reader): New struct template definition
10661         and partial specializations.
10662         (Stub_addend_reader::operator()): New method definition for a
10663         partially specialized template.
10664
10665 2009-10-30  Doug Kwan  <dougkwan@google.com>
10666
10667         * arm.cc (Arm_relobj::processor_specific_flags): New method
10668         definition.
10669         (Arm_relobj::do_read_symbols): New method declaration.
10670         (Arm_relobj::processor_specific_flags_): New data member declaration.
10671         (Arm_dynobj): New class definition.
10672         (Target_arm::do_finalize_sections): Add input_objects parameter.
10673         (Target_arm::do_adjust_elf_header): New method declaration.
10674         (Target_arm::are_eabi_versions_compatible,
10675         (Target_arm::merge_processor_specific_flags): New method declaration.
10676         (Target_arm::do_make_elf_object): New overloaded method definitions
10677         and declaration.
10678         (Arm_relobj::do_read_symbols): New method definition.
10679         (Arm_dynobj::do_read_symbols): Ditto.
10680         (Target_arm::do_finalize_sections): Add input_objects parameters.
10681         Merge processor-specific flags from all input objects.
10682         (Target_arm::are_eabi_versions_compatible,
10683         Target_arm::merge_processor_specific_flags,
10684         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10685         New method definitions.
10686         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10687         Input_objects pointer type parameter.
10688         * layout.cc (Layout::finalize): Pass input objects to target's.
10689         finalize_sections function.
10690         * output.cc (Output_file_header::do_sized_write): Set ELF file
10691         header's processor-specific flags.
10692         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10693         Input_objects pointer type parameter.
10694         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10695         * target.h (Input_objects): New forward class declaration.
10696         (Target::processor_specific_flags,
10697         Target::are_processor_specific_flags_sect): New method definitions.
10698         (Target::finalize_sections): Add input_objects parameter.
10699         (Target::Target): Initialize processor_specific_flags_ and
10700         are_processor_specific_flags_set_.
10701         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10702         parameter.
10703         (Target::set_processor_specific_flags): New method definition.
10704         (Target::processor_specific_flags_,
10705         Target::are_processor_specific_flags_set_): New data member
10706         declarations.
10707         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10708         Input_objects pointer type parameter.
10709
10710 2009-10-30  Doug Kwan  <dougkwan@google.com>
10711
10712         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10713
10714 2009-10-28  Ian Lance Taylor  <iant@google.com>
10715
10716         * object.h (class Relobj): Drop options parameter from
10717         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10718         do_scan_relocs, do_relocate.  Change all callers.
10719         (class Sized_relobj): Drop options parameters from
10720         do_gc_process_relocs, do_scan_relocs, do_relocate,
10721         do_relocate_sections, relocate_sections, emit_relocs_scan,
10722         emit_relocs_scan_reltype.  Change all callers.
10723         (struct Relocate_info): Remove options field and all references to
10724         it.
10725         * reloc.h (class Read_relocs): Remove options constructor
10726         parameter and options_ field.  Change all callers.
10727         (class Gc_process_relocs, class Scan_relocs): Likewise.
10728         (class Relocate_task): Likewise.
10729         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10730         all callers.
10731         (scan_relocatable_relocs): Likewise.
10732         * target.h (class Sized_target): Remove options parameter from
10733         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10734         all callers.
10735         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10736         callers.
10737         * arm.cc: Update functions to remove options parameters.
10738         * i386.cc: Likewise.
10739         * powerpc.cc: Likewise.
10740         * sparc.cc: Likewise.
10741         * x86_64.cc: Likewise.
10742         * testsuite/testfile.cc: Likewise.
10743
10744 2009-10-28  Doug Kwan  <dougkwan@google.com>
10745
10746         * arm.cc (Arm_relobj): New class definition.
10747         (Arm_relobj::scan_sections_for_stubs,
10748         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10749         New method definitions.
10750
10751 2009-10-28  Cary Coutant  <ccoutant@google.com>
10752
10753         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10754         (Plugin::cleanup_done_): New member.
10755         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10756         (Plugin_manager::cleanup_done_): Remove.
10757         (Plugin_manager::add_input_file): Edit error message.
10758         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10759         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10760
10761 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10762
10763         * fileread.cc: (File_read::View::~View): Use the new
10764         data_ownership_ filed.
10765         (File_read::~File_read): Dispose the new whole_file_view_.
10766         (File_read::open): Mmap the whole file if needed.
10767         (File_read::open): Use whole_file_view_ instead of contents_.
10768         (File_read::find_view): Use whole_file_view_ if applicable.
10769         (File_read::do_read): Use whole_file_view_ instead of contents_.
10770         (File_read::make_view): Use whole_file_view_ instead of contents_,
10771         update File_read::View::View call.
10772         (File_read::find_or_make_view): Update File_read::View::View
10773         call.
10774         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10775         remove contents_
10776         (File_read::View::Data_ownership): New enum.
10777         (File_read::View::View): Replace bool mapped_ with Data_ownership
10778         argument.
10779         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10780         (File_read::View::data_ownership_): New field.
10781         (File_read::contents_): Remove (replaced by whole_file_view_).
10782         (File_read::whole_file_view_): New field.
10783         * options.h (class General_options): Add --keep-files-mapped.
10784
10785 2009-10-27  Cary Coutant  <ccoutant@google.com>
10786
10787         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10788         * testsuite/Makefile.am (plugin_test_5): New test case.
10789         * testsuite/Makefile.in: Regenerate.
10790
10791 2009-10-25  Doug Kwan  <dougkwan@google.com>
10792
10793         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10794         from private to protected to allow access by child class.
10795         (Sized_relobj::do_relocate_sections): New method declaration.
10796         (Sized_relobj::relocate_sections): Virtualize.
10797         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10798         Sized_relobj::relocate_sections.  Instantiate template explicitly
10799         for different target sizes and endianity.
10800
10801 2009-10-24  Doug Kwan  <dougkwan@google.com>
10802
10803         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10804         (Arm_input_section::as_arm_input_section): New method.
10805         (Arm_output_section): New class definition.
10806         (Arm_output_section::create_stub_group,
10807         Arm_output_section::group_sections): New method definitions.
10808
10809 2009-10-22  Doug Kwan  <dougkwan@google.com>
10810
10811         * arm.cc (Arm_input_section): New class definition.
10812         (Arm_input_section::init, Arm_input_section:do_write,
10813         Arm_input_section::set_final_data_size,
10814         Arm_input_section::do_reset_address_and_file_offset): New method
10815         definitions.
10816
10817 2009-10-21  Doug Kwan  <dougkwan@google.com>
10818
10819         * arm.cc (Stub_table, Arm_input_section): New forward class
10820         declarations.
10821         (Stub_table): New class defintion.
10822         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10823         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10824         New method definition.
10825
10826 2009-10-21  Doug Kwan  <dougkwan@google.com>
10827
10828         * arm.cc: Update copyright comments.
10829         (Target_arm): New forward class template declaration.
10830         (Arm_address): New type.
10831         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10832         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10833         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10834         constants.
10835         (Insn_template): Same.
10836         (DEF_STUBS): New macro.
10837         (Stub_type): New enum type.
10838         (Stub_template): New class definition.
10839         (Stub): Same.
10840         (Reloc_stub): Same.
10841         (Stub_factory): Same.
10842         (Target_arm::Target_arm): Initialize may_use_blx_ and
10843         should_force_pic_veneer_.
10844         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10845         Target_arm::should_force_pic_veneer,
10846         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10847         Target_arm::using_thumb_only, Target_arm:;default_target): New
10848         method defintions.
10849         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10850         New data member declarations.
10851         (Insn_template::size, Insn_template::alignment): New method defintions.
10852         (Stub_template::Stub_template): New method definition.
10853         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10854         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10855         (Stub_factory::Stub_factory): New method definition.
10856         * gold.h (string_hash): New template.
10857         * output.h (Input_section_specifier::hash_value): Use
10858         gold::string_hash.
10859         (Input_section_specifier::string_hash): Remove.
10860         * stringpool.cc (Stringpool_template::string_hash): Use
10861         gold::string_hash.
10862
10863 2009-10-20  Doug Kwan  <dougkwan@google.com>
10864
10865         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10866         symbols of relaxed input sections.
10867         * output.h (Output_section::find_relaxed_input_section): Make
10868         method public.
10869
10870 2009-10-16  Doug Kwan  <dougkwan@google.com>
10871
10872         * dynobj.cc (Versions::Versions): Initialize version_script_.
10873         Only insert base version symbol definition for a shared object
10874         if version script defines any version versions.
10875         (Versions::define_base_version): New method definition.
10876         (Versions::add_def): Check that base version is not needed.
10877         (Versions::add_need): Define base version lazily.
10878         * dynobj.h (Versions::define_base_version): New method declaration.
10879         (Versions::needs_base_version_): New data member declaration.
10880         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10881         (check_DATA): Add no_version_test.stdout.
10882         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10883         New make rules.
10884         * testsuite/Makefile.in: Regenerate.
10885         * testsuite/no_version_test.c: New file.
10886         * testsuite/no_version_test.sh: Ditto.
10887
10888 2009-10-16  Doug Kwan  <dougkwan@google.com>
10889
10890         * expression.cc (class Segment_start_expression): New class definition.
10891         (Segment_start_expression::value): New method definition.
10892         (script_exp_function_segment_start): Return a new
10893         Segment_start_expression.
10894         * gold/script-c.h (script_saw_segment_start_expression): New function
10895         prototype.
10896         * script-sections.cc (Script_sections::Script_sections): Initialize
10897         SAW_SEGMENT_START_EXPRESSION_ to false.
10898         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10899         and -Tbbs options to specify section addresses if given in
10900         command line and no SEGMENT_START expression is seen in a script.
10901         * script-sections.h (Script_sections::saw_segment_start_expression,
10902         Script_sections::set_saw_segment_start_expression): New method
10903         definition.
10904         (Script_sections::saw_segment_start_expression_): New data member
10905         declaration.
10906         * script.cc (script_saw_segment_start_expression): New function.
10907         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10908         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10909         script_test_7.sh and script_test_8.sh.
10910         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10911         script_test_8.stdout.
10912         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10913         (script_test_6, script_test_6.stdout, script_test_7,
10914         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10915         * Makefile.in: Regenerate.
10916         * testsuite/script_test_6.sh: New file.
10917         * testsuite/script_test_6.t: Same.
10918         * testsuite/script_test_7.sh: Same.
10919         * testsuite/script_test_7.t: Same.
10920         * testsuite/script_test_8.sh: Same.
10921
10922 2009-10-16  Doug Kwan  <dougkwan@google.com>
10923
10924         * output.cc (Output_segment::set_section_list_address): Cast
10925         expressions to unsigned long long type to avoid format warnings.
10926
10927 2009-10-15  Ian Lance Taylor  <iant@google.com>
10928
10929         * script.cc (Script_options::add_symbol_assignment): Always add a
10930         dot assignment to script_sections_.
10931         * script-sections.cc (Script_sections::add_dot_assignment):
10932         Initialize if necessary.
10933
10934         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10935         program headers with no load segment if there is a linker script.
10936
10937         * layout.cc (Layout::set_segment_offsets): Align the file offset
10938         to the segment aligment for -N or -n with no load segment.
10939         * output.cc (Output_segment::add_output_section): Don't crash if
10940         the first section is a TLS section.
10941         (Output_segment::set_section_list_addresses): Print an error
10942         message if the address moves backward in a linker script.
10943         * script-sections.cc
10944         (Output_section_element_input::set_section_addresses): Don't
10945         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10946         (Orphan_output_section::set_section_addresses): Likewise.
10947
10948 2009-10-15  Doug Kwan  <dougkwan@google.com>
10949
10950         * layout.cc (Layout::finish_dynamic_section): Generate tags
10951         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10952         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10953         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10954
10955 2009-10-14  Ian Lance Taylor  <iant@google.com>
10956
10957         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10958         fields.
10959         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10960         data_shdr fields of relinfo.
10961         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10962         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10963         R_386_TLS_LDO_32, adjust based on section flags.
10964         (Target_i386::Relocate::fix_up_ldo): Remove.
10965
10966 2009-10-13  Ian Lance Taylor  <iant@google.com>
10967
10968         Add support for -pie.
10969         * options.h (class General_options): Add -pie and
10970         --pic-executable.
10971         (General_options::output_is_position_independent): Test -pie.
10972         (General_options::output_is_executable): Return true if not shared
10973         and not relocatable.
10974         (General_options::output_is_pie): Remove.
10975         * options.cc (General_options::finalize): Reject incompatible uses
10976         of -pie.
10977         * gold.cc (queue_middle_tasks): A -pie link is not static.
10978         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10979         * symtab.cc (Symbol::final_value_is_known): Return false if
10980         output_is_position_independent.
10981         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10982         output_is_position_independent.
10983         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10984         output_is_position_independent.
10985         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10986         output_is_position_independent.
10987         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10988         two_file_pie_test.
10989         (basic_pie_test.o, basic_pie_test): New targets.
10990         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10991         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10992         (two_file_pie_test): New target.
10993         * testsuite/Makefile.in: Rebuild.
10994         * README: Remove note saying that -pie is not supported.
10995
10996 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10997
10998         * options.h (class General_options): Add -init and -fini.
10999         * layout.cc (Layout::finish_dynamic_section): Emit
11000         given init and fini functions.
11001
11002 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11003
11004         * gc.h (gc_process_relocs): Check if icf is enabled using new
11005         function.
11006         * gold.cc (queue_initial_tasks): Likewise.
11007         (queue_middle_tasks): Likewise.
11008         * object.cc (do_layout): Likewise.
11009         * symtab.cc (is_section_folded): Likewise.
11010         * main.cc (main): Likewise.
11011         * reloc.cc (Read_relocs::run): Likewise.
11012         (Sized_relobj::do_scan_relocs): Likewise.
11013         * icf.cc (is_function_ctor_or_dtor): New function.
11014         (Icf::find_identical_sections): Check if function is ctor or dtor when
11015         safe icf is chosen.
11016         * options.h (General_options::icf): Change option to be an enum.
11017         (Icf_status): New enum.
11018         (icf_enabled): New method.
11019         (icf_safe_folding): New method.
11020         (set_icf_status): New method.
11021         (icf_status_): New variable.
11022         * (options.cc) (General_options::finalize): Set icf_status_.
11023         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11024         icf_test and icf_keep_unique_test to use the --icf enum flag.
11025         * testsuite/icf_safe_test.sh: New file.
11026         * testsuite/icf_safe_test.cc: New file.
11027
11028 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11029
11030         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11031         includes to gc.h and icf.h.
11032         * arm.cc: Include gc.h.
11033         * gold.cc: Likewise.
11034         * i386.cc: Likewise.
11035         * powerpc.cc: Likewise.
11036         * sparc.cc: Likewise.
11037         * x86_64.cc: Likewise.
11038         * gc.h: Include icf.h.
11039
11040 2009-10-11  Ian Lance Taylor  <iant@google.com>
11041
11042         * plugin.cc: Include "gold.h" before other header files.
11043
11044 2009-10-10  Chris Demetriou  <cgd@google.com>
11045
11046         * options.h (Input_file_argument::Input_file_type): New enum.
11047         (Input_file_argument::is_lib_): Replace with...
11048         (Input_file_argument::type_): New member.
11049         (Input_file_argument::Input_file_argument): Take Input_file_type
11050         'type' rather than boolean 'is_lib' as second argument.
11051         (Input_file_argument::is_lib): Use type_.
11052         (Input_file_argument::is_searched_file): New function.
11053         (Input_file_argument::may_need_search): Handle is_searched_file.
11054         * options.cc (General_options::parse_library): Support -l:filename.
11055         (General_options::parse_just_symbols): Update for Input_file_argument
11056         changes.
11057         (Command_line::process): Likewise.
11058         * archive.cc (Archive::get_file_and_offset): Likewise.
11059         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11060         * script.cc (read_script_file, script_add_file): Likewise.
11061         * fileread.cc (Input_file::Input_file): Likewise.
11062         (Input_file::will_search_for): Handle is_searched_file.
11063         (Input_file::open): Likewise.
11064         * readsyms.cc (Read_symbols::get_name): Likewise.
11065         * testsuite/Makefile.am (searched_file_test): New test.
11066         * testsuite/Makefile.in: Regenerate.
11067         * testsuite/searched_file_test.cc: New file.
11068         * testsuite/searched_file_test_lib.cc: New file.
11069
11070 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11071             Ian Lance Taylor  <iant@google.com>
11072
11073         * descriptor.cc: Include <cstdio> and "binary-io.h".
11074         (Descriptors::open): Open the files in binary mode always.
11075         * script.cc (Lex::get_token): Treat \r as whitespace.
11076
11077 2009-10-09  Ian Lance Taylor  <iant@google.com>
11078
11079         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11080
11081 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11082             Ian Lance Taylor  <iant@google.com>
11083
11084         * configure.ac: Check for readv function also.
11085         * fileread.cc (readv): Define if not HAVE_READV.
11086         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11087         does not exist.
11088         * config.in: Regenerate.
11089         * configure: Regenerate.
11090
11091 2009-10-09  Doug Kwan  <dougkwan@google.com>
11092
11093         * layout.cc (Layout::make_output_section): Call target hook to make
11094         ordinary output section.
11095         (Layout::finalize): Adjust parameter list of call the
11096         Target::may_relax().
11097         * layout.h (class Layout::section_list): New method.
11098         * merge.h (Output_merge_base::entsize): Change visibility to public.
11099         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11100         New methods.
11101         (Output_merge_string::do_is_string): New method.
11102         * object.cc (Sized_relobj::do_setup): renamed from
11103         Sized_relobj::set_up.
11104         * object.h (Sized_relobj::adjust_shndx,
11105         Sized_relobj::initializ_input_to_output_maps,
11106         Sized_relobj::free_input_to_output_maps): Change visibilities to
11107         protected.
11108         (Sized_relobj::setup): Virtualize.
11109         (Sized_relobj::do_setup): New method declaration.
11110         (Sized_relobj::invalidate_section_offset,
11111         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11112         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11113         * options.cc (parse_int): New function.
11114         * options.h (parse_int): New declaration.
11115         (DEFINE_int): New macro.
11116         (stub_group_size): New option.
11117         * output.cc (Output_section::Output_section): Initialize memebers
11118         merge_section_map_, merge_section_by_properties_map_,
11119         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11120         (Output_section::add_input_section): Handled deferred code-fill
11121         generation and remove an old comment.
11122         (Output_section::add_relaxed_input_section): New method definition.
11123         (Output_section::add_merge_input_section): Use merge section by
11124         properties map to speed to search.  Update merge section maps
11125         as appropriate.
11126         (Output_section::build_relaxation_map): New method definition.
11127         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11128         Same.
11129         (Output_section::relax_input_section): Renamed to
11130         Output_section::convert_input_sections_to_relaxed_sections and change
11131         interface to take a vector of pointers to relaxed sections.
11132         (Output_section::find_merge_section,
11133         Output_section::find_relaxed_input_section): New method definitions.
11134         (Output_section::is_input_address_mapped,
11135         Output_section::output_offset, Output_section::output_address):
11136         Use output section data maps to speed up searching.
11137         (Output_section::find_starting_output_address): Add comments.
11138         (Output_section::do_write,
11139         Output_section::write_to_postprocessing_buffer): Do code-fill
11140         generation as appropriate.
11141         (Output_section::get_input_sections): Invalidate relaxed input section
11142         map.
11143         (Output_section::restore_states): Adjust type of checkpoint .
11144         Invalidate relaxed input section map.
11145         * output.h (Output_merge_base): New class declaration.
11146         (Input_section_specifier): New class defintion.
11147         (class Output_relaxed_input_section) Change base class to
11148         Output_section_data_build.
11149         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11150         base class initializer.
11151         (Output_section::add_relaxed_input_section): New method declaration.
11152         (Output_section::Input_section): Change visibility to protected.
11153         (Output_section::Input_section::relobj,
11154         Output_section::Input_section::shndx): Handle relaxed input sections.
11155         Output_section::input_sections) Change visibility to protected.  Also
11156         define overload to return a non-const pointer.
11157         (Output_section::Merge_section_properties): New class defintion.
11158         (Output_section::Merge_section_by_properties_map,
11159         Output_section::Output_section_data_by_input_section_map,
11160         Output_section::Relaxation_map): New types.
11161         (Output_section::relax_input_section): Rename method to
11162         Output_section::convert_input_sections_to_relaxed_sections and change
11163         interface to take a vector of relaxed section pointers.
11164         (Output_section::find_merge_section,
11165         Output_section::find_relaxed_input_section,
11166         Output_section::build_relaxation_map,
11167         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11168         New method declarations.
11169         (Output_section::merge_section_map_
11170         Output_section::merge_section_by_properties_map_,
11171         Output_section::relaxed_input_section_map_,
11172         Output_section::is_relaxed_input_section_map_valid_,
11173         Output_section::generate_code_fills_at_write_): New data members.
11174         * script-sections.cc
11175         (Output_section_element_input::set_section_addresses): Call
11176         current_data_size and addralign methods of relaxed input sections.
11177         (Orphan_output_section::set_section_addresses): Call current_data_size
11178         and addralign methods of relaxed input sections.
11179         * symtab.cc (Symbol_table::compute_final_value): Extract template
11180         from the body of Symbol_table::sized_finalize_symbol.
11181         (Symbol_table::sized_finalized_symbol): Call
11182         Symbol_table::compute_final_value.
11183         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11184         (Symbol_table::compute_final_value): New templated method declaration.
11185         * target.cc (Target::do_make_output_section): New method defintion.
11186         * target.h (Target::make_output_section): New method declaration.
11187         (Target::relax): Add more parameters for input objects, symbol table
11188         and layout.  Adjust call to do_relax.
11189         (Target::do_make_output_section): New method declaration.
11190         (Target::do_relax): Add parameters for input objects, symbol table
11191         and layout.
11192
11193 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11194
11195         * pread.c: Include stdio.h.
11196
11197 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11198
11199         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11200         defined.
11201
11202 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11203
11204         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11205         Change read_shndx type to unsigned int.
11206         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11207         int.
11208         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11209         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11210         Change read_shndx type to unsigned int.
11211         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11212         int.
11213         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11214         * layout.cc (Layout::create_symtab_sections): Cast the result of
11215         local_symcount * symsize to off_t in the gold_assert.
11216
11217 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11218
11219         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11220         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11221         R_ARM_BASE_ABS.
11222         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11223         (Arm_relocate_functions::thm_abs5): New function.
11224         (Arm_relocate_functions::abs12): New function.
11225         (Arm_relocate_functions::abs16): New function.
11226         (Arm_relocate_functions::base_abs): New function.
11227         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11228         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11229         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11230         R_ARM_BASE_ABS.
11231         (Scan::global): Likewise.
11232         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11233         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11234         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11235         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11236         R_ARM_BASE_ABS.
11237
11238 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11239
11240         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11241         (Arm_relocate_functions::movt_prel): New function.
11242         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11243         (Arm_relocate_functions::thm_movt_prel): New function.
11244         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11245         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11246         (Scan::global, Relocate::relocate): Likewise.
11247         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11248
11249 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11250
11251         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11252         Incremental_checker.
11253         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11254         unsigned int.
11255         (class Incremental_inputs_header): New class.
11256         (Incremental_inputs_header_writer): Edit comment.
11257         (Incremental_inputs_entry): New class.
11258         (Incremental_inputs_entry_writer): Edit comment.
11259         (Sized_incremental_binary::do_find_incremental_inputs_section):
11260         Add *strtab_shndx parameter, fill it.
11261         (Sized_incremental_binary::do_check_inputs): New method.
11262         (Incremental_checker::can_incrementally_link_output_file): Use
11263         Sized_incremental_binary::check_inputs.
11264         (Incremental_inputs::report_command_line): Save command line in
11265         command_line_.
11266         * incremental.h:
11267         (Incremental_binary::find_incremental_inputs_section): New
11268         method.
11269         (Incremental_binary::do_find_incremental_inputs_section): Add
11270         strtab_shndx parameter.
11271         (Incremental_binary::do_check_inputs): New pure virtual method.
11272         (Sized_incremental_binary::do_check_inputs): Declare.
11273         (Incremental_checker::Incremental_checker): Add incremental_inputs
11274         parameter, use it to initialize incremental_inputs_.
11275         (Incremental_checker::incremental_inputs_): New field.
11276         (Incremental_checker::command_line): New method.
11277         (Incremental_checker::inputs): New method.
11278         (Incremental_checker::command_line_): New field.
11279
11280 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11281
11282         * incremental.cc: Include <cstdarg> and "target-select.h".
11283         (vexplain_no_incremental): New function.
11284         (explain_no_incremental): New function.
11285         (Incremental_binary::error): New method.
11286         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11287         method.
11288         (make_sized_incremental_binary): New function.
11289         (open_incremental_binary): New function.
11290         (can_incrementally_link_file): Add checks if output is ELF and has
11291         inputs section.
11292         * incremental.h: Include "elfcpp_file.h" and "output.h".
11293         (Incremental_binary): New class.
11294         (Sized_incremental_binary): New class.
11295         (open_incremental_binary): Declare.
11296         * object.cc (is_elf_object): Use
11297         elfcpp::Elf_recognizer::is_elf_file.
11298         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11299         * output.h (Output_file::filesize): New method.
11300
11301 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11302
11303         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11304         New function.
11305         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11306         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11307         function.
11308         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11309         function.
11310         (Arm_relocate_functions::movw_abs_nc): New function.
11311         (Arm_relocate_functions::movt_abs): New function.
11312         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11313         (Arm_relocate_functions::thm_movt_abs): New function.
11314         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11315         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11316         (Scan::global): Likewise.
11317         (Relocate::relocate): Likewise.
11318         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11319
11320 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11321
11322         * arm.cc (Arm_relocate_functions::got_prel) New function.
11323         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11324         (Relocate::relocate): Likewise.
11325         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11326
11327 2009-10-06  Ian Lance Taylor  <iant@google.com>
11328
11329         * options.h (class General_options): Define
11330         split_stack_adjust_size parameter.
11331         * object.h (class Object): Add uses_split_stack_ and
11332         has_no_split_stack_ fields.  Add uses_split_stack and
11333         has_no_split_stack accessor functions.  Declare
11334         handle_split_stack_section.
11335         (class Reloc_symbol_changes): Define.
11336         (class Sized_relobj): Define Function_offsets.  Declare
11337         split_stack_adjust, split_stack_adjust_reltype, and
11338         find_functions.
11339         * object.cc (Object::handle_split_stack_section): New function.
11340         (Sized_relobj::do_layout): Call handle_split_stack_section.
11341         * dynobj.cc (Sized_dynobj::do_layout): Call
11342         handle_split_stack_section.
11343         * reloc.cc (Sized_relobj::relocate_sections): Call
11344         split_stack_adjust for executable sections in split_stack
11345         objects.  Pass reloc_map to relocate_section.
11346         (Sized_relobj::split_stack_adjust): New function.
11347         (Sized_relobj::split_stack_adjust_reltype): New function.
11348         (Sized_relobj::find_functions): New function.
11349         * target-reloc.h: Include "object.h".
11350         (relocate_section): Add reloc_symbol_changes parameter.  Change
11351         all callers.
11352         * target.h (class Target): Add calls_non_split method.  Declare
11353         do_calls_non_split virtual method.  Declare match_view and
11354         set_view_to_nop.
11355         * target.cc: Include "elfcpp.h".
11356         (Target::do_calls_non_split): New function.
11357         (Target::match_view): New function.
11358         (Target::set_view_to_nop): New function.
11359         * gold.cc (queue_middle_tasks): Give an error if mixing
11360         split-stack and non-split-stack objects with -r.
11361         * i386.cc (Target_i386::relocate_section): Add
11362         reloc_symbol_changes parameter.
11363         (Target_i386::do_calls_non_split): New function.
11364         * x86_64.cc (Target_x86_64::relocate_section): Add
11365         reloc_symbol_changes parameter.
11366         (Target_x86_64::do_calls_non_split): New function.
11367         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11368         parameter.
11369         * powerpc.cc (Target_powerpc::relocate_section): Add
11370         reloc_symbol_changes parameter.
11371         * sparc.cc (Target_sparc::relocate_section): Add
11372         reloc_symbol_changes parameter.
11373         * configure.ac: Call AM_CONDITIONAL for the default target.
11374         * configure: Rebuild.
11375         * testsuite/Makefile.am (TEST_AS): New variable.
11376         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11377         (check_DATA): Add split_i386 and split_x86_64 files.
11378         (SPLIT_DEFSYMS): Define.
11379         (split_i386_[1234n].o): New targets.
11380         (split_i386_[124]): New targets.
11381         (split_i386_[1234r].stdout): New targets.
11382         (split_x86_64_[1234n].o): New targets.
11383         (split_x86_64_[124]): New targets.
11384         (split_x86_64_[1234r].stdout): New targets.
11385         (MOSTLYCLEANFILES): Add new executables.
11386         * testsuite/split_i386.sh: New file.
11387         * testsuite/split_x86_64.sh: New file.
11388         * testsuite/split_i386_1.s: New file.
11389         * testsuite/split_i386_2.s: New file.
11390         * testsuite/split_i386_3.s: New file.
11391         * testsuite/split_i386_4.s: New file.
11392         * testsuite/split_i386_n.s: New file.
11393         * testsuite/split_x86_64_1.s: New file.
11394         * testsuite/split_x86_64_2.s: New file.
11395         * testsuite/split_x86_64_3.s: New file.
11396         * testsuite/split_x86_64_4.s: New file.
11397         * testsuite/split_x86_64_n.s: New file.
11398         * testsuite/testfile.cc (Target_test): Update relocation_section
11399         function.
11400         * testsuite/Makefile.in: Rebuild.
11401
11402 2009-10-06  Ian Lance Taylor  <iant@google.com>
11403
11404         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11405         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11406         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11407         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11408         the address on ldo_addrs_.
11409         (Target_i386::Relocate::fix_up_ldo): New function.
11410
11411 2009-10-06   Rafael Espindola  <espindola@google.com>
11412
11413         * plugin.cc (add_input_library): New.
11414         (Plugin::load): Add add_input_library to tv.
11415         (Plugin_manager::add_input_file): Add the is_lib argument.
11416         (add_input_file): Update call to Plugin_manager::add_input_file.
11417         (add_input_library): New.
11418         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11419
11420 2009-09-30  Doug Kwan  <dougkwan@google.com>
11421
11422         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11423         symbol and call Symbol::may_need_copy_reloc to determine if
11424         a copy reloc is needed.
11425         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11426         nocopyreloc is given in command line.
11427         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11428         given in command line.
11429         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11430         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11431         of the removed Target_i386::may_need_copy_reloc.
11432         * options.h (copyreloc): New option with default value false.
11433         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11434         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11435         instead of the removed Target_powerpc::may_need_copy_reloc.
11436         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11437         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11438         instead of the removed Target_sparc::may_need_copy_reloc.
11439         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11440         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11441         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11442         instead of the removed Target_x86_64::may_need_copy_reloc.
11443
11444 2009-09-30  Ian Lance Taylor  <iant@google.com>
11445
11446         * object.h (class Object): Remove target_ field, and target,
11447         sized_target, and set_target methods.
11448         (Object::sized_target): Remove.
11449         (class Sized_relobj): Update declarations.  Remove sized_target.
11450         * object.cc (Sized_relobj::setup): Remove target parameter.
11451         Change all callers.
11452         (Input_objects::add_object): Don't do anything with the target.
11453         (make_elf_sized_object): Add punconfigured parameter.  Change all
11454         callers.  Set or test parameter target.
11455         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11456         Change all callers.
11457         * parameters.cc (Parameters::set_target): Change parameter type to
11458         be non-const.
11459         (Parameters::default_target): Remove.
11460         (set_parameters_target): Change parameter type to be non-const.
11461         (parameters_force_valid_target): New function.
11462         (parameters_clear_target): New function.
11463         * parameters.h (class Parameters): Update declarations.  Remove
11464         default_target method.  Add sized_target and clear_target
11465         methods.  Change target_ to be non-const.
11466         (set_parameters_target): Update declaration.
11467         (parameters_force_valid_target): Declare.
11468         (parameters_clear_target): Declare.
11469         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11470         as NULL if we aren't searching.
11471         (Add_symbols::run): Don't check for compatible target.
11472         * fileread.cc (Input_file::open_binary): Call
11473         parameters_force_valid_target.
11474         * gold.cc (queue_middle_tasks): Likewise.
11475         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11476         set_target on object.
11477         * dynobj.h (class Sized_dynobj): Update declarations.
11478         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11479         make_elf_object returns NULL.
11480         (Archive::include_member): Don't check whether object target is
11481         compatible.
11482         * output.cc (Output_section::add_input_section): Get target from
11483         parameters.
11484         (Output_section::relax_input_section): Likewise.
11485         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11486         parameters.
11487         (Sized_relobj::do_scan_relocs): Likewise.
11488         (Sized_relobj::relocate_sections): Likewise.
11489         * resolve.cc (Symbol_table::resolve): Likewise.
11490         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11491         parameter.  Change all callers.
11492         (Symbol_table::add_from_object): Get target from parameters.
11493         (Symbol_table::add_from_relobj): Don't check object target.
11494         (Symbol_table::add_from_dynobj): Likewise.
11495         (Symbol_table::define_special_symbol): Get target from
11496         parameters.
11497         * symtab.h (class Symbol_table): Update declaration.
11498         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11499         parameter.  Change all callers.  Clear parameter target.
11500         (Binary_test): Test target here.
11501         * testsuite/object_unittest.cc (gold_testsuite): Remove
11502         target_test_pointer parameter.  Change all callers.
11503         (Object_test): Test target here.
11504
11505 2009-09-26  Ian Lance Taylor  <iant@google.com>
11506
11507         * testsuite/initpri1.c: Don't try to use constructor priorities if
11508         compiling with gcc before 4.3.
11509
11510 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11511
11512         * testsuite/retain_symbols_file_test.sh (check_present): Change
11513         output file name to retain_symbols_file_test.stdout.
11514         (check_absent): Likewise.
11515
11516 2009-09-18  Craig Silverstein  <csilvers@google.com>
11517
11518         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11519         * options.cc: Include <cerrno> and <fstream>.
11520         (General_options::finalize): Parse -retain-symbols-file tag.
11521         * options.h: New flag.
11522         (General_options): New method should_retain_symbol, new
11523         variable symbols_to_retain.
11524         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11525         should_retain_symbol map.
11526         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11527         * testsuite/Makefile.in: Regenerate.
11528         * testsuite/retain_symbols_file_test.sh: New file.
11529
11530 2009-09-18  Nick Clifton  <nickc@redhat.com>
11531
11532         * po/es.po: Updated Spanish translation.
11533
11534 2009-09-17  Doug Kwan  <dougkwan@google.com>
11535
11536         * debug.h (DEBUG_RELAXATION): New constant.
11537         (DEBUG_ALL): Add DEBUG_RELAXATION.
11538         (debug_string_to_enum): Add relaxation debug option.
11539         * layout.cc
11540         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11541         Layout::Relaxation_debug_check::read_sections,
11542         Layout::Relaxation_debug_check::read_sections): New method definitions.
11543         (Layout::Layout): Initialize data members
11544         record_output_section_data_from_scrips_,
11545         script_output_section_data_list_ and relaxation_debug_check_.
11546         (Layout::save_segments, Layout::restore_segments,
11547         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11548         Layout::relaxation_loop_body): New method definitions.
11549         (Layout::finalize): Support relaxation.  Move section layout code to
11550         Layout::relaxation_loop_body.
11551         (Layout::set_asection_address_from_script): Move code for orphan
11552         section placement out.
11553         (Layout::place_orphan_sections_in_script): New method definition.
11554         * layout.h (Output_segment_headers, Output_file_header):
11555         New forward class declarations.
11556         (Layout::~Layout): Define.
11557         (Layout::new_output_section_data_from_script): New method definition.
11558         (Layout::place_orphan_sections_in_script): New method declaration.
11559         (Layout::Segment_states): New type declaration.
11560         (Layout::save_segments, Layout::restore_segments,
11561         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11562         Layout::relaxation_loop_body): New method declarations.
11563         (Layout::Output_section_data_list): New type declaration.
11564         (Layout::Relaxation_debug_check): New class definition.
11565         (Layout::record_output_section_data_from_script_,
11566         Layout::script_output_section_data_list_, Layout::segment_states_,
11567         Layout::relaxation_debug_check_): New data members.
11568         * output.cc: (Output_section_headers::do_size): New method definition.
11569         (Output_section_headers::Output_section_headers): Move size
11570         computation to Output_section_headers::do_size.
11571         (Output_segment_headers::do_size): New method definition.
11572         (Output_file_header::Output_file_header): Move size computation to
11573         Output_file_header::do_size and call it.
11574         (Output_file_header::do_size): New method definition.
11575         (Output_data_group::Output_data_group): Adjust call to
11576         Output_section_data.
11577         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11578         (Output_symtab_xindex::do_write): Add array bound check.
11579         (Output_section::Input_section::print_to_mapfile): Handle
11580         RELAXED_INPUT_SECTION_CODE.
11581         (Output_section::Output_section): Initialize data member checkpoint_.
11582         (Output_section::~Output_section): Delete checkpoint object pointed
11583         by checkpoint_.
11584         (Output_section::add_input_section): Always add an Input_section if
11585         relaxing.
11586         (Output_section::add_merge_input_section): Add assert.
11587         (Output_section::relax_input_section): New method definition.
11588         (Output_section::set_final_data_size): Set load address to zero for
11589         an unallocated section.
11590         (Output_section::do_address_and_file_offset_have_reset_values):
11591         New method definition.
11592         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11593         Handle relaxed input section.
11594         (Output_section::sort_attached_input_sections): Checkpoint input
11595         section list lazily.
11596         (Output_section::get_input_sections): Change type of input_sections to
11597         list of Simple_input_section pointers.  Checkpoint input section list
11598         lazily.  Also handle relaxed input sections.
11599         (Output_section::add_input_section_for_script): Take a reference to
11600         a Simple_input_section object instead of Relobj pointer and section
11601         index as parameter.  Handle relaxed input sections.
11602         (Output_section::save_states, Output_section::restore_states): New
11603         method definitions.
11604         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11605         (Output_data::is_data_size_fixed): New method definition.
11606         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11607         if it is fixed.
11608         (Output_data::address_and_file_offset_have_reset_values): New method
11609         definition.
11610         (Output_data::do_address_and_file_offset_have_reset_values): New method
11611         definition.
11612         (Output_data::set_data_size): Check that data size is not fixed.
11613         (Output_data::fix_data_size): New method definition.
11614         (Output_data::is_data_size_fixed_): New data member.
11615         (Output_section_headers::set_final_data_size): New method definition.
11616         (Output_section_headers::do_size): New method declaration.
11617         (Output_segment_headers::set_final_data_size): New method definition.
11618         (Output_segment_headers::do_size): New method declaration.
11619         (Output_file_header::set_final_data_size)::New method definition.
11620         (Output_file_header::do_size)::New method declaration.
11621         (Output_section_data::Output_section_data): Add new parameter
11622         is_data_size_fixed and use it to fix data size.
11623         (Output_data_const::Output_data_const): Adjust call to base class
11624         constructor and fix data size.
11625         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11626         base class constructor and fix data size.
11627         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11628         base class constructor and fix data size.
11629         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11630         class constructor and fix data size.
11631         (Output_data_group::set_final_data_size): New method definition.
11632         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11633         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11634         class constructor and fix data size.
11635         (Output_relaxed_input_section): New class definition.
11636         (Output_section::Simple_input_section): New class definition.
11637         (Output_section::get_input_sections): Adjust parameter list.
11638         (Output_section::add_input_section_for_script): Same.
11639         (Output_section::save_states, Output_section::restore_states,
11640         Output_section::do_address_and_file_offset_have_reset_values,
11641         (Output_section::Input_section::Input_section): Handle
11642         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11643         Output_relaxed_input_section.
11644         (Output_section::Input_section::is_input_section,
11645         Output_section::Input_section::set_output_section): Handle relaxed
11646         input section.
11647         (Output_section::Input_section::is_relaxed_input_section,
11648         Output_section::Input_section::output_section_data,
11649         Output_section::Input_section::relaxed_input_section): New method
11650         definitions.
11651         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11652         value.
11653         (Output_section::Input_section::u1_): Update comments.
11654         (Output_section::Input_section::u2_): Add new union member poris.
11655         (Output_section::Checkpoint_output_section): New classs definition.
11656         (Output_section::relax_input_section): New method declaration.
11657         (Output_section::checkpoint_): New data member.
11658         (Output_segment): Update comments.
11659         (Output_segment::Output_segment): Un-privatize copy constructor.
11660         (Output_segment::operator=): Un-privatize.
11661         * script-sections.cc (Output_section_element::Input_section_list):
11662         Change element type to Output_section::Simple_input_section.
11663         (Output_section_element_dot_assignment::set_section_addresses):
11664         Register output section data for relaxation clean up.
11665         (Output_data_exression::Output_data_expression): Adjust call to base
11666         constructor to fix data size.
11667         (Output_section_element_data::set_section_addresses): Register
11668         Output_data_expression object for relaxation clean up.
11669         (struct Input_section_info): Replace Relobj pointer and section index
11670         pair with Output_section::Simple_input_section and Convert struct to a
11671         class.
11672         (Input_section_sorter::operator()): Adjust access to
11673         Input_section_info data member to use accessors.
11674         (Output_section_element_input::set_section_addresses): Use layout
11675         parameter.  Adjust code to use Output_section::Simple_input_section
11676         and Input_secction_info classes.  Register filler for relaxation
11677         clean up.
11678         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11679         and section index pair with Output_section::Simple_input_section
11680         class.  Adjust code accordingly.
11681         (Phdrs_element::release_segment): New method definition.
11682         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11683         segment list.
11684         (Script_sections::release_segments): New method definition.
11685         * gold/script-sections.h (Script_sections::release_segments): New
11686         method declaration.
11687         * gold/target.h (Target::may_relax, Target::relax,
11688         Target::do_may_relax, Target::do_relax): New method definitions.
11689
11690 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11691
11692         * arm.cc (has_signed_unsigned_overflow): New function.
11693         (Arm_relocate_functions::abs8): New function.
11694         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11695         (Target_arm::Scan::global): Likewise.
11696         (Target_arm::relocate::relocate): Likewise.
11697         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11698         Likewise.
11699
11700 2009-09-16  Cary Coutant  <ccoutant@google.com>
11701
11702         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11703         * testsuite/Makefile.in: Regenerate.
11704
11705 2009-09-11  Nick Clifton  <nickc@redhat.com>
11706
11707         * po/gold.pot: Updated by the Translation project.
11708
11709 2009-09-08  Cary Coutant  <ccoutant@google.com>
11710
11711         * output.cc (Output_file::open): Add execute permission to empty file.
11712         * testsuite/Makefile.am (permission_test): New test.
11713         * testsuite/Makefile.in: Regenerate.
11714
11715 2009-09-02  Ian Lance Taylor  <iant@google.com>
11716
11717         * output.cc (Output_file::resize): Call map_no_anonymous rather
11718         than map.
11719
11720 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11721
11722         * gold.cc: Include "incremental.h".
11723         (queue_initial_tasks): Call Incremental_checker methods.
11724         * incremental.cc: Include "output.h".
11725         (Incremental_checker::can_incrementally_link_output_file): New
11726         method.
11727         * incremental.h (Incremental_checker): New class.
11728
11729         * output.cc (Output_file::open_for_modification): New method.
11730         (Output_file::map_anonymous): Changed return type to bool.  Record
11731         map in base_ field.
11732         (Output_file::map_no_anonymous): New method, broken out of map.
11733         (Output_file::map): Use map_no_anonymous and map_anonymous.
11734         * output.h (class Output_file): Update declarations.
11735
11736 2009-08-24  Cary Coutant  <ccoutant@google.com>
11737
11738         * options.h (Command_line::Pre_options): New class.
11739         (Command_line::pre_options): New member.
11740         * options.cc (gold::options::ready_to_register): New variable.
11741         (One_option::register_option): Do nothing if not registering options.
11742         Assert if same short option registered twice.
11743         (General_options::General_options): Turn off option registration when
11744         done constructing.
11745         (Command_line::Pre_options::Pre_options): New constructor.
11746
11747 2009-08-24  Cary Coutant  <ccoutant@google.com>
11748
11749         * options.h (General_options::no_keep_memory): Remove incorrect
11750         short option.
11751
11752 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11753
11754         * Makefile.am (am__skiplex, am__skipyacc): New.
11755         * Makefile.in: Regenerate.
11756
11757 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11758
11759         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11760         (INCLUDES): ... this.
11761         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11762         (AM_CPPFLAGS): Renamed from ...
11763         (INCLUDE): ... this.
11764         * Makefile.in, testsuite/Makefile.in: Regenerate.
11765
11766         * Makefile.in: Regenerate.
11767         * aclocal.m4: Likewise.
11768         * config.in: Likewise.
11769         * configure: Likewise.
11770         * testsuite/Makefile.in: Likewise.
11771
11772         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11773         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11774         * Makefile.in: Regenerate.
11775         * testsuite/Makefile.in: Regenerate.
11776
11777 2009-08-19  Cary Coutant  <ccoutant@google.com>
11778
11779         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11780         symbols in shared libraries overridden by hidden or internal symbols
11781         in the main program.
11782
11783 2009-08-19  Chris Demetriou  <cgd@google.com>
11784
11785         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11786         checking source file names in error messages.
11787
11788 2009-08-18  Doug Kwan  <dougkwan@google.com>
11789
11790         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11791         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11792         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11793         an elfcpp::Ehdr as parameter.
11794         * object.cc (Object::set_target): Remove the version that looks up
11795         a target and sets it.
11796         (Sized_relobj::setup): Take a Target object instead of
11797         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11798         (make_elf_sized_object): Find target and ask target to
11799         make an ELF object.
11800         * object.h: (Object::set_target): Remove the version that looks up
11801         a target and sets it.
11802         (Sized_relobj::setup): Take a Target object instead of
11803         an elfcpp:Ehdr as parameter.
11804         * target.cc: Include dynobj.h.
11805         (Target::do_make_elf_object_implementation): New.
11806         (Target::do_make_elf_object): New.
11807         * target.h (Target::make_elf_object): New template declaration.
11808         (Target::do_make_elf_object): New method declarations.
11809         (Target::do_make_elf_object_implementation): New template declaration.
11810
11811 2009-08-14  Ian Lance Taylor  <iant@google.com>
11812
11813         * gold.h (FUNCTION_NAME): Define.
11814         (gold_unreachable): Use FUNCTION_NAME.
11815
11816 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11817
11818         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11819         symbol in the --keep-unique list is not found.
11820
11821 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11822
11823         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11824         been maked as --keep-unique.
11825         (Icf::unfold_section): New function.
11826         * icf.h (Icf::unfold_section): New function.
11827         * options.h (General_options::keep_unique): New option.
11828         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11829         * testsuite/Makefile.in: Regenerate.
11830         * testsuite/icf_keep_unique_test.sh: New file.
11831         * testsuite/icf_keep_unique_test.cc: New file.
11832
11833 2009-08-12  Cary Coutant  <ccoutant@google.com>
11834
11835         PR 10471
11836         * resolve.cc (Symbol_table::resolve): Check for references from
11837         dynamic objects to hidden and internal symbols.
11838         * testsuite/Makefile.am (hidden_test.sh): New test.
11839         * testsuite/Makefile.in: Regenerate.
11840         * testsuite/hidden_test.sh: New script.
11841         * testsuite/hidden_test_1.c: New test source.
11842         * testsuite/hidden_test_main.c: New test source.
11843
11844 2009-08-11  Doug Kwan  <dougkwan@google.com>
11845
11846         * arm.cc: Update comments.
11847         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11848         segment to locate the .ARM.exidx section if present.
11849
11850 2009-08-09  Doug Kwan  <dougkwan@google.com>
11851
11852         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11853         patch.
11854
11855 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11856         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11857         compiler warnings.
11858
11859 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11860
11861         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11862         valid tls_segment only for non-debug-section relocations.
11863         * testsuite/Makefile.am: Add gc_tls_test.
11864         * testsuite/Makefile.in: Regenerate.
11865         * testsuite/gc_tls_test.cc: New file.
11866         * testsuite/gc_tls_test.sh: New file.
11867
11868 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11869
11870         * icf.cc: New file.
11871         * icf.h: New file.
11872         * Makefile.am (CCFILES): Add icf.cc.
11873         (HFILES): Add icf.h
11874         * Makefile.in: Regenerate.
11875         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11876         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11877         section, symbol and addend information for the relocs.
11878         * gold.cc (queue_middle_tasks): Call identical code folding.
11879         * gold.h: Add defines for multimap.
11880         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11881         to the call of finalize_local_symbols.
11882         * main.cc (main): Create object of class Icf.
11883         * object.cc (Sized_relobj::do_layout): Allow this function to be
11884         called twice during icf.
11885         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11886         to sections marked as identical by icf.
11887         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11888         when available.
11889         (Sized_relobj::do_section_entsize): New function.
11890         * object.h (Object::section_entsize): New function.
11891         (Object::do_section_entsize): New pure virtual function.
11892         (Relobj::finalize_local_symbols): Add new parameter.
11893         (Relobj::do_section_entsize): New function.
11894         * options.h (General_options::icf): New option.
11895         (General_options::icf_iterations): New option.
11896         (General_options::print_icf_sections): New option.
11897         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11898         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11899         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11900         icf.
11901         * symtab.cc (Symbol_table::is_section_folded): New function.
11902         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11903         to sections marked as identical by icf.
11904         * symtab.h (Symbol_table::set_icf): New function.
11905         (Symbol_table::icf): New function.
11906         (Symbol_table::is_section_folded): New function.
11907         (Symbol_table::icf_): New data member.
11908         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11909         * testsuite/Makefile.am: Add commands to build icf_test.
11910         * testsuite/Makefile.in: Regenerate.
11911         * testsuite/icf_test.sh: New file.
11912         * testsuite/icf_test.cc: New file.
11913
11914 2009-07-24  Chris Demetriou  <cgd@google.com>
11915
11916         * layout.cc (is_compressible_debug_section): Fix incorrect
11917         comment about compressed section names.
11918
11919 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11920
11921         PR 10419
11922         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11923
11924 2009-07-16  Ian Lance Taylor  <iant@google.com>
11925
11926         PR 10400
11927         * layout.h: #include <map>.
11928         (class Kept_section): Change from struct to class.  Add accessors
11929         and setters.  Add section size to Comdat_group mapping.  Change
11930         Comdat_group to std::map.  Add is_comdat_ field.  Add
11931         linkonce_size field in union.
11932         (class Layout): Update declaration of find_or_add_kept_section.
11933         Don't declare find_kept_object.
11934         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11935         parameter.  Add object, shndx, is_comdat, and is_group_name
11936         parameters.  Change all callers.  Adjust for new Kept_section.
11937         (Layout::find_kept_object): Remove.
11938         * object.cc (Sized_relobj::include_section_group): Update use of
11939         Kept_section.  Rename secnum to shndx.  Only record
11940         Kept_comdat_section if sections are the same size.
11941         (Sized_relobj::include_linkonce_section): Update use of
11942         Kept_section.  Only record Kept_comdat_section if sections are the
11943         same size.  Set size of linkonce section.
11944         (Sized_relobj::map_to_kept_section): Update call to
11945         get_kept_comdat_section.
11946         * object.h (class Sized_relobj): Rename fields in
11947         Kept_comdat_section to drop trailing underscores; change object
11948         field to Relobj*.  Change Kept_comdat_section_table to store
11949         struct rather than pointer.
11950         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11951         Add kept_object and kept_shndx parameters.  Change all callers.
11952         (Sized_relobj::get_kept_comdat_section): Change return type to
11953         bool.  Add kept_object and kept_shndx parameters.  Change all
11954         callers.
11955         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11956         Layout::find_or_add_kept_section.
11957
11958 2009-07-09  Ian Lance Taylor  <iant@google.com>
11959
11960         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11961         Reserve space in the hash table.
11962
11963 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11964
11965         * fileread.cc (File_read::get_mtime): New method.
11966         * fileread.h (Timespec): New structure.
11967         (File_read::get_mtime): New method.
11968         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11969         Renamed from timestamp_nsec.
11970         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11971         Elf_Xword.
11972         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11973         timestamp_nsec.
11974         (Incremental_inputs::report_archive): Save mtime; style fix.
11975         (Incremental_inputs::report_obejct): Save mtime; style fix.
11976         (Incremental_inputs::report_script): Save mtime; style fix.
11977         (Incremental_inputs::finalize_inputs): Style fix.
11978         (Incremental_inputs::finalize): Style fix.
11979         (Incremental_inputs::create_input_section_data): Store inputs
11980         mtime.
11981         * incremental.h (Incremental_inputs::report_script): Add mtime
11982         argument.
11983         (Incremental_inputs::Input_info::Input_info): Intialize only one
11984         union member.
11985         (Incremental_inputs::Input_info::archive): Move to nameless
11986         union.
11987         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11988         (Incremental_inputs::Input_info::script): Move to nameless union.
11989         (Incremental_inputs::mtime): New field.
11990         * script.cc (read_input_script): Pass file mtime to
11991         Incremental_input.
11992         * script.h (Script_info::inputs): Style fix.
11993
11994 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11995
11996         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11997         instead of 32.
11998
11999 2009-06-24  Ian Lance Taylor  <iant@google.com>
12000
12001         PR 10156
12002         * layout.cc (Layout::choose_output_section): If we find an
12003         existing section, update the flags.
12004         (Layout::create_notes): New function, broken out of
12005         Layout::finalize.
12006         (Layout::finalize): Don't create note sections.
12007         (Layout::create_note): Don't crash if linker script discards
12008         section.
12009         (Layout::create_gold_note): Likewise.
12010         (Layout::create_build_id): Likewise.  Don't set
12011         after_input_sections on the section.
12012         (Layout::create_executable_stack_info): Remove target parameter.
12013         Change caller.
12014         * layout.h (class Layout): Declare create_notes.  Update
12015         declaration of create_executable_stack_info.
12016         * gold.cc (queue_middle_tasks): Call create_notes.
12017         * output.cc (Output_section::update_flags_for_input_section): Move
12018         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12019         invalid.
12020         * output.h (Output_data::mark_address_invalid): New function.
12021         (class Output_section): Only declare, not define,
12022         update_flags_for_input_section.  Remove set_flags.
12023
12024 2009-06-24  Ian Lance Taylor  <iant@google.com>
12025
12026         * script-sections.cc (Output_section_definition::
12027         set_section_addresses): Rename shadowing local load_address to
12028         laddr.
12029
12030 2009-06-24  Ian Lance Taylor  <iant@google.com>
12031
12032         PR 10244
12033         * reloc.cc (relocate_sections): Skip empty relocation sections.
12034
12035 2009-06-23  Ian Lance Taylor  <iant@google.com>
12036
12037         PR 10156
12038         * layout.cc (Layout::create_note): Use choose_output_section
12039         rather than make_output_section.
12040
12041 2009-06-23  Ian Lance Taylor  <iant@google.com>
12042
12043         PR 10237
12044         * options.cc (General_options::parse_V): Set printed_version_.
12045         (General_options::General_options): Initialize printed_version_.
12046         * options.h (class General_options): Add printed_version_ field.
12047         * gold.cc (queue_initial_tasks): If there are no input files,
12048         don't give a fatal error if we printed the version information.
12049         (queue_middle_tasks): If using -r with a shared object, give a
12050         fatal error rather than an ordinary error.
12051
12052 2009-06-23  Ian Lance Taylor  <iant@google.com>
12053
12054         PR 10219
12055         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12056         (Layout::make_output_section): Set have_stabstr_section_ if we see
12057         a .stab*str section.
12058         (Layout::finalize): Call link_stabs_sections.
12059         (Layout::link_stabs_sections): New file.
12060         * layout.h (class Layout): Add have_stabstr_section_ field.
12061         Declare link_stabs_sections.
12062
12063 2009-06-23  Doug Kwan  <dougkwan@google.com>
12064
12065         * Makefile.am (libgold_a_LIBADD): New.
12066         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12067         * Makefile.in: Regenerate.
12068         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12069         * configure: Regenerate.
12070         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12071         * fileread.cc: Include sys/state.h
12072         * gold.h: Declare memmem and strndup if found missing.
12073         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12074
12075 2009-06-23  Ian Lance Taylor  <iant@google.com>
12076
12077         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12078         * configure: Rebuild.
12079
12080 2009-06-23  Ian Lance Taylor  <iant@google.com>
12081
12082         PR 10147
12083         * object.cc (Object::section_contents): Don't try to get a view if
12084         the section has length zero.
12085         (Object::handle_gnu_warning_section): If the section is empty, use
12086         the name of the section as the warning.
12087
12088 2009-06-23  Ian Lance Taylor  <iant@google.com>
12089
12090         PR 10133
12091         * stringpool.h (class Stringpool_template): Add optimize_ field.
12092         (Stringpool_template::set_optimize): New function.
12093         * stringpool.cc (Stringpool_template::Stringpool_template):
12094         Initialize optimize_ field.
12095         (Stringpool_template::set_string_offsets): Test local optimize
12096         fild rather than parameter.
12097         * layout.cc (Layout::Layout): Call set_optimize on the section
12098         name stringpool.
12099
12100 2009-06-22  Ian Lance Taylor  <iant@google.com>
12101
12102         PR 10030
12103         * yyscript.y: Parse TARGET.
12104         * script.cc (script_set_target): New function.
12105         * script-c.h (script_set_target): Declare.
12106         * options.cc (General_options::string_to_object_format): Rename
12107         from string_to_object_format in anonymous namespace.  Change
12108         callers.
12109         * options.h (class General_options): Declare
12110         string_to_object_format.
12111
12112 2009-06-22  Ian Lance Taylor  <iant@google.com>
12113
12114         * script-sections.cc (Script_sections::create_segments): Don't put
12115         program headers in a PT_LOAD segment if -n or -N.
12116
12117 2009-06-22  Ian Lance Taylor  <iant@google.com>
12118
12119         PR 10141
12120         * options.h (class General_options): Add -z lazy and -z now.  Sort
12121         -z options into alphabetical order.
12122         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12123
12124 2009-06-21  Ian Lance Taylor  <iant@google.com>
12125
12126         * layout.cc (Layout::make_output_section): Call
12127         Target::new_output_section.
12128         (Layout::attach_allocated_section_to_segment): Put large section
12129         sections in a separate load segment with the large segment flag
12130         set.
12131         (Layout::segment_precedes): Sort large data segments after other
12132         load segments.
12133         (align_file_offset): New static function.
12134         (Layout::set_segment_offsets): Use align_file_offset.
12135         * output.h (class Output_section): Add is_small_section_ and
12136         is_large_section_ fields.
12137         (Output_section::is_small_section): New function.
12138         (Output_section::set_is_small_section):  New function.
12139         (Output_section::is_large_section): New function.
12140         (Output_section::set_is_large_section): New function.
12141         (Output_section::is_large_data_section): New function.
12142         (class Output_segment): Add is_large_data_segment_ field.
12143         (Output_segment::is_large_data_segment): New function.
12144         (Output_segment::set_is_large_data_segment): New function.
12145         * output.cc (Output_section::Output_section): Initialize new
12146         fields.
12147         (Output_segment::Output_segment): Likewise.
12148         (Output_segment::add_output_section): Add assertion that large
12149         data sections always go in large data segments.  Force small data
12150         sections to the end of the list of data sections.  Force small BSS
12151         sections to the start of the list of BSS sections.  For large BSS
12152         sections to the end of the list of BSS sections.
12153         * symtab.h (class Symbol): Declare is_common_shndx.
12154         (Symbol::is_defined): Check Symbol::is_common_shndx.
12155         (Symbol::is_common): Likewise.
12156         (class Symbol_table): Define enum Commons_section_type.  Update
12157         declarations.  Add small_commons_ and large_commons_ fields.
12158         * symtab.cc (Symbol::is_common_shndx): New function.
12159         (Symbol_table::Symbol_table): Initialize new fields.
12160         (Symbol_table::add_from_object): Put small and large common
12161         symbols in the right list.
12162         (Symbol_table::sized_finalized_symbol): Check
12163         Symbol::is_common_shndx.
12164         (Symbol_table::sized_write_globals): Likewise.
12165         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12166         common symbol lists.  Don't call do_allocate_commons_list if the
12167         list is empty.
12168         (Symbol_table::do_allocate_commons_list): Remove is_tls
12169         parameter.  Add comons_section_type parameter.  Change all
12170         callers.  Handle small and large common symbols.
12171         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12172         Symbol::is_common_shndx.
12173         * resolve.cc (symbol_to_bits): Likewise.
12174         * target.h (Target::small_common_shndx): New function.
12175         (Target::small_common_section_flags): New function.
12176         (Target::large_common_shndx): New function.
12177         (Target::large_common_section_flags): New function.
12178         (Target::new_output_section): New function.
12179         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12180         small_common_section_flags, and large_common_section_flags
12181         fields.
12182         (Target::do_new_output_section): New virtual function.
12183         * arm.cc (Target_arm::arm_info): Initialize new fields.
12184         * i386.cc (Target_i386::i386_info): Likewise.
12185         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12186         Likewise.
12187         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12188         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12189         (Target_x86_64::do_new_output_section): New function.
12190         * configure.ac: Define conditional MCMODEL_MEDIUM.
12191         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12192         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12193         (large_LDFLAGS): Define.
12194         * testsuite/large.c: New file.
12195         * testsuite/testfile.cc (Target_test::test_target_info):
12196         Initialize new fields.
12197         * configure, testsuite/Makefile.in: Rebuild.
12198
12199 2009-06-05  Doug Kwan  <dougkwan@google.com>
12200
12201         * Makefile.am (CCFILES): Add target.cc.
12202         * Makefile.in: Regenerate.
12203         * i386.cc (class Target_i386): Define new virtual method to
12204         override do_is_local_label_name in parent.
12205         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12206         local symbols if --discard-locals or -X is given.
12207         * options.h (class General_options): Declare new options
12208         '--discard-locals' and '-X' for discarding locals.
12209         * target.h (class Target): Define new methods is_local_label_name.
12210         Declare new virtual method do_is_local_label_name.
12211         * target.cc: New file.
12212         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12213         (check_SCRIPTS): Add discard_locals_test.sh.
12214         (check_DATA): Add discard_local_tests.syms.
12215         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12216         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12217         * testsuite/Makefile.in: Regenerate.
12218         * testsuite/discard_locals_test.c: New file.
12219         * testsuite/discard_locals_test.sh: Same.
12220
12221 2009-06-05  Doug Kwan  <dougkwan@google.com>
12222
12223         * object.cc (Sized_relobj::Sized_relobj): Initialize
12224         discarded_eh_frame_shndx_ to -1U.
12225         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12226         section.
12227         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12228         a discarded .eh_frame section.
12229         (Sized_relobj::do_finalize_local_symbols): Ditto.
12230         * object.h (class Sized_relobj): Declare new member
12231         discarded_eh_frame_shndx_.
12232         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12233         (local_labels_test.o, local_labels_test): New rules.
12234         * testsuite/Makefile.in: Regenerate.
12235
12236 2009-06-04  Doug Kwan  <dougkwan@google.com>
12237
12238         * layout.cc (Layout::section_name_mapping): Add mapping for
12239         special ARM sections.
12240
12241 2009-06-03  Doug Kwan  <dougkwan@google.com>
12242
12243         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12244         (utils::has_overflow): Same.
12245
12246 2009-06-03  Ian Lance Taylor  <iant@google.com>
12247
12248         * layout.cc (Layout::section_name_mapping): New array, replacing
12249         Layout::linkonce_mapping.
12250         (Layout::section_name_mapping_count): New variable, replacing
12251         Layout::linkonce_mapping_count.
12252         (Layout::linkonce_output_name): Remove.
12253         (Layout::output_section_name): Rewrite.
12254         * layout.h (class Layout): Rename Linkonce_mapping to
12255         Section_name_mapping, linkonce_mapping to section_name_mapping,
12256         linkonce_mapping_count to section_name_mapping_count.  Don't
12257         declare linkonce_output_name.
12258
12259 2009-06-03  Doug Kwan  <dougkwan@google.com>
12260
12261         * gold/arm.cc (namespace utils): New.
12262         (Target_arm::reloc_is_non_pic): Define new method.
12263         (class Arm_relocate_functions): New.
12264         (Target_arm::Relocate::relocate): Handle relocation types used by
12265         Android.
12266
12267 2009-06-03  Ian Lance Taylor  <iant@google.com>
12268
12269         * arm.cc (Target_arm::scan::global): Use || instead of |.
12270
12271 2009-06-02  Doug Kwan  <dougkwan@google.com>
12272
12273         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12274         issued_non_pic_error_.
12275         (class Target_arm::Scan): Declare new method check_non_pic.
12276         Define new method symbol_needs_plt_entry.
12277         Declare new data member issued_non_pic_error_.
12278         (class Target_arm::Relocate): Declare new method
12279         should_apply_static_reloc.
12280         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12281         (Target_arm::Scan::check_non_pic): Define new method.
12282         (Target_arm::Scan::local): Handle a small subset of reloc types used
12283         by Android.
12284         (Target_arm::Scan::local): Same.
12285         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12286
12287 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12288
12289         * incremental.cc (Incremental_inputs::report_command_line): Filter
12290         out --incremental-* options.
12291
12292 2009-05-29  Doug Kwan  <dougkwan@google.com>
12293
12294         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12295         template class.
12296         (class Target_arm): Update comment.
12297         (Target_arm::Target_arm): Initialize new data members GOT_,
12298         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12299         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12300         and Target_arm::rel_dyn_section.
12301         Declare new_enum Target_arm::Got_type.
12302         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12303         and DYNBSS_.
12304         Update commments for member do_dynsym_value.
12305         (Target_arm::got_size, Target_arm::plt_section,
12306         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12307         new methods inside class defintion.
12308         (Target_arm::got_section): Define new method.
12309         (Target_arm::rel_dyn_section): Same.
12310         (Output_data_plt_arm): New template class.
12311         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12312         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12313         (Output_data_plt_arm::add_entry): Same.
12314         (Output_data_plt_arm::first_plt_entry): Define new
12315         static data member for PLT instruction template.
12316         (Output_data_plt_arm::plt_entry): Same.
12317         (Output_data_plt_arm::do_write): Define new method.
12318         (Target_arm::make_plt_entry): Same.
12319         (Target_arm::do_finalize_sections): Same.
12320         (Target_arm::do_dynsym_value): Same.
12321
12322 2009-05-28  Doug Kwan  <dougkwan@google.com>
12323
12324         * Makefile.am (TARGETSOURCES): Add arm.cc.
12325         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12326         * Makefile.in: Regenerate.
12327         * arm.cc: New file.
12328         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12329
12330 2009-05-26  Doug Kwan  <dougkwan@google.com>
12331
12332         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12333         (General_options::check_excluded_libs): Strip off directories in
12334         archive name before matching like GNU ld does.
12335         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12336         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12337         (exclude_libs_test_LDFLAGS): Add linker option
12338         -Wl,--exclude-libs,libexclude_libs_test_3
12339         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12340         an explicit archive without using -l.
12341         (alt/libexclude_libs_test_3.a): New make rule.
12342         * testsuite/Makefile.in: Regenerate.
12343         * testsuite/exclude_libs_test.c : Declare lib3_default().
12344         (main): Call it.
12345         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12346         * exclude_libs_test_3.c: New file.
12347
12348 2009-05-26  Nick Clifton  <nickc@redhat.com>
12349
12350         * po/id.po: New Indonesian translation.
12351         * po/gold.pot: Updated template file.
12352
12353 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12354
12355         * testsuite/Makefile.am: Add -ffunction-sections to compile
12356         gc_comdat_test files.  Add -Wl,--gc-sections to build
12357         gc_comdat_test.
12358         * testsuite/Makefile.in: Regenerate.
12359         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12360
12361 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12362
12363         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12364         kept comdat section was garbage collected.
12365         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12366         * testsuite/Makefile.in: Regenerate.
12367         * testsuite/gc_comdat_test.sh: New file.
12368         * testsuite/gc_comdat_test_1.cc: New file.
12369         * testsuite/gc_comdat_test_2.cc: New file.
12370
12371 2009-05-19  Doug Kwan  <dougkwan@google.com>
12372
12373         * archive.cc (Archive::Archive): Move constructor from archive.h
12374         to here.  Initialize no_export_.
12375         (Archive::get_elf_object_for_member): Set no_export flag of object.
12376         * archive.h (Archive::Archive): Move constructor body to
12377         archive.cc.
12378         (Archive::no_export): New method.
12379         (Archive::no_export_): New field.
12380         * object.h (Object::Object): Initialize no_export_ to false.
12381         (Object::no_export, Object::set_no_export): New methods.
12382         (Object::no_export_): New field.
12383         * options.cc (General_options::parse_exclude_libs): New method.
12384         (General_options::check_excluded_libs) Same.
12385         * options.h (exclude_libs): New option.
12386         (General_options::check_excluded_libs): New method declaration.
12387         (General_options::excluded_libs_): New field.
12388         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12389         default or protected visibility if an object has no-export flag set.
12390         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12391         (check_SCRIPTS): Add exclude_libs_test.sh.
12392         (check_DATA): Add exclude_libs_test.syms.
12393         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12394         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12395         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12396         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12397         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12398         libexclude_libs_test_2.a): New rules.
12399         * testsuite/Makefile.in: Regenerate.
12400         * testsuite/exclude_libs_test.c: New file.
12401         * testsuite/exclude_libs_test.sh: Ditto.
12402         * testsuite/exclude_libs_test_1.c: Ditto.
12403         * testsuite/exclude_libs_test_2.c: Ditto.
12404
12405 2009-05-15  Ian Lance Taylor  <iant@google.com>
12406
12407         * configure.ac: Check for declarations for cases where libiberty.h
12408         checks HAVE_DECL_xxx.
12409         * configure, config.in: Rebuild.
12410
12411 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12412
12413         * gold.h (Incremental_argument_list): Remove (invalid) forward
12414         declaration.
12415         * incremental.cc (Incremental_inputs::report_achive): New method.
12416         (Incremental_inputs::report_object): New method.
12417         (Incremental_inputs::report_script): New method.
12418         (Incremental_inputs::finalize_inputs): New method.
12419         (Incremental_inputs::finalize): Call finalize_inputs().
12420         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12421         Create inputs entries.
12422         * incremental.h (Incremental_input_type): New enum.
12423         (Incremental_inputs::Incremental_input): Initialize new fields.
12424         (Incremental_inputs::report_inputs): New method.
12425         (Incremental_inputs::report_achive): New method.
12426         (Incremental_inputs::report_object): New method.
12427         (Incremental_inputs::report_script): New method.
12428         (Incremental_inputs::finalize_inputs): New method.
12429         (Incremental_inputs::Input_info): New struct.
12430         (Incremental_inputs::Input_info_map): New typedef.
12431         (Incremental_inputs::lock_): New field.
12432         (Incremental_inputs::Inputs_): New field.
12433         (Incremental_inputs::Inputs_map): New field.
12434         * main.cc (main): Call Incremental_input::report_inputs.
12435         * options.h (Input_argument_list): Typedef moved from
12436         Input_arguments.
12437         (Input_file_group::Files): Remove, use ::Input_argument_list.
12438         (Input_file_group::Input_argument_list): Remove, use
12439         ::Input_argument_list.
12440         * plugin.cc (Plugin_manager::add_input_file): Add error in
12441         incremental build.
12442         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12443         functions.
12444         * script.cc (read_input_script): Call
12445         Incremental_input::report_script.
12446         * script.h (Script_info): New class.
12447
12448 2009-04-27  Ian Lance Taylor  <iant@google.com>
12449
12450         * x86_64.cc (do_adjust_output_section): Set entsize to
12451         plt_entry_size.
12452
12453 2009-04-23  Elliott Hughes  <enh@google.com>
12454
12455         * output.cc (Output_file::close): After short writes, continue
12456         writing from the correct offset in the buffer being written.
12457
12458 2009-04-23  Chris Demetriou  <cgd@google.com>
12459
12460         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12461         * configure: Regenerate.
12462         * config.in: Regenerate.
12463         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12464         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12465
12466 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12467
12468         * incremental.cc (Incremental_inputs_header_data): Renamed from
12469         Incremental_input_header_data.
12470         (Incremental_inputs_header_data::data_size): New field.
12471         (Incremental_inputs_header_data::put_input_file_count): Renamed
12472         from input_file_count.
12473         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12474         from command_line_offset.
12475         (Incremental_inputs_header_data::put_reserved): Renamed from
12476         put_reserved.
12477         (Incremental_inputs_entry_data): Renamed from
12478         Incremental_input_entry_data.
12479         (Incremental_inputs_entry_data::data_size): New field.
12480         (Incremental_inputs::report_command_line): New method.
12481         (Incremental_inputs::finalize): New method.
12482         (Incremental_inputs::create_incremental_inputs_data): New method.
12483         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12484         * incremental.h: New file.
12485         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12486         (Layout::finalize): Create incremental inputs section in
12487         incremental builds.
12488         (Layout::create_incremental_info_sections): New method.
12489         * layout.h (Layout::incremental_inputs): New method.
12490         (Layout::create_incremental_info_sections): New method.
12491         (Layout::incremental_inputs_): New field.
12492         * main.cc (main): Notify Incremental_input of the command line.
12493
12494 2009-04-01  Ian Lance Taylor  <iant@google.com>
12495             Mikolaj Zalewski  <mikolajz@google.com>
12496
12497         * gold.h (reserve_unordered_map): Define, three versions, one for
12498         each version of Unordered_map.
12499         * layout.cc (Layout::Layout): Remove options parameter.  Add
12500         number_of_input_files parameter.  Don't initialize options_.
12501         Initialize number_of_input_files_ and resized_signatures_.  Move
12502         sections_are_attached_.
12503         (Layout::layout_group): Reserve space for group_signatures_.
12504         (Layout::find_or_add_kept_section): Change name parameter to be a
12505         reference.  Resize signatures_ map when it gets large enough.
12506         (Layout::layout_eh_frame): Use parameters->options() instead of
12507         this->options_.
12508         (Layout::make_output_section): Likewise.
12509         (Layout::attach_allocated_section_to_segment): Likewise.
12510         (Layout::finalize, Layout::create_executable_stack): Likewise.
12511         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12512         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12513         * layout.h (class Layout): Update declarations.  Remove options_
12514         field.  Add number_of_input_files_ and resized_signatures_
12515         fields.  Move sections_are_attached_ field.
12516         * main.cc (main): Pass number of input files to Layout
12517         constructor.  Don't pass options.
12518
12519 2009-03-30  Ian Lance Taylor  <iant@google.com>
12520
12521         * ffsll.c (ffsll): Correct implementation.
12522
12523 2009-03-27  Ian Lance Taylor  <iant@google.com>
12524
12525         * ffsll.c: New file.
12526         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12527         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12528         * ftruncate.c (ftruncate): Declare before definition.
12529         * mremap.c (mremap): Likewise.
12530         * pread.c (pread): Likewise.
12531         * configure, Makefile.in, config.in: Rebuild.
12532
12533         * mremap.c: New file.
12534         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12535         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12536         (mremap): Declare if HAVE_MREMAP is not defined.
12537         * configure, Makefile.in, config.in: Rebuild.
12538
12539 2009-03-27  Cary Coutant  <ccoutant@google.com>
12540
12541         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12542         position independent.
12543         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12544         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12545
12546 2009-03-24  Cary Coutant  <ccoutant@google.com>
12547
12548         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12549         an executable.
12550         (needs_dynamic_reloc): Likewise.
12551
12552 2009-03-24  Ian Lance Taylor  <iant@google.com>
12553
12554         * yyscript.y (file_cmd): Recognize EXTERN.
12555         (extern_name_list, extern_name_list_body): New nonterminals.
12556         * script.cc (script_add_extern): Define.
12557         * script-c.h (script_add_extern): Declare.
12558
12559 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12560
12561         * object.cc (is_elf_object): Define.
12562         * object.h (is_elf_object): Declare.
12563         * archive.cc (Archive::get_elf_object_for_member): Call
12564         is_elf_object.
12565         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12566
12567 2009-03-24  Elliott Hughes  <enh@google.com>
12568
12569         * output.cc (Output_file::map_anonymous): Define.
12570         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12571         try an anonymous one.  Report the size if the mmap fails.
12572         * output.h (class Output_file): Declare map_anonymous.
12573
12574 2009-03-24  Ian Lance Taylor  <iant@google.com>
12575
12576         * target-select.cc (instantiate_target): Don't acquire the lock if
12577         the instantiated_target_ field has already been set.
12578
12579 2009-03-23  Ian Lance Taylor  <iant@google.com>
12580
12581         * gold-threads.h (class Initialize_lock): Define.
12582         * gold-threads.cc (class Initialize_lock_once): Define.
12583         (initialize_lock_control): New static variable.
12584         (initialize_lock_pointer): New static variable.
12585         (initialize_lock_once): New static function.
12586         (Initialize_lock::Initialize_lock): Define.
12587         (Initialize_lock::initialize): Define.
12588         * target-select.h: Include "gold-threads.h".
12589         (class Target_selector): Add lock_ and initialize_lock_ fields.
12590         Don't define instantiate_target, just declare it.
12591         * target-select.cc (Target_selector::Target_selector): Initialize
12592         new fields.
12593         (Target_selector::instantiate_target): Define.
12594         * descriptors.h: Include "gold-threads.h".
12595         (class Descriptors): Add initialize_lock_ field.
12596         * descriptors.cc (Descriptors::Descriptors): Initialize new
12597         field.
12598         (Descriptors::open): Use initialize_lock_ field
12599         * errors.h (class Errors): Add initialize_lock_ field.
12600         * errors.cc (Errors::Errors): Initialize new field.
12601         (Errors::initialize_lock): Use initialize_lock_ field.
12602         * powerpc.cc (class Target_selector_powerpc): Remove
12603         instantiated_target_ field.  In do_recognize call
12604         instantiate_target rather than do_instantiate_target.  In
12605         do_instantiate_target just allocate a new target.
12606         * sparc.cc (class Target_selector_sparc): Likewise.
12607
12608         * freebsd.h: New file.
12609         * i386.cc: Include "freebsd.h".
12610         (Target_i386): Derive from Target_freebsd rather than
12611         Sized_target.
12612         (Target_selector_i386): Derive from Target_selector_freebsd rather
12613         than Target_selector.
12614         * x86_64.cc: Include "freebsd.h".
12615         (Target_x86_64): Derive from Target_freebsd rather than
12616         Sized_target.
12617         (Target_selector_x86_64): Derive from Target_selector_freebsd
12618         rather than Target_selector.
12619         * target.h (class Target): Add adjust_elf_header and
12620         do_adjust_elf_header.
12621         * output.cc (Output_file_header:: do_sized_write): Call target
12622         adjust_elf_header routine.
12623         * configure.tgt: Set targ_osabi.
12624         * configure.ac: Define GOLD_DEFAULT_OSABI.
12625         * parameters.cc (Parameters::default_target): Pass
12626         GOLD_DEFAULT_OSABI to select_target.
12627         * target-select.h (class Target_selector): Make instantiate_target
12628         protected rather than private.
12629         * Makefile.am (HFILES): Add freebsd.h.
12630         * configure, Makefile.in, config.in: Rebuild.
12631
12632         * merge.cc (do_add_input_section): Correct pend value.  Change
12633         message about last entry not being null terminated from error to
12634         warning.
12635
12636 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12637
12638         * incremental.cc: New file.
12639         * Makefile.am (CCFILES): Add incremental.cc.
12640         * Makefile.in: Rebuild.
12641
12642 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12643
12644         * layout.cc (Layout::output_section_name): Preserve names
12645         of '.note.' sections.
12646
12647 2009-03-19  Ian Lance Taylor  <iant@google.com>
12648
12649         * descriptors.cc (Descriptors::open): Check that the options are
12650         valid before using them.
12651
12652 2009-03-18  Ian Lance Taylor  <iant@google.com>
12653
12654         * script-sections.h: Include <list>.
12655         (class Script_sections): Change Sections_elements from std::vector
12656         to std::list.  Typedef public Elements_iterator.  Add
12657         orphan_section_placement_, data_segment_align_start_, and
12658         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12659         field.
12660         * script-sections.cc (class Orphan_section_placement): New class.
12661         (class Sections_element): Add virtual functions is_relro and
12662         orphan_section_init.  Remove virtual function place_orphan_here.
12663         (class Output_section_definition): Add is_relro and
12664         orphan_section_init.  Remove place_orphan_here.
12665         (class Orphan_output_section): Likewise.
12666         (Script_sections::Script_sections): Update for field changes.
12667         (Script_sections::data_segment_align): Set saw_data_segment_align_
12668         and data_segment_align_start_, not data_segment_align_index.
12669         (Script_sections::data_segment_relro_end): Check
12670         saw_data_segment_align_.  Use data_segment_align_start_ rather
12671         than data_segment_align_index_.
12672         (Script_sections::place_orphan): Rewrite to use
12673         Orphan_section_placement.
12674
12675 2009-03-17  Ian Lance Taylor  <iant@google.com>
12676
12677         * archive.cc (Archive::add_symbols): Check for a version attached
12678         to the symbol name in the archive map.
12679         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12680         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12681         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12682         (ver_test_11.a): New target.
12683         * testsuite/Makefile.in: Rebuild.
12684
12685         * configure.ac: Check for chsize and posix_fallocate.  Replace
12686         ftruncate.
12687         * ftruncate.c: New file, from gnulib.
12688         * output.cc (posix_fallocate): Define dummy version if not
12689         HAVE_POSIX_FALLOCATE.
12690         (Output_file::map): Call posix_fallocate rather than lseek and
12691         write.
12692         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12693         * configure, Makefile.in, config.in: Rebuild.
12694
12695 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12696
12697         * layout.h (Layout::create_note): Add section_name parameter.
12698         * layout.cc (Layout::create_note): Likewise.
12699         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12700
12701 2009-03-17  Ian Lance Taylor  <iant@google.com>
12702
12703         * descriptors.cc: Include "options.h".
12704         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12705         (Descriptors::open): Always use O_CLOEXEC when opening a new
12706         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12707         then set FD_CLOEXEC.
12708
12709         * sparc.cc (class Target_sparc): Add has_got_section.
12710         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12711         make sure we have a GOT section.
12712
12713         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12714         (Target_sparc::Scan::local): Likewise.
12715         (Target_sparc::Scan::global): Likewise.
12716         (Target_sparc::Relocate::relocate): Likewise.
12717         (Target_sparc::Relocate::relocate_tls): Likewise.
12718
12719         * symtab.cc (Symbol_table::define_default_version): New function,
12720         broken out of add_from_object.
12721         (Symbol_table::add_from_object): Call define_default_version.
12722         (Symbol_table::define_special_symbol): Add resolve_oldsym
12723         parameter.  Change all callers.  If the version for a symbol comes
12724         from a version script, resolve it with the symbol with the same
12725         name with no version.  Also add the symbol without a version if
12726         appropriate.
12727         (do_define_in_output_data): If resolving with oldsym, don't delete
12728         sym.
12729         (do_define_in_output_segment): Likewise.
12730         (do_define_as_constant): Likewise.
12731         * symtab.h (class Symbol_table): Update declarations.
12732
12733 2009-03-13  Ian Lance Taylor  <iant@google.com>
12734
12735         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12736         (Read_symbols::requeue): New function.
12737         (Read_symbols::do_read_symbols): If make_elf_object fails because
12738         the target type is not configured, and the file was searched for,
12739         issue a warning and retry with the next directory.
12740         (Add_symbols::run): If the file has an incompatible format, and
12741         it was searched for, requeue the Read_symbols task.  On error,
12742         release the object.
12743         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12744         dirindex parameter to constructor.  Change all callers.  Declare
12745         incompatible_warning and requeue.
12746         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12747         input_argument_ and input_group_ fields.  Add them to
12748         constructor.  Change all callers.
12749         (class Read_script): Add dirindex_ field.  Add it to constructor.
12750         Change all callers.
12751         * archive.cc (Archive::setup): Remove input_objects parameter.
12752         Change all callers.
12753         (Archive::get_file_and_offset): Likewise.
12754         (Archive::read_all_symbols): Likewise.
12755         (Archive::read_symbols): Likewise.
12756         (Archive::get_elf_object_for_member): Remove input_objects
12757         parameter.  Add punconfigured parameter.  Change all callers.
12758         (Archive::add_symbols): Change return type to bool.  Check return
12759         value of include_member.
12760         (Archive::include_all_members): Likewise.
12761         (Archive::include_member): Change return type to bool.  Return
12762         false if first included object has incompatible target.  Set
12763         included_member_ field.
12764         (Add_archive_symbols::run): If add_symbols returns false, requeue
12765         Read_symbols task.
12766         * archive.h (class Archive): Add included_member_ field.
12767         Initialize it in constructor.  Add input_file and searched_for
12768         methods.  Update declarations.
12769         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12770         input_argument_ fields.  Add them to constructor.  Change all
12771         callers.
12772         * script.cc: Include "target-select.h".
12773         (class Parser_closure): Add skip_on_incompatible_target_ and
12774         found_incompatible_target_ fields.  Add
12775         skip_on_incompatible_target parameter to constructor.  Change all
12776         callers.  Add methods skip_on_incompatible_target,
12777         clear_skip_on_incompatible_target, found_incompatible_target, and
12778         set_found_incompatible_target.
12779         (read_input_script): Add dirindex parameter.  Change all callers.
12780         If parser finds an incompatible target, requeue Read_symbols
12781         task.
12782         (script_set_symbol): Clear skip_on_incompatible_target in
12783         closure.
12784         (script_add_assertion, script_parse_option): Likewise.
12785         (script_start_sections, script_add_phdr): Likewise.
12786         (script_check_output_format): New function.
12787         * script.h (read_input_script): Update declaration.
12788         * script-c.h (script_check_output_format): Declare.
12789         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12790         (ignore_cmd): Remove OUTPUT_FORMAT.
12791         * fileread.cc (Input_file::Input_file): Add explicit this.
12792         (Input_file::will_search_for): New function.
12793         (Input_file::open): Add pindex parameter.  Change all callers.
12794         * fileread.h (class Input_file): Add input_file_argument method.
12795         Declare will_search_for.  Update declarations.
12796         * object.cc (make_elf_object): Add punconfigured parameter.
12797         Change all callers.
12798         * object.h (class Object): Make input_file public.  Add
12799         searched_for method.
12800         (make_elf_object): Update declaration.
12801         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12802         restart search.
12803         * dirsearch.h (class Dirsearch): Update declaration.
12804         * options.h (class General_options): Add --warn-search-mismatch.
12805         * parameters.cc (Parameters::is_compatible_target): New function.
12806         * parameters.h (class Parameters): Declare is_compatible_target.
12807         * workqueue.cc (Workqueue::add_blocker): New function.
12808         * workqueue.h (class Workqueue): Declare add_blocker.
12809
12810         * fileread.cc (Input_file::open): Remove options parameter.
12811         Change all callers.
12812         (Input_file::open_binary): Likewise.
12813         * script.cc (read_input_script): Likewise.
12814         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12815         options parameter from constructor.  Change all callers.
12816         (class Read_script): Likewise.
12817         * fileread.h (class Input_file): Update declarations.
12818         * script.h (read_input_script): Update declaration.
12819
12820 2009-03-10  Nick Clifton  <nickc@redhat.com>
12821
12822         * po/es.po: New Spanish translation.
12823
12824 2009-03-06  Cary Coutant  <ccoutant@google.com>
12825
12826         * options.cc (parse_short_option): Keep dash_z from registering itself.
12827
12828 2009-03-03  Ian Lance Taylor  <iant@google.com>
12829
12830         PR 9918
12831         * target-reloc.h (relocate_section): Pass output_section to
12832         relocate.
12833         * i386.cc (Target_i386::should_apply_static_reloc): Add
12834         output_section parameter.  Change all callers.
12835         (Target_i386::Relocate::relocate): Add output_section parameter.
12836         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12837         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12838         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12839         * testsuite/two_file_shared.sh: New script.
12840         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12841         (check_DATA): Add two_file_shared.dbg.
12842         (two_file_shared.dbg): New target.
12843         * testsuite/Makefile.in: Rebuild.
12844
12845 2009-03-01  Ian Lance Taylor  <iant@google.com>
12846
12847         * configure.ac: Check for byteswap.h.
12848         * configure: Rebuild.
12849         * config.in: Rebuild.
12850
12851 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12852
12853         * layout.cc (Layout::find_or_add_kept_section): New function.
12854         (Layout::add_comdat): Removed.
12855         * layout.h (struct Kept_section): Move out of class Layout.
12856         Remove trailing underscores from field names.  Add group_sections
12857         field.  Rename group_ field to is_group.  Change all uses.
12858         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12859         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12860         comdat_groups_ field.
12861         (Sized_relobj::include_section_group): Use
12862         find_or_add_kept_section and Kept_section::group_sections.
12863         (Sized_relobj::include_linkonce_section): Likewise.
12864         * object.cc (class Sized_relobj): Don't define Comdat_group or
12865         Comdat_group_table.  Remove find_comdat_group and
12866         add_comdat_group.  Remove comdat_groups_ field.
12867         * plugin.cc (include_comdat_group): Use
12868         Layout::find_or_add_kept_section.
12869
12870 2009-02-28  Ian Lance Taylor  <iant@google.com>
12871
12872         * README: --gc-sections and map files are now supported.  Document
12873         some build requirements.
12874
12875         PR 6992
12876         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12877         relocatable link set the value of the section symbol to zero.
12878         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12879         relocatable link don't include the section address in the local
12880         symbol value.
12881
12882 2009-02-27  Ian Lance Taylor  <iant@google.com>
12883
12884         PR 6811
12885         * options.h (class Search_directory): Add is_system_directory.
12886         (class General_options): Declare is_in_system_directory.
12887         * options.cc (get_relative_sysroot): Make static.
12888         (get_default_sysroot): Make static.
12889         (General_optoins::is_in_system_directory): New function.
12890         * fileread.cc (Input_file::is_in_system_directory): New function.
12891         * fileread.h (class Input_file): Declare is_in_system_directory.
12892         * object.h (class Object): Add is_in_system_directory.
12893         (class Input_objects): Remove system_library_directory_ field.
12894         * object.cc (Input_objects::add_object): Don't set
12895         system_library_directory_.
12896         (input_objects::found_in_system_library_directory): Remove.
12897         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12898         parameter.  Change all callers.
12899         (Symbol_table::sized_write_globals): Likewise.
12900         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12901         Call Object::is_in_system_directory.
12902         * symtab.h (class Symbol_table): Update declarations.
12903
12904         PR 5990
12905         * descriptors.h (Open_descriptor): Add is_on_stack field.
12906         * descriptors.cc (Descriptors::open): If the descriptor is on the
12907         top of the stack, remove it.  Initialize is_on_stack field.
12908         (Descriptors::release): Only add pod to stack if it is not on the
12909         stack already.
12910         (Descriptors::close_some_descriptor): Clear stack_next and
12911         is_on_stack fields.
12912
12913         PR 7091
12914         * output.cc (Output_section::find_starting_output_address): Rename
12915         from starting_output_address; add PADDR parameter; change return
12916         type.
12917         * output.h (class Output_section): Declare
12918         find_starting_output_address instead of starting_output_address.
12919         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12920         section symbol for which we can't find a merge section.
12921
12922         PR 9836
12923         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12924         hidden or internal, force the symbol to be local.
12925         * resolve.cc (Symbol::override_visibility): Define.
12926         (Symbol::override_base): Use override_visibility.
12927         (Symbol_table::resolve): Likewise.
12928         (Symbol::override_base_with_special): Likewise.
12929         (Symbol_table::override_with_special): If the visibility is hidden
12930         or internal, force the symbol to be local.
12931         * symtab.h (class Symbol): Add set_visibility and
12932         override_visibility.
12933         * testsuite/ver_test_1.sh: New file.
12934         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12935         (check_DATA): Add ver_test_1.syms.
12936         (ver_test_1.syms): New target.
12937         * testsuite/Makefile.in: Rebuild.
12938
12939 2009-02-25  Cary Coutant  <ccoutant@google.com>
12940
12941         * layout.cc (Layout::choose_output_section): Don't rename sections
12942         when using a linker script that has a SECTIONS clause.
12943         * Makefile.in: Regenerate.
12944
12945         * testsuite/Makefile.am (script_test_5.sh): New test case.
12946         * testsuite/Makefile.in: Regenerate.
12947         * testsuite/script_test_5.cc: New file.
12948         * testsuite/script_test_5.sh: New file.
12949         * testsuite/script_test_5.t: New file.
12950
12951 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12952
12953         * archive.cc (Archive::include_member): Update calls to add_symbols.
12954         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12955         the Layout argument.
12956         * dynobj.h (do_add_symbols): Add the Layout argument.
12957         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12958         Layout argument.
12959         * object.h (Object::add_symbols): Add the Layout argument.
12960         (Object::do_add_symbols): Add the Layout argument.
12961         (Sized_relobj::do_add_symbols): Add the Layout argument.
12962         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12963         Unify the two versions.
12964         (Add_plugin_symbols): Remove.
12965         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12966         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12967         (Add_plugin_symbols): Remove.
12968         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12969         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12970         (Add_symbols::run): Make it work with Pulginobj.
12971
12972 2009-02-06  Ian Lance Taylor  <iant@google.com>
12973
12974         * object.cc (Sized_relobj::do_layout): Make info message start
12975         with lower case letter.
12976
12977 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12978
12979         * binary.cc: Fix file comment.
12980
12981         * options.h (enum Incremental_disposition): Define.
12982         (class General_options): Add new options: --incremental,
12983         --incremental_changed, --incremental_unchanged,
12984         --incremental_unknown.  Add incremental_disposition_ and
12985         implicit_incremental_ fields.
12986         (General_options::incremental_disposition): New function.
12987         (class Position_dependent_options): Add incremental_disposition
12988         option.
12989         (Position_dependent_options::copy_from_options): Set incremental
12990         dispositions.
12991         * options.cc (General_options::parse_incremental_changed): New
12992         function.
12993         (General_options::parse_incremental_unchanged): New function.
12994         (General_options::parse_incremental_unknown): New function.
12995         (General_options::General_options): Initialize new fields
12996         incremental_disposition_ and implicit_incremental_.
12997         (General_options::finalize): Check for uasge of --incremental-*
12998         without --incremental.
12999
13000 2009-02-06  Chris Demetriou  <cgd@google.com>
13001
13002         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13003         pointer and to report location as the file name associated with
13004         the symbol.
13005         (gold_undefined_symbol_at_location): New function to replace the
13006         old gold_undefined_symbol functionality.
13007         * target-reloc.h (relocate_section): Update to use
13008         gold_undefined_symbol_at_location.
13009         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13010         Call gold_undefined_symbol function rather than gold_error.
13011         * errors.h (Errors::undefined_symbol): Take location as a
13012         string, rather than calculating it from a relocation.
13013         * errors.cc (Errors::fatal): Print "fatal error:" before the
13014         formatted message.
13015         (Errors::error, Errors::error_at_location): Print "error: "
13016         before the formatted message.
13017         (Errors::undefined_symbol): Take location as a string, rather
13018         than calculating it from a relocation.
13019         (gold_undefined_symbol_at_location): New function akin to
13020         old gold_undefined_symbol, calculates location from relocation.
13021         (gold_undefined_symbol): Change to take only a Symbol pointer
13022         and to report location as the file name associated with the symbol.
13023         * testsuite/debug_msg.sh: Update for changed error messages.
13024         * testsuite/undef_symbol.sh: Likewise.
13025
13026 2009-02-04  Duncan Sands  <baldrick@free.fr>
13027
13028         PR 9812
13029         * reduced_debug_output.h
13030         (Output_reduced_debug_abbrev_section::failed): Use format for
13031         gold_warning.
13032         (Output_reduced_debug_info_section::faild): Likewise.
13033
13034 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13035
13036         * script.cc (Lazy_demangler): New class.
13037         (Version_script_info::get_symbol_version_helper): Demangle a
13038         symbol only once.
13039
13040 2009-01-29  Cary Coutant  <ccoutant@google.com>
13041
13042         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13043         to __tls_get_addr.
13044         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13045
13046 2009-01-28  Ian Lance Taylor  <iant@google.com>
13047
13048         * version.cc (version_string): Bump to 1.9.
13049
13050         * gold.h: Include <cstring> and <stdint.h>.
13051         * version.cc: Include <cstdio>.
13052         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13053         warning.
13054         * reduced_debug_output.cc (insert_into_vector): Rename from
13055         Insert_into_vector; change all callers.  Use Swap_unaligned to
13056         avoid aliasing issue; remove union since it is unnecessary.
13057
13058 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13059
13060         * Makefile.am (CCFILES): Add gc.cc.
13061         (HFILES): Add gc.h.
13062         * Makefile.in: Regenerate.
13063         * gold.cc (Gc_runner): New class.
13064         (queue_initial_tasks): Call garbage collection related tasks
13065         when corresponding options are invoked.
13066         (queue_middle_gc_tasks): New function.
13067         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13068         processed early before laying out sections during garbage collection.
13069         * gold.h (queue_middle_gc_tasks): New function.
13070         (is_prefix_of): Move from "layout.cc".
13071         * i386.cc (Target_i386::gc_process_relocs): New function.
13072         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13073         * main.cc (main): Create object of class "Garbage_collection".
13074         * object.cc (Relobj::copy_symbols_data): New function.
13075         (Relobj::is_section_name_included): New function.
13076         (Sized_relobj::do_layout): Allow this function to be called twice
13077         during garbage collection and defer layout of section during the
13078         first call.
13079         * object.h (Relobj::get_symbols_data): New function.
13080         (Relobj::is_section_name_included): New function.
13081         (Relobj::copy_symbols_data): New function.
13082         (Relobj::set_symbols_data): New function.
13083         (Relobj::get_relocs_data): New function.
13084         (Relobj::set_relocs_data): New function.
13085         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13086         (Relobj::gc_process_relocs): New function.
13087         (Relobj::do_gc_process_relocs): New pure virtual function.
13088         (Relobj::sd_): New data member.
13089         (Sized_relobj::is_output_section_offset_invalid): New function.
13090         (Sized_relobj::do_gc_process_relocs): New function.
13091         * options.h (General_options::gc_sections): Modify to not be a no-op.
13092         (General_options::print_gc_sections): New option.
13093         * plugin.cc (Plugin_finish::run): Remove function call to
13094         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13095         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13096         * reloc.cc (Read_relocs::run): Add task to process relocs and
13097         determine unreferenced sections when doing garbage collection.
13098         (Gc_process_relocs): New class.
13099         (Sized_relobj::do_gc_process_relocs): New function.
13100         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13101         sections that are garbage collected.
13102         * reloc.h (Gc_process_relocs): New class.
13103         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13104         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13105         symbols whose corresponding sections are garbage collected.
13106         (Symbol_table::Symbol_table): Add new parameter for the garbage
13107         collection object.
13108         (Symbol_table::gc_mark_undef_symbols): New function.
13109         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13110         (Symbol_table::gc_mark_dyn_syms): New function.
13111         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13112         as garbage.
13113         (Symbol_table::add_from_object): Likewise.
13114         (Symbol_table::add_from_relobj): When building shared objects, do not
13115         treat externally visible symbols as garbage.
13116         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13117         table information for static and relocatable links.
13118         * symtab.h (Symbol_table::set_gc): New function.
13119         (Symbol_table::gc): New function.
13120         (Symbol_table::gc_mark_undef_symbols): New function.
13121         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13122         (Symbol_table::gc_mark_dyn_syms): New function.
13123         (Symbol_table::gc_): New data member.
13124         * target.h (Sized_target::gc_process_relocs): New pure virtual
13125         function.
13126         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13127         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13128
13129 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13130
13131         * options.h (General_options::gc_sections): Define as a no-op for now.
13132         (General_options::no_keep_memory): Ditto.
13133         (General_options::Bshareable): Define.
13134         * options.cc (General_options::finalize): Honor -Bshareable.
13135
13136 2009-01-20  Andreas Schwab  <schwab@suse.de>
13137
13138         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13139         read the value in the contents, since we don't use it.  Use the
13140         template endianness when writing.
13141         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13142
13143 2009-01-19  Andreas Schwab  <schwab@suse.de>
13144
13145         * configure.tgt (powerpc64-*): Fix targ_obj.
13146
13147 2009-01-15  Ian Lance Taylor  <iant@google.com>
13148
13149         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13150         local symbols when stripping all symbols.
13151
13152 2009-01-14  Cary Coutant  <ccoutant@google.com>
13153
13154         * output.cc (Output_reloc): Add explicit instantiations.
13155
13156 2009-01-14  Cary Coutant  <ccoutant@google.com>
13157
13158         * archive.cc (Archive::get_elf_object_for_member): Remove call
13159         to File_read::claim_for_plugin.
13160         * descriptors.cc (Descriptors::open): Remove reference to
13161         is_claimed.
13162         (Descriptors::claim_for_plugin): Remove.
13163         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13164         (Descriptors::is_claimed): Remove.
13165         (claim_descriptor_for_plugin): Remove.
13166         * fileread.cc (File_read::claim_for_plugin): Remove.
13167         * fileread.h (File_read::claim_for_plugin): Remove.
13168         (File_read::descriptor): Reopen descriptor if necessary.
13169         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13170         (Plugin_manager::all_symbols_read): Add task parameter. Change
13171         all callers.
13172         (Plugin_manager::get_input_file): New function.
13173         (Plugin_manager::release_input_file): New function.
13174         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13175         corresponding data member.
13176         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13177         and pass to base constructor. Change all callers.
13178         (get_input_file, release_input_file): New functions.
13179         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13180         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13181         (Plugin_manager::all_symbols_read): Add task parameter.
13182         (Plugin_manager::get_input_file): New function.
13183         (Plugin_manager::release_input_file): New function.
13184         (Plugin_manager::task_): New data member.
13185         (Pluginobj::Pluginobj): Add filesize parameter.
13186         (Pluginobj::filename): New function.
13187         (Pluginobj::descriptor): New function.
13188         (Pluginobj::filesize): New function.
13189         (Pluginobj::filesize_): New data member.
13190         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13191         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13192         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13193
13194         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13195         with archive libraries.
13196         * testsuite/Makefile.in: Regenerate.
13197         * testsuite/plugin_test.c (struct sym_info): New type.
13198         (get_input_file, release_input_file): New static variables.
13199         (onload): Capture new transfer vector entries.
13200         (claim_file_hook): Stop reading at end of file according to filesize.
13201         Factor out parsing of readelf output into separate function.
13202         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13203         APIs and get the source file name from the symbol table.  Convert
13204         source file name to corresponding object file name.  Print info
13205         message when adding new input files.
13206         (parse_readelf_line): New function.
13207         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13208         * testsuite/plugin_test_2.sh: Likewise.
13209         * testsuite/plugin_test_3.sh: Likewise.
13210         * testsuite/plugin_test_4.sh: New test case.
13211
13212 2009-01-07  Ian Lance Taylor  <iant@google.com>
13213
13214         * version.cc (version_string): Bump to 1.8.
13215
13216 2008-12-23  Cary Coutant  <ccoutant@google.com>
13217
13218         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13219         * plugin.cc (Plugin_manager::finish): Rename as
13220         layout_deferred_objects.  Move cleanup to separate function.
13221         (Plugin_manager::cleanup): New function.
13222         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13223         separately.
13224         * plugin.h (Plugin_manager::finish): Rename as
13225         layout_deferred_objects.
13226         (Plugin_manager::cleanup): New function.
13227         (Plugin_manager::cleanup_done): New field.
13228
13229 2008-12-23  Cary Coutant  <ccoutant@google.com>
13230
13231         * plugin.cc (is_visible_from_outside): New function.
13232         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13233         so we don't return "IR only" status for exported symbols or -r links.
13234
13235         * testsuite/Makefile.am (plugin_test_3): New test case.
13236         * testsuite/Makefile.in: Regenerate.
13237         * testsuite/plugin_test_3.sh: New file.
13238
13239 2008-12-22  Cary Coutant  <ccoutant@google.com>
13240
13241         * object.cc (Sized_relobj::layout_section): New function.
13242         (Sized_relobj::do_layout): Defer layout of input sections until after
13243         plugin has provided replacement files.
13244         (Sized_relobj::do_layout_deferred_sections): New function.
13245         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13246         (Relobj::layout_deferred_sections): New function.
13247         (Relobj::do_layout_deferred_sections): New function.
13248         (Sized_relobj::do_layout_deferred_sections): New function.
13249         (Sized_relobj::layout_section): New function.
13250         (Sized_relobj::Deferred_layout): New structure.
13251         (Sized_relobj::deferred_layout_): New field.
13252         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13253         Change all callers.  Layout deferred sections.
13254         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13255         references.
13256         (Plugin_hook::run): Move code from do_plugin_hook inline.
13257         (Plugin_hook::do_plugin_hook): Remove.
13258         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13259         (Plugin_manager::finish): Renamed, was cleanup.
13260         (Plugin_manager::should_defer_layout): New function.
13261         (Plugin_manager::add_deferred_layout_object): New function.
13262         (Plugin_manager::Deferred_layout_list): New type.
13263         (Plugin_manager::deferred_layout_objects_): New field.
13264         (Plugin_hook::do_plugin_hook): Remove.
13265
13266 2008-12-17  Ian Lance Taylor  <iant@google.com>
13267
13268         * options.h (class General_options): Add --no case for
13269         --export-dynamic.
13270
13271 2008-12-16  Cary Coutant  <ccoutant@google.com>
13272
13273         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13274         vector.
13275         (Plugin_manager::claim_file): Create plugin object even if
13276         plugin did not call the add_symbols callback.
13277         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13278         asking for more symbols than were added.
13279         * testsuite/Makefile.am (plugin_test_1): Add test case with
13280         no global symbols.
13281         (empty.syms): New target.
13282         * testsuite/Makefile.in: Regenerate.
13283         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13284         message. Don't call add_symbols if no globals.
13285         (all_symbols_read_hook): Don't provide replacement for empty
13286         claimed file.
13287
13288 2008-12-12  Ian Lance Taylor  <iant@google.com>
13289
13290         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13291         r_type == 0 for a local symbol with r_sym == 0.
13292         (scan_relocatable_relocs): Pass r_sym to
13293         local_non_section_strategy.
13294         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13295         r_sym parameter.
13296
13297         * configure.ac: Update test for TLS descriptors: they are
13298         supported as of glibc 2.9.
13299         * configure: Rebuild.
13300
13301 2008-12-11  Ian Lance Taylor  <iant@google.com>
13302
13303         PR 7091
13304         * target-reloc.h (Default_scan_relocatable_relocs): For each
13305         function, map r_type == 0 to RELOC_DISCARD.
13306
13307 2008-12-10  Cary Coutant  <ccoutant@google.com>
13308
13309         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13310         object to override a kept COMDAT group from a plugin object.
13311
13312 2008-12-09  Ian Lance Taylor  <iant@google.com>
13313
13314         PR 7088
13315         * yyscript.y (file_cmd): Handle INPUT.
13316
13317         * testsuite/initpri1.c: Change all declarations to be full
13318         prototypes by adding void, to avoid compiler warnings.
13319
13320 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13321
13322         * options.cc (General_options::parse_plugin_opt): New.
13323         (General_options::add_plugin): The argument now is just the filename.
13324         (General_options::add_plugin_option): New.
13325         * options.h (plugin_opt): New.
13326         (add_plugin): Change argument name.
13327         (add_plugin_option): New.
13328         * plugin.cc (Plugin::load): Don't parse the plugin option.
13329         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13330         (Plugin::add_option): New.
13331         (Plugin::args_): Change type.
13332         (Plugin::filename_): New.
13333         (Plugin_manager::add_plugin_option): New.
13334         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13335         * testsuite/Makefile.in: Regenerate.
13336
13337 2008-12-05  Cary Coutant  <ccoutant@google.com>
13338
13339         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13340         Handle --strip-lto-sections option.
13341         * options.h (strip_lto_sections): New option.
13342
13343 2008-12-01  Cary Coutant  <ccoutant@google.com>
13344
13345         * plugin.cc (ld_plugin_message): Change format parameter to const.
13346         Fix mismatch between new[] and delete.
13347
13348 2008-11-14  Cary Coutant  <ccoutant@google.com>
13349
13350         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13351         instead of -1U.
13352
13353 2008-11-05  Craig Silverstein  <csilvers@google.com>
13354
13355         * options.cc (General_options::parse_dynamic_list): New function.
13356         * options.h (General_options): New flags dynamic_list,
13357         dynamic_list_data, dynamic_list_cpp_new, and
13358         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13359         (General_options::in_dynamic_list): New function.
13360         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13361         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13362         (Lex::can_continue_name): Likewise.
13363         (yylex): Likewise.
13364         (read_script_file): New parameter script_options.
13365         (read_dynamic_list): New function.
13366         (Script_options::define_dynamic_list): New function.
13367         (dynamic_list_keyword_parsecodes): New variable.
13368         (dynamic_list_keywords): New variable.
13369         * script.h (Script_options::define_dynamic_list): New function
13370         prototype.
13371         (read_dynamic_list): New function prototype.
13372         * symtab.cc (strprefix): New macro.
13373         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13374         dynamic_list_data, dynamic_list_cpp_new, and
13375         dynamic_list_cpp_typeinfo.
13376         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13377         (dynamic_list_expr): New rule.
13378         (dynamic_list_nodes): Likewise.
13379         (dynamic_list_node): Likewise.
13380         * testsuite/Makefile.am (dynamic_list): New test.
13381         * testsuite/Makefile.in: Regenerated.
13382         * testsuite/dynamic_list.t: New file.
13383         * testsuite/dynamic_list.sh: New file.
13384
13385 2008-11-05  Craig Silverstein  <csilvers@google.com>
13386
13387         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13388         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13389         (t11_last): Likewise.
13390         * testsuite/ver_test_6.c (main): Likewise.
13391
13392 2008-10-07  Cary Coutant  <ccoutant@google.com>
13393
13394         * options.c (General_options::finalize): Add check for -static and
13395         -shared.
13396         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13397         is not empty.
13398
13399 2008-10-02  Cary Coutant  <ccoutant@google.com>
13400
13401         * plugin.cc (make_sized_plugin_object): Fix conditional
13402         compilation to work when not all targets are enabled.
13403
13404 2008-09-29  Cary Coutant  <ccoutant@google.com>
13405
13406         * archive.cc (Archive::get_file_and_offset): Use filename instead
13407         of name to get library path.
13408         (Archive::include_member): Unlock external member of a thin archive.
13409
13410         * testsuite/Makefile.am (TEST_AR): New variable.
13411         (thin_archive_test_1): New test.
13412         (thin_archive_test_2): New test.
13413         * testsuite/Makefile.in: Regenerate.
13414         * testsuite/thin_archive_main.cc: New file.
13415         * testsuite/thin_archive_test_1.cc: New file.
13416         * testsuite/thin_archive_test_2.cc: New file.
13417         * testsuite/thin_archive_test_3.cc: New file.
13418         * testsuite/thin_archive_test_4.cc: New file.
13419
13420 2008-09-29  Cary Coutant  <ccoutant@google.com>
13421
13422         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13423         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13424         instead of -1U.
13425         (Sized_relobj::do_finalize_local_symbols): Likewise.
13426         (Sized_relobj::map_to_kept_section): Likewise.
13427         * object.h (Sized_relobj::invalid_address): New constant.
13428         (Sized_relobj::do_output_section_offset): Check for invalid_address
13429         and return -1ULL.
13430         * output.cc (Output_reloc::local_section_offset): Use constant
13431         invalid_address instead of -1U.
13432         (Output_reloc::get_address): Likewise.
13433         (Output_section::output_address): Change -1U to -1ULL.
13434         * output.h (Output_reloc::invalid_address): New constant.
13435         * reloc.cc (Sized_relobj::write_sections): Use constant
13436         invalid_address instead of -1U.
13437         (Sized_relobj::relocate_sections): Likewise.
13438         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13439         values for merge sections.
13440         * target-reloc.h (relocate_for_relocatable): Use constant
13441         invalid_address instead of -1U.
13442
13443 2008-09-19  Cary Coutant  <ccoutant@google.com>
13444
13445         Add plugin functionality for link-time optimization (LTO).
13446         * configure.ac (plugins): Add --enable-plugins option.
13447         * configure: Regenerate.
13448         * config.in: Regenerate.
13449         * Makefile.am (LIBDL): New variable.
13450         (CCFILES): Add plugin.cc.
13451         (HFILES): Add plugin.h.
13452         (ldadd_var): Add LIBDL.
13453         * Makefile.in: Regenerate.
13454
13455         * archive.cc: Include "plugin.h".
13456         (Archive::setup): Don't preread archive symbols when using a plugin.
13457         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13458         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13459         files.
13460         (Archive::include_member): Add symbols from plugin objects.
13461         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13462         * descriptors.cc (Descriptors::open): Check for file descriptors
13463         abandoned by plugins.
13464         (Descriptors::claim_for_plugin): New function.
13465         * descriptors.h (Descriptors::claim_for_plugin): New function.
13466         (Open_descriptor::is_claimed): New field.
13467         (claim_descriptor_for_plugin): New function.
13468         * fileread.cc (File_read::claim_for_plugin): New function.
13469         * fileread.h (File_read::claim_for_plugin): New function.
13470         (File_read::descriptor): New function.
13471         * gold.cc: Include "plugin.h".
13472         (queue_initial_tasks): Add task to call plugin hooks for generating
13473         new object files.
13474         * main.cc: Include "plugin.h".
13475         (main): Load plugin libraries.
13476         * object.h (Pluginobj): Declare.
13477         (Object::pluginobj): New function.
13478         (Object::do_pluginobj): New function.
13479         (Object::set_target): New function.
13480         * options.cc: Include "plugin.h".
13481         (General_options::parse_plugin): New function.
13482         (General_options::General_options): Initialize plugins_ field.
13483         (General_options::add_plugin): New function.
13484         * options.h (Plugin_manager): Declare.
13485         (General_options): Add --plugin option.
13486         (General_options::has_plugins): New function.
13487         (General_options::plugins): New function.
13488         (General_options::add_plugin): New function.
13489         (General_options::plugins_): New field.
13490         * plugin.cc: New file.
13491         * plugin.h: New file.
13492         * readsyms.cc: Include "plugin.h".
13493         (Read_symbols::do_read_symbols): Check for archive before checking
13494         for ELF file.  Call plugin hooks to claim files.
13495         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13496         from a real object file; force override when processing replacement
13497         files.
13498         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13499         (Symbol::init_base_object): Likewise.
13500         (Symbol::init_base_output_data): Likewise.
13501         (Symbol::init_base_output_segment): Likewise.
13502         (Symbol::init_base_constant): Likewise.
13503         (Symbol::init_base_undefined): Likewise.
13504         (Symbol::output_section): Assert that object is not a plugin.
13505         (Symbol_table::add_from_pluginobj): New function.
13506         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13507         undefined.
13508         (Symbol_table::sized_write_globals): Likewise.
13509         (Symbol_table::add_from_pluginobj): Instantiate template.
13510         * symtab.h (Sized_pluginobj): Declare.
13511         (Symbol::in_real_elf): New function.
13512         (Symbol::set_in_real_elf): New function.
13513         (Symbol::in_real_elf_): New field.
13514         (Symbol_table::add_from_pluginobj): New function.
13515
13516         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13517         (LIBDL): New variable.
13518         (LDADD): Add LIBDL.
13519         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13520         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13521         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13522         (MOSTLYCLEANFILES): Likewise.
13523         * testsuite/Makefile.in: Regenerate.
13524         * testsuite/plugin_test.c: New file.
13525         * testsuite/plugin_test_1.sh: New file.
13526         * testsuite/plugin_test_2.sh: New file.
13527
13528 2008-09-16  Ian Lance Taylor  <iant@google.com>
13529
13530         * target-reloc.h (relocate_section): Check whether a symbol is
13531         defined by the ABI before reporting an undefined symbol error.
13532         * target.h (Target::is_defined_by_abi): Make parameter const.
13533         (Target::do_is_defined_by_abi): Likewise.
13534         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13535         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13536         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13537         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13538         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13539         * testsuite/Makefile.in: Rebuild.
13540
13541         * fileread.cc (make_view): Add casts to avoid warning.
13542
13543 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13544
13545         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13546         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13547
13548 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13549
13550         * options.h (General_options::output_is_executable): New.
13551         (General_options::output_is_pie): New.
13552         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13553         for shared libraries.
13554         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13555
13556 2008-09-11  Chris Demetriou  <cgd@google.com>
13557
13558         * options.h (origin): New -z option.
13559         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13560         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13561         in DT_FLAGS_1.
13562
13563 2008-09-05  Cary Coutant  <ccoutant@google.com>
13564
13565         * fileread.cc (File_read::make_view): Add check for attempt to map
13566         beyond end of file.
13567
13568 2008-09-05  Cary Coutant  <ccoutant@google.com>
13569
13570         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13571         explicit instantiations.
13572
13573 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13574
13575         PR gold/6858
13576         * options.cc (General_options::finalize): Allow undefined symbols
13577         in shlibs if linking -shared.
13578
13579         PR gold/6859
13580         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13581         symbols as not needing a dynsym entry.
13582
13583 2008-08-20  Craig Silverstein  <csilvers@google.com>
13584
13585         * fileread.cc (File_read::open): Do not lock the file unless it
13586         was successfully opened.
13587
13588 2008-08-14  Cary Coutant  <ccoutant@google.com>
13589
13590         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13591         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13592         * testsuite/tls_test.cc (struct int128): 128-bit struct
13593         for testing TLS relocs with non-zero addend.
13594         (v12): New TLS variable.
13595         (t12): New test.
13596         (t_last): Add check for v12.
13597         * testsuite/tls_test.h (t12): New function.
13598         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13599
13600 2008-08-13  Ian Lance Taylor  <iant@google.com>
13601
13602         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13603         set tls_segment_ or relro_segment_.
13604         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13605         when appropriate.
13606         * output.h (Output_section::clear_is_relro): New function.
13607         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13608         sections specially even when output_data_ is empty.
13609         (Output_segment::maximum_alignment): When first section is relro,
13610         only force alignment for PT_LOAD segments.
13611         * script.cc (script_data_segment_align): New function.
13612         (script_data_segment_relro_end): New function.
13613         * script-c.h (script_data_segment_align): Declare.
13614         (script_data_segment_relro_end): Declare.
13615         * script-sections.h (class Script_sections): Declare
13616         data_segment_align and data_segment_relro_end.  Add fields
13617         segment_align_index_ and saw_relro_end_.
13618         * script-sections.cc (class Sections_element): Add set_is_relro
13619         virtual function.  Add new bool* parameter to place_orphan_here.
13620         Add get_output_section virtual function.
13621         (class Output_section_definition): Add set_is_relro.  Add new
13622         bool* parameter to place_orphan_here.  Add get_output_section.
13623         Add is_relro_ field.
13624         (Output_section_definition::Output_section_definition): Initialize
13625         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13626         and is_relro_ fields.
13627         (Output_section_definition::place_orphan_here): Add is_relro
13628         parameter.
13629         (Output_section_definition::set_section_addresses): Set relro for
13630         output section.
13631         (Output_section_definition::alternate_constraint): Likewise.
13632         (class Orphan_output_section): Add new bool* parameter to
13633         place_orphan_here.  Add get_output_section.
13634         (Orphan_output_section::place_orphan_here): Add is_relro
13635         parameter.
13636         (Script_sections::Script_sections): Initialize
13637         data_segment_align_index_ and saw_relro_end_.
13638         (Script_sections::data_segment_align): New function.
13639         (Script_sections::data_segment_relro_end): New function.
13640         (Script_sections::place_orphan): Set or clear is_relro.
13641         (Script_sections::set_section_addresses): Force alignment of first
13642         TLS section.
13643         * yyscript.y (exp): Call script_data_segment_align and
13644         script_data_segment_relro_end.
13645         * testsuite/relro_script_test.t: New file.
13646         * testsuite/relro_test.cc (using_script): Declare.
13647         (t1, t2): Test using_script.
13648         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13649         (relro_script_test_SOURCES): Define.
13650         (relro_script_test_DEPENDENCIES): Define.
13651         (relro_script_test_LDFLAGS): Define.
13652         (relro_script_test_LDADD): Define.
13653         (relro_script_test.so): New target.
13654         * testsuite/Makefile.in: Rebuild.
13655
13656 2008-08-06  Cary Coutant <ccoutant@google.com>
13657
13658         * archive.cc (Archive::total_archives, Archive::total_members)
13659         (Archive::total_members_loaded): New variables.
13660         (Archive::setup): Add parameter.  Add option to preread
13661         archive symbols.
13662         (Archive::read_armap): Add counter.
13663         (Archive::get_file_and_offset): New function.
13664         (Archive::get_elf_object_for_member): New function.
13665         (Archive::read_all_symbols): New function.
13666         (Archive::read_symbols): New function.
13667         (Archive::add_symbols): Add counters.
13668         (Archive::include_all_members): Use armap to find members if it's
13669         already built.
13670         (Archive::include_member): Skip reading symbols if already read.
13671         Factored code into Archive::get_file_and_offset and
13672         Archive::get_elf_object_for_member.  Changed call to
13673         Mapfile::report_include_archive_member.
13674         (Archive::print_stats): New function.
13675         * archive.h: Declare Object and Read_symbols_data classes.
13676         (Archive::Archive): Add initializers for new members.
13677         (Archive::setup): Add parameter.
13678         (Archive::print_stats): New function.
13679         (Archive::total_archives, Archive::total_members)
13680         (Archive::total_members_loaded): New variables.
13681         (Archive::get_file_and_offset): New function.
13682         (Archive::get_elf_object_for_member): New function.
13683         (Archive::read_all_symbols): New function.
13684         (Archive::read_symbols): New function.
13685         (Archive::Archive_member): New class.
13686         (Archive::members_): New member.
13687         (Archive::num_members_): New member.
13688         * main.cc: Include archive.h.
13689         (main): Call Archive::print_stats.
13690         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13691         archive parameter; member_name is now the fully-decorated name.
13692         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13693         * options.h: (General_options): Add --preread-archive-symbols option.
13694         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13695         Archive::setup.
13696
13697 2008-08-04  Ian Lance Taylor  <iant@google.com>
13698
13699         * symtab.h (Symbol::use_plt_offset): New function.
13700         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13701         * powerpc.cc (Relocate::relocate): Likewise.
13702         * sparc.cc (Relocate::relocate): Likewise.
13703         * x86_64.cc (Relocate::relocate): Likewise.
13704         * testsuite/weak_plt.sh: New test.
13705         * testsuite/weak_plt_main.cc: New test.
13706         * testsuite/weak_plt_shared.cc: New test.
13707         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13708         (check_PROGRAMS): Add weak_plt.
13709         (check_DATA): Add weak_plt_shared.so.
13710         (weak_plt_main_pic.o, weak_plt): New targets.
13711         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13712         * testsuite/Makefile.in: Rebuild.
13713
13714         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13715         gcctestdir/ld.
13716         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13717         * testsuite/Makefile.in: Rebuild.
13718
13719 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13720
13721         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13722         * Makefile.in: Regenerate.
13723         * po/POTFILES.in: Regenerate.
13724
13725 2008-07-29  Ian Lance Taylor  <iant@google.com>
13726
13727         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13728         symbols before other symbols.
13729         * testsuite/script_test_2.cc (test_addr): Declare.
13730         (test_addr_alias): Declare.
13731         (main): Check that test_addr and test_addr_alias have the right
13732         values.
13733         * testsuite/script_test_2.t: Define test_addr_alias and
13734         test_addr.
13735
13736 2008-07-24  Ian Lance Taylor  <iant@google.com>
13737
13738         PR 5990
13739         * descriptors.cc: New file.
13740         * descriptors.h: New file.
13741         * gold-threads.h (class Hold_optional_lock): New class.
13742         * fileread.cc: Include "descriptors.h".
13743         (File_read::~File_read): Release descriptor rather than closing
13744         it.
13745         (File_read::open) [file]: Call open_descriptor rather than open.
13746         Set is_descriptor_opened_.
13747         (File_read::open) [memory]: Assert that descriptor is not open.
13748         (File_read::reopen_descriptor): New function.
13749         (File_read::release): Release descriptor.
13750         (File_read::do_read): Make non-const.  Reopen descriptor.
13751         (File_read::read): Make non-const.
13752         (File_read::make_view): Reopen descriptor.
13753         (File_read::do_readv): Likewise.
13754         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13755         Update declarations.
13756         * layout.cc: Include "descriptors.h".
13757         (Layout::create_build_id): Use open_descriptor rather than open.
13758         * output.cc: Include "descriptors.h".
13759         (Output_file::open): Use open_descriptor rather than open.
13760         * archive.cc (Archive::const_iterator): Change Archive to be
13761         non-const.
13762         (Archive::begin, Archive::end): Make non-const.
13763         (Archive::count_members): Likewise.
13764         * archive.h (class Archive): Update declarations.
13765         * object.h (Object::read): Make non-const.
13766         * Makefile.am (CCFILES): Add descriptors.cc.
13767         (HFILES): Add descriptors.h.
13768         * Makefile.in: Rebuild.
13769
13770         PR 6716
13771         * gold.h: Always include <clocale>.  Add Solaris workarounds
13772         following code in binutils/sysdep.h.
13773
13774         PR 6048
13775         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13776         this->eh_frame_hdr_ is NULL before using it.
13777
13778         * dynobj.cc (Versions::Versions): Update comment.
13779
13780         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13781         the base version name.
13782
13783         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13784         array size plus one.
13785         (Stringpool_template::set_string_offsets): Subtract one from key
13786         before using it as an array index.
13787         (Stringpool_template::get_offset_with_length): Likewise.
13788         (Stringpool_template::write_to_buffer): Likewise.
13789         * stringpool.h (Stringpool_template::get_offset_from_key):
13790         Likewise.
13791
13792 2008-07-23  Ian Lance Taylor  <iant@google.com>
13793
13794         PR 6658
13795         * object.h (Merged_symbol_value::value): Do our best to handle a
13796         negative addend.
13797
13798         PR 6647
13799         * script.cc (Version_script_info::get_versions): Don't add empty
13800         version tag to return value.
13801         (Version_script_info::get_symbol_version_helper): Change return
13802         type to bool.  Add pversion parameter.  Change all callers.
13803         (script_register_vers_node): Don't require a non-NULL tag.
13804         * script.h (class Version_script_info): Update declarations.
13805         (Version_script_info::get_symbol_version): Change return type to
13806         bool.  Add version parameter.  Change all callers.
13807         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13808         handling.  Handle an empty version from a version script.
13809         (Symbol_table::define_special_symbol): Likewise.
13810         * testsuite/ver_test_10.script: New file.
13811         * testsuite/ver_test_10.sh: New file.
13812         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13813         (check_DATA): Add ver_test_10.syms.
13814         (ver_test_10.syms, ver_test_10.so): New target.
13815         * testsuite/Makefile.in: Rebuild.
13816
13817 2008-07-23  Simon Baldwin  <simonb@google.com>
13818
13819         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13820         to zero for undefined symbols from dynamic libraries.
13821
13822 2008-07-23  Ian Lance Taylor  <iant@google.com>
13823
13824         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13825         Change all callers.
13826         * symtab.h (class Symbol_table): Update declaration.
13827         * testsuite/ver_test_9.cc: New file.
13828         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13829         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13830         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13831         (ver_test_9.so, ver_test_9.o): New targets.
13832         * testsuite/Makefile.in: Rebuild.
13833
13834 2008-07-22  Ian Lance Taylor  <iant@google.com>
13835
13836         * options.h (class General_options): Define --check-sections.
13837         * layout.cc (Layout::set_segment_offsets): Handle
13838         --check-sections.
13839
13840         * options.h (class General_options): Define -n/--nmagic and
13841         -N/--omagic.
13842         * options.cc (General_options::finalize): For -n/--nmagic or
13843         -N/--omagic, set -static.
13844         * layout.cc (Layout::attach_allocated_section_to_segment): If
13845         -N/--omagic, don't put read-only and read-write sections in
13846         different segments.
13847         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13848         finding a read-only segment.
13849         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13850         don't set the minimum segment alignment to the common page size,
13851         and don't set the file offset to the address modulo the page size.
13852         * script-sections.cc (Script_sections::create_segments): If
13853         -n/--omagic, don't put read-only and read-write sections in
13854         different segments.
13855
13856         * cref.cc: New file.
13857         * cref.h: New file.
13858         * options.h (class General_options): Add --print-symbol-counts.
13859         * main.cc (main): Issue defined symbol report if requested.
13860         * archive.cc (Archive::interpret_header): Make into a const member
13861         function.
13862         (Archive::add_symbols): Call Input_objects::archive_start and
13863         archive_stop.
13864         (Archive::const_iterator): Define new class.
13865         (Archive::begin, Archive::end): New functions.
13866         (Archive::include_all_members): Rewrite to use iterator.
13867         (Archive::count_members): New function.
13868         * archive.h (class Archive): Update declarations.
13869         (Archive::filename): New function.
13870         * object.cc: Include "cref.h".
13871         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13872         (Sized_relobj::do_get_global_symbol_counts): New function.
13873         (Input_objects::add_object): Add object to cross-referencer.
13874         (Input_objects::archive_start): New function.
13875         (Input_objects::archive_stop): New function.
13876         (Input_objects::print_symbol_counts): New function.
13877         * object.h: Declare Cref and Archive.
13878         (Object::get_global_symbol_counts): New function.
13879         (Object::do_get_global_symbol_counts): New pure virtual function.
13880         (class Sized_relobj): Add defined_count_ field.  Update
13881         declarations.
13882         (class Input_objects): Add cref_ field.  Update constructor.
13883         Update declarations.
13884         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13885         defined_count_.
13886         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13887         symbol counts.
13888         (Sized_dynobj::do_get_global_symbol_counts): New function.
13889         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13890         defined_count_.  Update declarations.  Define Symbols typedef.
13891         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13892         parameter.  Change all callers.
13893         (Symbol_table::add_from_dynobj): Add sympointers and defined
13894         parameters.  Change all callers.
13895         * symtab.h (class Symbol_table): Update declarations.
13896         * Makefile.am (CCFILES): Add cref.cc.
13897         (HFILES): Add cref.h.
13898         * Makefile.in: Rebuild.
13899
13900 2008-07-22  Simon Baldwin  <simonb@google.com>
13901
13902         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13903         to zero when writing undefined symbols.
13904
13905 2008-07-22  Ian Lance Taylor  <iant@google.com>
13906
13907         * output.cc (Output_section::add_input_section): Don't try to
13908         merge empty merge sections.
13909
13910 2008-07-21  Craig Silverstein  <csilvers@google.com>
13911
13912         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13913         Include symbol version in error message.
13914
13915 2008-07-20  Chris Demetriou  <cgd@google.com>
13916
13917         * configure.ac (gold_cv_c_random_seed): New configured variable.
13918         (RANDOM_SEED_CFLAGS): New substituted variable.
13919         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13920         * configure: Rebuild.
13921         * Makefile.in: Likewise.
13922         * testsuite/Makefile.in: Likewise.
13923
13924 2008-07-18  Ian Lance Taylor  <iant@google.com>
13925
13926         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13927         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13928         * testsuite/ver_test_main.cc (main): Call t4.
13929         (t4, t4_2a): Define.
13930         * testsuite/ver_test_2.cc (t4_2): Define.
13931         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13932         * testsuite/ver_test_4.cc (t4_2a): Define.
13933         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13934         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13935
13936 2008-07-17  Ian Lance Taylor  <iant@google.com>
13937
13938         * dynobj.cc (Versions::add_def): If we give an error about a
13939         missing version, go ahead and create the version anyhow.
13940
13941 2008-07-10  Ian Lance Taylor  <iant@google.com>
13942
13943         Handle output sections with more than 0x7fffffff bytes.
13944         * object.h (class Relobj): Change map_to_output_ to
13945         output_sections_, and just keep a section pointer.  Change all
13946         uses.  Move comdat group support to Sized_relobj.
13947         (Relobj::is_section_specially_mapped): Remove.
13948         (Relobj::output_section): Remove poff parameter.  Change all
13949         callers.
13950         (Relobj::output_section_offset): New function.
13951         (Relobj::set_section_offset): Rewrite.
13952         (Relobj::map_to_output): Remove.
13953         (Relobj::output_sections): New function.
13954         (Relobj::do_output_section_offset): New pure virtual function.
13955         (Relobj::do_set_section_offset): Likewise.
13956         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13957         group support from Relobj.  Update declarations.
13958         (Sized_relobj::get_output_section_offset): New function.
13959         (Sized_relobj::do_output_section_offset): New function.
13960         (Sized_relobj::do_set_section_offset): New function.
13961         * object.cc (Relobj::output_section_address): Remove.
13962         (Sized_relobj::Sized_relobj): Initialize new fields.
13963         (Sized_relobj::include_section_group): Cast find_kept_object to
13964         Sized_relobj.
13965         (Sized_relobj::include_linkonce_section): Likewise.
13966         (Sized_relobj::do_layout): Use separate arrays for output section
13967         and output offset.
13968         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13969         output_sections.
13970         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13971         output_sections and section_offsets.
13972         (Sized_relobj::write_local_symbols): Likewise.
13973         (map_to_kept_section): Compute output address directly.
13974         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13975         output_sections and section_offsets.
13976         (Sized_relobj::write_sections): Likewise.
13977         (Sized_relobj::relocate_sections): Likewise.
13978         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13979         * output.h (class Output_reloc): Update declarations.  Change
13980         u2_.relobj to Sized_relobj*.
13981         (class Output_data_reloc): Change add functions to use
13982         Sized_relobj*.
13983         * output.cc (Output_reloc::Output_reloc): Change relobj to
13984         Sized_relobj*.
13985         (Output_reloc::local_section_offset): Change return type to
13986         Elf_Addr.  Use get_output_section_offset.
13987         (Output_reloc::get_address): Likewise.
13988         (Output_section::is_input_address_mapped): Don't call
13989         is_section_specially_mapped.
13990         (Output_section::output_offset): Likewise.
13991         (Output_section::output_address): Likewise.
13992         (Output_section::starting_output_address): Likewise.
13993         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13994         parameter to Sized_relobj*.
13995         (Copy_relocs::need_copy_reloc): Likewise.
13996         (Copy_relocs::save): Likewise.
13997         * copy-relocs.h (class Copy_relocs): Update declarations.
13998         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13999         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14000         * target-reloc.h (relocate_for_relocatable): Change
14001         offset_in_output_section type to Elf_Addr.  Change code that uses
14002         it as well.
14003         * layout.cc (Layout::layout): Always set *off.
14004         * mapfile.cc (Mapfile::print_input_section): Use
14005         output_section_offset.
14006         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14007         Sized_relobj*.
14008         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14009         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14010         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14011
14012 2008-07-03  Ian Lance Taylor  <iant@google.com>
14013
14014         * layout.cc (Layout::include_section): Do not discard unrecognized
14015         SHT_STRTAB sections.
14016
14017 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14018
14019         * script.cc (Lex::can_continue_name): Make '?' allowable in
14020         version-script names.
14021         * testsuite/version_script.map: Change glob pattern to use '?'
14022
14023 2008-06-30  Manish Singh  <yosh@gimp.org>
14024
14025         PR 6585
14026         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14027         Correct typo.
14028
14029 2008-06-30  Ian Lance Taylor  <iant@google.com>
14030
14031         PR 6660
14032         PR 6682
14033         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14034         versions]: Don't try to read the value in the contents, since we
14035         don't use it.  Use the template endianness when writing.
14036
14037 2008-06-25  Cary Coutant  <ccoutant@google.com>
14038
14039         * fileread.cc (File_read::make_view): Assert on zero-length view.
14040         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14041         symbol table when there are no symbols to read.
14042
14043 2008-06-23  Craig Silverstein  <csilvers@google.com>
14044
14045         * version.cc (version_string): Bump to 1.7
14046
14047 2008-06-18  Craig Silverstein  <csilvers@google.com>
14048
14049         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14050         constant 0xFFFF to type Valtype.
14051         (Powerpc_relocate_functions::rel16_ha): Likewise.
14052
14053 2008-06-17  Ian Lance Taylor  <iant@google.com>
14054
14055         * output.h (Output_section::Input_section): Initialize p2align_ to
14056         zero for Output_section_data constructors.
14057         (Output_section::Input_section::addralign): If not an input
14058         section, return the alignment of the Output_section_data.
14059         * testsuite/copy_test.cc: New file.
14060         * testsuite/copy_test_1.cc: New file.
14061         * testsuite/copy_test_2.cc: New file.
14062         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14063         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14064         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14065         (copy_test_1_pic.o, copy_test_1.so): New targets.
14066         (copy_test_2_pic.o, copy_test_2.so): New targets.
14067         * testsuite/Makefile.in: Rebuild.
14068
14069         * script-sections.cc (Script_sections::place_orphan): Initialize
14070         local variable exact.
14071
14072 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14073
14074         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14075
14076 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14077             David S. Miller  <davem@davemloft.net>
14078
14079         * powerpc.cc: New file.
14080         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14081         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14082         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14083         * Makefile.in: Rebuild.
14084
14085 2008-06-09  Ian Lance Taylor  <iant@google.com>
14086
14087         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14088         <exception>.
14089         (throwing, orig_terminate): New static variables.
14090         (terminate_handler): New static function.
14091         (t2): Set terminate handler.
14092
14093 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14094
14095         PR 6584
14096         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14097         alignment.
14098
14099 2008-05-30  Cary Coutant  <ccoutant@google.com>
14100
14101         * archive.cc (Archive::include_all_members) Correct to step
14102         over symbol table and extended name table in thin archives.
14103
14104 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14105
14106         PR 6407
14107         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14108         calculation.
14109
14110 2008-05-28  Caleb Howe  <cshowe@google.com>
14111
14112         * reduced_debug_output.cc: New file.
14113         * reduced_debug_output.h: New file.
14114         * options.h (class General_options): Add --strip-debug-non-line.
14115         * options.cc (General_options::finalize): Add strip_debug_non_line
14116         to the strip heirarchy.
14117         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14118         fields.
14119         * layout.cc: Include "reduced_debug_output.h".
14120         (Layout::Layout): Initialize new fields.
14121         (line_only_debug_sections): New static array.
14122         (is_lines_only_debug_sections): New static inline function.
14123         (Layout::include_section): Handle --strip-debug-non-line.
14124         (Layout::make_output_section): If --strip-debug-non-line, build
14125         new output sections for .debug_abbrev and .debug_info.
14126         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14127         gold.  Warn about possible overflow.
14128         (read_signed_LEB_128): Likewise.
14129         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14130         (read_signed_LEB_128): Declare.
14131         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14132         (HFILES): Add reduced_debug_output.h.
14133         * Makefile.in: Rebuild.
14134
14135 2008-05-21  Ian Lance Taylor  <iant@google.com>
14136
14137         * mapfile.cc: New file.
14138         * mapfile.h: New file.
14139         * options.h (class General_options): Add -M/--print-map and -Map.
14140         * options.cc (General_options::finalize): Make -M equivalent to
14141         -Map -.
14142         * main.cc: Include <cstdio> and "mapfile.h".
14143         (main): Open mapfile if requested.
14144         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14145         constructor.  Change caller.
14146         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14147         (queue_middle_tasks): Likewise.
14148         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14149         declarations.
14150         * archive.cc: Include "mapfile.h".
14151         (Archive::add_symbols): Add mapfile parameter.  Change all
14152         callers.  Pass mapfile, symbol, and reason to include_member.
14153         (Archive::include_all_members): Add mapfile parameter.  Change all
14154         callers.
14155         (Archive::include_member): Add mapfile, sym, and why parameters.
14156         Change all callers.  Report inclusion to map file.
14157         * archive.h: Include "fileread.h".
14158         (class Archive): Update declarations.
14159         (Archive::file): New const method.
14160         (class Add_archive_symbols): Add mapfile_ field.  Update
14161         constructor.  Change all callers.
14162         * readsyms.h (class Read_symbols): Likewise.
14163         (class Finish_group): Likewise.
14164         (class Read_script): Likewise.
14165         * common.cc: Include "mapfile.h".
14166         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14167         all callers.
14168         (Symbol_table::do_allocate_commons): Likewise.
14169         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14170         symbol allocation to mapfile.
14171         * common.h (class Allocate_commons_task): Add mapfile_ field.
14172         Update constructor.  Change all callers.
14173         * symtab.h (class Symbol_table): Update declarations.
14174         * layout.cc: Include "mapfile.h".
14175         (Layout_task_runner::run): Print information to mapfile.
14176         (Layout::create_gold_note): Change Output_data_fixed_space to
14177         Output_data_zero_fill.
14178         (Layout::create_build_id): Likewise.
14179         (Layout::print_to_mapfile): New function.
14180         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14181         constructor.  Change caller.
14182         (class Layout): Declare print_to_mapfile.
14183         * output.cc (Output_section::Input_section::print_to_mapfile): New
14184         function.
14185         (Output_section::add_input_section): If producing a map, always
14186         add to input_sections_ list.
14187         (Output_section::do_print_to_mapfile): New function.
14188         (Output_segment::print_sections_to_mapfile): New function.
14189         (Output_segment::print_section_list_to_mapfile): New function.
14190         * output.h: Include "mapfile.h".
14191         (Output_data::print_to_mapfile): New function.
14192         (Output_data::do_print_to_mapfile): New virtual function.
14193         (Output_segment_headers::do_print_to_mapfile): New function.
14194         (Output_file_header::do_print_to_mapfile): New function.
14195         (Output_data_const::do_print_to_mapfile): New function.
14196         (class Output_data_const_buffer): Add map_name_ field.  Update
14197         constructor.  Change all callers.  Add do_print_to_mapfile
14198         function.
14199         (class Output_data_fixed_space): Likewise.
14200         (class Output_data_space): Likewise.
14201         (class Output_data_zero_fill): New class.
14202         (Output_data_strtab::do_print_to_mapfile): New function.
14203         (Output_data_reloc_base::do_print_to_mapfile): New function.
14204         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14205         (Output_data_group::do_print_to_mapfile): New function.
14206         (Output_data_got::do_print_to_mapfile): New function.
14207         (Output_data_dynamic::do_print_to_mapfile): New function.
14208         (Output_symtab_xindex::do_print_to_mapfile): New function.
14209         (class Output_section): Declare do_print_to_mapflie.  Declare
14210         print_to_mapfile in Input_section.
14211         (class Output_segment): Declare new functions.
14212         * object.h (Sized_relobj::symbol_count): New function.
14213         * script-sections.cc
14214         (Output_section_element_dot_assignment::set_section_addresses):
14215         Change Output_data_fixed_space to Output_data_zero_fill.
14216         (Output_data_expression::do_print_to_mapfile): New function.
14217         * script.cc (read_input_script): Add mapfile parameter.  Change
14218         all callers.
14219         * script.h (read_input_script): Update declaration.
14220         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14221         (Eh_frame::do_print_to_mapfile): New function.
14222         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14223         (Output_merge_string::do_print_to_mapfile): New function.
14224         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14225         function.
14226         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14227         function.
14228         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14229         function.
14230         * Makefile.am (CCFILES): Add mapfile.cc.
14231         (HFILES): Add mapfile.h.
14232         * Makefile.in: Rebuild.
14233
14234 2008-05-19  Ian Lance Taylor  <iant@google.com>
14235
14236         * options.h (class General_options): Add -z relro.
14237         * layout.cc (Layout::Layout): Initialize relro_segment_.
14238         (Layout::add_output_section_data): Return the output section.
14239         (Layout::make_output_section): Rcognize relro sections and mark
14240         them appropriately.
14241         (Layout::attach_allocated_section_to_segment): Put relro sections
14242         in a PT_GNU_RELRO segment.
14243         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14244         section as relro.
14245         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14246         PT_TLS segments.
14247         (Layout::linkonce_mapping): Map d.rel.ro.local to
14248         .data.rel.ro.local.
14249         (Layout::output_section_name): Us .data.rel.ro.local for any
14250         section which begins with that.
14251         * layout.h (class Layout): Update add_output_section_data
14252         declaration.  Add relro_segment_ field.
14253         * output.cc (Output_section::Output_section): Initialize is_relro_
14254         and is_relro_local_ fields.
14255         (Output_segment::add_output_section): Group relro sections.
14256         (Output_segment::is_first_section_relro): New function.
14257         (Output_segment::maximum_alignment): If there is a relro section,
14258         align the segment to the common page size.
14259         (Output_segment::set_section_addresses): Track whether we are
14260         looking at relro sections.  If the last section is a relro
14261         section, align to the common page size.
14262         (Output_segment::set_section_list_addresses): Add in_relro
14263         parameter.  Change all callers.  Align to the page size when
14264         moving from relro to non-relro section.
14265         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14266         segment.
14267         * output.h (class Output_section): Add is_relro_ and
14268         is_relro_local_ fields.
14269         (Output_section::is_relro): New function.
14270         (Output_section::set_is_relro): New function.
14271         (Output_section::is_relro_local): New function.
14272         (Output_section::set_is_relro_local): New function.
14273         (class Output_segment): Update declarations.
14274         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14275         * sparc.cc (Target_sparc::got_section): Likewise.
14276         * x86_64.cc (Target_x86_64::got_section): Likewise.
14277         * testsuite/relro_test_main.cc: New file.
14278         * testsuite/relro_test.cc: New file.
14279         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14280         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14281         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14282         (relro_test.so, relro_test_pic.o): New targets.
14283         * testsuite/Makefile.in: Rebuild.
14284
14285 2008-05-16  Ian Lance Taylor  <iant@google.com>
14286
14287         * output.cc (Output_segment::add_output_section): Remove front
14288         parameter.
14289         * output.h (class Output_segment): Remove
14290         add_initial_output_section and overloaded add_output_section.
14291         Update declaration of remaining add_output_section.
14292         * layout.cc (Layout::create_interp): Call add_output_section
14293         rather than add_initial_output_section.
14294         (Layout::finish_dynamic_section): Likewise.
14295
14296         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14297         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14298         know the dynamic type.
14299         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14300         field.  Initialize it in constructor.
14301         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14302         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14303         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14304         reloc.
14305
14306         * output.cc (Output_reloc::get_address): Change return type to
14307         Elf_Addr.
14308         * output.h (class Output_reloc): Update get_address declaration.
14309         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14310         for section addresses.
14311
14312 2008-05-09  Ian Lance Taylor  <iant@google.com>
14313
14314         PR 6493
14315         * gold.cc (gold_nomem): Use return value of write.
14316
14317 2008-05-08  Ian Lance Taylor  <iant@google.com>
14318
14319         * symtab.c (Symbol::init_base_output_data): Add version
14320         parameter.  Change all callers.
14321         (Symbol::init_base_output_segment): Likewise.
14322         (Symbol::init_base_constant): Likewise.
14323         (Symbol::init_base_undefined): Likewise.
14324         (Sized_symbol::init_output_data): Likewise.
14325         (Sized_symbol::init_output_segment): Likewise.
14326         (Sized_symbol::init_constant): Likewise.
14327         (Sized_symbol::init_undefined): Likewise.
14328         (Symbol_table::do_define_in_output_data): If the new symbol has a
14329         version, mark it as the default.
14330         (Symbol_table::do_define_in_output_segment): Likewise.
14331         (Symbol_table::do_define_as_constant): Likewise.
14332         * symtab.h (class Symbol): Update declarations.
14333         (class Sized_symbol): Likewise.
14334         * resolve.cc (Symbol::override_version): New function.
14335         (Symbol::override_base): Call override_version.
14336         (Symbol::override_base_with_special): Likewise.
14337         * testsuite/ver_script_8.script: New file.
14338         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14339         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14340         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14341         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14342
14343 2008-05-06  Ian Lance Taylor  <iant@google.com>
14344
14345         PR 6049
14346         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14347         functions.
14348         (class General_options): Remove existing --undefined, and add
14349         --no-undefined instead.  Add new --undefined as synonym for -u.
14350         * archive.cc (Archive::add_symbols): Check whether symbol was
14351         named with -u.
14352         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14353         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14354         all uses.  Add IS_UNDEFINED.  Update declarations to split
14355         different versions of init_base.  Declare init_base_undefined.
14356         (Symbol::is_defined): Handle IS_UNDEFINED.
14357         (Symbol::is_undefined): Likewise.
14358         (Symbol::is_weak_undefined): Call is_undefined.
14359         (Symbol::is_absolute): Handle IS_CONSTANT.
14360         (class Sized_symbol): Update declarations to split different
14361         versions of init.  Declare init_undefined.
14362         (class Symbol_table): Declare new functions.
14363         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14364         Change all callers.
14365         (Symbol::init_base_output_data): Likewise.
14366         (Symbol::init_base_output_segment): Likewise.
14367         (Symbol::init_base_constant): Likewise.
14368         (Symbol::init_base_undefined): New function.
14369         (Sized_symbol::init_object): Rename from init.  Change all
14370         callers.
14371         (Sized_symbol::init_output_data): Likewise.
14372         (Sized_symbol::init_output_segment): Likewise.
14373         (Sized_symbol::init_constant): Likewise.
14374         (Sized_symbol::init_undefined): New function.
14375         (Symbol_table::add_undefined_symbols_from_command_line): New
14376         function.
14377         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14378         function.
14379         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14380         (Symbol::output_section): Likewise.
14381         (Symbol::set_output_section): Likewise.
14382         (Symbol_table::sized_finalize_symbol): Likewise.
14383         (Symbol_table::sized_write_globals): Likewise.
14384         * resolve.cc (Symbol_table::should_override): Likewise.
14385         (Symbol::override_base_with_special): Likewise.
14386
14387         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14388         symbol, change it to have default visibility.
14389         * testsuite/protected_1.cc: New file.
14390         * testsuite/protected_2.cc: New file.
14391         * testsuite/protected_3.cc: New file.
14392         * testsuite/protected_main_1.cc: New file.
14393         * testsuite/protected_main_2.cc: New file.
14394         * testsuite/protected_main_3.cc: New file.
14395         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14396         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14397         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14398         (protected_1.so): New target.
14399         (protected_1_pic.o, protected_2_pic.o): New targets.
14400         (protected_3_pic.o): New target.
14401         (check_PROGRAMS): Add protected_2.
14402         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14403         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14404         * testsuite/Makefile.in: Rebuild.
14405
14406         * options.h (DEFINE_var): Add set_user_set_##varname__.
14407         (DEFINE_bool_alias): New macro.
14408         (class General_options): Define -Bstatic using DEFINE_bool_alias
14409         rather than DEFINE_special.  Add --undefined as an alias for -z
14410         defs.
14411         * options.cc (General_options::parse_Bstatic): Remove.
14412
14413         * options.h (class General_options): Add --fatal-warnings.
14414         * main.cc (main): Implement --fatal-warnings.
14415         * errors.h (Errors::warning_count): New function.
14416
14417         * options.h (class General_options): Add -Bsymbolic-functions.
14418         * symtab.h (Symbol::is_preemptible): Check for
14419         -Bsymbolic-functions.
14420
14421 2008-05-05  Ian Lance Taylor  <iant@google.com>
14422
14423         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14424         as noVARNAME rather than no-VARNAME.
14425         (class General_options): Add option -z combreloc.
14426         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14427         get_address.
14428         (Output_reloc::sort_before) [SHT_REL]: New function.
14429         (Output_reloc::sort_before) [SHT_RELA]: New function.
14430         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14431         Sort_relocs_comparison.
14432         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14433         parameter.  Change all callers.
14434         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14435         sort_relocs parameter.  Change all callers.
14436         * output.cc (Output_reloc::get_address): New function, broken out
14437         of write_rel.
14438         (Output_reloc::write_rel): Call it.
14439         (Output_reloc::compare): New function.
14440         (Output_data_reloc_base::do_write): Optionally sort relocs.
14441
14442         * configure.ac: If targ_extra_obj is set, link it in.
14443         * configure.tgt: Initialize all variables.
14444         (x86_64*): Set targ_extra_obj and targ_extra_size.
14445         * configure: Rebuild.
14446
14447         * object.cc (Sized_relobj::include_section_group): Adjust section
14448         indexes read from group data.  Build vector to pass to
14449         layout_group.
14450         * layout.cc (Layout::layout_group): Add flags and shndxes
14451         parameters.  Remove contents parameter.  Change caller.  Update
14452         explicit instantiations.
14453         * layout.h (class Layout): Update layout_group declaration.
14454         * output.cc (Output_data_group::Output_data_group): Add flags and
14455         input_shndxes parameters.  Remove contents parameter.  Change
14456         caller.
14457         (Output_data_group::do_write): Change input_sections_ to
14458         input_shndxes_.
14459         * output.h (class Output_data_group): Update constructor
14460         declaration.  Rename input_sections_ to input_shndxes_.
14461         * testsuite/many_sections_test.cc: Add template.
14462
14463 2008-04-30  Cary Coutant  <ccoutant@google.com>
14464
14465         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14466
14467         * layout.cc (Layout::include_section): Refactored check for debug
14468         info section.
14469         (Layout::add_comdat): Add new parameters.  Change type
14470         of signature parameter.  Add object and shndx to signatures table.
14471         (Layout::find_kept_object): New function.
14472         * layout.h: Include <cstring>.
14473         (Layout::is_debug_info_section): New function.
14474         (Layout::add_comdat): Add new parameters.
14475         (Layout::find_kept_object): New function.
14476         (Layout::Kept_section): New struct.
14477         (Layout::Signatures): Change type of map range.
14478         * object.cc (Relobj::output_section_address): New function.
14479         (Sized_relobj::include_section_group): Add new parameters.  Change
14480         calls to Layout::add_comdat.  Change to build table of kept comdat
14481         groups and table mapping discarded sections to kept sections.
14482         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14483         (Sized_relobj::do_layout): Change calls to include_section_group and
14484         include_linkonce_section.
14485         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14486         value to zero when section is discarded.
14487         (Sized_relobj::map_to_kept_section): New function.
14488         * object.h (Relobj::output_section_address): New function.
14489         (Relobj::Comdat_group): New type.
14490         (Relobj::find_comdat_group): New function.
14491         (Relobj::Comdat_group_table): New type.
14492         (Relobj::Kept_comdat_section): New type.
14493         (Relobj::Kept_comdat_section_table): New type.
14494         (Relobj::add_comdat_group): New function.
14495         (Relobj::set_kept_comdat_section): New function.
14496         (Relobj::get_kept_comdat_section): New function.
14497         (Relobj::comdat_groups_): New field.
14498         (Relobj::kept_comdat_sections_): New field.
14499         (Symbol_value::input_value): Update comment.
14500         (Sized_relobj::map_to_kept_section) New function.
14501         (Sized_relobj::include_linkonce_section): Add new parameter.
14502         * target-reloc.h (Comdat_behavior): New type.
14503         (get_comdat_behavior): New function.
14504         (relocate_section): Add code to map a discarded section to the
14505         corresponding kept section when applying a relocation.
14506
14507 2008-04-30  Craig Silverstein  <csilvers@google.com>
14508
14509         * dwarf_reader.cc (next_generation_count): New static var.
14510         (Addr2line_cache_entry): New struct.
14511         (addr2line_cache): New static var.
14512         (Dwarf_line_info::one_addr2line): Added caching.
14513         (Dwarf_line_info::clear_addr2line_cache): New function.
14514         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14515         cache-size parameter.
14516         (Dwarf_line_info::one_addr2line_cache): New function.
14517         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14518         new cache-size argument to one_addr2line(), and clear cache.
14519
14520 2008-04-28  Cary Coutant  <ccoutant@google.com>
14521
14522         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14523         R_386_PC8 relocations.
14524
14525 2008-04-23  Ian Lance Taylor  <iant@google.com>
14526
14527         * object.cc (Sized_relobj::include_section_group): Check for
14528         invalid section group.
14529
14530         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14531         header size.
14532
14533         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14534         than read for file header.
14535         * archive.cc (Archive::include_member): Likewise.
14536
14537 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14538
14539         * aclocal.m4: Regenerate.
14540         * configure: Regenerate.
14541
14542 2008-04-19  Ian Lance Taylor  <iant@google.com>
14543
14544         * version.cc (version_string): Bump to 1.6.
14545
14546         * testsuite/Makefile.am (many_sections_r_test): New target.
14547         (many_sections_r_test_SOURCES): Remove.
14548         (many_sections_r_test_DEPENDENCIES): Remove.
14549         (many_sections_r_test_LDFLAGS): Remove.
14550         (many_sections_r_test_LDADD): Remove.
14551
14552         * object.cc (Sized_relobj::do_add_symbols): Always pass
14553         local_symbol_count_ to add_from_relobj.
14554
14555         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14556         every thousand variables.
14557         * testsuite/Makefile.in: Rebuild.
14558
14559         * object.cc (Xindex::initialize_symtab_xindex): New function.
14560         (Xindex::read_symtab_xindex): New function.
14561         (Xindex::sym_xindex_to_shndx): New function.
14562         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14563         available.
14564         (Sized_relobj::do_initialize_xindex): New function.
14565         (Sized_relobj::do_read_symbols): Adjust section links.
14566         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14567         parameter.  Change all callers.
14568         (Sized_relobj::include_section_group): Adjust section links and
14569         symbol section indexes.
14570         (Sized_relobj::do_layout): Adjust section links.
14571         (Sized_relobj::do_count_local_symbols): Adjust section links and
14572         symbol section indexes.
14573         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14574         ordinary and special symbols.
14575         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14576         dynsym_xindex parameters.  Change all callers.  Adjust section
14577         links.  Use SHN_XINDEX when needed.
14578         (Sized_relobj::get_symbol_location_info): Adjust section links.
14579         Don't get fooled by special symbols.
14580         * object.h (class Xindex): Define.
14581         (class Object): Add xindex_ parameter.  Declare virtual functoin
14582         do_initialize_xindex.
14583         (Object::adjust_sym_shndx): New function.
14584         (Object::set_xindex): New protected function.
14585         (class Symbol_value): Add is_ordinary_shndx_ field.
14586         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14587         (Symbol_value::value): Assert ordinary section.
14588         (Symbol_value::initialize_input_to_output_map): Likewise.
14589         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14590         Change all callers.
14591         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14592         all callers.
14593         (class Sized_relobj): Update declarations.
14594         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14595         parameter.  Change all callers.
14596         (Sized_relobj::adjust_shndx): New function.
14597         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14598         field.
14599         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14600         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14601         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14602         (Sized_dynobj::read_dynsym_section): Adjust section links.
14603         (Sized_dynobj::read_dynamic): Likewise.
14604         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14605         section links.
14606         (Sized_dynobj::do_initialize_xindex): New function.
14607         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14608         do_initialize_xindex.
14609         (Sized_dynobj::adjust_shndx): New function.
14610         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14611         dynsym_xindex_ fields.
14612         (Layout::finalize): Add a call to set_section_indexes before
14613         creating the symtab sections.
14614         (Layout::set_section_indexes): Don't do anything if the section
14615         already has a section index.
14616         (Layout::create_symtab_sections): Add shnum parameter.  Change
14617         caller.  Create .symtab_shndx section if needed.
14618         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14619         caller.
14620         (Layout::allocated_output_section_count): New function.
14621         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14622         needed.
14623         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14624         fields.  Update declarations.
14625         (Layout::symtab_xindex): New function.
14626         (Layout::dynsym_xindex): New function.
14627         (class Write_symbols_task): Add layout_ field.
14628         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14629         Change caller.
14630         * output.cc (Output_section_headers::Output_section_headers): Add
14631         shstrtab_section parameter.  Change all callers.
14632         (Output_section_headers::do_sized_write): Store overflow values
14633         for section count and section string table section index in
14634         section header zero.
14635         (Output_file_header::do_sized_write): Check for overflow of
14636         section count and section string table section index.
14637         (Output_symtab_xindex::do_write): New function.
14638         (Output_symtab_xindex::endian_do_write): New function.
14639         * output.h (class Output_section_headers): Add shstrtab_section_.
14640         Update declarations.
14641         (class Output_symtab_xindex): Define.
14642         (Output_section::has_out_shndx): New function.
14643         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14644         field.
14645         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14646         Change all callers.
14647         (Sized_symbol::init): Likewise.
14648         (Symbol::output_section): Check for ordinary symbol.
14649         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14650         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14651         callers.
14652         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14653         Change all callers.  Simplify handling of symbols from sections
14654         not included in the link.
14655         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14656         distinction.
14657         (Weak_alias_sorter::operator()): Assert that symbols are
14658         ordinary.
14659         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14660         distinction.
14661         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14662         parameters.  Change all callers.
14663         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14664         symbol distinction.  Use SHN_XINDEX when needed.
14665         (Symbol_table::write_section_symbol): Add symtab_xindex
14666         parameter.  Change all callers.
14667         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14668         SHN_XINDEX when needed.
14669         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14670         declarations.
14671         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14672         (Symbol::is_defined): Check is_ordinary.
14673         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14674         (Symbol::is_absolute, Symbol::is_common): Likewise.
14675         (class Sized_symbol): Update declarations.
14676         (class Symbol_table): Update declarations.
14677         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14678         parameters.  Change all callers.
14679         (Sized_symbol::override): Likewise.
14680         (Symbol_table::override): Likewise.
14681         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14682         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14683         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14684         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14685         to be in an ordinary section.
14686         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14687         object and is_ordinary parameters.  Change all callers.
14688         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14689         Change all callers.  Don't add undefined or non-ordinary symbols
14690         to reloc_map_.
14691         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14692         Change all callers.
14693         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14694         declarations.
14695         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14696         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14697         (Sized_relobj::relocate_sections): Likewise.
14698         * target-reloc.h (scan_relocs): Adjust section symbol index.
14699         (scan_relocatable_relocs): Likewise.
14700         * i386.cc (Scan::local): Check for ordinary symbols.
14701         * sparc.cc (Scan::local): Likewise.
14702         * x86_64.cc (Scan::local): Likewise.
14703         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14704         to symbol_section_and_value.
14705         * testsuite/many_sections_test.cc: New file.
14706         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14707         (check_PROGRAMS): Add many_sections_test.
14708         (many_sections_test_SOURCES): Define.
14709         (many_sections_test_DEPENDENCIES): Define.
14710         (many_sections_test_LDFLAGS): Define.
14711         (BUILT_SOURCES): Add many_sections_define.h.
14712         (many_sections_define.h): New target.
14713         (BUILT_SOURCES): Add many_sections_check.h.
14714         (many_sections_check.h): New target.
14715         (check_PROGRAMS): Add many_sections_r_test.
14716         (many_sections_r_test_SOURCES): Define.
14717         (many_sections_r_test_DEPENDENCIES): Define.
14718         (many_sections_r_test_LDFLAGS): Define.
14719         (many_sections_r_test_LDADD): Define.
14720         (many_sections_r_test.o): New target.
14721         * testsuite/Makefile.in: Rebuild.
14722
14723 2008-04-17  Cary Coutant  <ccoutant@google.com>
14724
14725         * errors.cc (Errors::info): New function.
14726         (gold_info): New function.
14727         * errors.h (Errors::info): New function.
14728         * gold.h (gold_info): New function.
14729         * object.cc (Input_objects::add_object): Print trace output.
14730         * options.cc (options::parse_set): New function.
14731         (General_options::parse_wrap): Deleted.
14732         (General_options::General_options): Deleted initializer.
14733         * options.h (options::String_set): New typedef.
14734         (options::parse_set): New function.
14735         (DEFINE_set): New macro.
14736         (General_options::wrap): Changed to use DEFINE_set. Changed
14737         callers of any_wrap_symbols and is_wrap_symbol.
14738         (General_options::trace, General_options::trace_symbol):
14739         New options.
14740         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14741         (General_options::wrap_symbols_): Deleted.
14742         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14743
14744 2008-04-17  David S. Miller  <davem@davemloft.net>
14745
14746         * options.cc (General_options::parse_V): New function.
14747         * options.h: Add entries for -V and -Qy.
14748
14749 2008-04-17  Ian Lance Taylor  <iant@google.com>
14750
14751         * common.cc (Symbol_table::allocate_commons): Remove options
14752         parameter.  Change caller.
14753         (Symbol_table::do_allocate_commons): Remove options parameter.
14754         Change caller.  Just call do_allocate_commons_list twice.
14755         (Symbol_table::do_allocate_commons_list): New function, broken out
14756         of do_allocate_commons.
14757         * common.h (class Allocate_commons_task): Remove options_ field.
14758         Update constructor.
14759         * symtab.cc (Symbol_table::Symbol_table): Initialize
14760         tls_commons_.
14761         (Symbol_table::add_from_object): Put TLS common symbols on
14762         tls_commons_ list.
14763         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14764         which are IN_OUTPUT_DATA.
14765         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14766         allocate_commons and do_allocate_commons declarations.  Declare
14767         do_allocate_commons_list.
14768         * gold.cc (queue_middle_tasks): Update creation of
14769         Allocate_commons_task to not pass options.
14770         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14771         (TLS_TEST_C_FLAGS): New variable.
14772         (tls_test_c_pic.o): New target.
14773         (tls_test_shared.so): Link in tls_test_c_pic.o.
14774         (tls_test_c_pic_ie.o): New target.
14775         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14776         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14777         (tls_test_c.o): New target.
14778         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14779         (tls_pic_test_LDADD): Likewise.
14780         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14781         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14782         (tls_test_c_gnu2.o): New target.
14783         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14784         tls_test_c_gnu2.o.
14785         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14786         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14787         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14788         * testsuite/tls_test.cc: Include "config.h".
14789         (t_last): Call t11_last.
14790         * testsuite/tls_test.h (t11, t11_last): Declare.
14791         * testsuite/tls_test_c.c: New file.
14792         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14793         * configure.ac: Check for OpenMP support.
14794         * configure, config.in, Makefile.in: Rebuild.
14795         * testsuite/Makefile.in: Rebuild.
14796
14797 2008-04-16  Cary Coutant  <ccoutant@google.com>
14798
14799         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14800         (Target_i386::tls_base_symbol_defined_): New field.
14801         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14802         (Target_i386::Scan::global): Likewise.
14803         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14804         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14805         (Target_x86_64::tls_base_symbol_defined_): New field.
14806         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14807         (Target_x86_64::Scan::global): Likewise.
14808
14809 2008-04-16  Cary Coutant  <ccoutant@google.com>
14810
14811         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14812         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14813         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14814         building shared libraries.
14815         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14816         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14817         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14818         * testsuite/Makefile.in: Rebuild.
14819         * testsuite/weak_undef.h: New file.
14820         * testsuite/weak_undef_file1.cc: Add extra test cases.
14821         * testsuite/weak_undef_file2.cc: Likewise.
14822         * testsuite/weak_undef_test.cc: Likewise.
14823
14824 2008-04-16  David S. Miller  <davem@davemloft.net>
14825
14826         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14827         Add issued_non_pic_error_ field.  Declare check_non_pic.
14828         (Target_sparc::Scan::check_non_pic): New function.
14829         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14830         (Target_sparc::Scan::global): Likewise.
14831
14832         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14833         * configure: Rebuild.
14834
14835         * options.h (DEFINE_enable): New macro.
14836         (new_dtags): New enable option.
14837         (initfirst, interpose, loadfltr, nodefaultlib,
14838         nodelete, nodlopen, nodump): New -z options.
14839         * layout.cc (Layout:finish_dynamic_section): If new
14840         dtags enabled, emit DT_RUNPATH.  Also, emit a
14841         DT_FLAGS_1 containing any specified -z flags.
14842
14843 2008-04-16  Ian Lance Taylor  <iant@google.com>
14844
14845         * copy-relocs.cc: New file.
14846         * copy-relocs.h: New file.
14847         * reloc.cc: Remove Copy_relocs code.
14848         * reloc.h: Likewise.
14849         * reloc-types.h (struct Reloc_types) [both versions]: Add
14850         get_reloc_addend_noerror.
14851         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14852         variants of add_global which take an addend which must be zero.
14853         * i386.cc: Include "copy-relocs.h".
14854         (class Target_i386): Change type of copy_relocs_ to variable,
14855         update initializer.
14856         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14857         Change all callers.
14858         (Target_i386::do_finalize_sections): Change handling of
14859         copy_relocs_.
14860         * sparc.cc: Include "copy-relocs.h".
14861         (class Target_sparc): Change type of copy_relocs_ to variable,
14862         update initializer.
14863         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14864         Change all callers.
14865         (Target_sparc::do_finalize_sections): Change handling of
14866         copy_relocs_.
14867         * x86_64.cc: Include "copy-relocs.h".
14868         (class Target_x86_64): Change type of copy_relocs_ to variable,
14869         update initializer.
14870         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14871         class.  Change all callers.
14872         (Target_x86_64::do_finalize_sections): Change handling of
14873         copy_relocs_.
14874         * Makefile.am (CCFILES): Add copy-relocs.cc.
14875         (HFILES): Add copy-relocs.h.
14876
14877         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14878
14879         * testsuite/script_test_4.sh: Permit leading zeroes.
14880
14881 2008-04-15  Ian Lance Taylor  <iant@google.com>
14882
14883         * script-sections.cc (Script_sections::create_segments): Use
14884         header_size_adjustment even when there is enough room for the
14885         headers.
14886         * testsuite/script_test_4.sh: New file.
14887         * testsuite/script_test_4.t: New file.
14888         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14889         (check_DATA): Add script_test_4.stdout.
14890         (MOSTLYCLEANFILES): Likewise.
14891         (script_test_4): New target.
14892         (script_test_4.stdout): New target.
14893         * testsuite/Makefile.in: Rebuild.
14894
14895         * sparc.cc: Add definitions for Output_data_plt_sparc class
14896         constants.
14897
14898 2008-04-14  David S. Miller  <davem@davemloft.net>
14899
14900         * sparc.cc: New file.
14901         * Makefile.am (TARGETSOURCES): Add sparc.cc
14902         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14903         * configure.tgt: Document targ_extra_size and
14904         targ_extra_big_endian.  Add entries for sparc-* and
14905         sparc64-*.
14906         * configure.ac: Handle targ_extra_size and
14907         targ_extra_big_endian.
14908         * Makefile.in: Rebuild.
14909         * configure: Likewise.
14910         * po/POTFILES.in: Likewise.
14911         * po/gold.pot: Likewise.
14912
14913 2008-04-14  Ian Lance Taylor  <iant@google.com>
14914
14915         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14916         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14917         in the name/type/flags to section mapping.  Don't call
14918         allocate_output_section.
14919         (Layout::choose_output_section): Change parameter from adjust_name
14920         to is_input_section.  Don't permit input sections after sections
14921         are attached to segments.  Don't call allocate_output_section.
14922         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14923         not write_enable_output_section.
14924         (Layout::make_output_section): Don't push to
14925         unattached_section_list_ nor call attach_to_segment.  Call
14926         attach_section_to_segment if sections are attached.
14927         (Layout::attach_sections_to_segments): New function.
14928         (Layout::attach_section_to_segment): New function.
14929         (Layout::attach_allocated_section_to_segment): Rename from
14930         attach_to_segment.  Remove flags parameter.
14931         (Layout::allocate_output_section): Remove function.
14932         (Layout::write_enable_output_section): Remove function.
14933         * layout.h (class Layout): Update for above changes.  Add new
14934         field sections_are_attached_.
14935         * output.h (Output_section::update_flags_for_input_section): New
14936         function.
14937         * output.cc (Output_section::add_input_section): Call
14938         update_flags_for_input_section.
14939         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14940
14941 2008-04-11  Cary Coutant  <ccoutant@google.com>
14942
14943         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14944         thought unnecessary.
14945         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14946
14947 2008-04-11  Ian Lance Taylor  <iant@google.com>
14948
14949         * output.h (class Output_section_data): Remove inline definition
14950         of set_addralign.
14951         * output.cc (Output_section_data::set_addralign): New function.
14952
14953 2008-04-11  Cary Coutant  <ccoutant@google.com>
14954
14955         Add support for TLS descriptors for i386 and x86_64.
14956         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14957         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14958         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14959         GOT_TYPE_TLS_DESC.
14960         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14961         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14962         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14963         relocations.
14964         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14965         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14966         Fix problem with initial-exec relocations.
14967         (Target_i386::Relocate::relocate_tls): Likewise.
14968         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14969         relaxation.
14970         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14971         support for section-plus-offset dynamic table entries.
14972         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14973         (Output_data_dynamic::Dynamic_entry): Add support for
14974         section-plus-offset dynamic table entries.
14975         (Output_data_dynamic::Classification): Likewise.
14976         (Output_data_dynamic::classification_): Renamed offset_.
14977         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14978         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14979         (Target_x86_64::make_plt_section): New function.
14980         (Target_x86_64::reserve_tlsdesc_entries): New function.
14981         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14982         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14983         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14984         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14985         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14986         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14987         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14988         add extra PLT entry for TLS descriptors.
14989         (Output_data_plt_x86_64::got_): New field.
14990         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14991         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14992         fields.
14993         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14994         descriptors.
14995         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14996         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14997         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14998         R_386_TLS_DESC_CALL relocations.
14999         (Target_x86_64::Scan::global): Likewise.
15000         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15001         for TLS descriptors.
15002         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15003         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15004         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15005         GD-to-IE relaxation.
15006         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15007         and TLS_DESCRIPTORS.
15008         * Makefile.in: Rebuild.
15009         * configure: Rebuild.
15010         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15011         (tls_test_shared2.so): New target.
15012         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15013         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15014         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15015         (tls_shared_gd_to_ie_test_LDADD): New variable.
15016         (tls_shared_gnu2_gd_to_ie_test): New target.
15017         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15018         New targets.
15019         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15020         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15021         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15022         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15023         (tls_shared_gnu2_test): New target.
15024         (tls_test_gnu2_shared.so): New target.
15025         (tls_shared_gnu2_test_SOURCES): New variable.
15026         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15027         (tls_shared_gnu2_test_LDFLAGS): New variable.
15028         (tls_shared_gnu2_test_LDADD): New variable.
15029         * testsuite/Makefile.in: Rebuild.
15030         * testsuite/Makefile.
15031
15032 2008-04-11  Ian Lance Taylor  <iant@google.com>
15033
15034         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15035         justsyms.t.
15036         * testsuite/Makefile.in: Rebuild.
15037
15038         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15039         long.
15040         * testsuite/script_test_2.cc (main): Adjust test.
15041
15042 2008-04-11  David S. Miller  <davem@davemloft.net>
15043             Ian Lance Taylor  <iant@google.com>
15044
15045         * options.h (General_options): Add entries for '-Y' and
15046         '-relax'.
15047         * options.cc (General_options:finalize): If -Y was used, add those
15048         entries to the library path instead of the default "/lib" and
15049         "/usr/lib".
15050
15051 2008-04-11  David S. Miller  <davem@davemloft.net>
15052
15053         * testsuite/justsyms.t: Start at 0x100.
15054         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15055         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15056         long.
15057         * testsuite/script_test_2.cc: Adjust string and section length
15058         checks.
15059
15060 2008-04-09  Ian Lance Taylor  <iant@google.com>
15061
15062         PR gold/5996
15063         * script-sections.cc (Sections_element::allocate_to_segment): Add
15064         orphan parameter.
15065         (Output_section_definition::allocate_to_segment): Likewise.
15066         (Orphan_output_section::allocate_to_segment): Likewise.
15067         (Script_sections::attach_sections_using_phdrs_clause): Don't
15068         propagate non-PT_LOAD segments to orphan sections.
15069         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15070         readelf rather than objdump.
15071         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15072         .interp section and PT_INTERP segment are the same size.
15073         * testsuite/Makefile.in: Rebuild.
15074
15075         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15076         aliases for symbols defined in the same object.
15077         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15078         (weak_alias_test_SOURCES): New variable.
15079         (weak_alias_test_DEPENDENCIES): New variable.
15080         (weak_alias_test_LDFLAGS): New variable.
15081         (weak_alias_test_LDADD): New variable.
15082         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15083         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15084         (weak_alias_test_3.o): New target.
15085         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15086         * testsuite/weak_alias_test_main.cc: New file.
15087         * testsuite/weak_alias_test_1.cc: New file.
15088         * testsuite/weak_alias_test_2.cc: New file.
15089         * testsuite/weak_alias_test_3.cc: New file.
15090
15091 2008-04-08  Ian Lance Taylor  <iant@google.com>
15092
15093         * options.h (class General_options): Add --noinhibit-exec option.
15094         * main.cc (main): Check --noinhibit-exec.
15095
15096         * options.h (class General_options): Define --wrap as a special
15097         option.  Add wrap_symbols_ field.
15098         (General_options::any_wrap_symbols): New function.
15099         (General_options::is_wrap_symbol): New function.
15100         * options.cc (General_options::parse_wrap): New function.
15101         (General_options::General_options): Initialize wrap_symbols_.
15102         * symtab.cc (Symbol_table::wrap_symbol): New function.
15103         (Symbol_table::add_from_object): Handle --wrap.
15104         * symtab.h (class Symbol_table): Declare wrap_symbol.
15105         * target.h (Target::wrap_char): New function.
15106         (Target::Target_info): Add wrap_char field.
15107         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15108         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15109         * testsuite/testfile.cc (Target_test::test_target_info):
15110         Likewise.
15111
15112         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15113         there is one.
15114
15115         * layout.h (class Layout): Add added_eh_frame_data_ field.
15116         * layout.cc (Layout::Layout): Initialize new field.
15117         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15118         output section until we find a section we merged successfully.
15119         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15120         that the size be non-zero.
15121
15122         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15123         qualifier.
15124
15125 2008-04-08  Craig Silverstein  <csilvers@google.com>
15126
15127         * configure.ac: Export new conditional variable HAVE_ZLIB.
15128         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15129         on HAVE_ZLIB.
15130         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15131         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15132
15133 2008-04-07  Ian Lance Taylor  <iant@google.com>
15134
15135         * version.cc (version_string): Set to "1.5".
15136
15137         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15138         Add issued_non_pic_error_ field.  Declare check_non_pic.
15139         (Target_x86_64::Scan::check_non_pic): New function.
15140         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15141         (Target_x86_64::Scan::global): Likewise.
15142
15143         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15144         addend parameter.  Change caller.  Handle merge sections.
15145         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15146         Address to Addend.  Don't add in the result of
15147         local_section_offset, pass down the addend and use the returned
15148         value.
15149         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15150         Update declarations of local_section_offset and symbol_value.
15151         * testsuite/two_file_test_1.cc (t18): New function.
15152         * testsuite/two_file_test_2.cc (f18): New function.
15153         * testsuite/two_file_test_main.cc (main): Call t18.
15154         * testsuite/two_file_test.h (t18, f18): Declare.
15155
15156         * configure.ac: Don't test for objdump, c++filt, or readelf.
15157         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15158         conditionals.
15159         (TEST_READELF): New variable.
15160         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15161         (check_PROGRAMS): Add two_file_strip_test.
15162         (two_file_strip_test): New target.
15163         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15164         (two_file_same_shared_strip_test_SOURCES): New variable.
15165         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15166         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15167         (two_file_same_shared_strip_test_LDADD): New variable.
15168         (two_file_shared_strip.so): New target.
15169         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15170         (ver_test_5.syms, ver_test_7.syms): Likewise.
15171         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15172         (strip_test_3.stdout): Use TEST_OBJDUMP.
15173         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15174
15175 2008-04-04  Cary Coutant  <ccoutant@google.com>
15176
15177         * symtab.h (Symbol::is_weak_undefined): New function.
15178         (Symbol::is_strong_undefined): New function.
15179         (Symbol::is_absolute): New function.
15180         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15181         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15182         absolute symbols.
15183         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15184         (weak_undef_test): New target.
15185         * testsuite/Makefile.in: Rebuild.
15186         * testsuite/weak_undef_file1.cc: New file.
15187         * testsuite/weak_undef_file2.cc: New file.
15188         * testsuite/weak_undef_test.cc: New file.
15189
15190 2008-04-03  Craig Silverstein  <csilvers@google.com>
15191
15192         * compressed_output.h (class Output_compressed_section): Use
15193         unsigned buffer.
15194         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15195         add zlib header.
15196         (zlib_compressed_suffix): Removed.
15197         (Output_compressed_section::set_final_data_size): Use unsigned
15198         buffers.
15199         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15200         Fix linker invocation.
15201         (flagstest_o_specialfile_and_compress_debug_sections):
15202         Likewise.
15203         * testsuite/Makefile.in: Regenerated.
15204
15205 2008-04-02  David S. Miller  <davem@davemloft.net>
15206
15207         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15208         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15209
15210 2008-04-02  Craig Silverstein  <csilvers@google.com>
15211
15212         * TODO: New file.
15213
15214 2008-04-02  Ian Lance Taylor  <iant@google.com>
15215
15216         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15217         parameters.  Update for new key type to views_.  Change all
15218         callers.
15219         (File_read::read): Adjust for byteshift in returned view.
15220         (File_read::add_view): New function, broken out of
15221         find_and_make_view.
15222         (File_read::make_view): New function, broken out of
15223         find_and_make_view.
15224         (File_read::find_or_make_view): Add offset and aligned
15225         parameters.  Rewrite accordingly.  Change all callers.
15226         (File_read::get_view): Add offset and aligned parameters.  Adjust
15227         for byteshift in return value.
15228         (File_read::get_lasting_view): Likewise.
15229         * fileread.h (class File_read): Update declarations.
15230         (class File_read::View): Add byteshift_ field.  Add byteshift to
15231         constructor.  Add byteshift method.
15232         * archive.h (Archive::clear_uncached_views): New function.
15233         (Archive::get_view): Add aligned parameter.  Change all callers.
15234         * object.h (Object::get_view): Add aligned parameter.  Change all
15235         callers.
15236         (Object::get_lasting_view): Likewise.
15237
15238         * fileread.cc (File_read::release): Don't call clear_views if
15239         there are multiple objects.
15240         * fileread.h (File_read::clear_uncached_views): New function.
15241         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15242         on the archive.
15243
15244 2008-03-31  Cary Coutant  <ccoutant@google.com>
15245
15246         Add thin archive support.
15247         * archive.cc (Archive::armagt): New const.
15248         (Archive::setup): Remove task parameter and calls to unlock.
15249         (Archive::unlock_nested_archives): New function.
15250         (Archive::read_header): Add nested_off parameter. Change
15251         all callers.
15252         (Archive::interpret_header): Likewise.
15253         (Archive::include_all_members): Change to handle thin
15254         archives.
15255         (Archive::include_member): Likewise.
15256         * archive.h (Archive::Archive): Add new parameters and
15257         initializers.
15258         (Archive::armagt): New const.
15259         (Archive::setup): Remove task parameter.
15260         (Archive::unlock_nested_archives): New function.
15261         (Archive::read_header): Add nested_off parameter.
15262         (Archive::interpret_header): Likewise.
15263         (Archive::Nested_archive_table): New typedef.
15264         (Archive::is_thin_archive_): New field.
15265         (Archive::nested_archives_): New field.
15266         (Archive::options_): New field.
15267         (Archive::dirpath_): New field.
15268         (Archive::task_): New field.
15269         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15270         for thin archives.  Pass additional parameters to
15271         Archive::Archive.  Unlock the archive file after calling
15272         Archive::setup.
15273
15274 2008-03-29  Ian Lance Taylor  <iant@google.com>
15275
15276         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15277         version symbol to be local.
15278         * testsuite/ver_test_4.sh: New file.
15279         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15280         (check_DATA): Add ver_test_4.syms.
15281         (ver_test_4.syms): New target.
15282         * testsuite/Makefile.in: Rebuild.
15283
15284         * output.cc
15285         (Output_section::Input_section_sort_entry::has_priority): New
15286         function.
15287         (Output_section::Input_section_sort_entry::match_file_name): New
15288         function.
15289         (Output_section::Input_section_sort_entry::match_section_name):
15290         Remove.
15291         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15292         Remove.
15293         (Output_section::Input_section_sort_entry::match_section_file):
15294         Remove.
15295         (Output_section::Input_section_sort_compare::operator()): Rewrite
15296         using new Input_section_sort_entry functions.  Sort crtbegin and
15297         crtend first.  Sort sections with no priority before sections with
15298         a priority.
15299         * testsuite/initpri1.c (d3): Check j != 4.
15300         (cd5): New constructor/destructor function.
15301         (main): Check j != 2.
15302
15303         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15304         new symbol when resolving, don't call set_is_default.
15305         * testsuite/ver_test_7.cc: New file.
15306         * testsuite/ver_test_7.sh: New file.
15307         * testsuite/Makefile.am (ver_test_7.so): New target.
15308         (ver_test_7.o): New target.
15309         (check_SCRIPTS): Add ver_test_7.sh.
15310         (check_DATA): Add ver_test_7.syms.
15311         (ver_test_7.syms): New target.
15312
15313 2008-03-28  Ian Lance Taylor  <iant@google.com>
15314
15315         * layout.cc (Layout::layout): If we see an input section with a
15316         name that needs sorting, set the must_sort flag for the output
15317         section.
15318         (Layout::make_output_section): If the name of the output section
15319         indicates that it might require sorting, set the may_sort flag.
15320         * output.h (Output_section::may_sort_attached_input_sections): New
15321         function.
15322         (Output_section::set_may_sort_attached_input_sections): New
15323         function.
15324         (Output_section::must_sort_attached_input_sections): New
15325         function.
15326         (Output_section::set_must_sort_attached_input_sections): New
15327         function.
15328         (class Output_section): Declare Input_section_sort_entry.  Define
15329         Input_section_sort_compare.  Declare
15330         sort_attached_input_sections.  Add new fields:
15331         may_sort_attached_input_sections_,
15332         must_sort_attached_input_sections_,
15333         attached_input_sections_are_sorted_.
15334         * output.cc (Output_section::Output_section): Initialize new
15335         fields.
15336         (Output_section::add_input_section): Add an entry to
15337         input_sections_ if may_sort or must_sort are true.
15338         (Output_section::set_final_data_size): Call
15339         sort_attached_input_sections if necessary.
15340         (Output_section::Input_section_sort_entry): Define new class.
15341         (Output_section::Input_section_sort_compare::operator()): New
15342         function.
15343         (Output_section::sort_attached_input_sections): New function.
15344         * configure.ac: Check whether the compiler supports constructor
15345         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15346         * testsuite/initpri1.c: New file.
15347         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15348         CONSTRUCTOR_PRIORITY.
15349         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15350         (initpri1_LDFLAGS): New variable.
15351         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15352
15353 2008-03-27  Ian Lance Taylor  <iant@google.com>
15354
15355         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15356         * testsuite/common_test_1.c: New file.
15357         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15358         (common_test_1_SOURCES): New variable.
15359         (common_test_1_DEPENDENCIES): New variable.
15360         (common_test_1_LDFLAGS): New variable.
15361
15362         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15363         and commons_ correctly when NAME/VERSION does not override
15364         NAME/NULL.
15365         * testsuite/ver_test_6.c: New file.
15366         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15367         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15368         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15369
15370 2008-03-26  Ian Lance Taylor  <iant@google.com>
15371
15372         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15373         of an undefined symbol from a version script.
15374         * testsuite/Makefile.am (ver_test_5.so): New target.
15375         (ver_test_5.o): New target.
15376         (check_SCRIPTS): Add ver_test_5.sh.
15377         (check_DATA): Add ver_test_5.syms.
15378         (ver_test_5.syms): New target.
15379         * testsuite/ver_test_5.cc: New file.
15380         * testsuite/ver_test_5.script: New file.
15381         * testsuite/ver_test_5.sh: New file.
15382         * Makefile.in, testsuite/Makefile.in: Rebuild.
15383
15384         PR gold/5986
15385         Fix problems building gold with gcc 4.3.0.
15386         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15387         (gold_error_at_location, gold_warning_at_location): Use it.
15388         * configure.ac: Check whether we can compile and use a template
15389         function with a printf attribute.
15390         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15391         when jumping over bytes.
15392         * object.cc: Instantiate Object::read_section_data.
15393         * debug.h: Include <cstring>
15394         * dwarf_reader.cc: Include <algorithm>
15395         * main.cc: Include <cstring>.
15396         * options.cc: Include <cstring>.
15397         * output.cc: Include <cstring>.
15398         * script.cc: Include <cstring>.
15399         * script.h: Include <string>.
15400         * symtab.cc: Include <cstring> and <algorithm>.
15401         * target-select.cc: Include <cstring>.
15402         * version.cc: Include <string>.
15403         * testsuite/testmain.cc: Include <cstdlib>.
15404         * configure, config.in: Rebuild.
15405
15406 2008-03-25  Ian Lance Taylor  <iant@google.com>
15407
15408         * options.cc: Include "../bfd/bfdver.h".
15409         (options::help): Print bug reporting address.
15410
15411         * version.cc (print_version): Adjust output for current value of
15412         BFD_VERSION_STRING.
15413
15414         * NEWS: New file.
15415
15416         * options.cc (options::help): Print list of supported targets.
15417         * target-select.h: Include <vector>.
15418         (class Target_selector): Make machine_, size_, and is_big_endian_
15419         fields const.  Add bfd_name_ and instantiated_target_ fields.
15420         (Target_selector::Target_selector): Add bfd_name parameter.
15421         (Target_selector::recognize): Make non-virtual, call
15422         do_recognize.
15423         (Target_selector::recognize_by_name): Make non-virtual, call
15424         do_recognize_by_name.
15425         (Target_selector::supported_names): New function.
15426         (Target_selector::bfd_name): New function.
15427         (Target_selector::do_instantiate_target): New pure virtual
15428         function.
15429         (Target_selector::do_recognize): New virtual function.
15430         (Target_selector::do_recognize_by_name): New virtual function.
15431         (Target_selector::instantiate_target): New private function.
15432         (supported_target_names): Declare.
15433         * target-select.cc (Target_selector::Target_selector): Update for
15434         new parameter and fields.
15435         (select_target_by_name): Check that the name matches before
15436         calling recognize_by_name.
15437         (supported_target_names): New function.
15438         * i386.cc (class Target_selector_i386): Update Target_selector
15439         constructor call.  Remove recognize and recognize_by_name.  Add
15440         do_instantiate_target.
15441         * x86_64.cc (class Target_selector_x86_64): Likewise.
15442         * testsuite/testfile.cc (class Target_selector_test): Update for
15443         changes to Target_selector.
15444
15445         * README: Rewrite, with some notes on unsupported features.
15446
15447 2008-03-24  Cary Coutant  <ccoutant@google.com>
15448
15449         * i386.cc (Target_i386::Got_type): New enum declaration.
15450         (Target_i386::Scan::local): Updated callers of Output_data_got
15451         member functions.
15452         (Target_i386::Scan::global): Likewise.
15453         (Target_i386::Relocate::relocate): Likewise.
15454         (Target_i386::Relocate::relocate_tls): Likewise.
15455         * object.h (Got_offset_list): New class.
15456         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15457         (Sized_relobj::local_got_offset): Likewise.
15458         (Sized_relobj::set_local_got_offset): Likewise.
15459         (Sized_relobj::local_has_tls_got_offset): Removed.
15460         (Sized_relobj::local_tls_got_offset): Removed.
15461         (Sized_relobj::set_local_tls_got_offset): Removed.
15462         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15463         * output.cc (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         * output.h (Output_data_got::add_global): Added got_type parameter.
15480         (Output_data_got::add_global_with_rel): Likewise.
15481         (Output_data_got::add_global_with_rela): Likewise.
15482         (Output_data_got::add_global_pair_with_rel): New function.
15483         (Output_data_got::add_global_pair_with_rela): New function.
15484         (Output_data_got::add_local): Added got_type parameter.
15485         (Output_data_got::add_local_with_rel): Likewise.
15486         (Output_data_got::add_local_with_rela): Likewise.
15487         (Output_data_got::add_local_pair_with_rel): New function.
15488         (Output_data_got::add_local_pair_with_rela): New function.
15489         (Output_data_got::add_global_tls): Removed.
15490         (Output_data_got::add_global_tls_with_rel): Removed.
15491         (Output_data_got::add_global_tls_with_rela): Removed.
15492         (Output_data_got::add_local_tls): Removed.
15493         (Output_data_got::add_local_tls_with_rel): Removed.
15494         (Output_data_got::add_local_tls_with_rela): Removed.
15495         * resolve.cc (Symbol::override_base_with_special): Removed
15496         reference to has_got_offset_ field.
15497         * symtab.cc (Symbol::init_fields): Replaced initialization
15498         of got_offset_ with got_offsets_.  Removed initialization
15499         of has_got_offset_
15500         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15501         (Symbol::got_offset): Likewise.
15502         (Symbol::set_got_offset): Likewise.
15503         (Symbol::has_tls_got_offset): Removed.
15504         (Symbol::tls_got_offset): Removed.
15505         (Symbol::set_tls_got_offset): Removed.
15506         (Symbol::got_offset_): Removed.
15507         (Symbol::tls_mod_got_offset_): Removed.
15508         (Symbol::tls_pair_got_offset_): Removed.
15509         (Symbol::got_offsets_): New field.
15510         (Symbol::has_got_offset): Removed.
15511         (Symbol::has_tls_mod_got_offset): Removed.
15512         (Symbol::has_tls_pair_got_offset): Removed.
15513         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15514         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15515         member functions.
15516         (Target_x86_64::Scan::global): Likewise.
15517         (Target_x86_64::Relocate::relocate): Likewise.
15518         (Target_x86_64::Relocate::relocate_tls): Likewise.
15519
15520 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15521
15522         * yyscript.y: Fix spelling error in comment.
15523
15524 2008-03-24  Ian Lance Taylor  <iant@google.com>
15525
15526         * options.h (class General_options): Define build_id option.
15527         * layout.h (class Layout): Declare write_build_id, create_note,
15528         create_build_id.  Add build_id_note_ member.
15529         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15530         "libiberty.h", "md5.h", "sha1.h".
15531         (Layout::Layout): Initialize eh_frame_data_,
15532         eh_frame_hdr_section_, and build_id_note_.
15533         (Layout::finalize): Call create_build_id.
15534         (Layout::create_note): New function, broken out of
15535         Layout::create_gold_note.
15536         (Layout::create_gold_note): Call create_note.
15537         (Layout::create_build_id): New function.
15538         (Layout::write_build_id): New function.
15539         (Close_task_runner::run): Call write_build_id.
15540
15541         * x86_64.cc: Correct license to GPLv3.
15542
15543 2008-03-23  Ian Lance Taylor  <iant@google.com>
15544
15545         * options.cc: Include "demangle.h".
15546         (parse_optional_string): New function.
15547         (parse_long_option): Handle takes_optional_argument.
15548         (parse_short_option): Update dash_z initializer.  Handle
15549         takes_optional_argument.
15550         (General_options::General_options): Initialize do_demangle_.
15551         (General_options::finalize): Set do_demangle_.  Handle demangling
15552         style.
15553         * options.h (parse_optional_string): Declare.
15554         (struct One_option): Add optional_arg field.  Update constructor.
15555         Update call constructor calls.  Add takes_optional_argument
15556         function.
15557         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15558         (DEFINE_optional_string): Define.
15559         (General_options::demangle): Change from DEFINE_bool to
15560         DEFINE_optional_string.
15561         (General_options::no_demangle): New function.
15562         (General_options::do_demangle): New function.
15563         (General_options::set_do_demangle): New function.
15564         (General_options::execstack_status_): Move definition to end of
15565         class definition.
15566         (General_options::static_): Likewise.
15567         (General_options::do_demangle_): New field.
15568         * object.cc (big_endian>::get_symbol_location_info): Call
15569         Options::do_demangle, not Options::demangle.
15570         * symtab.cc (demangle): Likewise.
15571
15572 2008-03-22  Ian Lance Taylor  <iant@google.com>
15573
15574         * gold.h: Include <cstddef> and <sys/types.h>
15575         * options.h: Include <cstring>.
15576
15577 2008-03-21  Ian Lance Taylor  <iant@google.com>
15578
15579         * Added source code to GNU binutils.
15580 \f
15581 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15582
15583 Copying and distribution of this file, with or without modification,
15584 are permitted in any medium without royalty provided the copyright
15585 notice and this notice are preserved.
15586
15587 Local Variables:
15588 mode: change-log
15589 left-margin: 8
15590 fill-column: 74
15591 version-control: never
15592 End: