Better overflow checking for powerpc64 relocations
[external/binutils.git] / gold / ChangeLog
1 2014-03-07  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
4         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
5         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
6         (Powerpc_relocate_functions::has_overflow_bitfield,
7         overflowed): Use the above.
8         (Target_powerpc::Relocate::relocate): Correct overflow checking
9         for a number of relocations.  Modify overflow test for 16-bit
10         fields in instructions to signed/unsigned according to whether
11         the field takes a signed or unsigned value.
12
13 2014-03-05  Alan Modra  <amodra@gmail.com>
14
15         Update copyright years.
16
17 2014-03-05  Alan Modra  <amodra@gmail.com>
18
19         * powerpc.cc (Target_powerpc::Scan::local, global): Support
20         R_PPC64_ADDR64_LOCAL.
21         (Target_powerpc::Relocate::relocate): Likewise.
22
23 2014-03-03  Alan Modra  <amodra@gmail.com>
24
25         * dwp.cc (print_version): Update copyright year to current.
26
27 2014-02-10  Alan Modra  <amodra@gmail.com>
28
29         * po/gold.pot: Regenerate.
30
31 2014-02-06  Cary Coutant  <ccoutant@google.com>
32
33         Fix problem where -u is ignored when a weak undef is seen.
34
35         * archive.cc (Library_base::should_include_member): Reorder
36         code to check for -u option if a weak undef has already been seen.
37         * testsuite/Makefile.am (weak_undef_test_2): New test case.
38         * testsuite/Makefile.in: Regenerate.
39         * testsuite/weak_undef_file3.cc: New file.
40         * testsuite/weak_undef_file4.cc: New file.
41         * testsuite/weak_undef_test_2.cc: New file.
42
43 2014-02-05  Cary Coutant  <ccoutant@google.com>
44
45         Fix issues with gold undefined symbol diagnostics.
46
47         PR binutils/15435
48         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
49         check to here.
50         * target-reloc.h (is_strong_undefined): New function.
51         (relocate_section): Move undef vtable symbol check from here.
52         Check for is_strong_undefined.
53
54 2014-02-05  Cary Coutant  <ccoutant@google.com>
55     
56         Fix problems with the --dynamic-list option.
57
58         PR gold/13577
59         * options.cc (General_options::parse_dynamic_list):
60         Set have_dynamic_list_.
61         (General_options::General_options): Initialize have_dynamic_list_.
62         (General_options::finalize): Turn off -Bsymbolic and
63         -Bsymbolic-functions if --dynamic-list provided.
64         * options.h (General_options::have_dynamic_list): New function.
65         (General_options::have_dynamic_list_): New data member.
66         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
67         correctly.
68    
69         PR gold/16530
70         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
71         in --dynamic-list, mark it.
72    
73         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
74         (dynamic_list_2): New test case.
75         * testsuite/Makefile.in: Regenerate.
76         * testsuite/dynamic_list_2.cc: New file.
77         * testsuite/dynamic_list_2.t: New file.
78         * testsuite/dynamic_list_lib1.cc: New file.
79         * testsuite/dynamic_list_lib2.cc: New file.
80         * testsuite/gc_dynamic_list_test.c: New file.
81         * testsuite/gc_dynamic_list_test.sh: New file.
82         * testsuite/gc_dynamic_list_test.t: New file.
83
84 2014-01-28  Cary Coutant  <ccoutant@google.com>
85
86         Add .gdb_index version 7 support.
87
88         * gold/dwarf_reader.cc: include <utility> (for make_pair).
89         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
90         debug sections.
91         (Dwarf_ranges_table::read_ranges_table): Likewise.
92         (Dwarf_pubnames_table::read_section): Check for GNU-style
93         sections, and for compressed debug sections.
94         (Dwarf_pubnames_table::read_header): Compute end address of table.
95         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
96         for end of list by offset, not by offset == 0.
97         (Dwarf_info_reader::do_read_string_table): Check for compressed
98         debug sections.
99         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
100         Initialize new data members.
101         (Dwarf_pubnames_table::next_name): return flag_byte.
102         (Dwarf_pubnames_table::end_of_table_): New data member.
103         (Dwarf_pubnames_table::is_gnu_style_): New data member.
104         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
105         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
106         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
107         read skeleton type unit DIEs.
108         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
109         (Gdb_index::do_write): Write flag_byte.
110         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
111         (Gdb_index::Cu_vector): Store flags along with cu indexes.
112         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
113         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
114
115 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
116
117         * version.cc (print_version): Update copyright year to 2014.
118
119 2013-12-19  Dimitry Andric  <dimitry@andric.com>
120
121         * stringpool.cc (Stringpool_template::reserve): Add
122         HAVE_UNORDERED_MAP case.
123         * stringpool.cc (Stringpool_template::print_stats): Likewise.
124
125 2013-12-18  Cary Coutant  <ccoutant@google.com>
126
127         * configure.ac: Check for <unordered_set> and <unordered_map>.
128         * config.in: Regenerate.
129         * configure: Regenerate.
130         * system.h: Use <unordered_set> and <unordered_map> if available.
131
132 2013-12-10  Roland McGrath  <mcgrathr@google.com>
133
134         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
135         with $(INSTALL_PROGRAM_ENV).
136         * Makefile.in: Regenerate.
137
138 2013-11-22  Cary Coutant  <ccoutant@google.com>
139
140         * configure.ac: Add check for which library is needed for
141         dlopen.
142         * configure: Regenerate.
143
144 2013-11-22  Cary Coutant  <ccoutant@google.com>
145
146         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
147         assembler.
148         * testsuite/Makefile.in: Regenerate.
149
150 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
151
152         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
153         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
154         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
155         (Target_x86_64<size>::Scan::local): Likewise.
156         (Target_x86_64<size>::Scan::global): Likewise.
157         (Target_x86_64<size>::Relocate::relocate): Likewise.
158         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
159         Likewise.
160         (Target_x86_64<size>::Scan::check_non_pic(): Handle
161         R_X86_64_PC32_BND.
162
163         * testsuite/Makefile.am (check_PROGRAMS): Add
164         exception_x86_64_bnd_test.
165         (exception_x86_64_bnd_test_SOURCES): New macro.
166         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
167         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
168         (exception_x86_64_bnd_test_LDADD): Likewise.
169         (exception_x86_64_bnd_1.o): New rule.
170         (exception_x86_64_bnd_2.o): Likewise.
171         * testsuite/Makefile.in: Regenerated.
172
173 2013-11-15  Alan Modra  <amodra@gmail.com>
174
175         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
176         accessor.
177         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
178         Only call ppc64_local_entry_offset for 64-bit.  Restrict
179         symval_for_branch lookup to ELFv1.
180         (Stub_table::add_plt_call_entry): Use unsigned int off.
181         (Output_data_glink::Address, invalid_address): New.
182         (Output_data_glink::add_eh_frame): Move out of line.  Add
183         support for ELFv2.
184         (Output_data_glink::add_global_entry, find_global_entry,
185         global_entry_address): New functions.
186         (Output_data_glink::global_entry_stubs_, end_branch_table_,
187         ge_size): New variables.
188         (Output_data_glink::set_final_data_size): Add global entry
189         stub sizing.
190         (Output_data_glink::do_write): Write global entry stubs.
191         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
192         parameter.  Return true for ELFv2.  Adjust callers.
193         (Target_powerpc::Scan::local, global): Restrict opd lookup to
194         ELFv1.  Similarly for ifunc and dynamic relocation processing
195         specific to ELFv1.  Recognize that symbols are defined on
196         their plt entries for ELFv2.
197         (Target_powerpc::symval_for_branch): Assert if called for
198         ELFv2 or ppc32.
199         (Target_powerpc::Relocate::relocate): Use global entry plt
200         stub for symbol value if such exists on ELFv2.
201         (Target_powerpc::Relocate::relocate): Don't call
202         symval_for_branch when ELFv2.  Do adjust for local entry
203         offset when ELFv2.
204         (Target_powerpc::do_dynsym_value): Set symbols to global entry
205         plt stub for ELFv2.
206         (Target_powerpc::do_plt_address_for_global): Similarly.
207
208 2013-11-14  Cary Coutant  <ccoutant@google.com>
209
210         Revert patch -- this did not fix the problem, and there is
211         no race there.
212
213         2013-11-14  Cary Coutant  <ccoutant@google.com>
214
215             PR gold/14860
216             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
217             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
218             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
219             updating fde_offsets_.
220             (Eh_frame_hdr::lock_): New data member.
221
222 2013-11-14  Cary Coutant  <ccoutant@google.com>
223
224         * dwp.cc (Dwo_file_entry): New type.
225         (File_list): Use Dwo_file_entry.
226         (Dwo_file::verify): New function.
227         (Dwo_file::verify_dwo_list): New function.
228         (Dwo_file::sized_verify_dwo_list): New function.
229         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
230         list.
231         (Dwp_options): New enum type.
232         (dwp_options): Add --verify-only.
233         (usage): Likewise.
234         (main): Likewise.
235         * dwp.h (gold_info): Add declaration.
236
237 2013-11-14  Cary Coutant  <ccoutant@google.com>
238
239         PR gold/14860
240         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
241         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
242         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
243         updating fde_offsets_.
244         (Eh_frame_hdr::lock_): New data member.
245
246 2013-11-06  Cary Coutant  <ccoutant@google.com>
247
248         PR gold/15758
249         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
250         before reloc sections.
251
252 2013-11-04  Alan Modra  <amodra@gmail.com>
253
254         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
255         (Symbol::needs_dynamic_reloc): Test new flag.
256         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
257         (Target_powerpc::Scan::get_reference_flags): Add target param.
258         Return FUNC_DESC_ABI for 64-bit ELFv1.
259         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
260         call.
261         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
262         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
263
264 2013-10-31  Cary Coutant  <ccoutant@google.com>
265
266         Restore support for dwp v2 DWARF package file format.
267
268         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
269         tu_length parameter.  Adjust all callers.
270         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
271         * dwp.cc: Include dwarf.h.
272         (Section_bounds): New struct type.
273         (Unit_set): New struct type.
274         (Dwo_file::Dwo_file): Initialize new data member.
275         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
276         Combine and rename to...
277         (Dwo_file::read_unit_index): ...this.
278         (Dwo_file::sized_read_compunit_index)
279         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
280         (Dwo_file::sized_read_unit_index): ...this.
281         (Dwo_file::copy_section): Remove section_name, is_str_offsets
282         parameters; add section_id parameter.
283         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
284         (Dwo_file::add_unit_set): ...this.
285         (Dwo_file::shndx_map_): Remove.
286         (Dwo_file::sect_offsets_): New data member.
287         (Dwp_output_file::Dwp_output_file): Initialize new data members.
288         (Dwp_output_file::add_section): Rename to...
289         (Dwp_output_file::add_contribution): ...this.
290         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
291         (Dwp_output_file::add_tu_set): Likewise.
292         (Dwp_output_file::Contribution): New type.
293         (Dwp_output_file::Section::contributions): New data member.
294         (Dwp_output_file::Cu_or_tu_set): Remove.
295         (Dwp_output_file::Section::Section): New ctor.
296         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
297         (Dwp_output_file::Dwp_index::Section_table): New type.
298         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
299         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
300         parameter.
301         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
302         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
303         (Dwp_output_file::Dwp_index::section_table): New member function.
304         (Dwp_output_file::Dwp_index::section_table_end): New member function.
305         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
306         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
307         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
308         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
309         (Dwp_output_file::Dwp_index::section_table_): New data member.
310         (Dwp_output_file::Dwp_index::section_mask_): New data member.
311         (Dwp_output_file::add_output_section): New member function.
312         (Dwp_output_file::write_new_section): New member function.
313         (Dwp_output_file::write_contributions): New member function.
314         (Dwp_output_file::section_id_map_): New data member.
315         (class Dwo_id_info_reader): Remove.
316         (class Unit_reader): New class.
317         (get_dwarf_section_name): New function.
318         (Dwo_file::read_executable): Adjust initializations of class data.
319         (Dwo_file::read): Add support for v2 package file format.
320         (Dwo_file::read_unit_index): Likewise.
321         (Dwo_file::sized_read_unit_index): Likewise.
322         (Dwo_file::copy_section): Likewise.
323         (Dwo_file::add_unit_set): Likewise.
324         (Dwp_output_file::add_output_section): Likewise.
325         (Dwp_output_file::add_contribution): Likewise.
326         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
327         for empty slot.
328         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
329         file format.
330         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
331         slot.
332         (Dwp_output_file::initialize): Remove unused function.
333         (Dwp_output_file::finalize): Add support for v2 package file format.
334         (Dwp_output_file::write_index): Likewise.
335         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
336         function prototype.
337
338 2013-10-31  Cary Coutant  <ccoutant@google.com>
339
340         * configure.ac: Fix check for -fmerge-constants.
341         * configure.ac: Regenerate.
342
343 2013-10-30  Roland McGrath  <mcgrathr@google.com>
344
345         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
346         Correct 9-byte nop sequence to match what the assembler generates.
347
348 2013-10-30  Alan Modra  <amodra@gmail.com>
349
350         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
351         ppc64_local_entry_offset, ppc64_local_entry_offset,
352         do_read_symbols): New functions.
353         (Powerpc_relobj::e_flags_, st_other_): New vars.
354         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
355         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
356         (Powerpc_relobj::e_flags_): New var.
357         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
358         and adjust for ELFv2.
359         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
360         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
361         (Powerpc_dynobj::do_find_special_sections): Likewise.
362         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
363         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
364         to ELFv2 local entry.
365         (Target_powerpc::do_relax): No thread safe barriers needed for
366         ELFv2.
367         (Output_data_plt_powerpc::initial_plt_entry_size_,
368         plt_entry_size): Delete.  Replace all uses with
369         first_plt_entry_offset() and plt_entry_size().
370         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
371         reserved_size parm.  Update callers.
372         (Output_data_plt_powerpc::entry_count): Update.
373         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
374         and use Target_powerpc::first_plt_entry_offset().
375         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
376         rename to plt_entry_size.
377         (Output_data_plt_powerpc::add_ifunc_entry,
378         add_local_ifunc_entry): Adjust reloc for ELFv2.
379         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
380         (glink_eh_frame_fde_64v2): New.
381         (Stub_table::plt_call_size): Support ELFv2 sizing.
382         (Output_data_glink::add_eh_frame): Use the new FDE.
383         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
384         (Stub_table::do_write): Write ELFv2 stubs and glink.
385         (Target_powerpc::Relocate::relocate): Replaces nop after call
386         with ld 2,24(1) and adjust local offset destination for ELFv2.
387
388 2013-10-30  Alan Modra  <amodra@gmail.com>
389
390         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
391         (Target_powerpc::Scan::global, local): Likewise.
392         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
393         on all ppc64 @h and @ha relocs.
394
395 2013-10-14  Alan Modra  <amodra@gmail.com>
396
397         * output.h (Output_data_got::add_constant): Tidy.
398         (Output_data_got::add_constant_pair): New function.
399         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
400         methods used so as to first call reserve_ent().
401
402 2013-10-11  Roland McGrath  <mcgrathr@google.com>
403
404         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
405         add_got_entry and add_got_entry_pair.
406
407         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
408         (HAVE_PUBNAMES): Likewise.
409         * configure: Regenerate.
410
411         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
412         * testsuite/Makefile.in: Regenerate.
413
414         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
415         Remove const from declaration.
416         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
417         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
418         * output.h (Output_file_header): Remove const from member target_
419         and corresponding constructor argument.
420         * output.cc (Output_file_header::Output_file_header): Update prototype.
421         (Output_file_header::do_sized_write): Use this->target_ in place
422         of parameters()->target().
423
424         * testsuite/undef_symbol.cc (Foo::get_a): New method.
425
426         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
427         * configure: Regenerate.
428         * Makefile.in: Regenerate.
429         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
430         * testsuite/merge_string_literals_2.c: Likewise.
431         * testsuite/Makefile.am
432         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
433         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
434         literal -fmerge-constants.
435         * testsuite/Makefile.in: Regenerate.
436
437         * i386.cc (Target_i386): Remove unused member dynbss_.
438         * arm.cc (Target_arm): Likewise.
439         * powerpc.cc (Target_powerpc): Likewise.
440         * sparc.cc (Target_sparc): Likewise.
441         * tilegx.cc (Target_tilegx): Likewise.
442         * x86_64.cc (Target_x86_64): Likewise.
443         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
444         type_signature_, type_offset_.
445         * plugin.h (Plugin_hook): Remove unused member layout_.
446         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
447         mapfile_.
448         (Read_member): Remove unused members input_objects_, symtab_,
449         mapfile_, layout_.
450         (Check_library): Remove unused member symtab_.
451         * archive.h (Lib_group): Remove unused member lib_.
452         * archive.cc (Lib_group::Lib_group): Update initializer.
453         * incremental.h (Incremental_binary): Remove unused member target_.
454         (Incremental_script_entry): Removed unused member script_.
455         * layout.h (Write_symbols_task): Remove unused member input_objects_.
456         * icf.h (Icf): Remove unused member num_tracked_relocs.
457
458         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
459         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
460         its only use.
461         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
462
463         * archive.h: Use struct rather than class for forward declaration
464         of Read_symbols_data.
465
466 2013-10-07  Cary Coutant  <ccoutant@google.com>
467
468         PR gold/16010
469         * testsuite/Makefile.am (icf_test): Fix dependencies.
470         (icf_safe_test): Likewise.
471         (icf_safe_so_test): Likewise.
472         (large_symbol_alignment): Add empty _LDADD rule.
473         * testsuite/Makefile.in: Regenerate.
474
475 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
476
477         PR gold/15927
478         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
479         relocation for R_X86_64_32 on x32.
480
481 2013-08-27  Roland McGrath  <mcgrathr@google.com>
482
483         * output.cc (Output_segment::set_section_addresses): Take new
484         Target* argument.  If target->isolate_execinstr() and the segment
485         is executable and starts at a target->abi_pagesize() boundary,
486         pad its end out to a target->abi_pagesize() boundary with code fill.
487         * output.h (Output_segment::set_section_addresses): Update decl.
488         * layout.h (Layout::check_output_data_for_reset_values): Take new
489         argument RELAX_OUTPUTS.
490         (Layout): New member relax_output_list_.
491         (Layout::add_relax_output): New method.
492         * layout.cc (Layout::Layout): Update constructor.
493         (Layout::reset_relax_output): New method.
494         (Layout::clean_up_after_relaxation): Call it.
495         (Layout::prepare_for_relaxation): Update caller.
496         (Layout::set_segment_offsets): Update callers of set_section_addresses.
497         Call reset_relax_output before re-processing segments for
498         isolate_execinstr case.
499         (Layout::write_data): Handle relax_output_list_.
500         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
501         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
502
503 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
504
505         PR binutils/15834
506         * object.h: Fix typos.
507
508 2013-08-16  Roland McGrath  <mcgrathr@google.com>
509
510         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
511         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
512
513 2013-08-07  Cary Coutant  <ccoutant@google.com>
514
515         Revert support for v2 DWP files:
516
517         2013-03-01  Cary Coutant  <ccoutant@google.com>
518
519             Add dwp support for v2 DWARF package file format.
520             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
521             tu_length parameter.  Adjust all callers.
522             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
523             * dwp.cc: Include dwarf.h.
524             (Section_bounds): New struct type.
525             (Unit_set): New struct type.
526             (Dwo_file::Dwo_file): Initialize new data member.
527             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
528             Combine and rename to...
529             (Dwo_file::read_unit_index): ...this.
530             (Dwo_file::sized_read_compunit_index)
531             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
532             (Dwo_file::sized_read_unit_index): ...this.
533             (Dwo_file::copy_section): Remove section_name, is_str_offsets
534             parameters; add section_id parameter.
535             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
536             (Dwo_file::add_unit_set): ...this.
537             (Dwo_file::shndx_map_): Remove.
538             (Dwo_file::sect_offsets_): New data member.
539             (Dwp_output_file::Dwp_output_file): Initialize new data members.
540             (Dwp_output_file::add_section): Rename to...
541             (Dwp_output_file::add_contribution): ...this.
542             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
543             (Dwp_output_file::add_tu_set): Likewise.
544             (Dwp_output_file::Contribution): New type.
545             (Dwp_output_file::Section::contributions): New data member.
546             (Dwp_output_file::Cu_or_tu_set): Remove.
547             (Dwp_output_file::Section::Section): New ctor.
548             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
549             (Dwp_output_file::Dwp_index::Section_table): New type.
550             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
551             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
552             parameter.
553             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
554             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
555             (Dwp_output_file::Dwp_index::section_table): New member function.
556             (Dwp_output_file::Dwp_index::section_table_end): New member function.
557             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
558             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
559             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
560             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
561             (Dwp_output_file::Dwp_index::section_table_): New data member.
562             (Dwp_output_file::Dwp_index::section_mask_): New data member.
563             (Dwp_output_file::add_output_section): New member function.
564             (Dwp_output_file::write_new_section): New member function.
565             (Dwp_output_file::write_contributions): New member function.
566             (Dwp_output_file::section_id_map_): New data member.
567             (class Dwo_id_info_reader): Remove.
568             (class Unit_reader): New class.
569             (get_dwarf_section_name): New function.
570             (Dwo_file::read_executable): Adjust initializations of class data.
571             (Dwo_file::read): Add support for v2 package file format.
572             (Dwo_file::read_unit_index): Likewise.
573             (Dwo_file::sized_read_unit_index): Likewise.
574             (Dwo_file::copy_section): Likewise.
575             (Dwo_file::add_unit_set): Likewise.
576             (Dwp_output_file::add_output_section): Likewise.
577             (Dwp_output_file::add_contribution): Likewise.
578             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
579             for empty slot.
580             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
581             file format.
582             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
583             slot.
584             (Dwp_output_file::initialize): Remove unused function.
585             (Dwp_output_file::finalize): Add support for v2 package file format.
586             (Dwp_output_file::write_index): Likewise.
587             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
588             function prototype.
589
590 2013-07-31  Cary Coutant  <ccoutant@google.com>
591
592         * object.cc (Sized_relobj::do_output_section_address): New function.
593         (Sized_relobj): Instantiate explicitly.
594         * object.h (Object::output_section_address): New function.
595         (Object::do_output_section_address): New function.
596         (Sized_relobj::do_output_section_address): New function.
597         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
598
599 2013-07-30  Cary Coutant  <ccoutant@google.com>
600             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
601
602         * parameters.cc (Parameters::entry): Return target-specific entry
603         symbol name.
604         * target.h (Target::entry_symbol_name): New function.
605         (Target_info::entry_symbol_name): New data member.
606
607         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
608         * i386.cc (Target_i386::i386_info): Likewise.
609         (Target_i386_nacl::i386_nacl_info): Likewise.
610         * sparc.cc (Target_sparc::sparc_info): Likewise.
611         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
612         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
613         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
614         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
615
616 2013-07-22  Sterling Augustine  <saugustine@google.com>
617
618         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
619         Convert parameter shndx to local variable. Add parameters symtab
620         and symtab_size.  Scan over section names.  Find relocation
621         section corresponding to current section.  Create and initialize
622         reloc_mapper_ and reloc_type_.
623         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
624         unit_length to off_t.  Initialize member unit_length_.  Fill in field
625         cu_offset_.
626         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
627         Initialize new fields unit_length_ and cu_offset_.
628         (Dwarf_pubnames_table::read_section): Update prototype.
629         (Dwarf_pubnames_table::cu_offset): New member function.
630         (Dwarf_pubnames_table::subsection_size): Likewise.
631         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
632         New fields.
633         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
634         member functions public.
635         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
636         Update comment.  Rework logic.  Move repeated parts to...
637         (Gdb_index_info_reader::read_pubtable): ...here. New function.
638         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
639         pubtypes_table_, and stmt_list_offset.
640         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
641         Gdb_index::find_pubtype_offset,
642         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
643         (Gdb_index::pubnames_read): Update prototype and rework logic.
644         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
645         Forward declare.
646         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
647         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
648         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
649         Gdb_index::map_pubtable_to_dies):
650         Declare functions.
651         (Gdb_index::pubnames_read): Update declaration.
652         (Gdb_index::Pubname_offset_map): New type.
653         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
654         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
655         Gdb_index::stmt_list_offset): Declare.
656         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
657         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
658         Gdb_index::pubtypes_offset_): Remove.
659
660 2013-07-19  Roland McGrath  <mcgrathr@google.com>
661
662         * options.h (General_options): Add -Trodata-segment option.
663         * parameters.cc (Parameters::check_rodata_segment): New function.
664         (Parameters::set_target_once): Call it.
665         * parameters.h (Parameters): Declare it (private member function).
666         * layout.cc (load_seg_unusable_for_headers): New function, broken
667         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
668         then validate rodata segment rather than text segment.
669         (relaxation_loop_body): Call that.
670         (is_text_segment): New function.  Don't admit a non-executable
671         segment if TARGET->isolate_execinstr().
672         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
673
674 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
675
676         PR gold/15070
677         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
678         * nacl.h (Sniff_file::View::View): Request aligned view.
679
680 2013-07-11  Cary Coutant  <ccoutant@google.com>
681
682         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
683         correct BRLT entry size.
684
685 2013-07-03  Alan Modra  <amodra@gmail.com>
686
687         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
688         comment.
689
690 2013-07-01  Cary Coutant  <ccoutant@google.com>
691
692         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
693         reloc_type_.
694         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
695         (Dwarf_ranges_table::lookup_reloc): New function.
696         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
697         reloc_type_.
698         (Dwarf_ranges_table::lookup_reloc): New function.
699         (Dwarf_ranges_table::reloc_type_): New data member.
700
701 2013-06-27  Jing Yu  <jingyu@google.com>
702
703         PR gold/15662
704         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
705         function.
706         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
707         (Target_powerpc::do_relax): Call the above.
708
709 2013-06-27  Cary Coutant  <ccoutant@google.com>
710
711         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
712         on garbage collected .opd section.
713
714 2013-06-27  Alan Modra  <amodra@gmail.com>
715
716         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
717         is non-zero.
718         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
719         (Target_powerpc::do_function_location): Likewise for loc->shndx.
720
721 2013-06-14  Cary Coutant  <ccoutant@google.com>
722
723         * resolve.cc (Symbol::override_base): Don't override st_type
724         from plugin placeholder symbols.
725         (Symbol_table::resolve): Likewise.
726         (Symbol_table::should_override): Don't complain about TLS mismatch
727         if the TO symbol is a plugin placeholder.
728         * testsuite/Makefile.am (plugin_test_tls): New test.
729         * testsuite/Makefile.in: Regenerate.
730         * testsuite/plugin_test_tls.sh: New test script.
731         * testsuite/two_file_test_2_tls.cc: New test source.
732         * testsuite/two_file_test_tls.cc: New test source.
733
734 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
735
736         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
737         the maximum segment alignment is larger than the page size.
738         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
739         correctly aligns the symbols with large alignemnt.
740         * testsuite/Makefile.in: Regenerate.
741         * testsuite/large_symbol_alignment.cc: New file.
742
743 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
744             Sriraman Tallam  <tmsriram@google.com>
745
746         * options.h (sort_section): New option.
747         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
748         Rename from Input_section_sort_section_name_special_ordering_compare.
749         (Input_section_sort_section_name_compare): New struct.
750         * output.cc (Output_section::Input_section_sort_section_name_compare::
751         operator()): New function.
752         (Output_section::sort_attached_input_sections): Use new sort function
753         for .text if --sort-section=name is specified.
754         * layout.cc (Layout::make_output_section):
755         Add sorting by name when --sort-section=name is specified.
756         * testsuite/Makefile.am (text_section_grouping): Test option
757         --sort-section=name.
758         * testsuite/Makefile.in: Regenerate.
759         * testsuite/section_sorting_name.cc: New file.
760         * testsuite/section_sorting_name.sh: New file.
761
762 2013-05-21  Cary Coutant  <ccoutant@google.com>
763
764         * symtab.h (Symbol::is_cxx_vtable): New function.
765         * target-reloc.h (relocate_section): Check for vtable symbol.
766         * testsuite/Makefile.am (missing_key_func.sh): New test case.
767         * testsuite/Makefile.in: Regenerate.
768         * testsuite/missing_key_func.cc: New test source.
769         * testsuite/missing_key_func.sh: New test script.
770
771 2013-05-21  Cary Coutant  <ccoutant@google.com>
772
773         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
774         type of enclosing symbol.
775         (Relocate_info::location): Check symbol type when describing symbol.
776         * object.h (Symbol_location_info): Remove unused line_number;
777         add enclosing_symbol_type.
778         * testsuite/debug_msg.sh: Adjust expected output.
779
780 2013-05-13  Cary Coutant  <ccoutant@google.com>
781
782         * configure.ac: Export DEFAULT_TARGET.
783         * configure: Regenerate.
784         * Makefile.in: Regenerate.
785         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
786         * testsuite/Makefile.in: Regenerate.
787         * testsuite/debug_msg.sh: Delete duplicate tests.
788         Don't check undef_int error message match for powerpc where the
789         source file and line number aren't available.
790
791 2013-05-10  Roland McGrath  <mcgrathr@google.com>
792
793         * options.h (General_options): Add --rosegment-gap option.
794         * options.cc (finalize): --rosegment-gap implies --rosegment.
795         * layout.cc (set_segment_offsets): Let user option override
796         target->rosegment_gap().
797
798 2013-05-10  Roland McGrath  <mcgrathr@google.com>
799
800         * options.h (General_options): Remove leading space from help
801         messages for -nostdlib and --rosegment.
802
803 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
804
805         PR ld/15365
806         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
807
808 2013-05-03  Alan Modra  <amodra@gmail.com>
809
810         * merge.cc (Output_merge_string::do_add_input_section): Correct
811         scan for number of strings.  Rename vars to avoid shadowing.
812         Include missing terminator in input_size_.
813
814 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
815
816         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
817         Restore empty string handling.
818
819 2013-05-01  Cary Coutant  <ccoutant@google.com>
820
821         * stringpool.cc (Stringpool_template::new_key_offset): Fix
822         uninitialized warning.
823
824 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
825
826         * output.cc (Output_section::add_merge_input_section): Allow
827         to merge sections if the alignment is more than character size.
828         * merge.h (Output_merge_string::Output_merge_string): Remove
829         assert.
830         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
831         only not-null strings. Check the alignment of strings.
832         * stringpool.h
833         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
834         alignment as the argument.
835         (Stringpool_template<Stringpool_char>::addralign_): New class member.
836         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
837         Align non-zero length strings according to the addralign_.
838         (Stringpool_template<Stringpool_char>::set_string_offsets):
839         Updating offsets according to the given alignment.
840         * testsuite/Makefile.am (text_section_grouping): Test if string
841         literals are getting merged.
842         * testsuite/Makefile.in: Regenerate.
843         * testsuite/merge_string_literals_1.c: New file.
844         * testsuite/merge_string_literals_2.c: Ditto.
845         * testsuite/merge_string_literals.sh: Ditto.
846
847 2013-04-26  Ian Lance Taylor  <iant@google.com>
848
849         * target-reloc.h (relocate_section): If the reloc offset is out of
850         range, pass VIEW as NULL to relocate.relocate.
851         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
852         * i386.cc (Target_i386::Relocate::relocate): Likewise.
853         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
854         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
855         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
856         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
857
858 2013-04-26  Geoff Pike  <gpike@chromium.org>
859
860         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
861         * layout.cc (Hash_task): New class.
862         (Layout::queue_build_id_tasks): New function.
863         (Layout::write_build_id): Handle single-thread portion of build ID
864         computation.  (In some cases, all of it is single-threaded.)  Replace
865         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
866         functionality in fewer lines of code.
867         * layout.h (Layout::queue_build_id_tasks): New function declaration.
868         * options.h (General_options): make "--build-id" default to tree
869         rather than sha1.  Add two new options related to --build-id=tree:
870         --build-id-chunk-size-for-treehash and
871         --build-id-min-file-size-for-treehash.
872         * Makefile.am: add testing of --build-id=tree and related new options
873         (these tests will be invoked by "make check").
874         * Makefile.in: Regenerate.
875
876 2013-04-25  Alan Modra  <amodra@gmail.com>
877
878         * configure.tgt: Add powerpcle and powerpc64le.
879
880 2013-04-22  Alan Modra  <amodra@gmail.com>
881
882         PR gold/15355
883         * layout.cc (Layout::segment_precedes): Allow more than one
884         segment with the same type and flags.
885
886 2013-04-15  Cary Coutant  <ccoutant@google.com>
887
888         * layout.cc (Layout::set_relocatable_section_offsets): Don't
889         allocate space in file for BSS sections.
890
891 2013-04-15  Cary Coutant  <ccoutant@google.com>
892
893         * script-sections.cc (Orphan_output_section): Reset address
894         to zero after each orphaned section for relocatable links.
895
896 2013-04-15  Cary Coutant  <ccoutant@google.com>
897
898         * symtab.cc (Symbol_table::sized_write_globals): Subtract
899         section starting address for relocatable link.
900         * testsuite/Makefile.am (script_test_11): New test.
901         * testsuite/Makefile.in: Regenerate.
902         * testsuite/script_test_11.c: New source file.
903         * testsuite/script_test_11.t: New linker script.
904
905 2013-04-13  Alan Modra  <amodra@gmail.com>
906
907         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
908         owner when sections are not adjacent and exceed group size.
909         (Target_powerpc::group_sections): Handle corner case.
910         (Target_powerpc::Branch_info::make_stub): Handle case where
911         stub table doesn't exist due to branches in non-exec sections.
912         (Target_powerpc::Relocate::relocate): Likewise.
913
914 2013-04-11  Alan Modra  <amodra@gmail.com>
915
916         PR gold/15354
917         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
918         .branch_lt to match bfd ld.  Adjust comments throughout file.
919
920 2013-04-04  Ian Lance Taylor  <iant@google.com>
921
922         GCC PR c++/56840
923         * object.cc (do_layout_deferred_sections): Handle .eh_frame
924         sections before checking whether they are included in the link.
925
926 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
927
928         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
929         object before calling the plugin claim_file handler.  Pass the elf
930         object of the archive to the plugin. Delete the elf object if the
931         plugin claims the file.
932
933 2013-03-21  Alan Modra  <amodra@gmail.com>
934
935         * layout.cc (Layout::set_segment_offsets): Accept writable .text
936         segment when omagic.
937
938 2013-03-21  Alan Modra  <amodra@gmail.com>
939
940         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
941         comparison warning.
942         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
943         uninitialized" warning.
944
945 2013-03-20  Alan Modra  <amodra@gmail.com>
946
947         * symtab.h (Symbol::clear_version): New function.
948         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
949         is_needed by weak references.  Clear version for symbols defined
950         in as-needed objects that are not needed.
951
952 2013-03-15  Alan Modra  <amodra@gmail.com>
953
954         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
955         static and public.  Add report_err param.  Return false for data refs.
956         (Target_powerpc::rela_dyn_section): New overloaded function.
957         (Target_powerpc::plt_, iplt_): Elucidate.
958         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
959         (Output_data_plt_powerpc::do_write): Don't write .iplt.
960         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
961         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
962         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
963         push_branch and make_plt_entry for ifunc syms when
964         reloc_needs_plt_for_ifunc.
965         (Target_powerpc::Relocate::relocate): Don't use plt entry value
966         for ifunc unless reloc_needs_plt_for_ifunc.
967
968 2013-03-15  Alan Modra  <amodra@gmail.com>
969
970         * gc.h (gc_process_relocs): Don't look through function descriptors.
971         * icf.cc (get_section_contents): Do so here instead.
972
973 2013-03-13  Alan Modra  <amodra@gmail.com>
974
975         * powerpc.cc (is_branch_reloc): Forward declare.
976         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
977         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
978         false for 64-bit, true for 32-bit non-branch relocs.
979         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
980         * testsuite/Makefile.am (icf_test): Use linker map file instead of
981         nm output.
982         (icf_safe_test): Generate linker map file as well as nm output.
983         (icf_safe_so_test): Likewise.
984         * testsuite/Makefile.in: Regenerate.
985         * testsuite/icf_test.sh: Parse linker map file to determine
986         section folding.
987         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
988         * testsuite/icf_safe_so_test.sh: Likewise.
989         (X86_32_or_ARM_specific_safe_fold): Merge into..
990         (arch_specific_safe_fold): ..this.
991         (X86_64_specific_safe_fold): Delete unused function.
992
993 2013-03-12  Alan Modra  <amodra@gmail.com>
994
995         * gc.h (gc_process_relocs): Look through function descriptors
996         to determine shndx, symvalue and addend used by ICF.  Tidy
997         variable duplication.
998
999 2013-03-11  Alan Modra  <amodra@gmail.com>
1000
1001         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1002         * layout.cc (Layout_task_runner::run): ..to here.
1003         * symtab.h (struct Symbol_location): Extract from..
1004         (class Symbol_table): ..here.
1005         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1006         * target.h (class Target): Add function_location and
1007         do_function_location functions.
1008         (class Sized_target): Add do_function_location.
1009         * object.h (class Sized_relobj_file): Move find_shdr..
1010         (class Object): ..to here.
1011         * object.cc: Likewise.  Update to suit.  Instantiate.
1012         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1013         * powerpc.cc (class Powerpc_dynobj): New.
1014         (Target_powerpc::do_function_location): New function.
1015         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1016         (Powerpc_dynobj::do_read_symbols): New function.
1017         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1018
1019 2013-03-08  Ian Lance Taylor  <iant@google.com>
1020
1021         * options.cc (General_options::string_to_object_format): Accept
1022         "default".
1023
1024 2013-03-08  Alan Modra  <amodra@gmail.com>
1025
1026         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1027         pointer to Post_fde.
1028         (struct Post_fde): Move definition to here..
1029         * ehframe.cc (struct Post_fde): ..from here.
1030         (Cie::write): Don't alloc Post_fde.
1031         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1032
1033 2013-03-07  Alan Modra  <amodra@gmail.com>
1034
1035         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1036         relocation referencing .LC0.
1037         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1038
1039 2013-03-07  Alan Modra  <amodra@gmail.com>
1040
1041         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1042         always_inline.  Add assembly for powerpc to avoid GOT.
1043
1044 2013-03-07  Alan Modra  <amodra@gmail.com>
1045
1046         * testsuite/script_test_10.sh: Don't test .bss section
1047         header number.
1048
1049 2013-03-06  Alan Modra  <amodra@gmail.com>
1050
1051         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1052         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1053         all callers.  Handle folded sections.
1054         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1055         to Powerpc_relobj.
1056         (Global_symbol_visitor_opd::operator()): Likewise.
1057
1058 2013-03-04  Alan Modra  <amodra@gmail.com>
1059
1060         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1061         * testsuite/Makefile.in: Regenerate.
1062
1063 2013-03-01  Cary Coutant  <ccoutant@google.com>
1064
1065         Add dwp support for v2 DWARF package file format.
1066         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1067         tu_length parameter.  Adjust all callers.
1068         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1069         * dwp.cc: Include dwarf.h.
1070         (Section_bounds): New struct type.
1071         (Unit_set): New struct type.
1072         (Dwo_file::Dwo_file): Initialize new data member.
1073         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1074         Combine and rename to...
1075         (Dwo_file::read_unit_index): ...this.
1076         (Dwo_file::sized_read_compunit_index)
1077         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1078         (Dwo_file::sized_read_unit_index): ...this.
1079         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1080         parameters; add section_id parameter.
1081         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1082         (Dwo_file::add_unit_set): ...this.
1083         (Dwo_file::shndx_map_): Remove.
1084         (Dwo_file::sect_offsets_): New data member.
1085         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1086         (Dwp_output_file::add_section): Rename to...
1087         (Dwp_output_file::add_contribution): ...this.
1088         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1089         (Dwp_output_file::add_tu_set): Likewise.
1090         (Dwp_output_file::Contribution): New type.
1091         (Dwp_output_file::Section::contributions): New data member.
1092         (Dwp_output_file::Cu_or_tu_set): Remove.
1093         (Dwp_output_file::Section::Section): New ctor.
1094         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1095         (Dwp_output_file::Dwp_index::Section_table): New type.
1096         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1097         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1098         parameter.
1099         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1100         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1101         (Dwp_output_file::Dwp_index::section_table): New member function.
1102         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1103         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1104         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1105         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1106         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1107         (Dwp_output_file::Dwp_index::section_table_): New data member.
1108         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1109         (Dwp_output_file::add_output_section): New member function.
1110         (Dwp_output_file::write_new_section): New member function.
1111         (Dwp_output_file::write_contributions): New member function.
1112         (Dwp_output_file::section_id_map_): New data member.
1113         (class Dwo_id_info_reader): Remove.
1114         (class Unit_reader): New class.
1115         (get_dwarf_section_name): New function.
1116         (Dwo_file::read_executable): Adjust initializations of class data.
1117         (Dwo_file::read): Add support for v2 package file format.
1118         (Dwo_file::read_unit_index): Likewise.
1119         (Dwo_file::sized_read_unit_index): Likewise.
1120         (Dwo_file::copy_section): Likewise.
1121         (Dwo_file::add_unit_set): Likewise.
1122         (Dwp_output_file::add_output_section): Likewise.
1123         (Dwp_output_file::add_contribution): Likewise.
1124         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1125         for empty slot.
1126         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1127         file format.
1128         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1129         slot.
1130         (Dwp_output_file::initialize): Remove unused function.
1131         (Dwp_output_file::finalize): Add support for v2 package file format.
1132         (Dwp_output_file::write_index): Likewise.
1133         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1134         function prototype.
1135
1136 2013-03-01  Cary Coutant  <ccoutant@google.com>
1137
1138         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1139         function into class definition in header file.
1140         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1141         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1142         New function.
1143         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1144
1145 2013-02-28  Alan Modra  <amodra@gmail.com>
1146
1147         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1148         * target.cc (Target::do_plt_fde_location): New function.
1149         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1150         accessor function, and constructor param.
1151         (struct Post_fde, Post_fdes): Declare.
1152         (Cie::write): Add post_fdes param.
1153         * ehframe.cc (Fde::write): Use plt_fde_location.
1154         (struct Post_fde): Define.
1155         (Cie::write): Stash FDEs added post merge mapping.
1156         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1157         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1158         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1159         other FDEs.
1160         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1161         (Target_powerpc::has_glink): New function.
1162         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1163         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1164         glink_eh_frame_fde_32, default_fde): New data.
1165         (Stub_table::eh_frame_added_): New var.
1166         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1167         Make const.
1168         (Stub_table::add_eh_frame): New function.
1169         (Output_data_glink::add_eh_frame): New function.
1170         (Target_powerpc::make_glink_section): Call add_eh_frame.
1171
1172 2013-02-15  Ian Lance Taylor  <iant@google.com>
1173
1174         * options.h (DEFINE_uint64_alias): Define.
1175         (class General_options): Add -Ttext-segment as an alias for
1176         -Ttext.
1177
1178 2013-02-15  Alan Modra  <amodra@gmail.com>
1179
1180         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1181         (Stub_table::do_write): ..here, two places.
1182         (Stub_table::plt_call_size): Use it here too.
1183
1184 2013-02-11  Ian Lance Taylor  <iant@google.com>
1185
1186         * descriptors.cc (Descriptors::close_all): New function.
1187         * descriptors.h (class Descriptors): Declare close_all.
1188         (close_all_descriptors): New inline function.
1189         * plugin.cc: Include "descriptors.h".
1190         (Plugin_manager::cleanup): Call close_all_descriptors.
1191
1192 2013-02-06  Alan Modra  <amodra@gmail.com>
1193
1194         * README: Update coding style link.
1195
1196 2013-01-28  Cary Coutant  <ccoutant@google.com>
1197
1198         * dwp.cc (File_list): New typedef.
1199         (Dwo_name_info_reader): New class.
1200         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1201         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1202         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1203         (Dwo_file::read_executable): New function.
1204         (Dwo_file::read): Move common setup code to ...
1205         (Dwo_file::make_object): ... here.
1206         (dwp_options): Add --exec/-e.
1207         (usage): Likewise.
1208         (main): Likewise.
1209
1210 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1211
1212         * layout.cc (Layout::layout): Check for option text_reorder.
1213         (Layout::make_output_section): Ditto.
1214         * options.h (text_reorder): New option.
1215         * output.cc (Input_section_sort_compare): Remove special ordering
1216         of section names.
1217         (Output_section::
1218          Input_section_sort_section_name_special_ordering_compare::
1219          operator()): New function.
1220         (Output_section::sort_attached_input_sections): Use new sort function
1221         for .text.
1222         * output.h (Input_section_sort_section_name_special_ordering_compare):
1223         New struct.
1224         * testsuite/Makefile.am (text_section_grouping): Test option
1225         --no-text-reorder
1226         * testsuite/Makefile.in: Regenerate.
1227         * testsuite/text_section_grouping.sh: Check order of functions without
1228         default text reordering.
1229
1230 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1231
1232         * options.h (General_options): Change default to true for new_dtags.
1233
1234 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1235
1236         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1237         when enable_new_dtags is false.  Only add DT_RUNPATH when
1238         enable_new_dtags is true.
1239
1240 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1241
1242         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1243         used in declaration and definition consistent.
1244         (Target_powerpc::symval_for_branch): Ditto.
1245
1246 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1247
1248         * testsuite/plugin_final_layout.cc: Fix comment.
1249
1250 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1251
1252         * layout.cc (Layout::layout): Do not do default sorting for
1253         text sections when section ordering is specified.
1254         (make_output_section): Ditto.
1255         * testsuite/plugin_final_layout.cc: Name the function sections
1256         to catch reordering issues.
1257
1258 2013-01-15  Alan Modra  <amodra@gmail.com>
1259
1260         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1261         plt-thread-safe.
1262
1263 2013-01-15  Alan Modra  <amodra@gmail.com>
1264
1265         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1266         * testsuite/Makefile.in: Regenerate.
1267
1268 2013-01-14  Alan Modra  <amodra@gmail.com>
1269
1270         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1271         * testsuite/Makefile.in: Regenerate.
1272
1273 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1274
1275         PR bfd/14430
1276         Fix mingw gold build with plugins enabled
1277         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1278         * configure.ac: Export DLOPEN_LIBS and add headers check.
1279         * plugin.cc: Handle non-dlfcn case.
1280         * Makefile.in: Regenerate.
1281         * config.in: Regenerate.
1282         * configure: Regenerate.
1283         * testsuite/Makefile.in: Regenerate.
1284
1285 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1286
1287         * output.h (sort_attached_input_sections): Change to be public.
1288         * script-sections.cc
1289         (Output_section_definition::set_section_addresses): Sort
1290         attached input sections according to section order before linker
1291         script assigns section addresses.
1292         (Orphan_output_section::set_section_addresses): Sort
1293         attached input sections according to section order before linker
1294         script assigns section addresses.
1295         * Makefile.am (final_layout.sh): Use a simple linker script to
1296         check if section ordering still works.
1297         * Makefile.in: Regenerate.
1298
1299 2013-01-09  Ben Cheng  <bccheng@google.com>
1300
1301         * arm.cc (Target_arm::attributes_accept_div): New function.
1302         (Target_arm::attributes_forbid_div): New function.
1303         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1304         attribute using the same new functions as what bfd/elf32_arm.c
1305         does.
1306
1307 2013-01-07  Cary Coutant  <ccoutant@google.com>
1308
1309         PR gold/14993
1310         * output.cc (Output_section::add_input_section): For incremental
1311         updates, don't track input sections that are allocated from patch
1312         space.
1313
1314 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1315             Ian Lance Taylor  <iant@google.com>
1316
1317         PR gold/14897
1318         * configure.ac (--enable-ld): Removed.
1319         (install_as_default): Set to yes only for --enable-gold=default
1320         or --disable-ld.
1321         * configure: Regenerated.
1322
1323 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1324
1325         * options.h (General_options): Add -fuse-ld= for GCC linker
1326         option compatibility.
1327
1328 2013-01-04  Cary Coutant  <ccoutant@google.com>
1329
1330         * configure.ac: Fix typo restoring CXXFLAGS.
1331         * configure: Regenerate.
1332
1333 2013-01-04  Cary Coutant  <ccoutant@google.com>
1334
1335         * testsuite/Makefile.am (CXXLINK_S): New macro.
1336         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1337         * testsuite/Makefile.in: Regenerate.
1338
1339 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1340
1341         * version.cc (print_version): Update copyright year to 2013.
1342
1343 2012-12-20  Ian Lance Taylor  <iant@google.com>
1344
1345         * layout.cc (Layout::special_ordering_of_input_section): New
1346         function.
1347         (Layout::layout): If input section requires special ordering, must
1348         sort input sections.
1349         (Layout::make_output_section): May sort .text input sections.
1350         (Layout::is_section_name_prefix_grouped): Remove.
1351         * layout.h (class Layout): Declare
1352         special_ordering_of_input_section.  Don't declare
1353         is_section_name_prefix_grouped.
1354         * output.cc (Output_section::add_input_section): Revert last
1355         change.
1356         (Output_section::Input_section_sort::match_file_name): Don't crash
1357         if called on output section data.
1358         (Output_section::Input_section_sort_compare): Sort based on
1359         special ordering.
1360         (Output_section::Input_section_sort_section_order_index_compare):
1361         Revert last patch.
1362         (Output_section::sort_attached_input_sections): Likewise.
1363
1364 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1365
1366         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1367         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1368         * output.cc (Output_section::add_input_section): Check if section
1369         name contains special prefix.  Keep input sections to sort such
1370         sections.
1371         (Output_section::Input_section_sort_section_order_index_compare
1372          ::operator()): Group sections according to prefixes.
1373         (Output_section::sort_attached_input_sections): Add condition to
1374         Input_section_entry constructor call.
1375         * testsuite/Makefile.am (text_section_grouping): New test.
1376         * testsuite/Makefile.in: Regenerate.
1377         * testsuite/text_section_grouping.cc: New file.
1378         * testsuite/text_section_grouping.sh: New file.
1379
1380 2012-12-17  Nick Clifton  <nickc@redhat.com>
1381
1382         * Makefile.am: Add copyright notice.
1383         * NEWS: Likewise.
1384         * README: Likewise.
1385         * configure.ac: Likewise.
1386         * ftruncate.c: Likewise.
1387         * Makefile.in: Regenerate.
1388
1389 2012-12-14  Cary Coutant  <ccoutant@google.com>
1390
1391         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1392         --no-as-needed flag.
1393         (exception_separate_shared_12_test): Likewise.
1394         (incremental_copy_test): Likewise.
1395         * testsuite/Makefile.in: Regenerate.
1396
1397 2012-12-14  Cary Coutant  <ccoutant@google.com>
1398
1399         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1400         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1401
1402 2012-12-12  Alan Modra  <amodra@gmail.com>
1403
1404         * powerpc.cc (class Track_tls): New.
1405         (class Relocate, class Scan): Inherit Track_tls.
1406         (Target_powerpc::Scan::local, global): Track tls optimization
1407         and avoid creating plt entry for __tls_get_addr if all uses
1408         are optimized away.
1409         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1410
1411 2012-12-12  Alan Modra  <amodra@gmail.com>
1412
1413         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1414         Replace no_toc_optimize with toc_optimize.
1415         * output.h (Output_section::input_sections): Provide non-const variant.
1416         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1417         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1418         accessors.
1419         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1420         (class Sort_toc_sections): New.
1421         (Target_powerpc::do_finalize_sections): Sort toc sections.
1422         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1423
1424 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1425
1426         * testsuite/binary_unittest.cc (read_all): New function.
1427         (Sized_binary_test): Use it instead of ::read.
1428         * fileread.cc (do_read): Don't assume pread always reads the whole
1429         amount in a single call.
1430
1431 2012-12-10  Alan Modra  <amodra@gmail.com>
1432
1433         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1434         Set EM_PPC64 or EM_PPC here.
1435         (Target_selector_powerpc::do_recognize): Delete.
1436
1437 2012-12-10  Alan Modra  <amodra@gmail.com>
1438
1439         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1440         stub_table_.
1441         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1442
1443 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1444
1445         * testsuite/binary_unittest.cc (Sized_binary_test):
1446         Use open_descriptor rather than ::open.
1447
1448 2012-12-07  Alan Modra  <amodra@gmail.com>
1449
1450         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1451         typedef and invalid_address constant.
1452         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1453         instantiate constants.
1454
1455 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1456
1457         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1458         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1459         * aclocal.m4: Regenerate.
1460         * configure: Regenerate.
1461         * Makefile.in: Regenerate.
1462         * testsuite/Makefile.in: Regenerate.
1463
1464 2012-12-07  Alan Modra  <amodra@gmail.com>
1465
1466         * options.h (General_options): Add no_toc_optimize.
1467         * powerpc.cc (ok_lo_toc_insn): New function.
1468         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1469
1470 2012-12-06  Alan Modra  <amodra@gmail.com>
1471
1472         * options.h (General_options): Add plt_align, plt_static_chain,
1473         plt_thread_safe.  Update stub_group_size help text.
1474         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1475         for new plt_thread_safe_ var.
1476         (use_plt_offset): Correct comments.
1477         (Target_powerpc::do_relax): Look for thread creation symbols to
1478         determine default plt_thread_safe value.  Clear plt call stubs
1479         as well as branch stubs each iteration.
1480         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1481         insn constants.
1482         (l, hi, ha, write_insn): Move earlier.
1483         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1484         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1485         plt stubs too.
1486         (Stub_table::update_size): Adjust.
1487         (Stub_table::prev_size, set_prev_size): Delete.
1488         (Stub_table::stub_align): Let --plt-align affect result.
1489         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1490         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1491         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1492         (Stub_table::do_write): Support more stub variants.
1493
1494 2012-12-04  Alan Modra  <amodra@gmail.com>
1495
1496         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1497         (Target_powerpc::do_define_standard_symbols): New function.
1498
1499 2012-12-03  Alan Modra  <amodra@gmail.com>
1500
1501         * output.h: Formatting, whitespace.
1502
1503 2012-12-03  Alan Modra  <amodra@gmail.com>
1504
1505         * layout.h (Layout::get_executable_sections): Declare.
1506         * layout.cc (Layout::get_executable_sections): New function.
1507         * arm.cc (Target_arm::group_sections): Use it.
1508         (Arm_output_section::group_sections): Delete now redundant test.
1509         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1510         param to handle relative relocs.
1511         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1512         (Output_data_reloc::add_absolute): Adjust.
1513         (Output_data_reloc::add_relative): New function.
1514         (Output_data::reset_data_size): New function.
1515         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1516         (Output_section::set_addralign): New function.
1517         (Output_section::checkpoint_set_addralign): New function.
1518         (Output_section::clear_section_offsets_need_adjustment): New function.
1519         (Output_section::input_sections): Make public.
1520         * powerpc.cc (class Output_data_brlt_powerpc): New.
1521         (class Stub_table, class Stub_control): New.
1522         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1523         stub_table_, set_stub_table, stub_table): New vectors and accessor
1524         functions.
1525         (Target_powerpc::do_may_relax, do_relax, push_branch,
1526         new_stub_table, stub_tables, brlt_section, group_sections,
1527         add_branch_lookup_table, find_branch_lookup_table,
1528         write_branch_lookup_table, make_brlt_section): New functions.
1529         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1530         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1531         branch_info_): New vars.
1532         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1533         make call stubs here.
1534         (Output_data_glink): Remove all call stub handling from this class.
1535         (Target_powerpc::Scan::local, global): Save interesting branch
1536         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1537         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1538         functions on final link.
1539         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1540         Handle long branch destinations too.
1541         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1542         do_plt_address_for_local): Adjust lookup of plt call stubs.
1543
1544 2012-11-30  Alan Modra  <amodra@gmail.com>
1545
1546         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1547         relocs against protected symbols when building 32-bit shared libs.
1548
1549 2012-11-30  Alan Modra  <amodra@gmail.com>
1550
1551         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1552         param.  Call got_section() to make .got.  Update all callers
1553         and their callers and so on.
1554
1555 2012-11-30  Alan Modra  <amodra@gmail.com>
1556
1557         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1558         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1559         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1560         value if it already exists.
1561
1562 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1563
1564         PR gold/14858
1565         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1566
1567 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1568
1569         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1570         than bfc instruction for data sandboxing.
1571
1572 2012-11-08  Alan Modra  <amodra@gmail.com>
1573
1574         * po/POTFILES.in: Regenerate.
1575
1576 2012-11-05  Alan Modra  <amodra@gmail.com>
1577
1578         * configure.ac: Apply 2012-09-10 change to config.in here.
1579         * configure: Regenerate.
1580
1581 2012-11-05  Alan Modra  <amodra@gmail.com>
1582
1583         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1584         (struct Opd_ent): Use "Address" rather than "Offset".
1585         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1586         (Target_powerpc::got_section): Make public.
1587         (Target_powerpc::scan_relocs): Move code setting symbols..
1588         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1589         Create _SDA_BASE_ only when referenced.
1590
1591 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1592
1593         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1594         from last change.
1595
1596 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1597
1598         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1599         for offset_in_output_section parameter.
1600         (Sized_target::relocate_special_relocatable): Likewise.
1601         * arm.cc (Target_arm::relocate_relocs): Likewise.
1602         (Target_arm::relocate_special_relocatable): Likewise.
1603         * i386.cc (Target_i386::relocate_relocs): Likewise.
1604         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1605         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1606         * target-reloc.h (relocate_relocs): Likewise.
1607         * testsuite/testfile.cc (Target_test): Likewise.
1608         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1609         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1610
1611         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1612         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1613
1614         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1615         parameter, which is unused in the [!F_SETFD] case.
1616
1617         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1618         SYMNDX to off_t before comparing it to this->data_size().
1619         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1620         * incremental.cc (Output_section_incremental_inputs::do_write):
1621         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1622
1623         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1624
1625 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1626
1627         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1628         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1629         in EABI_VER5.
1630
1631 2012-10-29  Cary Coutant  <ccoutant@google.com>
1632
1633         * dwp.cc (usage): Add file and exit status parameters;
1634         add --help and --version options.
1635         (print_version): New function.
1636         (main): Add --help and --version options.
1637
1638 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1639
1640         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1641         final_layout_sequence.txt.
1642         * testsuite/Makefile.in: Regenerated.
1643
1644 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1645
1646         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1647         COMPILE generated by automake.
1648         (LINK1): Likewise.
1649         (CXXCOMPILE1): Likewise.
1650         (CXXLINK1): Likewise.
1651         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1652         (LINK): Likewise.
1653         (CXXCOMPILE): Likewise.
1654         (CXXLINK): Likewise.
1655         * testsuite/Makefile.in: Regenerated.
1656
1657 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1658
1659         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1660         on bad fwrite return.
1661
1662 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1663
1664         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1665         on val.
1666
1667 2012-10-23  Cary Coutant  <ccoutant@google.com>
1668
1669         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1670         * testsuite/Makefile.in: Regenerate.
1671         * testsuite/dwp_test.h: New source file.
1672         * testsuite/dwp_test_1.cc: New source file.
1673         * testsuite/dwp_test_1.s: New source file.
1674         * testsuite/dwp_test_1.sh: New source file.
1675         * testsuite/dwp_test_1b.cc: New source file.
1676         * testsuite/dwp_test_1b.s: New source file.
1677         * testsuite/dwp_test_2.cc: New source file.
1678         * testsuite/dwp_test_2.s: New source file.
1679         * testsuite/dwp_test_2.sh: New source file.
1680         * testsuite/dwp_test_main.cc: New source file.
1681         * testsuite/dwp_test_main.s: New source file.
1682
1683 2012-10-23  Cary Coutant  <ccoutant@google.com>
1684
1685         * dwp.h: New header file.
1686         * dwp.cc: New source file.
1687         * gold.h: Move shared declarations to system.h.
1688         * system.h: New header file.
1689         * Makefile.am: Add dwp.
1690         * Makefile.in: Regenerate.
1691
1692 2012-10-23  Cary Coutant  <ccoutant@google.com>
1693
1694         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1695         Dwarf_info_reader::read_from_pointer.
1696         (Dwarf_pubnames_table::read_header): Likewise.
1697         (Dwarf_pubnames_table::next_name): Likewise.
1698         (Dwarf_die::read_attributes): Likewise.
1699         (Dwarf_die::skip_attributes): Likewise.
1700         (Dwarf_info_reader::read_from_pointer): New function template.
1701         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1702         (Dwarf_pubnames_table): Likewise.
1703         (Dwarf_info_reader::read_from_pointer): New function template.
1704         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1705         Dwarf_pubnames_table ctor.
1706
1707 2012-10-23  Cary Coutant  <ccoutant@google.com>
1708
1709         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1710         abbrev_shndx.
1711         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1712         abbrev_shndx_.
1713         (Dwarf_info_reader::set_abbrev_shndx): New method.
1714         (Dwarf_info_reader::abbrev_shndx_): New data member.
1715
1716 2012-10-23  Cary Coutant  <ccoutant@google.com>
1717
1718         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1719         from object, not parameters.
1720         (Dwarf_info_reader::parse): Likewise.
1721         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1722         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1723         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1724         methods.
1725
1726 2012-10-23  Cary Coutant  <ccoutant@google.com>
1727
1728         * fileread.cc (Input_file::Input_file): New constructor.
1729         * fileread.h (class Input_file): Add new constructor.
1730
1731 2012-10-18  Alan Modra  <amodra@gmail.com>
1732
1733         PR gold/14727
1734         * object.cc (Relobj::is_section_name_included): Also match
1735         .sdata personality section.
1736
1737 2012-10-18  Alan Modra  <amodra@gmail.com>
1738
1739         * target-reloc.h (class Default_comdat_behavior): New, package up..
1740         (get_comdat_behaviour): ..this.
1741         (relocate_section): Add Relocate_comdat_behavior template arg,
1742         adjust code to suit.
1743         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1744         (Target_arm::scan_reloc_section): Likewise.
1745         * i386.cc (Target_i386::relocate_section): Likewise.
1746         * sparc.cc (Target_sparc::relocate_section): Likewise.
1747         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1748         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1749         * powerpc.cc (class Relocate_comdat_behavior): New.
1750         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1751         gold::relocate_section with new template arg.
1752
1753 2012-10-18  Alan Modra  <amodra@gmail.com>
1754
1755         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1756         dynamic relocs for GOT_TPREL got entries, without symbol if
1757         resolving locally.
1758         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1759         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1760         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1761
1762 2012-10-17  Alan Modra  <amodra@gmail.com>
1763
1764         PR gold/14726
1765         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1766
1767 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1768
1769         * layout.cc (Layout::include_section): Keep sections marked
1770         SHF_EXCLUDE when doing relocatable links.
1771
1772 2012-10-16  Alan Modra  <amodra@gmail.com>
1773
1774         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1775         (Target_powerpc::do_finalize_sections): Call it.
1776         (Output_data_save_res): New class and supporting functions.
1777         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1778         normal symbols defined in object files.
1779
1780 2012-10-12  Alan Modra  <amodra@gmail.com>
1781
1782         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1783         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1784         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1785         section if scan_opd_relocs not yet called.
1786         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1787
1788 2012-10-12  Alan Modra  <amodra@gmail.com>
1789
1790         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1791         add_local_ifunc_entry): Revert last change.
1792         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1793
1794 2012-10-05  Alan Modra  <amodra@gmail.com>
1795
1796         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1797         do_plt_address_for_global): New functions.
1798         (Output_data_got_powerpc::do_write): Don't segfault when linking
1799         statically.
1800         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1801         add_local_ifunc_entry): Return true on adding entry..
1802         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1803         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1804         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1805         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1806         set up symbols here.
1807         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1808         syms here.  Do so even when no .iplt.  Don't segfault when linking
1809         statically.
1810         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1811         new variants without reloc param.
1812         (Glink_sym_ent::Glink_sym_ent): Likewise.
1813         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1814         reloc when refs will resolve to plt call stub.
1815         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1816         R_PPC_PLTREL24 to resolve locally.
1817         (Target_powerpc::Scan::global): Correct ifunc handling.
1818         (Target_powerpc::Relocate::relocate): Correct local sym glink
1819         lookup.  Don't destroy "value" when we have a plt call stub,
1820         and when checking plt call validity.
1821         (Target_powerpc::do_dynsym_value): Simplify.
1822
1823 2012-10-05  Alan Modra  <amodra@gmail.com>
1824
1825         * i386.cc (Output_data_plt_i386::address_for_global,
1826         address_for_local): Add plt offset to returned value.  Adjust uses.
1827         * sparc.cc (Output_data_plt_sparc::address_for_global,
1828         address_for_local): Likewise.
1829         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1830         address_for_local): Likewise.
1831         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1832         address_for_local): Likewise.
1833         * target.h (Target::plt_address_for_global, plt_address_for_local):
1834         Update comment.
1835         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1836         (Output_data_got::Got_entry::write): Nor here.
1837         * output.h: Comment fix.
1838
1839 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1840
1841         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1842         global_offset_table_ value for larget got.
1843         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1844
1845 2012-09-29  Alan Modra  <amodra@gmail.com>
1846
1847         * powerpc.cc (Target_powerpc::iplt_): New output section.
1848         (Target_powerpc::iplt_section, make_iplt_section,
1849         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1850         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1851         Target_powerpc::plt_entry_count): Count iplt entries too.
1852         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1853         reloc section in constructor.  New params.
1854         (Target_powerpc::make_plt_section): Create reloc section here instead.
1855         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1856         functions.
1857         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1858         (Output_data_glink::add_entry, find_entry): New functions to
1859         deal with local syms.
1860         (Glink_sym_ent): Add support for local syms.
1861         (Output_data_glink::do_write): Handle ifunc plt entries.
1862         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1863         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1864         (Target_powerpc::Relocate::relocate): Likewise.
1865         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1866
1867 2012-09-25  Alan Modra  <amodra@gmail.com>
1868
1869         * object.h (Sized_relobj_file::adjust_local_symbol,
1870         do_adjust_local_symbol): New functions.
1871         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1872         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1873         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1874         and irregular opd entry spacing.
1875         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1876         (Global_symbol_visitor_opd): New functor.
1877         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1878         on deleted opd entries.
1879
1880 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1881
1882         * tilegx.cc: New file.
1883         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1884         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1885         * configure.tgt: Add entries for tilegx*.
1886         * configure.ac: Likewise.
1887         * Makefile.in: Rebuild.
1888         * configure: Likewise.
1889         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1890         tilegx.
1891
1892 2012-09-13  Alan Modra  <amodra@gmail.com>
1893
1894         * target-reloc.h (scan_relocs): Call scan.local for relocs
1895         against symbols in discarded sections.  Pass is_discarded
1896         param.
1897         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1898         Add is_discarded param.
1899         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1900         is_discarded to flag opd entry as discarded.  Don't emit dyn
1901         relocs on such entries.
1902         (Target_powerpc::Scan::global): Similarly detect and handle
1903         such opd entries.
1904         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1905         opd_ent_.  Update all uses.
1906         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1907         (Target_powerpc::relocate_section): Zero out discarded opd
1908         entry relocs.
1909
1910 2012-09-12  Ian Lance Taylor  <iant@google.com>
1911
1912         PR gold/14570
1913         * output.cc: Rename Output_data_got template parameter from size
1914         to got_size for all functions.  Compile all variants of
1915         Output_data_got.
1916         (Output_data_got::Got_entry::write): Correct use of size for
1917         symbol value.  Use local_is_tls rather than casting to
1918         Sized_relobj_file.
1919         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1920         (class Sized_relobj_file): Add do_local_is_tls.
1921         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1922
1923 2012-09-11  Alan Modra  <amodra@gmail.com>
1924
1925         PR gold/14566
1926         * layout.cc (Layout::set_segment_offsets): When using
1927         common-page-size alignment, ensure we are on a new max-page-size
1928         page.
1929         * output.cc (Output_segment::set_section_addresses): Use
1930         abi_pagesize, not common_pagesize for relro boundary.
1931         (Output_segment::set_offset): Likewise.
1932
1933 2012-09-11  Alan Modra  <amodra@gmail.com>
1934
1935         * output.h (Output_data_got::add_global_tls, add_local_tls,
1936         add_local_tls_pair): New functions.
1937         (Output_data_got::add_local_pair_with_rel): Remove second
1938         reloc param.  Expand comment.
1939         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1940         use_plt_or_tls_offset_, similarly for constructor param.
1941         (Output_data_got::Got_entry::write): Add got_index param.
1942         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1943         add_local_tls_pair): New functions.
1944         (Output_data_got::Got_entry::write): Handle tls symbols
1945         with use_plt_or_tls_offset_ set specially.
1946         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1947         (Output_data_got::do_write): Replace iterator with index, pass
1948         index to entry write function.
1949         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1950         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1951         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1952         call.
1953         * i386.cc (Target_i386::Scan::local): Likewise.
1954         * sparc.cc (Target_sparc::Scan::local): Likewise.
1955         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1956         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1957         do_tls_offset_for_global): New functions.
1958         (Target_powerpc::Scan::local): Correct TLS relocations and got
1959         entry values.
1960         (Target_powerpc::Scan::global): Don't emit unnecessary
1961         dynamic relocations on TLS GOT entries.
1962
1963 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1964
1965         * config.in: Disable sanity check for kfreebsd.
1966
1967 2012-09-10  Sterling Augustine  <saugustine@google.com>
1968
1969         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1970         (Gdb_index::pubtypes_read): New parameter.
1971         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1972         to calls.
1973         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1974         pubtypes_object_.
1975
1976 2012-09-09  Alan Modra  <amodra@gmail.com>
1977
1978         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1979         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1980         * gc.h (gc_process_relocs): Call target gc_add_reference.
1981         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1982         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1983         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1984         unnecessary cast.
1985         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1986         to cater for when we don't need code offset.  Update use.
1987         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1988         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1989         set_opd_valid): New functions.
1990         (Target_powerpc::do_gc_add_reference): New function.
1991         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1992         stashed refs.
1993         (Target_powerpc::do_gc_mark_symbol): New function.
1994
1995 2012-09-06  Cary Coutant  <ccoutant@google.com>
1996
1997         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1998         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1999         (Dwarf_die::skip_attributes): Likewise.
2000         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2001         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2002         (main): Call it.
2003         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2004
2005 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2006
2007         * testsuite/script_test_3.t: Add .got.plt output section
2008         statement.
2009         * testsuite/script_test_4.t: Likewise.
2010
2011 2012-09-05  Alan Modra  <amodra@gmail.com>
2012
2013         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2014         update all uses and lose "enum" when using type.
2015
2016 2012-09-05  Alan Modra  <amodra@gmail.com>
2017
2018         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2019         * configure: Regenerate.
2020         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2021         (plugin_final_layout.stdout): Likewise.
2022         (memory_test): Set page sizes to 0x1000.
2023         * testsuite/Makefile.in: Regenerate.
2024         * testsuite/discard_locals_test.sh: Add FIXME comment.
2025         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2026         * testsuite/pr14265.t: Add .got output section statement.
2027         * testsuite/script_test_2.t: Likewise.
2028         * testsuite/script_test_3.t: Likewise.
2029         * testsuite/script_test_4.t: Likewise.
2030         * testsuite/script_test_5.t: Likewise.
2031         * testsuite/script_test_6.t: Likewise.
2032         * testsuite/script_test_7.t: Likewise.
2033         * testsuite/script_test_9.t: Likewise.
2034
2035 2012-09-05  Alan Modra  <amodra@gmail.com>
2036
2037         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2038         (Powerpc_relocate_functions::Status): New typedef.
2039         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2040         (Target_powerpc::Scan::local): Handle REL64.
2041         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2042         for REL32 and REL64.
2043         (Target_powerpc::symval_for_branch): New function, extracted from..
2044         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2045         checks.  Report overflow errors.
2046
2047 2012-09-05  Alan Modra  <amodra@gmail.com>
2048
2049         * object.h (Sized_relobj_file::emit_relocs): Delete.
2050         (Sized_relobj_file::emit_relocs_reltype): Delete.
2051         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2052         relocate_relocs for --emit-relocs.
2053         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2054         * output.h: Update comment.
2055         (Output_segment::first_section): New function.
2056         (Output_segment::first_section_load_address): Use first_section.
2057         * output.cc (Output_segment::first_section): New function extracted..
2058         (Output_segment::first_section_load_address): ..from here.  Delete.
2059         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2060         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2061         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2062         adjust call to target.h function.
2063         * i386.cc (Target_i386): Likewise.
2064         * sparc.cc (Target_sparc): Likewise.
2065         * x86_64.cc (Target_x86_64): Likewise.
2066         * powerpc.cc (Target_powerpc): Likewise.
2067         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2068         first tls section has section symbol for optimised local dynamic
2069         output relocs.
2070         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2071         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2072         optimised tls code.
2073         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2074         Rename to relocate_relocs.  Update error message.
2075
2076 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2077
2078         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2079         --just-symbols.
2080
2081 2012-08-31  Alan Modra  <amodra@gmail.com>
2082
2083         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2084         (Powerpc_relobj::toc_base_offset): New stub function.
2085         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2086         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2087         (Target_powerpc::Relocate::enum skip_tls): New.
2088         (Target_powerpc::call_tls_get_addr_): New var.
2089         (Target_powerpc::is_branch_reloc): Move to file scope.
2090         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2091         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2092         New functions.
2093         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2094         (powerpc_info): Correct common_pagesize for ppc64.
2095         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2096         (Powerpc_relocate_functions): Add overflow check enums and functions.
2097         Add non-shift version of rela, rela_ua.  Delete all rel public
2098         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2099         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2100         addr16_ha3, addr14 functions.
2101         (Output_data_got_powerpc::add_constant_pair): New function.
2102         (Output_data_got_powerpc::got_base_offset): Likewise.
2103         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2104         (instruction constants): Sort, add some more.
2105         (Output_data_glink::do_write): Add and use Address typedef.  Use
2106         object->toc_base_offset() stub for 64-bit.
2107         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2108         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2109         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2110         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2111         Always treat .opd relocs as against locally defined symbol.
2112         Correct condition for RELATIVE relocs.
2113         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2114         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2115         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2116         calculations.  Handle TLS relocs, and more.  Add overflow
2117         checking and adjust for Powerpc_relocate_functions changes.
2118         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2119         Reinstate --emit-relocs code with FIXME.
2120
2121 2012-08-30  Alan Modra  <amodra@gmail.com>
2122
2123         * layout.cc (Layout::set_segment_offsets): Set p_align to
2124         abi_pagesize, not common_pagesize.
2125         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2126         to determine whether file header can go in segment.
2127
2128 2012-08-30  Alan Modra  <amodra@gmail.com>
2129
2130         * output.h (Output_reloc::Output_reloc <output section>): Add
2131         is_relative param.  Adjust calls.
2132         (Output_reloc::add_output_section_relative): New functions.
2133         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2134         is_relative.
2135         (Output_reloc::symbol_value): Handle SECTION_CODE.
2136
2137 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2138
2139         * gold.cc (queue_middle_tasks): Call layout again when unique
2140         segments for sections is desired.
2141         * layout.cc (Layout::Layout): Initialize new members.
2142         (Layout::get_output_section_flags): New function.
2143         (Layout::choose_output_section): Call get_output_section_flags.
2144         (Layout::layout): Make output section for mapping to a unique segment.
2145         (Layout::insert_section_segment_map): New function.
2146         (Layout::attach_allocated_section_to_segment): Make unique segment for
2147         output sections marked so.
2148         (Layout::segment_precedes): Check for unique segments when sorting.
2149         * layout.h (Layout::Unique_segment_info): New struct.
2150         (Layout::Section_segment_map): New typedef.
2151         (Layout::insert_section_segment_map): New function.
2152         (Layout::get_output_section_flags): New function.
2153         (Layout::is_unique_segment_for_sections_specified): New function.
2154         (Layout::set_unique_segment_for_sections_specified): New function.
2155         (Layout::unique_segment_for_sections_specified_): New member.
2156         (Layout::section_segment_map_): New member.
2157         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2158         Rename is_gc_pass_one to is_pass_one.
2159         Rename is_gc_pass_two to is_pass_two.
2160         Rename is_gc_or_icf to is_two_pass.
2161         Check for which pass based on whether symbols data is present.
2162         Make it two pass when unique segments for sections is desired.
2163         * output.cc (Output_section::Output_section): Initialize new
2164         members.
2165         * output.h (Output_section::is_unique_segment): New function.
2166         (Output_section::set_is_unique_segment): New function.
2167         (Output_section::is_unique_segment_): New member.
2168         (Output_section::extra_segment_flags): New function.
2169         (Output_section::set_extra_segment_flags): New function.
2170         (Output_section::extra_segment_flags_): New member.
2171         (Output_section::segment_alignment): New function.
2172         (Output_section::set_segment_alignment): New function.
2173         (Output_section::segment_alignment_): New member.
2174         (Output_segment::Output_segment): Initialize is_unique_segment_.
2175         (Output_segment::is_unique_segment): New function.
2176         (Output_segment::set_is_unique_segment): New function.
2177         (Output_segment::is_unique_segment_): New member.
2178         * plugin.cc (allow_unique_segment_for_sections): New function.
2179         (unique_segment_for_sections): New function.
2180         (Plugin::load): Add new functions to transfer vector.
2181         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2182         * Makefile.in: Regenerate.
2183         * testsuite/plugin_final_layout.sh: Check if unique segment
2184         functionality works.
2185         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2186         are available.
2187         (allow_unique_segment_for_sections): New global.
2188         (unique_segment_for_sections): New global.
2189         (claim_file_hook): Call allow_unique_segment_for_sections.
2190         (all_symbols_read_hook): Call unique_segment_for_sections.
2191
2192 2012-08-22  Cary Coutant  <ccoutant@google.com>
2193
2194         * layout.cc (Layout::include_section): Don't assert on GROUP
2195         sections with --emit-relocs.
2196
2197 2012-08-21  Cary Coutant  <ccoutant@google.com>
2198
2199         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2200         if --export-dynamic-symbol names an undef symbol.
2201
2202 2012-08-18  Alan Modra  <amodra@gmail.com>
2203
2204         * powerpc.cc: Formatting and white space.
2205         (Powerpc_relobj): Rename got2_section_ to special_.
2206         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2207         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2208         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2209         (Target_powerpc): Add Address typedef and invalid_address.  Use
2210         throughout.
2211         (Target_powerpc::is_branch_reloc): New function.
2212         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2213         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2214         for dst_mask, value and addend.
2215         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2216         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2217         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2218         uint16_t for 24-bit offset.  Use get_output_section_offset and
2219         check return.
2220         (Target_powerpc::Scan::local): Handle more relocs.
2221         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2222         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2223         Plug in toc restoring insn after plt calls.  Translate branches
2224         to function descriptor symbols to corresponding entry point.
2225         (Target_powerpc::relocate_for_relocatable): Check return from
2226         get_output_section_offset.
2227         * symtab.h: Comment typo.
2228
2229 2012-08-14  Ian Lance Taylor  <iant@google.com>
2230
2231         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2232         unsupported_relocal_local to call unsupported_reloc_global.
2233
2234 2012-08-14  Nick Clifton  <nickc@redhat.com>
2235
2236         PR ld/14265
2237         * script-sections.cc (Sections_element::output_section_name): Add
2238         keep return parameter.
2239         (Output_section_element::match_name): Add keep return parameter.
2240         Return the value of the keep_ member.
2241         * script-sections.h (class Output_section): Update
2242         output_section_name prototype.
2243         * layout.cc (Layout::keep_input_section): New public member
2244         function.
2245         (Layout::choose_output_section): Pass keep parameter to
2246         output_section_name.
2247         * layout.h (class Layout): Add keep_input_section.
2248         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2249         sections.
2250         * testsuite/Makefile.am: Add a test.
2251         * testsuite/Makefile.in: Regenerate.
2252         * testsuite/pr14265.c: Source file for the test.
2253         * testsuite/pr14265.t: Linker script for the test.
2254         * testsuite/pr14265.sh: Shell script for the test.
2255
2256 2012-08-14  Alan Modra  <amodra@gmail.com>
2257
2258         * target.h (Target::output_section_name): New function.
2259         (Target::do_output_section_name): New function.
2260         * layout.cc (Layout::choose_output_section): Call the above.
2261         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2262
2263 2012-08-14  Alan Modra  <amodra@gmail.com>
2264
2265         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2266         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2267         for replace_constant call.
2268         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2269         (Output_data_glink::do_print_to_mapfile): New function.
2270         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2271         (Target_powerpc::Relocate::relocate): Likewise.
2272
2273 2012-08-14  Alan Modra  <amodra@gmail.com>
2274
2275         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2276         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2277         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2278         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2279         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2280         here.
2281         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2282         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2283         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2284         here.
2285         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2286         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2287
2288 2012-08-12  Alan Modra  <amodra@gmail.com>
2289
2290         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2291         (glink insn constants): Use uint32_t.
2292         (Output_data_glink::add_entry): Use insert, not [] operator.
2293
2294 2012-08-11  Alan Modra  <amodra@gmail.com>
2295
2296         * object.h (Sized_relobj_file::find_shdr): New function.
2297         (Sized_relobj_file::find_special_sections): New function.
2298         * object.cc (Sized_relobj_file::find_shdr): New function.
2299         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2300         (Sized_relobj_file::find_special_sections): New function, split out..
2301         (Sized_relobj_file::do_read_symbols): ..from here.
2302         * output.h (Output_data_got::replace_constant): New function.
2303         (Output_data_got::num_entries): New function.
2304         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2305         (Output_data_got::got_offset): Protected rather than private.
2306         (Output_data_got::replace_got_entry): New function.
2307         * output.cc (Output_data_got::replace_got_entry): New function.
2308         * powerpc.cc (class Powerpc_relobj): New.
2309         (class Powerpc_relocate_functions): Delete all psymval variants or
2310         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2311         Implement _ha functions using corresponding _hi function.
2312         (Powerpc_relobj::find_special_sections): New function.
2313         (Target_powerpc::do_make_elf_object): New function.
2314         (class Output_data_got_powerpc): New.
2315         (class Output_data_glink): New.
2316         (class Powerpc_scan_relocatable_reloc): New.
2317         Many more changes througout file.
2318
2319 2012-08-09  Nick Clifton  <nickc@redhat.com>
2320
2321         * po/vi.po: Updated Vietnamese translation.
2322
2323 2012-08-07  Ian Lance Taylor  <iant@google.com>
2324
2325         * layout.cc (Layout::add_target_dynamic_tags): If
2326         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2327         plt_rel.
2328
2329 2012-07-30  Nick Clifton  <nickc@redhat.com>
2330
2331         * po/gold.pot: Updated template.
2332         * po/es.po: Updated Spanish translation.
2333
2334 2012-07-18  Cary Coutant  <ccoutant@google.com>
2335
2336         PR gold/14344
2337         * configure.ac: Add check for -gpubnames support.
2338         * configure: Regenerate.
2339         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2340         support; force -gno-pubnames.
2341         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2342         support.
2343         (gdb_index_test_4): New test.
2344         * testsuite/Makefile.in: Regenerate.
2345         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2346         * testsuite/gdb_index_test_2.sh: Likewise.
2347         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2348         * testsuite/gdb_index_test_4.sh: New script.
2349         * testsuite/gdb_index_test_comm.sh: New script with common code;
2350         don't look for space after colon.
2351
2352 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2353
2354         * gold.cc (queue_middle_tasks): Update function order only after
2355         deferred objects due to plugins are processed.
2356
2357 2012-07-11  Ian Lance Taylor  <iant@google.com>
2358
2359         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2360         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2361         (Target_arm::scan_reloc_for_stub): Likewise.
2362         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2363         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2364         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2365         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2366         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2367
2368 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2369             Ian Lance Taylor  <iant@google.com>
2370
2371         PR gold/14309
2372         * configure.ac: Test whether std::tr1::hash<off_t> works.
2373         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2374         needed.
2375         * output.h (class Output_fill): Add virtual destructor.
2376         * configure, config.in: Rebuild.
2377
2378 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2379
2380         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2381
2382 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2383
2384         * plugin.cc (Plugin::load): Handle position independent executables.
2385
2386 2012-06-06  Cary Coutant  <ccoutant@google.com>
2387
2388         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2389         add .debug_macro.
2390         (lines_only_debug_sections): Likewise.
2391         (gdb_fast_lookup_sections): New static array.
2392         (is_gdb_debug_section): Rename formal parameter.
2393         (is_lines_only_debug_section): Likewise.
2394         (is_gdb_fast_lookup_section): New function.
2395         (Layout::include_section): Check for ".zdebug_" prefix; pass
2396         section name suffix to is_gdb_debug_section, et al.; check for
2397         fast-lookup sections when building .gdb_index.
2398         * options.h (--strip-debug-gdb): Update GDB version number.
2399
2400 2012-06-06  Cary Coutant  <ccoutant@google.com>
2401
2402         * configure.ac: Add check for fallocate.
2403         * configure: Regenerate.
2404         * config.in: Regenerate.
2405
2406         * options.h (class General_options): Add --mmap-output-file and
2407         --posix-fallocate options.
2408         * output.cc: (posix_fallocate): Remove; replace with...
2409         (gold_fallocate): New function.
2410         (Output_file::map_no_anonymous): Call gold_fallocate.
2411         (Output_file::map): Check --mmap-output-file option.
2412
2413 2012-06-05  Jing Yu  <jingyu@google.com>
2414
2415         * gold.h (textdomain): Add do {} to empty while(0).
2416         (bindtextdomain): Likewise.
2417
2418 2012-06-04  Cary Coutant  <ccoutant@google.com>
2419
2420         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2421         has_dynsym_index.
2422
2423 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2424
2425         * symtab.cc (Symbol_table::define_special_symbol):
2426         Initialize *poldsym to prevent uninitialized variable errors.
2427
2428 2012-05-23  Cary Coutant  <ccoutant@google.com>
2429
2430         * layout.cc (Layout::section_name_mapping): Add rules to handle
2431         exact match on .data.rel.ro.local or .data.rel.ro.
2432         (Layout::output_section_name): Check for exact matches.
2433
2434 2012-05-23  Cary Coutant  <ccoutant@google.com>
2435
2436         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2437         more carefully.
2438
2439 2012-05-22  Cary Coutant  <ccoutant@google.com>
2440
2441         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2442         object before exporting symbol.
2443
2444 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2445
2446         * testsuite/tls_test.cc: Include "config.h" first.
2447         * testsuite/tls_test_c.c: Likewise.
2448
2449 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2450             Nick Clifton  <nickc@redhat.com>
2451
2452         PR 14072
2453         * configure.in: Add check that sysdep.h has been included before
2454         any system header files.
2455         * configure: Regenerate.
2456         * config.in: Regenerate.
2457
2458 2012-05-14  Cary Coutant  <ccoutant@google.com>
2459
2460         * layout.cc (Layout::make_output_section): Mark .tdata section
2461         as RELRO.
2462         * testsuite/relro_test.cc: Add a TLS variable.
2463
2464 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2465
2466         PR gold/14091
2467         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2468         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2469         R_X86_64_64.
2470
2471 2012-05-08  Cary Coutant  <ccoutant@google.com>
2472
2473         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2474         (lines_only_debug_sections): Likewise.
2475
2476 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2477
2478         * nacl.cc: New file.
2479         * nacl.h: New file.
2480         * Makefile.am (CCFILES, HFILES): Add them.
2481         * Makefile.in: Regenerate.
2482         * i386.cc (Output_data_plt_i386_nacl): New class.
2483         (Output_data_plt_i386_nacl_exec): New class.
2484         (Output_data_plt_i386_nacl_dyn): New class.
2485         (Target_i386_nacl): New class.
2486         (Target_selector_i386_nacl): New class.
2487         (target_selector_i386): Use it instead of Target_selector_i386.
2488         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2489         (Target_x86_64_nacl): New class.
2490         (Target_selector_x86_64_nacl): New class.
2491         (target_selector_x86_64, target_selector_x32): Use it instead of
2492         Target_selector_x86_64.
2493         * arm.cc (Output_data_plt_arm_nacl): New class.
2494         (Target_arm_nacl): New class.
2495         (Target_selector_arm_nacl): New class.
2496         (target_selector_arm, target_selector_armbe): Use it instead of
2497         Target_selector_arm.
2498
2499         * target-select.cc (select_target): Take new Input_file* and off_t
2500         arguments, pass them on to recognize method of selector.
2501         * object.cc (make_elf_sized_object): Update caller.
2502         * parameters.cc (parameters_force_valid_target): Likewise.
2503         * incremental.cc (make_sized_incremental_binary): Likewise.
2504         * target-select.h: Update decl.
2505         (Target_selector::recognize): Take new Input_file* argument,
2506         pass it on to do_recognize.
2507         (Target_selector::do_recognize): Take new Input_file* argument.
2508         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2509         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2510         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2511         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2512
2513         * target.h (Target::Target_info): New members isolate_execinstr
2514         and rosegment_gap.
2515         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2516         * arm.cc (Target_arm::arm_info): Update initializer.
2517         * i386.cc (Target_i386::i386_info): Likewise.
2518         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2519         * sparc.cc (Target_sparc::sparc_info): Likewise.
2520         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2521         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2522         * layout.cc (Layout::attach_allocated_section_to_segment):
2523         Take new const Target* argument.  If target->isolate_execinstr(), act
2524         like --rosegment.
2525         (Layout::find_first_load_seg): Take new const Target* argument;
2526         if target->isolate_execinstr(), reject PF_X segments.
2527         (Layout::relaxation_loop_body): Update caller.
2528         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2529         reset file offset to zero when we hit LOAD_SEG, and then do a second
2530         loop over the segments before LOAD_SEG to reassign offsets after
2531         addresses have been determined.  Handle target->rosegment_gap().
2532         (Layout::attach_section_to_segment): Take new const Target* argument;
2533         pass it to attach_allocated_section_to_segment.
2534         (Layout::make_output_section): Update caller.
2535         (Layout::attach_sections_to_segments): Take new const Target* argument;
2536         pass it to attach_section_to_segment.
2537         * gold.cc (queue_middle_tasks): Update caller.
2538         * layout.h (Layout): Update method decls with new arguments.
2539
2540         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2541         Target_info pointer to use.
2542         (Target_arm::do_make_data_plt): New virtual method.
2543         (Target_arm::make_data_plt): New method that calls it.
2544         (Target_arm::make_plt_entry): Use it.
2545         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2546         for the section alignment.
2547         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2548         method.
2549         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2550         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2551         method.
2552         (Output_data_plt_arm::get_plt_entry_size): Call it.
2553         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2554         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2555         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2556         method.
2557         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2558         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2559         method instead of sizeof(plt_entry).
2560         (Output_data_plt_arm::add_entry): Likewise.
2561         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2562         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2563         than static method.
2564         (Target_arm::plt_entry_size): Likewise.
2565         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2566         Move to ...
2567         (Output_data_plt_arm_standard): ... here, new class.
2568         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2569         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2570         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2571
2572         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2573         Take additional argument for the PLT entry size.
2574         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2575         Use get_plt_entry_size method rather than plt_entry_size variable.
2576         (Output_data_plt_x86_64::reserve_slot): Likewise.
2577         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2578         (Output_data_plt_x86_64::add_entry): Likewise.
2579         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2580         (Output_data_plt_x86_64::address_for_global): Likewise.
2581         (Output_data_plt_x86_64::address_for_local): Likewise.
2582         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2583         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2584         Make method non-static.
2585         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2586         method.
2587         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2588         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2589         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2590         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2591         virtual method.
2592         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2593         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2594         virtual method.
2595         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2596         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2597         virtual method.
2598         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2599         (Output_data_plt_x86_64::plt_entry_size)
2600         (Output_data_plt_x86_64::first_plt_entry)
2601         (Output_data_plt_x86_64::plt_entry)
2602         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2603         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2604         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2605         (Output_data_plt_x86_64_standard): ... here, new class.
2606         (Target_x86_64::Target_x86_64): Take optional argument for the
2607         Target_info pointer to use.
2608         (Target_x86_64::do_make_data_plt): New virtual method.
2609         (Target_x86_64::make_data_plt): New method to call it.
2610         (Target_x86_64::init_got_plt_for_update): Use that.
2611         Call this->plt_->add_eh_frame method here.
2612         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2613         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2614         rather than static method.
2615         (Target_x86_64::plt_entry_size): Likewise.
2616         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2617         rather than plt_entry_size variable.  Move guts of PLT filling to...
2618         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2619         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2620         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2621
2622         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2623         additional argument for the section alignment.
2624         Don't do add_eh_frame_for_plt here.
2625         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2626         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2627         variable.
2628         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2629         method.
2630         (Output_data_plt_i386::get_plt_entry_size): Call it.
2631         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2632         (Output_data_plt_i386::add_eh_frame): New method to call it.
2633         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2634         method.
2635         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2636         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2637         method.
2638         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2639         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2640         method instead of plt_entry_size.
2641         (Output_data_plt_i386::plt_entry_size)
2642         (Output_data_plt_i386::plt_eh_frame_fde_size)
2643         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2644         (Output_data_plt_i386_standard): ... here, new class.
2645         (Output_data_plt_i386_exec): New class.
2646         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2647         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2648         (Output_data_plt_i386::exec_plt_entry): Move to ...
2649         (Output_data_plt_i386_exec::plt_entry): ... here.
2650         (Output_data_plt_i386_dyn): New class.
2651         (Output_data_plt_i386::first_plt_entry): Move to ...
2652         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2653         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2654         (Output_data_plt_i386_dyn::plt_entry): ... here.
2655         (Target_i386::Target_i386): Take optional argument for the Target_info
2656         pointer to use.
2657         (Target_i386::do_make_data_plt): New virtual method.
2658         (Target_i386::make_data_plt): New method to call it.
2659         (Target_i386::make_plt_section): Use that.
2660         Call this->plt_->add_eh_frame method here.
2661         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2662         rather than plt_entry_size variable.
2663         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2664         (Output_data_plt_i386::address_for_local): Likewise.
2665         (Output_data_plt_i386::do_write): Likewise.
2666         Move guts of PLT filling to...
2667         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2668         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2669         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2670         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2671
2672 2012-05-01  Cary Coutant  <ccoutant@google.com>
2673
2674         * dwarf_reader.cc (Dwarf_die::read_attributes)
2675         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2676         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2677         * reduced_debug_output.cc
2678         (Output_reduced_debug_info_section::get_die_end): Remove
2679         DW_FORM_GNU_ref_index.  Add default case.
2680
2681 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2682
2683         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2684         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2685         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2686         DW_AT_high_pc as offset from DW_AT_low_pc.
2687
2688         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2689         * testsuite/Makefile.in: Regenerate.
2690         * testsuite/gdb_index_test_3.c: New test source file.
2691         * testsuite/gdb_index_test_3.sh: New test source file.
2692
2693 2012-04-25  Ian Lance Taylor  <iant@google.com>
2694
2695         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2696         pointer.
2697         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2698         as a class, not a struct.
2699         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2700         (Target_arm::apply_cortex_a8_workaround): Likewise.
2701         * gc.h: Declare Reloc_types as a struct, not a class.
2702         * object.h: Declare Symbols_data as a struct.
2703         * reloc.h: Declare Read_relocs_data as a struct.
2704         * target.h: Declare Relocate_info as a struct.
2705
2706 2012-04-24  David S. Miller  <davem@davemloft.net>
2707
2708         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2709         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2710         and R_SPARC_WPLT30.
2711
2712 2012-04-24  Cary Coutant  <ccoutant@google.com>
2713
2714         * incremental-dump.cc (find_input_containing_global): Replace
2715         magic number with symbolic constant.
2716         (dump_incremental_inputs): Update version number.
2717         * incremental.cc (Output_section_incremental_inputs): Update version
2718         number; import symbolic constants from Incremental_inputs_reader.
2719         (Incremental_inputs::create_data_sections): Align relocations
2720         section correctly for 64-bit targets.
2721         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2722         constants; add padding.
2723         (Output_section_incremental_inputs::write_header): Add assert for
2724         header_size.
2725         (Output_section_incremental_inputs::write_input_files): Add assert
2726         for input_entry_size.
2727         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2728         add assert for object_info_size, input_section_entry_size,
2729         global_sym_entry_size.
2730         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2731         for data structure sizes; use them.
2732         (Incremental_input_entry_reader): Import symbolic constants from
2733         Incremental_inputs_reader; use them.
2734
2735 2012-04-23  David S. Miller  <davem@davemloft.net>
2736
2737         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2738         and elf_flags_set_.
2739         (Target_sparc::Target_sparc): Initialize new fields.
2740         (Target_sparc::do_make_elf_object): New function.
2741         (Target_sparc::do_adjust_elf_header): New function.
2742
2743 2012-04-23  Cary Coutant  <ccoutant@google.com>
2744
2745         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2746         CU range table of gdb index.
2747
2748 2012-04-20  David S. Miller  <davem@davemloft.net>
2749
2750         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2751         instead of false.
2752
2753 2012-04-16  David S. Miller  <davem@davemloft.net>
2754
2755         * sparc.cc (Target_sparc::got_address): New function.
2756         (Sparc_relocate_functions::gdop_hix22): New function.
2757         (Sparc_relocate_functions::gdop_lox10): New function.
2758         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2759         relocs.
2760         (Target_sparc::Scan::local): Likewise if the global symbol is not
2761         preemptible and is not IFUNC.
2762         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2763         transformations for local and non-preemptible non-IFUNC global
2764         symbols.
2765
2766         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2767         writing out 64-bit part of ranges.
2768
2769         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2770         -fpic and -fpie respectively.
2771         * Makefile.in: Regenerate.
2772
2773         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2774         (Target_sparc::Target_sparc): Initialize new field.
2775         (Target_sparc::do_plt_section_for_global): New function.
2776         (Target_sparc::do_plt_section_for_local): New function.
2777         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2778         (Target_sparc::make_plt_section): New function, broken out of
2779         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2780         (Target_sparc::make_plt_entry): Call make_plt_section.
2781         (Target_sparc::make_local_ifunc_plt_entry): New function.
2782         (Target_sparc::rela_ifunc_section): New function.
2783         (Target_sparc::plt_section): Remove const.
2784         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2785         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2786         and ifunc_count_ fields.
2787         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2788         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2789         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2790         (Output_data_plt_sparc::rela_ifunc): New function.
2791         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2792         (Output_data_plt_sparc::has_ifunc_section): New function.
2793         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2794         (Output_data_plt_sparc::address_for_global): New function.
2795         (Output_data_plt_sparc::address_for_local): New function.
2796         (Output_data_plt_sparc::plt_index_to_offset): New function.
2797         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2798         and entry_count.
2799         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2800         entry_count.
2801         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2802         R_SPARC_JMP_IREL to switch.
2803         (Target_sparc::Scan::check_non_pic): Likewise.
2804         (Target_sparc::Scan::local): Handle IFUNC symbols.
2805         (Target_sparc::Scan::local): Likewise.
2806         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2807         and plt_address_for_local.
2808         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2809         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2810
2811         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2812         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2813         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2814         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2815         global relocs too.
2816         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2817         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2818         calls.
2819         * sparc.cc (Target_sparc::Scan::global): Likewise.
2820         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2821
2822 2012-04-16  Cary Coutant  <ccoutant@google.com>
2823
2824         * archive.cc (Library_base::should_include_member): Check for
2825         --export-dynamic-symbol.
2826         * options.h (class General_options): Add --export-dynamic-symbol.
2827         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2828         --export-dynamic-symbol.
2829         (Symbol_table::gc_mark_undef_symbols): Likewise.
2830         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2831
2832 2012-04-12  David S. Miller  <davem@davemloft.net>
2833
2834         * sparc.cc (Reloc::wdisp10): New relocation method.
2835         (Reloc::h34): Likewise.
2836         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2837         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2838         R_SPARC_WDISP10.
2839         (Target_sparc::Scan::local): Likewise.
2840         (Target_sparc::Scan::global): Likewise.
2841         (Target_sparc::Relocate::relocate): Likewise.
2842
2843 2012-04-09  Cary Coutant  <ccoutant@google.com>
2844
2845         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2846         low_pc == 0.
2847
2848 2012-04-06  Ian Lance Taylor  <iant@google.com>
2849
2850         * timer.cc: #include <unistd.h>.
2851
2852 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2853
2854         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2855         * config.in: Regenerate.
2856         * configure: Regenerate.
2857
2858 2012-04-05  Nick Clifton  <nickc@redhat.com>
2859
2860         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2861         (AM_LC_MESSAGES): Add.
2862         * aclocal.m4: Regenerate.
2863         * config.in: Regenerate.
2864         * configure: Regenerate.
2865
2866 2012-03-21  Cary Coutant  <ccoutant@google.com>
2867
2868         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2869         * Makefile.in: Regenerate.
2870         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2871         (Sized_elf_reloc_mapper::symbol_section): New function.
2872         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2873         (make_elf_reloc_mapper): New function.
2874         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2875         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2876         (Dwarf_abbrev_table::do_get_abbrev): New function.
2877         (Dwarf_ranges_table::read_ranges_table): New function.
2878         (Dwarf_ranges_table::read_range_list): New function.
2879         (Dwarf_pubnames_table::read_section): New function.
2880         (Dwarf_pubnames_table::read_header): New function.
2881         (Dwarf_pubnames_table::next_name): New function.
2882         (Dwarf_die::Dwarf_die): New function.
2883         (Dwarf_die::read_attributes): New function.
2884         (Dwarf_die::skip_attributes): New function.
2885         (Dwarf_die::set_name): New function.
2886         (Dwarf_die::set_linkage_name): New function.
2887         (Dwarf_die::attribute): New function.
2888         (Dwarf_die::string_attribute): New function.
2889         (Dwarf_die::int_attribute): New function.
2890         (Dwarf_die::uint_attribute): New function.
2891         (Dwarf_die::ref_attribute): New function.
2892         (Dwarf_die::child_offset): New function.
2893         (Dwarf_die::sibling_offset): New function.
2894         (Dwarf_info_reader::check_buffer): New function.
2895         (Dwarf_info_reader::parse): New function.
2896         (Dwarf_info_reader::do_parse): New function.
2897         (Dwarf_info_reader::do_read_string_table): New function.
2898         (Dwarf_info_reader::lookup_reloc): New function.
2899         (Dwarf_info_reader::get_string): New function.
2900         (Dwarf_info_reader::visit_compilation_unit): New function.
2901         (Dwarf_info_reader::visit_type_unit): New function.
2902         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2903         Sized_elf_reloc_mapper.
2904         (Sized_dwarf_line_info::symbol_section): Remove function.
2905         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2906         (Sized_dwarf_line_info::read_line_mappings): Remove object
2907         parameter, adjust callers.
2908         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2909         * dwarf_reader.h: Include <sys/types.h>.
2910         (class Track_relocs): Remove forward declaration.
2911         (class Elf_reloc_mapper): New class.
2912         (class Sized_elf_reloc_mapper): New class.
2913         (class Dwarf_abbrev_table): New class.
2914         (class Dwarf_range_list): New class.
2915         (class Dwarf_ranges_table): New class.
2916         (class Dwarf_pubnames_table): New class.
2917         (class Dwarf_die): New class.
2918         (class Dwarf_info_reader): New class.
2919         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2920         (Sized_dwarf_line_info::symbol_section): Remove member function.
2921         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2922         base class.
2923         * gdb-index.cc: New source file.
2924         * gdb-index.h: New source file.
2925         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2926         and .debug_types sections, call Layout::add_to_gdb_index.
2927         (Sized_relobj_incr::do_section_name): Implement.
2928         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2929         return type; Implement.
2930         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2931         return type.
2932         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2933         parameter list and return type.
2934         (Sized_incr_dynobj::do_section_contents): Likewise.
2935         * layout.cc: Include gdb-index.h.
2936         (Layout::Layout): Initialize gdb_index_data_.
2937         (Layout::init_fixed_output_section): Check for .gdb_index section.
2938         (Layout::add_to_gdb_index): New function. Instantiate.
2939         * layout.h: Add forward declaration for class Gdb_index.
2940         (Layout::add_to_gdb_index): New member function.
2941         (Layout::gdb_index_data_): New data member.
2942         * main.cc: Include gdb-index.h.
2943         (main): Print statistics for gdb index.
2944         * object.cc (Object::section_contents): Move code into
2945         do_section_contents.
2946         (need_decompressed_section): Check for sections needed when building
2947         gdb index.
2948         (build_compressed_section_map): Likewise.
2949         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2950         gdb index.
2951         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2952         sections; call Layout::add_to_gdb_index.
2953         (Sized_relobj_file::do_decompressed_section_contents): Call
2954         do_section_contents directly.
2955         * object.h (Object::do_section_contents): Adjust parameter list and
2956         return type.
2957         (Object::do_decompressed_section_contents): Call do_section_contents
2958         directly.
2959         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2960         return type.
2961         * options.h (class General_options): Add --gdb-index option.
2962         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2963         list and return type.
2964         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2965         * reloc.h (Track_relocs::checkpoint): New function.
2966         (Track_relocs::reset): New function.
2967
2968         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2969         New test cases.
2970         * testsuite/Makefile.in: Regenerate.
2971         * testsuite/gdb_index_test.cc: New test source file.
2972         * testsuite/gdb_index_test_1.sh: New test source file.
2973         * testsuite/gdb_index_test_2.sh: New test source file.
2974
2975 2012-03-19  Doug Kwan  <dougkwan@google.com>
2976
2977         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2978         (Target_arm::do_finalize_sections): Remove code which defines
2979         __exidx_start and __exidx_end.  Make symbol table parameter
2980         anonymous as it is not used.
2981         * gold.cc (queue_middle_tasks): Call target hook to define any
2982         target-specific symbols.
2983         * target.h (Target::define_standard_symbols): New method.
2984         (Target::do_define_standard_symbols): Same.
2985         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2986         * testsuite/Makefile.in: Regenerate.
2987         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2988         and __exidx_end.
2989         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2990         relocations are generated for __exidx_start and __exidx_end.
2991
2992 2012-03-16  Doug Kwan  <dougkwan@google.com>
2993
2994         * testsuite/Makefile.am: Disable test initpri3b.
2995         * testsuite/Makefile.in: Regenerate.
2996
2997 2012-03-15  Doug Kwan  <dougkwan@google.com>
2998
2999         * arm.cc (Target_arm::got_section): Make .got section read-only
3000         if -z now is given.
3001
3002 2012-03-15  Ian Lance Taylor  <iant@google.com>
3003
3004         PR gold/13850
3005         * layout.cc (Layout::make_output_section): Correctly mark
3006         SHT_INIT_ARRAY, et. al., as relro.
3007
3008 2012-03-14  Doug Kwan  <dougkwan@google.com>
3009
3010         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3011         dynamic relocations for protected symbols in shared objects.
3012
3013 2012-03-13  Ian Lance Taylor  <iant@google.com>
3014
3015         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3016         keep the larger alignment.
3017
3018 2012-03-12  Cary Coutant  <ccoutant@google.com>
3019
3020         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3021         handling of DW_LNE_define_file.
3022
3023 2012-03-12  Cary Coutant  <ccoutant@google.com>
3024
3025         * reduced_debug_output.cc
3026         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3027         codes to switch.
3028
3029 2012-02-29  Cary Coutant  <ccoutant@google.com>
3030
3031         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3032
3033 2012-02-29  Cary Coutant  <ccoutant@google.com>
3034
3035         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3036         Call Object::decompressed_section_contents.
3037         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3038         New dtor.
3039         (Sized_dwarf_line_info::buffer_start_): New data member.
3040         * merge.cc (Output_merge_data::do_add_input_section): Call
3041         Object::decompressed_section_contents.
3042         (Output_merge_string::do_add_input_section): Likewise.
3043         * object.cc (need_decompressed_section): New function.
3044         (build_compressed_section_map): Decompress sections needed later.
3045         (Sized_relobj_file::do_decompressed_section_contents): New function.
3046         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3047         * object.h (Object::decompressed_section_contents): New function.
3048         (Object::discard_decompressed_sections): New function.
3049         (Object::do_decompressed_section_contents): New function.
3050         (Object::do_discard_decompressed_sections): New function.
3051         (Compressed_section_info): New type.
3052         (Compressed_section_map): Include decompressed section contents.
3053         (Sized_relobj_file::do_decompressed_section_contents): New function.
3054         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3055
3056 2012-02-16  Cary Coutant  <ccoutant@google.com>
3057
3058         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3059         * testsuite/Makefile.in: Regenerate.
3060
3061 2012-02-14  Cary Coutant  <ccoutant@google.com>
3062
3063         * options.cc (General_options::finalize): Disallow -pie and -static.
3064
3065 2012-02-03  Doug Kwan  <dougkwan@google.com>
3066
3067         * arm.cc (Arm_relocate_functions::abs8,
3068         Arm_relocate_functions::abs16): Use
3069         Bits::has_signed_unsigned_overflow32.
3070         (Arm_relocate_functions::thm_abs8): Correct range of
3071         overflow check.
3072         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3073         in assertions.
3074
3075 2012-02-02  Doug Kwan  <dougkwan@google.com>
3076
3077         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3078         position independent outputs, not just shared objects.
3079
3080 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3081
3082         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3083         * configure: Regenerated.
3084
3085 2012-01-27  Ian Lance Taylor  <iant@google.com>
3086
3087         * reloc.h (Bits): New class with static functions, copied from
3088         namespace utils in arm.cc.
3089         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3090         instead.
3091
3092 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3093
3094         * incremental.cc (write_info_blocks): Correct relocation offset.
3095
3096 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3097
3098         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3099         (Relocate::tls_gd_to_le): Likewise.
3100
3101 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3102
3103         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3104
3105 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3106
3107         * configure.ac: Check if -mcmodel=medium works.
3108         * configure: Regenerated.
3109
3110 2012-01-24  Cary Coutant  <ccoutant@google.com>
3111
3112         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3113         definition and ...
3114         (read_unsigned_LEB_128_x): ... this new function.
3115         (read_signed_LEB_128): Replaced with inline definition and ...
3116         (read_signed_LEB_128_x): ... this new function.
3117         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3118         (read_unsigned_LEB_128): Add inline definition.
3119         (read_signed_LEB_128_x): New function.
3120         (read_signed_LEB_128): Add inline definition.
3121         * testsuite/Makefile.am (leb128_unittest): New unit test.
3122         * testsuite/Makefile.in: Regenerate.
3123         * testsuite/leb128_unittest.cc: New unit test.
3124
3125 2012-01-23  Ian Lance Taylor  <iant@google.com>
3126
3127         PR gold/13617
3128         * i386.cc (Target_i386::do_code_fill): When using a jmp
3129         instruction, pad with nop instructions.
3130         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3131
3132 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3133
3134         * x86_64.cc (gc_process_relocs): Add typename on types used in
3135         template.
3136         (scan_relocs): Likewise.
3137         (relocate_section): Likewise.
3138         (apply_relocation): Likewise.
3139
3140 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3141
3142         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3143         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3144         under x32.
3145
3146 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3147
3148         * x86_64.cc: Initial support for x32.
3149
3150 2012-01-03  Cary Coutant  <ccoutant@google.com>
3151
3152         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3153         Use abstract base class for GOT.
3154         * gold/output.h (class Output_data_got_base): New abstract base class.
3155         (class Output_data_got): Derive from new base class, adjust ctors.
3156         (Output_data_got::reserve_slot): Make virtual; rename to
3157         do_reserve_slot; Adjust callers.
3158         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3159         pointer to abstract base class.
3160         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3161
3162 2011-12-18  Ian Lance Taylor  <iant@google.com>
3163
3164         * object.h (Relobj::local_symbol_value): New function.
3165         (Relobj::local_plt_offset): New function.
3166         (Relobj::local_has_got_offset): New function.
3167         (Relobj::local_got_offset): New function.
3168         (Relobj::set_local_got_offset): New function.
3169         (Relobj::do_local_symbol_value): New pure virtual function.
3170         (Relobj::do_local_plt_offset): Likewise.
3171         (Relobj::do_local_has_got_offset): Likewise.
3172         (Relobj::do_local_got_offset): Likewise.
3173         (Relobj::do_set_local_got_offset): Likewise.
3174         (Sized_relobj::do_local_has_got_offset): Rename from
3175         local_has_got_offset.
3176         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3177         (Sized_relobj::do_set_local_got_offset): Rename from
3178         set_local_got_offset.
3179         (Sized_relobj_file::do_local_plt_offset): Rename from
3180         local_plt_offset.
3181         (Sized_relobj_file::do_local_symbol_value): New function.
3182         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3183         local_plt_offset.
3184         * output.cc (Output_data_got::Got_entry::write): Change object to
3185         Relobj.  Use local_symbol_value.
3186         (Output_data_got::add_global_with_rel): Change rel_dyn to
3187         Output_data_reloc_generic*.  Use add_global_generic.
3188         (Output_data_got::add_global_with_rela): Remove.  Change all
3189         callers to use add_global_with_rel.
3190         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3191         Output_data_reloc_generic*.  Use add_global_generic.
3192         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3193         callers to use add_global_pair_with_rel.
3194         (Output_data_got::add_local): Change object to Relobj*.
3195         (Output_data_got::add_local_plt): Likewise.
3196         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3197         change rel_dyn to Output_data_reloc_generic*.  Use
3198         add_local_generic.
3199         (Output_data_got::add_local_with_rela): Remove.  Change all
3200         callers to use all_local_with_rel.
3201         (Output_data_got::add_local_pair_with_rel): Change object to
3202         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3203         add_output_section_generic.
3204         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3205         callers to use add_local_pair_with_rel.
3206         (Output_data_got::reserve_local): Change object to Relobj*.
3207         * output.h: (class Output_data_reloc_generic): Add pure virtual
3208         declarations for add_global_generic, add_local_generic,
3209         add_output_section_generic.
3210         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3211         functions for Output_data_reloc_generic.  Update declarations for
3212         changes listed in output.cc.
3213         (class Output_data_got): Change template parameter to got_size.
3214         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3215         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3216         function.
3217         (Sized_relobj_incr::do_local_plt_offset): New function.
3218         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3219         add_global_generic.
3220
3221 2011-12-17  Cary Coutant  <ccoutant@google.com>
3222
3223         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3224         * resolve.cc (Symbol_table::resolve): Likewise.
3225         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3226         arrays.
3227         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3228
3229 2011-12-16  Ian Lance Taylor  <iant@google.com>
3230
3231         * output.h (Output_data_reloc_generic::add): Only call
3232         add_dynamic_reloc if this is a dynamic reloc section.
3233
3234 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3235
3236         PR gold/13505
3237         * target-reloc.h (apply_relocation): Replace <64, false> with
3238         <size, big_endian>.
3239
3240 2011-11-25  Nick Clifton  <nickc@redhat.com>
3241
3242         * po/it.po: New Italian translation.
3243
3244 2011-11-17  Sterling Augustine  <saugustine@google.com>
3245
3246         * script.cc (script_include_directive): Implement.
3247         (read_script_file): New local variables name and search_path. Update
3248         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3249         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3250         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3251
3252 2011-11-11  Sterling Augustine  <saugustine@google.com>
3253
3254         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3255         (file_or_sections_cmd): Likewise.
3256
3257 2011-11-11  Doug Kwan  <dougkwan@google.com>
3258
3259         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3260         if --just-symbols is given.
3261
3262 2011-11-10  Doug Kwan  <dougkwan@google.com>
3263
3264         PR gold/13362
3265         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3266         when processing data relocs.
3267         * reloc.h (Relocate_functions::rel_unaligned): New method.
3268         (Relocate_functions::pcrel_unaligned): Ditto.
3269         (Relocate_functions::rel32_unaligned): Ditto.
3270         (Relocate_functions::pcrel32_unaligned): Ditto.
3271
3272 2011-11-09  Doug Kwan  <dougkwan@google.com>
3273
3274         PR gold/13362
3275         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3276         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3277         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3278         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3279         (Relocate_functions::rel_unaligned): New.
3280         (Relocate_functions::rel32_unaligned): New.
3281         * target-reloc.h (relocate_for_relocatable): Add code to handle
3282         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3283         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3284         arm_unaligned_reloc_r): New targets.
3285         * testsuite/Makefile.in: Regenerate.
3286         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3287         linking.
3288
3289 2011-11-02  Ian Lance Taylor  <iant@google.com>
3290
3291         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3292         NATIVE_LINKER.
3293         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3294         * options.cc (General_options::finalize): Use library search path
3295         from configure script if specified.  If not native and no sysroot,
3296         only search TOOLLIBDIR.
3297         * options.h (Search_directory::Search_directory): Change name to
3298         const std::string&.
3299         (General_options::add_to_library_path_with_sysroot): Change arg to
3300         const std::string&.
3301         * configure, Makefile.in, config.in: Rebuild.
3302
3303 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3304
3305         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3306         we are working around the ARM1176 Erratum.
3307         * options.h (General_options::fix_arm1176): Add option.
3308         * testsuite/Makefile.am: Add testcases, and keep current ones
3309         working.
3310         * testsuite/Makefile.in: Regenerate.
3311         * testsuite/arm_fix_1176.s: New file.
3312         * testsuite/arm_fix_1176.sh: Likewise.
3313
3314 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3315
3316         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3317         may_use_blx_.
3318         (Target_arm::may_use_blx): Remove method.
3319         (Target_arm::set_may_use_blx): Likewise.
3320         (Target_arm::may_use_v4t_interworking): New method.
3321         (Target_arm::may_use_v5t_interworking): Likewise.
3322         (Target_arm::may_use_blx_): Remove member variable.
3323         (Arm_relocate_functions::arm_branch_common): Check for v5T
3324         interworking.
3325         (Arm_relocate_functions::thumb_branch_common): Likewise.
3326         (Reloc_stub::stub_type_for_reloc): Likewise.
3327         (Target_arm::do_finalize_sections): Correct interworking checks.
3328         * testsuite/Makefile.am: Add new tests.
3329         * testsuite/Makefile.in: Regenerate.
3330         * testsuite/arm_farcall_arm_arm.s: New test.
3331         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3332         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3333         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3334         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3335         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3336         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3337         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3338
3339 2011-10-31  Cary Coutant  <ccoutant@google.com>
3340
3341         PR gold/13023
3342         * expression.cc (Expression::eval_with_dot): Add
3343         is_section_dot_assignment parameter.
3344         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3345         absolute and assigning to dot within a section.
3346         * script-sections.cc
3347         (Output_section_element_assignment::set_section_addresses): Pass
3348         dot_section to set_if_absolute.
3349         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3350         as is_section_dot_assignment flag to eval_with_dot.
3351         (Output_section_element_dot_assignment::set_section_addresses):
3352         Likewise.
3353         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3354         parameter.  Also set value if relative to dot_section; set the
3355         symbol's output_section.
3356         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3357         parameter.  Adjust all callers.
3358         (Expression::eval_maybe_dot): Likewise.
3359         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3360         Adjust all callers.
3361         * testsuite/script_test_2.t: Test assignment of an absolute value
3362         to dot within an output section element.
3363
3364 2011-10-31  Cary Coutant  <ccoutant@google.com>
3365
3366         * options.h (class General_options): Add --[no-]gnu-unique options.
3367         * symtab.cc (Symbol_table::sized_write_globals): Convert
3368         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3369
3370 2011-10-31  Cary Coutant  <ccoutant@google.com>
3371
3372         PR gold/13359
3373         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3374         unnecessary assertion.
3375         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3376
3377 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3378
3379         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3380         gc_mark_symbol.
3381         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3382         gc_mark_symbol.
3383         Change to just keep the section associated with symbol.
3384         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3385         they are externally visible and --export-dynamic is turned on.
3386         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3387
3388 2011-10-19  Ian Lance Taylor  <iant@google.com>
3389
3390         PR gold/13163
3391         * script-sections.cc
3392         (Output_section_element_dot_assignment::needs_output_section): New
3393         function.
3394
3395 2011-10-19  Ian Lance Taylor  <iant@google.com>
3396
3397         PR gold/13204
3398         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3399         --section-start option was seen.
3400         * options.h (General_options::any_section_start): New function.
3401
3402 2011-10-18  David S. Miller  <davem@davemloft.net>
3403
3404         PR binutils/13301
3405         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3406         member to track relocation locations that have moved during TLS
3407         reloc optimizations.
3408         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3409         (Target_sparc::Relocate::relocate): Adjust view down by 4
3410         bytes if it matches reloc_adjust_addr_.
3411         (Target_sparc::Relocate::relocate_tls): Always move the
3412         __tls_get_addr call delay slot instruction forward 4 bytes when
3413         performing relaxation.
3414
3415 2011-10-18  Cary Coutant  <ccoutant@google.com>
3416
3417         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3418         (Output_file::map_no_anonymous): Check for non-zero
3419         return code from posix_fallocate.
3420
3421 2011-10-17  Cary Coutant  <ccoutant@google.com>
3422
3423         PR gold/13245
3424         * plugin.cc (is_visible_from_outside): Check for symbols
3425         referenced from dynamic objects.
3426         * resolve.cc (Symbol_table::resolve): Don't count references
3427         from dynamic objects as references from real ELF files.
3428         * testsuite/plugin_test_2.sh: Adjust expected result.
3429
3430 2011-10-17  Cary Coutant  <ccoutant@google.com>
3431
3432         * gold.cc: Include timer.h.
3433         (queue_middle_tasks): Stamp time.
3434         (queue_final_tasks): Likewise.
3435         * main.cc (main): Store timer in parameters.  Print timers
3436         for each pass.
3437         * parameters.cc (Parameters::Parameters): Initialize timer_.
3438         (Parameters::set_timer): New function.
3439         (set_parameters_timer): New function.
3440         * parameters.h (Parameters::set_timer): New function.
3441         (Parameters::timer): New function.
3442         (Parameters::timer_): New data member.
3443         (set_parameters_timer): New function.
3444         * timer.cc (Timer::stamp): New function.
3445         (Timer::get_pass_time): New function.
3446         * timer.h (Timer::stamp): New function.
3447         (Timer::get_pass_time): New function.
3448         (Timer::pass_times_): New data member.
3449
3450 2011-10-17  Cary Coutant  <ccoutant@google.com>
3451
3452         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3453         task for members of lib groups.
3454
3455 2011-10-17  Cary Coutant  <ccoutant@google.com>
3456
3457         PR gold/13288
3458         * fileread.cc (File_read::find_view): Add assert.
3459         (File_read::make_view): Move bounds check (replace with assert)...
3460         (File_read::find_or_make_view): ... to here.
3461
3462 2011-10-12  Cary Coutant  <ccoutant@google.com>
3463
3464         * output.cc (Output_file::open_base_file): Handle case where
3465         ::read returns less than requested size.
3466
3467 2011-10-10  Cary Coutant  <ccoutant@google.com>
3468
3469         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3470         Initialize defined_count_.
3471         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3472         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3473         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3474         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3475         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3476         * incremental.h (Sized_relobj_incr::defined_count_): New data
3477         member.
3478         (Sized_incr_dynobj::defined_count_): New data member.
3479         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3480         Return zeroes instead of internal error.
3481
3482 2011-10-10  Cary Coutant  <ccoutant@google.com>
3483
3484         PR gold/13249
3485         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3486         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3487         * output.h (class Output_reloc): Add use_plt_offset flag.
3488         (Output_reloc::type_): Adjust size of bit field.
3489         (Output_reloc::use_plt_offset_): New bit field.
3490         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3491         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3492         flag.  Adjust all callers.
3493         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3494         creating RELATIVE relocations.
3495
3496 2011-10-10  Nick Clifton  <nickc@redhat.com>
3497
3498         * po/es.po: Updated Spanish translation.
3499         * po/fi.po: Updated Finnish translation.
3500
3501 2011-10-03   Diego Novillo  <dnovillo@google.com>
3502
3503         * options.cc (parse_uint): Fix dereference of RETVAL.
3504
3505 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3506
3507         * layout.h (section_order_map_): New member.
3508         (get_section_order_map): New member function.
3509         * output.cc (Output_section::add_input_section): Check for patterns
3510         only when --section-ordering-file is specified.
3511         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3512         output_sections have been formed.
3513         * layout.cc (Layout_Layout): Initialize section_order_map_.
3514         * plugin.cc (update_section_order): Store order in order_map. Do not
3515         update the order.
3516         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3517         * testsuite/Makefile.in: Regenerate.
3518         * testsuite/plugin_section_order.c: New file.
3519         * testsuite/plugin_final_layout.cc: New file.
3520         * testsuite/plugin_final_layout.sh: New file.
3521
3522 2011-09-29  Cary Coutant  <ccoutant@google.com>
3523
3524         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3525         Check for NULL.
3526         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3527         symbols during incremental update.
3528         (Symbol_table::add_from_dynobj): Likewise.
3529
3530 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3531             Ian Lance Taylor  <iant@google.com>
3532
3533         * symtab.cc (Symbol_table::define_special_symbol): Always
3534         canonicalize version string.
3535
3536 2011-09-26  Cary Coutant  <ccoutant@google.com>
3537
3538         * gold.cc (queue_initial_tasks): Move option checks ...
3539         * options.cc (General_options::finalize): ... to here. Disable
3540         some options; make others fatal.
3541
3542 2011-09-26  Cary Coutant  <ccoutant@google.com>
3543
3544         gcc PR lto/47247
3545         * plugin.cc (get_symbols_v2): New function.
3546         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3547         (is_referenced_from_outside): New function.
3548         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3549         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3550         (get_symbols): Pass version parameter.
3551         (get_symbols_v2): New function.
3552         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3553         parameter.
3554         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3555         (onload): Add LDPT_GET_SYMBOLS_V2.
3556         (all_symbols_read_hook): Use get_symbols_v2; check for
3557         LDPR_PREVAILING_DEF_IRONLY_EXP.
3558         * testsuite/plugin_test_3.sh: Update expected results.
3559
3560 2011-09-23  Simon Baldwin  <simonb@google.com>
3561
3562         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3563         configuration options.
3564         * configure: Regenerate.
3565         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3566         * Makefile.in: Regenerate.
3567         * testsuite/Makefile.in: Regenerate.
3568
3569 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3570
3571         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3572
3573 2011-09-19  Cary Coutant  <ccoutant@google.com>
3574
3575         * incremental.cc (can_incremental_update): Fix typo in comment.
3576         * incremental.h (can_incremental_update): Likewise.
3577
3578 2011-09-18  Cary Coutant  <ccoutant@google.com>
3579
3580         * incremental.cc (can_incremental_update): New function.
3581         * incremental.h (can_incremental_update): New function.
3582         * layout.cc (Layout::init_fixed_output_section): Call it.
3583         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3584         * object.cc (Sized_relobj_file::do_layout): Call
3585         can_incremental_update.
3586
3587 2011-09-13  Cary Coutant  <ccoutant@google.com>
3588
3589         * configure.ac: Check for glibc support for gnu_indirect_function
3590         support with static linking, setting automake conditional
3591         IFUNC_STATIC.
3592         * Makefile.in: Regenerate.
3593         * configure: Regenerate.
3594
3595         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3596         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3597         for IFUNC_STATIC.
3598         * testsuite/Makefile.in: Regenerate.
3599
3600 2011-09-13  Cary Coutant  <ccoutant@google.com>
3601
3602         * incremental.cc (Sized_relobj_incr::do_layout): Call
3603         report_comdat_group for kept comdat sections.
3604         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3605         * testsuite/Makefile.in: Regenerate.
3606         * testsuite/incr_comdat_test_1.cc: New source file.
3607         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3608         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3609         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3610
3611 2011-09-13  Ian Lance Taylor  <iant@google.com>
3612
3613         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3614         variable external_symbols_offset.
3615
3616 2011-09-12  Ian Lance Taylor  <iant@google.com>
3617
3618         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3619         triggered if object has no symbols.
3620
3621 2011-09-09  David S. Miller  <davem@davemloft.net>
3622
3623         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3624         (Output_fill_debug_line::do_write): Likewise.
3625
3626 2011-08-29  Cary Coutant  <ccoutant@google.com>
3627
3628         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3629         casts to match formatting specs.
3630         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3631
3632 2011-08-26  Cary Coutant  <ccoutant@google.com>
3633
3634         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3635         remaining hole size when allocating.
3636         (Layout::make_output_section): Set fill methods for debug sections.
3637         * layout.h (Free_list::Free_list_node): Move from private to
3638         public.
3639         (Free_list::set_min_hole_size): New function.
3640         (Free_list::begin, Free_list::end): New functions.
3641         (Free_list::min_hole_): New data member.
3642         * output.cc: Include dwarf.h.
3643         (Output_fill_debug_info::do_minimum_hole_size): New function.
3644         (Output_fill_debug_info::do_write): New function.
3645         (Output_fill_debug_line::do_minimum_hole_size): New function.
3646         (Output_fill_debug_line::do_write): New function.
3647         (Output_section::Output_section): Initialize new data member.
3648         (Output_section::set_final_data_size): Ensure patch space is larger
3649         than minimum hole size.
3650         (Output_section::do_write): Fill holes in debug sections.
3651         * output.h (Output_fill): New class.
3652         (Output_fill_debug_info): New class.
3653         (Output_fill_debug_line): New class.
3654         (Output_section::set_free_space_fill): New function.
3655         (Output_section::free_space_fill_): New data member.
3656         * testsuite/Makefile.am (incremental_test_3): Add
3657         --incremental-patch option.
3658         (incremental_test_4): Likewise.
3659         (incremental_test_5): Likewise.
3660         (incremental_test_6): Likewise.
3661         (incremental_copy_test): Likewise.
3662         (incremental_common_test_1): Likewise.
3663         * testsuite/Makefile.in: Regenerate.
3664
3665 2011-08-26  Nick Clifton  <nickc@redhat.com>
3666
3667         * po/es.po: Updated Spanish translation.
3668
3669 2011-08-01  Cary Coutant  <ccoutant@google.com>
3670
3671         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3672         * gold/testsuite/Makefile.in: Regenerate.
3673         * gold/testsuite/justsyms_exec.c: New source file.
3674         * gold/testsuite/justsyms_lib.c: New source file.
3675
3676 2011-08-01  Cary Coutant  <ccoutant@google.com>
3677
3678         * layout.cc (Layout::set_segment_offsets): Don't realign text
3679         segment if -Ttext was specified.
3680         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3681         file type.
3682         * object.h (Sized_relobj_file::e_type): New function.
3683         (Sized_relobj_file::e_type_): New data member.
3684         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3685         base address for ET_EXEC files.
3686         * target.cc (Target::do_make_elf_object_implementation): Allow
3687         ET_EXEC files with --just-symbols option.
3688
3689 2011-07-28  Cary Coutant  <ccoutant@google.com>
3690
3691         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3692         Add thread_number parameter.
3693         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3694         * workqueue-threads.cc
3695         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3696         current thread if its thread number is greater than desired thread
3697         count.
3698         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3699         Add thread_number parameter.
3700         (Workqueue::should_cancel_thread): Likewise.
3701         (Workqueue::find_runnable_or_wait): Pass thread_number to
3702         should_cancel_thread.
3703         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3704         parameter.
3705
3706 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3707
3708         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3709         only after checking if it cannot be forced local.
3710         * symtab.h (is_externally_visible): Check if the symbol is not forced
3711         local.
3712
3713 2011-07-15  Ian Lance Taylor  <iant@google.com>
3714
3715         * options.h (class General_options): Add --print-output-format.
3716         Move -EL next to -EB, for  better --help output.
3717         * target-select.cc: Include <cstdio>, "options.h", and
3718         "parameters.h".
3719         (Target_selector::do_target_bfd_name): New function.
3720         (print_output_format): New function.
3721         * target-select.h (class Target_selector): Update declarations.
3722         (Target_selector::target_bfd_name): New function.
3723         (print_output_format): Declare.
3724         * main.cc: Include "target-select.h".
3725         (main): Handle --print-output-format.
3726         * gold.cc: Include "target-select.h".
3727         (queue_initial_tasks): Handle --print-output-format when there are
3728         no input files.
3729         * parameters.cc (parameters_force_valid_target): Give a better
3730         error message if -EB/-EL does not match target.
3731         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3732         function.
3733
3734 2011-07-15  Ian Lance Taylor  <iant@google.com>
3735
3736         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3737         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3738         (Output_data_plt_i386::do_write): Write address of .dynamic
3739         section to first entry in .got.plt section.
3740         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3741         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3742         Initialize layout_.
3743         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3744         section to first entry in .got.plt section.
3745         * layout.h (Layout::dynamic_section): New function.
3746
3747 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3748
3749         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3750         to claim_file call.
3751         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3752         input_section_position_, and input_section_glob_.
3753         (read_layout_from_file): Call function section_ordering_specified.
3754         * layout.h (is_section_ordering_specified): New function.
3755         (section_ordering_specified): New function.
3756         (section_ordering_specified_): New boolean member.
3757         * main.cc(main): Call load_plugins after layout object is defined.
3758         * output.cc (Output_section::add_input_section): Use
3759         function section_ordering_specified to check if section ordering is
3760         needed.
3761         * output.cc (Output_section::add_relaxed_input_section): Use
3762         function section_ordering_specified to check if section ordering is
3763         needed.
3764         (Output_section::update_section_layout): New function.
3765         (Output_section::sort_attached_input_sections): Check if input section
3766         must be reordered.
3767         * output.h (Output_section::update_section_layout): New function.
3768         * plugin.cc (get_section_count): New function.
3769         (get_section_type): New function.
3770         (get_section_name): New function.
3771         (get_section_contents): New function.
3772         (update_section_order): New function.
3773         (allow_section_ordering): New function.
3774         (Plugin::load): Add the new interfaces to the transfer vector.
3775         (Plugin_manager::load_plugins): New parameter.
3776         (Plugin_manager::all_symbols_read): New parameter.
3777         (Plugin_manager::claim_file): New parameter. Save the elf object for
3778         unclaimed objects.
3779         (Plugin_manager::get_elf_object): New function.
3780         (Plugin_manager::get_view): Change to directly use the bool to check
3781         if get_view is called from claim_file_hook.
3782         * plugin.h (input_objects): New function
3783         (Plugin__manager::load_plugins): New parameter.
3784         (Plugin_manager::claim_file): New parameter.
3785         (Plugin_manager::get_elf_object): New function.
3786         (Plugin_manager::in_claim_file_handler): New function.
3787         (Plugin_manager::in_claim_file_handler_): New member.
3788         (layout): New function.
3789         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3790         handler with an extra parameter. Make the elf object before calling
3791         claim_file handler.
3792         * testsuite/plugin_test.c (get_section_count): New function pointer.
3793         (get_section_type): New function pointer.
3794         (get_section_name): New function pointer.
3795         (get_section_contents): New function pointer.
3796         (update_section_order): New function pointer.
3797         (allow_section_ordering): New function pointer.
3798         (onload): Check if the new interfaces exist.
3799
3800 2011-07-13  Ian Lance Taylor  <iant@google.com>
3801
3802         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3803         relro section.
3804         * x86_64.cc (Target_x86_64::got_section): Likewise.
3805         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3806         (relro_now_test_SOURCES): New variable.
3807         (relro_now_test_DEPENDENCIES): New variable.
3808         (relro_now_test_LDFLAGS): New variable.
3809         (relro_now_test_LDADD): New variable.
3810         (relro_now_test.so): New target.
3811         * testsuite/Makefile.in: Rebuild.
3812
3813 2011-07-12  Ian Lance Taylor  <iant@google.com>
3814
3815         PR gold/12980
3816         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3817         GLOB_DAT relocation rather than a RELATIVE relocation for a
3818         protected symbol when creating a shared library.
3819         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3820         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3821         * testsuite/protected_main_1.cc (main): Test that protected
3822         function has same address.
3823
3824 2011-07-11  Ian Lance Taylor  <iant@google.com>
3825
3826         PR gold/12979
3827         * options.h (class General_options): Add -Bgroup.
3828         * options.cc (General_options::finalize): If -Bgroup is set,
3829         default to --unresolved-symbols=report-all.
3830         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3831         * target-reloc.h (issue_undefined_symbol_error): Handle
3832         --unresolved-symbols=report-all.
3833
3834 2011-07-08  Ian Lance Taylor  <iant@google.com>
3835
3836         PR gold/11985
3837         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3838         if linker script discards key sections.
3839         (Layout::create_dynamic_symtab): Likewise.
3840         (Layout::assign_local_dynsym_offsets): Likewise.
3841         (Layout::sized_create_version_sections): Likewise.
3842         (Layout::create_interp): Likewise.
3843         (Layout::finish_dynamic_section): Likewise.
3844         (Layout::set_dynamic_symbol_size): Likewise.
3845
3846 2011-07-08  Ian Lance Taylor  <iant@google.com>
3847
3848         PR gold/12386
3849         * options.h (class General_options): Add --unresolved-symbols.
3850         * target-reloc.h (issue_undefined_symbol_error): Check
3851         --unresolved-symbols.  Add comments.
3852
3853 2011-07-08  Ian Lance Taylor  <iant@google.com>
3854
3855         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3856         expression more complex.
3857
3858 2011-07-08  Ian Lance Taylor  <iant@google.com>
3859
3860         PR gold/11317
3861         * target-reloc.h (issue_undefined_symbol_error): New inline
3862         function, broken out of relocate_section.
3863         (relocate_section): Call issue_undefined_symbol_error.
3864         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3865         there is no TLS segment if we are about to issue an undefined
3866         symbol error.
3867         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3868
3869 2011-07-08  Ian Lance Taylor  <iant@google.com>
3870
3871         PR gold/12279
3872         * resolve.cc (Symbol_table::should_override): Add fromtype
3873         parameter.  Change all callers.  Give error when linking together
3874         TLS and non-TLS symbol.
3875         (Symbol_table::should_override_with_special): Add fromtype
3876         parameter.  Change all callers.
3877         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3878         there is no TLS segment if we have reported some errors.
3879         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3880
3881 2011-07-08  Ian Lance Taylor  <iant@google.com>
3882
3883         PR gold/12372
3884         * target.h (Target::plt_address_for_global): New function.
3885         (Target::plt_address_for_local): New function.
3886         (Target::plt_section_for_global): Remove.
3887         (Target::plt_section_for_local): Remove.
3888         (Target::do_plt_address_for_global): New virtual function.
3889         (Target::do_plt_address_for_local): New virtual function.
3890         (Target::do_plt_section_for_global): Remove.
3891         (Target::do_plt_section_for_local): Remove.
3892         (Target::register_global_plt_entry): Add Symbol_table and Layout
3893         parameters.
3894         * output.cc (Output_data_got::Got_entry::write): Use
3895         plt_address_for_global and plt_address_for_local.
3896         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3897         address of output section.
3898         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3899         got_irelative_, and irelative_count_ fields.  Update
3900         declarations.
3901         (Output_data_plt_i386::has_irelative_section): New function.
3902         (Output_data_plt_i386::entry_count): Add irelative_count_.
3903         (Output_data_plt_i386::set_final_data_size): Likewise.
3904         (class Target_i386): Add got_irelative_ and rel_irelative_
3905         fields.  Update declarations.
3906         (Target_i386::Target_i386): Initialize new fields.
3907         (Target_i386::do_plt_address_for_global): New function replacing
3908         do_plt_section_for_global.
3909         (Target_i386::do_plt_address_for_local): New function replacing
3910         do_plt_section_for_local.
3911         (Target_i386::got_section): Create got_irelative_.
3912         (Target_i386::rel_irelative_section): New function.
3913         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3914         fields.  Don't define __rel_iplt_{start,end}.
3915         (Output_data_plt_i386::add_entry): Add symtab and layout
3916         parameters.  Change all callers.  Use different PLT and GOT for
3917         IFUNC symbols.
3918         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3919         layout parameters.  Change all callers.  Use different PLT and
3920         GOT.
3921         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3922         (Output_data_plt_i386::rel_irelative): New function.
3923         (Output_data_plt_i386::address_for_global): New function.
3924         (Output_data_plt_i386::address_for_local): New function.
3925         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3926         IRELATIVE GOT when changing IFUNC GOT entries.
3927         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3928         reloc.
3929         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3930         if we didn't create an IRELATIVE GOT.
3931         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3932         plt_address_for_local.
3933         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3934         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3935         got_irelative_, and irelative_count_ fields.  Update
3936         declarations.
3937         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3938         Initialize new fields.  Remove symtab parameter.  Change all
3939         callers.
3940         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3941         irelative_count_.
3942         (Output_data_plt_x86_64::has_irelative_section): New function.
3943         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3944         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3945         fields.  Update declarations.
3946         (Target_x86_64::Target_x86_64): Initialize new fields.
3947         (Target_x86_64::do_plt_address_for_global): New function replacing
3948         do_plt_section_for_global.
3949         (Target_x86_64::do_plt_address_for_local): New function replacing
3950         do_plt_section_for_local.
3951         (Target_x86_64::got_section): Create got_irelative_.
3952         (Target_x86_64::rela_irelative_section): New function.
3953         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3954         all callers.  Don't create __rel_iplt_{start,end}.
3955         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3956         parameters.  Change all callers.  Use different PLT and GOT for
3957         IFUNC symbols.
3958         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3959         layout parameters.  Change all callers.  Use different PLT and
3960         GOT.
3961         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3962         parameters.  Change all callers.  Use different PLT and GOT for
3963         IFUNC symbols.
3964         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3965         (Output_data_plt_x86_64::rela_irelative): New function.
3966         (Output_data_plt_x86_64::address_for_global): New function.
3967         (Output_data_plt_x86_64::address_for_local): New function.
3968         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3969         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3970         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3971         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3972         parameters.
3973         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3974         reloc.
3975         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3976         symbols if we didn't create an IRELATIVE GOT.
3977         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3978         plt_address_for_local.
3979         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3980         * testsuite/ifuncvar1.c: New test file.
3981         * testsuite/ifuncvar2.c: New test file.
3982         * testsuite/ifuncvar3.c: New test file.
3983         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3984         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3985         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3986         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3987         * testsuite/Makefile.in: Rebuild.
3988
3989 2011-07-07  Cary Coutant  <ccoutant@google.com>
3990
3991         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3992         (two_file_test_1_ndebug.o): Likewise.
3993         (two_file_test_1b_ndebug.o): Likewise.
3994         (two_file_test_2_ndebug.o): Likewise.
3995         (two_file_test_main_ndebug.o): Likewise.
3996         (incremental_test_2): Link with no-debug versions.
3997
3998 2011-07-06  Cary Coutant  <ccoutant@google.com>
3999
4000         * gold/incremental.cc
4001         (Output_section_incremental_inputs::write_info_blocks): Check for
4002         hidden and internal symbols.
4003
4004 2011-07-06  Cary Coutant  <ccoutant@google.com>
4005
4006         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4007         Check disposition for startup file.
4008         (Incremental_inputs::report_command_line): Ignore
4009         --incremental-startup-unchanged option.
4010         * options.cc (General_options::parse_incremental_startup_unchanged):
4011         New function.
4012         (General_options::General_options): Initialize new data member.
4013         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4014         (General_options): Add --incremental-startup-unchanged option.
4015         (General_options::incremental_startup_disposition): New function.
4016         (General_options::incremental_startup_disposition_): New data member.
4017
4018 2011-07-06  Cary Coutant  <ccoutant@google.com>
4019
4020         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4021         input file index to Script_info ctor.
4022         (Sized_incremental_binary::do_file_has_changed): Find the
4023         command-line argument for files named in scripts.
4024         * incremental.h (Script_info::Script_info): New ctor
4025         with input file index.
4026         (Script_info::input_file_index): New function.
4027         (Script_info::input_file_index_): New data member.
4028         (Incremental_binary::get_library): Add const.
4029         (Incremental_binary::get_script_info): Add const.
4030         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4031         * testsuite/Makefile.am (incremental_test_5): New test case.
4032         (incremental_test_6): New test case.
4033         * testsuite/Makefile.in: Regenerate.
4034
4035 2011-07-06  Cary Coutant  <ccoutant@google.com>
4036
4037         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4038         debug output when command lines differ.
4039
4040 2011-07-06  Cary Coutant  <ccoutant@google.com>
4041
4042         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4043         --incremental-patch option.
4044         * layout.cc (Free_list::allocate): Extend allocation beyond original
4045         end if enabled.
4046         (Layout::make_output_section): Mark sections that should get
4047         patch space.
4048         * options.cc (parse_percent): New function.
4049         * options.h (parse_percent): New function.
4050         (DEFINE_percent): New macro.
4051         (General_options): Add --incremental-patch option.
4052         * output.cc (Output_section::Output_section): Initialize new data
4053         members.
4054         (Output_section::add_input_section): Print section name when out
4055         of patch space.
4056         (Output_section::add_output_section_data): Likewise.
4057         (Output_section::set_final_data_size): Add patch space when
4058         doing --incremental-full.
4059         (Output_section::do_reset_address_and_file_offset): Remove patch
4060         space.
4061         (Output_segment::set_section_list_addresses): Print debug output
4062         only if --incremental-update.
4063         * output.h (Output_section::set_is_patch_space_allowed): New function.
4064         (Output_section::is_patch_space_allowed_): New data member.
4065         (Output_section::patch_space_): New data member.
4066         * parameters.cc (Parameters::incremental_full): New function.
4067         * parameters.h (Parameters::incremental_full): New function
4068         * testsuite/Makefile.am (incremental_test_2): Add test for
4069         --incremental-patch option.
4070         * testsuite/Makefile.in: Regenerate.
4071         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4072         (t18): Remove function body.
4073
4074 2011-07-05  Doug Kwan  <dougkwan@google.com>
4075
4076         PR gold/12771
4077         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4078         Arm_Address type for relocation result.
4079         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4080         overflow check.
4081         (Arm_relocate_functions::abs32): Use unaligned access.
4082         (Arm_relocate_functions::rel32): Ditto.
4083         (Arm_relocate_functions::prel31): Ditto.
4084         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4085         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4086         static data relocations.
4087         * testsuite/Makefile.in: Regnerate.
4088         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4089
4090 2011-07-05  Ian Lance Taylor  <iant@google.com>
4091
4092         PR gold/12392
4093         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4094         symbols if necessary.
4095         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4096
4097 2011-07-05  Ian Lance Taylor  <iant@google.com>
4098
4099         PR gold/12952
4100         * resolve.cc (Symbol::override_base_with_special): Simply override
4101         version with special symbol version, ignoring previous version.
4102
4103 2011-07-05  Ian Lance Taylor  <iant@google.com>
4104
4105         * object.cc (Sized_relobj_file::include_section_group): Add
4106         information to comment about signature location.
4107
4108 2011-07-02  Ian Lance Taylor  <iant@google.com>
4109
4110         PR gold/12957
4111         * options.h (class General_options): Add -f and -F.
4112         * options.cc (General_options::finalize): Fatal error if -f/-F
4113         are used without -shared.
4114         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4115
4116 2011-07-02  Ian Lance Taylor  <iant@google.com>
4117
4118         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4119
4120 2011-07-01  Ian Lance Taylor  <iant@google.com>
4121
4122         PR gold/12525
4123         PR gold/12952
4124         * resolve.cc (Symbol::override_base_with_special): Don't override
4125         the version if the overriding symbol has a different name.
4126         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4127         all callers.  If we give an error about an undefined version,
4128         define the base version if necessary.
4129         * dynobj.h (class Versions): Update declaration.
4130         * testsuite/weak_alias_test_5.cc: New file.
4131         * testsuite/weak_alias_test.script: New file.
4132         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4133         and versioned_alias have the right value, and call t2.
4134         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4135         weak_alias_test_5.so.
4136         (weak_alias_test_LDADD): Likewise.
4137         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4138         * testsuite/Makefile.in: Rebuild.
4139
4140 2011-07-01  Ian Lance Taylor  <iant@google.com>
4141
4142         PR gold/12525
4143         * options.h (class General_options): Support -z notext.
4144         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4145         -Wl,-z,notext.
4146         (two_file_shared_nonpic.so): Likewise.
4147         (two_file_shared_mixed.so): Likewise.
4148         (two_file_shared_mixed_1.so): Likewise.
4149         (weak_undef_lib_nonpic.so): Likewise.
4150         (alt/weak_undef_lib_nonpic.so): Likewise.
4151         (tls_test_shared_nonpic.so): Likewise.
4152         * testsuite/Makefile.in: Rebuild.
4153
4154 2011-07-01  Ian Lance Taylor  <iant@google.com>
4155
4156         PR gold/12525
4157         * configure.ac: Test whether static linking works, setting
4158         the automake conditional HAVE_STATIC.
4159         * testsuite/Makefile.am: Disable tests using -static if
4160         HAVE_STATIC is not true.
4161         * configure, testsuite/Makefile.in: Rebuild.
4162
4163 2011-07-01  Ian Lance Taylor  <iant@google.com>
4164
4165         PR gold/12525
4166         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4167         Assert if we see DW_EH_PE_indirect.
4168         * target.h (Target::ehframe_datarel_base): New function.
4169         (Target::do_ehframe_datarel_base): New target function.
4170         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4171         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4172         function.
4173
4174 2011-07-01  Ian Lance Taylor  <iant@google.com>
4175
4176         PR gold/12571
4177         * options.h (class General_options): Add
4178         --ld-generated-unwind-info.
4179         * ehframe.cc (Fde::write): Add address parameter.  Change all
4180         callers.  If associated with PLT, fill in address and size.
4181         (Cie::set_output_offset): Only add merge mapping if there is an
4182         object.
4183         (Cie::write): Add address parameter.  Change all callers.
4184         (Eh_frame::add_ehframe_for_plt): New function.
4185         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4186         input_offset_ fields into union u_, with new plt field.
4187         (Fde::Fde): Adjust for new union field.
4188         (Fde::Fde) [Output_data version]: New constructor.
4189         (Fde::add_mapping): Only add merge mapping if there is an object.
4190         (class Cie): Update declarations.
4191         (class Eh_frame): Declare add_ehframe_for_plt.
4192         * layout.cc (Layout::layout_eh_frame): Break out code into
4193         make_eh_frame_section, and call it.
4194         (Layout::make_eh_frame_section): New function.
4195         (Layout::add_eh_frame_for_plt): New function.
4196         * layout.h (class Layout): Update declarations.
4197         * merge.cc (Merge_map::add_mapping): Add assertion.
4198         * i386.cc: Include "dwarf.h".
4199         (class Output_data_plt_i386): Make first_plt_entry,
4200         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4201         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4202         and plt_eh_frame_fde.
4203         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4204         boundary.  Call add_eh_frame_for_plt if appropriate.
4205         * x86_64.cc: Include "dwarf.h".
4206         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4207         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4208         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4209         and plt_eh_frame_fde.
4210         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4211         appropriate.
4212
4213 2011-06-29  Ian Lance Taylor  <iant@google.com>
4214
4215         PR gold/12629
4216         * object.cc (Sized_relobj_file::layout_section): Change shdr
4217         parameter to be const.
4218         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4219         out of do_layout.
4220         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4221         appropriate.  Call layout_eh_frame_section.
4222         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4223         sections.
4224         * object.h (class Sized_relobj_file): Update declarations.
4225
4226 2011-06-29  Ian Lance Taylor  <iant@google.com>
4227
4228         PR gold/12652
4229         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4230         modifier.
4231         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4232
4233 2011-06-29  Ian Lance Taylor  <iant@google.com>
4234
4235         PR gold/12675
4236         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4237         SHT_X86_64_UNWIND.
4238         * layout.cc (Layout::layout_eh_frame): Likewise.
4239
4240 2011-06-29  Ian Lance Taylor  <iant@google.com>
4241
4242         PR gold/12695
4243         * layout.cc (Layout::symtab_section_shndx): New function.
4244         * layout.h (class Layout): Declare symtab_section_shndx.
4245         * output.cc (Output_section::write_header): Call it.
4246
4247 2011-06-29  Ian Lance Taylor  <iant@google.com>
4248
4249         PR gold/12818
4250         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4251         symbols which are not used in a relocation.
4252
4253 2011-06-28  Ian Lance Taylor  <iant@google.com>
4254
4255         PR gold/12898
4256         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4257         script create indistinguishable segments.
4258         (Layout::set_segment_offsets): Use stable_sort when sorting
4259         segments.  Pass this to Compare_segments constructor.
4260         * layout.h (class Layout): Make segment_precedes non-static.
4261         (class Compare_segments): Change from struct to class.  Add
4262         layout_ field.  Add constructor.
4263         * script-sections.cc
4264         (Script_sections::attach_sections_using_phdrs_clause): Rename
4265         local orphan to is_orphan.  Don't report failure to put empty
4266         section in segment.  On attachment failure, report name of
4267         section, and attach to first PT_LOAD segment.
4268
4269 2011-06-28  Ian Lance Taylor  <iant@google.com>
4270
4271         PR gold/12934
4272         * target-select.cc (Target_selector::Target_selector): Add
4273         emulation parameter.  Change all callers.
4274         (select_target_by_bfd_name): Rename from select_target_by_name.
4275         Change all callers.
4276         (select_target_by_emulation): New function.
4277         (supported_emulation_names): New function.
4278         * target-select.h (class Target_selector): Add emulation_ field.
4279         Update declarations.
4280         (Target_selector::recognize_by_bfd_name): Rename from
4281         recognize_by_name.  Change all callers.
4282         (Target_selector::supported_bfd_names): Rename from
4283         supported_names.  Change all callers.
4284         (Target_selector::recognize_by_emulation): New function.
4285         (Target_selector::supported_emulations): New function.
4286         (Target_selector::emulation): New function.
4287         (Target_selector::do_recognize_by_bfd_name): Rename from
4288         do_recognize_by_name.  Change all callers.
4289         (Target_selector::do_supported_bfd_names): Rename from
4290         do_supported_names.  Change all callers.
4291         (Target_selector::do_recognize_by_emulation): New function.
4292         (Target_selector::do_supported_emulations): New function.
4293         (select_target_by_bfd_name): Change name in declaration.
4294         (select_target_by_emulation): Declare.
4295         (supported_emulation_names): Declare.
4296         * parameters.cc (parameters_force_valid_target): Try to find
4297         target based on emulation from -m option.
4298         * options.h (class General_options): Change doc string for -m.
4299         * options.cc (help): Print emulations.
4300         (General_options::parse_V): Likewise.
4301         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4302         Add emulation parameter.  Change all callers.
4303
4304 2011-06-28  Ian Lance Taylor  <iant@google.com>
4305
4306         * target.h (class Target): Add osabi_ field.
4307         (Target::osabi): New function.
4308         (Target::set_osabi): New function.
4309         (Target::Target): Initialize osabi_.
4310         (Target::do_adjust_elf_header): Make pure virtual.
4311         (Sized_target::do_adjust_elf_header): Declare.
4312         * target.cc (Sized_target::do_adjust_elf_header): New function.
4313         (class Sized_target): Instantiate all versions.
4314         * freebsd.h (class Target_freebsd): Remove.
4315         (Target_selector_freebsd::do_recognize): Call set_osabi on
4316         Target.
4317         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4318         (Target_selector_freebsd::set_osabi): Remove.
4319         * i386.cc (class Target_i386): Inherit from Sized_target rather
4320         than Target_freebsd.
4321         * x86_64.cc (class Target_x86_64): Likewise.
4322
4323 2011-06-28  Ian Lance Taylor  <iant@google.com>
4324
4325         * target.h (Target::can_check_for_function_pointers): Rewrite.
4326         Make non-virtual.
4327         (Target::can_icf_inline_merge_sections): Likewise.
4328         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4329         (Target::Target_info): Add can_icf_inline_merge_sections field.
4330         (Target::do_can_check_for_function_pointers): New virtual
4331         function.
4332         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4333         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4334         from can_check_for_function_pointers, move in file.
4335         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4336         section_may_have_icf_unsafe_poineters, move in file.
4337         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4338         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4339         Rename from can_check_for_function_pointers, move in file.
4340         (Target_i386::can_icf_inline_merge_sections): Remove.
4341         (Target_i386::i386_info): Initialize
4342         can_icf_inline_merge_sections.
4343         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4344         Initialize can_icf_inline_merge_sections.
4345         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4346         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4347         Rename from can_check_for_function_pointers, move in file.
4348         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4349         (Target_x86_64::x86_64_info): Initialize
4350         can_icf_inline_merge_sections.
4351         * testsuite/testfile.cc (Target_test::test_target_info):
4352         Likewise.
4353         * icf.cc (get_section_contents): Correct formatting.
4354
4355 2011-06-27  Ian Lance Taylor  <iant@google.com>
4356
4357         * symtab.cc (Symbol::versioned_name): New function.
4358         (Symbol_table::add_to_final_symtab): Use versioned_name when
4359         appropriate.
4360         (Symbol_table::sized_write_symbol): Likewise.
4361         * symtab.h (class Symbol): Declare versioned_name.
4362         * stringpool.h (class Stringpool_template): Add variant of add
4363         which takes a std::basic_string.
4364         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4365         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4366         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4367         (ver_test_12.o): New target.
4368         * testsuite/Makefile.in: Rebuild.
4369
4370 2011-06-27  Doug Kwan  <dougkwan@google.com>
4371
4372         * arm.cc (Arm_relocate_functions::thm_jump8,
4373         Arm_relocate_functions::thm_jump11): Use a wider signed
4374         type to compute offset.
4375         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4376         arm_thm_jump8.
4377         * testsuite/Makefile.in: Regenerate.
4378         * testsuite/arm_branch_in_range.sh: Check test results of
4379         arm_thm_jump11 and arm_thm_jump8.
4380         * testsuite/arm_thm_jump11.s: New test source file.
4381         * testsuite/arm_thm_jump11.t: New linker script.
4382         * testsuite/arm_thm_jump8.s: New test source file.
4383         * testsuite/arm_thm_jump8.t: New linker script.
4384
4385 2011-06-24  Ian Lance Taylor  <iant@google.com>
4386
4387         * layout.cc: Include "object.h".
4388         (ctors_sections_in_init_array): New static variable.
4389         (Layout::is_ctors_in_init_array): New function.
4390         (Layout::layout): Add entry to ctors_sections_in_init_array if
4391         appropriate.
4392         * layout.h (class Layout): Declare is_ctors_in_init_array.
4393         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4394         is_ctors_reverse_view is set.
4395         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4396         all callers.  Set is_ctors_reverse_view field of View_size.
4397         (Sized_relobj_file::reverse_words): New function.
4398         * object.h (Sized_relobj_file::View_size): Add
4399         is_ctors_reverse_view field.
4400         (class Sized_relobj_file): Update declarations.
4401         * testsuite/initpri3.c: New test.
4402         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4403         initpri3b.
4404         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4405         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4406         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4407         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4408         * testsuite/Makefile.in: Rebuild.
4409
4410 2011-06-24  Cary Coutant  <ccoutant@google.com>
4411
4412         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4413         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4414         (debug_msg_cdebug.err): New targets.
4415         * testsuite/Makefile.in: Regenerate.
4416         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4417         Fix checks for link with shared library.
4418
4419 2011-06-24  Doug Kwan  <dougkwan@google.com>
4420
4421         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4422         skip empty text sections.
4423         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4424
4425 2011-06-22  Ian Lance Taylor  <iant@google.com>
4426
4427         PR gold/12910
4428         * options.h (class General_options): Add --ctors-in-init-array.
4429         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4430         friends as SHT_PROGBITS for merging sections.
4431         (Layout::layout): Remove special handling of .init_array and
4432         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4433         and .dtors if ctors_in_init_array.
4434         (Layout::make_output_section): Force correct section types for
4435         .init_array and friends.  Don't sort if doing relocatable link,
4436         Don't sort .ctors and .dtors if ctors_in_init_array.
4437         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4438         (Layout::output_section_name): Add relobj parameter.  Change all
4439         callers.  Handle .ctors. and .dtors. in code rather than table.
4440         Handle .ctors and .dtors if ctors_in_init_array.
4441         (Layout::match_file_name): New function, moved from output.cc.
4442         * layout.h (class Layout): Update declarations.
4443         * output.cc: Include "layout.h".
4444         (Input_section_sort_entry::get_priority): New function.
4445         (Input_section_sort_entry::match_file_name): Just call
4446         Layout::match_file_name.
4447         (Output_section::Input_section_sort_init_fini_compare::operator()):
4448         Handle .ctors and .dtors.  Sort by explicit priority rather than
4449         by name.
4450         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4451         * testsuite/initpri2.c: New test.
4452         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4453         (check_PROGRAMS): Add initpri2.
4454         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4455         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4456         * configure, testsuite/Makefile.in: Rebuild.
4457
4458 2011-06-19  Ian Lance Taylor  <iant@google.com>
4459
4460         PR gold/12880
4461         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4462         .interp section to a PT_INTERP segment even if we have seen a
4463         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4464         clause in a linker script.
4465         (Layout::finalize): Don't create a .interp section if we've
4466         already create a PT_INTERP segment.
4467         (Layout::create_interp): Always call choose_output_section (revert
4468         patch of 2011-06-17).  Don't create PT_INTERP segment.
4469         * script-sections.cc
4470         (Script_sections::create_note_and_tls_segments): Add a .interp
4471         section to a PT_INTERP segment even if we have seen a
4472         --dynamic-linker option.
4473
4474 2011-06-18  Ian Lance Taylor  <iant@google.com>
4475
4476         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4477         merely because a non-PT_LOAD segment has a dynamic reloc.
4478
4479 2011-06-18  Ian Lance Taylor  <iant@google.com>
4480
4481         * layout.cc (Layout::finish_dynamic_section): Don't create
4482         DT_FLAGS entry if not needed.
4483
4484 2011-06-18  Ian Lance Taylor  <iant@google.com>
4485
4486         PR gold/12745
4487         * layout.cc (Layout::layout_eh_frame): Correct handling of
4488         writable .eh_frame section.
4489
4490 2011-06-17  Ian Lance Taylor  <iant@google.com>
4491
4492         PR gold/12893
4493         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4494         symbol is redefined with the exact same object and value.
4495
4496 2011-06-17  Ian Lance Taylor  <iant@google.com>
4497
4498         PR gold/12880
4499         * layout.h (class Layout): Add interp_segment_ field.
4500         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4501         (Layout::attach_allocated_section_to_segment): If making shared
4502         library, put .interp section in PT_INTERP segment.
4503         (Layout::finalize): Also call create_interp if -dynamic-linker
4504         option was used.
4505         (Layout::create_interp): Assert that there is no PT_INTERP
4506         segment.  If not using a SECTIONS clause, use make_output_section.
4507         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4508         * script-sections.cc
4509         (Script_sections::create_note_and_tls_segments): If making shared
4510         library, put .interp section in PT_INTERP segment.
4511
4512 2011-06-17  Ian Lance Taylor  <iant@google.com>
4513
4514         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4515         when making a shared library.
4516
4517 2011-06-17  Ian Lance Taylor  <iant@google.com>
4518
4519         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4520         parameter.  Change all callers.  Don't issue warning about PC32
4521         against locally defined symbol.
4522
4523 2011-06-16  Ian Lance Taylor  <iant@google.com>
4524
4525         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4526         occurs in same object.
4527
4528 2011-06-14  Alan Modra  <amodra@gmail.com>
4529
4530         * po/POTFILES.in: Regenerate.
4531
4532 2011-06-09  Ian Lance Taylor  <iant@google.com>
4533
4534         * script-sections.cc
4535         (Orphan_output_section::set_section_addresses): For a relocatable
4536         link set address to 0.
4537
4538 2011-06-09  Cary Coutant  <ccoutant@google.com>
4539
4540         PR gold/12804
4541         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4542         used with --compress-debug-sections.
4543         * gold/object.cc (Sized_relobj_file::do_layout): Report
4544         uncompressed size of compressed input sections.
4545
4546 2011-06-08  Cary Coutant  <ccoutant@google.com>
4547
4548         PR gold/12804
4549         * testsuite/two_file_test_2_v1.cc: Change initialization of
4550         v2 to keep it in .data.
4551
4552 2011-06-07  Cary Coutant  <ccoutant@google.com>
4553
4554         * common.cc (Symbol_table::do_allocate_commons_list): Call
4555         gold_fallback.
4556         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4557         (Errors::fallback): New function.
4558         (gold_fallback): New function.
4559         * errors.h (Errors::fallback): New function.
4560         * gold.cc (gold_exit): Change status parameter to enum; adjust
4561         all callers.
4562         (queue_initial_tasks): Call gold_fallback.
4563         * gold.h: Include cstdlib.
4564         (Exit_status): New enum type.
4565         (gold_exit): Change status parameter to enum.
4566         (gold_fallback): New function.
4567         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4568         (Layout::create_symtab_sections): Likewise.
4569         (Layout::create_shdrs): Likewise.
4570         * main.cc (main): Adjust call to gold_exit.
4571         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4572         (Output_data_got::add_got_entry_pair): Likewise.
4573         (Output_section::add_input_section): Likewise.
4574         (Output_section::add_output_section_data): Likewise.
4575         (Output_segment::set_section_list_addresses): Likewise.
4576         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4577
4578 2011-06-07  Cary Coutant  <ccoutant@google.com>
4579
4580         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4581         for incremental links.
4582         * output.cc (Output_segment::set_section_list_addresses): Remove
4583         FIXME and test for TLS or BSS.
4584
4585 2011-06-07  Cary Coutant  <ccoutant@google.com>
4586
4587         * testsuite/Makefile.am: Add incremental_copy_test,
4588         incremental_common_test_1.
4589         * testsuite/Makefile.in: Regenerate.
4590         * testsuite/common_test_1_v1.c: New source file.
4591         * testsuite/common_test_1_v2.c: New source file.
4592         * testsuite/copy_test_v1.cc: New source file.
4593
4594 2011-06-07  Cary Coutant  <ccoutant@google.com>
4595
4596         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4597         update, allocate common from bss section's free list.
4598         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4599         linker-defined symbols.
4600         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4601         Skip GOT and PLT entries that are no longer referenced.
4602         (Output_section_incremental_inputs::write_info_blocks): Mark
4603         linker-defined symbols.
4604         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4605         * output.cc (Output_section::allocate): New function.
4606         * output.h (Output_section::allocate): New function.
4607         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4608         linker-defined symbols.
4609         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4610         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4611         (Symbol::init_base_output_data): Likewise.
4612         (Symbol::init_base_output_segment): Likewise.
4613         (Symbol::init_base_constant): Likewise.
4614         (Sized_symbol::init_output_data): Likewise.
4615         (Sized_symbol::init_output_segment): Likewise.
4616         (Sized_symbol::init_constant): Likewise.
4617         (Symbol_table::do_define_in_output_data): Likewise.
4618         (Symbol_table::do_define_in_output_segment): Likewise.
4619         (Symbol_table::do_define_as_constant): Likewise.
4620         * symtab.h (Symbol::is_predefined): New function.
4621         (Symbol::init_base_output_data): Add is_predefined parameter.
4622         (Symbol::init_base_output_segment): Likewise.
4623         (Symbol::init_base_constant): Likewise.
4624         (Symbol::is_predefined_): New data member.
4625         (Sized_symbol::init_output_data): Add is_predefined parameter.
4626         (Sized_symbol::init_output_segment): Likewise.
4627         (Sized_symbol::init_constant): Likewise.
4628         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4629
4630 2011-06-07  Cary Coutant  <ccoutant@google.com>
4631
4632         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4633         instead of emit_copy_reloc.
4634         (Copy_relocs::emit_copy_reloc): Refactor.
4635         (Copy_relocs::make_copy_reloc): New function.
4636         (Copy_relocs::add_copy_reloc): Remove.
4637         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4638         section.
4639         (Copy_relocs::make_copy_reloc): New function.
4640         (Copy_relocs::add_copy_reloc): Remove.
4641         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4642         unchanged input files.
4643         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4644         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4645         Reserve BSS space for COPY relocations.
4646         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4647         (Output_section_incremental_inputs::write_info_blocks): Record
4648         whether a symbol is copied from a shared object.
4649         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4650         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4651         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4652         (Incremental_input_entry_reader::get_output_symbol_index): Add
4653         is_copy parameter.
4654         (Incremental_binary::emit_copy_relocs): New function.
4655         (Incremental_binary::do_emit_copy_relocs): New function.
4656         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4657         new data member.
4658         (Sized_incremental_binary::add_copy_reloc): New function.
4659         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4660         (Sized_incremental_binary::Copy_reloc): New struct.
4661         (Sized_incremental_binary::Copy_relocs): New typedef.
4662         (Sized_incremental_binary::copy_relocs_): New data member.
4663         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4664         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4665         * target.h (Sized_target::emit_copy_reloc): New function.
4666         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4667
4668 2011-06-02  Cary Coutant  <ccoutant@google.com>
4669
4670         PR gold/12163
4671         * gold/archive.cc (Archive::Archive): Initialize new data member.
4672         (Archive::include_all_members): Return if archive has already been
4673         included.
4674         * gold/archive.h (Archive::include_all_members_): New data member.
4675
4676 2011-06-02  Nick Clifton  <nickc@redhat.com>
4677
4678         * dynobj.h: Fix spelling mistake in comment.
4679         * output.cc: Likewise.
4680
4681 2011-05-31  Doug Kwan  <dougkwan@google.com>
4682             Asier Llano
4683
4684         PR gold/12826
4685         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4686         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4687         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4688         redundant arm_exidx_test.so.
4689         * testsuite/Makefile.in: Regenerate.
4690         (check_SCRIPTS): Add pr12826.sh
4691         (check_DATA): Add pr12826.stdout
4692         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4693         * testsuite/pr12826.sh: New file.
4694         * testsuite/pr12826_1.s: Ditto.
4695         * testsuite/pr12826_1.s: Ditto.
4696
4697 2011-05-30  Ian Lance Taylor  <iant@google.com>
4698
4699         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4700         sections.
4701
4702 2011-05-29  Ian Lance Taylor  <iant@google.com>
4703
4704         PR gold/12804
4705         * testsuite/Makefile.am: Use different file name for two_file_test
4706         temporary file for each incremental test.
4707         * testsuite/Makefile.in: Rebuild.
4708
4709 2011-05-29  Ian Lance Taylor  <iant@google.com>
4710
4711         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4712         binary input file is empty.
4713
4714 2011-05-27  Ian Lance Taylor  <iant@google.com>
4715
4716         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4717         (ver_test_9.so): Likewise.
4718         * testsuite/Makefile.in: Rebuild.
4719
4720 2011-05-26 Cary Coutant  <ccoutant@google.com>
4721
4722         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4723         * incremental.cc (Incremental_inputs::report_input_section): Fix
4724         comment, indentation.
4725         (Incremental_inputs::report_comdat_group): New function.
4726         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4727         of data for incremental input file entry.
4728         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4729         group count, COMDAT group signatures.
4730         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4731         an unchanged input file.
4732         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4733         Initialize new data member.
4734         (Incremental_object_entry::add_comdat_group): New function.
4735         (Incremental_object_entry::get_comdat_group_count): New function.
4736         (Incremental_object_entry::get_comdat_signature_key): New function.
4737         (Incremental_object_entry::groups_): New data member.
4738         (Incremental_inputs::report_comdat_group): New function.
4739         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4740         data for incremental input file entry.
4741         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4742         (Incremental_input_entry_reader::get_input_section): Adjust size of
4743         data for incremental input file entry.
4744         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4745         (Incremental_input_entry_reader::get_comdat_group_signature): New
4746         function.
4747         * object.cc (Sized_relobj::include_section_group): Report kept
4748         COMDAT groups for incremental links.
4749
4750 2011-05-24  David Meyer  <pdox@google.com>
4751
4752         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4753         with name parameter.  Add found_name parameter.
4754         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4755         * dirsearch.h (class Dirsearch): Update declaration.
4756
4757 2011-05-24  Ian Lance Taylor  <iant@google.com>
4758
4759         * archive.cc (Library_base::should_include_member): Pull in object
4760         from archive if it defines the entry symbol.
4761         * parameters.cc (Parameters::entry): New function.
4762         * parameters.h (class Parameters): Declare entry.
4763         * output.h (class Output_file_header): Remove entry_ field.
4764         * output.cc (Output_file_header::Output_file_header): Remove entry
4765         parameter.  Change all callers.
4766         (Output_file_header::entry): Use parameters->entry.
4767         * gold.cc (queue_middle_tasks): Likewise.
4768         * plugin.cc (Plugin_hook::run): Likewise.
4769
4770 2011-05-24 Cary Coutant  <ccoutant@google.com>
4771
4772         * gold.cc (queue_initial_tasks): Pass incremental base filename
4773         to Output_file::open_base_file; don't print error message.
4774         * incremental-dump.cc (main): Adjust call to
4775         Output_file::open_for_modification.
4776         * incremental-dump.cc (main): Likewise.
4777         * incremental.cc (Incremental_inputs::report_command_line):
4778         Ignore --incremental-base option when comparing command lines.
4779         Ignore parameter when given as separate argument.
4780         * options.h (class General_options): Add --incremental-base.
4781         * output.cc (Output_file::Output_file):
4782         (Output_file::open_base_file): Add base_name and writable parameters;
4783         read base file into new file; print error message here.
4784         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4785         callers.
4786         * output.h (Output_file::open_for_modification): Rename to...
4787         (Output_file::open_base_file): ...this; add base_name and
4788         writable parameters; adjust all callers.
4789         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4790         callers.
4791         * testsuite/Makefile.am (incremental_test_4): Test
4792         --incremental-base.
4793         * testsuite/Makefile.in: Regenerate.
4794
4795 2011-05-24 Cary Coutant  <ccoutant@google.com>
4796
4797         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4798         incremental_test_4.
4799         * testsuite/Makefile.in: Regenerate.
4800         * testsuite/two_file_test_1_v1.cc: New test source file.
4801         * testsuite/two_file_test_1b_v1.cc: New test source file.
4802         * testsuite/two_file_test_2_v1.cc: New test source file.
4803
4804 2011-05-24 Cary Coutant  <ccoutant@google.com>
4805
4806         * dynobj.h (Dynobj::do_dynobj): New function.
4807         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4808         flag and soname for shared objects.
4809         * incremental.cc (Incremental_inputs::report_object): Make
4810         either Incremental_object_entry or Incremental_dynobj_entry; add
4811         soname to string table.
4812         (Incremental_inputs::report_input_section): Add assertion.
4813         (Output_section_incremental_inputs::set_final_data_size): Adjust
4814         type of input file entry for shared libraries; adjust size of
4815         shared library info entry.
4816         (Output_section_incremental_inputs::write_input_files): Write
4817         as_needed flag for shared libraries.
4818         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4819         of input file entry for shared libraries; write soname.
4820         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4821         soname from incremental info.
4822         * incremental.h (enum Incremental_input_flags): Add
4823         INCREMENTAL_INPUT_AS_NEEDED.
4824         (Incremental_input_entry::Incremental_input_entry): Initialize new
4825         data member.
4826         (Incremental_input_entry::set_as_needed): New function.
4827         (Incremental_input_entry::as_needed): New function.
4828         (Incremental_input_entry::do_dynobj_entry): New function.
4829         (Incremental_input_entry::as_needed_): New data member.
4830         (Incremental_object_entry::Incremental_object_entry): Don't check
4831         for shared library.
4832         (Incremental_object_entry::do_type): Likewise.
4833         (class Incremental_dynobj_entry): New class.
4834         (Incremental_input_entry_reader::as_needed): New function.
4835         (Incremental_input_entry_reader::get_soname): New function.
4836         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4837         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4838         size of shared library info entry.
4839         * layout.cc (Layout::finish_dynamic_section): Don't test for
4840         incremental link when adding DT_NEEDED entries.
4841         * object.h (Object::Object): Initialize new data member.
4842         (Object::dynobj): New function.
4843         (Object::set_as_needed): New function.
4844         (Object::as_needed): New function.
4845         (Object::do_dynobj): New function.
4846         (Object::as_needed_): New data member.
4847
4848 2011-05-24 Cary Coutant  <ccoutant@google.com>
4849
4850         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4851         info; adjust display of GOT entries.
4852         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4853         vector of input objects; remove file_status_.
4854         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4855         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4856         got_plt reader; call target hooks to reserve GOT entries.
4857         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4858         of input file info header and GOT info entry.
4859         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4860         relocation info.
4861         (Got_plt_view_info::got_descriptor): Remove.
4862         (Got_plt_view_info::sym_index): New data member.
4863         (Got_plt_view_info::input_index): New data member.
4864         (Local_got_offset_visitor::visit): Write input file index.
4865         (Global_got_offset_visitor::visit): Write 0 for input file index.
4866         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4867         with sym_index and input_index.
4868         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4869         incremental info GOT entry; replace got_descriptor with input_index.
4870         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4871         map from input file index to object.
4872         (Sized_relobj_incr::do_layout): Replace direct data member reference
4873         with accessor function.
4874         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4875         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4876         Adjust size of input file info header.
4877         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4878         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4879         (Incremental_input_entry_reader::get_input_section): Adjust size of
4880         input file info header.
4881         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4882         of incremental info GOT entry.
4883         (Incremental_got_plt_reader::get_got_desc): Remove.
4884         (Incremental_got_plt_reader::get_got_symndx): New function.
4885         (Incremental_got_plt_reader::get_got_input_index): New function.
4886         (Sized_incremental_binary::Sized_incremental_binary): Remove
4887         file_status_; add input_objects_.
4888         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4889         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4890         (Sized_incremental_binary::file_is_unchanged): Remove.
4891         (Sized_incremental_binary::set_input_object): New function.
4892         (Sized_incremental_binary::input_object): New function.
4893         (Sized_incremental_binary::file_status_): Remove.
4894         (Sized_incremental_binary::input_objects_): New data member.
4895         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4896         references.
4897         (Sized_relobj_incr::invalid_address): Move to base class.
4898         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4899         class.
4900         (Sized_relobj_incr::do_output_section_offset): Likewise.
4901         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4902         (Sized_relobj_incr::section_offsets_): Likewise.
4903         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4904         function.
4905         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4906         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4907         with accessor function.
4908         (Sized_relobj_file::do_layout): Likewise.
4909         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4910         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4911         (Sized_relobj_file::compute_final_local_value): Replace refs to
4912         section_offsets_ with accessor function.
4913         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4914         * object.h (Relobj::Relobj): Initialize new data members.
4915         (Relobj::add_dyn_reloc): New function.
4916         (Relobj::first_dyn_reloc): New function.
4917         (Relobj::dyn_reloc_count): New function.
4918         (Relobj::first_dyn_reloc_): New data member.
4919         (Relobj::dyn_reloc_count_): New data member.
4920         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4921         references.
4922         (Sized_relobj::Address): New typedef.
4923         (Sized_relobj::invalid_address): Move here from child class.
4924         (Sized_relobj::Sized_relobj): Initialize new data members.
4925         (Sized_relobj::sized_relobj): New function.
4926         (Sized_relobj::is_output_section_offset_invalid): Move here from
4927         child class.
4928         (Sized_relobj::get_output_section_offset): Likewise.
4929         (Sized_relobj::local_has_got_offset): Likewise.
4930         (Sized_relobj::local_got_offset): Likewise.
4931         (Sized_relobj::set_local_got_offset): Likewise.
4932         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4933         (Sized_relobj::clear_got_offsets): New function.
4934         (Sized_relobj::section_offsets): Move here from child class.
4935         (Sized_relobj::do_output_section_offset): Likewise.
4936         (Sized_relobj::do_set_section_offset): Likewise.
4937         (Sized_relobj::Local_got_offsets): Likewise.
4938         (Sized_relobj::local_got_offsets_): Likewise.
4939         (Sized_relobj::section_offsets_): Likewise.
4940         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4941         references.
4942         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4943         class.
4944         (Sized_relobj_file::sized_relobj): New function
4945         (Sized_relobj_file::local_has_got_offset): Move to base class.
4946         (Sized_relobj_file::local_got_offset): Likewise.
4947         (Sized_relobj_file::set_local_got_offset): Likewise.
4948         (Sized_relobj_file::get_output_section_offset): Likewise.
4949         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4950         (Sized_relobj_file::do_output_section_offset): Likewise.
4951         (Sized_relobj_file::do_set_section_offset): Likewise.
4952         (Sized_relobj_file::Local_got_offsets): Likewise.
4953         (Sized_relobj_file::local_got_offsets_): Likewise.
4954         (Sized_relobj_file::section_offsets_): Likewise.
4955         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4956         (all constructors).
4957         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4958         (Output_reloc::get_symbol_index): Likewise.
4959         (Output_reloc::local_section_offset): Likewise.
4960         (Output_reloc::get_address): Likewise.
4961         (Output_reloc::symbol_value): Likewise.
4962         (Output_data_got::reserve_slot): Move to class definition.
4963         (Output_data_got::reserve_local): New function.
4964         (Output_data_got::reserve_slot_for_global): Remove.
4965         (Output_data_got::reserve_global): New function.
4966         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4967         (all constructors, two instantiations).
4968         (Output_reloc::get_relobj): New function (two instantiations).
4969         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4970         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4971         (Output_data_reloc::add_global): Adjust type of relobj.
4972         (Output_data_reloc::add_global_relative): Likewise.
4973         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4974         (Output_data_reloc::add_local): Likewise.
4975         (Output_data_reloc::add_local_relative): Likewise.
4976         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4977         (Output_data_reloc::add_local_section): Likewise.
4978         (Output_data_reloc::add_output_section): Likewise.
4979         (Output_data_reloc::add_absolute): Likewise.
4980         (Output_data_reloc::add_target_specific): Likewise.
4981         (Output_data_got::reserve_slot): Move definition here.
4982         (Output_data_got::reserve_local): New function.
4983         (Output_data_got::reserve_global): New function.
4984         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4985         section_offsets_ with accessor function.
4986         (Sized_relobj_file::write_sections): Likewise.
4987         (Sized_relobj_file::do_relocate_sections): Likewise.
4988         * target.h (Sized_target::reserve_local_got_entry): New function.
4989         (Sized_target::reserve_global_got_entry): New function.
4990         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4991         (Target_x86_64::reserve_global_got_entry): New function.
4992         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4993
4994 2011-05-23 Cary Coutant  <ccoutant@google.com>
4995
4996         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4997         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4998         bit when checking got_type.
4999         * incremental.cc (Sized_incremental_binary::setup_readers):
5000         Store symbol table and string table locations; initialize bit vector
5001         of file status flags.
5002         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5003         unchanged files.
5004         (Sized_incremental_binary::do_process_got_plt): New function.
5005         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5006         (Output_section_incremental_inputs::set_final_data_size): Record
5007         file index for each input file.
5008         (Output_section_incremental_inputs::write_got_plt): Store file index
5009         instead of input entry offset for each GOT entry.
5010         * incremental.h
5011         (Incremental_input_entry::Incremental_input_entry): Initialize new
5012         data member.
5013         (Incremental_input_entry::set_offset): Store file index.
5014         (Incremental_input_entry::get_file_index): New function.
5015         (Incremental_input_entry::file_index_): New data member.
5016         (Incremental_binary::process_got_plt): New function.
5017         (Incremental_binary::do_process_got_plt): New function.
5018         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5019         data members.
5020         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5021         (Sized_incremental_binary::set_file_is_unchanged): New function.
5022         (Sized_incremental_binary::file_is_unchanged): New function.
5023         (Sized_incremental_binary::do_process_got_plt): New function.
5024         (Sized_incremental_binary::file_status_): New data member.
5025         (Sized_incremental_binary::main_symtab_loc_): New data member.
5026         (Sized_incremental_binary::main_strtab_loc_): New data member.
5027         * output.cc (Output_data_got::Got_entry::write): Add case
5028         RESERVED_CODE.
5029         (Output_data_got::add_global): Call add_got_entry.
5030         (Output_data_got::add_global_plt): Likewise.
5031         (Output_data_got::add_global_with_rel): Likewise.
5032         (Output_data_got::add_global_with_rela): Likewise.
5033         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5034         (Output_data_got::add_global_pair_with_rela): Likewise.
5035         (Output_data_got::add_local): Call add_got_entry.
5036         (Output_data_got::add_local_plt): Likewise.
5037         (Output_data_got::add_local_with_rel): Likewise.
5038         (Output_data_got::add_local_with_rela): Likewise.
5039         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5040         (Output_data_got::add_local_pair_with_rela): Likewise.
5041         (Output_data_got::reserve_slot): New function.
5042         (Output_data_got::reserve_slot_for_global): New function.
5043         (Output_data_got::add_got_entry): New function.
5044         (Output_data_got::add_got_entry_pair): New function.
5045         (Output_section::add_output_section_data): Edit FIXME.
5046         * output.h
5047         (Output_section_data_build::Output_section_data_build): New
5048         constructor with size parameter.
5049         (Output_data_space::Output_data_space): Likewise.
5050         (Output_data_got::Output_data_got): Initialize new data member; new
5051         constructor with size parameter.
5052         (Output_data_got::add_constant): Call add_got_entry.
5053         (Output_data_got::reserve_slot): New function.
5054         (Output_data_got::reserve_slot_for_global): New function.
5055         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5056         (Output_data_got::add_got_entry): New function.
5057         (Output_data_got::add_got_entry_pair): New function.
5058         (Output_data_got::free_list_): New data member.
5059         * target.h (Sized_target::init_got_plt_for_update): New function.
5060         (Sized_target::register_global_plt_entry): New function.
5061         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5062         Initialize new data member; call init; add constructor with PLT count.
5063         (Output_data_plt_x86_64::init): New function.
5064         (Output_data_plt_x86_64::add_relocation): New function.
5065         (Output_data_plt_x86_64::reserve_slot): New function.
5066         (Output_data_plt_x86_64::free_list_): New data member.
5067         (Target_x86_64::init_got_plt_for_update): New function.
5068         (Target_x86_64::register_global_plt_entry): New function.
5069         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5070         incremental updates.
5071         (Output_data_plt_x86_64::add_relocation): New function.
5072         * testsuite/object_unittest.cc (Object_test): Set default options.
5073
5074 2011-05-16  Ian Lance Taylor  <iant@google.com>
5075
5076         * options.h (class General_options): Make -i a synonym for -r.
5077
5078 2011-05-16  Ian Lance Taylor  <iant@google.com>
5079
5080         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5081
5082 2011-05-10 Cary Coutant  <ccoutant@google.com>
5083
5084         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5085         strip_all (-s).
5086
5087 2011-05-06  Ian Lance Taylor  <iant@google.com>
5088
5089         * layout.cc (Layout::layout): If the output section flags change,
5090         update the ordering.
5091
5092 2011-04-25 Cary Coutant  <ccoutant@google.com>
5093
5094         * incremental-dump.cc (dump_incremental_inputs): Print local
5095         symbol info for each input file.
5096         * incremental.cc
5097         (Output_section_incremental_inputs::set_final_data_size): Add local
5098         symbol info to input file entries in incremental info.
5099         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5100         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5101         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5102         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5103         implementation.
5104         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5105         (Sized_incr_relobj::do_relocate): Write the local symbols.
5106         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5107         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5108         Adjust size of input file header.
5109         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5110         (Incremental_inputs_reader::get_local_symbol_count): New function.
5111         (Incremental_inputs_reader::get_input_section): Adjust size of input
5112         file header.
5113         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5114         (Sized_incr_relobj::This): New typedef.
5115         (Sized_incr_relobj::sym_size): New const data member.
5116         (Sized_incr_relobj::Local_symbol): New struct.
5117         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5118         (Sized_incr_relobj::do_local_symbol_offset): New function.
5119         (Sized_incr_relobj::local_symbol_count_): New data member.
5120         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5121         (Sized_incr_relobj::local_symbol_index_): New data member.
5122         (Sized_incr_relobj::local_symbol_offset_): New data member.
5123         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5124         (Sized_incr_relobj::local_symbols_): New data member.
5125         * object.h (Relobj::output_local_symbol_count): New function.
5126         (Relobj::local_symbol_offset): New function.
5127         (Relobj::do_output_local_symbol_count): New function.
5128         (Relobj::do_local_symbol_offset): New function.
5129         (Sized_relobj::do_output_local_symbol_count): New function.
5130         (Sized_relobj::do_local_symbol_offset): New function.
5131
5132 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5133
5134         * descriptors.cc (set_close_on_exec): New function.
5135         (Descriptors::open): Use set_close_on_exec.
5136         * output.cc (S_ISLNK): Define if not defined.
5137
5138 2011-04-22 Cary Coutant  <ccoutant@google.com>
5139
5140         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5141         global symbol map.
5142         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5143         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5144         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5145         relocations.
5146         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5147         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5148         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5149         * incremental.h
5150         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5151         function.
5152         (Incremental_binary::apply_incremental_relocs): New function.
5153         (Incremental_binary::do_apply_incremental_relocs): New function.
5154         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5155         data member.
5156         (Sized_incremental_binary::add_global_symbol): New function.
5157         (Sized_incremental_binary::global_symbol): New function.
5158         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5159         (Sized_incremental_binary::symbol_map_): New data member.
5160         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5161         * target.h (Sized_target::apply_relocation): New function.
5162         * target-reloc.h (apply_relocation): New function.
5163         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5164
5165 2011-04-22  Doug Kwan  <dougkwan@google.com>
5166
5167         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5168         flag of a SHT_ARM_EXIDX section.
5169         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5170         * testsuite/Makefile.in: Regenerate.
5171         * testsuite/arm_exidx_test.s: New file.
5172         * testsuite/arm_exidx_test.sh: Same.
5173
5174 2011-04-20 Cary Coutant  <ccoutant@google.com>
5175
5176         PR gold/12689
5177         * archive.h (Incremental_archive_entry::Archive_member):
5178         Initialize arg_serial_ (second constructor).
5179
5180 2011-04-17  Ian Lance Taylor  <iant@google.com>
5181
5182         * object.cc (Relocate_info::location): Simplify location string.
5183         * errors.cc (Errors::error_at_location): Don't print program
5184         name.
5185         (Errors::warning_at_location): Likewise.
5186         (Errors::undefined_symbol): Likewise.
5187         * testsuite/debug_msg.sh: Update accordingly.
5188
5189 2011-04-14 Cary Coutant  <ccoutant@google.com>
5190
5191         * gold/layout.cc (Layout::symtab_section_offset): New function.
5192         * gold/layout.h (Layout::symtab_section_offset): New function.
5193         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5194
5195 2011-04-12  Ian Lance Taylor  <iant@google.com>
5196
5197         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5198         with MREMAP_MAYMOVE.
5199         * output.h (class Output_file): Add map_is_allocated_ field.
5200         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5201         not available, provide stubs.  If mremap is not available, #define
5202         it to gold_mremap.
5203         (MREMAP_MAYMOVE): Define if not defined.
5204         (Output_file::Output_file): Initialize map_is_allocated_.
5205         (Output_file::resize): Check map_is_allocated_.
5206         (Output_file::map_anonymous): If mmap fails, use malloc.
5207         (Output_file::unmap): Don't do anything for an anonymous map.
5208         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5209         is not available, provide stubs.
5210         (File_read::View::~View): Use free rather than delete[].
5211         (File_read::make_view): Use malloc rather than new[].  If mmap
5212         fails, use malloc.
5213         (File_read::find_or_make_view): Use malloc rather than new[].
5214         * gold.h: Remove HAVE_REMAP code.
5215         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5216         exists.  Rename mremap to gold_mremap.  If mmap is not available
5217         don't do anything.
5218         * configure, config.in: Rebuild.
5219
5220 2011-04-11  Ian Lance Taylor  <iant@google.com>
5221
5222         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5223         initialize local variable v.
5224
5225 2011-04-11  Cary Coutant  <ccoutant@google.com>
5226
5227         * archive.cc (Archive::include_member): Adjust call to
5228         report_object.
5229         (Add_archive_symbols::run): Track argument serial numbers.
5230         (Lib_group::include_member): Likewise.
5231         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5232         * archive.h (Incremental_archive_entry::Archive_member):
5233         Initialize arg_serial_.
5234         (Archive_member::arg_serial_): New data member.
5235         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5236         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5237         incremental link.
5238         (Sized_dynobj::do_for_all_local_got_entries): New function.
5239         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5240         function.
5241         * fileread.cc (get_mtime): New function.
5242         * fileread.h (get_mtime): New function.
5243         * gold.cc (queue_initial_tasks): Check for incremental update.
5244         (process_incremental_input): New function.
5245         (queue_middle_tasks): Don't force valid target for incremental
5246         update.
5247         * incremental-dump.cc (find_input_containing_global): Adjust
5248         size of symbol info entry.
5249         (dump_incremental_inputs): Dump argument serial number and
5250         in_system_directory flag; bias shndx by 1; print symbol names
5251         when dumping per-file symbol lists; use new symbol info readers.
5252         * incremental.cc
5253         (Output_section_incremental_inputs:update_data_size): New function.
5254         (Sized_incremental_binary::setup_readers): Setup input readers
5255         for each input file; build maps for files added from libraries
5256         and scripts.
5257         (Sized_incremental_binary::check_input_args): New function.
5258         (Sized_incremental_binary::do_check_inputs): Build map of argument
5259         serial numbers to input arguments.
5260         (Sized_incremental_binary::do_file_has_changed): Rename
5261         do_file_is_unchanged to this; compare file modification times.
5262         (Sized_incremental_binary::do_init_layout): New function.
5263         (Sized_incremental_binary::do_reserve_layout): New function.
5264         (Sized_incremental_binary::do_get_input_reader): Remove.
5265         (Sized_incremental_binary::get_symtab_view): New function.
5266         (Incremental_checker::can_incrementally_link_output_file): Remove.
5267         (Incremental_inputs::report_command_line): Exclude --debug options.
5268         (Incremental_inputs::report_archive_begin): Add parameter; track
5269         argument serial numbers; don't put input file entry for archive
5270         before archive members.
5271         (Incremental_inputs::report_archive_end): Put input file entry
5272         for archive after archive members.
5273         (Incremental_inputs::report_object): Add parameter; track argument
5274         serial numbers and in_system_directory flag.
5275         (Incremental_inputs::report_script): Add parameter; track argument
5276         serial numbers.
5277         (Output_section_incremental_inputs::set_final_data_size): Adjust
5278         size of symbol info entry; check for forwarding symbols.
5279         (Output_section_incremental_inputs::write_input_files): Write
5280         in_system_directory flag and argument serial number.
5281         (Output_section_incremental_inputs::write_info_blocks): Map section
5282         indices between incremental info and original input file; store
5283         input section index for each symbol.
5284         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5285         change operator() to visit().
5286         (class Global_got_offset_visitor): Likewise.
5287         (class Global_symbol_visitor_got_plt):
5288         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5289         classes.
5290         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5291         (Sized_incr_relobj::do_read_symbols): New function.
5292         (Sized_incr_relobj::do_layout): New function.
5293         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5294         (Sized_incr_relobj::do_add_symbols): New function.
5295         (Sized_incr_relobj::do_should_include_member): New function.
5296         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5297         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5298         (Sized_incr_relobj::do_section_size): New function.
5299         (Sized_incr_relobj::do_section_name): New function.
5300         (Sized_incr_relobj::do_section_contents): New function.
5301         (Sized_incr_relobj::do_section_flags): New function.
5302         (Sized_incr_relobj::do_section_entsize): New function.
5303         (Sized_incr_relobj::do_section_address): New function.
5304         (Sized_incr_relobj::do_section_type): New function.
5305         (Sized_incr_relobj::do_section_link): New function.
5306         (Sized_incr_relobj::do_section_info): New function.
5307         (Sized_incr_relobj::do_section_addralign): New function.
5308         (Sized_incr_relobj::do_initialize_xindex): New function.
5309         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5310         (Sized_incr_relobj::do_read_relocs): New function.
5311         (Sized_incr_relobj::do_gc_process_relocs): New function.
5312         (Sized_incr_relobj::do_scan_relocs): New function.
5313         (Sized_incr_relobj::do_count_local_symbols): New function.
5314         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5315         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5316         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5317         (Sized_incr_relobj::do_relocate): New function.
5318         (Sized_incr_relobj::do_set_section_offset): New function.
5319         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5320         (Sized_incr_dynobj::do_read_symbols): New function.
5321         (Sized_incr_dynobj::do_layout): New function.
5322         (Sized_incr_dynobj::do_add_symbols): New function.
5323         (Sized_incr_dynobj::do_should_include_member): New function.
5324         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5325         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5326         (Sized_incr_dynobj::do_section_size): New function.
5327         (Sized_incr_dynobj::do_section_name): New function.
5328         (Sized_incr_dynobj::do_section_contents): New function.
5329         (Sized_incr_dynobj::do_section_flags): New function.
5330         (Sized_incr_dynobj::do_section_entsize): New function.
5331         (Sized_incr_dynobj::do_section_address): New function.
5332         (Sized_incr_dynobj::do_section_type): New function.
5333         (Sized_incr_dynobj::do_section_link): New function.
5334         (Sized_incr_dynobj::do_section_info): New function.
5335         (Sized_incr_dynobj::do_section_addralign): New function.
5336         (Sized_incr_dynobj::do_initialize_xindex): New function.
5337         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5338         (make_sized_incremental_object): New function.
5339         (Incremental_library::copy_unused_symbols): New function.
5340         (Incremental_library::do_for_all_unused_symbols): New function.
5341         * incremental.h (enum Incremental_input_flags): New type.
5342         (class Incremental_checker): Remove.
5343         (Incremental_input_entry::Incremental_input_entry): Add argument
5344         serial number.
5345         (Incremental_input_entry::arg_serial): New function.
5346         (Incremental_input_entry::set_is_in_system_directory): New function.
5347         (Incremental_input_entry::is_in_system_directory): New function.
5348         (Incremental_input_entry::arg_serial_): New data member.
5349         (Incremental_input_entry::is_in_system_directory_): New data member.
5350         (class Script_info): Move here from script.h.
5351         (Script_info::Script_info): Add filename parameter.
5352         (Script_info::filename): New function.
5353         (Script_info::filename_): New data member.
5354         (Incremental_script_entry::Incremental_script_entry): Add argument
5355         serial number.
5356         (Incremental_object_entry::Incremental_object_entry): Likewise.
5357         (Incremental_object_entry::add_input_section): Build list of input
5358         sections with map to original shndx.
5359         (Incremental_object_entry::get_input_section_index): New function.
5360         (Incremental_object_entry::shndx_): New data member.
5361         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5362         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5363         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5364         serial number.
5365         (Incremental_inputs::report_archive_begin): Likewise.
5366         (Incremental_inputs::report_object): Likewise.
5367         (Incremental_inputs::report_script): Likewise.
5368         (class Incremental_global_symbol_reader): New class.
5369         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5370         and store flags and input file type.
5371         (Incremental_input_entry_reader::arg_serial): New function.
5372         (Incremental_input_entry_reader::type): Extract type from flags.
5373         (Incremental_input_entry_reader::is_in_system_directory): New function.
5374         (Incremental_input_entry_reader::get_input_section_count): Call
5375         accessor function for type.
5376         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5377         function for type; adjust size of global symbol entry.
5378         (Incremental_input_entry_reader::get_global_symbol_count): Call
5379         accessor function for type.
5380         (Incremental_input_entry_reader::get_object_count): Likewise.
5381         (Incremental_input_entry_reader::get_object_offset): Likewise.
5382         (Incremental_input_entry_reader::get_member_count): Likewise.
5383         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5384         (Incremental_input_entry_reader::get_member_offset): Likewise.
5385         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5386         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5387         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5388         (Incremental_input_entry_reader::get_global_symbol_reader): New
5389         function.
5390         (Incremental_input_entry_reader::get_output_symbol_index): New
5391         function.
5392         (Incremental_input_entry_reader::type_): Remove.
5393         (Incremental_input_entry_reader::flags_): New data member.
5394         (Incremental_inputs_reader::input_file_offset): New function.
5395         (Incremental_inputs_reader::input_file_index): New function.
5396         (Incremental_inputs_reader::input_file): Call input_file_offset.
5397         (Incremental_inputs_reader::input_file_at_offset): New function.
5398         (Incremental_relocs_reader::get_r_type): Reformat.
5399         (Incremental_relocs_reader::get_r_shndx): Reformat.
5400         (Incremental_relocs_reader::get_r_offset): Reformat.
5401         (Incremental_relocs_reader::data): New function.
5402         (Incremental_binary::Incremental_binary): Initialize new data members.
5403         (Incremental_binary::check_inputs): Add cmdline parameter.
5404         (Incremental_binary::file_is_unchanged): Remove.
5405         (Input_reader::arg_serial): New function.
5406         (Input_reader::get_unused_symbol_count): New function.
5407         (Input_reader::get_unused_symbol): New function.
5408         (Input_reader::do_arg_serial): New function.
5409         (Input_reader::do_get_unused_symbol_count): New function.
5410         (Input_reader::do_get_unused_symbol): New function.
5411         (Incremental_binary::input_file_count): New function.
5412         (Incremental_binary::get_input_reader): Change signature to use
5413         index instead of filename.
5414         (Incremental_binary::file_has_changed): New function.
5415         (Incremental_binary::get_input_argument): New function.
5416         (Incremental_binary::get_library): New function.
5417         (Incremental_binary::get_script_info): New function.
5418         (Incremental_binary::init_layout): New function.
5419         (Incremental_binary::reserve_layout): New function.
5420         (Incremental_binary::output_file): New function.
5421         (Incremental_binary::do_check_inputs): New function.
5422         (Incremental_binary::do_file_is_unchanged): Remove.
5423         (Incremental_binary::do_file_has_changed): New function.
5424         (Incremental_binary::do_init_layout): New function.
5425         (Incremental_binary::do_reserve_layout): New function.
5426         (Incremental_binary::do_input_file_count): New function.
5427         (Incremental_binary::do_get_input_reader): Change signature.
5428         (Incremental_binary::input_args_map_): New data member.
5429         (Incremental_binary::library_map_): New data member.
5430         (Incremental_binary::script_map_): New data member.
5431         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5432         new data members.
5433         (Sized_incremental_binary::output_section): New function.
5434         (Sized_incremental_binary::inputs_reader): Add const.
5435         (Sized_incremental_binary::symtab_reader): Add const.
5436         (Sized_incremental_binary::relocs_reader): Add const.
5437         (Sized_incremental_binary::got_plt_reader): Add const.
5438         (Sized_incremental_binary::get_symtab_view): New function.
5439         (Sized_incremental_binary::Inputs_reader): New typedef.
5440         (Sized_incremental_binary::Input_entry_reader): New typedef.
5441         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5442         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5443         (Sized_incremental_binary::do_file_has_changed): New function.
5444         (Sized_incremental_binary::do_init_layout): New function.
5445         (Sized_incremental_binary::do_reserve_layout): New function.
5446         (Sized_input_reader::Inputs_reader): Remove.
5447         (Sized_input_reader::Input_entry_reader): Remove.
5448         (Sized_input_reader::do_arg_serial): New function.
5449         (Sized_input_reader::do_get_unused_symbol_count): New function.
5450         (Sized_input_reader::do_get_unused_symbol): New function.
5451         (Sized_incremental_binary::do_input_file_count): New function.
5452         (Sized_incremental_binary::do_get_input_reader): Change signature;
5453         use index instead of filename.
5454         (Sized_incremental_binary::section_map_): New data member.
5455         (Sized_incremental_binary::input_entry_readers_): New data member.
5456         (class Sized_incr_relobj): New class.
5457         (class Sized_incr_dynobj): New class.
5458         (make_sized_incremental_object): New function.
5459         (class Incremental_library): New class.
5460         * layout.cc (Free_list::num_lists): New static data member.
5461         (Free_list::num_nodes): New static data member.
5462         (Free_list::num_removes): New static data member.
5463         (Free_list::num_remove_visits): New static data member.
5464         (Free_list::num_allocates): New static data member.
5465         (Free_list::num_allocate_visits): New static data member.
5466         (Free_list::init): New function.
5467         (Free_list::remove): New function.
5468         (Free_list::allocate): New function.
5469         (Free_list::dump): New function.
5470         (Free_list::print_stats): New function.
5471         (Layout_task_runner::run): Resize output file for incremental updates.
5472         (Layout::Layout): Initialize new data members.
5473         (Layout::set_incremental_base): New function.
5474         (Layout::init_fixed_output_section): New function.
5475         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5476         incremental updates.
5477         (Layout::create_gold_note): Do not create gold note section for
5478         incremental updates.
5479         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5480         for incremental updates.
5481         (Layout::set_section_offsets): For incremental updates, allocate space
5482         from free list.
5483         (Layout::create_symtab_sections): Layout with offsets relative to
5484         start of section; for incremental updates, allocate space from free
5485         list.
5486         (Layout::create_shdrs): For incremental updates, allocate space from
5487         free list.
5488         (Layout::finish_dynamic_section): For incremental updates, do not
5489         check --as-needed (fixed in subsequent patch).
5490         * layout.h (class Free_list): New class.
5491         (Layout::set_incremental_base): New function.
5492         (Layout::incremental_base): New function.
5493         (Layout::init_fixed_output_section): New function.
5494         (Layout::allocate): New function.
5495         (Layout::incremental_base_): New data member.
5496         (Layout::free_list_): New data member.
5497         * main.cc (main): Print Free_list statistics.
5498         * object.cc (Relobj::finalize_incremental_relocs): Add
5499         clear_counts parameter; clear counts only when clear_counts is set.
5500         (Sized_relobj::Sized_relobj): Initialize new base class.
5501         (Sized_relobj::do_layout): Don't report special sections.
5502         (Sized_relobj::do_for_all_local_got_entries): New function.
5503         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5504         symtab_off to all symbol table offsets.
5505         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5506         * object.h (class Got_offset_list): Move to top of file.
5507         (Object::Object): Allow case where input_file == NULL.
5508         (Object::~Object): Likewise.
5509         (Object::input_file): Assert that input_file != NULL.
5510         (Object::lock): Allow case where input_file == NULL.
5511         (Object::unlock): Likewise.
5512         (Object::is_locked): Likewise.
5513         (Object::token): Likewise.
5514         (Object::release): Likewise.
5515         (Object::is_incremental): New function.
5516         (Object::get_mtime): New function.
5517         (Object::for_all_local_got_entries): New function.
5518         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5519         (Object::set_is_in_system_directory): New function.
5520         (Object::is_in_system_directory): New function.
5521         (Object::do_is_incremental): New function.
5522         (Object::do_get_mtime): New function.
5523         (Object::do_for_all_local_got_entries): New function.
5524         (Object::is_in_system_directory_): New data member.
5525         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5526         (class Sized_relobj_base): New class.
5527         (class Sized_relobj): Derive from Sized_relobj_base.
5528         (class Sized_relobj::Symbols): Redeclare from base class.
5529         (class Sized_relobj::local_got_offset_list): Remove.
5530         (class Sized_relobj::Output_sections): Redeclare from base class.
5531         (class Sized_relobj::do_for_all_local_got_entries): New function.
5532         (class Sized_relobj::write_local_symbols): Add offset parameter.
5533         (class Sized_relobj::local_symbol_offset_): Update comment.
5534         (class Sized_relobj::local_dynsym_offset_): Update comment.
5535         * options.cc (Input_arguments::add_file): Remove const.
5536         * options.h (Input_file_argument::Input_file_argument):
5537         Initialize arg_serial_ (all constructors).
5538         (Input_file_argument::set_arg_serial): New function.
5539         (Input_file_argument::arg_serial): New function.
5540         (Input_file_argument::arg_serial_): New data member.
5541         (Input_arguments::Input_arguments): Initialize file_count_.
5542         (Input_arguments::add_file): Remove const.
5543         (Input_arguments::number_of_input_files): New function.
5544         (Input_arguments::file_count_): New data member.
5545         (Command_line::number_of_input_files): Call
5546         Input_arguments::number_of_input_files.
5547         * output.cc (Output_segment_headers::Output_segment_headers):
5548         Set current size.
5549         (Output_section::Input_section::current_data_size): New function.
5550         (Output_section::Output_section): Initialize new data members.
5551         (Output_section::add_input_section): Don't do merge sections for
5552         an incremental link; allocate space from free list for an
5553         incremental update.
5554         (Output_section::add_output_section_data): Allocate space from
5555         free list for an incremental update.
5556         (Output_section::update_data_size): New function.
5557         (Output_section::set_fixed_layout): New function.
5558         (Output_section::reserve): New function.
5559         (Output_segment::set_section_addresses): Remove const.
5560         (Output_segment::set_section_list_addresses): Remove const; allocate
5561         space from free list for an incremental update.
5562         (Output_segment::set_offset): Adjust size of RELRO segment for an
5563         incremental update.
5564         * output.h (Output_data::current_data_size): Move here from
5565         child classes.
5566         (Output_data::pre_finalize_data_size): New function.
5567         (Output_data::update_data_size): New function.
5568         (Output_section_headers::update_data_size): new function.
5569         (Output_section_data_build::current_data_size): Move to Output_data.
5570         (Output_data_strtab::update_data_size): New function.
5571         (Output_section::current_data_size): Move to Output_data.
5572         (Output_section::set_fixed_layout): New function.
5573         (Output_section::has_fixed_layout): New function.
5574         (Output_section::reserve): New function.
5575         (Output_section::update_data_size): New function.
5576         (Output_section::has_fixed_layout_): New data member.
5577         (Output_section::free_list_): New data member.
5578         (Output_segment::set_section_addresses): Remove const.
5579         (Output_segment::set_section_list_addresses): Remove const.
5580         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5581         New function.
5582         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5583         New function.
5584         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5585         parameter when calling Add_symbols constructor; store argument
5586         serial number for members of a lib group.
5587         (Add_symbols::locks): Allow case where token == NULL.
5588         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5589         (Read_member::~Read_member): New function.
5590         (Read_member::is_runnable): New function.
5591         (Read_member::locks): New function.
5592         (Read_member::run): New function.
5593         (Check_script::~Check_script): New function.
5594         (Check_script::is_runnable): New function.
5595         (Check_script::locks): New function.
5596         (Check_script::run): New function.
5597         (Check_library::~Check_library): New function.
5598         (Check_library::is_runnable): New function.
5599         (Check_library::locks): New function.
5600         (Check_library::run): New function.
5601         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5602         (Add_symbols::library_): New data member.
5603         (class Read_member): New class.
5604         (class Check_script): New class.
5605         (class Check_library): New class.
5606         * reloc.cc (Read_relocs::is_runnable): Allow case where
5607         token == NULL.
5608         (Read_relocs::locks): Likewise.
5609         (Scan_relocs::locks): Likewise.
5610         (Relocate_task::locks): Likewise.
5611         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5612         to clear counters.
5613         (Sized_relobj::incremental_relocs_scan): Fix comment.
5614         (Sized_relobj::do_relocate): Pass output file offset to
5615         write_local_symbols.
5616         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5617         from class declaration.
5618         * script.cc (read_input_script): Allocate Script_info; pass
5619         argument serial number to report_script.
5620         * script.h (class Script_info): Move to incremental.h.
5621         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5622         * symtab.h (Symbol_table::add_from_incrobj): New function.
5623         (Symbol_table::set_file_offset): New function.
5624
5625 2011-04-05  Cary Coutant  <ccoutant@google.com>
5626
5627         * incremental-dump.cc (dump_incremental_inputs): Change signature
5628         to take a Sized_incremental_binary; change caller.  Use readers
5629         in Sized_incremental_binary.
5630         * incremental.cc
5631         (Sized_incremental_binary::find_incremental_inputs_sections):
5632         Rename do_find_incremental_inputs_sections to this.
5633         (Sized_incremental_binary::setup_readers): New function.
5634         (Sized_incremental_binary::do_check_inputs): Check
5635         has_incremental_info_ flag; move setup code to setup_readers;
5636         use input readers.
5637         (Sized_incremental_binary::do_file_is_unchanged): New function.
5638         (Sized_incremental_binary::do_get_input_reader): New function.
5639         * incremental.h (class Incremental_binary): Move to end of file.
5640         (Incremental_binary::file_is_unchanged): New function.
5641         (Incremental_binary::do_file_is_unchanged): New function.
5642         (Incremental_binary::Input_reader): New class.
5643         (Incremental_binary::get_input_reader): New function.
5644         (class Sized_incremental_binary): Move to end of file.
5645         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5646         input section reader classes.
5647         (Sized_incremental_binary::has_incremental_info): New function.
5648         (Sized_incremental_binary::inputs_reader): New function.
5649         (Sized_incremental_binary::symtab_reader): New function.
5650         (Sized_incremental_binary::relocs_reader): New function.
5651         (Sized_incremental_binary::got_plt_reader): New function.
5652         (Sized_incremental_binary::do_file_is_unchanged): New function.
5653         (Sized_incremental_binary::Sized_input_reader): New class.
5654         (Sized_incremental_binary::get_input_reader): New function.
5655         (Sized_incremental_binary::find_incremental_inputs_sections):
5656         Rename do_find_incremental_inputs_sections to this.
5657         (Sized_incremental_binary::setup_readers): New function.
5658         (Sized_incremental_binary::has_incremental_info_): New data member.
5659         (Sized_incremental_binary::inputs_reader_): New data member.
5660         (Sized_incremental_binary::symtab_reader_): New data member.
5661         (Sized_incremental_binary::relocs_reader_): New data member.
5662         (Sized_incremental_binary::got_plt_reader_): New data member.
5663         (Sized_incremental_binary::current_input_file_): New data member.
5664
5665 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5666
5667         PR gold/12640
5668         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5669         violation.
5670
5671 2011-03-30  Cary Coutant  <ccoutant@google.com>
5672
5673         * archive.cc (Archive::include_member): Adjust call to report_object.
5674         (Add_archive_symbols::run): Add script_info to call to
5675         report_archive_begin.
5676         (Lib_group::include_member): Adjust call to report_object.
5677         (Add_lib_group_symbols::run): Adjust call to report_object.
5678         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5679         blocks.  Add object count for script input files.
5680         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5681         script_info parameter; change all callers.
5682         (Incremental_inputs::report_object): Add script_info parameter;
5683         change all callers.
5684         (Incremental_inputs::report_script): Store backpointer to
5685         incremental info entry.
5686         (Output_section_incremental_inputs::set_final_data_size): Record
5687         additional information for scripts.
5688         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5689         * incremental.h (Incremental_script_entry::add_object): New function.
5690         (Incremental_script_entry::get_object_count): New function.
5691         (Incremental_script_entry::get_object): New function.
5692         (Incremental_script_entry::objects_): New data member; adjust
5693         constructor.
5694         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5695         (Incremental_inputs::report_object): Add script_info parameter.
5696         (Incremental_inputs_reader::get_object_count): New function.
5697         (Incremental_inputs_reader::get_object_offset): New function.
5698         * options.cc (Input_arguments::add_file): Return reference to
5699         new input argument.
5700         * options.h (Input_argument::set_script_info): New function.
5701         (Input_argument::script_info): New function.
5702         (Input_argument::script_info_): New data member; adjust all
5703         constructors.
5704         (Input_file_group::add_file): Return reference to new input argument.
5705         (Input_file_lib::add_file): Likewise.
5706         (Input_arguments::add_file): Likewise.
5707         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5708         * script.cc (Parser_closure::Parser_closure): Add script_info
5709         parameter; adjust all callers.
5710         (Parser_closure::script_info): New function.
5711         (Parser_closure::script_info_): New data member.
5712         (read_input_script): Report scripts earlier to incremental info.
5713         (script_add_file): Set script_info in Input_argument.
5714         (script_add_library): Likewise.
5715         * script.h (Script_options::Script_info): Rewrite class.
5716
5717 2011-03-29  Cary Coutant  <ccoutant@google.com>
5718
5719         * archive.cc (Library_base::should_include_member): Move
5720         method here from class Archive.
5721         (Archive::Archive): Initialize base class.
5722         (Archive::should_include_member): Move to base class.
5723         (Archive::do_for_all_unused_symbols): New function.
5724         (Add_archive_symbols::run): Remove redundant access to
5725         incremental_inputs.
5726         (Lib_group::Lib_group): Initialize base class.
5727         (Lib_group::do_filename): New function.
5728         (Lib_group::include_member): Pass pointer to Lib_group to
5729         report_object.
5730         (Lib_group::do_for_all_unused_symbols): New function.
5731         (Add_lib_group_symbols::run): Report archive information for
5732         incremental links.
5733         * archive.h (class Library_base): New base class.
5734         (class Archive): Derive from Library_base.
5735         (Archive::filename): Move to base class.
5736         (Archive::set_incremental_info): Likewise.
5737         (Archive::incremental_info): Likewise.
5738         (Archive::Should_include): Likewise.
5739         (Archive::should_include_member): Likewise.
5740         (Archive::Armap_entry): Remove.
5741         (Archive::Unused_symbol_iterator): Remove.
5742         (Archive::unused_symbols_begin): Remove.
5743         (Archive::unused_symbols_end): Remove.
5744         (Archive::do_filename): New function.
5745         (Archive::do_get_mtime): New function.
5746         (Archive::do_for_all_unused_symbols): New function.
5747         (Archive::task_): Move to base class.
5748         (Archive::incremental_info_): Likewise.
5749         (class Lib_group): Derive from Library_base.
5750         (Lib_group::do_filename): New function.
5751         (Lib_group::do_get_mtime): New function.
5752         (Lib_group::do_for_all_unused_symbols): New function.
5753         (Lib_group::task_): Move to base class.
5754         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5755         function.
5756         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5757         function.
5758         * incremental.cc (Incremental_inputs::report_archive_begin):
5759         Use Library_base; call library's get_mtime; add incremental inputs
5760         entry before members.
5761         (class Unused_symbol_visitor): New class.
5762         (Incremental_inputs::report_archive_end): Use Library_base; use
5763         visitor class to record unused symbols; don't add incremental inputs
5764         entry after members.
5765         (Incremental_inputs::report_object): Use Library_base.
5766         * incremental.h
5767         (Incremental_archive_entry::Incremental_archive_entry): Remove
5768         unused Archive parameter.
5769         (Incremental_inputs::report_archive_begin): Use Library_base.
5770         (Incremental_inputs::report_archive_end): Likewise.
5771         (Incremental_inputs::report_object): Likewise.
5772         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5773         function.
5774         * object.h (Object::for_all_global_symbols): New function.
5775         (Object::do_for_all_global_symbols): New function.
5776         (Sized_relobj::do_for_all_global_symbols): New function.
5777         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5778         function.
5779         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5780         function.
5781
5782 2011-03-27  Ian Lance Taylor  <iant@google.com>
5783
5784         * archive.cc (Archive::interpret_header): Return -1 if something
5785         goes wrong.  Change callers accordingly.
5786
5787 2011-03-25  Cary Coutant  <ccoutant@google.com>
5788
5789         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5790         * testsuite/Makefile.in: Regenerate.
5791
5792 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5793
5794         * plugin.cc (get_view): New.
5795         (Plugin::load): Pass get_view to the plugin.
5796         (Plugin_manager::get_view): New.
5797
5798 2011-03-21  Ian Lance Taylor  <iant@google.com>
5799
5800         * testsuite/final_layout.sh: Rewrite to not use dc.
5801         * testsuite/relro_test.sh: Fail if dc is not present.
5802
5803 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5804
5805         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5806         Change == to -eq.
5807         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5808         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5809         Change == to -eq.
5810         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5811         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5812
5813 2011-03-14  Ian Lance Taylor  <iant@google.com>
5814
5815         * script-sections.cc (Sort_output_sections::script_compare):
5816         Rename from is_before, change return type.
5817         (Sort_output_sections::operator()): Adjust accordingly.
5818
5819 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5820
5821         PR gold/12572
5822         * testsuite/odr_violation2.cc: Add comment to make all error line
5823         numbers double digits.
5824         * testsuite/debug_msg.sh: Adjust expected errors.
5825
5826 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5827
5828         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5829         but mark earlier ones as non-canonical
5830         (offset_to_iterator): Update search target and example
5831         (do_addr2line): Return extra lines in a vector*
5832         (format_file_lineno): Extract from do_addr2line
5833         (one_addr2line): Add vector* out-param
5834         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5835         when a lineno entry appeared last for its instruction
5836         (Dwarf_line_info): Add vector* out-param
5837         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5838         * symtab.cc (Odr_violation_compare): Include the lineno in the
5839         comparison again.
5840         (linenos_from_loc): New. Combine the canonical line for an
5841         address with its other lines.
5842         (True_if_intersect): New. Helper functor to make
5843         std::set_intersection a query.
5844         (detect_odr_violations): Compare sets of lines instead of just
5845         one line for each function. This became less deterministic, but
5846         has fewer false positives.
5847         * symtab.h: Declarations.
5848         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5849         mix an optimized and non-optimized object in the same binary
5850         (odr_violation2.so): Same.
5851         * testsuite/Makefile.in: Regenerate from Makefile.am.
5852         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5853         * testsuite/debug_msg.sh: Update line numbers and add
5854         assertions.
5855         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5856         non-optimized context.
5857         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5858         isn't inlined, and use OdrDerived in an optimized context.
5859         * testsuite/odr_header1.h: Defines OdrDerived, where
5860         optimization will change the
5861         first-instruction-in-the-destructor's file and line number.
5862         * testsuite/odr_header2.h: Defines OdrBase.
5863
5864 2011-03-09  Ian Lance Taylor  <iant@google.com>
5865
5866         * fileread.cc (File_read::clear_views): Don't delete the whole
5867         file view.
5868
5869 2011-03-08  Ian Lance Taylor  <iant@google.com>
5870
5871         PR gold/12525
5872         * fileread.cc: #include <climits>.
5873         (GOLD_IOV_MAX): Define.
5874         (File_read::read_multiple): Limit number of entries by iov_max.
5875         * fileread.h (class File_read): Always set max_readv_entries to
5876         128.
5877
5878 2011-03-07  Ian Lance Taylor  <iant@google.com>
5879
5880         PR gold/12525
5881         * options.h (class General_options): Add -dy and -dn.
5882
5883 2011-03-02  Cary Coutant  <ccoutant@google.com>
5884
5885         * testsuite/script_test_9.t: Add TLS segment.
5886
5887 2011-03-02  Simon Baldwin  <simonb@google.com>
5888
5889         * configure.ac: Add check for gnu_indirect_function support in
5890         the toolchain building binutils.
5891         * configure: Rebuild.
5892
5893 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5894
5895         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5896         plugin only symbols.
5897         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5898         in plugin files as not needed in the symbol table.
5899
5900 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5901
5902         * output.cc (Output_section::add_input_section): Delay fill
5903         generation for section ordering.
5904
5905 2011-02-09  Ian Lance Taylor  <iant@google.com>
5906
5907         PR gold/12316
5908         * object.h (class Sized_relobj): Remove clear_local_symbols.
5909         * reloc.cc (Sized_relobj::do_relocate): Don't call
5910         clear_local_symbols.
5911
5912 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5913
5914         * plugin.cc (is_visible_from_outside): Return true for symbols
5915         in the -u option.
5916
5917 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5918
5919         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5920         filename.
5921
5922 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5923
5924         * icf.h (is_section_foldable_candidate): Change type of parameter
5925         to std::string.
5926         * icf.cc (Icf::find_identical_sections): Change type of local variable
5927         section_name to be std::string.
5928         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5929
5930 2011-01-25  Ian Lance Taylor  <iant@google.com>
5931
5932         * script.cc (script_add_extern): Rewrite to use
5933         add_symbol_reference.
5934
5935 2011-01-25  Doug Kwan  <dougkwan@google.com>
5936
5937         * icf.cc (get_section_contents): Always lock section's object.
5938
5939 2011-01-24  Ian Lance Taylor  <iant@google.com>
5940
5941         * options.h (class General_options): Accept
5942         --no-detect-odr-violations.
5943
5944 2011-01-24  Ian Lance Taylor  <iant@google.com>
5945
5946         * version.cc (version_string): Bump to 1.11.
5947
5948 2011-01-24  Ian Lance Taylor  <iant@google.com>
5949
5950         * plugin.cc (class Plugin_rescan): Define new class.
5951         (Plugin_manager::claim_file): Set any_claimed_.
5952         (Plugin_manager::save_archive): New function.
5953         (Plugin_manager::save_input_group): New function.
5954         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5955         necessary.
5956         (Plugin_manager::new_undefined_symbol): New function.
5957         (Plugin_manager::rescan): New function.
5958         (Plugin_manager::rescannable_defines): New function.
5959         (Plugin_manager::add_input_file): Set any_added_.
5960         * plugin.h (class Plugin_manager): define new fields rescannable_,
5961         undefined_symbols_, any_claimed_, and any_added_.  Declare
5962         Plugin_rescan as friend.  Declare new functions.
5963         (Plugin_manager::Rescannable): Define type.
5964         (Plugin_manager::Rescannable_list): Define type.
5965         (Plugin_manager::Undefined_symbol_list): Define type.
5966         (Plugin_manager::Plugin_manager): Initialize new fields.
5967         * archive.cc (Archive::defines_symbol): New function.
5968         (Add_archive_symbols::run): Pass archive to plugins if any.
5969         * archive.h (class Archive): Declare defines_symbol.
5970         * readsyms.cc (Input_group::~Input_group): New function.
5971         (Finish_group::run): Pass input_group to plugins if any.
5972         * readsyms.h (class Input_group): Declare destructor.
5973         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5974         any.
5975
5976 2011-01-10  Ian Lance Taylor  <iant@google.com>
5977
5978         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5979         section as relro.
5980         (Layout::set_segment_offsets): Reset increase_relro before calling
5981         set_section_addresses a second time.
5982
5983 2011-01-04  Cary Coutant  <ccoutant@google.com>
5984
5985         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5986         sections before NOBITS sections.
5987
5988 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5989
5990         * version.cc (print_version): Update copyright to 2011.
5991
5992 2010-12-23  Cary Coutant  <ccoutant@google.com>
5993
5994         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5995         of OS to this->add.  Add OD parameter to second form of the function.
5996
5997 2010-12-20  Ian Lance Taylor  <iant@google.com>
5998
5999         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6000         second of two consecutive entries with same offset.
6001
6002 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6003
6004         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6005         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6006         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6007         to avoid unneeded links against $(LDADD).
6008         * testsuite/Makefile.in: Regenerate.
6009
6010 2010-12-15  Ian Lance Taylor  <iant@google.com>
6011
6012         PR gold/12324
6013         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6014         for R_X86_64_32 and R_X86_64_PC32.
6015         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6016         ver_matching_def_pic.o.
6017         (ver_matching_def_pic.o): New target.
6018
6019 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6020
6021         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6022         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6023         Move definition before File_read::View member definitions.
6024         (File_read::View::~View): Initialize and hold lock before
6025         updating current_mapped_bytes.
6026
6027 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6028
6029         * dwarf_reader.cc: Remove outdated comment.
6030         * gold-threads.cc: Fix typo in error message.
6031         * archive.cc: Fix typos in comments.
6032         * archive.h: Likewise.
6033         * arm-reloc-property.cc: Likewise.
6034         * arm-reloc-property.h: Likewise.
6035         * arm-reloc.def: Likewise.
6036         * arm.cc: Likewise.
6037         * attributes.h: Likewise.
6038         * cref.cc: Likewise.
6039         * ehframe.cc: Likewise.
6040         * fileread.h: Likewise.
6041         * gold.h: Likewise.
6042         * i386.cc: Likewise.
6043         * icf.cc: Likewise.
6044         * incremental.h: Likewise.
6045         * int_encoding.cc: Likewise.
6046         * layout.h: Likewise.
6047         * main.cc: Likewise.
6048         * merge.h: Likewise.
6049         * object.cc: Likewise.
6050         * object.h: Likewise.
6051         * options.cc: Likewise.
6052         * readsyms.cc: Likewise.
6053         * reduced_debug_output.cc: Likewise.
6054         * reloc.cc: Likewise.
6055         * script-sections.cc: Likewise.
6056         * sparc.cc: Likewise.
6057         * symtab.h: Likewise.
6058         * target-reloc.h: Likewise.
6059         * target.cc: Likewise.
6060         * target.h: Likewise.
6061         * timer.cc: Likewise.
6062         * timer.h: Likewise.
6063         * x86_64.cc: Likewise.
6064
6065 2010-12-09  Cary Coutant  <ccoutant@google.com>
6066
6067         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6068         stack.
6069         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6070         parameter; change all callers.
6071         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6072         * options.h (warn_execstack): New option.
6073
6074 2010-12-07  Doug Kwan  <dougkwan@google.com>
6075
6076         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6077         like function call relocations.
6078
6079 2010-12-07  Ian Lance Taylor  <iant@google.com>
6080
6081         * archive.cc (Archive::get_elf_object_for_member): Permit
6082         punconfigured to be NULL.
6083         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6084         (Archive::include_member): Pass NULL to get_elf_object_for_member
6085         if we searched for the archive and this is the first included
6086         object.
6087
6088 2010-12-01  Ian Lance Taylor  <iant@google.com>
6089
6090         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6091         track_relocs_type_ field.
6092         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6093         Set track_relocs_type_.
6094         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6095         contents when using RELA relocs.
6096         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6097         reloc_map_.
6098         * reloc.cc (Track_relocs::next_addend): New function.
6099         * reloc.h (class Track_relocs): Declare next_addend.
6100
6101 2010-12-01  Ian Lance Taylor  <iant@google.com>
6102
6103         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6104         virtual destructor.
6105
6106 2010-12-01  Ian Lance Taylor  <iant@google.com>
6107
6108         * README: Update compilers known to work and fail.
6109
6110 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6111
6112         * configure.in: For --enable-gold, handle value `default' instead of
6113         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6114         not the default.
6115         * configure: Regenerate.
6116
6117 2010-11-18  Doug Kwan  <dougkwan@google.com>
6118
6119         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6120         and right_alignment to be zero.  Store result alignment only if it is
6121         greater than existing alignment.
6122
6123 2010-11-16  Cary Coutant  <ccoutant@google.com>
6124
6125         PR gold/12220
6126         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6127         Check for ".zdebug_line".
6128
6129 2010-11-16  Doug Kwan  <dougkwan@google.com>
6130             Cary Coutant  <ccoutant@google.com>
6131
6132         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6133         by reference; adjust all callers.
6134         * output.cc (Output_segment::set_section_addresses): Adjust references
6135         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6136         list is empty.
6137         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6138         end at page boundary.
6139
6140 2010-11-16  Cary Coutant  <ccoutant@google.com>
6141
6142         PR gold/12220
6143         * layout.cc (Layout::choose_output_section): Transform names of
6144         compressed sections even when using a script with a SECTIONS clause.
6145         (Layout::output_section_name): Remove code to transform
6146         compressed debug section names.
6147         * output.cc (Output_section::add_input_section): Use uncompressed
6148         section size when tracking input sections.
6149
6150 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6151
6152         * symtab.h (Symbol::NON_PIC_REF): Remove.
6153         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6154         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6155         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6156         (Symbol::use_plt_offset): Take a flags argument and pass it
6157         directly to needs_dynamic_reloc.  Restrict check for undefined
6158         weak symbols to function calls.
6159         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6160         (Target_arm::Scan::global): Use it.
6161         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6162         (Target_arm::Relocate::relocate): Likewise.
6163         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6164         parameter with an r_type parameter.  Use get_reference_flags
6165         to get the flags.
6166         (Target_arm::Relocate::relocate): Update accordingly.
6167         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6168         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6169         (Target_i386::Scan::global): Likewise.
6170         (Target_i386::Relocate::relocate): Likewise.
6171         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6172         parameter with an r_type parameter.  Use get_reference_flags
6173         to get the flags.
6174         (Target_i386::Relocate::relocate): Update accordingly.
6175         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6176         (Target_powerpc::Scan::global): Use it.
6177         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6178         (Target_powerpc::Relocate::relocate): Likewise.
6179         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6180         (Target_sparc::Scan::global): Use it.
6181         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6182         (Target_sparc::Relocate::relocate): Likewise.
6183         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6184         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6185         (Target_x86_64::Scan::global): Likewise.
6186         (Target_x86_64::Relocate::relocate): Likewise.
6187
6188 2010-11-08  Doug Kwan  <dougkwan@google.com>
6189             Cary Coutant  <ccoutant@google.com>
6190
6191         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6192         (Arm_exidx_merge_section::section_contents_): New data member.
6193         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6194         (Arm_input_section::~Arm_input_section): De-allocate memory.
6195         (Arm_input_section::original_contents_): New data member.
6196         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6197         in parameters instead of calling Object::section_contents without
6198         locking.
6199         (Arm_output_section::group_section): New parameter TASK.  Pass it
6200         to callees that need locking objects.
6201         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6202         to lock EXIDX input sections.  Fix a formatting issue.  Call
6203         Arm_exidx_merged_section::build_contents to create merged section
6204         contents.
6205         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6206         to lock object of stub table owner.
6207         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6208         TEXT_SIZE to initialize data member TEXT_SIZE_.
6209         (Arm_exidx_input_section::addralign): Fix typo in comment.
6210         (Arm_exidx_input_section::text_size): New method.
6211         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6212         that require locking objects.  Lock objects before scanning for stubs
6213         and updating local symbols.
6214         (Arm_input_section<big_endian>::init): Copy contents of original
6215         input section.
6216         (Arm_input_section<big_endian>::do_write): Use saved contents of
6217         original input section instead of calling Object::section_contents
6218         without locking.
6219         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6220         size without calling Object::section_size().
6221         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6222         for size.  Allocate a buffer for merged EXIDX entries.
6223         (Arm_exidx_merged_section::build_contents): New method.
6224         (Arm_exidx_merged_section::do_write): Move merge section contents
6225         building code to Arm_exidx_merged_section::build_contetns.  Write
6226         out contetns in buffer instead of building it on the fly.
6227         (Arm_relobj::make_exidx_input_section): Also pass text section size
6228         to Arm_exidx_input_section constructor.
6229         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6230         (Arm_dynobj::do_read_symbols): Fix memory leak.
6231         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6232         * target.h: (class Task): Add forward declaration.
6233         (Target::relax): Add new parameter TASK and pass it to
6234         Target::do_relax().
6235         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6236
6237 2010-11-05  Cary Coutant  <ccoutant@google.com>
6238
6239         PR gold/10708
6240         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6241         object when reading from the file.
6242         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6243         second layout pass.
6244         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6245         when reading section contents.
6246         (get_section_contents): Likewise.
6247         (icf::find_identical_sections): Likewise.
6248         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6249         object when reading from the file.
6250         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6251         the object when doing deferred section layout.
6252
6253 2010-11-03  Nick Clifton  <nickc@redhat.com>
6254
6255         PR gold/12001
6256         * script.h (class Symbol_assignment: name): New member.  Returns
6257         the name of the symbol.
6258         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6259         Returns true if the given symbol name is on the list of
6260         assignments wating to be processed.
6261         * archive.cc (should_incldue_member): If the symbol is undefined,
6262         check to see if it is on the list of symbols pending assignment.
6263
6264 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6265
6266         * script-sections.cc (Script_sections::find_memory_region): Check
6267         for a NULL output section pointer.
6268
6269 2010-10-29  Doug Kwan  <dougkwan@google.com>
6270
6271         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6272         Output_section::add_relaxed_input_section.
6273         * output.cc (Output_section::add_relaxed_input_section): Add new
6274         arguments LAYOUT and NAME.  Set section order index.
6275         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6276         Copy section order index.
6277         * output.h (Output_section::add_relaxed_input_section): Add new
6278         arguments LAYOUT and NAME.
6279
6280 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6281
6282         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6283         NATIVE_OR_CROSS_LINKER.
6284         * testsuite/Makefile.in: Regenerate.
6285
6286 2010-10-20  Doug Kwan  <dougkwan@google.com>
6287
6288         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6289         without SHF_LINK_ORDER flags.
6290         * layout.cc (Layout::choose_output_section): Do not filter
6291         SHF_LINK_ORDER flag in a relocatable link.
6292
6293 2010-10-17  Cary Coutant  <ccoutant@google.com>
6294
6295         * output.h (Output_segment::set_section_addresses): Change function
6296         signature.  Update all callers.
6297         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6298         sections.
6299         (Output_segment::set_section_addresses): Align after last TLS
6300         section.  Add padding before last relro section instead of after.
6301
6302 2010-10-17  Doug Kwan  <dougkwan@google.com>
6303
6304         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6305         GOT output section to be writable.
6306
6307 2010-10-14  Cary Coutant  <ccoutant@google.com>
6308
6309         * debug.h (DEBUG_INCREMENTAL): New flag.
6310         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6311         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6312         mode.
6313         * incremental.cc (report_command_line): Ignore all forms of
6314         --incremental.
6315         * layout.cc (Layout::Layout): Check parameters for incremental link
6316         mode.
6317         * options.cc (General_options::parse_incremental): New function.
6318         (General_options::parse_no_incremental): New function.
6319         (General_options::parse_incremental_full): New function.
6320         (General_options::parse_incremental_update): New function.
6321         (General_options::incremental_mode_): New data member.
6322         (General_options::finalize): Check incremental_mode_.
6323         * options.h (General_options): Update help text for --incremental.
6324         Add --no-incremental, --incremental-full, --incremental-update.
6325         (General_options::Incremental_mode): New enum type.
6326         (General_options::incremental_mode): New function.
6327         (General_options::incremental_mode_): New data member.
6328         * parameters.cc (Parameters::incremental_mode_): New data member.
6329         (Parameters::set_options): Set incremental_mode_.
6330         (Parameters::set_incremental_full): New function.
6331         (Parameters::incremental): New function.
6332         (Parameters::incremental_update): New function.
6333         (set_parameters_incremental_full): New function.
6334         * parameters.h (Parameters::set_incremental_full): New function.
6335         (Parameters::incremental): New function.
6336         (Parameters::incremental_update): New function.
6337         (Parameters::incremental_mode_): New data member.
6338         (set_parameters_incremental_full): New function.
6339         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6340         incremental link mode.
6341         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6342         (Sized_relobj::do_relocate_sections): Likewise.
6343         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6344         option.
6345         * testsuite/Makefile.in: Regenerate.
6346         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6347
6348 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6349
6350         * script-sections.h (class Script_sections): Make
6351         Sections_elements typedef public.
6352         * script-sections.cc (class Sort_output_sections): Add elements_
6353         field.  Add constructor which sets it; change all callers.
6354         (Sort_output_sections::is_before): New function.
6355         (Sort_output_sections::operator()): Call is_before.
6356         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6357         conditional.
6358         * testsuite/script_test_10.sh: New test. Test script section
6359         order.
6360         * testsuite/script_test_10.t: Likewise.
6361         * testsuite/script_test_10.s: Likewise.
6362         * testsuite/Makefile.am: Wrap the cross linker tests and the
6363         common tests into NATIVE_OR_CROSS_LINKER.
6364         (check_SCRIPTS): Add script_test_10.sh.
6365         (check_DATA): Add script_test_10.stdout.
6366         (script_test_10.o, script_test_10): New targets.
6367         (script_test_10.stdout): New target.
6368         * configure, testsuite/Makefile.in: Regenerate.
6369
6370 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6371
6372         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6373         error for the deprecated relocations.
6374         (Target_arm::Scan::global): Likewise.
6375         (Target_arm::Relocate::relocate): Likewise.
6376
6377 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6378
6379         * fileread.cc (Input_file::find_file): Initialize *found_name
6380         and *namep when using the fallback search for case 4.
6381
6382 2010-10-11  Cary Coutant  <ccoutant@google.com>
6383
6384         * options.h (class General_options): Redefine -z lazy as an alias for
6385         the negation of -z now.
6386
6387 2010-10-11  Ian Lance Taylor  <iant@google.com>
6388
6389         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6390         binding.
6391
6392 2010-10-06  Nick Clifton  <nickc@redhat.com>
6393
6394         * script-sections.cc(class Memory_region): Remove
6395         current_lma_offset_ field.  Rename current_vma_offset_ to
6396         current_offset_.  Add last_section_ field.
6397         (Memory_region::get_current_vma_address): Rename to
6398         get_current_address.
6399         (Memory_region::get_current_lma_address): Delete.
6400         (Memory_region::increment_vma_offset): Rename to
6401         increment_offset.
6402         (Memory_region::increment_lma_offset): Delete.
6403         (Memory_region::attributes_compatible): New method.  Returns
6404         true if the provided section is compatible with the region.
6405         (Memory_region::get_last_section): New method.  Returns the last
6406         section to use the region.
6407         (Memory_region::set_last_section): New method.  Stores the last
6408         section to use the region.
6409         (Script_sections::block_in_region): New method.  Returns true if
6410         a block of memory is contained within a region.
6411         (Script_sections::find_memory_region): New method.  Locates a
6412         memory region to be used to set a VMA or LMA address.
6413         (Output_section_definition::set_section_addresses): Add code to
6414         check for addresses set by memory regions.
6415         (Output_segment::set_section_addresses): Remove memory region
6416         walking code.
6417         (Script_sections::create_segment): Add a warning if a header
6418         segment is created outside of any region.
6419         * script-sections.h (class Script_sections): Add prototypes for
6420         find_memory_region and block_in_region methods.
6421         * testsuite/memory_test.s: Use .long instead of .word.
6422         * testsuite/memory_test.t: Add some more output sections.
6423         * testsuite/memory_test.sh: Update expected output.
6424
6425 2010-10-02  Doug Kwan  <dougkwan@google.com>
6426
6427         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6428         defintion to symtab.h
6429         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6430         declaration to defintion.
6431
6432 2010-10-01  Nick Clifton  <nickc@redhat.com>
6433
6434         * expression.cc (eval): Replace dummy argument with NULL.
6435         (eval_maybe_dot): Check for a NULL result section pointer.
6436         (Symbol_expression::value): Likewise.
6437         (Dot_expression::value): Likewise.
6438         (BINARY_EXPRESSION): Likewise.
6439         (Max_expression::value): Likewise.
6440         (Min_expression::value): Likewise.
6441         (Absolute_expression::value): Likewise.
6442         (Addr_expression::value_from_output_section): Likewise.
6443         (Loaddddr_expression::value_from_output_section): Likewise.
6444         (Segment_start_expression::value): Likewise.
6445         * script-sections.cc
6446         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6447         argument with NULL.
6448         (Sections_elememt_dot_assignment::set_section_addresses):
6449         Likewise.
6450         (Output_data_expression::do_write_to_buffer): Likewise.
6451         (Output_section_definition::finalize_symbols): Likewise.
6452         (Output_section_definition::set_section_addresses): Likewise.
6453
6454 2010-09-30  Doug Kwan  <dougkwan@google.com>
6455
6456         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6457
6458 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6459
6460         * target.h (Target::can_icf_inline_merge_sections): New virtual
6461         function.
6462         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6463         virtual function.
6464         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6465         virtual function.
6466         * icf.cc (get_section_contents): Inline merge sections only when
6467         target allows it.
6468
6469 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6470
6471         * configure: Regenerate.
6472
6473 2010-09-17  Ian Lance Taylor  <iant@google.com>
6474
6475         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6476         * testsuite/Makefile.am (memory_test.o): New target.
6477         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6478         memory_test.t.
6479         * testsuite/Makefile.in: Rebuild.
6480
6481 2010-09-17  Doug Kwan  <dougkwan@google.com>
6482
6483         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6484         defintion if relocation uses GOT entries of the symbol.
6485         * testsuite/icf_safe_test.sh: Fix test.
6486         * testsuite/icf_safe_so_test.sh: Fix test.
6487
6488 2010-09-16  Cary Coutant  <ccoutant@google.com>
6489
6490         * script_sections.cc (class Memory_region): Remove "NULL" from
6491         vector initializations.
6492
6493 2010-09-15  Cary Coutant  <ccoutant@google.com>
6494
6495         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6496         Resolve forwarding symbols.
6497
6498 2010-09-15  Doug Kwan  <dougkwan@google.com>
6499
6500         * gold/testsuite/script_test_3.t: Add ARM special sections.
6501         * gold/testsuite/script_test_4.t: Same.
6502         * gold/testsuite/script_test_5.t: Same.
6503         * gold/testsuite/script_test_6.t: Same.
6504         * gold/testsuite/script_test_7.t: Same.
6505         * gold/testsuite/script_test_7.t: Same.
6506         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6507
6508 2010-09-14  Cary Coutant  <ccoutant@google.com>
6509
6510         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6511         (Target_x86_64::Relocate::relocate_tls): Replace check for
6512         saw_tls_block_reloc_ with test for executable section.
6513
6514 2010-09-12  Cary Coutant  <ccoutant@google.com>
6515
6516         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6517         position-independent executables to shared libraries need dynamic
6518         relocations.
6519         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6520         position-independent executables.
6521         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6522         * testsuite/Makefile.in: Regenerate.
6523
6524 2010-09-10  Nick Clifton  <nickc@redhat.com>
6525
6526         PR gold/11997
6527         * testsuite/memory_test.t: Discard any sections that are not
6528         needed.
6529
6530 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6531
6532         PR gold/11996
6533         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6534         "This::" to work around a bug in gcc 4.2.
6535
6536         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6537
6538 2010-09-09  Rafael Espindola  <espindola@google.com>
6539
6540         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6541         sections with different PF_X flags in the same segment.
6542         (Layout::find_first_load_seg): Search all segments to find the first
6543         one.
6544         * options.h (rosegment): New.
6545
6546 2010-09-08  Rafael Espindola  <espindola@google.com>
6547
6548         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6549
6550 2010-09-08  Doug Kwan  <dougkwan@google.com>
6551
6552         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6553         (Arm_relobj::do_relocate_sections): Add new parameter for output
6554         file to match the parent.
6555         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6556         of local symbols instead of input values.  Update code to track
6557         changes in gold::relocate_section.
6558         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6559         (Sized_relobj::compute_final_local_value_internal): New methods.
6560         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6561         body into private version of Sized_relobj::compute_final_local_value.
6562         Call the inline method.
6563         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6564         merged symbol value if there is one.
6565         (Symbol_value::has_output_value): New method defintiion.
6566         (Sized_relobj::Compute_final_local_value_status): New enum type.
6567         (Sized_relobj::compute_final_local_value): New methods.
6568         (Sized_relobj::compute_final_local_value_internal): New methods.
6569         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6570         and arm_cortex_a8.sh.
6571         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6572         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6573         New tests.
6574         * Makefile.in: Regenerate.
6575         * testsuite/arm_bl_out_of_range.s: Update test.
6576         * testsuite/thumb_bl_out_of_range.s: Ditto.
6577         * testsuite/thumb_blx_out_of_range.s: Ditto.
6578         * testsuite/arm_branch_out_of_range.sh: New file.
6579         * testsuite/arm_cortex_a8.sh: Ditto.
6580         * testsuite/arm_cortex_a8_b.s: Ditto.
6581         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6582         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6583         * testsuite/arm_cortex_a8_bl.s: Ditto.
6584         * testsuite/arm_cortex_a8_blx.s: Ditto.
6585         * testsuite/arm_cortex_a8_local.s: Ditto.
6586         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6587         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6588
6589 2010-09-08  Rafael Espindola  <espindola@google.com>
6590
6591         * Makefile.am (memory_test.stdout): Run readelf with -W.
6592         * Makefile.in: Regenerate.
6593         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6594         64 bit output.
6595
6596 2010-09-08  Rafael Espindola  <espindola@google.com>
6597
6598         * script-sections.cc (Script_sections::add_memory_region): Convert
6599         field precision to int.
6600         * script.cc (script_set_section_region, script_set_section_region):
6601         Convert field precision to int.
6602
6603 2010-09-08  Rafael Espindola  <espindola@google.com>
6604
6605         * arm.cc (do_finalize_sections): Create the __exidx_start and
6606         __exdix_end symbols even when the section is missing.
6607
6608 2010-09-08  Nick Clifton  <nickc@redhat.com>
6609
6610         * README: Remove claim that MEMORY is not supported.
6611         * expression.cc (script_exp_function_origin)
6612         (script_exp_function_length): Move from here to ...
6613         * script.cc: ... here.
6614         (script_set_section_region, script_add_memory)
6615         (script_parse_memory_attr, script_include_directive): New
6616         functions.
6617         * script-sections.cc
6618         (class Memory_region): New class.
6619         (class Output_section_definition): Add set_memory_region,
6620         set_section_vma, set_section_lma and get_section_name methods.
6621         (class Script_Sections): Add add_memory_region,
6622         find_memory_region, find_memory_region_origin,
6623         find_memory_region_length and set_memory_region methods.
6624         Have set_section_addresses method walk the list of set memory
6625         regions.
6626         Extend the print methos to display memory regions.
6627         * script-sections.h: Add prototypes for new methods.
6628         Add enum for MEMORY region attributes.
6629         * yyscript.y: Add support for parsing MEMORY regions.
6630         * script-c.h: Add prototypes for new functions.
6631         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6632         * testsuite/Makefile.in: Regenerate.
6633         * testsuite/memory_test.sh: New script.
6634         * testsuite/memory_test.s: New assembler source file.
6635         * testsuite/memory_test.t: New linker script.
6636
6637 2010-08-27  Doug Kwan  <dougkwan@google.com>
6638
6639         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6640         reference override an existing dynamic weak reference.
6641         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6642         * testsuite/Makefile.in: Regenerate.
6643         * testsuite/dyn_weak_ref.sh: New file.
6644         * testsuite/dyn_weak_ref_1.c: Ditto.
6645         * testsuite/dyn_weak_ref_2.c: Ditto.
6646
6647 2010-08-27  Ian Lance Taylor  <iant@google.com>
6648
6649         * incremental.h (class Incremental_input_entry): Add virtual
6650         destructor.
6651
6652 2010-08-27  Ian Lance Taylor  <iant@google.com>
6653
6654         * testsuite/start_lib_test_3.c: Mark t3 as used.
6655
6656 2010-08-27  Nick Clifton  <nickc@redhat.com>
6657
6658         * options.cc (version_script): Fix small typo in previous
6659         whitespace tidyup.
6660
6661 2010-08-25  Nick Clifton  <nickc@redhat.com>
6662
6663         * archive.cc: Formatting fixes: Remove whitespace between
6664         typename and following asterisk.  Remove whitespace between
6665         function name and opening parenthesis.
6666         * archive.h: Likewise.
6667         * arm.cc: Likewise.
6668         * attributes.cc: Likewise.
6669         * attributes.h: Likewise.
6670         * common.cc: Likewise.
6671         * copy-relocs.cc: Likewise.
6672         * dirsearch.h: Likewise.
6673         * dynobj.cc: Likewise.
6674         * ehframe.cc: Likewise.
6675         * ehframe.h: Likewise.
6676         * expression.cc: Likewise.
6677         * fileread.cc: Likewise.
6678         * fileread.h: Likewise.
6679         * gc.h: Likewise.
6680         * gold-threads.cc: Likewise.
6681         * gold.cc: Likewise.
6682         * i386.cc: Likewise.
6683         * icf.h: Likewise.
6684         * incremental-dump.cc: Likewise.
6685         * incremental.cc: Likewise.
6686         * layout.cc: Likewise.
6687         * layout.h: Likewise.
6688         * main.cc: Likewise.
6689         * merge.cc: Likewise.
6690         * merge.h: Likewise.
6691         * object.cc: Likewise.
6692         * object.h: Likewise.
6693         * options.cc: Likewise.
6694         * options.h: Likewise.
6695         * output.cc: Likewise.
6696         * output.h: Likewise.
6697         * plugin.cc: Likewise.
6698         * plugin.h: Likewise.
6699         * powerpc.cc: Likewise.
6700         * reloc.cc: Likewise.
6701         * script-c.h: Likewise.
6702         * script-sections.cc: Likewise.
6703         * script.cc: Likewise.
6704         * stringpool.cc: Likewise.
6705         * symtab.cc: Likewise.
6706         * symtab.h: Likewise.
6707         * target.cc: Likewise.
6708         * timer.cc: Likewise.
6709         * timer.h: Likewise.
6710         * version.cc: Likewise.
6711         * x86_64.cc: Likewise.
6712
6713 2010-08-24  Nick Clifton  <nickc@redhat.com>
6714
6715         PR 11899
6716         * layout.cc (segment_precedes): Sort segments by their physical
6717         addresses, if they have been set.
6718
6719 2010-08-23  Cary Coutant  <ccoutant@google.com>
6720
6721         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6722         symbols data.
6723         (Lib_group::include_member): Unlock object after deleting its
6724         symbols data.
6725         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6726         the bug fixed here.
6727
6728 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6729             Cary Coutant  <ccoutant@google.com>
6730
6731         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6732         constructor, and set_blocker.
6733         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6734         readsyms_blocker_.
6735         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6736         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6737         * testsuite/Makefile.am (start_lib_test): New test case.
6738         * testsuite/Makefile.in: Regenerate.
6739         * testsuite/start_lib_test_main.c: New file.
6740         * testsuite/start_lib_test_1.c: New file.
6741         * testsuite/start_lib_test_2.c: New file.
6742         * testsuite/start_lib_test_3.c: New file.
6743
6744 2010-08-19  Ian Lance Taylor  <iant@google.com>
6745
6746         * Makefile.in: Rebuild with automake 1.11.1.
6747         * aclocal.m4: Likewise.
6748         * testsuite/Makefile.in: Likewise.
6749
6750 2010-08-19  Ian Lance Taylor  <iant@google.com>
6751
6752         PR 10893
6753         * i386.cc (class Output_data_plt_i386): Update declarations.
6754         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6755         local_ifuncs_ fields.
6756         (Target_i386::do_plt_section_for_global): New function.
6757         (Target_i386::do_plt_section_for_local): New function.
6758         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6759         parameter; change all callers.  Initialize global_ifuncs_ and
6760         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6761         __rel_iplt_end.
6762         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6763         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6764         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6765         symbols.
6766         (Target_i386::make_plt_section): New function, broken out of
6767         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6768         (Target_i386::make_plt_entry): Call make_plt_section.
6769         (Target_i386::make_local_ifunc_plt_entry): New function.
6770         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6771         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6772         R_386_IRELATIVE to switch.
6773         (Target_i386::Scan::global): Likewise.
6774         (Target_i386::Relocate::relocate): Likewise.
6775         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6776         switch.
6777         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6778         (Target_x86_64::do_plt_section_for_global): New function.
6779         (Target_x86_64::do_plt_section_for_local): New function.
6780         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6781         parameter; change all callers.  If doing a static link define
6782         __rela_iplt_start and __rela_iplt_end.
6783         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6784         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6785         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6786         to point to .plt.
6787         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6788         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6789         switch.
6790         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6791         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6792         R_X86_64_IRELATIVE to switch.
6793         (Target_x86_64::Scan::global): Likewise.
6794         (Target_x86_64::Relocate::relocate): Likewise.
6795         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6796         switch.
6797         * target.h (class Target): Add plt_section_for_global and
6798         plt_section_for_local functions.  Add do_plt_section_for_global
6799         and do_plt_section_for_local virtual functions.
6800         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6801         clarifying comments.
6802         (Symbol::use_plt_offset): Handle IFUNC symbol.
6803         * object.cc (Sized_relobj::Sized_relobj): Initialize
6804         local_plt_offsets_.
6805         (Sized_relobj::local_has_plt_offset): New function.
6806         (Sized_relobj::local_plt_offset): New function.
6807         (Sized_relobj::set_local_plt_offset): New function.
6808         (Sized_relobj::do_count): Handle IFUNC symbol.
6809         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6810         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6811         is_ifunc_symbol functions.
6812         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6813         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6814         local_plt_offsets_ field.
6815         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6816         * output.h (class Output_section_data): Add non-const
6817         output_section function.
6818         (class Output_data_got): Update declarations.
6819         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6820         Add use_plt_offset parameter to global and local constructors.
6821         Change all callers.  Change local_sym_index_ field to 31 bits.
6822         Change GSYM_CODE and CONSTANT_CODE accordingly.
6823         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6824         doing a static link don't set sh_link field.
6825         (Output_data_got::Got_entry::write): Use PLT offset if
6826         appropriate.
6827         (Output_data_got::add_global_plt): New function.
6828         (Output_data_got::add_local_plt): New function.
6829         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6830         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6831         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6832         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6833         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6834         IFUNC conditional.
6835         * testsuite/ifunc-sel.h: New file.
6836         * testsuite/ifuncmain1.c: New file.
6837         * testsuite/ifuncmain1vis.c: New file.
6838         * testsuite/ifuncmod1.c: New file.
6839         * testsuite/ifuncdep2.c: New file.
6840         * testsuite/ifuncmain2.c: New file.
6841         * testsuite/ifuncmain3.c: New file.
6842         * testsuite/ifuncmod3.c: New file.
6843         * testsuite/ifuncmain4.c: New file.
6844         * testsuite/ifuncmain5.c: New file.
6845         * testsuite/ifuncmod5.c: New file.
6846         * testsuite/ifuncmain6pie.c: New file.
6847         * testsuite/ifuncmod6.c: New file.
6848         * testsuite/ifuncmain7.c: New file.
6849         * configure, testsuite/Makefile.in: Rebuild.
6850
6851 2010-08-18  Ian Lance Taylor  <iant@google.com>
6852
6853         * incremental.cc
6854         (Output_section_incremental_inputs::write_input_files): Add cast
6855         to avoid signed/unsigned comparison warning.
6856         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6857
6858 2010-08-12  Cary Coutant  <ccoutant@google.com>
6859
6860         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6861
6862 2010-08-13  Ian Lance Taylor  <iant@google.com>
6863
6864         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6865
6866 2010-08-12  Cary Coutant  <ccoutant@google.com>
6867             Doug Kwan  <dougkwan@google.com>
6868
6869         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6870         defintion overrides non-weak undef, remember that the original undef
6871         is not weak.
6872         * symtab.cc (Symbol_table::sized_write_global): For undef without
6873         an original weak binding, set binding to global in output.
6874         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6875         * testsuite/Makefile.in: Regenerate.
6876         * testsuite/strong_ref_weak_def.sh: New file.
6877         * testsuite/strong_ref_weak_def_1.c: Ditto.
6878         * testsuite/strong_ref_weak_def_2.c: Ditto.
6879
6880 2010-08-12  Cary Coutant  <ccoutant@google.com>
6881
6882         * testsuite/incremental_test.sh: Rewrite.
6883         * testsuite/incremental_test_1.c: Rewrite.
6884         * testsuite/incremental_test_2.c: Rewrite.
6885
6886 2010-08-12  Cary Coutant  <ccoutant@google.com>
6887
6888         * arm.cc (Target_arm::got_size): Add const.
6889         (Target_arm::got_entry_count): New function.
6890         (Target_arm::plt_entry_count): New function.
6891         (Target_arm::first_plt_entry_offset): New function.
6892         (Target_arm::plt_entry_size): New function.
6893         (Output_data_plt_arm::entry_count): New function.
6894         (Output_data_plt_arm::first_plt_entry_offset): New function.
6895         (Output_data_plt_arm::get_plt_entry_size): New function.
6896         * i386.cc (Target_i386::got_size): Add const.
6897         (Target_i386::got_entry_count): New function.
6898         (Target_i386::plt_entry_count): New function.
6899         (Target_i386::first_plt_entry_offset): New function.
6900         (Target_i386::plt_entry_size): New function.
6901         (Output_data_plt_i386::entry_count): New function.
6902         (Output_data_plt_i386::first_plt_entry_offset): New function.
6903         (Output_data_plt_i386::get_plt_entry_size): New function.
6904         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6905         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6906         * incremental.cc: Include target.h.
6907         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6908         parameter.  Adjust all callers.  Find incremental_got_plt section.
6909         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6910         section.
6911         (Output_section_incremental_inputs::set_final_data_size): Calculate
6912         size of incremental_got_plt section.
6913         (Output_section_incremental_inputs::do_write): Write the
6914         incremental_got_plt section.
6915         (Got_plt_view_info): New struct.
6916         (Local_got_offset_visitor): New class.
6917         (Global_got_offset_visitor): New class.
6918         (Global_symbol_visitor_got_plt): New class.
6919         (Output_section_incremental_inputs::write_got_plt): New function.
6920         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6921         Add parameter.  Adjust all callers.
6922         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6923         (Incremental_inputs::got_plt_section): New function.
6924         (Incremental_inputs::got_plt_section_): New data member.
6925         (Incremental_got_plt_reader): New class.
6926         * layout.cc (Layout::create_incremental_info_sections): Add the
6927         incremental_got_plt section.
6928         * object.h (Got_offset_list::get_list): New function.
6929         (Got offset_list::for_all_got_offsets): New function.
6930         (Sized_relobj::local_got_offset_list): New function.
6931         * powerpc.cc (Target_powerpc::got_size): Add const.
6932         (Target_powerpc::got_entry_count): New function.
6933         (Target_powerpc::plt_entry_count): New function.
6934         (Target_powerpc::first_plt_entry_offset): New function.
6935         (Target_powerpc::plt_entry_size): New function.
6936         (Output_data_plt_powerpc::entry_count): New function.
6937         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6938         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6939         * sparc.cc (Target_sparc::got_size): Add const.
6940         (Target_sparc::got_entry_count): New function.
6941         (Target_sparc::plt_entry_count): New function.
6942         (Target_sparc::first_plt_entry_offset): New function.
6943         (Target_sparc::plt_entry_size): New function.
6944         (Output_data_plt_sparc::entry_count): New function.
6945         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6946         (Output_data_plt_sparc::get_plt_entry_size): New function.
6947         * symtab.h (Symbol::got_offset_list): New function.
6948         (Symbol_table::for_all_symbols): New function.
6949         * target.h (Sized_target::got_entry_count): New function.
6950         (Sized_target::plt_entry_count): New function.
6951         (Sized_target::plt_entry_size): New function.
6952         * x86_64.cc (Target_x86_64::got_size): Add const.
6953         (Target_x86_64::got_entry_count): New function.
6954         (Target_x86_64::plt_entry_count): New function.
6955         (Target_x86_64::first_plt_entry_offset): New function.
6956         (Target_x86_64::plt_entry_size): New function.
6957         (Output_data_plt_x86_64::entry_count): New function.
6958         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6959         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6960
6961 2010-08-12  Cary Coutant  <ccoutant@google.com>
6962
6963         * archive.cc: Include incremental.h.
6964         (Archive::Archive): Initialize incremental_info_.
6965         (Archive::include_member): Record archive members in incremental info.
6966         (Add_archive_symbols::run): Record begin and end of an archive in
6967         incremental info.
6968         (Lib_group::include_member): Record objects in incremental info.
6969         * archive.h (Incremental_archive_entry): Forward declaration.
6970         (Archive::set_incremental_info): New member function.
6971         (Archive::incremental_info): New member function.
6972         (Archive::Unused_symbol_iterator): New class.
6973         (Archive::unused_symbols_begin): New member function.
6974         (Archive::unused_symbols_end): New member function.
6975         (Archive::incremental_info_): New data member.
6976         * incremental-dump.cc (find_input_containing_global): New function.
6977         (dump_incremental_inputs): Dump new incremental info sections.
6978         * incremental.cc: Include symtab.h.
6979         (Output_section_incremental_inputs): New class.
6980         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6981         new incremental info sections.
6982         (Sized_incremental_binary::do_check_inputs): Likewise.
6983         (Incremental_inputs::report_archive): Remove.
6984         (Incremental_inputs::report_archive_begin): New function.
6985         (Incremental_inputs::report_archive_end): New function.
6986         (Incremental_inputs::report_object): New function.
6987         (Incremental_inputs::finalize_inputs): Remove.
6988         (Incremental_inputs::report_input_section): New function.
6989         (Incremental_inputs::report_script): Rewrite.
6990         (Incremental_inputs::finalize): Do nothing but finalize string table.
6991         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6992         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6993         (Incremental_inputs::create_data_sections): New function.
6994         (Incremental_inputs::relocs_entsize): New function.
6995         (Output_section_incremental_inputs::set_final_data_size): New function.
6996         (Output_section_incremental_inputs::do_write): New function.
6997         (Output_section_incremental_inputs::write_header): New function.
6998         (Output_section_incremental_inputs::write_input_files): New function.
6999         (Output_section_incremental_inputs::write_info_blocks): New function.
7000         (Output_section_incremental_inputs::write_symtab): New function.
7001         * incremental.h (Incremental_script_entry): Forward declaration.
7002         (Incremental_object_entry): Forward declaration.
7003         (Incremental_archive_entry): Forward declaration.
7004         (Incremental_inputs): Forward declaration.
7005         (Incremental_inputs_header_data): Remove.
7006         (Incremental_inputs_header): Remove.
7007         (Incremental_inputs_header_write): Remove.
7008         (Incremental_inputs_entry_data): Remove.
7009         (Incremental_inputs_entry): Remove.
7010         (Incremental_inputs_entry_write): Remove.
7011         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7012         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7013         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7014         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7015         Likewise.
7016         (Incremental_input_entry): New class.
7017         (Incremental_script_entry): New class.
7018         (Incremental_object_entry): New class.
7019         (Incremental_archive_entry): New class.
7020         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7021         (Incremental_inputs::report_inputs): Remove.
7022         (Incremental_inputs::report_archive): Remove.
7023         (Incremental_inputs::report_archive_begin): New function.
7024         (Incremental_inputs::report_archive_end): New function.
7025         (Incremental_inputs::report_object): Change prototype.
7026         (Incremental_inputs::report_input_section): New function.
7027         (Incremental_inputs::report_script): Change prototype.
7028         (Incremental_inputs::get_reloc_count): New function.
7029         (Incremental_inputs::set_reloc_count): New function.
7030         (Incremental_inputs::create_data_sections): New function.
7031         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7032         (Incremental_inputs::inputs_section): New function.
7033         (Incremental_inputs::symtab_section): New function.
7034         (Incremental_inputs::relocs_section): New function.
7035         (Incremental_inputs::get_stringpool): Add const.
7036         (Incremental_inputs::command_line): Add const.
7037         (Incremental_inputs::inputs): Remove.
7038         (Incremental_inputs::command_line_key): New function.
7039         (Incremental_inputs::input_file_count): New function.
7040         (Incremental_inputs::input_files): New function.
7041         (Incremental_inputs::relocs_entsize): New function.
7042         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7043         (Incremental_inputs::finalize_inputs): Remove.
7044         (Incremental_inputs::Input_info): Remove.
7045         (Incremental_inputs::lock_): Remove.
7046         (Incremental_inputs::inputs_): Change type.
7047         (Incremental_inputs::inputs_map_): Remove.
7048         (Incremental_inputs::current_object_entry_): New data member.
7049         (Incremental_inputs::inputs_section_): New data member.
7050         (Incremental_inputs::symtab_section_): New data member.
7051         (Incremental_inputs::relocs_section_): New data member.
7052         (Incremental_inputs::reloc_count_): New data member.
7053         (Incremental_inputs_reader): New class.
7054         (Incremental_symtab_reader): New class.
7055         (Incremental_relocs_reader): New class.
7056         * layout.cc (Layout::finalize): Move finalization of incremental info
7057         and creation of incremental info sections to follow finalization of
7058         symbol table.  Set offsets for postprocessing sections.
7059         (Layout::create_incremental_info_sections): Call
7060         Incremental_inputs::create_data_sections.  Add incremental symtab
7061         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7062         sections to layout after input sections.
7063         * layout.h (struct Timespec): Forward declaration.
7064         (Layout::incremental_inputs): Add const.
7065         (Layout::create_incremental_info_sections): Add parameter.
7066         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7067         * object.cc: Include incremental.h.
7068         (Relobj::finalize_incremental_relocs): New function.
7069         (Sized_relobj::do_layout): Record input sections in incremental info.
7070         * object.h (Object::output_section): New function.
7071         (Object::output_section_offset): Moved from Relobj.
7072         (Object::get_incremental_reloc_base): New function.
7073         (Object::get_incremental_reloc_count): New function.
7074         (Object::do_output_section): New function.
7075         (Object::do_output_section_offset): Moved from Relobj.
7076         (Object::do_get_incremental_reloc_base): New function.
7077         (Object::do_get_incremental_reloc_count): New function.
7078         (Object::Object): Initialize new data members.
7079         (Relobj::output_section): Renamed do_output_section and moved to
7080         protected.
7081         (Relobj::output_section_offset): Moved to Object.
7082         (Relobj::do_get_incremental_reloc_base): New function.
7083         (Relobj::do_get_incremental_reloc_count): New function.
7084         (Relobj::allocate_incremental_reloc_counts): New function.
7085         (Relobj::count_incremental_reloc): New function.
7086         (Relobj::finalize_incremental_relocs): New function.
7087         (Relobj::next_incremental_reloc_index): New function.
7088         (Relobj::reloc_counts_): New data member.
7089         (Relobj::reloc_bases_): New data member.
7090         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7091         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7092         (Sized_relobj::incremental_relocs_scan): New function.
7093         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7094         (Sized_relobj::incremental_relocs_write): New function.
7095         (Sized_relobj::incremental_relocs_write_reltype): New function.
7096         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7097         incremental link.
7098         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7099         archives and object files elsewhere.
7100         (Add_symbols::run): Report object files here.
7101         (Finish_group::run): Report end of archive at end of group.
7102         * reloc.cc: Include layout.h, incremental.h.
7103         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7104         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7105         (Sized_relobj::incremental_relocs_scan): New function.
7106         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7107         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7108         (Sized_relobj::incremental_relocs_write): New function.
7109         (Sized_relobj::incremental_relocs_write_reltype): New function.
7110         * script.cc (read_input_script): Rewrite test for incremental link.
7111         Change call to Incremental_inputs::report_script.
7112         * symtab.h (Symbol_table::first_global_index): New function.
7113         (Symbol_table::output_count): New function.
7114
7115 2010-08-12  Doug Kwan  <dougkwan@google.com>
7116
7117         * arm.cc (Target_arm::merge_object_attributes): Check command line
7118         options --no-wchar-size-warning and --no-enum-size-warning.
7119         * options.h (General_options): Add ld-compatible options
7120         --no-enum-size-warning and --no-wchar-size-warning.
7121
7122 2010-08-04  Ian Lance Taylor  <iant@google.com>
7123
7124         * x86_64.cc (Target_x86_64::Scan::local): Use
7125         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7126         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7127         (Target_x86_64::Scan::global): Likewise.
7128         (Target_x86_64::Relocate::relocate): Likewise.
7129         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7130         Likewise.
7131
7132 2010-08-03  Cary Coutant  <ccoutant@google.com>
7133
7134         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7135         to reserve space in merged_strings vector. Keep total input size
7136         for stats.
7137         (Output_merge_string::do_print_merge_stats): Print total input size.
7138         * merge.h (Output_merge_string): Add input_size_ field.
7139         * stringpool.cc (Stringpool_template::string_length): Move
7140         implementations out of Stringpool_template class and place in
7141         stringpool.h.
7142         * stringpool.h (string_length): Move out of Stringpool_template.
7143
7144 2010-08-03  Ian Lance Taylor  <iant@google.com>
7145
7146         PR 11712
7147         * layout.cc (relaxation_loop_body): If address of load segment is
7148         set, adjust address to include headers if possible.
7149
7150 2010-08-03  Ian Lance Taylor  <iant@google.com>
7151
7152         * version.cc (version_string): Bump to 1.10.
7153
7154 2010-08-03  Ian Lance Taylor  <iant@google.com>
7155
7156         PR 11805
7157         * layout.h (enum Output_section_order): Define.
7158         (class Layout): Update declarations.
7159         * layout.cc (Layout::get_output_section): Add order parameter.
7160         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7161         is_first_non_relro parameters.  Change all callers.
7162         (Layout::choose_output_section): Likewise.
7163         (Layout::add_output_section_data): Likewise.
7164         (Layout::make_output_section): Likewise.  Set order.
7165         (Layout::default_section_order): New function.
7166         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7167         * output.cc (Output_section::Output_section): Initialize order_.
7168         Don't initialize deleted fields.
7169         (Output_segment::Output_segment): Don't initialize deleted
7170         fields.
7171         (Output_segment::add_output_section_to_load): New function
7172         replacing add_output_section.  Change all callers to call this or
7173         add_output_section_to_nonload.
7174         (Output_segment::add_output_section_to_nonload): New function.
7175         (Output_segment::remove_output_section): Rewrite.
7176         (Output_segment::add_initial_output_data): Likewise.
7177         (Output_segment::has_any_data_sections): Likewise.
7178         (Output_segment::is_first_section_relro): Likewise.
7179         (Output_segment::maximum_alignment): Likewise.
7180         (Output_segment::has_dynamic_reloc): New function replacing
7181         dynamic_reloc_count.  Change all callers.
7182         (Output_segment::has_dynamic_reloc_list): New function replacing
7183         dynamic_reloc_count_list.  Change all callers.
7184         (Output_segment::set_section_addresses): Rewrite.
7185         (Output_segment::set_offset): Rewrite.
7186         (Output_segment::find_first_and_last_list): Remove.
7187         (Output_segment::set_tls_offsets): Rewrite.
7188         (Output_segment::first_section_load_address): Likewise.
7189         (Output_segment::output_section_count): Likewise.
7190         (Output_segment::section_with_lowest_load_address): Likewise.
7191         (Output_segment::write_section_headers): Likewise.
7192         (Output_segment::print_sections_to_map): Likewise.
7193         * output.h (class Output_data): Remove dynamic_reloc_count_
7194         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7195         (Output_data::add_dynamic_reloc): Rewrite.
7196         (Output_data::has_dynamic_reloc): New function.
7197         (Output_data::dynamic_reloc_count): Remove.
7198         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7199         is_last_relro_, is_first_non_relro_, is_interp_,
7200         is_dynamic_linker_section_ fields.  Add order and set_order
7201         functions.  Remove is_relro_local, set_is_relro_local,
7202         is_last_relro, set_is_last_relro, is_first_non_relro,
7203         set_is_first_non_relro functions, is_interp, set_is_interp,
7204         is_dynamic_linker_section, and set_is_dynamic_linker_section
7205         functions.
7206         (class Output_segment): Change Output_data_list from std::list to
7207         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7208         output_bss_ fields.  Update declarations.
7209
7210 2010-08-02  Ian Lance Taylor  <iant@google.com>
7211
7212         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7213         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7214         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7215
7216 2010-08-02  Ian Lance Taylor  <iant@google.com>
7217
7218         PR 11855
7219         * script.cc (Script_options::Script_options): Initialize
7220         symbol_definitions_ and symbol_references_.
7221         (Script_options::add_symbol_assignment): Update
7222         symbol_definitions_ and symbol_references_.
7223         (Script_options::add_symbol_reference): New function.
7224         (script_symbol): New function.
7225         * script.h (class Script_options): Add symbol_definitions_ and
7226         symbol_references_ fields.
7227         (Script_options::referenced_const_iterator): New type.
7228         (Script_options::referenced_begin): New function.
7229         (Script_options::referenced_end): New function.
7230         (Script_options::is_referenced): New function.
7231         (Script_options::any_unreferenced): New function.
7232         * script-c.h (script_symbol): Declare.
7233         * yyscript.y (exp): Call script_symbol.
7234         * symtab.cc: Include "script.h".
7235         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7236         Change all callers.  Check symbols referenced by scripts.
7237         (Symbol_table::add_undefined_symbols_from_command_line): Add
7238         layout parameter.  Change all callers.
7239         (Symbol_table::do_add_undefined_symbols_from_command_line):
7240         Likewise.  Break out loop body.  Check symbols referenced by
7241         scripts.
7242         (Symbol_table::add_undefined_symbol_from_command_line): New
7243         function broken out of
7244         do_add_undefined_symbols_from_command_line.
7245         * symtab.h (class Symbol_table): Update declarations.
7246         * archive.cc: Include "layout.h".
7247         (Archive::should_include_member): Add layout parameter.  Change
7248         all callers.  Check for symbol mentioned in expression.
7249         * archive.h (class Archive): Update declaration.
7250         * object.cc (Sized_relobj::do_should_include_member): Add layout
7251         parameter.
7252         * object.h (Object::should_include_member): Add layout parameter.
7253         Change all callers.
7254         (Object::do_should_include_member): Add layout parameter.
7255         (class Sized_relobj): Update declaration.
7256         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7257         parameter.
7258         * dynobj.h (class Sized_dynobj): Update declaration.
7259         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7260         layout parameter.
7261         * plugin.h (class Sized_pluginobj): Update declaration.
7262
7263 2010-08-02  Ian Lance Taylor  <iant@google.com>
7264
7265         PR 11866
7266         * output.cc (Output_segment::set_offset): Search for the first and
7267         last sections rather than assuming that the list is in order.
7268         (Output_segment::find_first_and_last_list): New function.
7269         * output.h (class Output_segment): Update declarations.
7270         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7271         (relro_strip_test_SOURCES): New variable.
7272         (relro_strip_test_DEPENDENCIES): New variable.
7273         (relro_strip_test_LDFLAGS): New variable.
7274         (relro_strip_test_LDADD): New variable.
7275         (relro_strip_test.so): New target.
7276
7277 2010-08-02  Ian Lance Taylor  <iant@google.com>
7278
7279         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7280         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7281         (Target_i386::got_tlsdesc_section): New function.
7282         (Target_i386::got_section): Create space for GOT entries for
7283         TLSDESC relocations.
7284         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7285         R_386_TLS_GOTDESC.
7286         (Target_i386::Scan::global): Likewise.
7287         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7288         using TLSDESC GOT.
7289         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7290         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7291         (Target_x86_64::got_tlsdesc_section): New function.
7292         (Target_x86_64::got_section): Create space for GOT entries for
7293         TLSDESC relocations.
7294         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7295         R_386_TLS_GOTDESC.
7296         (Target_x86_64::Scan::global): Likewise.
7297         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7298         using TLSDESC GOT.
7299
7300 2010-08-02  Ian Lance Taylor  <iant@google.com>
7301
7302         * testsuite/final_layout.sh: Use dc to convert from hex to
7303         decimal.
7304
7305 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7306
7307         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7308         paramter to the call to gold::gc_process_relocs.
7309         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7310         paramter to the call to gold::gc_process_relocs.
7311         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7312         parameter to the call to gold::gc_process_relocs.
7313         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7314         template parameter to the call to gold::gc_process_relocs.
7315         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7316         paramter to the call to gold::gc_process_relocs.
7317         * gc.h (get_embedded_addend_size): New function.
7318         (gc_process_relocs): Save the size of the reloc for use by ICF.
7319         * icf.cc (get_section_contents): Get the addend from the text section
7320         for SHT_REL relocation sections.
7321         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7322         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7323         * int_encoding.h (read_from_pointer): New overloaded function.
7324         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7325         * testsuite/icf_sht_rel_addend_test.sh: New file.
7326         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7327         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7328
7329 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7330
7331         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7332         * Makefile.in: Regenerate.
7333         * testsuite/Makefile.in: Regenerate.
7334
7335 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7336
7337         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7338         * gold/testsuite/debug_msg.cc: Likewise.
7339         * gold/testsuite/odr_violation1.cc
7340         * gold/testsuite/odr_violation2.cc
7341
7342 2010-07-21  Cary Coutant  <ccoutant@google.com>
7343
7344         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7345         string, and length fields.
7346         (Output_merge_string::Merged_strings_list): New type.
7347         (Output_merge_string::Merged_strings_lists): New typedef.
7348         (Output_merge_string): Replace merged_strings_ with
7349         merged_strings_lists_.
7350         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7351         Merged_strings_list per input object and section.  Don't store pointer
7352         to the string.  Don't store length with each merged string entry.
7353         (Output_merge_string::finalize_merged_data): Loop over list of merged
7354         strings lists.  Recompute length of each merged string.
7355
7356 2010-07-15  Cary Coutant  <ccoutant@google.com>
7357
7358         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7359         here.
7360
7361 2010-07-14  Ian Lance Taylor  <iant@google.com>
7362
7363         * descriptors.cc (Descriptors::open): Report correct name in error
7364         message.
7365
7366 2010-07-13  Doug Kwan  <dougkwan@google.com>
7367
7368         * arm.cc (Arm_input_section::Arm_input_section): For a
7369         SHT_ARM_EXIDX section, always keeps the input sections.
7370         (Arm_input_section::set_exidx_section_link): New method.
7371         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7372         has_errors_ to false.
7373         (Arm_exidx_input_section::has_errors,
7374         Arm_exidx_input_section::set_has_errors): New methods.
7375         (Arm_exidx_input_section::has_errors_): New data member.
7376         (Arm_relobj::get_exidx_shndx_list): New method.
7377         (Arm_output_section::append_text_sections_to_list): Do not skip
7378         section without SHF_EXECINSTR.
7379         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7380         errors.
7381         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7382         section header.  Make error messages more verbose.  Check for
7383         a non-executable section linked to an EXIDX section.
7384         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7385         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7386         check that there is no deferred EXIDX section if we exit early.
7387         Instead of not making an EXIDX section in case of an error, make one
7388         and set the has_errors flag of it.
7389         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7390         in a relocatable link.
7391         (Target_arm::do_relax): Look for the EXIDX output section instead of
7392         assuming that it is called .ARM.exidx.
7393         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7394         section list.  Do not check for SHF_EXECINSTR section flags but
7395         skip any input section with errors.
7396         * output.cc (Output_section::Output_section): Initialize
7397         always_keeps_input_sections_ to false.
7398         (Output_section::add_input_section): Check for
7399         always_keeps_input_sections_.
7400         *  output.h (Output_section::always_keeps_input_sections,
7401         Output_section::set_always_keeps_input_sections): New methods.
7402         (Output_section::always_keeps_input_sections): New data member.
7403
7404 2010-07-13  Rafael Espindola  <espindola@google.com>
7405
7406         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7407         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7408
7409 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7410             Ian Lance Taylor  <iant@google.com>
7411
7412         * output.h (Output_section_lookup_maps::add_merge_section):
7413         Correct check of whether value was inserted.
7414         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7415         (Output_section_lookup_maps::add_relaxed_input_section):
7416         Likewise.
7417         * arm.cc (Target_arm::got_section): Remove used local os.
7418         * i386.cc (Target_i386::got_section): Likewise.
7419         * x86_64.cc (Target_x86_64::got_section): Likewise.
7420         * sparc.cc (Target_sparc::got_section): Likewise.
7421         (Target_sparc::relocate): Remove unused local have_got_offset.
7422         * powerpc.cc (Target_powerpc::relocate): Likewise.
7423
7424 2010-07-13  Ian Lance Taylor  <iant@google.com>
7425
7426         * compressed_output.cc (zlib_decompress): Fix signature in
7427         !HAVE_ZLIB_H case.
7428
7429         * archive.cc (Archive::include_member): Unlock an external member
7430         of a thin archive.  Don't bother to delete an object we know is
7431         NULL.
7432
7433 2010-07-12  Cary Coutant  <ccoutant@google.com>
7434
7435         * compressed_output.cc (zlib_decompress): New function.
7436         (get_uncompressed_size): New function.
7437         (decompress_input_section): New function.
7438         * compressed_output.h (get_uncompressed_size): New function.
7439         (decompress_input_section): New function.
7440         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7441         Handle compressed debug sections.
7442         * layout.cc (is_compressed_debug_section): New function.
7443         (Layout::output_section_name): Map compressed section names to
7444         canonical names.
7445         * layout.h (is_compressed_debug_section): New function.
7446         (is_debug_info_section): Recognize compressed debug sections.
7447         * merge.cc: Include compressed_output.h.
7448         (Output_merge_data::do_add_input_section): Handle compressed
7449         debug sections.
7450         (Output_merge_string::do_add_input_section): Handle compressed
7451         debug sections.
7452         * object.cc: Include compressed_output.h.
7453         (Sized_relobj::Sized_relobj): Initialize new data members.
7454         (build_compressed_section_map): New function.
7455         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7456         * object.h (Object::section_is_compressed): New method.
7457         (Object::do_section_is_compressed): New method.
7458         (Sized_relobj::Compressed_section_map): New type.
7459         (Sized_relobj::do_section_is_compressed): New method.
7460         (Sized_relobj::compressed_sections_): New data member.
7461         * output.cc (Output_section::add_input_section): Handle compressed
7462         debug sections.
7463         * reloc.cc: Include compressed_output.h.
7464         (Sized_relobj::write_sections): Handle compressed debug sections.
7465
7466 2010-07-08  Cary Coutant  <ccoutant@google.com>
7467
7468         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7469         weak when resolving to a dynamic def.
7470         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7471         for weak undef/dynamic def cases. Adjust callers.
7472         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7473         undef_binding_weak_.
7474         (Symbol_table::sized_write_globals): Adjust symbol binding.
7475         (Symbol_table::sized_write_symbol): Add binding parameter.
7476         * symtab.h (Symbol::set_undef_binding): New method.
7477         (Symbol::is_undef_binding_weak): New method.
7478         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7479         (Symbol_table::should_override): Add new parameter.
7480         (Symbol_table::sized_write_symbol): Add new parameter.
7481
7482         * testsuite/weak_undef_file1.cc: Add new test case.
7483         * testsuite/weak_undef_file2.cc: Fix header comment.
7484         * testsuite/weak_undef_test.cc: Add new test case.
7485
7486 2010-06-29  Doug Kwan  <dougkwan@google.com>
7487
7488         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7489         Initialize USE_SYMBOL_.
7490         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7491         definition.
7492         (Arm_reloc_property::uses_symbol_): New data member declaration.
7493         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7494         uses symbol value and symbol is undefined but not weakly undefined.
7495
7496 2010-06-28  Rafael Espindola  <espindola@google.com>
7497
7498         * plugin.cc (Plugin::load): Use dlerror.
7499
7500 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7501
7502         * symtab.cc (detect_odr_violations): When reporting an ODR
7503         violation, report an object where the symbol is defined.
7504
7505 2010-06-25  Doug Kwan  <dougkwan@google.com>
7506
7507         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7508         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7509         definition.
7510         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7511         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7512         target hook to detect function points.
7513         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7514         * icf.h (Icf::check_section_for_function_pointers): Change type of
7515         parameter SECTION_NAME to const reference to std::string.  Use
7516         target hook to determine if section may have unsafe pointers.
7517         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7518         method definition.
7519
7520 2010-06-21  Rafael Espindola  <espindola@google.com>
7521
7522         * fileread.cc (Input_file::find_fie): New
7523         (Input_file::open): Use Input_file::find_fie.
7524         * fileread.h (Input_file::find_fie): New
7525         * plugin.cc (set_extra_library_path): New.
7526         (Plugin::load): Add set_extra_library_path to the transfer vector.
7527         (Plugin_manager::set_extra_library_path): New.
7528         (Plugin_manager::add_input_file): Use the extra search path if set.
7529         (set_extra_library_path(): New.
7530         * plugin.h (Plugin_manager): Add set_extra_library_path and
7531         extra_search_path_.
7532
7533 2010-06-19  Cary Coutant  <ccoutant@google.com>
7534
7535         * layout.cc (gdb_sections): Add .debug_types.
7536         (lines_only_debug_sections): Likewise.
7537
7538 2010-06-18  Rafael Espindola  <espindola@google.com>
7539
7540         * plugin.cc (add_input_file,add_input_library)
7541         (Plugin_manager::add_input_file): Make filename arguments const.
7542         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7543         const.
7544
7545 2010-06-16  Doug Kwan  <dougkwan@google.com>
7546
7547         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7548         .ARM.attributes section if we have not merged any input
7549         attributes sections.
7550
7551 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7552
7553         * arm.cc: Allow combining objects with no EABI version
7554         information.
7555
7556 2010-06-15  Rafael Espindola  <espindola@google.com>
7557
7558         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7559
7560 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7561
7562         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7563         (struct iovec): Correct !HAVE_READV definition.
7564
7565 2010-06-10  Cary Coutant  <ccoutant@google.com>
7566
7567         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7568         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7569         reloc sections.
7570         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7571
7572         PR 11683
7573         * symtab.h (Symbol::is_placeholder): New member function.
7574         * target-reloc.h (relocate_section): Check for placeholder symbols.
7575
7576         * testsuite/Makefile.am (plugin_test_8): New test.
7577         (plugin_test_9): New test.
7578         * testsuite/Makefile.in: Regenerate.
7579
7580 2010-06-09  Nick Clifton  <nickc@redhat.com>
7581
7582         * yyscript.y (input_list_element): Allow strings prefixed with
7583         the '-' character.  Treat these as libraries.
7584         * script.cc (script_add_library): New function.  Adds a library
7585         specified by "-l<name>" found in an input script.
7586         * script-c.h: Add prototype for script_add_library.
7587
7588 2010-06-07  Doug Kwan  <dougkwan@google.com>
7589
7590         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7591         Restrict stub-group size to be within long conditional branch
7592         range when working around cortex-A8 erratum.
7593
7594 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7595
7596         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7597         #ifdef typo.
7598
7599 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7600
7601         PR gold/11658
7602         * output.cc
7603         (Output_section::Input_section_sort_entry::compare_section_ordering):
7604         Change to return non-zero correctly.
7605         (Output_section::Input_section_sort_section_order_index_compare
7606         ::operator()): Change to fix ambiguity in comparisons.
7607
7608 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7609
7610         * gold.h (is_wildcard_string): New function.
7611         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7612         (Layout::layout_eh_frame): Ditto.
7613         (Layout::find_section_order_index): New method.
7614         (Layout::read_layout_from_file): New method.
7615         * layout.h (Layout::find_section_order_index): New method.
7616         (Layout::read_layout_from_file): New method.
7617         (Layout::input_section_position_): New private member.
7618         (Layout::input_section_glob_): New private member.
7619         * main.cc (main): Call read_layout_from_file here.
7620         * options.h (--section-ordering-file): New option.
7621         * output.cc (Output_section::input_section_order_specified_): New
7622         member.
7623         (Output_section::Output_section): Initialize new member.
7624         (Output_section::add_input_section): Add new parameter.
7625         Keep input sections when --section-ordering-file is used.
7626         (Output_section::set_final_data_size): Sort input sections when
7627         section ordering file is specified.
7628         (Output_section::Input_section_sort_entry): Add new parameter.
7629         Check sorting type.
7630         (Output_section::Input_section_sort_entry::compare_section_ordering):
7631         New method.
7632         (Output_section::Input_section_sort_compare::operator()): Change to
7633         consider section_order_index.
7634         (Output_section::Input_section_sort_init_fini_compare::operator()):
7635         Change to consider section_order_index.
7636         (Output_section::Input_section_sort_section_order_index_compare
7637         ::operator()): New method.
7638         (Output_section::sort_attached_input_sections): Change to sort
7639         according to section order when specified.
7640         (Output_section::add_input_section<32, true>): Add new parameter.
7641         (Output_section::add_input_section<64, true>): Add new parameter.
7642         (Output_section::add_input_section<32, false>): Add new parameter.
7643         (Output_section::add_input_section<64, false>): Add new parameter.
7644         * output.h (Output_section::add_input_section): Add new parameter.
7645         (Output_section::input_section_order_specified): New
7646         method.
7647         (Output_section::set_input_section_order_specified): New method.
7648         (Input_section::Input_section): Initialize section_order_index_.
7649         (Input_section::section_order_index): New method.
7650         (Input_section::set_section_order_index): New method.
7651         (Input_section::section_order_index_): New member.
7652         (Input_section::Input_section_sort_section_order_index_compare): New
7653         struct.
7654         (Output_section::input_section_order_specified_): New member.
7655         * script-sections.cc (is_wildcard_string): Delete and move modified
7656         method to gold.h.
7657         (Output_section_element_input::Output_section_element_input): Modify
7658         call to is_wildcard_string.
7659         (Output_section_element_input::Input_section_pattern
7660         ::Input_section_pattern): Ditto.
7661         (Output_section_element_input::Output_section_element_input): Ditto.
7662         * testsuite/Makefile.am (final_layout): New test case.
7663         * testsuite/Makefile.in: Regenerate.
7664         * testsuite/final_layout.cc: New file.
7665         * testsuite/final_layout.sh: New file.
7666
7667 2010-06-01  Rafael Espindola  <espindola@google.com>
7668
7669         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7670
7671 2010-06-01  Rafael Espindola  <espindola@google.com>
7672
7673         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7674         visibility of symbols.
7675
7676 2010-05-27  Doug Kwan  <dougkwan@google.com>
7677
7678         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7679         from start of output section instead of address for a local symbol
7680         in a merged or relaxed section when doing a relocatable link.
7681
7682 2010-05-26  Rafael Espindola  <espindola@google.com>
7683
7684         PR 11604
7685         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7686         adding sections the garbage collector removed.
7687         * gold/testsuite/Makefile.am: Add test.
7688         * gold/testsuite/Makefile.in: Regenerate.
7689         * gold/testsuite/plugin_test_7.sh: New.
7690         * gold/testsuite/plugin_test_7_1.c: New.
7691         * gold/testsuite/plugin_test_7_2.c: New.
7692
7693 2010-05-26  Rafael Espindola  <espindola@google.com>
7694
7695         * script-sections.cc (Output_section_definition::set_section_addresses):
7696         Check for --section-start.
7697
7698 2010-05-26  Doug Kwan  <dougkwan@google.com>
7699
7700         * arm.cc (Arm_scan_relocatable_relocs): New class.
7701         (Target_arm::relocate_special_relocatable): New method.
7702         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7703         (Arm_relocate_functions::thumb_branch_common): Same.
7704         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7705         instead of Default_scan_relocatable_relocs.
7706         * target-reloc.h (relocate_for_relocatable): Let target handle
7707         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7708         * target.h (Sized_target::relocate_special_relocatable): New method.
7709
7710 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7711
7712         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7713
7714 2010-05-23  Doug Kwan  <dougkwan@google.com>
7715
7716         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7717         instead of a cast.
7718         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7719         with a direct branch, not a conditional branch, to a stub.
7720         * merge.cc (Output_merge_base::record_input_section): New method
7721         defintion.
7722         (Output_merge_data::do_add_input_section): Record input section if
7723         keeps-input-sections flag is set.
7724         (Output_merge_string::do_add_input_section): Ditto.
7725         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7726         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7727         INPUT_SECTIONS_.
7728         (Output_merge_base::keeps_input_sections,
7729         Output_merge_base::set_keeps_input_sections,
7730         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7731         method definitions.
7732         (Output_merge_base::Input_sections): New type declaration.
7733         (Output_merge_base::input_sections_begin,
7734         Output_merge_base::input_sections_end,
7735         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7736         (Output_merge_base::bool keeps_input_sections_,
7737         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7738         Output_merge_base::input_sections_): New data members.
7739         (Output_merge_data::do_set_keeps_input_sections): New method
7740         defintion.
7741         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7742         * output.cc (Output_section::Input_section::relobj): Move method
7743         defintion from class declaration to here and handle merge sections.
7744         (Output_section::Input_section::shndx): Ditto.
7745         (Output_section::Output_section): Remove initializations of removed
7746         data members and initialize new data member LOOKUP_MAPS_.
7747         (Output_section::add_input_section): Set keeps-input-sections flag
7748         for a newly created merge output section as appropriate.  Adjust code
7749         to use Output_section_lookup_maps class.
7750         (Output_section::add_relaxed_input_section): Adjst code for lookup
7751         maps code refactoring.
7752         (Output_section::add_merge_input_section): Add a new parameter
7753         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7754         class.  If adding input section to a newly created merge output
7755         section fails, remove the new merge section.
7756         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7757         Adjust code for use of the Output_section_lookup_maps class.
7758         (Output_section::find_merge_section): Ditto.
7759         (Output_section::build_lookup_maps): New method defintion.
7760         (Output_section::find_relaxed_input_section): Adjust code to use
7761         Output_section_lookup_maps class.
7762         (Output_section::get_input_sections): Export merge sections.  Adjust
7763         code to use Output_section_lookup_maps class.
7764         (Output_section:::add_script_input_section): Adjust code to use
7765         Output_section_lookup_maps class.  Update lookup maps for merge
7766         sections also.
7767         (Output_section::discard_states): Use Output_section_lookup_maps.
7768         (Output_section::restore_states): Same.
7769         * output.h (Merge_section_properties): Move class defintion out of
7770         Output_section.
7771         (Output_section_lookup_maps): New class.
7772         (Output_section::Input_section::is_merge_section): New method
7773         defintion.
7774         (Output_section::Input_section::relobj): Move defintion out of class
7775         defintion.  Declare method only.
7776         (Output_section::Input_section::shndx): Ditto.
7777         (Output_section::Input_section::output_merge_base): New method defintion.
7778         (Output_section::Input_section::u2_.pomb): New union field.
7779         (Output_section::Merge_section_by_properties_map,
7780         Output_section::Output_section_data_by_input_section_map,
7781         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7782         Remove types.
7783         (Output_section::add_merge_input_section): Add new parameter
7784         KEEPS_INPUT_SECTIONS.
7785         (Output_section::build_lookup_maps): New method declaration.
7786         (Output_section::merge_section_map_,
7787         Output_section::merge_section_by_properties_map_,
7788         Output_section::relaxed_input_section_map_,
7789         Output_section::is_relaxed_input_section_map_valid_): Remove data
7790         members.
7791         (Output_section::lookup_maps_): New data member.
7792
7793 2010-05-21  Doug Kwan  <dougkwan@google.com>
7794
7795         PR gold/11619
7796         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7797         avoid a compilation error.
7798
7799 2010-05-19  Rafael Espindola  <espindola@google.com>
7800
7801         * script-sections.cc (Output_section_definition::allocate_to_segment):
7802         Update the phdrs_list even when the output section is NULL.
7803         * testsuite/Makefile.am: Add test.
7804         * testsuite/Makefile.in: Regenerate.
7805         * testsuite/script_test_9.cc: New.
7806         * testsuite/script_test_9.sh: New.
7807         * testsuite/script_test_9.t: New.
7808
7809 2010-05-19  Doug Kwan  <dougkwan@google.com>
7810
7811         * arm.cc (Arm_input_section::original_size): New method.
7812         (Arm_input_section::do_addralign): Add a cast.
7813         (Arm_input_section::do_output_offset): Remove static cast.
7814         (Arm_input_section::original_addralign,
7815          Arm_input_section::original_size_): Change type to uint32_t.
7816         (Arm_input_section::init): Add safe casts for section alignment
7817         and size.
7818         (Arm_input_section::set_final_data_size): Do not set address and
7819         offset of stub table.
7820         (Arm_output_section::fix_exidx_coverage): Change use of of
7821         Output_section::Simple_input_section to that of
7822         Output_section::Input_section.
7823         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7824         except for the first pass.
7825         * output.cc (Output_section::get_input_sections): Change type of
7826         input_sections to std::list<Input_section>.
7827         (Output_section::add_script_input_section): Rename from
7828         Output_section::add_simple_input_section.  Change type of SIS
7829         parameter from Simple_input_section to Input_section.
7830         * output.h (Output_section::Simple_input_section): Remove class.
7831         (Output_section::Input_section): Change class visibility to public.
7832         (Output_section::Input_section::addralign): Use stored alignments
7833         for special input sections if set.
7834         (Output_section::Input_section::set_addralign): New method.
7835         (Output_section::get_input_sections): Change parameter type from
7836         list of Simple_input_section to list of Input_section.
7837         (Output_section::add_script_input_section): Rename from
7838         Output_section::add_simple_input_section. Change first parameter's
7839         type from Simple_input_section to Input_section and remove the
7840         second and third parameters.
7841         * script-sections.cc (Input_section::Input_section_list): Change
7842         type to list of Output_section::Input_section/
7843         (Input_section_info::Input_section_info): Change parameter type of
7844         INPUT_SECTION to Output_section::Input_section.
7845         (Input_section_info::input_section): Change return type.
7846         (Input_section_info::input_section_): Change type to
7847         Output_section::Input_section.
7848         (Output_section_element_input::set_section_addresses): Adjust code
7849         to use Output_section::Input_section instead of
7850         Output_section::Simple_input_section.  Adjust code for renaming
7851         of Output_section::add_simple_input_section.
7852         (Orphan_output_section::set_section_addresses): Ditto.
7853
7854 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7855
7856         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7857         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7858
7859 2010-05-18  Rafael Espindola  <espindola@google.com>
7860
7861         * options.cc (General_options::finalize): Handle -nostdlib.
7862         * options.h (nostdlib): New option.
7863         * script.cc (script_add_search_dir): Handle -nostdlib.
7864
7865 2010-05-12  Doug Kwan  <dougkwan@google.com>
7866
7867         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7868         attributes section only if there no attributes section after merging.
7869         (Target_arm::merge_object_attributes): Move value of
7870         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7871         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7872         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7873         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7874         and arm_attr_merge_7.stdout.
7875         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7876         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7877         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7878         arm_attr_merge_7b.o): New rules.
7879         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7880         arm_attr_merge_7
7881         * testsuite/Makefile.in: Regenerate.
7882         * testsuite/arm_attr_merge.sh: New file.
7883         * testsuite/arm_attr_merge_[67][ab].s: Same.
7884
7885 2010-05-05  Nick Clifton  <nickc@redhat.com>
7886
7887         * po/es.po: Updated Spanish translation.
7888
7889 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7890
7891         * Makefile.am (install-exec-local): Properly install gold as
7892         default cross linker.
7893         * Makefile.in: Regenerated.
7894
7895 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7896             Nick Clifton  <nickc@redhat.com>
7897
7898         * configure.ac (install_as_default): Define and set to false
7899         unless --enable-gold or --enable-gold=both/gold has been
7900         specified.
7901         * configure: Regenerate.
7902
7903         * Makefile.am (install-exec-local): Install the executable as
7904         'ld.gold'.  If install_as_default is true then also install it as
7905         'ld'.
7906         * Makefile.in: Regenerated.
7907
7908 2010-04-24  Ian Lance Taylor  <iant@google.com>
7909
7910         * layout.cc (Layout::layout_reloc): In relocatable link don't
7911         combine reloc sections for grouped sections.
7912
7913 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7914
7915         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7916         sections that are not ordinary to icf.
7917         * icf.cc (get_section_contents): Handle relocation pointing to section
7918         with no object or shndx information.
7919         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7920         * testsuite/Makefile.in: Regenerate.
7921         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7922         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7923
7924 2010-04-22  Ian Lance Taylor  <iant@google.com>
7925
7926         * expression.cc (Expression::Expression_eval_info): Add
7927         result_alignment_pointer field.
7928         (Expression::eval_with_dot): Add result_alignment_pointer
7929         parameter.  Change all callers.
7930         (Expression::eval_maybe_dot): Likewise.
7931         (class Binary_expression): Add alignment_pointer parameter to
7932         left_value and right_value.  Change all callers.
7933         (BINARY_EXPRESSION): Set result alignment.
7934         (class Trinary_expression): Add alignment_pointer parameter to
7935         arg2_value and arg3_value.  Change all callers.
7936         (Trinary_cond::value): Set result alignment.
7937         (Max_expression::value, Min_expression::value): Likewise.
7938         (Align_expression::value): Likewise.
7939         * script-sections.cc (class Sections_element): Add dot_alignment
7940         parameter to set_section_addresses virtual function.  Update
7941         instantiations.
7942         (class Output_section_element): Likewise.
7943         (Script_sections::create_segments): Add dot_alignment parameter.
7944         Change all callers.
7945         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7946         (Script_sections::set_phdrs_clause_addresses): Likewise.
7947         * script-sections.h: Update declarations.
7948         * script.h: Update declarations.
7949         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7950         min_p_align.
7951         * testsuite/script_test_3.t: Set large alignment.
7952         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7953         segment has expected alignment.
7954
7955 2010-04-22  Nick Clifton  <nickc@redhat.com>
7956
7957         * po/gold.pot: Updated by the Translation project.
7958         * po/vi.po: Updated Vietnamese translation.
7959
7960 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7961
7962         * testsuite/Makefile.am (check_PROGRAMS): Add
7963         icf_virtual_function_folding_test.
7964         * testsuite/Makefile.in: Regenerated.
7965
7966 2010-04-15  Andrew Haley  <aph@redhat.com>
7967
7968         * options.h (merge_exidx_entries): New option.
7969         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7970         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7971         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7972         (Target_arm::merge_exidx_entries): New function.
7973         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7974         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7975         to Arm_exidx_fixup constructor.
7976         Add new arg, merge_exidx_entries.
7977         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7978         Arm_output_section::fix_exidx_coverage.
7979
7980 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7981
7982         * icf.cc (get_section_contents): Check for preemptible functions.
7983         Ignore addend when appropriate.
7984         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7985         section folded.
7986         (add_from_relobj): Check for section folded.
7987         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7988         * symtab.h (should_add_dynsym_entry): Add new parameter.
7989         * target-reloc.h (scan_relocs): Check for section folded.
7990         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7991         Check reloc types for function pointers in shared objects.
7992         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7993         case.
7994         (icf_preemptible_functions_test): New test case.
7995         (icf_string_merge_test): New test case.
7996         * testsuite.Makefile.in: Regenerate.
7997         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7998         bar_glob.  Refactor code.
7999         * testsuite/icf_preemptible_functions_test.cc: New file.
8000         * testsuite/icf_preemptible_functions_test.sh: New file.
8001         * testsuite/icf_string_merge_test.cc: New file.
8002         * testsuite/icf_string_merge_test.sh: New file.
8003         * testsuite/icf_virtual_function_folding_test.cc: New file.
8004         * testsuite/icf_virtual_function_folding_test.sh: New file.
8005
8006 2010-04-14  Doug Kwan  <dougkwan@google.com>
8007
8008         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8009         for local symbol recounting if we remove a section due to ICF.
8010         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8011         there are no regular objects in input.
8012
8013 2010-04-13  Doug Kwan  <dougkwan@google.com>
8014
8015         * arm.cc (Arm_input_section::set_final_data_size): Compute
8016         accurate final data size instead of using current data size.
8017
8018 2010-04-09  Doug Kwan  <dougkwan@google.com>
8019
8020         * layout.cc (Layout::choose_output_section): Handle script section
8021         types.
8022         (Layout::make_output_section_for_script): Add section type parameter.
8023         Handle script section types.
8024         * layout.h (Layout::make_output_section_for_script): Add section
8025         type parameter.
8026         * output.cc (Output_section::Output_section): Initialize data member
8027         is_noload_.
8028         (Output_section::do_reset_address_and_file_offset): Do not set address
8029         to 0 if section is a NOLOAD section.
8030         * output.h (Output_section::is_noload): New method.
8031         (Output_section::set_is_noload): Ditto.
8032         (Output_section::is_noload_): New data member.
8033         * script-c.h (Script_section_type): New enum type.
8034         (struct Parser_output_section_header): Add new file section_type.
8035         * script-sections.cc (Sections_element::output_section_name): Add
8036         parameter for returning script section type.
8037         (Output_section_definition::output_section_name): Ditto.
8038         (Output_section_definition::section_type)P; New method.
8039         (Output_section_definiton::script_section_type_name): Ditto.
8040         (Output_section_definition::script_section_type_): New data member.
8041         (Output_section_definition::Output_section_definition): Initialize
8042         data member Output_section_definition::script_section_type_.
8043         (Output_section_definition::create_sections): Pass script section type
8044         to Layout::make_output_section_for_script.
8045         (Output_section_definition::output_section_name): Return script
8046         section type to caller.
8047         (Output_section_definition::set_section_address): Do not advance
8048         dot value and load address if section type is NOLOAD.  Set address
8049         of NOLOAD sections regardless of section flags.
8050         (Output_section_definition::print): Print section type if it is
8051         not SCRIPT_SECTION_TYPE_NONE.
8052         (Output_section_definition::section_type): New method.
8053         (Output_section_definition::script_section_type_name): Ditto.
8054         (Script_sections::output_section_name): Add new parameter
8055         PSECTION_TYPE for returning script section type.  Pass it to
8056         section elements.  Handle discard sections.
8057         (Sort_output_sections::operator()): Handle NOLOAD sections.
8058         * script-sections.h (Script_sections::Section_type): New enum type.
8059         (Script_sections::output_section_name): Add a new parameter for
8060         returning script section type.
8061         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8062         INFO and NOLOAD.
8063         * yyscript.y (union): Add new field SECTION_TYPE.
8064         (COPY, DSECT, INFO, NOLOAD): New tokens.
8065         (opt_address_and_section_type): Change type to output_section_header.
8066         (section_type): New non-terminal
8067         (section_header): Handle section type.
8068         (opt_address_and_section_type): Return section type value.
8069
8070 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8071
8072         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8073         * testsuite/plugin_common_test_2.c (foo): Likewise.
8074
8075 2010-04-08  Doug Kwan  <dougkwan@google.com>
8076
8077         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8078         Output_merge_data.
8079         * output.cc (Output_section::add_merge_input_section): Simplify
8080         code and return status of Output_merge_base::add_input_section.
8081         Update merge section map only if Output_merge_base::add_input_section
8082         returns true.
8083
8084 2010-04-07  Doug Kwan  <dougkwan@google.com>
8085
8086         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8087         if section is marked as containing instructions but has no mapping
8088         symbols.
8089         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8090         correct section index.
8091         (Arm_relobj::find_linked_text_section): Ditto.
8092
8093 2010-04-07  Cary Coutant  <ccoutant@google.com>
8094
8095         * archive.cc (include_member): Destroy Read_symbols_data object before
8096         releasing file.
8097         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8098         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8099         (Read_symbols_data::~Read_symbols_data) New destructor.
8100         (Section_relocs::Section_relocs) New constructor.
8101         (Section_relocs::~Section_relocs) New destructor.
8102         (Read_relocs_data::Read_relocs_data) New constructor.
8103         (Read_relocs_data::~Read_relocs_data) New destructor.
8104         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8105         pointers to NULL after deleting.
8106
8107 2010-04-07  Doug Kwan  <dougkwan@google.com>
8108
8109         * arm.cc: Replace "endianity" with "endianness" in comments.
8110         (Arm_exidx_cantunwind): Ditto.
8111         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8112         (Arm_relobj::merge_flags_and_attributes): New method.
8113         (Arm_relobj::merge_flags_and_attributes_): New data member.
8114         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8115         (Arm_relobj::scan_sections_for_stubs): Ditto.
8116         (Arm_relobj::do_read_symbols): Check to see if we really want to
8117         merge processor-specific flags and attributes.  Exit early if
8118         an object is empty except for section names and the undefined symbol.
8119         (Target_arm::do_finalize_sections): Move check for ELF format to
8120         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8121         attributes from a regular object only when we have determined that
8122         it is aapropriate.  Do not create an .ARM.attributes section in
8123         output if there is no regular input object.
8124         (Target_arm::merge_processor_specific_flags): Check
8125         --warn-mismatch before printing any error.
8126         (Target_arm::merge_object_attributes): Ditto.
8127         * gold.cc (queue_middle_tasks): Handle the case in which there is
8128         no regular object in input.
8129         * options.cc (General_options::parse_EB): New method.
8130         (General_options::parse_EL): Same.
8131         (General_options::General_options): Initialize endianness_.
8132         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8133         New options.
8134         (General_options::Endianness): New enum.
8135         (General_options::endianness): New method.
8136         (General_options::endianness_): New data member.
8137         * parameters.cc (Parameters::set_options): Check target endianness.
8138         (Parameters::set_target_once): Ditto.
8139         (Parameters::check_target_endianness): New method.
8140         (parameters_force_valid_target): If either -EL or -EB is specified,
8141         use it to define endianness of default target.
8142         * parameters.h (Parameters::check_target_endianness): New method
8143         declaration.
8144         * target.h (class Target): Change "endianity" to "endianness"
8145         in comments.
8146
8147 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8148
8149         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8150         * configure: Regenerate.
8151         * Makefile.in: Regenerate.
8152         * testsuite/Makefile.in: Regenerate.
8153
8154 2010-04-06  Cary Coutant  <ccoutant@google.com>
8155
8156         gcc PR lto/42757
8157         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8158         prevailing definitions of common symbols.
8159         * testsuite/plugin_test_6.sh: New test case.
8160         * testsuite/plugin_common_test_1.c: New test case.
8161         * testsuite/plugin_common_test_2.c: New test case.
8162         * testsuite/Makefile.am (plugin_test_6): New test case.
8163         * testsuite/Makefile.in: Regenerate.
8164
8165 2010-04-06  Nick Clifton  <nickc@redhat.com>
8166
8167         * po/vi.po: New Vietnamese translation.
8168
8169 2010-03-30  Doug Kwan  <dougkwan@google.com>
8170
8171         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8172
8173 2010-03-25  Doug Kwan  <dougkwan@google.com>
8174
8175         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8176         to avoid a conversion warning on a 32-bit host.
8177
8178 2010-03-24  Ian Lance Taylor  <iant@google.com>
8179
8180         * testsuite/script_test_3.t: Add a TLS segment.
8181         * testsuite/Makefile.am (check_PROGRAMS): Add
8182         tls_phdrs_script_test.
8183         (tls_phdrs_script_test_SOURCES): Define.
8184         (tls_phdrs_script_test_DEPENDENCIES): Define.
8185         (tls_phdrs_script_test_LDFLAGS): Define.
8186         (tls_phdrs_script_test_LDADD): Define.
8187         * testsuite/Makefile.in: Rebuild.
8188
8189 2010-03-23  Cary Coutant  <ccoutant@google.com>
8190
8191         * fileread.cc (find_or_make_view): Fix comment.
8192
8193 2010-03-23  Ian Lance Taylor  <iant@google.com>
8194
8195         * script-sections.cc (class Orphan_section_placement): Define
8196         PLACE_TLS and PLACE_TLS_BSS.
8197         (Orphan_section_placement::Orphan_section_placement): Initialize
8198         new places.
8199         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8200         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8201         (tls_script_test_SOURCES): Define.
8202         (tls_script_test_DEPENDENCIES): Define.
8203         (tls_script_test_LDFLAGS): Define.
8204         (tls_script_test_LDADD): Define.
8205         * testsuite/Makefile.in: Rebuild.
8206
8207 2010-03-22  Doug Kwan  <dougkwan@google.com>
8208
8209         * arm.cc (Arm_relocate_functions::abs8,
8210         Arm_relocate_functions::abs16): Use correct check for overflow
8211         specified in the ARM ELF specs.
8212         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8213         target of a BLX instruction specially.
8214         (Reloc_stub::stub_type_for_reloc): Ditto.
8215         (Relocate::relocate): Use symbolic names instead of numeric relocation
8216         codes to report error.
8217         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8218         workaround.
8219         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8220         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8221         thumb2_blx_out_of_range.stdout
8222         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8223         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8224         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8225         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8226         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8227         thumb2_blx_in_range, thumb2_blx_in_range.o,
8228         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8229         thumb2_blx_out_of_range.o): New rules.
8230         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8231         thumb2_blx_in_range and thumb2_blx_out_of_range.
8232         * testsuite/Makefile.in: Regenerate.
8233         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8234         * testsuite/thumb_blx_in_range.s: New file.
8235         * testsuite/thumb_blx_out_of_range.s: New file.
8236
8237 2010-03-22  Rafael Espindola  <espindola@google.com>
8238
8239         * archive.cc (Should_include): Move to archive.h.
8240         (should_include_member): Make it a member of Archive.
8241         (Lib_group): New.
8242         (Add_lib_group_symbols): New.
8243         * archive.h: Include options.h.
8244         (Archive_member): Moved from Archive.
8245         (Should_include): Moved from archive.cc.
8246         (Lib_group): New.
8247         (Add_lib_group_symbols): New.
8248         * dynobj.cc (do_should_include_member): New.
8249         * dynobj.h (do_should_include_member): New.
8250         * gold.cc (queue_initial_tasks): Update call to queue.
8251         * main.cc (main): Print lib group stats.
8252         * object.cc (do_should_include_member): New.
8253         * object.h: Include archive.h.
8254         (Object::should_include_member): New.
8255         (Object::do_should_include_member): New.
8256         (Sized_relobj::do_should_include_member): New.
8257         * options.cc (General_options::parse_start_lib): New.
8258         (General_options::parse_end_lib): New.
8259         (Input_arguments::add_file): Handle lib groups.
8260         (Input_arguments::start_group): Check we are not in a lib.
8261         (Input_arguments::start_lib): New.
8262         (Input_arguments::end_lib): New.
8263         * options.h (General_options): Add start_lib and end_lib.
8264         (Input_argument::lib_): New.
8265         (Input_argument::lib): New.
8266         (Input_argument::is_lib): New.
8267         (Input_file_lib): New.
8268         (Input_arguments::in_lib_): New.
8269         (Input_arguments::in_lib): New.
8270         (Input_arguments::start_lib): New.
8271         (Input_arguments::end_lib_): New.
8272         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8273         in unused members as preempted.
8274         (Sized_pluginobj::do_should_include_member): New.
8275         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8276         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8277         return the blocker.
8278         (Read_symbols::do_whole_lib_group): New.
8279         (Read_symbols::do_lib_group): New.
8280         (Read_symbols::do_read_symbols): Handle lib groups.
8281         (Read_symbols::get_name): Handle lib groups.
8282         * readsyms.h (Read_symbols): Add an archive member pointer.
8283         (Read_symbols::do_whole_lib_group): New.
8284         (Read_symbols::do_lib_group): New.
8285         (Read_symbols::member_): New.
8286         * script.cc (read_input_script): Update call to queue_soon.
8287
8288 2010-03-19  Doug Kwan  <dougkwan@google.com>
8289
8290         * arm.cc (Stub_table::Stub_table): Initialize new data members
8291         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8292         (Stub_table::add_reloc_stub): Assign stub offset and update
8293         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8294         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8295         New data members.
8296         (Stub_table::update_data_size_and_addralign): Use
8297         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8298         instead of going over all reloc stubs.
8299         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8300         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8301         Stringpool_template::offset_ to size of Stringpool_char.
8302         (Stringpool_template::new_key_offset): Remove code to initialize
8303         Stringpool_template::offset_.
8304         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8305         Stringpool_template::offset_ to zero.
8306
8307 2010-03-15  Doug Kwan  <dougkwan@google.com>
8308
8309         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8310         offset_.
8311         (Stringpool_template::new_key_offset): New method.
8312         (Stringpool_template::add_string): Assign offsets when adding new
8313         strings.
8314         (Stringpool_template::set_string_offsets): Do not set string offsets
8315         when not optimizing.
8316         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8317         member size_.
8318         (Chunked_vector::clear): Clear size_.
8319         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8320         (Chunked_vector::size): Return size_.
8321         (Chunked_vector::push_back): Use size_ to find insert position.
8322         (Chunked_vector::size_): New data member.
8323         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8324         (Stringpool_template::new_key_offset): New method declaration.
8325         (Stringpool_template::offset_): New data member.
8326
8327 2010-03-15   Rafael Espindola  <espindola@google.com>
8328
8329         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8330         Add_symbols' constructor.
8331         * readsyms.h (Add_symbols): Remove the input_group member.
8332
8333 2010-03-10  Ian Lance Taylor  <iant@google.com>
8334
8335         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8336         target to ask whether a reference to a symbol requires a stack
8337         split.
8338         * target.h (Target::is_call_to_non_split): New function.
8339         (Target::do_is_call_to_non_split): Declare virtual function.
8340         * target.cc: Include "symtab.h".
8341         (Target::do_is_call_to_non_split): New function.
8342         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8343
8344 2010-03-10  Cary Coutant  <ccoutant@google.com>
8345
8346         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8347         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8348         (File_read::open[2]): Add whole_file_view_ to list of views.
8349         (File_read::make_view): Remove test of whole_file_view_.
8350         (File_read::find_or_make_view): Create whole_file_view_ if
8351         necessary.
8352         (File_read::clear_views): Replace bool parameter with enum;
8353         adjust all callers.  Don't delete views with permanent data;
8354         do delete cached views and views from archives if
8355         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8356         if clearing the corresponding view.
8357         * fileread.h (File_read::Clear_views_mode): New enum.
8358         (File_read::View::is_permanent_view): New method.
8359         (File_read::clear_views): Replace bool parameter
8360         with enum; adjust all callers.
8361         * options.h (General_options): Change keep_files_mapped option;
8362         add map_whole_files.
8363         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8364         releasing the file.
8365         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8366         the file.
8367
8368 2010-03-10  David S. Miller  <davem@davemloft.net>
8369
8370         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8371
8372 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8373
8374         * icf.cc (get_section_contents): Add '@' marker after processing the
8375         merge reloc.
8376
8377 2010-03-08  Doug Kwan  <dougkwan@google.com>
8378
8379         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8380         due to a conversion warning.
8381         (Arm_relobj::update_output_local_symbol_count): Check for local
8382         symbol with unset output index.
8383
8384 2010-03-05  Ian Lance Taylor  <iant@google.com>
8385
8386         * options.h (class General_options): Add --spare-dynamic-tags.
8387         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8388         --spare-dynamic-tags.
8389
8390 2010-03-05  Ian Lance Taylor  <iant@google.com>
8391
8392         * incremental.cc: Include "libiberty.h".
8393
8394 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8395
8396         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8397         function, is_info_ member.
8398         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8399         (Versions::Versions): Update caller.
8400         (Versions::define_base_version): Likewise.
8401         (Versions::add_def): Likewise.
8402
8403 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8404
8405         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8406         (Scan::possible_function_pointer_reloc): New function.
8407         (Scan::local_reloc_may_be_function_pointer): Change to call
8408         possible_function_pointer_reloc.
8409         (Scan::global_reloc_may_be_function_pointer): Ditto.
8410         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8411         relocations in ".data.rel.ro._ZTV" section.
8412         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8413         * testsuite/icf_safe_so_test.cc: Ditto.
8414         * testsuite/icf_safe_test.cc: Ditto.
8415         * testsuite/icf_safe_test.sh: Ditto.
8416
8417 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8418             Ian Lance Taylor  <iant@google.com>
8419
8420         * target-reloc.h (relocate_section): Check the symbol table index
8421         for -1U before setting the local symbol index.
8422         (scan_relocatable_relocs): If copying the relocation, record that
8423         the local symbol is required.
8424         * object.h (Symbol_value::is_output_symtab_index_set): New
8425         function.
8426         (Symbol_value::may_be_discarded_from_output_symtab): New
8427         function.
8428         (Symbol_value::has_output_symtab_entry): New function.
8429         (Symbol_value::needs_output_symtab_entry): Remove.
8430         (Symbol_value::output_symtab_index): Make sure the symbol index is
8431         set.
8432         (Symbol_value::set_output_symtab_index): Make sure the symbol
8433         index is not set.  Make sure the new index is valid.
8434         (Symbol_value::set_must_have_output_symtab_entry): New function.
8435         (Symbol_value::has_output_dynsym_entry): New function.
8436         (Symbol_value::set_output_dynsym_index): Make sure the new index
8437         is valid.
8438         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8439         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8440         local symbol if permitted.
8441         (Sized_relobj::do_finalize_local_symbols): Call
8442         is_output_symtab_index_set rather than needs_output_symtab_entry.
8443         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8444         rather than needs_output_symtab_entry.  Call
8445         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8446         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8447         is_output_symtab_index_set rather than needs_output_symtab_entry.
8448         * testsuite/discard_locals_relocatable_test.c: New file.
8449         * testsuite/discard_locals_test.sh: Test -r.
8450         * testsuite/Makefile.am (check_DATA): Add
8451         discard_locals_relocatable_test1.syms,
8452         discard_local_relocatable_test2.syms.
8453         (MOSTLYCLEANFILES): Likewise.  Also add
8454         discard_locals_relocatable_test1.lout and
8455         discard_locals_relocatable_test2.out.
8456         (discard_locals_relocatable_test1.syms): New target.
8457         (discard_locals_relocatable_test.o): New target.
8458         (discard_locals_relocatable_test1.out): New target.
8459         (discard_locals_relocatable_test2.syms): New target.
8460         (discard_locals_relocatable_test2.out): New target.
8461         (various): Add missing ../ld-new dependencies.
8462         * testsuite/Makefile.in: Rebuild.
8463
8464 2010-03-03  Nick Clifton  <nickc@redhat.com>
8465
8466         * po/fi.po: New Finnish translation.
8467
8468 2010-03-01  Doug Kwan  <dougkwan@google.com>
8469
8470         * layout.cc (Layout::Layout): Force section types of .init_array*,
8471         .preinit_array* and .fini_array* sections.
8472         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8473         Fix check of return value of std::string::find.().
8474         (Output_section::Input_section_sort_compare::operator()): Remove
8475         comment about .init_array.
8476         (Output_section::Input_section_sort_init_fini_compare::operator()):
8477         New method.
8478         (Output_section::sort_attached_input_sections): Handle .init_array
8479         and .fini_array specially.
8480         * output.h (Output_section::Inut_section_sort_compare): Update
8481         comment.
8482         (Output_section::Input_section_sort_init_fini_compare): New struct.
8483
8484 2010-02-26  Doug Kwan  <dougkwan@google.com>
8485
8486         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8487         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8488         * testsuite/debug_msg.sh: Avoid matching source line number for
8489         use of global variable undef_int.
8490
8491 2010-02-26  Doug Kwan  <dougkwan@google.com>
8492
8493         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8494         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8495         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8496         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8497         * options.cc (General_options::General_options): Initialize member
8498         fix_v4bx_.
8499         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8500         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8501         and rm_no_fix_v4bx.stdout
8502         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8503         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8504         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8505         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8506         and arm_no_fix_v4bx.
8507         * Makefile.in: Regenerate.
8508         * testsuite/arm_fix_v4bx.s: New file.
8509         * testsuite/arm_fix_v4bx.sh: Ditto.
8510
8511 2010-02-24  Doug Kwan  <dougkwan@google.com>
8512
8513         * arm.cc (Target_arm::got_section): Make the .got section the first
8514         non RELRO section in the data segment.
8515         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8516         suffixes of section names.
8517
8518 2010-02-24  Doug Kwan  <dougkwan@google.com>
8519
8520         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8521         flags and attributes merging if an input file is a binary file.
8522         * fileread.cc (Input_file::open): Record format of original file.
8523         * fileread.h (Input_file::Format): New enum type.
8524         (Input_file::Input_file): Initialize data member format_.
8525         (Input_file::format): New method definition.
8526         (Input_file::format_):: New data member.
8527
8528 2010-02-24  Doug Kwan  <dougkwan@google.com>
8529
8530         * arm.cc (Arm_output_data_got): New class.
8531         (ARM_TCB_SIZE): New constant
8532         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8533         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8534         If user uses a script with a SECTIONS clause, issue only a warning
8535         for a misplaced EXIDX input section.  Otherwise, issue an error.
8536         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8537         garbage collection.
8538         (Target_arm::got_mode_index_entry): Handle static linking.
8539         (Target_arm::Scan::local): Ditto.
8540         (Target_arm::Scan::global): Ditto.
8541         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8542         all incorrectly implemented relocations.
8543         (Target_arm::fix_exidx_coverage): Pass layout to
8544         Arm_output_section::fix_exidx_coverage.
8545         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8546         from ".ARM.exidx." and ".ARM.extab.".
8547
8548 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8549
8550         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8551         section if it does not already exist.
8552         * attributes.cc (Attributes_section_data::Attributes_section_data):
8553         Don't crash if size is zero.
8554
8555 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8556             Ian Lance Taylor  <iant@google.com>
8557
8558         * gold.cc (queue_middle_tasks): If no input files were opened,
8559         exit.
8560         * workqueue.h (Task_function::Task_function): Assert that there is
8561         a blocker.
8562
8563 2010-02-22  Doug Kwan  <dougkwan@google.com>
8564
8565         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8566         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8567         types to avoid warnings due to different uint64_t implementations
8568         on different hosts.
8569
8570 2010-02-21  Doug Kwan  <dougkwan@google.com>
8571
8572         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8573         handling of the maximum backward branch offset.
8574         (Arm_relocate_functions::thumb_branch_common): Ditto.
8575         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8576         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8577         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8578         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8579         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8580         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8581         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8582         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8583         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8584         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8585         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8586         thumb2_bl_out_of_range.o): New rules.
8587         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8588         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8589         thumb2_bl_out_of_range
8590         * testsuite/Makefile.in: Regenerate.
8591         * testsuite/arm_bl_in_range.s: New file.
8592         * testsuite/arm_bl_out_of_range.s: Ditto.
8593         * testsuite/arm_branch_in_range.sh: Ditto.
8594         * testsuite/arm_branch_range.t: Ditto.
8595         * testsuite/thumb2_branch_range.t: Ditto.
8596         * testsuite/thumb_bl_in_range.s: Ditto.
8597         * testsuite/thumb_bl_out_of_range.s: Ditto.
8598         * testsuite/thumb_branch_range.t: Ditto.
8599
8600 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8601
8602         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8603         Add reloc offset information.
8604         * icf.cc (get_section_contents): Change iterators to point to the new
8605         vectors. Add reloc offset information to the contents.
8606         * icf.h (Icf::Sections_reachable_info): New typedef.
8607         (Icf::Sections_reachable_list): New typedef.
8608         (Icf::Offset_info): New typedef.
8609         (Icf::Reloc_info): New struct typedef.
8610         (Icf::Reloc_info_list): New typedef.
8611         (Icf::symbol_reloc_list): Delete method.
8612         (Icf::addend_reloc_list): Delete method.
8613         (Icf::section_reloc_list): Delete method.
8614         (Icf::reloc_info_list): New method.
8615         (Icf::reloc_info_list_): New member.
8616
8617 2010-02-19  Doug Kwan  <dougkwan@google.com>
8618
8619         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8620         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8621         * arm.cc (Arm_relocation_functions): New forward declaration.
8622         (Target_arm::Target_arm): Initialize new data members
8623         got_mod_index_offset_ and tls_base_symbol_defined_.
8624         (Target_arm::Relocate::relocate_tls): New method.
8625         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8626          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8627         New methods.
8628         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8629         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8630         (Target_arm::got_mod_index_offset_,
8631         Target_arm::tls_base_symbol_defined_): New data members.
8632         (Target_arm::Scan::local, Target::Scan::global,
8633         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8634         relocations.
8635
8636 2010-02-18  Doug Kwan  <dougkwan@google.com>
8637
8638         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8639         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8640         text section as a parameter becuase some broken tools may not set
8641         the link in section header.
8642         (Target_arm::has_got_section): New method.
8643         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8644         without any mapping symbol as data only.  Remove warning.
8645         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8646         link in its section header, try to discover the link by inspecting the
8647         REL31 relocation at the beginning of the section.
8648         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8649         in error message.
8650         (Target_arm::Scan::global): Treat any reference to the symbol
8651         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8652
8653 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8654
8655         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8656         (Scan::global_reloc_may_be_function_pointer): New function.
8657         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8658         (Scan::global_reloc_may_be_function_pointer): New function.
8659         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8660         (Scan::global_reloc_may_be_function_pointer): New function.
8661         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8662         (Scan::global_reloc_may_be_function_pointer): New function.
8663         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8664         (Scan::global_reloc_may_be_function_pointer): New function.
8665         (Scan::possible_function_pointer_reloc): New function.
8666         (Target_x86_64::can_check_for_function_pointers): New function.
8667         * gc.h (gc_process_relocs): Scan relocation types to determine if
8668         function pointers were taken for targets that support it.
8669         * icf.cc (Icf::find_identical_sections): Include functions for
8670         folding in safe ICF whose pointer is not taken.
8671         * icf.h (Secn_fptr_taken_set): New typedef.
8672         (fptr_section_id_): New member.
8673         (section_has_function_pointers): New function.
8674         (set_section_has_function_pointers): New function.
8675         (check_section_for_function_pointers): New function.
8676         * options.h: Fix comment for safe ICF option.
8677         * target.h (can_check_for_function_pointers): New function.
8678         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8679         Modify icf_safe_test for X86-64.
8680         * testsuite/Makefile.in: Regenerate.
8681         * testsuite/icf_safe_so_test.cc: New file.
8682         * testsuite/icf_safe_so_test.sh: New file.
8683         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8684         (main): Change to take pointer to function kept_func_3.
8685         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8686         folding is done correctly for X86-64.
8687
8688 2010-02-12  David S. Miller  <davem@davemloft.net>
8689
8690         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8691         is_symbolless parameter.
8692         (Output_reloc<SHT_REL>::is_symbolless): New.
8693         (Output_reloc<SHT_REL>::is_symbolless_): New.
8694         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8695         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8696         (Output_reloc<SHT_RELA>::is_symbolless): New.
8697         (Output_data_reloc::add_global): Handle is_symbolless.
8698         (Output_data_reloc::add_global_relative): Likewise.
8699         (Output_data_reloc::add_local): Likewise.
8700         (Output_data_reloc::add_local_relative): Likewise.
8701         (Output_data_reloc::add_symbolless_global_addend): New.
8702         (Output_data_reloc::add_symbolless_local_addend): New.
8703         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8704         is_symbolless.
8705         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8706         instead of ->is_relative_
8707         (Output_reloc::write): Likewise.
8708         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8709         (Output_reloc::write_rel): Simplify.
8710
8711         * sparc.cc (Target_sparc::Scan::local): Use
8712         ->add_symbolless_local_addend as needed.
8713         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8714         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8715         based upon relocation offset.
8716
8717 2010-02-11  Doug Kwan  <dougkwan@google.com>
8718
8719         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8720         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8721         beginning of function.
8722         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8723         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8724         parameter is_32bit in calls to should_apply_static_reloc.
8725         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8726         (check_DATA): Add arm_abs_global.stdout.
8727         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8728         arm_abs_global.stdout): New rules.
8729         (MOSTLLYCLEANFILES): Add arm_abs_global
8730         * Makefile.in: Regenerate.
8731         * testsuite/arm_abs_global.s: New file.
8732         * testsuite/arm_abs_global.sh: Ditto.
8733         * testsuite/arm_abs_lib.s: Ditto.
8734
8735 2010-02-11  Ian Lance Taylor  <iant@google.com>
8736
8737         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8738         Read_relocs task.
8739         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8740         Allocate_commons_task first.
8741         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8742         task, rather than symtab_lock_.
8743         (Gc_process_relocs::~Gc_process_relocs): New function.
8744         (Gc_process_relocs::is_runnable): Check this_blocker_.
8745         (Gc_process_relocs::locks): Use next_blocker_ rather than
8746         blocker_.
8747         (Scan_relocs::~Scan_relocs): New function.
8748         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8749         symtab_lock_.
8750         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8751         next_blocker_.
8752         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8753         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8754         constructor accordingly.
8755         (class Gc_process_relocs): Likewise.
8756         (class Scan_relocs): Likewise.
8757         * common.h (class Allocate_commons_task): Remove symtab_lock_
8758         field, and corresponding constructor parameter.
8759         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8760         symtab_lock_.
8761         (Allocate_commons_task::locks): Likewise.
8762
8763 2010-02-11  Ian Lance Taylor  <iant@google.com>
8764
8765         * gold-threads.h (class Once): Define.
8766         (class Initialize_lock): Rewrite as child of Once.
8767         * gold-threads.cc (class Once_initialize): Define.
8768         (once_pointer_control): New static variable.
8769         (once_pointer, once_arg): New static variables.
8770         (c_run_once): New static function.
8771         (Once::Once, Once::run_once, Once::internal_run): New functions.
8772         (class Initialize_lock_once): Remove.
8773         (initialize_lock_control): Remove.
8774         (initialize_lock_pointer): Remove.
8775         (initialize_lock_once): Remove.
8776         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8777         (Initialize_lock::initialize): Rewrite.
8778         (Initialize_lock::do_run_once): New function.
8779         * archive.cc (Archive::interpret_header): Only clear name if it is
8780         not already empty.
8781         * fileread.cc: Include "gold-threads.h"
8782         (file_counts_lock): New static variable.
8783         (file_counts_initialize_lock): Likewise.
8784         (File_read::release): Only increment counts when using --stats.
8785         Use a lock around the increment.
8786         * parameters.cc (class Set_parameters_target_once): Define.
8787         (set_parameters_target_once): New static variable.
8788         (Parameters::Parameters): Move here from parameters.h.
8789         (Parameters::set_target): Rewrite.
8790         (Parameters::set_target_once): New function.
8791         (Parameters::clear_target): Move here and rewrite.
8792         * parameters.h (class Parameters): Update declarations.  Add
8793         set_parameters_target_once_ field.
8794         (Parameters::Parameters): Move to parameters.cc.
8795         (Parameters::clear_target): Likewise.
8796         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8797         task.
8798         (Start_group::~Start_group): New function.
8799         (Start_group::is_runnable): New function.
8800         (Start_group::locks, Start_group::run): New functions.
8801         (Finish_group::run): Change saw_undefined to size_t.
8802         * readsyms.h (class Start_group): Define.
8803         (class Finish_group): Change saw_undefined_ field to size_t.
8804         (Finish_group::Finish_group): Remove saw_undefined and
8805         this_blocker parameters.  Change all callers.
8806         (Finish_group::set_saw_undefined): New function.
8807         (Finish_group::set_blocker): New function.
8808         * symtab.h (class Symbol_table): Change saw_undefined to return
8809         size_t.  Change saw_undefined_ field to size_t.
8810         * target-select.cc (Set_target_once::do_run_once): New function.
8811         (Target_selector::Target_selector): Initialize set_target_once_
8812         field.  Don't initialize lock_ and initialize_lock_ fields.
8813         (Target_selector::instantiate_target): Rewrite.
8814         (Target_selector::set_target): New function.
8815         * target-select.h (class Set_target_once): Define.
8816         (class Target_selector): Update declarations.  Make
8817         Set_target_once a friend.  Remove lock_ and initialize_lock_
8818         fields.  Add set_target_once_ field.
8819
8820 2010-02-10  Ian Lance Taylor  <iant@google.com>
8821
8822         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8823         queueing any tasks.
8824         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8825         (queue_middle_tasks): Add all blockers before queueing any tasks.
8826         (queue_final_tasks): Likewise.
8827         * token.h (Task_token::add_blockers): New function.
8828         * object.h (Input_objects::number_of_relobjs): New function.
8829
8830 2010-02-10  Ian Lance Taylor  <iant@google.com>
8831
8832         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8833         shared, not if not position independent.
8834         * x86_64.cc (Relocate::relocate_tls): Likewise.
8835         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8836         (tls_pie_pic_test): New target.
8837         * testsuite/Makefile.in: Rebuild.
8838
8839         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8840         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8841         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8842         * testsuite/Makefile.in: Rebuild.
8843
8844 2010-02-09  David S. Miller  <davem@davemloft.net>
8845
8846         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8847         R_SPARC_RELATIVE using ->add_local_relative().
8848         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8849
8850         * output.h (Output_data_dynamic::add_section_size): New method
8851         that takes two Output_data objects.
8852         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8853         entry param.  Handle it in initializers.
8854         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8855         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8856         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8857         arg.
8858         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8859         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8860         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8861         for dynrel_includes_plt.
8862         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8863         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8864         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8865         before .rela.plt
8866         (Target_sparc::do_finalize_sections): Update to pass true for
8867         dynrel_includes_plt.
8868         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8869         output before .rela.plt
8870         (Target_powerpc::do_finalize_sections): Update to pass true for
8871         dynrel_includes_plt when 32-bit.
8872
8873 2010-02-08  Doug Kwan  <dougkwan@google.com>
8874
8875         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8876         method.
8877         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8878         Arm_relobj::scan_section_for_cortex_a8_stubs,
8879         Arm_relobj::do_relocation_section): Instead of calling
8880         Output_section::output_address, use faster
8881         Arm_relobj::simple_input_section_output_address.
8882
8883 2010-02-08  David S. Miller  <davem@davemloft.net>
8884
8885         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8886         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8887         relocation helper function.
8888
8889         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8890         just like R_SPARC_GOT{10,13,22}.
8891         (Target_sparc::Scan::local): Likewise.
8892         (Target_sparc::Relocate:relocate): Likewise.
8893
8894 2010-02-06  Ian Lance Taylor  <iant@google.com>
8895
8896         * configure.ac: Rewrite targetobjs duplicate removal code to use
8897         only shell constructs.
8898         * configure: Rebuild.
8899
8900 2010-02-05  Doug Kwan  <dougkwan@google.com>
8901
8902         PR 11247
8903         * arm.cc (Arm_relobj::section_is_scannable): New method.
8904         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8905         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8906
8907 2010-02-04  Doug Kwan  <dougkwan@google.com>
8908
8909         PR 11247
8910         * arm-reloc-property.cc (cstdio): Include.
8911         * configure.ac (targetobjs): Remove duplicates.
8912         * configure: Regenerate.
8913         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8914         big and little endian version for a given address size.
8915
8916 2010-02-03  Doug Kwan  <dougkwan@google.com>
8917
8918         * arm-reloc-property.cc
8919         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8920         definition.
8921         * arm-reloc-property.h
8922         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8923         New method definition.
8924         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8925         declaration.
8926         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8927         overflow to N.
8928         (GOT_PREL): Change implemented to Y.
8929         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8930         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8931         (Arm_relocate_functions::movw_abs_nc): Remove method.
8932         (Arm_relocate_functions::movt_abs): Ditto.
8933         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8934         (Arm_relocate_functions::thm_movt_abs): Ditto.
8935         (Arm_relocate_functions::movw_rel_nc): Ditto.
8936         (Arm_relocate_functions::movw_rel): Ditto.
8937         (Arm_relocate_functions::movt_rel): Ditto.
8938         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8939         (Arm_relocate_functions:thm_movw_rel): Ditto.
8940         (Arm_relocate_functions:thm_movt_rel): Ditto.
8941         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8942         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8943         New method definitions.
8944         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8945         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8946         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8947         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8948         (Target_arm::Relocate::relocate): Check for non-static or
8949         unimplemented relocation code and exit early.  Change calls to
8950         Target_arm::reloc_uses_thumb_bit and
8951         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8952         instead.  Refactor code to handle similar relocations to increase
8953         code sharing.  Remove check for unsupported relocation code in switch
8954         statement.
8955         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8956         relocation property table to find out size.  Change error message to
8957         print out the name of a relocation code instead of the numeric value.
8958         (Target_arm::scan_reloc_for_stub): Use relocation property table
8959         instead of calling Target_arm::reloc_uses_thumb_bit().
8960
8961 2010-02-02  Doug Kwan  <dougkwan@google.com>
8962
8963         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8964         types of relaxed input section.
8965
8966 2010-02-02  Doug Kwan  <dougkwan@google.com>
8967
8968         * Makefile.am (HFILES): Add arm-reloc-property.h.
8969         (DEFFILES): New.
8970         (TARGETSOURCES): Add arm-reloc-property.cc
8971         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8972         (libgold_a_SOURCES): $(DEFFILES)
8973         * Makefile.in: Regenerate.
8974         * arm-reloc-property.cc: New file.
8975         * arm-reloc-property.h: New file.
8976         * arm-reloc.def: New file.
8977         * arm.cc: Update comments.
8978         (arm-reloc-property.h): New included header.
8979         (arm_reloc_property_table): New global variable.
8980         (Target_arm::do_select_as_default_target): New method definition.
8981         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8982         arm-reloc-property to targ_extra_obj.
8983         * parameters.cc (set_parameters_target): Call
8984         Target::select_as_default_target().
8985         * target.h (Target::select_as_default_target): New method definition.
8986         (Target::do_select_as_default_target): Same.
8987
8988 2010-02-01  Doug Kwan  <dougkwan@google.com>
8989
8990         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8991         first_output_text_section_.
8992         (Arm_exidx_fixup::first_output_text_section): New method definition.
8993         (Arm_exidx_fixup::first_output_text_section_): New data member.
8994         (Arm_exidx_fixup::process_exidx_section): Record the first text
8995         output section seen.
8996         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8997         and entsize in output section header.
8998
8999 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9000
9001         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9002         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9003         (Arm_relocate_functions::thm_alu11): New Method.
9004         (Arm_relocate_functions::thm_pc8): New Method.
9005         (Arm_relocate_functions::thm_pc12): New Method.
9006         (Target_arm::Scan::local): Handle the relocations.
9007         (Target_arm::Scan::global): Likewise.
9008         (Target_arm::Relocate::relocate): Likewise.
9009         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9010
9011 2010-01-29  Doug Kwan  <dougkwan@google.com>
9012
9013         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9014         of relocation types as ld.
9015
9016 2010-01-29  Doug Kwan  <dougkwan@google.com>
9017
9018         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9019         to public.
9020         (Arm_relocate_functions::thumb_branch_common): Ditto.
9021         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9022         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9023         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9024         Arm_relocate_functions::jump24): Remove.
9025         (Target_arm::Relocate::relocate): Adjust code to call
9026         Arm_relocation_functions::arm_branch_common and
9027         Arm_relocation_functions::thumb_branch_common instead of their removed
9028         wrappers.  Merge switch-cases together to reduce source code size.
9029
9030 2010-01-29  Doug Kwan  <dougkwan@google.com>
9031
9032         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9033         output_local_symbol_count_needs_update_.
9034         (Arm_relobj::output_local_symbol_count_needs_update,
9035          Arm_relobj::set_output_local_symbol_count_needs_update,
9036          Arm_relobj::update_output_local_symbol_count): New methods.
9037         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9038         member.
9039         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9040         of pointed function as in a R_ARM_PREL31 relocation.
9041         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9042         for output local symbol count updating.
9043         (Target_arm::do_relax): Update output local symbol counts in objects
9044         if necessary.
9045         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9046
9047 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9048
9049         * arm.cc: Added support for the ARM relocations:
9050         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9051         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9052         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9053         movw_prel_nc).
9054         (Arm_relocate_functions::movw_rel): New method.
9055         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9056         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9057         thm_movw_prel_nc).
9058         (Arm_relocate_functions::thm_movw_rel): New method.
9059         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9060         thm_movt_prel).
9061         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9062         relocations.
9063         (Target_arm::Scan::global): Likewise.
9064         (Target_arm::Relocate::relocate): Likewise.
9065         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9066         Likewise.
9067
9068 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9069
9070         * arm.cc: Added support for ARM group relocations.
9071         (Target_arm::reloc_needs_sym_origin): New method.
9072         (Arm_relocate_functions::calc_grp_kn): New method.
9073         (Arm_relocate_functions::calc_grp_residual): New method.
9074         (Arm_relocate_functions::calc_grp_gn): New method.
9075         (Arm_relocate_functions::arm_grp_alu): New Method.
9076         (Arm_relocate_functions::arm_grp_ldr): New Method.
9077         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9078         (Arm_relocate_functions::arm_grp_ldc): New Method.
9079         (Target_arm::Scan::local): Handle the ARM group relocations.
9080         (Target_arm::Scan::global): Likewise.
9081         (Target_arm::Relocate::relocate): Likewise.
9082         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9083         Likewise.
9084
9085 2010-01-26  Doug Kwan  <dougkwan@google.com>
9086
9087         * arm.cc (set): Include.
9088         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9089         pointer type.
9090         (Arm_output_section::Text_section_list): New type.
9091         (Arm_output_section::append_text_sections_to_list): New method.
9092         (Arm_output_section::fix_exidx_coverage): Ditto.
9093         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9094         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9095         Relobj::set_section_offset() instead of
9096         Sized_relobj::invalidate_section_offset().
9097         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9098         parameter for section headers. Ignore relocation sections for
9099         unallocated sections and EXIDX sections.
9100         (Target_arm::fix_exidx_coverage): New method.
9101         (Target_arm::output_section_address_less_than): New type.
9102         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9103         linked text section instead of the EXIDX section.
9104         (Arm_output_section::create_stub_group): Add an assertion to check
9105         that this is not an EXIDX output section.
9106         (Arm_output_section::append_text_sections_to_list): New method.
9107         (Arm_output_section::fix_exidx_coverage): Ditto.
9108         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9109         Arm_relobj::section_needs_reloc_stub_scanning.
9110         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9111         first pass.
9112         (Target_arm::fix_exidx_coverage): New method.
9113         * object.h (Relobj::set_output_section): New method.
9114         (Sized_relobj::invalidate_section_offset): Remove method.
9115         (Sized_relobj::do_invalidate_section_offset): Remove method.
9116         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9117
9118 2010-01-25  Doug Kwan  <dougkwan@google.com>
9119
9120         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9121         Fix warning due to signed and unsigned comparison on a 32-bit host.
9122
9123 2010-01-22  Doug Kwan  <dougkwan@google.com>
9124
9125         * arm.cc (Target_arm::do_relax): Record an output section for section
9126         offset adjustment it contains any stub table that has changed.
9127         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9128         offsets in an output section if necessary.
9129         * output.cc (Output_section::Output_section): Initialize
9130         section_offsets_need_adjustments_.
9131         (Output_section::add_input_section_for_script): Renamed to
9132         Output_section::add_simple_input_section.
9133         (Output_section::save_states): Add a comment.
9134         (Output_section::discard_states): New method defintion.
9135         (Output_section::adjust_section_offsets): Same.
9136         * output.h (Output_section::add_input_section_for_script): Renamed to
9137         Output_section::add_simple_input_section.
9138         (Output_section::discard_states): New method declaration.
9139         (Output_section::adjust_section_offsets): Same.
9140         (Output_section::section_offsets_need_adjustment,
9141         Output_section::set_section_offsets_need_adjustment): New method
9142         definitions.
9143         (Output_section::section_offsets_need_adjustment_): New data member.
9144         * script-sections.cc
9145         (Output_section_element_input::set_section_address): Adjust code for
9146         renaming of Output_section::add_input_section_for_script.
9147         (Orphan_output_section::set_section_address): Same.
9148
9149 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9150
9151         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9152         Fix_v4bx enum values .
9153         * gold/options.h (General_options): New option definitions.
9154         (General_options::fix_v4bx): New method.
9155         (General_options::Fix_v4bx): New enum.
9156         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9157         (General_options::parse_fix_v4bx_interworking): New method.
9158
9159 2010-01-22  Doug Kwan  <dougkwan@google.com>
9160
9161         * arm.cc (Arm_exidx_fixup): New class.
9162
9163 2010-01-21  Doug Kwan  <dougkwan@google.com>
9164
9165         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9166         classes.
9167         (Arm_exidx_section_offset_map): New type.
9168
9169 2010-01-21  Doug Kwan  <dougkwan@google.com>
9170
9171         * arm.cc (Arm_exidx_input_section): New class.
9172         (Arm_relobj::exidx_input_section_by_link,
9173         Arm_relobj::exidx_input_section_by_shndx,
9174         Arm_relobj::make_exidx_input_section): New methods.
9175         (read_arm_attributes_section): Remove.
9176         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9177         information about them.
9178         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9179         to here.
9180
9181 2010-01-20  Doug Kwan  <dougkwan@google.com>
9182
9183         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9184         Input_section_specifier to Section_id.
9185         (Target_arm::new_arm_input_section: Adjust code for change of key
9186         type.
9187         (Target_arm::find_arm_input_section): Ditto.
9188         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9189         (Section_id): Remove.
9190         (Garbage_collection::Section_id_hash): Remove.
9191         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9192         (Section_id): Remove.
9193         (Icf::Section_id_hash): Remove.
9194         * object.h (Section_id, Const_section_id, Section_id_hash,
9195         Const_section_id_hash): New type definitions.
9196         * output.cc (Output_section::add_relaxed_input_section): Change to
9197         use Const_section_id instead of Input_section_specifier as key type.
9198         (Output_section::add_merge_input_section): Ditto.
9199         (Output_section::build_relaxation_map): Change to use Section_id
9200         instead of Input_section_specifier as key type.
9201         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9202         Ditto.
9203         (Output_section::convert_input_sections_to_relaxed_sections): Change
9204         to use Const_section_id instead of Input_section_specifier as key type.
9205         (Output_section::find_merge_section): Ditto.
9206         (Output_section::find_relaxed_input_section): Ditto.
9207         * output.h (Input_section_specifier): Remove class.
9208         (Output_section::Output_section_data_by_input_section_map): Change
9209         key type to Const_section_id.
9210         (Output_section::Output_relaxed_input_section_by_input_section_map):
9211         Ditto.
9212         (Output_section::Relaxation_map): Change key type to Section_id.
9213
9214 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9215
9216         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9217         (class Arm_v4bx_stub): New class.
9218         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9219         (Stub_factory::make_arm_v4bx_stub): New method.
9220         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9221         (Stub_table::empty): Handle v4bx stubs.
9222         (Stub_table::add_arm_v4bx_stub): New method.
9223         (Stub_table::find_arm_v4bx_stub): New method.
9224         (Arm_relocate_functions::v4bx): New method.
9225         (Target_arm::fix_v4bx): New method.
9226         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9227         (Stub_table::relocate_stubs): Likewise.
9228         (Stub_table::do_write): Likewise.
9229         (Stub_table::update_data_size_and_addralign): Likewise.
9230         (Stub_table::finalize_stubs):  Likewise.
9231         (Target_arm::Scan::local): Likewise.
9232         (Target_arm::Scan::global): Likewise.
9233         (Target_arm::do_finalize_sections): Likewise.
9234         (Target_arm::Relocate::relocate): Likewise.
9235         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9236         Likewise.
9237         (Target_arm::scan_reloc_for_stub): Likewise.
9238         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9239
9240 2010-01-19  Ian Lance Taylor  <iant@google.com>
9241
9242         * output.cc (Output_section_headers::do_sized_write): Write large
9243         segment count to sh_info field.
9244         (Output_file_header::do_sized_write): For large segment count,
9245         write PN_XNUM to e_phnum field.
9246
9247 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9248
9249         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9250         (Arm_relocate_functions::thm_jump8): New function.
9251         (Arm_relocate_functions::thm_jump11): New function.
9252         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9253         R_ARM_THM_JUMP11.
9254         (Target_arm::Scan::global): Likewise.
9255         (Target_arm::Relocate::relocate): Likewise.
9256         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9257         Likewise.
9258
9259 2010-01-14  Doug Kwan  <dougkwan@google.com>
9260
9261         * arm.cc (map, utility): Include headers.
9262         (Target_arm::apply_cortex_a8_workaround): New method.
9263         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9264         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9265         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9266         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9267         the --[no-]fix-cortex-a8 command line options.
9268         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9269         (Target_arm::relocate_stub): Use addend in instruction template.
9270         * options.h (DEFINE_bool): Set the user-set flag.
9271         (General_options): Add --[no-]-fix-cortex options.
9272         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9273         : Update fast look-up map after conversion.
9274
9275 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9276
9277         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9278         in the first pass of do_layout.
9279
9280 2010-01-13  Doug Kwan  <dougkwan@google.com>
9281
9282         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9283         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9284         apparent compiler problem of not folding static constant integral
9285         data members of elfcpp::Elf_sizes<32>.
9286
9287 2010-01-13  Doug Kwan  <dougkwan@google.com>
9288
9289         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9290         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9291         Arm_relobj::scan_section_for_cortex_a8_erratum,
9292         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9293         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9294         sections to scan for relocation stubs into a new method
9295         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9296         relocation and Cortex-A8 stub scanning.
9297         (Target_arm::do_relax): Force stubs to be after stubbed sections
9298         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9299         the beginning of a new relaxation pass.  Update a comment.
9300         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9301
9302 2010-01-12  Ian Lance Taylor  <iant@google.com>
9303
9304         * target-reloc.h (visibility_error): New inline function.
9305         (relocate_section): Call visibility_error.
9306         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9307         (MOSTLYCLEANFILES): Likewise.
9308         (protected_4_pic.o, protected_3.err): New targets.
9309         * testsuite/protected_4.cc: New file.
9310
9311 2010-01-12  Doug Kwan  <dougkwan@google.com>
9312
9313         * arm.cc (Cortex_a8_reloc): New class.
9314         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9315         and cortex_a8_relocs_info_.
9316         (Target_arm::fix_cortex_a8): New method definition.
9317         (Target_arm::Cortex_a8_relocs_info): New type.
9318         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9319         New data member declarations.
9320         (Target_arm::scan_reloc_for_stub): Record information about
9321         relocations for THUMB branches that might be exempted from the
9322         Cortex-A8 workaround.
9323         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9324         at the beginning of a relaxation pass.
9325
9326 2010-01-12  Doug Kwan  <dougkwan@google.com>
9327
9328         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9329         (Arm_relobj::Mapping_symbol_position,
9330          Arm_reloj::Mapping_symbol_position_less,
9331          Arm_relobj::Mapping_symbols_info): New types.
9332         (Target_arm::is_mapping_symbol_name): New method definition.
9333         (Arm_relobj::do_count_local_symbols): Save information about mapping
9334         symbols.
9335
9336 2010-01-11  Doug Kwan  <dougkwan@google.com>
9337
9338         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9339         Arm_relocate_functions::thumb32_branch_upper,
9340         Arm_relocate_functions::thumb32_branch_lower,
9341         Arm_relocate_functions::thumb32_cond_branch_offset,
9342         Arm_relocate_functions::thumb32_cond_branch_upper,
9343         Arm_relocate_functions::thumb32_cond_branch_lower,
9344         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9345         branch offset encoding.
9346         (Arm_relocate_functions::thumb_branch_common): Use new branch
9347         offset encoding methods to avoid code duplication.
9348         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9349         (Stub_addend_reader::operator()): Use new branch encoding method
9350         to avoid code duplication.
9351
9352 2010-01-11  Doug Kwan  <dougkwan@google.com>
9353
9354         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9355         (Target_arm::do_finalize_sections): Define special EXIDX section
9356         symbols only if referenced.
9357         * gc.h (Garbage_collection::add_reference): New method.
9358         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9359         code duplication.
9360
9361 2010-01-11  Ian Lance Taylor  <iant@google.com>
9362
9363         * script.cc (Version_script_info::build_expression_list_lookup):
9364         Change complaing about duplicate wildcard match from error to
9365         warning.
9366
9367         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9368         of 2009-12-30.
9369         (Version_script_info::Version_script_info): Initialize globs_,
9370         default_version_, default_is_global_, and exact_.  Don't
9371         initialize globals_ or locals_.
9372         (Version_script_info::build_lookup_tables): Build local symbols
9373         first.
9374         (Version_script_info::unquote): New function.
9375         (Version_script_info::add_exact_match): New function.
9376         (Version_script_info::build_expression_list_lookup): Remove lookup
9377         parameter.  Add is_global parameter.  Change all callers.  Handle
9378         wildcard pattern specially.  Unquote pattern.  Call
9379         add_exact_match.
9380         (Version_script_info::get_name_to_match): New function.
9381         (Version_script_info::get_symbol_version): New function.
9382         (Version_script_info::get_symbol_version_helper): Remove.
9383         (Version_script_info::check_unmatched_names): Call unquote.
9384         * script.h (class Version_script_info): Change get_symbol_version
9385         to be non-inline and add is_global parameter; change all callers.
9386         Rewrite symbol_is_local.  Update declarations.  Define struct
9387         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9388         Remove globals_ and locals_ members.  Add exact_, globs_,
9389         default_version_, is_global_.
9390         (Version_script_info::Glob): Remove pattern, add expression and
9391         is_global.  Update constructor.  Change all callers.
9392         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9393         default version.
9394         (Versions::symbol_section_contents): If a symbol is undefined, or
9395         defined in a dynamic object, set the version index to
9396         VER_NDX_LOCAL.
9397         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9398         symbol_is_local.
9399         (Symbol_table::add_from_pluginobj): Likewise.
9400         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9401
9402 2010-01-11  Doug Kwan  <dougkwan@google.com>
9403
9404         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9405         (incremental_dump_LDADD): Add linking option for libintl.
9406         * Makefile.in: Regenerate.
9407
9408 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9409
9410         PR gold/11144
9411         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9412         instead of -Ds.
9413         * testsuite/Makefile.in: Regenerated.
9414
9415 2010-01-10  Doug Kwan  <dougkwan@google.com>
9416
9417         * options.h (DEFINE_var): Use parentheses around argument varname__
9418         in macro body to avoid any unintended subsequent substitutions.
9419
9420 2010-01-10  Ian Lance Taylor  <iant@google.com>
9421
9422         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9423         candidates before doing symbol resolution.
9424
9425         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9426         ODR candidates if only one is weak.
9427
9428 2010-01-08  Ian Lance Taylor  <iant@google.com>
9429
9430         * script.cc (Version_script_info::build_expression_list_lookup):
9431         Don't warn about ambiguous version, just record the ambiguity.
9432         (Version_script_info::get_symbol_version_helper): Give error if
9433         version is ambiguous.
9434
9435 2010-01-08  Doug Kwan  <dougkwan@google.com>
9436
9437         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9438         prev_data_size_ and prev_addralign_.  Remove initializer for
9439         deleted data member has_been_changed_.
9440         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9441         to determine if the table is empty.
9442         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9443         Remove.
9444         (Stub_table::add_reloc_stub): Define method in class definition
9445         instead of just declaring it there.
9446         (Stub_table::add_cortex_a8_stub): New method definition.
9447         (Stub_table::update_data_size_and_addralign): Ditto.
9448         (Stub_table::finalize_stubs): Ditto.
9449         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9450         (Stub_table::do_addralign_): Return address alignment in the
9451         (Stub_table::do_reset_address_and_file_offset): Define method in
9452         class definition instead of declaring it there.  Set current data
9453         size to be the data size of the previous pass.
9454         (Stub_table::set_final_data_size): Use current data size as the
9455         final data size.
9456         (Stub_table::relocate_stub): Change parameter type of stub from
9457         Reloc_stub pointer to Stub pointer.
9458         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9459         (Stub_table::Cortex_a8_stub_list): New typedef.
9460         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9461          Stub_table::prev_addralign_): New data member.
9462         (Arm_relobj::Arm_relobj): Initialize data member
9463         section_has_cortex_a8_workaround_.
9464         (Arm_relobj::section_has_cortex_a8_workaround,
9465          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9466          definitions.
9467         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9468         declarations.
9469         (Target_arm::relocate_stub): Change parameter type of stub from
9470         Reloc_stub pointer to Stub pointer.
9471         (Insn_template::size, Insn_template::alignment): Handle
9472         THUMB16_SPECIAL_TYPE.
9473         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9474          Stub_table::update_data_size_and_addralign,
9475          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9476         definitions.
9477         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9478         (Stub_table::do_write): Ditto.
9479         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9480
9481 2010-01-08  Ian Lance Taylor  <iant@google.com>
9482
9483         PR 11108
9484         * symtab.h (class Symbol): Remove fields is_target_special_ and
9485         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9486         (Symbol::is_defined_in_discarded_section): New function.
9487         (Symbol::set_is_defined_in_discarded_section): New function.
9488         (Symbol::has_plt_offset): Rewrite.
9489         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9490         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9491         Don't initialize is_target_special_ or has_plt_offset_.
9492         Initialize is_defined_in_discarded_section_.
9493         (Symbol_table::add_from_relobj): If appropriate, set
9494         is_defined_in_discarded_section.
9495         * resolve.cc (Symbol::override_base_with_special): Don't test
9496         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9497         * target-reloc.h (relocate_section): Do special handling for
9498         symbols defined in discarded sections for global symbols as well
9499         as local symbols.
9500
9501 2010-01-08  Ian Lance Taylor  <iant@google.com>
9502
9503         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9504         the SHT_SYMTAB case.
9505
9506 2010-01-08  Ian Lance Taylor  <iant@google.com>
9507
9508         * object.cc (Sized_relobj::do_layout): Don't get confused if
9509         layout_eh_frame returns NULL.
9510
9511 2010-01-08  Ian Lance Taylor  <iant@google.com>
9512
9513         PR 11084
9514         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9515         dynamic symbol table, use the normal symbol table.
9516         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9517         symbol table.
9518
9519 2010-01-08  Ian Lance Taylor  <iant@google.com>
9520
9521         PR 11072
9522         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9523         sections.
9524
9525 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9526
9527         * version.cc (print_version): Change to "Copyright 2010".
9528
9529 2010-01-08  Ian Lance Taylor  <iant@google.com>
9530
9531         PR 10287
9532         PR 11063
9533         * i386.cc (class Target_i386): Change return type of plt_section
9534         to be non-const.
9535         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9536         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9537         tls_desc_rel_ field.
9538         (Output_data_plt_i386::rel_tls_desc): New function.
9539         (Target_i386::rel_tls_desc_section): New function.
9540         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9541         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9542         R_386_TLS_DESC reloc in rel_tls_desc_section.
9543         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9544         Define struct Tlsdesc_info.
9545         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9546         (Target_x86_64::do_reloc_symbol_index): New function.
9547         (Target_x86_64::add_tlsdesc_info): New function.
9548         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9549         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9550         tlsdesc_rel_ field.
9551         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9552         all callers.
9553         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9554         (Target_x86_64::rela_tlsdesc_section): New function.
9555         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9556         handling.
9557         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9558         (Target_x86_64::do_reloc_addend): New function.
9559         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9560         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9561         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9562         (Output_reloc::type): New function.
9563         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9564         (Output_reloc::is_target_specific): New function.
9565         (Output_reloc::target_arg): New function.
9566         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9567         absolute relocs and target specific relocs.
9568         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9569         add_target_specific.
9570         (class Output_data_reloc) [SHT_RELA]: Likewise.
9571         * output.cc (Output_reloc::Output_reloc): Add four new versions
9572         for absolute relocs and target specific relocs.
9573         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9574         (Output_reloc::get_symbol_index): Likewise.
9575         (Output_reloc::local_section_offset): Check that local_sym_index_
9576         is not TARGET_CODE or 0.
9577         (Output_reloc::symbol_value): Likewise.
9578         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9579         reloc.
9580         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9581         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9582         functions.
9583         * layout.cc (add_target_dynamic_tags): Use output section for
9584         DT_PLTRELSZ and DT_JMPREL.
9585
9586 2010-01-07  Ian Lance Taylor  <iant@google.com>
9587
9588         PR 11061
9589         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9590         function.
9591         (class Output_data_reloc_generic): Define.
9592         (class Output_data_reloc_base): Change base class to
9593         Output_data_reloc_generic.  Change add() method to call
9594         bump_relative_reloc_count for a relative reloc.  Remove
9595         sort_relocs_ field.
9596         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9597         to sort_relocs().
9598         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9599         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9600         appropriate.
9601         * layout.h (class Layout): Update declaration.
9602
9603 2010-01-07  Ian Lance Taylor  <iant@google.com>
9604
9605         * output.h (class Output_data): Add const version of
9606         output_section and do_output_section.
9607         (class Output_section_data): Add const version of
9608         do_output_section.
9609         (class Output_section): Likewise.
9610         * layout.cc (Layout::add_target_dynamic_tags): New function.
9611         * layout.h (class Layout): Update declarations.
9612         * arm.cc (Target_arm::do_finalize_sections): Use
9613         add_target_dynamic_tags.
9614         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9615         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9616         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9617         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9618
9619 2010-01-07  Ian Lance Taylor  <iant@google.com>
9620
9621         PR 11042
9622         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9623         object as needed.
9624
9625 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9626             Ian Lance Taylor  <iant@google.com>
9627
9628         PR 11019
9629         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9630         Xindex::read_symtab_xindex.
9631
9632 2010-01-07  Doug Kwan  <dougkwan@google.com>
9633
9634         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9635         (Insn_template::thumb16_bcond_insn): New method declaration.
9636         (Insn_template): Fix spelling.
9637         (Stub::thumb16_special): New method declaration.
9638         (Stub::do_write): Define virtual method which was previously pure
9639         virtual.
9640         (Stub::do_thumb16_special): New method declaration.
9641         (Stub::do_fixed_endian_write): New template member.
9642         (Reloc_stub::do_write): Remove.
9643         (Reloc_stub::do_fixed_endian_write): Remove.
9644         (Cortex_a8_stub): New class definition.
9645         (Stub_factory::make_cortex_a8_stub): New method definition.
9646         (Stub_factory::Stub_factory): Add missing static storage class
9647         qualifier for elf32_arm_stub_a8_veneer_blx.
9648
9649 2010-01-07  Ian Lance Taylor  <iant@google.com>
9650
9651         PR 10980
9652         * options.h (class General_options): Add --warn-unresolved-symbols
9653         and --error-unresolved-symbols.
9654         * errors.cc (Errors::undefined_symbol): Implement
9655         --warn-unresolved-symbols.
9656
9657         * options.h (class General_options): Add -z text and -z textoff.
9658         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9659
9660 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9661
9662         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9663         (Garbage_collection::cident_sections): New function.
9664         (Garbage_collection::add_cident_section): New function.
9665         (Garbage_collection::cident_sections_): New member.
9666         (gc_process_relocs): Add references to sections whose names are C
9667         identifiers.
9668         * gold.h (cident_section_start_prefix): New constant.
9669         (cident_section_stop_prefix): New constant.
9670         (is_cident): New function.
9671         * layout.cc (Layout::define_section_symbols): Replace string constants
9672         with the newly defined constants.
9673         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9674         C identifiers.
9675         * testsuite/Makefile.am: Add gc_orphan_section_test.
9676         * testsuite/Makefile.in: Regenerate.
9677         * testsuite/gc_orphan_section_test.cc: New file.
9678         * testsuite/gc_orphan_section_test.sh: New file.
9679
9680 2010-01-06  Ian Lance Taylor  <iant@google.com>
9681
9682         PR 10980
9683         * options.h (class General_options): Add --warn-shared-textrel.
9684         * layout.cc (Layout::finish_dynamic_section): Implement
9685         --warn-shared-textrel.
9686
9687         PR 10980
9688         * options.h (class General_options): Add --warn-multiple-gp.
9689
9690 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9691
9692         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9693         $(THREADSLIB) and $(LIBDL).
9694         * Makefile.in: Rebuild.
9695
9696 2010-01-06  Ian Lance Taylor  <iant@google.com>
9697
9698         PR 10980
9699         * options.cc (General_options::parse_section_start): New function.
9700         (General_options::section_start): New function.
9701         (General_options::General_options): Initialize all members.
9702         * options.h: Include <map>
9703         (class General_options): Add --section-start.  Add section_starts_
9704         member.
9705         * layout.cc (Layout::attach_allocated_section_to_segment): If
9706         --section-start was used, set the address of the segment.  Remove
9707         local sort_sections.
9708         (Layout::relaxation_loop_body): If the address of the load segment
9709         has been set by --section-start, don't use it.
9710         * output.h (Output_segment::update_flags_for_output_section): New
9711         function.
9712         * output.cc (Output_segment::add_output_section): Call
9713         update_flags_for_output_section.
9714
9715 2010-01-05  Ian Lance Taylor  <iant@google.com>
9716
9717         PR 10980
9718         * options.h (class General_options): Add --undefined-version.
9719         * script.cc (struct Version_expression): Add was_matched_by_symbol
9720         field.
9721         (Version_script_info::matched_symbol): New function.
9722         (Version_script_info::get_symbol_version_helper): Call
9723         matched_symbol.
9724         (Version_script_info::check_unmatched_names): New function.
9725         * script.h (class Version_script_info): Update declarations.
9726         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9727
9728         * options.h (class General_options): Use DEFINE_bool_alias for
9729         allow_multiple_definition.
9730         * resolve.cc (Symbol_table::should_override): Don't test
9731         allow_multiple_definition.
9732
9733         PR 10980
9734         * options.h (class General_options): Add --cref.
9735         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9736         until after printing cref table.
9737         * cref.cc: Include "symtab.h".
9738         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9739         (Cref_table_compare::operator()): New function.
9740         (Cref_inputs::gather_cref): New function.
9741         (filecol): New static const.
9742         (Cref_inputs::print_cref): New function.
9743         (Cref::print_cref): New function.
9744         * cref.h: Include <cstdio>.
9745         (class Cref): Update declarations.
9746         * mapfile.h (Mapfile::file): New function.
9747         * object.h (class Object): Define Symbols.  Declare virtual
9748         do_get_global_symbols.
9749         (Object::get_global_symbols): New function.
9750         * object.cc (Input_objects::add_object): Pass object to cref_ if
9751         --cref.
9752         (Input_objects::archive_start): Likewise.
9753         (Input_objects::archive_stop): Likewise.
9754         (Input_objects::print_cref): New function.
9755         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9756         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9757         --cref.
9758         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9759         function.
9760         * plugin.h (class Sized_pluginobj): Update declarations.
9761
9762 2010-01-05  Ian Lance Taylor  <iant@google.com>
9763
9764         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9765         to is_default_version.  Rename insdef to insdefault.
9766         (Symbol_table::add_from_relobj): Rename def to is_default_version
9767         and local to is_forced_local.
9768         (Symbol_table::add_from_pluginobj): Likewise.
9769         (Symbol_table::add_from_dynobj): Likewise.
9770         (Symbol_table::define_special_symbol): Rename insdef to
9771         insdefault.
9772
9773 2010-01-04  Ian Lance Taylor  <iant@google.com>
9774
9775         PR 10980
9776         * options.h (class General_options): Add
9777         --allow-multiple-definition and -z muldefs.
9778         * resolve.cc (Symbol_table::should_override): Don't warn about a
9779         multiple symbol definition if --allow-multiple-definition or -z
9780         muldefs.
9781
9782         PR 10980
9783         * options.h (class General_options): Add --add-needed and
9784         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9785         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9786         error if --copy-dt-needed-entries aka --add-needed is used and
9787         would cause a change in behaviour.
9788
9789         PR 10980
9790         * options.h (class General_options): Add -G as a short version of
9791         --shared.  Add no-op options -assert, -g, and -i.
9792
9793 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9794
9795         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9796         check for .text or .gnu.linkonce.t sections.
9797         * icf.cc (Icf::find_identical_sections): Ditto.
9798         Change the detection for mangled function name within the section
9799         name.
9800         * icf.h (is_section_foldable_candidate): New function.
9801
9802 2009-12-30  Ian Lance Taylor  <iant@google.com>
9803
9804         PR 10980
9805         * options.h (class General_options): Permit two dashes with
9806         --retain-symbols-file.
9807
9808 2009-12-30  Ian Lance Taylor  <iant@google.com>
9809
9810         PR 10979
9811         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9812         don't put the file header and segment headers in the text
9813         segment.
9814
9815         PR 10979
9816         * common.cc (Sort_commons::operator()): Stabilize sort when both
9817         entries are NULL.
9818         (Symbol_table::do_allocate_commons_list): When allocating common
9819         symbols, skip a symbol which is no longer common.
9820         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9821         an object before checking its type.
9822         * testsuite/common_test_2.c: New file.
9823         * testsuite/common_test_3.c: New file.
9824         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9825         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9826         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9827         (common_test_2_pic.o, common_test_2.so): New targets.
9828         (common_test_3_pic.o, common_test_3.so): New targets.
9829         * testsuite/Makefile.in: Rebuild.
9830
9831         PR 10979
9832         * script.cc (read_input_script): If we see a new SECTIONS clause,
9833         and we have added an input section, give an error.
9834         * layout.h (class Layout): Add have_added_input_section function.
9835         Add have_added_input_section_ field.
9836         * layout.cc (Layout::Layout): Initialize
9837         have_added_input_section_.
9838         (Layout::layout): Set have_added_input_section_.
9839         (Layout::layout_eh_frame): Likewise.
9840
9841 2009-12-30  Ian Lance Taylor  <iant@google.com>
9842
9843         PR 10931
9844         * options.h (class General_options): Add --sort-common option.
9845         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9846         * common.cc (Sort_common): Add sort_order parameter to
9847         constructor.  Add sort_order_ field.
9848         (Sort_commons::operator): Check sort_order_.
9849         (Symbol_table::allocate_commons): Determine the sort order.
9850         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9851         Change all callers.
9852         (Symbol_table::do_allocate_commons_list): Likewise.
9853
9854 2009-12-30  Ian Lance Taylor  <iant@google.com>
9855
9856         PR 10916
9857         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9858         symbols from this object, don't change the visibility of an
9859         undefined symbol.
9860         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9861
9862 2009-12-30  Ian Lance Taylor  <iant@google.com>
9863
9864         PR 10861
9865         * script.h (class Version_script_info): Define Language enum.
9866         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9867         new fields globals_, locals_, and is_finalized_.
9868         * script.cc: Various formatting fixes.
9869         (class Parser_closure): Change language_stack_ from a vector of
9870         std::string to one of Version_script_info::Language.  Adjust all
9871         uses accordingly.
9872         (class Lazy_demangler): Remove.
9873         (struct Version_expression): Change language from std::string to
9874         Version_script_info::Language.
9875         (Version_script_info::Version_script_info): New function.
9876         (Version_script_info::~Version_script_info): Don't call clear.
9877         (Version_script_info::finalize): New function.
9878         (Version_script_info::build_lookup_tables): New function.
9879         (Version_script_info::build_expression_list_lookup): New
9880         function.
9881         (Version_script_info::get_symbol_version_helper): Rewrite to use
9882         lookup tables.
9883         (Version_script_info::print_expression_list): Adjust to use
9884         Version_script_info::Language.
9885         (script_push_lex_into_version_mode): Check that the version script
9886         has not been finalized.
9887         (version_script_push_lang): Change language string to
9888         Version_script_info::Language.
9889         * options.cc (Command_line::version_script): New function.
9890         * options.h (class General_options): Add finalize_dynamic_list
9891         function.  Change version_script from declaration to definition.
9892         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9893         * testsuite/version_script.map: Remove duplicate def of foo.
9894         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9895         version_script.map.
9896         * testsuite/Makefile.in: Rebuild.
9897
9898 2009-12-30  Ian Lance Taylor  <iant@google.com>
9899
9900         PR 10843
9901         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9902         if the input symbol index is 0, make the output symbol index 0.
9903
9904 2009-12-30  Ian Lance Taylor  <iant@google.com>
9905
9906         PR 10670
9907         * options.h (class General_options): Add -x/--discard-all.
9908         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9909         --discard-all.  If the local symbol needs a dynamic entry, check
9910         that before handling --discard-locals.
9911
9912 2009-12-30  Ian Lance Taylor  <iant@google.com>
9913
9914         PR 10450
9915         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9916         flags to PF_R.
9917         (Output_segment::add_output_section): Don't change the flags if
9918         the type is PT_TLS.
9919
9920         PR 10450
9921         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9922         GNU hash table if they need a dynamic value.  Otherwise, don't add
9923         them if they are defined in a dynamic object or are forced local.
9924
9925 2009-12-29  Ian Lance Taylor  <iant@google.com>
9926
9927         PR 10450
9928         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9929         .gnu.hash table for a 32-bit target.
9930
9931         PR 10450
9932         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9933         regular and a dynamic object only needs a dynamic symbol table
9934         entry if it is externally visible.
9935
9936         PR 10450
9937         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9938         constructor.  Add global_offset_table_ field.
9939         (Target_i386::got_section): Set global_offset_table_.
9940         (Target_i386::do_finalize_sections): Set global_offset_table_
9941         size.
9942         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9943         in constructor.  Add global_offset_table_ field.
9944         (Target_x86_64::got_section): Set global_offset_table_.
9945         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9946         size.
9947
9948         * layout.cc (Layout::Layout): Initialize increase_relro_.
9949         (Layout::get_output_section): Add is_relro, is_last_relro, and
9950         is_first_non_relro parameters.  Change all callers.
9951         (Layout::choose_output_section): Likewise.
9952         (Layout::add_output_section_data): Likewise.
9953         (Layout::make_output_section): Likewise.
9954         (Layout::set_segment_offsets): Clear increase_relro when using a
9955         linker script.
9956         * layout.h (class Layout): Add increase_relro method.  Add
9957         increase_relro_ field.  Update declarations.
9958         * output.cc (Output_section::Output_section): Initialize
9959         is_last_relro_ and is_first_non_relro_.
9960         (Output_segment::add_output_section): Group relro sections is
9961         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9962         (Output_segment::maximum_alignment): Remove relro handling.
9963         (Output_segment::set_section_addresses): Add increase_relro
9964         parameter.  Change all callers.  Add initial alignment to align
9965         relro sections on separate page.  Remove old relro handling.
9966         (Output_segment::set_section_list_addresses): Remove in_relro
9967         parameter.  Change all callers.
9968         (Output_segment::set_offset): Add increase parameter.  Change all
9969         callers.  Remove old relro handling.
9970         * output.h (class Output_section): Add new methods: is_last_relro,
9971         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9972         Add is_last_relro_ and is_first_non_relro_ fields.
9973         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9974         Create separate .got.plt section.  Call increase_relro.
9975         * x86_64.cc (Target_x86_64::got_section): Likewise.
9976         * testsuite/relro_script_test.t: Add .got.plt.
9977
9978         PR 10450
9979         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9980         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9981         (Layout::finalize): Call set_dynamic_symbol_size.
9982         (Layout::set_dynamic_symbol_size): New function.
9983         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9984         set_dynamic_symbol_size.
9985
9986         PR 10450
9987         * output.h (class Output_section): Add is_entsize_zero_ field.
9988         * output.cc (Output_section::Output_section): Initialize
9989         is_entsize_zero_.
9990         (Output_section::set_entsize): If two different entsizes are
9991         requested, force it to zero.
9992         (Output_section::add_input_section): Set flags for .debug_str
9993         before updating section flags.  Set entsize.
9994         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9995         and SHF_STRING if all input sections have those flags.
9996
9997 2009-12-29   Rafael Espindola  <espindola@google.com>
9998
9999         * main.cc (main): Fix the sys time reporting.
10000         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10001         reporting.
10002
10003 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10004
10005         * options.cc (General_options::parse_version): Allow -v to exit
10006         without an error if there is nothing to link.
10007
10008 2009-12-29  Ian Lance Taylor  <iant@google.com>
10009
10010         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10011         using a version of gcc before 4.1.
10012         * configure: Rebuild.
10013
10014 2009-12-28  Chris Demetriou  <cgd@google.com>
10015
10016         * attributes.cc (Output_attributes_section_data::do_write): Use
10017         std::vector::front rather than std::vector::data.
10018
10019 2009-12-28  Ian Lance Taylor  <iant@google.com>
10020
10021         * symtab.h (class Symbol_table): Add enum Defined.
10022         * resolve.cc (Symbol_table::should_override): Add defined
10023         parameter.  Change all callers.  Test whether object is NULL
10024         before calling a method on it.
10025         (Symbol_table::report_resolve_problem): Add defined parameter.
10026         Change all callers.
10027         (Symbol_table::should_override_with_special): Likewise.
10028         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10029         parameter.  Change all callers.
10030         (Symbol_table::do_define_in_output_data): Likewise.
10031         (Symbol_table::define_in_output_segment): Likewise.
10032         (Symbol_table::do_define_in_output_segment): Likewise.
10033         (Symbol_table::define_as_constant): Likewise.
10034         (Symbol_table::do_define_as_constant): Likewise.
10035         * script.h (class Symbol_assignment): Add is_defsym parameter to
10036         constructor; change all callers.
10037         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10038         parameter.  Change all callers.  Add is_defsym_ field.
10039         (class Parser_closure): Add parsing_defsym parameter to
10040         constructor; change all callers.  Add parsing_defsym accessor
10041         function.  Add parsing_defsym_ field.
10042
10043 2009-12-28  Ian Lance Taylor  <iant@google.com>
10044
10045         * gold.cc (queue_middle_tasks): Fix formatting.
10046         * object.cc (Relobj::is_section_name_included): Likewise.
10047
10048 2009-12-23  Ian Lance Taylor  <iant@google.com>
10049
10050         * i386.cc (Target_i386::do_calls_non_split): Recognize
10051         -fsplit-stack prologue for a function with a static chain.
10052         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10053         -fsplit-stack prologue when using %r11.
10054
10055 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10056
10057         * options.cc (General_options::parse_version): Make -v continue and do
10058         the link like GNU ld does.
10059
10060 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10061
10062         * Makefile.am (CCFILES): Add timer.cc.
10063         (HFILES): Add timer.h.
10064         * configure.ac: Check for sysconf and times.
10065         * main.cc: include timer.h.
10066         (main): Use Timer instead of get_run_time.
10067         * timer.cc: New.
10068         * timer.h: New.
10069         * workqueue.cc: include timer.h.
10070         (Workqueue::find_and_run_task):
10071         Report user, sys and wall time.
10072         * Makefile.in: Regenerate.
10073         * config.in: Regenerate.
10074         * configure: Regenerate.
10075
10076 2009-12-16  Doug Kwan  <dougkwan@google.com>
10077
10078         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10079         sections.
10080         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10081         relaxed input sections.
10082         * output.cc (Output_section::find_relaxed_input_section): Change
10083         return type to Output_relaxed_input_section pointer.  Adjust code
10084         for new type of relaxed_input_section_map_.
10085         * output.h (Output_section::find_relaxed_input_section): Change
10086         return type to Output_relaxed_input_section pointer.
10087         (Output_section::Output_relaxed_input_section_by_input_section_map):
10088         New type.
10089         (Output_section::relaxed_input_section_map_): Change type to
10090         Output_section::Output_relaxed_input_section_by_input_section_map.
10091         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10092         input section.
10093
10094 2009-12-15  Ian Lance Taylor  <iant@google.com>
10095
10096         * layout.cc (Layout::create_shstrtab): Only write out after input
10097         sections if we are compressing debug sections.
10098
10099 2009-12-15  Ian Lance Taylor  <iant@google.com>
10100
10101         * archive.cc (Archive::add_symbols): Only look up a symbol without
10102         a version if there is, in fact, a version.
10103
10104 2009-12-14  Ian Lance Taylor  <iant@google.com>
10105
10106         Revert -Wshadow changes, all changes from:
10107         2009-12-11  Doug Kwan  <dougkwan@google.com>
10108         2009-12-11  Nick Clifton  <nickc@redhat.com>
10109         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10110
10111 2009-12-11  Doug Kwan  <dougkwan@google.com>
10112
10113         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10114         due to -Wshadow.
10115         * attributes.cc (Object_attribute::size): Ditto.
10116         (Attributes_section_data::size): Ditto.
10117         (Attributes_section_data::Attributes_section_data): Ditto.
10118         (Output_attributes_section_data::do_write): Ditto.
10119         * attributes.h (Object_attribute::set_type): Ditto.
10120         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10121
10122 2009-12-11  Nick Clifton  <nickc@redhat.com>
10123
10124         * archive.cc: Fix shadowed variable warnings.
10125         * arm.cc: Likewise.
10126         * compressed_output.cc: Likewise.
10127         * compressed_output.h: Likewise.
10128         * configure: Likewise.
10129         * dwarf_reader.cc: Likewise.
10130         * dynobj.cc: Likewise.
10131         * dynobj.h: Likewise.
10132         * ehframe.cc: Likewise.
10133         * ehframe.h: Likewise.
10134         * errors.cc: Likewise.
10135         * expression.cc: Likewise.
10136         * fileread.cc: Likewise.
10137         * fileread.h: Likewise.
10138         * freebsd.h: Likewise.
10139         * i386.cc: Likewise.
10140         * icf.cc: Likewise.
10141         * incremental.h: Likewise.
10142         * layout.cc: Likewise.
10143         * layout.h: Likewise.
10144         * mapfile.cc: Likewise.
10145         * merge.cc: Likewise.
10146         * merge.h: Likewise.
10147         * object.cc: Likewise.
10148         * object.h: Likewise.
10149         * options.h: Likewise.
10150         * output.cc: Likewise.
10151         * output.h: Likewise.
10152         * parameters.cc: Likewise.
10153         * plugin.cc: Likewise.
10154         * powerpc.cc: Likewise.
10155         * reduced_debug_output.cc: Likewise.
10156         * reduced_debug_output.h: Likewise.
10157         * reloc.cc: Likewise.
10158         * reloc.h: Likewise.
10159         * resolve.cc: Likewise.
10160         * script-sections.cc: Likewise.
10161         * script.cc: Likewise.
10162         * script.h: Likewise.
10163         * sparc.cc: Likewise.
10164         * symtab.cc: Likewise.
10165         * symtab.h: Likewise.
10166         * target-select.cc: Likewise.
10167         * target-select.h: Likewise.
10168         * token.h: Likewise.
10169         * workqueue.cc: Likewise.
10170         * workqueue.h: Likewise.
10171         * x86_64.cc: Likewise.
10172
10173 2009-12-10  Doug Kwan  <dougkwan@google.com>
10174
10175         * arm.cc (attributes.h): New include.
10176         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10177         (Arm_relobj::~Arm_relobj): Delete object pointed by
10178         attributes_section_data_.
10179         (Arm_relobj::attributes_section_data): New method definition.
10180         (Arm_relobj::attributes_section_data_): New data member declaration.
10181         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10182         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10183         attributes_section_data_.
10184         (Arm_dynobj::attributes_section_data): New method definition.
10185         (Arm_dynobj::attributes_section_data_): New data member declaration.
10186         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10187         initialization value of may_use_blx_ to false.
10188         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10189         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10190         object attributes to compute results instead of hard-coding.
10191         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10192         Target_arm::get_secondary_compatible_arch,
10193         Target_arm::set_secondary_compatible_arch
10194         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10195         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10196         New method declarations.
10197         (Target_arm::get_aeabi_object_attribute): New method definition.
10198         (Target_arm::attributes_section_data_): New data member declaration.
10199         (read_arm_attributes_section): New template definition.
10200         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10201         (Arm_dynobj::do_read_symbols): Ditto.
10202         (Target_arm::do_finalize_sections): Merge attributes sections from
10203         input.  Check for BLX use after attributes section merging.
10204         Fix __exidx_start and __exidx_end visibility.  Create an
10205         .ARM.attributes section if necessary.
10206         (Target_arm::get_secondary_compatible_arch,
10207         Target_arm::set_secondary_compatible_arch,
10208         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10209         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10210         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10211         New method definitions.
10212
10213 2009-12-09  Ian Lance Taylor  <iant@google.com>
10214
10215         * plugin.cc (Plugin::load): Don't cast from void* to a function
10216         pointer.
10217
10218 2009-12-09  Ian Lance Taylor  <iant@google.com>
10219
10220         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10221         information fields.
10222
10223 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10224
10225         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10226         Replace two_file_shared_1.so with two_file_shared_2.so.
10227         * testsuite/Makefile.in: Regenerated.
10228
10229 2009-12-08  Doug Kwan  <dougkwan@google.com>
10230
10231         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10232         (HFILES): Add attributes.h and int_encoding.h.
10233         * Makefile.in: Regenerate.
10234         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10235         function definitions to int_encoding.cc
10236         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10237         prototypes to int_encoding.h
10238         * reduced_debug_output.cc (int_encoding.h): New include.
10239         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10240         function definitions to int_encoding.cc
10241         (insert_into_vector, read_from_pointer): Move template definitions to
10242         int_encoding.h
10243         * attributes.cc: New file.
10244         * attributes.h: New file.
10245         * int_encoding.cc: New file.
10246         * int_encoding.h: New file.
10247
10248 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10249
10250         PR gold/11055
10251         * incremental-dump.cc (dump_incremental_inputs): New.
10252         (main): Use dump_incremental_inputs.
10253
10254 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10255
10256         PR gold/10893
10257         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10258         checking elfcpp::STT_FUNC.
10259         (Target_i386::Relocate::relocate): Likewise.
10260         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10261
10262         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10263         symbols from shared libraries into normal FUNC symbols.
10264
10265         * symtab.h (Symbol): Add is_func and use it.
10266
10267 2009-12-05  Doug Kwan  <dougkwan@google.com>
10268
10269         * arm.cc (Target_arm::arm_info): Initialize new fields
10270         attributes_section and attributes_vendor.
10271         * i386.cc (Target_i386::i386_info): Same.
10272         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10273         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10274         fields attributes_section and attributes_vendor.
10275         * sparc.cc (Target_sparc::sparc_info): Same.
10276         * target.h (Target::attributes_section, Target::attributes_vendor,
10277         Target::is_attributes_section, Target::attribute_arg_type,
10278         Target::attributes_order): New method definitions.
10279         (Target::Target_info::attributes_section,
10280         Target::Target_info::attributes_vendor): New fields.
10281         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10282         virtual method definitions.
10283         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10284         attributes_section and attributes_vendor.
10285         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10286
10287 2009-12-05  Doug Kwan  <dougkwan@google.com>
10288
10289         * arm.cc: Update comments about interworking and stub generation.
10290         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10291         considered as non-PIC.
10292         (Arm_relocate_functions::base_abs): Fix formatting.
10293         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10294         of function to use GOT entry address instead of offset.
10295         (Target_arm::Scan::global): Issue an error if a symbol would need a
10296         PLT does not get one because it is untyped.  Remove code to create
10297         dynamic symbols for relative branches.
10298         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10299         takes unsigned integer instead of boolean.
10300
10301 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10302
10303         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10304         (two_file_test_LDADD): Likewise.
10305         (common_test_1_LDADD): Likewise.
10306         (exception_test_LDADD) Likewise.
10307         (weak_test_LDADD): Likewise.
10308         (many_sections_test_LDADD): Likewise.
10309         (initpri1_LDADD): Likewise.
10310         (script_test_1_LDADD): Likewise.
10311         (script_test_2_LDADD): Likewise.
10312         (justsyms_LDADD): Likewise.
10313         (binary_test_LDADD): Likewise.
10314         (large_LDADD): Likewise.
10315         * testsuite/Makefile.in: Regenerated.
10316
10317 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10318
10319         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10320         (Symbol_table::override_with_special): Likewise.
10321         (Symbol_table::add_from_object): Likewise.
10322
10323 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10324
10325         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10326         Don't set the data_offset twice.
10327
10328 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10329
10330         * testsuite/Makefile.in: Regenerate.
10331
10332 2009-12-03  Doug Kwan  <dougkwan@google.com>
10333
10334         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10335         (Target_arm::do_finalize_sections): Add parameter for symbol table
10336         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10337         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10338         parameter for symbol table pointer.
10339         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10340         an additional parameter for a pointer to symbol table.
10341         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10342         parameter for a symbol table pointer.
10343         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10344         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10345         Ditto.
10346         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10347         parameter for a symbol table pointer.
10348
10349 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10350
10351         * incremental.cc (Incremental_inputs_header)
10352         (Incremental_inputs_header_write, Incremental_inputs_entry)
10353         (Incremental_inputs_entry_write): Move ...
10354         * incremental.h (Incremental_inputs_header)
10355         (Incremental_inputs_header_write, Incremental_inputs_entry)
10356         (Incremental_inputs_entry_write): here.
10357
10358 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10359
10360         * incremental.cc (make_sized_incremental_binary): Set the target.
10361         Error if it is incompatible.
10362         * output.h (Output_file): Add filename method.
10363
10364 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10365
10366         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10367         from the get_* methods.
10368
10369 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10370
10371         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10372         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10373         Write 0 for the data_offset of scripts.
10374
10375 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10376
10377         * testsuite/Makefile.am: Add the incremental_test.sh test.
10378         * testsuite/incremental_test.sh: New.
10379         * testsuite/incremental_test_1.c: New.
10380         * testsuite/incremental_test_2.c: New.
10381
10382 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10383
10384         * incremental-dump.cc (main): Fix typos.
10385
10386 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10387
10388         PR gold/11025
10389         * incremental-dump.cc (main): Use llu to print 64 bit values.
10390
10391 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10392             H.J. Lu  <hongjiu.lu@intel.com>
10393
10394         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10395         $(LIBDL).
10396         (incremental_dump_LDADD): Likewise.
10397         * Makefile.in: Regenerated.
10398
10399 2009-11-25  Doug Kwan  <dougkwan@google.com>
10400
10401         Revert:
10402
10403         2009-11-25  Doug Kwan  <dougkwan@google.com>
10404
10405                 * arm.cc (Target_arm::Target_arm): Move method definition
10406                 outside of class definition.  Add code to handle
10407                 --target1-rel, --target1-abs and --target2= options.
10408                 (Target_arm::get_reloc_reloc_type): Change method to be
10409                 non-static and const.
10410                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10411                 New data member declaration.
10412                 (Target_arm::Scan::local, Target_arm::Scan::global,
10413                 Target_arm::Relocate::relocate,
10414                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10415                 Adjust call to Target_arm::get_real_reloc_type.
10416                 (Target_arm::get_real_reloc_type): Use command line options
10417                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10418                 * options.h (--target1-rel, --target1-abs, --target2): New
10419                 ARM-only options.
10420
10421 2009-11-25  Doug Kwan  <dougkwan@google.com>
10422
10423         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10424         class definition.  Add code to handle --target1-rel, --target1-abs
10425         and --target2= options.
10426         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10427         and const.
10428         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10429         member declaration.
10430         (Target_arm::Scan::local, Target_arm::Scan::global,
10431         Target_arm::Relocate::relocate,
10432         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10433         call to Target_arm::get_real_reloc_type.
10434         (Target_arm::get_real_reloc_type): Use command line options to
10435         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10436         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10437         options.
10438
10439 2009-11-25  Doug Kwan  <dougkwan@google.com>
10440
10441         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10442         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10443         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10444         formatting.
10445         (Arm_relocate_functions::thm_call): Replace body with a call to
10446         Arm_relocate_functions::thumb_branch_common.
10447         (Arm_relocate_functions::thm_jump24,
10448         Arm_relocate_functions::thm_xpc22): New method definitions.
10449         (Arm_relocate_functions::thumb_branch_common): New method definition.
10450         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10451         operator.
10452         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10453         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10454
10455 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10456
10457         * Makefile.am: Build incremental-dump
10458         * Makefile.in: Regenerate.
10459         * incremental-dump.cc: New.
10460         * incremental.cc (Incremental_inputs_header_data,
10461         Incremental_inputs_entry_data): Move to incremental.h
10462         * incremental.h: (Incremental_inputs_header_data,
10463         Incremental_inputs_entry_data): Move from incremental.cc
10464
10465 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10466
10467         * incremental.cc (Incremental_inputs_header,
10468         Incremental_inputs_header_write, Incremental_inputs_entry,
10469         Incremental_inputs_entry_write): Add a typedef with the data type.
10470
10471 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10472
10473         * incremental.cc (Incremental_inputs_header,
10474         Incremental_inputs_header_write, Incremental_inputs_entry,
10475         Incremental_inputs_entry_write): Update comment about which
10476         type has the filed descriptions.
10477
10478 2009-11-15  Doug Kwan  <dougkwan@google.com>
10479
10480         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10481         (Arm_relocate_functions::arm_branch_common): Change method defintion
10482         in class definition to a method declaration and update list of formal
10483         parameters.
10484         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10485         Arm_relocation_functions::jump24): Adjust call to
10486         Arm_relocate_functions::arm_branch_common.  Update list of formal
10487         parameters.
10488         (Arm_relocate_functions::xpc25): New method definition.
10489         (Arm_relocate_functions::arm_branch_common): Move method defintion
10490         out from class definition.  Use stubs for mode-switching and extending
10491         branch ranges.
10492         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10493         specially.  Change code to enable use of stubs in ARM branches.
10494
10495 2009-11-10  Doug Kwan  <dougkwan@google.com>
10496
10497         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10498         in method declaration.
10499         (Target_arm::relocate_stub): New method declaration.
10500         (Target_arm::default_target): Change to return a pointer instead of
10501         a const reference.
10502         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10503         Target_arm::default_target.
10504         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10505         method definition.
10506         (Target_arm::relocate_section): Adjust view.
10507         (Target_arm::relocate_stub): New method definition.
10508
10509 2009-11-10  Doug Kwan  <dougkwan@google.com>
10510
10511         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10512         a format warning.
10513         * incremental.cc (open_incremental_binary): Initialized local
10514         variables to avoid warnings.
10515         * object.cc (make_elf_object): Ditto.
10516         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10517         a format warning.
10518
10519 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10520
10521         PR gold/10930
10522         * testsuite/plugin_test.c: Include "config.h".
10523
10524 2009-11-09  Doug Kwan  <dougkwan@google.com>
10525
10526         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10527         (arm_symbol_value): Remove.
10528         (Arm_relocate_functions::arm_branch_common,
10529         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10530         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10531         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10532         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10533         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10534         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10535         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10536         Arm_relocate_functions::thm_mobw_abs_nc,
10537         Arm_relocate_functions::thm_mov_abs,
10538         Arm_relocate_functions::movw_prel_nc,
10539         Arm_relocate_functions::thm_movt_abs,
10540         Arm_relocate_functions::movt_prel,
10541         Arm_relocate_functions::thm_movw_prel_nc,
10542         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10543         (Target_arm::Relocate::relocate): Only decompose address into two
10544         parts if relocation type uses the thumb-bit and pass the actual
10545         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10546         calls to methods in Arm_relocate_functions for this change.
10547
10548 2009-11-08  Ian Lance Taylor  <iant@google.com>
10549
10550         PR 10925
10551         * reloc.cc: Instantiate
10552         Sized_relobj::initialize_input_to_output_maps and
10553         Sized_relobj:free_input_to_output_maps.
10554
10555 2009-11-06  Ian Lance Taylor  <iant@google.com>
10556
10557         PR 10876
10558         * defstd.cc (in_segment): Set only_if_ref true for "end".
10559
10560 2009-11-06  Doug Kwan  <dougkwan@google.com>
10561
10562         * arm.cc (class Reloc_stub): Correct a comment.
10563         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10564         (Target_arm::scan_section_for_stubs): New method declaration.
10565         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10566         Change methods from private to protected.
10567         (Target_arm::do_may_relax): New method definition.
10568         (Target_arm::do_relax, Target_arm::group_sections,
10569         Target_arm::scan_reloc_for_stub,
10570         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10571         (Target_arm::arm_input_section_map_): New data member declaration.
10572         (Target_arm::scan_reloc_for_stub,
10573         Target_arm::scan_reloc_section_for_stubs,
10574         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10575         Target_arm::do_relax): New method definitions.
10576
10577 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10578
10579         * configure.ac: Check for (struct stat)::st_mtim
10580         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10581         * config.in: Regenerate.
10582         * configure: Regenerate.
10583
10584 2009-11-05  Ian Lance Taylor  <iant@google.com>
10585
10586         PR 10910
10587         * output.cc (Output_segment::add_output_section): Add missing
10588         return statement.
10589
10590 2009-11-04  Ian Lance Taylor  <iant@google.com>
10591
10592         PR 10880
10593         * object.h (class Object): Add is_needed and set_is_needed
10594         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10595         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10596         defined in a dynamic object and referenced by a regular object,
10597         set is_needed for the dynamic object.
10598         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10599         if the file is marked with as_needed and it is not needed.
10600
10601 2009-11-04  Ian Lance Taylor  <iant@google.com>
10602
10603         PR 10887
10604         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10605         tags if data is discarded by linker script.
10606         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10607         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10608         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10609         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10610
10611 2009-11-04  Ian Lance Taylor  <iant@google.com>
10612
10613         * layout.cc (Layout::get_output_section): Add is_interp and
10614         is_dynamic_linker_section parameters.  Change all callers.
10615         (Layout::choose_output_section): Likewise.
10616         (Layout::make_output_section): Likewise.
10617         (Layout::add_output_section_data): Add is_dynamic_linker_section
10618         parameter.  Change all callers.
10619         * layout.h (class Layout): Update declarations.
10620         * output.h (class Output_section): Add is_interp, set_is_interp,
10621         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10622         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10623         generate_code_fills_at_write_ to a bitfield.
10624         * output.cc (Output_section::Output_sections): Initialize new
10625         fields.
10626         (Output_segment::add_output_section): Add do_sort parameter.
10627         Change all callers.
10628
10629 2009-11-03  Ian Lance Taylor  <iant@google.com>
10630
10631         PR 10860
10632         * options.h (class General_options): Add --warn-common.
10633         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10634         merging two common symbols.
10635         (Symbol_table::should_override): Handle --warn-common when merging
10636         a common symbol with a defined symbol.  Use report_resolve_problem
10637         for multiple definitions.
10638         (Symbol_table::report_resolve_problem): New function.
10639         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10640
10641 2009-11-03  Doug Kwan  <dougkwan@google.com>
10642
10643         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10644         stub_factory_.
10645         (Target_arm::stub_factory): New method definition.
10646         (Target_arm::new_arm_input_section,
10647         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10648         Target_arm::reloc_uses_thumb_bit): New method declarations.
10649         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10650         New type definitions.
10651         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10652         member declarations.
10653         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10654         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10655         New method definitions.
10656
10657 2009-11-03  Ian Lance Taylor  <iant@google.com>
10658
10659         * options.h (class General_options): Add --warn_constructors.
10660
10661 2009-11-03  Ian Lance Taylor  <iant@google.com>
10662
10663         PR 10893
10664         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10665         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10666
10667 2009-11-03  Ian Lance Taylor  <iant@google.com>
10668
10669         PR 10895
10670         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10671         --msgid-bugs-address.
10672         (install-pdf): New target.
10673         (install-data_yes): Look up one directory to find mkinstalldirs.
10674
10675 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10676
10677         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10678         tree.
10679
10680 2009-10-30  Doug Kwan  <dougkwan@google.com>
10681
10682         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10683
10684 2009-10-30  Doug Kwan  <dougkwan@google.com>
10685
10686         * arm.cc (Stub_addend_reader): New struct template definition
10687         and partial specializations.
10688         (Stub_addend_reader::operator()): New method definition for a
10689         partially specialized template.
10690
10691 2009-10-30  Doug Kwan  <dougkwan@google.com>
10692
10693         * arm.cc (Arm_relobj::processor_specific_flags): New method
10694         definition.
10695         (Arm_relobj::do_read_symbols): New method declaration.
10696         (Arm_relobj::processor_specific_flags_): New data member declaration.
10697         (Arm_dynobj): New class definition.
10698         (Target_arm::do_finalize_sections): Add input_objects parameter.
10699         (Target_arm::do_adjust_elf_header): New method declaration.
10700         (Target_arm::are_eabi_versions_compatible,
10701         (Target_arm::merge_processor_specific_flags): New method declaration.
10702         (Target_arm::do_make_elf_object): New overloaded method definitions
10703         and declaration.
10704         (Arm_relobj::do_read_symbols): New method definition.
10705         (Arm_dynobj::do_read_symbols): Ditto.
10706         (Target_arm::do_finalize_sections): Add input_objects parameters.
10707         Merge processor-specific flags from all input objects.
10708         (Target_arm::are_eabi_versions_compatible,
10709         Target_arm::merge_processor_specific_flags,
10710         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10711         New method definitions.
10712         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10713         Input_objects pointer type parameter.
10714         * layout.cc (Layout::finalize): Pass input objects to target's.
10715         finalize_sections function.
10716         * output.cc (Output_file_header::do_sized_write): Set ELF file
10717         header's processor-specific flags.
10718         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10719         Input_objects pointer type parameter.
10720         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10721         * target.h (Input_objects): New forward class declaration.
10722         (Target::processor_specific_flags,
10723         Target::are_processor_specific_flags_sect): New method definitions.
10724         (Target::finalize_sections): Add input_objects parameter.
10725         (Target::Target): Initialize processor_specific_flags_ and
10726         are_processor_specific_flags_set_.
10727         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10728         parameter.
10729         (Target::set_processor_specific_flags): New method definition.
10730         (Target::processor_specific_flags_,
10731         Target::are_processor_specific_flags_set_): New data member
10732         declarations.
10733         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10734         Input_objects pointer type parameter.
10735
10736 2009-10-30  Doug Kwan  <dougkwan@google.com>
10737
10738         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10739
10740 2009-10-28  Ian Lance Taylor  <iant@google.com>
10741
10742         * object.h (class Relobj): Drop options parameter from
10743         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10744         do_scan_relocs, do_relocate.  Change all callers.
10745         (class Sized_relobj): Drop options parameters from
10746         do_gc_process_relocs, do_scan_relocs, do_relocate,
10747         do_relocate_sections, relocate_sections, emit_relocs_scan,
10748         emit_relocs_scan_reltype.  Change all callers.
10749         (struct Relocate_info): Remove options field and all references to
10750         it.
10751         * reloc.h (class Read_relocs): Remove options constructor
10752         parameter and options_ field.  Change all callers.
10753         (class Gc_process_relocs, class Scan_relocs): Likewise.
10754         (class Relocate_task): Likewise.
10755         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10756         all callers.
10757         (scan_relocatable_relocs): Likewise.
10758         * target.h (class Sized_target): Remove options parameter from
10759         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10760         all callers.
10761         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10762         callers.
10763         * arm.cc: Update functions to remove options parameters.
10764         * i386.cc: Likewise.
10765         * powerpc.cc: Likewise.
10766         * sparc.cc: Likewise.
10767         * x86_64.cc: Likewise.
10768         * testsuite/testfile.cc: Likewise.
10769
10770 2009-10-28  Doug Kwan  <dougkwan@google.com>
10771
10772         * arm.cc (Arm_relobj): New class definition.
10773         (Arm_relobj::scan_sections_for_stubs,
10774         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10775         New method definitions.
10776
10777 2009-10-28  Cary Coutant  <ccoutant@google.com>
10778
10779         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10780         (Plugin::cleanup_done_): New member.
10781         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10782         (Plugin_manager::cleanup_done_): Remove.
10783         (Plugin_manager::add_input_file): Edit error message.
10784         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10785         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10786
10787 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10788
10789         * fileread.cc: (File_read::View::~View): Use the new
10790         data_ownership_ filed.
10791         (File_read::~File_read): Dispose the new whole_file_view_.
10792         (File_read::open): Mmap the whole file if needed.
10793         (File_read::open): Use whole_file_view_ instead of contents_.
10794         (File_read::find_view): Use whole_file_view_ if applicable.
10795         (File_read::do_read): Use whole_file_view_ instead of contents_.
10796         (File_read::make_view): Use whole_file_view_ instead of contents_,
10797         update File_read::View::View call.
10798         (File_read::find_or_make_view): Update File_read::View::View
10799         call.
10800         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10801         remove contents_
10802         (File_read::View::Data_ownership): New enum.
10803         (File_read::View::View): Replace bool mapped_ with Data_ownership
10804         argument.
10805         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10806         (File_read::View::data_ownership_): New field.
10807         (File_read::contents_): Remove (replaced by whole_file_view_).
10808         (File_read::whole_file_view_): New field.
10809         * options.h (class General_options): Add --keep-files-mapped.
10810
10811 2009-10-27  Cary Coutant  <ccoutant@google.com>
10812
10813         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10814         * testsuite/Makefile.am (plugin_test_5): New test case.
10815         * testsuite/Makefile.in: Regenerate.
10816
10817 2009-10-25  Doug Kwan  <dougkwan@google.com>
10818
10819         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10820         from private to protected to allow access by child class.
10821         (Sized_relobj::do_relocate_sections): New method declaration.
10822         (Sized_relobj::relocate_sections): Virtualize.
10823         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10824         Sized_relobj::relocate_sections.  Instantiate template explicitly
10825         for different target sizes and endianity.
10826
10827 2009-10-24  Doug Kwan  <dougkwan@google.com>
10828
10829         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10830         (Arm_input_section::as_arm_input_section): New method.
10831         (Arm_output_section): New class definition.
10832         (Arm_output_section::create_stub_group,
10833         Arm_output_section::group_sections): New method definitions.
10834
10835 2009-10-22  Doug Kwan  <dougkwan@google.com>
10836
10837         * arm.cc (Arm_input_section): New class definition.
10838         (Arm_input_section::init, Arm_input_section:do_write,
10839         Arm_input_section::set_final_data_size,
10840         Arm_input_section::do_reset_address_and_file_offset): New method
10841         definitions.
10842
10843 2009-10-21  Doug Kwan  <dougkwan@google.com>
10844
10845         * arm.cc (Stub_table, Arm_input_section): New forward class
10846         declarations.
10847         (Stub_table): New class defintion.
10848         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10849         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10850         New method definition.
10851
10852 2009-10-21  Doug Kwan  <dougkwan@google.com>
10853
10854         * arm.cc: Update copyright comments.
10855         (Target_arm): New forward class template declaration.
10856         (Arm_address): New type.
10857         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10858         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10859         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10860         constants.
10861         (Insn_template): Same.
10862         (DEF_STUBS): New macro.
10863         (Stub_type): New enum type.
10864         (Stub_template): New class definition.
10865         (Stub): Same.
10866         (Reloc_stub): Same.
10867         (Stub_factory): Same.
10868         (Target_arm::Target_arm): Initialize may_use_blx_ and
10869         should_force_pic_veneer_.
10870         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10871         Target_arm::should_force_pic_veneer,
10872         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10873         Target_arm::using_thumb_only, Target_arm:;default_target): New
10874         method defintions.
10875         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10876         New data member declarations.
10877         (Insn_template::size, Insn_template::alignment): New method defintions.
10878         (Stub_template::Stub_template): New method definition.
10879         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10880         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10881         (Stub_factory::Stub_factory): New method definition.
10882         * gold.h (string_hash): New template.
10883         * output.h (Input_section_specifier::hash_value): Use
10884         gold::string_hash.
10885         (Input_section_specifier::string_hash): Remove.
10886         * stringpool.cc (Stringpool_template::string_hash): Use
10887         gold::string_hash.
10888
10889 2009-10-20  Doug Kwan  <dougkwan@google.com>
10890
10891         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10892         symbols of relaxed input sections.
10893         * output.h (Output_section::find_relaxed_input_section): Make
10894         method public.
10895
10896 2009-10-16  Doug Kwan  <dougkwan@google.com>
10897
10898         * dynobj.cc (Versions::Versions): Initialize version_script_.
10899         Only insert base version symbol definition for a shared object
10900         if version script defines any version versions.
10901         (Versions::define_base_version): New method definition.
10902         (Versions::add_def): Check that base version is not needed.
10903         (Versions::add_need): Define base version lazily.
10904         * dynobj.h (Versions::define_base_version): New method declaration.
10905         (Versions::needs_base_version_): New data member declaration.
10906         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10907         (check_DATA): Add no_version_test.stdout.
10908         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10909         New make rules.
10910         * testsuite/Makefile.in: Regenerate.
10911         * testsuite/no_version_test.c: New file.
10912         * testsuite/no_version_test.sh: Ditto.
10913
10914 2009-10-16  Doug Kwan  <dougkwan@google.com>
10915
10916         * expression.cc (class Segment_start_expression): New class definition.
10917         (Segment_start_expression::value): New method definition.
10918         (script_exp_function_segment_start): Return a new
10919         Segment_start_expression.
10920         * gold/script-c.h (script_saw_segment_start_expression): New function
10921         prototype.
10922         * script-sections.cc (Script_sections::Script_sections): Initialize
10923         SAW_SEGMENT_START_EXPRESSION_ to false.
10924         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10925         and -Tbbs options to specify section addresses if given in
10926         command line and no SEGMENT_START expression is seen in a script.
10927         * script-sections.h (Script_sections::saw_segment_start_expression,
10928         Script_sections::set_saw_segment_start_expression): New method
10929         definition.
10930         (Script_sections::saw_segment_start_expression_): New data member
10931         declaration.
10932         * script.cc (script_saw_segment_start_expression): New function.
10933         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10934         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10935         script_test_7.sh and script_test_8.sh.
10936         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10937         script_test_8.stdout.
10938         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10939         (script_test_6, script_test_6.stdout, script_test_7,
10940         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10941         * Makefile.in: Regenerate.
10942         * testsuite/script_test_6.sh: New file.
10943         * testsuite/script_test_6.t: Same.
10944         * testsuite/script_test_7.sh: Same.
10945         * testsuite/script_test_7.t: Same.
10946         * testsuite/script_test_8.sh: Same.
10947
10948 2009-10-16  Doug Kwan  <dougkwan@google.com>
10949
10950         * output.cc (Output_segment::set_section_list_address): Cast
10951         expressions to unsigned long long type to avoid format warnings.
10952
10953 2009-10-15  Ian Lance Taylor  <iant@google.com>
10954
10955         * script.cc (Script_options::add_symbol_assignment): Always add a
10956         dot assignment to script_sections_.
10957         * script-sections.cc (Script_sections::add_dot_assignment):
10958         Initialize if necessary.
10959
10960         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10961         program headers with no load segment if there is a linker script.
10962
10963         * layout.cc (Layout::set_segment_offsets): Align the file offset
10964         to the segment aligment for -N or -n with no load segment.
10965         * output.cc (Output_segment::add_output_section): Don't crash if
10966         the first section is a TLS section.
10967         (Output_segment::set_section_list_addresses): Print an error
10968         message if the address moves backward in a linker script.
10969         * script-sections.cc
10970         (Output_section_element_input::set_section_addresses): Don't
10971         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10972         (Orphan_output_section::set_section_addresses): Likewise.
10973
10974 2009-10-15  Doug Kwan  <dougkwan@google.com>
10975
10976         * layout.cc (Layout::finish_dynamic_section): Generate tags
10977         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10978         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10979         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10980
10981 2009-10-14  Ian Lance Taylor  <iant@google.com>
10982
10983         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10984         fields.
10985         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10986         data_shdr fields of relinfo.
10987         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10988         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10989         R_386_TLS_LDO_32, adjust based on section flags.
10990         (Target_i386::Relocate::fix_up_ldo): Remove.
10991
10992 2009-10-13  Ian Lance Taylor  <iant@google.com>
10993
10994         Add support for -pie.
10995         * options.h (class General_options): Add -pie and
10996         --pic-executable.
10997         (General_options::output_is_position_independent): Test -pie.
10998         (General_options::output_is_executable): Return true if not shared
10999         and not relocatable.
11000         (General_options::output_is_pie): Remove.
11001         * options.cc (General_options::finalize): Reject incompatible uses
11002         of -pie.
11003         * gold.cc (queue_middle_tasks): A -pie link is not static.
11004         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11005         * symtab.cc (Symbol::final_value_is_known): Return false if
11006         output_is_position_independent.
11007         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11008         output_is_position_independent.
11009         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11010         output_is_position_independent.
11011         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11012         output_is_position_independent.
11013         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11014         two_file_pie_test.
11015         (basic_pie_test.o, basic_pie_test): New targets.
11016         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11017         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11018         (two_file_pie_test): New target.
11019         * testsuite/Makefile.in: Rebuild.
11020         * README: Remove note saying that -pie is not supported.
11021
11022 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11023
11024         * options.h (class General_options): Add -init and -fini.
11025         * layout.cc (Layout::finish_dynamic_section): Emit
11026         given init and fini functions.
11027
11028 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11029
11030         * gc.h (gc_process_relocs): Check if icf is enabled using new
11031         function.
11032         * gold.cc (queue_initial_tasks): Likewise.
11033         (queue_middle_tasks): Likewise.
11034         * object.cc (do_layout): Likewise.
11035         * symtab.cc (is_section_folded): Likewise.
11036         * main.cc (main): Likewise.
11037         * reloc.cc (Read_relocs::run): Likewise.
11038         (Sized_relobj::do_scan_relocs): Likewise.
11039         * icf.cc (is_function_ctor_or_dtor): New function.
11040         (Icf::find_identical_sections): Check if function is ctor or dtor when
11041         safe icf is chosen.
11042         * options.h (General_options::icf): Change option to be an enum.
11043         (Icf_status): New enum.
11044         (icf_enabled): New method.
11045         (icf_safe_folding): New method.
11046         (set_icf_status): New method.
11047         (icf_status_): New variable.
11048         * (options.cc) (General_options::finalize): Set icf_status_.
11049         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11050         icf_test and icf_keep_unique_test to use the --icf enum flag.
11051         * testsuite/icf_safe_test.sh: New file.
11052         * testsuite/icf_safe_test.cc: New file.
11053
11054 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11055
11056         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11057         includes to gc.h and icf.h.
11058         * arm.cc: Include gc.h.
11059         * gold.cc: Likewise.
11060         * i386.cc: Likewise.
11061         * powerpc.cc: Likewise.
11062         * sparc.cc: Likewise.
11063         * x86_64.cc: Likewise.
11064         * gc.h: Include icf.h.
11065
11066 2009-10-11  Ian Lance Taylor  <iant@google.com>
11067
11068         * plugin.cc: Include "gold.h" before other header files.
11069
11070 2009-10-10  Chris Demetriou  <cgd@google.com>
11071
11072         * options.h (Input_file_argument::Input_file_type): New enum.
11073         (Input_file_argument::is_lib_): Replace with...
11074         (Input_file_argument::type_): New member.
11075         (Input_file_argument::Input_file_argument): Take Input_file_type
11076         'type' rather than boolean 'is_lib' as second argument.
11077         (Input_file_argument::is_lib): Use type_.
11078         (Input_file_argument::is_searched_file): New function.
11079         (Input_file_argument::may_need_search): Handle is_searched_file.
11080         * options.cc (General_options::parse_library): Support -l:filename.
11081         (General_options::parse_just_symbols): Update for Input_file_argument
11082         changes.
11083         (Command_line::process): Likewise.
11084         * archive.cc (Archive::get_file_and_offset): Likewise.
11085         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11086         * script.cc (read_script_file, script_add_file): Likewise.
11087         * fileread.cc (Input_file::Input_file): Likewise.
11088         (Input_file::will_search_for): Handle is_searched_file.
11089         (Input_file::open): Likewise.
11090         * readsyms.cc (Read_symbols::get_name): Likewise.
11091         * testsuite/Makefile.am (searched_file_test): New test.
11092         * testsuite/Makefile.in: Regenerate.
11093         * testsuite/searched_file_test.cc: New file.
11094         * testsuite/searched_file_test_lib.cc: New file.
11095
11096 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11097             Ian Lance Taylor  <iant@google.com>
11098
11099         * descriptor.cc: Include <cstdio> and "binary-io.h".
11100         (Descriptors::open): Open the files in binary mode always.
11101         * script.cc (Lex::get_token): Treat \r as whitespace.
11102
11103 2009-10-09  Ian Lance Taylor  <iant@google.com>
11104
11105         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11106
11107 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11108             Ian Lance Taylor  <iant@google.com>
11109
11110         * configure.ac: Check for readv function also.
11111         * fileread.cc (readv): Define if not HAVE_READV.
11112         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11113         does not exist.
11114         * config.in: Regenerate.
11115         * configure: Regenerate.
11116
11117 2009-10-09  Doug Kwan  <dougkwan@google.com>
11118
11119         * layout.cc (Layout::make_output_section): Call target hook to make
11120         ordinary output section.
11121         (Layout::finalize): Adjust parameter list of call the
11122         Target::may_relax().
11123         * layout.h (class Layout::section_list): New method.
11124         * merge.h (Output_merge_base::entsize): Change visibility to public.
11125         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11126         New methods.
11127         (Output_merge_string::do_is_string): New method.
11128         * object.cc (Sized_relobj::do_setup): renamed from
11129         Sized_relobj::set_up.
11130         * object.h (Sized_relobj::adjust_shndx,
11131         Sized_relobj::initializ_input_to_output_maps,
11132         Sized_relobj::free_input_to_output_maps): Change visibilities to
11133         protected.
11134         (Sized_relobj::setup): Virtualize.
11135         (Sized_relobj::do_setup): New method declaration.
11136         (Sized_relobj::invalidate_section_offset,
11137         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11138         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11139         * options.cc (parse_int): New function.
11140         * options.h (parse_int): New declaration.
11141         (DEFINE_int): New macro.
11142         (stub_group_size): New option.
11143         * output.cc (Output_section::Output_section): Initialize memebers
11144         merge_section_map_, merge_section_by_properties_map_,
11145         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11146         (Output_section::add_input_section): Handled deferred code-fill
11147         generation and remove an old comment.
11148         (Output_section::add_relaxed_input_section): New method definition.
11149         (Output_section::add_merge_input_section): Use merge section by
11150         properties map to speed to search.  Update merge section maps
11151         as appropriate.
11152         (Output_section::build_relaxation_map): New method definition.
11153         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11154         Same.
11155         (Output_section::relax_input_section): Renamed to
11156         Output_section::convert_input_sections_to_relaxed_sections and change
11157         interface to take a vector of pointers to relaxed sections.
11158         (Output_section::find_merge_section,
11159         Output_section::find_relaxed_input_section): New method definitions.
11160         (Output_section::is_input_address_mapped,
11161         Output_section::output_offset, Output_section::output_address):
11162         Use output section data maps to speed up searching.
11163         (Output_section::find_starting_output_address): Add comments.
11164         (Output_section::do_write,
11165         Output_section::write_to_postprocessing_buffer): Do code-fill
11166         generation as appropriate.
11167         (Output_section::get_input_sections): Invalidate relaxed input section
11168         map.
11169         (Output_section::restore_states): Adjust type of checkpoint .
11170         Invalidate relaxed input section map.
11171         * output.h (Output_merge_base): New class declaration.
11172         (Input_section_specifier): New class defintion.
11173         (class Output_relaxed_input_section) Change base class to
11174         Output_section_data_build.
11175         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11176         base class initializer.
11177         (Output_section::add_relaxed_input_section): New method declaration.
11178         (Output_section::Input_section): Change visibility to protected.
11179         (Output_section::Input_section::relobj,
11180         Output_section::Input_section::shndx): Handle relaxed input sections.
11181         Output_section::input_sections) Change visibility to protected.  Also
11182         define overload to return a non-const pointer.
11183         (Output_section::Merge_section_properties): New class defintion.
11184         (Output_section::Merge_section_by_properties_map,
11185         Output_section::Output_section_data_by_input_section_map,
11186         Output_section::Relaxation_map): New types.
11187         (Output_section::relax_input_section): Rename method to
11188         Output_section::convert_input_sections_to_relaxed_sections and change
11189         interface to take a vector of relaxed section pointers.
11190         (Output_section::find_merge_section,
11191         Output_section::find_relaxed_input_section,
11192         Output_section::build_relaxation_map,
11193         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11194         New method declarations.
11195         (Output_section::merge_section_map_
11196         Output_section::merge_section_by_properties_map_,
11197         Output_section::relaxed_input_section_map_,
11198         Output_section::is_relaxed_input_section_map_valid_,
11199         Output_section::generate_code_fills_at_write_): New data members.
11200         * script-sections.cc
11201         (Output_section_element_input::set_section_addresses): Call
11202         current_data_size and addralign methods of relaxed input sections.
11203         (Orphan_output_section::set_section_addresses): Call current_data_size
11204         and addralign methods of relaxed input sections.
11205         * symtab.cc (Symbol_table::compute_final_value): Extract template
11206         from the body of Symbol_table::sized_finalize_symbol.
11207         (Symbol_table::sized_finalized_symbol): Call
11208         Symbol_table::compute_final_value.
11209         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11210         (Symbol_table::compute_final_value): New templated method declaration.
11211         * target.cc (Target::do_make_output_section): New method defintion.
11212         * target.h (Target::make_output_section): New method declaration.
11213         (Target::relax): Add more parameters for input objects, symbol table
11214         and layout.  Adjust call to do_relax.
11215         (Target::do_make_output_section): New method declaration.
11216         (Target::do_relax): Add parameters for input objects, symbol table
11217         and layout.
11218
11219 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11220
11221         * pread.c: Include stdio.h.
11222
11223 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11224
11225         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11226         defined.
11227
11228 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11229
11230         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11231         Change read_shndx type to unsigned int.
11232         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11233         int.
11234         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11235         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11236         Change read_shndx type to unsigned int.
11237         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11238         int.
11239         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11240         * layout.cc (Layout::create_symtab_sections): Cast the result of
11241         local_symcount * symsize to off_t in the gold_assert.
11242
11243 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11244
11245         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11246         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11247         R_ARM_BASE_ABS.
11248         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11249         (Arm_relocate_functions::thm_abs5): New function.
11250         (Arm_relocate_functions::abs12): New function.
11251         (Arm_relocate_functions::abs16): New function.
11252         (Arm_relocate_functions::base_abs): New function.
11253         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11254         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11255         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11256         R_ARM_BASE_ABS.
11257         (Scan::global): Likewise.
11258         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11259         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11260         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11261         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11262         R_ARM_BASE_ABS.
11263
11264 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11265
11266         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11267         (Arm_relocate_functions::movt_prel): New function.
11268         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11269         (Arm_relocate_functions::thm_movt_prel): New function.
11270         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11271         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11272         (Scan::global, Relocate::relocate): Likewise.
11273         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11274
11275 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11276
11277         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11278         Incremental_checker.
11279         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11280         unsigned int.
11281         (class Incremental_inputs_header): New class.
11282         (Incremental_inputs_header_writer): Edit comment.
11283         (Incremental_inputs_entry): New class.
11284         (Incremental_inputs_entry_writer): Edit comment.
11285         (Sized_incremental_binary::do_find_incremental_inputs_section):
11286         Add *strtab_shndx parameter, fill it.
11287         (Sized_incremental_binary::do_check_inputs): New method.
11288         (Incremental_checker::can_incrementally_link_output_file): Use
11289         Sized_incremental_binary::check_inputs.
11290         (Incremental_inputs::report_command_line): Save command line in
11291         command_line_.
11292         * incremental.h:
11293         (Incremental_binary::find_incremental_inputs_section): New
11294         method.
11295         (Incremental_binary::do_find_incremental_inputs_section): Add
11296         strtab_shndx parameter.
11297         (Incremental_binary::do_check_inputs): New pure virtual method.
11298         (Sized_incremental_binary::do_check_inputs): Declare.
11299         (Incremental_checker::Incremental_checker): Add incremental_inputs
11300         parameter, use it to initialize incremental_inputs_.
11301         (Incremental_checker::incremental_inputs_): New field.
11302         (Incremental_checker::command_line): New method.
11303         (Incremental_checker::inputs): New method.
11304         (Incremental_checker::command_line_): New field.
11305
11306 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11307
11308         * incremental.cc: Include <cstdarg> and "target-select.h".
11309         (vexplain_no_incremental): New function.
11310         (explain_no_incremental): New function.
11311         (Incremental_binary::error): New method.
11312         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11313         method.
11314         (make_sized_incremental_binary): New function.
11315         (open_incremental_binary): New function.
11316         (can_incrementally_link_file): Add checks if output is ELF and has
11317         inputs section.
11318         * incremental.h: Include "elfcpp_file.h" and "output.h".
11319         (Incremental_binary): New class.
11320         (Sized_incremental_binary): New class.
11321         (open_incremental_binary): Declare.
11322         * object.cc (is_elf_object): Use
11323         elfcpp::Elf_recognizer::is_elf_file.
11324         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11325         * output.h (Output_file::filesize): New method.
11326
11327 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11328
11329         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11330         New function.
11331         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11332         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11333         function.
11334         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11335         function.
11336         (Arm_relocate_functions::movw_abs_nc): New function.
11337         (Arm_relocate_functions::movt_abs): New function.
11338         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11339         (Arm_relocate_functions::thm_movt_abs): New function.
11340         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11341         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11342         (Scan::global): Likewise.
11343         (Relocate::relocate): Likewise.
11344         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11345
11346 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11347
11348         * arm.cc (Arm_relocate_functions::got_prel) New function.
11349         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11350         (Relocate::relocate): Likewise.
11351         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11352
11353 2009-10-06  Ian Lance Taylor  <iant@google.com>
11354
11355         * options.h (class General_options): Define
11356         split_stack_adjust_size parameter.
11357         * object.h (class Object): Add uses_split_stack_ and
11358         has_no_split_stack_ fields.  Add uses_split_stack and
11359         has_no_split_stack accessor functions.  Declare
11360         handle_split_stack_section.
11361         (class Reloc_symbol_changes): Define.
11362         (class Sized_relobj): Define Function_offsets.  Declare
11363         split_stack_adjust, split_stack_adjust_reltype, and
11364         find_functions.
11365         * object.cc (Object::handle_split_stack_section): New function.
11366         (Sized_relobj::do_layout): Call handle_split_stack_section.
11367         * dynobj.cc (Sized_dynobj::do_layout): Call
11368         handle_split_stack_section.
11369         * reloc.cc (Sized_relobj::relocate_sections): Call
11370         split_stack_adjust for executable sections in split_stack
11371         objects.  Pass reloc_map to relocate_section.
11372         (Sized_relobj::split_stack_adjust): New function.
11373         (Sized_relobj::split_stack_adjust_reltype): New function.
11374         (Sized_relobj::find_functions): New function.
11375         * target-reloc.h: Include "object.h".
11376         (relocate_section): Add reloc_symbol_changes parameter.  Change
11377         all callers.
11378         * target.h (class Target): Add calls_non_split method.  Declare
11379         do_calls_non_split virtual method.  Declare match_view and
11380         set_view_to_nop.
11381         * target.cc: Include "elfcpp.h".
11382         (Target::do_calls_non_split): New function.
11383         (Target::match_view): New function.
11384         (Target::set_view_to_nop): New function.
11385         * gold.cc (queue_middle_tasks): Give an error if mixing
11386         split-stack and non-split-stack objects with -r.
11387         * i386.cc (Target_i386::relocate_section): Add
11388         reloc_symbol_changes parameter.
11389         (Target_i386::do_calls_non_split): New function.
11390         * x86_64.cc (Target_x86_64::relocate_section): Add
11391         reloc_symbol_changes parameter.
11392         (Target_x86_64::do_calls_non_split): New function.
11393         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11394         parameter.
11395         * powerpc.cc (Target_powerpc::relocate_section): Add
11396         reloc_symbol_changes parameter.
11397         * sparc.cc (Target_sparc::relocate_section): Add
11398         reloc_symbol_changes parameter.
11399         * configure.ac: Call AM_CONDITIONAL for the default target.
11400         * configure: Rebuild.
11401         * testsuite/Makefile.am (TEST_AS): New variable.
11402         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11403         (check_DATA): Add split_i386 and split_x86_64 files.
11404         (SPLIT_DEFSYMS): Define.
11405         (split_i386_[1234n].o): New targets.
11406         (split_i386_[124]): New targets.
11407         (split_i386_[1234r].stdout): New targets.
11408         (split_x86_64_[1234n].o): New targets.
11409         (split_x86_64_[124]): New targets.
11410         (split_x86_64_[1234r].stdout): New targets.
11411         (MOSTLYCLEANFILES): Add new executables.
11412         * testsuite/split_i386.sh: New file.
11413         * testsuite/split_x86_64.sh: New file.
11414         * testsuite/split_i386_1.s: New file.
11415         * testsuite/split_i386_2.s: New file.
11416         * testsuite/split_i386_3.s: New file.
11417         * testsuite/split_i386_4.s: New file.
11418         * testsuite/split_i386_n.s: New file.
11419         * testsuite/split_x86_64_1.s: New file.
11420         * testsuite/split_x86_64_2.s: New file.
11421         * testsuite/split_x86_64_3.s: New file.
11422         * testsuite/split_x86_64_4.s: New file.
11423         * testsuite/split_x86_64_n.s: New file.
11424         * testsuite/testfile.cc (Target_test): Update relocation_section
11425         function.
11426         * testsuite/Makefile.in: Rebuild.
11427
11428 2009-10-06  Ian Lance Taylor  <iant@google.com>
11429
11430         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11431         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11432         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11433         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11434         the address on ldo_addrs_.
11435         (Target_i386::Relocate::fix_up_ldo): New function.
11436
11437 2009-10-06   Rafael Espindola  <espindola@google.com>
11438
11439         * plugin.cc (add_input_library): New.
11440         (Plugin::load): Add add_input_library to tv.
11441         (Plugin_manager::add_input_file): Add the is_lib argument.
11442         (add_input_file): Update call to Plugin_manager::add_input_file.
11443         (add_input_library): New.
11444         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11445
11446 2009-09-30  Doug Kwan  <dougkwan@google.com>
11447
11448         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11449         symbol and call Symbol::may_need_copy_reloc to determine if
11450         a copy reloc is needed.
11451         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11452         nocopyreloc is given in command line.
11453         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11454         given in command line.
11455         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11456         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11457         of the removed Target_i386::may_need_copy_reloc.
11458         * options.h (copyreloc): New option with default value false.
11459         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11460         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11461         instead of the removed Target_powerpc::may_need_copy_reloc.
11462         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11463         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11464         instead of the removed Target_sparc::may_need_copy_reloc.
11465         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11466         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11467         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11468         instead of the removed Target_x86_64::may_need_copy_reloc.
11469
11470 2009-09-30  Ian Lance Taylor  <iant@google.com>
11471
11472         * object.h (class Object): Remove target_ field, and target,
11473         sized_target, and set_target methods.
11474         (Object::sized_target): Remove.
11475         (class Sized_relobj): Update declarations.  Remove sized_target.
11476         * object.cc (Sized_relobj::setup): Remove target parameter.
11477         Change all callers.
11478         (Input_objects::add_object): Don't do anything with the target.
11479         (make_elf_sized_object): Add punconfigured parameter.  Change all
11480         callers.  Set or test parameter target.
11481         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11482         Change all callers.
11483         * parameters.cc (Parameters::set_target): Change parameter type to
11484         be non-const.
11485         (Parameters::default_target): Remove.
11486         (set_parameters_target): Change parameter type to be non-const.
11487         (parameters_force_valid_target): New function.
11488         (parameters_clear_target): New function.
11489         * parameters.h (class Parameters): Update declarations.  Remove
11490         default_target method.  Add sized_target and clear_target
11491         methods.  Change target_ to be non-const.
11492         (set_parameters_target): Update declaration.
11493         (parameters_force_valid_target): Declare.
11494         (parameters_clear_target): Declare.
11495         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11496         as NULL if we aren't searching.
11497         (Add_symbols::run): Don't check for compatible target.
11498         * fileread.cc (Input_file::open_binary): Call
11499         parameters_force_valid_target.
11500         * gold.cc (queue_middle_tasks): Likewise.
11501         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11502         set_target on object.
11503         * dynobj.h (class Sized_dynobj): Update declarations.
11504         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11505         make_elf_object returns NULL.
11506         (Archive::include_member): Don't check whether object target is
11507         compatible.
11508         * output.cc (Output_section::add_input_section): Get target from
11509         parameters.
11510         (Output_section::relax_input_section): Likewise.
11511         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11512         parameters.
11513         (Sized_relobj::do_scan_relocs): Likewise.
11514         (Sized_relobj::relocate_sections): Likewise.
11515         * resolve.cc (Symbol_table::resolve): Likewise.
11516         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11517         parameter.  Change all callers.
11518         (Symbol_table::add_from_object): Get target from parameters.
11519         (Symbol_table::add_from_relobj): Don't check object target.
11520         (Symbol_table::add_from_dynobj): Likewise.
11521         (Symbol_table::define_special_symbol): Get target from
11522         parameters.
11523         * symtab.h (class Symbol_table): Update declaration.
11524         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11525         parameter.  Change all callers.  Clear parameter target.
11526         (Binary_test): Test target here.
11527         * testsuite/object_unittest.cc (gold_testsuite): Remove
11528         target_test_pointer parameter.  Change all callers.
11529         (Object_test): Test target here.
11530
11531 2009-09-26  Ian Lance Taylor  <iant@google.com>
11532
11533         * testsuite/initpri1.c: Don't try to use constructor priorities if
11534         compiling with gcc before 4.3.
11535
11536 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11537
11538         * testsuite/retain_symbols_file_test.sh (check_present): Change
11539         output file name to retain_symbols_file_test.stdout.
11540         (check_absent): Likewise.
11541
11542 2009-09-18  Craig Silverstein  <csilvers@google.com>
11543
11544         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11545         * options.cc: Include <cerrno> and <fstream>.
11546         (General_options::finalize): Parse -retain-symbols-file tag.
11547         * options.h: New flag.
11548         (General_options): New method should_retain_symbol, new
11549         variable symbols_to_retain.
11550         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11551         should_retain_symbol map.
11552         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11553         * testsuite/Makefile.in: Regenerate.
11554         * testsuite/retain_symbols_file_test.sh: New file.
11555
11556 2009-09-18  Nick Clifton  <nickc@redhat.com>
11557
11558         * po/es.po: Updated Spanish translation.
11559
11560 2009-09-17  Doug Kwan  <dougkwan@google.com>
11561
11562         * debug.h (DEBUG_RELAXATION): New constant.
11563         (DEBUG_ALL): Add DEBUG_RELAXATION.
11564         (debug_string_to_enum): Add relaxation debug option.
11565         * layout.cc
11566         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11567         Layout::Relaxation_debug_check::read_sections,
11568         Layout::Relaxation_debug_check::read_sections): New method definitions.
11569         (Layout::Layout): Initialize data members
11570         record_output_section_data_from_scrips_,
11571         script_output_section_data_list_ and relaxation_debug_check_.
11572         (Layout::save_segments, Layout::restore_segments,
11573         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11574         Layout::relaxation_loop_body): New method definitions.
11575         (Layout::finalize): Support relaxation.  Move section layout code to
11576         Layout::relaxation_loop_body.
11577         (Layout::set_asection_address_from_script): Move code for orphan
11578         section placement out.
11579         (Layout::place_orphan_sections_in_script): New method definition.
11580         * layout.h (Output_segment_headers, Output_file_header):
11581         New forward class declarations.
11582         (Layout::~Layout): Define.
11583         (Layout::new_output_section_data_from_script): New method definition.
11584         (Layout::place_orphan_sections_in_script): New method declaration.
11585         (Layout::Segment_states): New type declaration.
11586         (Layout::save_segments, Layout::restore_segments,
11587         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11588         Layout::relaxation_loop_body): New method declarations.
11589         (Layout::Output_section_data_list): New type declaration.
11590         (Layout::Relaxation_debug_check): New class definition.
11591         (Layout::record_output_section_data_from_script_,
11592         Layout::script_output_section_data_list_, Layout::segment_states_,
11593         Layout::relaxation_debug_check_): New data members.
11594         * output.cc: (Output_section_headers::do_size): New method definition.
11595         (Output_section_headers::Output_section_headers): Move size
11596         computation to Output_section_headers::do_size.
11597         (Output_segment_headers::do_size): New method definition.
11598         (Output_file_header::Output_file_header): Move size computation to
11599         Output_file_header::do_size and call it.
11600         (Output_file_header::do_size): New method definition.
11601         (Output_data_group::Output_data_group): Adjust call to
11602         Output_section_data.
11603         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11604         (Output_symtab_xindex::do_write): Add array bound check.
11605         (Output_section::Input_section::print_to_mapfile): Handle
11606         RELAXED_INPUT_SECTION_CODE.
11607         (Output_section::Output_section): Initialize data member checkpoint_.
11608         (Output_section::~Output_section): Delete checkpoint object pointed
11609         by checkpoint_.
11610         (Output_section::add_input_section): Always add an Input_section if
11611         relaxing.
11612         (Output_section::add_merge_input_section): Add assert.
11613         (Output_section::relax_input_section): New method definition.
11614         (Output_section::set_final_data_size): Set load address to zero for
11615         an unallocated section.
11616         (Output_section::do_address_and_file_offset_have_reset_values):
11617         New method definition.
11618         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11619         Handle relaxed input section.
11620         (Output_section::sort_attached_input_sections): Checkpoint input
11621         section list lazily.
11622         (Output_section::get_input_sections): Change type of input_sections to
11623         list of Simple_input_section pointers.  Checkpoint input section list
11624         lazily.  Also handle relaxed input sections.
11625         (Output_section::add_input_section_for_script): Take a reference to
11626         a Simple_input_section object instead of Relobj pointer and section
11627         index as parameter.  Handle relaxed input sections.
11628         (Output_section::save_states, Output_section::restore_states): New
11629         method definitions.
11630         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11631         (Output_data::is_data_size_fixed): New method definition.
11632         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11633         if it is fixed.
11634         (Output_data::address_and_file_offset_have_reset_values): New method
11635         definition.
11636         (Output_data::do_address_and_file_offset_have_reset_values): New method
11637         definition.
11638         (Output_data::set_data_size): Check that data size is not fixed.
11639         (Output_data::fix_data_size): New method definition.
11640         (Output_data::is_data_size_fixed_): New data member.
11641         (Output_section_headers::set_final_data_size): New method definition.
11642         (Output_section_headers::do_size): New method declaration.
11643         (Output_segment_headers::set_final_data_size): New method definition.
11644         (Output_segment_headers::do_size): New method declaration.
11645         (Output_file_header::set_final_data_size)::New method definition.
11646         (Output_file_header::do_size)::New method declaration.
11647         (Output_section_data::Output_section_data): Add new parameter
11648         is_data_size_fixed and use it to fix data size.
11649         (Output_data_const::Output_data_const): Adjust call to base class
11650         constructor and fix data size.
11651         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11652         base class constructor and fix data size.
11653         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11654         base class constructor and fix data size.
11655         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11656         class constructor and fix data size.
11657         (Output_data_group::set_final_data_size): New method definition.
11658         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11659         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11660         class constructor and fix data size.
11661         (Output_relaxed_input_section): New class definition.
11662         (Output_section::Simple_input_section): New class definition.
11663         (Output_section::get_input_sections): Adjust parameter list.
11664         (Output_section::add_input_section_for_script): Same.
11665         (Output_section::save_states, Output_section::restore_states,
11666         Output_section::do_address_and_file_offset_have_reset_values,
11667         (Output_section::Input_section::Input_section): Handle
11668         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11669         Output_relaxed_input_section.
11670         (Output_section::Input_section::is_input_section,
11671         Output_section::Input_section::set_output_section): Handle relaxed
11672         input section.
11673         (Output_section::Input_section::is_relaxed_input_section,
11674         Output_section::Input_section::output_section_data,
11675         Output_section::Input_section::relaxed_input_section): New method
11676         definitions.
11677         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11678         value.
11679         (Output_section::Input_section::u1_): Update comments.
11680         (Output_section::Input_section::u2_): Add new union member poris.
11681         (Output_section::Checkpoint_output_section): New classs definition.
11682         (Output_section::relax_input_section): New method declaration.
11683         (Output_section::checkpoint_): New data member.
11684         (Output_segment): Update comments.
11685         (Output_segment::Output_segment): Un-privatize copy constructor.
11686         (Output_segment::operator=): Un-privatize.
11687         * script-sections.cc (Output_section_element::Input_section_list):
11688         Change element type to Output_section::Simple_input_section.
11689         (Output_section_element_dot_assignment::set_section_addresses):
11690         Register output section data for relaxation clean up.
11691         (Output_data_exression::Output_data_expression): Adjust call to base
11692         constructor to fix data size.
11693         (Output_section_element_data::set_section_addresses): Register
11694         Output_data_expression object for relaxation clean up.
11695         (struct Input_section_info): Replace Relobj pointer and section index
11696         pair with Output_section::Simple_input_section and Convert struct to a
11697         class.
11698         (Input_section_sorter::operator()): Adjust access to
11699         Input_section_info data member to use accessors.
11700         (Output_section_element_input::set_section_addresses): Use layout
11701         parameter.  Adjust code to use Output_section::Simple_input_section
11702         and Input_secction_info classes.  Register filler for relaxation
11703         clean up.
11704         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11705         and section index pair with Output_section::Simple_input_section
11706         class.  Adjust code accordingly.
11707         (Phdrs_element::release_segment): New method definition.
11708         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11709         segment list.
11710         (Script_sections::release_segments): New method definition.
11711         * gold/script-sections.h (Script_sections::release_segments): New
11712         method declaration.
11713         * gold/target.h (Target::may_relax, Target::relax,
11714         Target::do_may_relax, Target::do_relax): New method definitions.
11715
11716 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11717
11718         * arm.cc (has_signed_unsigned_overflow): New function.
11719         (Arm_relocate_functions::abs8): New function.
11720         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11721         (Target_arm::Scan::global): Likewise.
11722         (Target_arm::relocate::relocate): Likewise.
11723         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11724         Likewise.
11725
11726 2009-09-16  Cary Coutant  <ccoutant@google.com>
11727
11728         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11729         * testsuite/Makefile.in: Regenerate.
11730
11731 2009-09-11  Nick Clifton  <nickc@redhat.com>
11732
11733         * po/gold.pot: Updated by the Translation project.
11734
11735 2009-09-08  Cary Coutant  <ccoutant@google.com>
11736
11737         * output.cc (Output_file::open): Add execute permission to empty file.
11738         * testsuite/Makefile.am (permission_test): New test.
11739         * testsuite/Makefile.in: Regenerate.
11740
11741 2009-09-02  Ian Lance Taylor  <iant@google.com>
11742
11743         * output.cc (Output_file::resize): Call map_no_anonymous rather
11744         than map.
11745
11746 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11747
11748         * gold.cc: Include "incremental.h".
11749         (queue_initial_tasks): Call Incremental_checker methods.
11750         * incremental.cc: Include "output.h".
11751         (Incremental_checker::can_incrementally_link_output_file): New
11752         method.
11753         * incremental.h (Incremental_checker): New class.
11754
11755         * output.cc (Output_file::open_for_modification): New method.
11756         (Output_file::map_anonymous): Changed return type to bool.  Record
11757         map in base_ field.
11758         (Output_file::map_no_anonymous): New method, broken out of map.
11759         (Output_file::map): Use map_no_anonymous and map_anonymous.
11760         * output.h (class Output_file): Update declarations.
11761
11762 2009-08-24  Cary Coutant  <ccoutant@google.com>
11763
11764         * options.h (Command_line::Pre_options): New class.
11765         (Command_line::pre_options): New member.
11766         * options.cc (gold::options::ready_to_register): New variable.
11767         (One_option::register_option): Do nothing if not registering options.
11768         Assert if same short option registered twice.
11769         (General_options::General_options): Turn off option registration when
11770         done constructing.
11771         (Command_line::Pre_options::Pre_options): New constructor.
11772
11773 2009-08-24  Cary Coutant  <ccoutant@google.com>
11774
11775         * options.h (General_options::no_keep_memory): Remove incorrect
11776         short option.
11777
11778 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11779
11780         * Makefile.am (am__skiplex, am__skipyacc): New.
11781         * Makefile.in: Regenerate.
11782
11783 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11784
11785         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11786         (INCLUDES): ... this.
11787         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11788         (AM_CPPFLAGS): Renamed from ...
11789         (INCLUDE): ... this.
11790         * Makefile.in, testsuite/Makefile.in: Regenerate.
11791
11792         * Makefile.in: Regenerate.
11793         * aclocal.m4: Likewise.
11794         * config.in: Likewise.
11795         * configure: Likewise.
11796         * testsuite/Makefile.in: Likewise.
11797
11798         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11799         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11800         * Makefile.in: Regenerate.
11801         * testsuite/Makefile.in: Regenerate.
11802
11803 2009-08-19  Cary Coutant  <ccoutant@google.com>
11804
11805         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11806         symbols in shared libraries overridden by hidden or internal symbols
11807         in the main program.
11808
11809 2009-08-19  Chris Demetriou  <cgd@google.com>
11810
11811         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11812         checking source file names in error messages.
11813
11814 2009-08-18  Doug Kwan  <dougkwan@google.com>
11815
11816         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11817         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11818         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11819         an elfcpp::Ehdr as parameter.
11820         * object.cc (Object::set_target): Remove the version that looks up
11821         a target and sets it.
11822         (Sized_relobj::setup): Take a Target object instead of
11823         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11824         (make_elf_sized_object): Find target and ask target to
11825         make an ELF object.
11826         * object.h: (Object::set_target): Remove the version that looks up
11827         a target and sets it.
11828         (Sized_relobj::setup): Take a Target object instead of
11829         an elfcpp:Ehdr as parameter.
11830         * target.cc: Include dynobj.h.
11831         (Target::do_make_elf_object_implementation): New.
11832         (Target::do_make_elf_object): New.
11833         * target.h (Target::make_elf_object): New template declaration.
11834         (Target::do_make_elf_object): New method declarations.
11835         (Target::do_make_elf_object_implementation): New template declaration.
11836
11837 2009-08-14  Ian Lance Taylor  <iant@google.com>
11838
11839         * gold.h (FUNCTION_NAME): Define.
11840         (gold_unreachable): Use FUNCTION_NAME.
11841
11842 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11843
11844         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11845         symbol in the --keep-unique list is not found.
11846
11847 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11848
11849         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11850         been maked as --keep-unique.
11851         (Icf::unfold_section): New function.
11852         * icf.h (Icf::unfold_section): New function.
11853         * options.h (General_options::keep_unique): New option.
11854         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11855         * testsuite/Makefile.in: Regenerate.
11856         * testsuite/icf_keep_unique_test.sh: New file.
11857         * testsuite/icf_keep_unique_test.cc: New file.
11858
11859 2009-08-12  Cary Coutant  <ccoutant@google.com>
11860
11861         PR 10471
11862         * resolve.cc (Symbol_table::resolve): Check for references from
11863         dynamic objects to hidden and internal symbols.
11864         * testsuite/Makefile.am (hidden_test.sh): New test.
11865         * testsuite/Makefile.in: Regenerate.
11866         * testsuite/hidden_test.sh: New script.
11867         * testsuite/hidden_test_1.c: New test source.
11868         * testsuite/hidden_test_main.c: New test source.
11869
11870 2009-08-11  Doug Kwan  <dougkwan@google.com>
11871
11872         * arm.cc: Update comments.
11873         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11874         segment to locate the .ARM.exidx section if present.
11875
11876 2009-08-09  Doug Kwan  <dougkwan@google.com>
11877
11878         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11879         patch.
11880
11881 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11882         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11883         compiler warnings.
11884
11885 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11886
11887         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11888         valid tls_segment only for non-debug-section relocations.
11889         * testsuite/Makefile.am: Add gc_tls_test.
11890         * testsuite/Makefile.in: Regenerate.
11891         * testsuite/gc_tls_test.cc: New file.
11892         * testsuite/gc_tls_test.sh: New file.
11893
11894 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11895
11896         * icf.cc: New file.
11897         * icf.h: New file.
11898         * Makefile.am (CCFILES): Add icf.cc.
11899         (HFILES): Add icf.h
11900         * Makefile.in: Regenerate.
11901         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11902         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11903         section, symbol and addend information for the relocs.
11904         * gold.cc (queue_middle_tasks): Call identical code folding.
11905         * gold.h: Add defines for multimap.
11906         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11907         to the call of finalize_local_symbols.
11908         * main.cc (main): Create object of class Icf.
11909         * object.cc (Sized_relobj::do_layout): Allow this function to be
11910         called twice during icf.
11911         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11912         to sections marked as identical by icf.
11913         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11914         when available.
11915         (Sized_relobj::do_section_entsize): New function.
11916         * object.h (Object::section_entsize): New function.
11917         (Object::do_section_entsize): New pure virtual function.
11918         (Relobj::finalize_local_symbols): Add new parameter.
11919         (Relobj::do_section_entsize): New function.
11920         * options.h (General_options::icf): New option.
11921         (General_options::icf_iterations): New option.
11922         (General_options::print_icf_sections): New option.
11923         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11924         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11925         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11926         icf.
11927         * symtab.cc (Symbol_table::is_section_folded): New function.
11928         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11929         to sections marked as identical by icf.
11930         * symtab.h (Symbol_table::set_icf): New function.
11931         (Symbol_table::icf): New function.
11932         (Symbol_table::is_section_folded): New function.
11933         (Symbol_table::icf_): New data member.
11934         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11935         * testsuite/Makefile.am: Add commands to build icf_test.
11936         * testsuite/Makefile.in: Regenerate.
11937         * testsuite/icf_test.sh: New file.
11938         * testsuite/icf_test.cc: New file.
11939
11940 2009-07-24  Chris Demetriou  <cgd@google.com>
11941
11942         * layout.cc (is_compressible_debug_section): Fix incorrect
11943         comment about compressed section names.
11944
11945 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11946
11947         PR 10419
11948         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11949
11950 2009-07-16  Ian Lance Taylor  <iant@google.com>
11951
11952         PR 10400
11953         * layout.h: #include <map>.
11954         (class Kept_section): Change from struct to class.  Add accessors
11955         and setters.  Add section size to Comdat_group mapping.  Change
11956         Comdat_group to std::map.  Add is_comdat_ field.  Add
11957         linkonce_size field in union.
11958         (class Layout): Update declaration of find_or_add_kept_section.
11959         Don't declare find_kept_object.
11960         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11961         parameter.  Add object, shndx, is_comdat, and is_group_name
11962         parameters.  Change all callers.  Adjust for new Kept_section.
11963         (Layout::find_kept_object): Remove.
11964         * object.cc (Sized_relobj::include_section_group): Update use of
11965         Kept_section.  Rename secnum to shndx.  Only record
11966         Kept_comdat_section if sections are the same size.
11967         (Sized_relobj::include_linkonce_section): Update use of
11968         Kept_section.  Only record Kept_comdat_section if sections are the
11969         same size.  Set size of linkonce section.
11970         (Sized_relobj::map_to_kept_section): Update call to
11971         get_kept_comdat_section.
11972         * object.h (class Sized_relobj): Rename fields in
11973         Kept_comdat_section to drop trailing underscores; change object
11974         field to Relobj*.  Change Kept_comdat_section_table to store
11975         struct rather than pointer.
11976         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11977         Add kept_object and kept_shndx parameters.  Change all callers.
11978         (Sized_relobj::get_kept_comdat_section): Change return type to
11979         bool.  Add kept_object and kept_shndx parameters.  Change all
11980         callers.
11981         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11982         Layout::find_or_add_kept_section.
11983
11984 2009-07-09  Ian Lance Taylor  <iant@google.com>
11985
11986         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11987         Reserve space in the hash table.
11988
11989 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11990
11991         * fileread.cc (File_read::get_mtime): New method.
11992         * fileread.h (Timespec): New structure.
11993         (File_read::get_mtime): New method.
11994         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11995         Renamed from timestamp_nsec.
11996         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11997         Elf_Xword.
11998         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11999         timestamp_nsec.
12000         (Incremental_inputs::report_archive): Save mtime; style fix.
12001         (Incremental_inputs::report_obejct): Save mtime; style fix.
12002         (Incremental_inputs::report_script): Save mtime; style fix.
12003         (Incremental_inputs::finalize_inputs): Style fix.
12004         (Incremental_inputs::finalize): Style fix.
12005         (Incremental_inputs::create_input_section_data): Store inputs
12006         mtime.
12007         * incremental.h (Incremental_inputs::report_script): Add mtime
12008         argument.
12009         (Incremental_inputs::Input_info::Input_info): Intialize only one
12010         union member.
12011         (Incremental_inputs::Input_info::archive): Move to nameless
12012         union.
12013         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12014         (Incremental_inputs::Input_info::script): Move to nameless union.
12015         (Incremental_inputs::mtime): New field.
12016         * script.cc (read_input_script): Pass file mtime to
12017         Incremental_input.
12018         * script.h (Script_info::inputs): Style fix.
12019
12020 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12021
12022         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12023         instead of 32.
12024
12025 2009-06-24  Ian Lance Taylor  <iant@google.com>
12026
12027         PR 10156
12028         * layout.cc (Layout::choose_output_section): If we find an
12029         existing section, update the flags.
12030         (Layout::create_notes): New function, broken out of
12031         Layout::finalize.
12032         (Layout::finalize): Don't create note sections.
12033         (Layout::create_note): Don't crash if linker script discards
12034         section.
12035         (Layout::create_gold_note): Likewise.
12036         (Layout::create_build_id): Likewise.  Don't set
12037         after_input_sections on the section.
12038         (Layout::create_executable_stack_info): Remove target parameter.
12039         Change caller.
12040         * layout.h (class Layout): Declare create_notes.  Update
12041         declaration of create_executable_stack_info.
12042         * gold.cc (queue_middle_tasks): Call create_notes.
12043         * output.cc (Output_section::update_flags_for_input_section): Move
12044         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12045         invalid.
12046         * output.h (Output_data::mark_address_invalid): New function.
12047         (class Output_section): Only declare, not define,
12048         update_flags_for_input_section.  Remove set_flags.
12049
12050 2009-06-24  Ian Lance Taylor  <iant@google.com>
12051
12052         * script-sections.cc (Output_section_definition::
12053         set_section_addresses): Rename shadowing local load_address to
12054         laddr.
12055
12056 2009-06-24  Ian Lance Taylor  <iant@google.com>
12057
12058         PR 10244
12059         * reloc.cc (relocate_sections): Skip empty relocation sections.
12060
12061 2009-06-23  Ian Lance Taylor  <iant@google.com>
12062
12063         PR 10156
12064         * layout.cc (Layout::create_note): Use choose_output_section
12065         rather than make_output_section.
12066
12067 2009-06-23  Ian Lance Taylor  <iant@google.com>
12068
12069         PR 10237
12070         * options.cc (General_options::parse_V): Set printed_version_.
12071         (General_options::General_options): Initialize printed_version_.
12072         * options.h (class General_options): Add printed_version_ field.
12073         * gold.cc (queue_initial_tasks): If there are no input files,
12074         don't give a fatal error if we printed the version information.
12075         (queue_middle_tasks): If using -r with a shared object, give a
12076         fatal error rather than an ordinary error.
12077
12078 2009-06-23  Ian Lance Taylor  <iant@google.com>
12079
12080         PR 10219
12081         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12082         (Layout::make_output_section): Set have_stabstr_section_ if we see
12083         a .stab*str section.
12084         (Layout::finalize): Call link_stabs_sections.
12085         (Layout::link_stabs_sections): New file.
12086         * layout.h (class Layout): Add have_stabstr_section_ field.
12087         Declare link_stabs_sections.
12088
12089 2009-06-23  Doug Kwan  <dougkwan@google.com>
12090
12091         * Makefile.am (libgold_a_LIBADD): New.
12092         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12093         * Makefile.in: Regenerate.
12094         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12095         * configure: Regenerate.
12096         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12097         * fileread.cc: Include sys/state.h
12098         * gold.h: Declare memmem and strndup if found missing.
12099         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12100
12101 2009-06-23  Ian Lance Taylor  <iant@google.com>
12102
12103         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12104         * configure: Rebuild.
12105
12106 2009-06-23  Ian Lance Taylor  <iant@google.com>
12107
12108         PR 10147
12109         * object.cc (Object::section_contents): Don't try to get a view if
12110         the section has length zero.
12111         (Object::handle_gnu_warning_section): If the section is empty, use
12112         the name of the section as the warning.
12113
12114 2009-06-23  Ian Lance Taylor  <iant@google.com>
12115
12116         PR 10133
12117         * stringpool.h (class Stringpool_template): Add optimize_ field.
12118         (Stringpool_template::set_optimize): New function.
12119         * stringpool.cc (Stringpool_template::Stringpool_template):
12120         Initialize optimize_ field.
12121         (Stringpool_template::set_string_offsets): Test local optimize
12122         fild rather than parameter.
12123         * layout.cc (Layout::Layout): Call set_optimize on the section
12124         name stringpool.
12125
12126 2009-06-22  Ian Lance Taylor  <iant@google.com>
12127
12128         PR 10030
12129         * yyscript.y: Parse TARGET.
12130         * script.cc (script_set_target): New function.
12131         * script-c.h (script_set_target): Declare.
12132         * options.cc (General_options::string_to_object_format): Rename
12133         from string_to_object_format in anonymous namespace.  Change
12134         callers.
12135         * options.h (class General_options): Declare
12136         string_to_object_format.
12137
12138 2009-06-22  Ian Lance Taylor  <iant@google.com>
12139
12140         * script-sections.cc (Script_sections::create_segments): Don't put
12141         program headers in a PT_LOAD segment if -n or -N.
12142
12143 2009-06-22  Ian Lance Taylor  <iant@google.com>
12144
12145         PR 10141
12146         * options.h (class General_options): Add -z lazy and -z now.  Sort
12147         -z options into alphabetical order.
12148         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12149
12150 2009-06-21  Ian Lance Taylor  <iant@google.com>
12151
12152         * layout.cc (Layout::make_output_section): Call
12153         Target::new_output_section.
12154         (Layout::attach_allocated_section_to_segment): Put large section
12155         sections in a separate load segment with the large segment flag
12156         set.
12157         (Layout::segment_precedes): Sort large data segments after other
12158         load segments.
12159         (align_file_offset): New static function.
12160         (Layout::set_segment_offsets): Use align_file_offset.
12161         * output.h (class Output_section): Add is_small_section_ and
12162         is_large_section_ fields.
12163         (Output_section::is_small_section): New function.
12164         (Output_section::set_is_small_section):  New function.
12165         (Output_section::is_large_section): New function.
12166         (Output_section::set_is_large_section): New function.
12167         (Output_section::is_large_data_section): New function.
12168         (class Output_segment): Add is_large_data_segment_ field.
12169         (Output_segment::is_large_data_segment): New function.
12170         (Output_segment::set_is_large_data_segment): New function.
12171         * output.cc (Output_section::Output_section): Initialize new
12172         fields.
12173         (Output_segment::Output_segment): Likewise.
12174         (Output_segment::add_output_section): Add assertion that large
12175         data sections always go in large data segments.  Force small data
12176         sections to the end of the list of data sections.  Force small BSS
12177         sections to the start of the list of BSS sections.  For large BSS
12178         sections to the end of the list of BSS sections.
12179         * symtab.h (class Symbol): Declare is_common_shndx.
12180         (Symbol::is_defined): Check Symbol::is_common_shndx.
12181         (Symbol::is_common): Likewise.
12182         (class Symbol_table): Define enum Commons_section_type.  Update
12183         declarations.  Add small_commons_ and large_commons_ fields.
12184         * symtab.cc (Symbol::is_common_shndx): New function.
12185         (Symbol_table::Symbol_table): Initialize new fields.
12186         (Symbol_table::add_from_object): Put small and large common
12187         symbols in the right list.
12188         (Symbol_table::sized_finalized_symbol): Check
12189         Symbol::is_common_shndx.
12190         (Symbol_table::sized_write_globals): Likewise.
12191         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12192         common symbol lists.  Don't call do_allocate_commons_list if the
12193         list is empty.
12194         (Symbol_table::do_allocate_commons_list): Remove is_tls
12195         parameter.  Add comons_section_type parameter.  Change all
12196         callers.  Handle small and large common symbols.
12197         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12198         Symbol::is_common_shndx.
12199         * resolve.cc (symbol_to_bits): Likewise.
12200         * target.h (Target::small_common_shndx): New function.
12201         (Target::small_common_section_flags): New function.
12202         (Target::large_common_shndx): New function.
12203         (Target::large_common_section_flags): New function.
12204         (Target::new_output_section): New function.
12205         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12206         small_common_section_flags, and large_common_section_flags
12207         fields.
12208         (Target::do_new_output_section): New virtual function.
12209         * arm.cc (Target_arm::arm_info): Initialize new fields.
12210         * i386.cc (Target_i386::i386_info): Likewise.
12211         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12212         Likewise.
12213         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12214         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12215         (Target_x86_64::do_new_output_section): New function.
12216         * configure.ac: Define conditional MCMODEL_MEDIUM.
12217         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12218         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12219         (large_LDFLAGS): Define.
12220         * testsuite/large.c: New file.
12221         * testsuite/testfile.cc (Target_test::test_target_info):
12222         Initialize new fields.
12223         * configure, testsuite/Makefile.in: Rebuild.
12224
12225 2009-06-05  Doug Kwan  <dougkwan@google.com>
12226
12227         * Makefile.am (CCFILES): Add target.cc.
12228         * Makefile.in: Regenerate.
12229         * i386.cc (class Target_i386): Define new virtual method to
12230         override do_is_local_label_name in parent.
12231         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12232         local symbols if --discard-locals or -X is given.
12233         * options.h (class General_options): Declare new options
12234         '--discard-locals' and '-X' for discarding locals.
12235         * target.h (class Target): Define new methods is_local_label_name.
12236         Declare new virtual method do_is_local_label_name.
12237         * target.cc: New file.
12238         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12239         (check_SCRIPTS): Add discard_locals_test.sh.
12240         (check_DATA): Add discard_local_tests.syms.
12241         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12242         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12243         * testsuite/Makefile.in: Regenerate.
12244         * testsuite/discard_locals_test.c: New file.
12245         * testsuite/discard_locals_test.sh: Same.
12246
12247 2009-06-05  Doug Kwan  <dougkwan@google.com>
12248
12249         * object.cc (Sized_relobj::Sized_relobj): Initialize
12250         discarded_eh_frame_shndx_ to -1U.
12251         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12252         section.
12253         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12254         a discarded .eh_frame section.
12255         (Sized_relobj::do_finalize_local_symbols): Ditto.
12256         * object.h (class Sized_relobj): Declare new member
12257         discarded_eh_frame_shndx_.
12258         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12259         (local_labels_test.o, local_labels_test): New rules.
12260         * testsuite/Makefile.in: Regenerate.
12261
12262 2009-06-04  Doug Kwan  <dougkwan@google.com>
12263
12264         * layout.cc (Layout::section_name_mapping): Add mapping for
12265         special ARM sections.
12266
12267 2009-06-03  Doug Kwan  <dougkwan@google.com>
12268
12269         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12270         (utils::has_overflow): Same.
12271
12272 2009-06-03  Ian Lance Taylor  <iant@google.com>
12273
12274         * layout.cc (Layout::section_name_mapping): New array, replacing
12275         Layout::linkonce_mapping.
12276         (Layout::section_name_mapping_count): New variable, replacing
12277         Layout::linkonce_mapping_count.
12278         (Layout::linkonce_output_name): Remove.
12279         (Layout::output_section_name): Rewrite.
12280         * layout.h (class Layout): Rename Linkonce_mapping to
12281         Section_name_mapping, linkonce_mapping to section_name_mapping,
12282         linkonce_mapping_count to section_name_mapping_count.  Don't
12283         declare linkonce_output_name.
12284
12285 2009-06-03  Doug Kwan  <dougkwan@google.com>
12286
12287         * gold/arm.cc (namespace utils): New.
12288         (Target_arm::reloc_is_non_pic): Define new method.
12289         (class Arm_relocate_functions): New.
12290         (Target_arm::Relocate::relocate): Handle relocation types used by
12291         Android.
12292
12293 2009-06-03  Ian Lance Taylor  <iant@google.com>
12294
12295         * arm.cc (Target_arm::scan::global): Use || instead of |.
12296
12297 2009-06-02  Doug Kwan  <dougkwan@google.com>
12298
12299         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12300         issued_non_pic_error_.
12301         (class Target_arm::Scan): Declare new method check_non_pic.
12302         Define new method symbol_needs_plt_entry.
12303         Declare new data member issued_non_pic_error_.
12304         (class Target_arm::Relocate): Declare new method
12305         should_apply_static_reloc.
12306         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12307         (Target_arm::Scan::check_non_pic): Define new method.
12308         (Target_arm::Scan::local): Handle a small subset of reloc types used
12309         by Android.
12310         (Target_arm::Scan::local): Same.
12311         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12312
12313 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12314
12315         * incremental.cc (Incremental_inputs::report_command_line): Filter
12316         out --incremental-* options.
12317
12318 2009-05-29  Doug Kwan  <dougkwan@google.com>
12319
12320         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12321         template class.
12322         (class Target_arm): Update comment.
12323         (Target_arm::Target_arm): Initialize new data members GOT_,
12324         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12325         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12326         and Target_arm::rel_dyn_section.
12327         Declare new_enum Target_arm::Got_type.
12328         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12329         and DYNBSS_.
12330         Update commments for member do_dynsym_value.
12331         (Target_arm::got_size, Target_arm::plt_section,
12332         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12333         new methods inside class defintion.
12334         (Target_arm::got_section): Define new method.
12335         (Target_arm::rel_dyn_section): Same.
12336         (Output_data_plt_arm): New template class.
12337         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12338         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12339         (Output_data_plt_arm::add_entry): Same.
12340         (Output_data_plt_arm::first_plt_entry): Define new
12341         static data member for PLT instruction template.
12342         (Output_data_plt_arm::plt_entry): Same.
12343         (Output_data_plt_arm::do_write): Define new method.
12344         (Target_arm::make_plt_entry): Same.
12345         (Target_arm::do_finalize_sections): Same.
12346         (Target_arm::do_dynsym_value): Same.
12347
12348 2009-05-28  Doug Kwan  <dougkwan@google.com>
12349
12350         * Makefile.am (TARGETSOURCES): Add arm.cc.
12351         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12352         * Makefile.in: Regenerate.
12353         * arm.cc: New file.
12354         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12355
12356 2009-05-26  Doug Kwan  <dougkwan@google.com>
12357
12358         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12359         (General_options::check_excluded_libs): Strip off directories in
12360         archive name before matching like GNU ld does.
12361         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12362         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12363         (exclude_libs_test_LDFLAGS): Add linker option
12364         -Wl,--exclude-libs,libexclude_libs_test_3
12365         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12366         an explicit archive without using -l.
12367         (alt/libexclude_libs_test_3.a): New make rule.
12368         * testsuite/Makefile.in: Regenerate.
12369         * testsuite/exclude_libs_test.c : Declare lib3_default().
12370         (main): Call it.
12371         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12372         * exclude_libs_test_3.c: New file.
12373
12374 2009-05-26  Nick Clifton  <nickc@redhat.com>
12375
12376         * po/id.po: New Indonesian translation.
12377         * po/gold.pot: Updated template file.
12378
12379 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12380
12381         * testsuite/Makefile.am: Add -ffunction-sections to compile
12382         gc_comdat_test files.  Add -Wl,--gc-sections to build
12383         gc_comdat_test.
12384         * testsuite/Makefile.in: Regenerate.
12385         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12386
12387 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12388
12389         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12390         kept comdat section was garbage collected.
12391         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12392         * testsuite/Makefile.in: Regenerate.
12393         * testsuite/gc_comdat_test.sh: New file.
12394         * testsuite/gc_comdat_test_1.cc: New file.
12395         * testsuite/gc_comdat_test_2.cc: New file.
12396
12397 2009-05-19  Doug Kwan  <dougkwan@google.com>
12398
12399         * archive.cc (Archive::Archive): Move constructor from archive.h
12400         to here.  Initialize no_export_.
12401         (Archive::get_elf_object_for_member): Set no_export flag of object.
12402         * archive.h (Archive::Archive): Move constructor body to
12403         archive.cc.
12404         (Archive::no_export): New method.
12405         (Archive::no_export_): New field.
12406         * object.h (Object::Object): Initialize no_export_ to false.
12407         (Object::no_export, Object::set_no_export): New methods.
12408         (Object::no_export_): New field.
12409         * options.cc (General_options::parse_exclude_libs): New method.
12410         (General_options::check_excluded_libs) Same.
12411         * options.h (exclude_libs): New option.
12412         (General_options::check_excluded_libs): New method declaration.
12413         (General_options::excluded_libs_): New field.
12414         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12415         default or protected visibility if an object has no-export flag set.
12416         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12417         (check_SCRIPTS): Add exclude_libs_test.sh.
12418         (check_DATA): Add exclude_libs_test.syms.
12419         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12420         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12421         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12422         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12423         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12424         libexclude_libs_test_2.a): New rules.
12425         * testsuite/Makefile.in: Regenerate.
12426         * testsuite/exclude_libs_test.c: New file.
12427         * testsuite/exclude_libs_test.sh: Ditto.
12428         * testsuite/exclude_libs_test_1.c: Ditto.
12429         * testsuite/exclude_libs_test_2.c: Ditto.
12430
12431 2009-05-15  Ian Lance Taylor  <iant@google.com>
12432
12433         * configure.ac: Check for declarations for cases where libiberty.h
12434         checks HAVE_DECL_xxx.
12435         * configure, config.in: Rebuild.
12436
12437 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12438
12439         * gold.h (Incremental_argument_list): Remove (invalid) forward
12440         declaration.
12441         * incremental.cc (Incremental_inputs::report_achive): New method.
12442         (Incremental_inputs::report_object): New method.
12443         (Incremental_inputs::report_script): New method.
12444         (Incremental_inputs::finalize_inputs): New method.
12445         (Incremental_inputs::finalize): Call finalize_inputs().
12446         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12447         Create inputs entries.
12448         * incremental.h (Incremental_input_type): New enum.
12449         (Incremental_inputs::Incremental_input): Initialize new fields.
12450         (Incremental_inputs::report_inputs): New method.
12451         (Incremental_inputs::report_achive): New method.
12452         (Incremental_inputs::report_object): New method.
12453         (Incremental_inputs::report_script): New method.
12454         (Incremental_inputs::finalize_inputs): New method.
12455         (Incremental_inputs::Input_info): New struct.
12456         (Incremental_inputs::Input_info_map): New typedef.
12457         (Incremental_inputs::lock_): New field.
12458         (Incremental_inputs::Inputs_): New field.
12459         (Incremental_inputs::Inputs_map): New field.
12460         * main.cc (main): Call Incremental_input::report_inputs.
12461         * options.h (Input_argument_list): Typedef moved from
12462         Input_arguments.
12463         (Input_file_group::Files): Remove, use ::Input_argument_list.
12464         (Input_file_group::Input_argument_list): Remove, use
12465         ::Input_argument_list.
12466         * plugin.cc (Plugin_manager::add_input_file): Add error in
12467         incremental build.
12468         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12469         functions.
12470         * script.cc (read_input_script): Call
12471         Incremental_input::report_script.
12472         * script.h (Script_info): New class.
12473
12474 2009-04-27  Ian Lance Taylor  <iant@google.com>
12475
12476         * x86_64.cc (do_adjust_output_section): Set entsize to
12477         plt_entry_size.
12478
12479 2009-04-23  Elliott Hughes  <enh@google.com>
12480
12481         * output.cc (Output_file::close): After short writes, continue
12482         writing from the correct offset in the buffer being written.
12483
12484 2009-04-23  Chris Demetriou  <cgd@google.com>
12485
12486         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12487         * configure: Regenerate.
12488         * config.in: Regenerate.
12489         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12490         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12491
12492 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12493
12494         * incremental.cc (Incremental_inputs_header_data): Renamed from
12495         Incremental_input_header_data.
12496         (Incremental_inputs_header_data::data_size): New field.
12497         (Incremental_inputs_header_data::put_input_file_count): Renamed
12498         from input_file_count.
12499         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12500         from command_line_offset.
12501         (Incremental_inputs_header_data::put_reserved): Renamed from
12502         put_reserved.
12503         (Incremental_inputs_entry_data): Renamed from
12504         Incremental_input_entry_data.
12505         (Incremental_inputs_entry_data::data_size): New field.
12506         (Incremental_inputs::report_command_line): New method.
12507         (Incremental_inputs::finalize): New method.
12508         (Incremental_inputs::create_incremental_inputs_data): New method.
12509         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12510         * incremental.h: New file.
12511         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12512         (Layout::finalize): Create incremental inputs section in
12513         incremental builds.
12514         (Layout::create_incremental_info_sections): New method.
12515         * layout.h (Layout::incremental_inputs): New method.
12516         (Layout::create_incremental_info_sections): New method.
12517         (Layout::incremental_inputs_): New field.
12518         * main.cc (main): Notify Incremental_input of the command line.
12519
12520 2009-04-01  Ian Lance Taylor  <iant@google.com>
12521             Mikolaj Zalewski  <mikolajz@google.com>
12522
12523         * gold.h (reserve_unordered_map): Define, three versions, one for
12524         each version of Unordered_map.
12525         * layout.cc (Layout::Layout): Remove options parameter.  Add
12526         number_of_input_files parameter.  Don't initialize options_.
12527         Initialize number_of_input_files_ and resized_signatures_.  Move
12528         sections_are_attached_.
12529         (Layout::layout_group): Reserve space for group_signatures_.
12530         (Layout::find_or_add_kept_section): Change name parameter to be a
12531         reference.  Resize signatures_ map when it gets large enough.
12532         (Layout::layout_eh_frame): Use parameters->options() instead of
12533         this->options_.
12534         (Layout::make_output_section): Likewise.
12535         (Layout::attach_allocated_section_to_segment): Likewise.
12536         (Layout::finalize, Layout::create_executable_stack): Likewise.
12537         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12538         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12539         * layout.h (class Layout): Update declarations.  Remove options_
12540         field.  Add number_of_input_files_ and resized_signatures_
12541         fields.  Move sections_are_attached_ field.
12542         * main.cc (main): Pass number of input files to Layout
12543         constructor.  Don't pass options.
12544
12545 2009-03-30  Ian Lance Taylor  <iant@google.com>
12546
12547         * ffsll.c (ffsll): Correct implementation.
12548
12549 2009-03-27  Ian Lance Taylor  <iant@google.com>
12550
12551         * ffsll.c: New file.
12552         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12553         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12554         * ftruncate.c (ftruncate): Declare before definition.
12555         * mremap.c (mremap): Likewise.
12556         * pread.c (pread): Likewise.
12557         * configure, Makefile.in, config.in: Rebuild.
12558
12559         * mremap.c: New file.
12560         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12561         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12562         (mremap): Declare if HAVE_MREMAP is not defined.
12563         * configure, Makefile.in, config.in: Rebuild.
12564
12565 2009-03-27  Cary Coutant  <ccoutant@google.com>
12566
12567         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12568         position independent.
12569         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12570         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12571
12572 2009-03-24  Cary Coutant  <ccoutant@google.com>
12573
12574         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12575         an executable.
12576         (needs_dynamic_reloc): Likewise.
12577
12578 2009-03-24  Ian Lance Taylor  <iant@google.com>
12579
12580         * yyscript.y (file_cmd): Recognize EXTERN.
12581         (extern_name_list, extern_name_list_body): New nonterminals.
12582         * script.cc (script_add_extern): Define.
12583         * script-c.h (script_add_extern): Declare.
12584
12585 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12586
12587         * object.cc (is_elf_object): Define.
12588         * object.h (is_elf_object): Declare.
12589         * archive.cc (Archive::get_elf_object_for_member): Call
12590         is_elf_object.
12591         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12592
12593 2009-03-24  Elliott Hughes  <enh@google.com>
12594
12595         * output.cc (Output_file::map_anonymous): Define.
12596         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12597         try an anonymous one.  Report the size if the mmap fails.
12598         * output.h (class Output_file): Declare map_anonymous.
12599
12600 2009-03-24  Ian Lance Taylor  <iant@google.com>
12601
12602         * target-select.cc (instantiate_target): Don't acquire the lock if
12603         the instantiated_target_ field has already been set.
12604
12605 2009-03-23  Ian Lance Taylor  <iant@google.com>
12606
12607         * gold-threads.h (class Initialize_lock): Define.
12608         * gold-threads.cc (class Initialize_lock_once): Define.
12609         (initialize_lock_control): New static variable.
12610         (initialize_lock_pointer): New static variable.
12611         (initialize_lock_once): New static function.
12612         (Initialize_lock::Initialize_lock): Define.
12613         (Initialize_lock::initialize): Define.
12614         * target-select.h: Include "gold-threads.h".
12615         (class Target_selector): Add lock_ and initialize_lock_ fields.
12616         Don't define instantiate_target, just declare it.
12617         * target-select.cc (Target_selector::Target_selector): Initialize
12618         new fields.
12619         (Target_selector::instantiate_target): Define.
12620         * descriptors.h: Include "gold-threads.h".
12621         (class Descriptors): Add initialize_lock_ field.
12622         * descriptors.cc (Descriptors::Descriptors): Initialize new
12623         field.
12624         (Descriptors::open): Use initialize_lock_ field
12625         * errors.h (class Errors): Add initialize_lock_ field.
12626         * errors.cc (Errors::Errors): Initialize new field.
12627         (Errors::initialize_lock): Use initialize_lock_ field.
12628         * powerpc.cc (class Target_selector_powerpc): Remove
12629         instantiated_target_ field.  In do_recognize call
12630         instantiate_target rather than do_instantiate_target.  In
12631         do_instantiate_target just allocate a new target.
12632         * sparc.cc (class Target_selector_sparc): Likewise.
12633
12634         * freebsd.h: New file.
12635         * i386.cc: Include "freebsd.h".
12636         (Target_i386): Derive from Target_freebsd rather than
12637         Sized_target.
12638         (Target_selector_i386): Derive from Target_selector_freebsd rather
12639         than Target_selector.
12640         * x86_64.cc: Include "freebsd.h".
12641         (Target_x86_64): Derive from Target_freebsd rather than
12642         Sized_target.
12643         (Target_selector_x86_64): Derive from Target_selector_freebsd
12644         rather than Target_selector.
12645         * target.h (class Target): Add adjust_elf_header and
12646         do_adjust_elf_header.
12647         * output.cc (Output_file_header:: do_sized_write): Call target
12648         adjust_elf_header routine.
12649         * configure.tgt: Set targ_osabi.
12650         * configure.ac: Define GOLD_DEFAULT_OSABI.
12651         * parameters.cc (Parameters::default_target): Pass
12652         GOLD_DEFAULT_OSABI to select_target.
12653         * target-select.h (class Target_selector): Make instantiate_target
12654         protected rather than private.
12655         * Makefile.am (HFILES): Add freebsd.h.
12656         * configure, Makefile.in, config.in: Rebuild.
12657
12658         * merge.cc (do_add_input_section): Correct pend value.  Change
12659         message about last entry not being null terminated from error to
12660         warning.
12661
12662 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12663
12664         * incremental.cc: New file.
12665         * Makefile.am (CCFILES): Add incremental.cc.
12666         * Makefile.in: Rebuild.
12667
12668 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12669
12670         * layout.cc (Layout::output_section_name): Preserve names
12671         of '.note.' sections.
12672
12673 2009-03-19  Ian Lance Taylor  <iant@google.com>
12674
12675         * descriptors.cc (Descriptors::open): Check that the options are
12676         valid before using them.
12677
12678 2009-03-18  Ian Lance Taylor  <iant@google.com>
12679
12680         * script-sections.h: Include <list>.
12681         (class Script_sections): Change Sections_elements from std::vector
12682         to std::list.  Typedef public Elements_iterator.  Add
12683         orphan_section_placement_, data_segment_align_start_, and
12684         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12685         field.
12686         * script-sections.cc (class Orphan_section_placement): New class.
12687         (class Sections_element): Add virtual functions is_relro and
12688         orphan_section_init.  Remove virtual function place_orphan_here.
12689         (class Output_section_definition): Add is_relro and
12690         orphan_section_init.  Remove place_orphan_here.
12691         (class Orphan_output_section): Likewise.
12692         (Script_sections::Script_sections): Update for field changes.
12693         (Script_sections::data_segment_align): Set saw_data_segment_align_
12694         and data_segment_align_start_, not data_segment_align_index.
12695         (Script_sections::data_segment_relro_end): Check
12696         saw_data_segment_align_.  Use data_segment_align_start_ rather
12697         than data_segment_align_index_.
12698         (Script_sections::place_orphan): Rewrite to use
12699         Orphan_section_placement.
12700
12701 2009-03-17  Ian Lance Taylor  <iant@google.com>
12702
12703         * archive.cc (Archive::add_symbols): Check for a version attached
12704         to the symbol name in the archive map.
12705         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12706         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12707         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12708         (ver_test_11.a): New target.
12709         * testsuite/Makefile.in: Rebuild.
12710
12711         * configure.ac: Check for chsize and posix_fallocate.  Replace
12712         ftruncate.
12713         * ftruncate.c: New file, from gnulib.
12714         * output.cc (posix_fallocate): Define dummy version if not
12715         HAVE_POSIX_FALLOCATE.
12716         (Output_file::map): Call posix_fallocate rather than lseek and
12717         write.
12718         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12719         * configure, Makefile.in, config.in: Rebuild.
12720
12721 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12722
12723         * layout.h (Layout::create_note): Add section_name parameter.
12724         * layout.cc (Layout::create_note): Likewise.
12725         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12726
12727 2009-03-17  Ian Lance Taylor  <iant@google.com>
12728
12729         * descriptors.cc: Include "options.h".
12730         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12731         (Descriptors::open): Always use O_CLOEXEC when opening a new
12732         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12733         then set FD_CLOEXEC.
12734
12735         * sparc.cc (class Target_sparc): Add has_got_section.
12736         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12737         make sure we have a GOT section.
12738
12739         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12740         (Target_sparc::Scan::local): Likewise.
12741         (Target_sparc::Scan::global): Likewise.
12742         (Target_sparc::Relocate::relocate): Likewise.
12743         (Target_sparc::Relocate::relocate_tls): Likewise.
12744
12745         * symtab.cc (Symbol_table::define_default_version): New function,
12746         broken out of add_from_object.
12747         (Symbol_table::add_from_object): Call define_default_version.
12748         (Symbol_table::define_special_symbol): Add resolve_oldsym
12749         parameter.  Change all callers.  If the version for a symbol comes
12750         from a version script, resolve it with the symbol with the same
12751         name with no version.  Also add the symbol without a version if
12752         appropriate.
12753         (do_define_in_output_data): If resolving with oldsym, don't delete
12754         sym.
12755         (do_define_in_output_segment): Likewise.
12756         (do_define_as_constant): Likewise.
12757         * symtab.h (class Symbol_table): Update declarations.
12758
12759 2009-03-13  Ian Lance Taylor  <iant@google.com>
12760
12761         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12762         (Read_symbols::requeue): New function.
12763         (Read_symbols::do_read_symbols): If make_elf_object fails because
12764         the target type is not configured, and the file was searched for,
12765         issue a warning and retry with the next directory.
12766         (Add_symbols::run): If the file has an incompatible format, and
12767         it was searched for, requeue the Read_symbols task.  On error,
12768         release the object.
12769         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12770         dirindex parameter to constructor.  Change all callers.  Declare
12771         incompatible_warning and requeue.
12772         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12773         input_argument_ and input_group_ fields.  Add them to
12774         constructor.  Change all callers.
12775         (class Read_script): Add dirindex_ field.  Add it to constructor.
12776         Change all callers.
12777         * archive.cc (Archive::setup): Remove input_objects parameter.
12778         Change all callers.
12779         (Archive::get_file_and_offset): Likewise.
12780         (Archive::read_all_symbols): Likewise.
12781         (Archive::read_symbols): Likewise.
12782         (Archive::get_elf_object_for_member): Remove input_objects
12783         parameter.  Add punconfigured parameter.  Change all callers.
12784         (Archive::add_symbols): Change return type to bool.  Check return
12785         value of include_member.
12786         (Archive::include_all_members): Likewise.
12787         (Archive::include_member): Change return type to bool.  Return
12788         false if first included object has incompatible target.  Set
12789         included_member_ field.
12790         (Add_archive_symbols::run): If add_symbols returns false, requeue
12791         Read_symbols task.
12792         * archive.h (class Archive): Add included_member_ field.
12793         Initialize it in constructor.  Add input_file and searched_for
12794         methods.  Update declarations.
12795         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12796         input_argument_ fields.  Add them to constructor.  Change all
12797         callers.
12798         * script.cc: Include "target-select.h".
12799         (class Parser_closure): Add skip_on_incompatible_target_ and
12800         found_incompatible_target_ fields.  Add
12801         skip_on_incompatible_target parameter to constructor.  Change all
12802         callers.  Add methods skip_on_incompatible_target,
12803         clear_skip_on_incompatible_target, found_incompatible_target, and
12804         set_found_incompatible_target.
12805         (read_input_script): Add dirindex parameter.  Change all callers.
12806         If parser finds an incompatible target, requeue Read_symbols
12807         task.
12808         (script_set_symbol): Clear skip_on_incompatible_target in
12809         closure.
12810         (script_add_assertion, script_parse_option): Likewise.
12811         (script_start_sections, script_add_phdr): Likewise.
12812         (script_check_output_format): New function.
12813         * script.h (read_input_script): Update declaration.
12814         * script-c.h (script_check_output_format): Declare.
12815         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12816         (ignore_cmd): Remove OUTPUT_FORMAT.
12817         * fileread.cc (Input_file::Input_file): Add explicit this.
12818         (Input_file::will_search_for): New function.
12819         (Input_file::open): Add pindex parameter.  Change all callers.
12820         * fileread.h (class Input_file): Add input_file_argument method.
12821         Declare will_search_for.  Update declarations.
12822         * object.cc (make_elf_object): Add punconfigured parameter.
12823         Change all callers.
12824         * object.h (class Object): Make input_file public.  Add
12825         searched_for method.
12826         (make_elf_object): Update declaration.
12827         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12828         restart search.
12829         * dirsearch.h (class Dirsearch): Update declaration.
12830         * options.h (class General_options): Add --warn-search-mismatch.
12831         * parameters.cc (Parameters::is_compatible_target): New function.
12832         * parameters.h (class Parameters): Declare is_compatible_target.
12833         * workqueue.cc (Workqueue::add_blocker): New function.
12834         * workqueue.h (class Workqueue): Declare add_blocker.
12835
12836         * fileread.cc (Input_file::open): Remove options parameter.
12837         Change all callers.
12838         (Input_file::open_binary): Likewise.
12839         * script.cc (read_input_script): Likewise.
12840         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12841         options parameter from constructor.  Change all callers.
12842         (class Read_script): Likewise.
12843         * fileread.h (class Input_file): Update declarations.
12844         * script.h (read_input_script): Update declaration.
12845
12846 2009-03-10  Nick Clifton  <nickc@redhat.com>
12847
12848         * po/es.po: New Spanish translation.
12849
12850 2009-03-06  Cary Coutant  <ccoutant@google.com>
12851
12852         * options.cc (parse_short_option): Keep dash_z from registering itself.
12853
12854 2009-03-03  Ian Lance Taylor  <iant@google.com>
12855
12856         PR 9918
12857         * target-reloc.h (relocate_section): Pass output_section to
12858         relocate.
12859         * i386.cc (Target_i386::should_apply_static_reloc): Add
12860         output_section parameter.  Change all callers.
12861         (Target_i386::Relocate::relocate): Add output_section parameter.
12862         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12863         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12864         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12865         * testsuite/two_file_shared.sh: New script.
12866         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12867         (check_DATA): Add two_file_shared.dbg.
12868         (two_file_shared.dbg): New target.
12869         * testsuite/Makefile.in: Rebuild.
12870
12871 2009-03-01  Ian Lance Taylor  <iant@google.com>
12872
12873         * configure.ac: Check for byteswap.h.
12874         * configure: Rebuild.
12875         * config.in: Rebuild.
12876
12877 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12878
12879         * layout.cc (Layout::find_or_add_kept_section): New function.
12880         (Layout::add_comdat): Removed.
12881         * layout.h (struct Kept_section): Move out of class Layout.
12882         Remove trailing underscores from field names.  Add group_sections
12883         field.  Rename group_ field to is_group.  Change all uses.
12884         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12885         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12886         comdat_groups_ field.
12887         (Sized_relobj::include_section_group): Use
12888         find_or_add_kept_section and Kept_section::group_sections.
12889         (Sized_relobj::include_linkonce_section): Likewise.
12890         * object.cc (class Sized_relobj): Don't define Comdat_group or
12891         Comdat_group_table.  Remove find_comdat_group and
12892         add_comdat_group.  Remove comdat_groups_ field.
12893         * plugin.cc (include_comdat_group): Use
12894         Layout::find_or_add_kept_section.
12895
12896 2009-02-28  Ian Lance Taylor  <iant@google.com>
12897
12898         * README: --gc-sections and map files are now supported.  Document
12899         some build requirements.
12900
12901         PR 6992
12902         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12903         relocatable link set the value of the section symbol to zero.
12904         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12905         relocatable link don't include the section address in the local
12906         symbol value.
12907
12908 2009-02-27  Ian Lance Taylor  <iant@google.com>
12909
12910         PR 6811
12911         * options.h (class Search_directory): Add is_system_directory.
12912         (class General_options): Declare is_in_system_directory.
12913         * options.cc (get_relative_sysroot): Make static.
12914         (get_default_sysroot): Make static.
12915         (General_optoins::is_in_system_directory): New function.
12916         * fileread.cc (Input_file::is_in_system_directory): New function.
12917         * fileread.h (class Input_file): Declare is_in_system_directory.
12918         * object.h (class Object): Add is_in_system_directory.
12919         (class Input_objects): Remove system_library_directory_ field.
12920         * object.cc (Input_objects::add_object): Don't set
12921         system_library_directory_.
12922         (input_objects::found_in_system_library_directory): Remove.
12923         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12924         parameter.  Change all callers.
12925         (Symbol_table::sized_write_globals): Likewise.
12926         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12927         Call Object::is_in_system_directory.
12928         * symtab.h (class Symbol_table): Update declarations.
12929
12930         PR 5990
12931         * descriptors.h (Open_descriptor): Add is_on_stack field.
12932         * descriptors.cc (Descriptors::open): If the descriptor is on the
12933         top of the stack, remove it.  Initialize is_on_stack field.
12934         (Descriptors::release): Only add pod to stack if it is not on the
12935         stack already.
12936         (Descriptors::close_some_descriptor): Clear stack_next and
12937         is_on_stack fields.
12938
12939         PR 7091
12940         * output.cc (Output_section::find_starting_output_address): Rename
12941         from starting_output_address; add PADDR parameter; change return
12942         type.
12943         * output.h (class Output_section): Declare
12944         find_starting_output_address instead of starting_output_address.
12945         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12946         section symbol for which we can't find a merge section.
12947
12948         PR 9836
12949         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12950         hidden or internal, force the symbol to be local.
12951         * resolve.cc (Symbol::override_visibility): Define.
12952         (Symbol::override_base): Use override_visibility.
12953         (Symbol_table::resolve): Likewise.
12954         (Symbol::override_base_with_special): Likewise.
12955         (Symbol_table::override_with_special): If the visibility is hidden
12956         or internal, force the symbol to be local.
12957         * symtab.h (class Symbol): Add set_visibility and
12958         override_visibility.
12959         * testsuite/ver_test_1.sh: New file.
12960         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12961         (check_DATA): Add ver_test_1.syms.
12962         (ver_test_1.syms): New target.
12963         * testsuite/Makefile.in: Rebuild.
12964
12965 2009-02-25  Cary Coutant  <ccoutant@google.com>
12966
12967         * layout.cc (Layout::choose_output_section): Don't rename sections
12968         when using a linker script that has a SECTIONS clause.
12969         * Makefile.in: Regenerate.
12970
12971         * testsuite/Makefile.am (script_test_5.sh): New test case.
12972         * testsuite/Makefile.in: Regenerate.
12973         * testsuite/script_test_5.cc: New file.
12974         * testsuite/script_test_5.sh: New file.
12975         * testsuite/script_test_5.t: New file.
12976
12977 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12978
12979         * archive.cc (Archive::include_member): Update calls to add_symbols.
12980         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12981         the Layout argument.
12982         * dynobj.h (do_add_symbols): Add the Layout argument.
12983         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12984         Layout argument.
12985         * object.h (Object::add_symbols): Add the Layout argument.
12986         (Object::do_add_symbols): Add the Layout argument.
12987         (Sized_relobj::do_add_symbols): Add the Layout argument.
12988         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12989         Unify the two versions.
12990         (Add_plugin_symbols): Remove.
12991         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12992         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12993         (Add_plugin_symbols): Remove.
12994         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12995         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12996         (Add_symbols::run): Make it work with Pulginobj.
12997
12998 2009-02-06  Ian Lance Taylor  <iant@google.com>
12999
13000         * object.cc (Sized_relobj::do_layout): Make info message start
13001         with lower case letter.
13002
13003 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13004
13005         * binary.cc: Fix file comment.
13006
13007         * options.h (enum Incremental_disposition): Define.
13008         (class General_options): Add new options: --incremental,
13009         --incremental_changed, --incremental_unchanged,
13010         --incremental_unknown.  Add incremental_disposition_ and
13011         implicit_incremental_ fields.
13012         (General_options::incremental_disposition): New function.
13013         (class Position_dependent_options): Add incremental_disposition
13014         option.
13015         (Position_dependent_options::copy_from_options): Set incremental
13016         dispositions.
13017         * options.cc (General_options::parse_incremental_changed): New
13018         function.
13019         (General_options::parse_incremental_unchanged): New function.
13020         (General_options::parse_incremental_unknown): New function.
13021         (General_options::General_options): Initialize new fields
13022         incremental_disposition_ and implicit_incremental_.
13023         (General_options::finalize): Check for uasge of --incremental-*
13024         without --incremental.
13025
13026 2009-02-06  Chris Demetriou  <cgd@google.com>
13027
13028         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13029         pointer and to report location as the file name associated with
13030         the symbol.
13031         (gold_undefined_symbol_at_location): New function to replace the
13032         old gold_undefined_symbol functionality.
13033         * target-reloc.h (relocate_section): Update to use
13034         gold_undefined_symbol_at_location.
13035         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13036         Call gold_undefined_symbol function rather than gold_error.
13037         * errors.h (Errors::undefined_symbol): Take location as a
13038         string, rather than calculating it from a relocation.
13039         * errors.cc (Errors::fatal): Print "fatal error:" before the
13040         formatted message.
13041         (Errors::error, Errors::error_at_location): Print "error: "
13042         before the formatted message.
13043         (Errors::undefined_symbol): Take location as a string, rather
13044         than calculating it from a relocation.
13045         (gold_undefined_symbol_at_location): New function akin to
13046         old gold_undefined_symbol, calculates location from relocation.
13047         (gold_undefined_symbol): Change to take only a Symbol pointer
13048         and to report location as the file name associated with the symbol.
13049         * testsuite/debug_msg.sh: Update for changed error messages.
13050         * testsuite/undef_symbol.sh: Likewise.
13051
13052 2009-02-04  Duncan Sands  <baldrick@free.fr>
13053
13054         PR 9812
13055         * reduced_debug_output.h
13056         (Output_reduced_debug_abbrev_section::failed): Use format for
13057         gold_warning.
13058         (Output_reduced_debug_info_section::faild): Likewise.
13059
13060 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13061
13062         * script.cc (Lazy_demangler): New class.
13063         (Version_script_info::get_symbol_version_helper): Demangle a
13064         symbol only once.
13065
13066 2009-01-29  Cary Coutant  <ccoutant@google.com>
13067
13068         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13069         to __tls_get_addr.
13070         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13071
13072 2009-01-28  Ian Lance Taylor  <iant@google.com>
13073
13074         * version.cc (version_string): Bump to 1.9.
13075
13076         * gold.h: Include <cstring> and <stdint.h>.
13077         * version.cc: Include <cstdio>.
13078         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13079         warning.
13080         * reduced_debug_output.cc (insert_into_vector): Rename from
13081         Insert_into_vector; change all callers.  Use Swap_unaligned to
13082         avoid aliasing issue; remove union since it is unnecessary.
13083
13084 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13085
13086         * Makefile.am (CCFILES): Add gc.cc.
13087         (HFILES): Add gc.h.
13088         * Makefile.in: Regenerate.
13089         * gold.cc (Gc_runner): New class.
13090         (queue_initial_tasks): Call garbage collection related tasks
13091         when corresponding options are invoked.
13092         (queue_middle_gc_tasks): New function.
13093         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13094         processed early before laying out sections during garbage collection.
13095         * gold.h (queue_middle_gc_tasks): New function.
13096         (is_prefix_of): Move from "layout.cc".
13097         * i386.cc (Target_i386::gc_process_relocs): New function.
13098         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13099         * main.cc (main): Create object of class "Garbage_collection".
13100         * object.cc (Relobj::copy_symbols_data): New function.
13101         (Relobj::is_section_name_included): New function.
13102         (Sized_relobj::do_layout): Allow this function to be called twice
13103         during garbage collection and defer layout of section during the
13104         first call.
13105         * object.h (Relobj::get_symbols_data): New function.
13106         (Relobj::is_section_name_included): New function.
13107         (Relobj::copy_symbols_data): New function.
13108         (Relobj::set_symbols_data): New function.
13109         (Relobj::get_relocs_data): New function.
13110         (Relobj::set_relocs_data): New function.
13111         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13112         (Relobj::gc_process_relocs): New function.
13113         (Relobj::do_gc_process_relocs): New pure virtual function.
13114         (Relobj::sd_): New data member.
13115         (Sized_relobj::is_output_section_offset_invalid): New function.
13116         (Sized_relobj::do_gc_process_relocs): New function.
13117         * options.h (General_options::gc_sections): Modify to not be a no-op.
13118         (General_options::print_gc_sections): New option.
13119         * plugin.cc (Plugin_finish::run): Remove function call to
13120         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13121         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13122         * reloc.cc (Read_relocs::run): Add task to process relocs and
13123         determine unreferenced sections when doing garbage collection.
13124         (Gc_process_relocs): New class.
13125         (Sized_relobj::do_gc_process_relocs): New function.
13126         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13127         sections that are garbage collected.
13128         * reloc.h (Gc_process_relocs): New class.
13129         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13130         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13131         symbols whose corresponding sections are garbage collected.
13132         (Symbol_table::Symbol_table): Add new parameter for the garbage
13133         collection object.
13134         (Symbol_table::gc_mark_undef_symbols): New function.
13135         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13136         (Symbol_table::gc_mark_dyn_syms): New function.
13137         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13138         as garbage.
13139         (Symbol_table::add_from_object): Likewise.
13140         (Symbol_table::add_from_relobj): When building shared objects, do not
13141         treat externally visible symbols as garbage.
13142         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13143         table information for static and relocatable links.
13144         * symtab.h (Symbol_table::set_gc): New function.
13145         (Symbol_table::gc): New function.
13146         (Symbol_table::gc_mark_undef_symbols): New function.
13147         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13148         (Symbol_table::gc_mark_dyn_syms): New function.
13149         (Symbol_table::gc_): New data member.
13150         * target.h (Sized_target::gc_process_relocs): New pure virtual
13151         function.
13152         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13153         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13154
13155 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13156
13157         * options.h (General_options::gc_sections): Define as a no-op for now.
13158         (General_options::no_keep_memory): Ditto.
13159         (General_options::Bshareable): Define.
13160         * options.cc (General_options::finalize): Honor -Bshareable.
13161
13162 2009-01-20  Andreas Schwab  <schwab@suse.de>
13163
13164         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13165         read the value in the contents, since we don't use it.  Use the
13166         template endianness when writing.
13167         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13168
13169 2009-01-19  Andreas Schwab  <schwab@suse.de>
13170
13171         * configure.tgt (powerpc64-*): Fix targ_obj.
13172
13173 2009-01-15  Ian Lance Taylor  <iant@google.com>
13174
13175         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13176         local symbols when stripping all symbols.
13177
13178 2009-01-14  Cary Coutant  <ccoutant@google.com>
13179
13180         * output.cc (Output_reloc): Add explicit instantiations.
13181
13182 2009-01-14  Cary Coutant  <ccoutant@google.com>
13183
13184         * archive.cc (Archive::get_elf_object_for_member): Remove call
13185         to File_read::claim_for_plugin.
13186         * descriptors.cc (Descriptors::open): Remove reference to
13187         is_claimed.
13188         (Descriptors::claim_for_plugin): Remove.
13189         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13190         (Descriptors::is_claimed): Remove.
13191         (claim_descriptor_for_plugin): Remove.
13192         * fileread.cc (File_read::claim_for_plugin): Remove.
13193         * fileread.h (File_read::claim_for_plugin): Remove.
13194         (File_read::descriptor): Reopen descriptor if necessary.
13195         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13196         (Plugin_manager::all_symbols_read): Add task parameter. Change
13197         all callers.
13198         (Plugin_manager::get_input_file): New function.
13199         (Plugin_manager::release_input_file): New function.
13200         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13201         corresponding data member.
13202         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13203         and pass to base constructor. Change all callers.
13204         (get_input_file, release_input_file): New functions.
13205         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13206         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13207         (Plugin_manager::all_symbols_read): Add task parameter.
13208         (Plugin_manager::get_input_file): New function.
13209         (Plugin_manager::release_input_file): New function.
13210         (Plugin_manager::task_): New data member.
13211         (Pluginobj::Pluginobj): Add filesize parameter.
13212         (Pluginobj::filename): New function.
13213         (Pluginobj::descriptor): New function.
13214         (Pluginobj::filesize): New function.
13215         (Pluginobj::filesize_): New data member.
13216         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13217         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13218         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13219
13220         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13221         with archive libraries.
13222         * testsuite/Makefile.in: Regenerate.
13223         * testsuite/plugin_test.c (struct sym_info): New type.
13224         (get_input_file, release_input_file): New static variables.
13225         (onload): Capture new transfer vector entries.
13226         (claim_file_hook): Stop reading at end of file according to filesize.
13227         Factor out parsing of readelf output into separate function.
13228         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13229         APIs and get the source file name from the symbol table.  Convert
13230         source file name to corresponding object file name.  Print info
13231         message when adding new input files.
13232         (parse_readelf_line): New function.
13233         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13234         * testsuite/plugin_test_2.sh: Likewise.
13235         * testsuite/plugin_test_3.sh: Likewise.
13236         * testsuite/plugin_test_4.sh: New test case.
13237
13238 2009-01-07  Ian Lance Taylor  <iant@google.com>
13239
13240         * version.cc (version_string): Bump to 1.8.
13241
13242 2008-12-23  Cary Coutant  <ccoutant@google.com>
13243
13244         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13245         * plugin.cc (Plugin_manager::finish): Rename as
13246         layout_deferred_objects.  Move cleanup to separate function.
13247         (Plugin_manager::cleanup): New function.
13248         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13249         separately.
13250         * plugin.h (Plugin_manager::finish): Rename as
13251         layout_deferred_objects.
13252         (Plugin_manager::cleanup): New function.
13253         (Plugin_manager::cleanup_done): New field.
13254
13255 2008-12-23  Cary Coutant  <ccoutant@google.com>
13256
13257         * plugin.cc (is_visible_from_outside): New function.
13258         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13259         so we don't return "IR only" status for exported symbols or -r links.
13260
13261         * testsuite/Makefile.am (plugin_test_3): New test case.
13262         * testsuite/Makefile.in: Regenerate.
13263         * testsuite/plugin_test_3.sh: New file.
13264
13265 2008-12-22  Cary Coutant  <ccoutant@google.com>
13266
13267         * object.cc (Sized_relobj::layout_section): New function.
13268         (Sized_relobj::do_layout): Defer layout of input sections until after
13269         plugin has provided replacement files.
13270         (Sized_relobj::do_layout_deferred_sections): New function.
13271         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13272         (Relobj::layout_deferred_sections): New function.
13273         (Relobj::do_layout_deferred_sections): New function.
13274         (Sized_relobj::do_layout_deferred_sections): New function.
13275         (Sized_relobj::layout_section): New function.
13276         (Sized_relobj::Deferred_layout): New structure.
13277         (Sized_relobj::deferred_layout_): New field.
13278         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13279         Change all callers.  Layout deferred sections.
13280         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13281         references.
13282         (Plugin_hook::run): Move code from do_plugin_hook inline.
13283         (Plugin_hook::do_plugin_hook): Remove.
13284         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13285         (Plugin_manager::finish): Renamed, was cleanup.
13286         (Plugin_manager::should_defer_layout): New function.
13287         (Plugin_manager::add_deferred_layout_object): New function.
13288         (Plugin_manager::Deferred_layout_list): New type.
13289         (Plugin_manager::deferred_layout_objects_): New field.
13290         (Plugin_hook::do_plugin_hook): Remove.
13291
13292 2008-12-17  Ian Lance Taylor  <iant@google.com>
13293
13294         * options.h (class General_options): Add --no case for
13295         --export-dynamic.
13296
13297 2008-12-16  Cary Coutant  <ccoutant@google.com>
13298
13299         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13300         vector.
13301         (Plugin_manager::claim_file): Create plugin object even if
13302         plugin did not call the add_symbols callback.
13303         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13304         asking for more symbols than were added.
13305         * testsuite/Makefile.am (plugin_test_1): Add test case with
13306         no global symbols.
13307         (empty.syms): New target.
13308         * testsuite/Makefile.in: Regenerate.
13309         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13310         message. Don't call add_symbols if no globals.
13311         (all_symbols_read_hook): Don't provide replacement for empty
13312         claimed file.
13313
13314 2008-12-12  Ian Lance Taylor  <iant@google.com>
13315
13316         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13317         r_type == 0 for a local symbol with r_sym == 0.
13318         (scan_relocatable_relocs): Pass r_sym to
13319         local_non_section_strategy.
13320         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13321         r_sym parameter.
13322
13323         * configure.ac: Update test for TLS descriptors: they are
13324         supported as of glibc 2.9.
13325         * configure: Rebuild.
13326
13327 2008-12-11  Ian Lance Taylor  <iant@google.com>
13328
13329         PR 7091
13330         * target-reloc.h (Default_scan_relocatable_relocs): For each
13331         function, map r_type == 0 to RELOC_DISCARD.
13332
13333 2008-12-10  Cary Coutant  <ccoutant@google.com>
13334
13335         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13336         object to override a kept COMDAT group from a plugin object.
13337
13338 2008-12-09  Ian Lance Taylor  <iant@google.com>
13339
13340         PR 7088
13341         * yyscript.y (file_cmd): Handle INPUT.
13342
13343         * testsuite/initpri1.c: Change all declarations to be full
13344         prototypes by adding void, to avoid compiler warnings.
13345
13346 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13347
13348         * options.cc (General_options::parse_plugin_opt): New.
13349         (General_options::add_plugin): The argument now is just the filename.
13350         (General_options::add_plugin_option): New.
13351         * options.h (plugin_opt): New.
13352         (add_plugin): Change argument name.
13353         (add_plugin_option): New.
13354         * plugin.cc (Plugin::load): Don't parse the plugin option.
13355         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13356         (Plugin::add_option): New.
13357         (Plugin::args_): Change type.
13358         (Plugin::filename_): New.
13359         (Plugin_manager::add_plugin_option): New.
13360         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13361         * testsuite/Makefile.in: Regenerate.
13362
13363 2008-12-05  Cary Coutant  <ccoutant@google.com>
13364
13365         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13366         Handle --strip-lto-sections option.
13367         * options.h (strip_lto_sections): New option.
13368
13369 2008-12-01  Cary Coutant  <ccoutant@google.com>
13370
13371         * plugin.cc (ld_plugin_message): Change format parameter to const.
13372         Fix mismatch between new[] and delete.
13373
13374 2008-11-14  Cary Coutant  <ccoutant@google.com>
13375
13376         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13377         instead of -1U.
13378
13379 2008-11-05  Craig Silverstein  <csilvers@google.com>
13380
13381         * options.cc (General_options::parse_dynamic_list): New function.
13382         * options.h (General_options): New flags dynamic_list,
13383         dynamic_list_data, dynamic_list_cpp_new, and
13384         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13385         (General_options::in_dynamic_list): New function.
13386         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13387         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13388         (Lex::can_continue_name): Likewise.
13389         (yylex): Likewise.
13390         (read_script_file): New parameter script_options.
13391         (read_dynamic_list): New function.
13392         (Script_options::define_dynamic_list): New function.
13393         (dynamic_list_keyword_parsecodes): New variable.
13394         (dynamic_list_keywords): New variable.
13395         * script.h (Script_options::define_dynamic_list): New function
13396         prototype.
13397         (read_dynamic_list): New function prototype.
13398         * symtab.cc (strprefix): New macro.
13399         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13400         dynamic_list_data, dynamic_list_cpp_new, and
13401         dynamic_list_cpp_typeinfo.
13402         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13403         (dynamic_list_expr): New rule.
13404         (dynamic_list_nodes): Likewise.
13405         (dynamic_list_node): Likewise.
13406         * testsuite/Makefile.am (dynamic_list): New test.
13407         * testsuite/Makefile.in: Regenerated.
13408         * testsuite/dynamic_list.t: New file.
13409         * testsuite/dynamic_list.sh: New file.
13410
13411 2008-11-05  Craig Silverstein  <csilvers@google.com>
13412
13413         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13414         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13415         (t11_last): Likewise.
13416         * testsuite/ver_test_6.c (main): Likewise.
13417
13418 2008-10-07  Cary Coutant  <ccoutant@google.com>
13419
13420         * options.c (General_options::finalize): Add check for -static and
13421         -shared.
13422         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13423         is not empty.
13424
13425 2008-10-02  Cary Coutant  <ccoutant@google.com>
13426
13427         * plugin.cc (make_sized_plugin_object): Fix conditional
13428         compilation to work when not all targets are enabled.
13429
13430 2008-09-29  Cary Coutant  <ccoutant@google.com>
13431
13432         * archive.cc (Archive::get_file_and_offset): Use filename instead
13433         of name to get library path.
13434         (Archive::include_member): Unlock external member of a thin archive.
13435
13436         * testsuite/Makefile.am (TEST_AR): New variable.
13437         (thin_archive_test_1): New test.
13438         (thin_archive_test_2): New test.
13439         * testsuite/Makefile.in: Regenerate.
13440         * testsuite/thin_archive_main.cc: New file.
13441         * testsuite/thin_archive_test_1.cc: New file.
13442         * testsuite/thin_archive_test_2.cc: New file.
13443         * testsuite/thin_archive_test_3.cc: New file.
13444         * testsuite/thin_archive_test_4.cc: New file.
13445
13446 2008-09-29  Cary Coutant  <ccoutant@google.com>
13447
13448         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13449         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13450         instead of -1U.
13451         (Sized_relobj::do_finalize_local_symbols): Likewise.
13452         (Sized_relobj::map_to_kept_section): Likewise.
13453         * object.h (Sized_relobj::invalid_address): New constant.
13454         (Sized_relobj::do_output_section_offset): Check for invalid_address
13455         and return -1ULL.
13456         * output.cc (Output_reloc::local_section_offset): Use constant
13457         invalid_address instead of -1U.
13458         (Output_reloc::get_address): Likewise.
13459         (Output_section::output_address): Change -1U to -1ULL.
13460         * output.h (Output_reloc::invalid_address): New constant.
13461         * reloc.cc (Sized_relobj::write_sections): Use constant
13462         invalid_address instead of -1U.
13463         (Sized_relobj::relocate_sections): Likewise.
13464         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13465         values for merge sections.
13466         * target-reloc.h (relocate_for_relocatable): Use constant
13467         invalid_address instead of -1U.
13468
13469 2008-09-19  Cary Coutant  <ccoutant@google.com>
13470
13471         Add plugin functionality for link-time optimization (LTO).
13472         * configure.ac (plugins): Add --enable-plugins option.
13473         * configure: Regenerate.
13474         * config.in: Regenerate.
13475         * Makefile.am (LIBDL): New variable.
13476         (CCFILES): Add plugin.cc.
13477         (HFILES): Add plugin.h.
13478         (ldadd_var): Add LIBDL.
13479         * Makefile.in: Regenerate.
13480
13481         * archive.cc: Include "plugin.h".
13482         (Archive::setup): Don't preread archive symbols when using a plugin.
13483         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13484         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13485         files.
13486         (Archive::include_member): Add symbols from plugin objects.
13487         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13488         * descriptors.cc (Descriptors::open): Check for file descriptors
13489         abandoned by plugins.
13490         (Descriptors::claim_for_plugin): New function.
13491         * descriptors.h (Descriptors::claim_for_plugin): New function.
13492         (Open_descriptor::is_claimed): New field.
13493         (claim_descriptor_for_plugin): New function.
13494         * fileread.cc (File_read::claim_for_plugin): New function.
13495         * fileread.h (File_read::claim_for_plugin): New function.
13496         (File_read::descriptor): New function.
13497         * gold.cc: Include "plugin.h".
13498         (queue_initial_tasks): Add task to call plugin hooks for generating
13499         new object files.
13500         * main.cc: Include "plugin.h".
13501         (main): Load plugin libraries.
13502         * object.h (Pluginobj): Declare.
13503         (Object::pluginobj): New function.
13504         (Object::do_pluginobj): New function.
13505         (Object::set_target): New function.
13506         * options.cc: Include "plugin.h".
13507         (General_options::parse_plugin): New function.
13508         (General_options::General_options): Initialize plugins_ field.
13509         (General_options::add_plugin): New function.
13510         * options.h (Plugin_manager): Declare.
13511         (General_options): Add --plugin option.
13512         (General_options::has_plugins): New function.
13513         (General_options::plugins): New function.
13514         (General_options::add_plugin): New function.
13515         (General_options::plugins_): New field.
13516         * plugin.cc: New file.
13517         * plugin.h: New file.
13518         * readsyms.cc: Include "plugin.h".
13519         (Read_symbols::do_read_symbols): Check for archive before checking
13520         for ELF file.  Call plugin hooks to claim files.
13521         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13522         from a real object file; force override when processing replacement
13523         files.
13524         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13525         (Symbol::init_base_object): Likewise.
13526         (Symbol::init_base_output_data): Likewise.
13527         (Symbol::init_base_output_segment): Likewise.
13528         (Symbol::init_base_constant): Likewise.
13529         (Symbol::init_base_undefined): Likewise.
13530         (Symbol::output_section): Assert that object is not a plugin.
13531         (Symbol_table::add_from_pluginobj): New function.
13532         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13533         undefined.
13534         (Symbol_table::sized_write_globals): Likewise.
13535         (Symbol_table::add_from_pluginobj): Instantiate template.
13536         * symtab.h (Sized_pluginobj): Declare.
13537         (Symbol::in_real_elf): New function.
13538         (Symbol::set_in_real_elf): New function.
13539         (Symbol::in_real_elf_): New field.
13540         (Symbol_table::add_from_pluginobj): New function.
13541
13542         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13543         (LIBDL): New variable.
13544         (LDADD): Add LIBDL.
13545         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13546         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13547         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13548         (MOSTLYCLEANFILES): Likewise.
13549         * testsuite/Makefile.in: Regenerate.
13550         * testsuite/plugin_test.c: New file.
13551         * testsuite/plugin_test_1.sh: New file.
13552         * testsuite/plugin_test_2.sh: New file.
13553
13554 2008-09-16  Ian Lance Taylor  <iant@google.com>
13555
13556         * target-reloc.h (relocate_section): Check whether a symbol is
13557         defined by the ABI before reporting an undefined symbol error.
13558         * target.h (Target::is_defined_by_abi): Make parameter const.
13559         (Target::do_is_defined_by_abi): Likewise.
13560         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13561         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13562         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13563         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13564         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13565         * testsuite/Makefile.in: Rebuild.
13566
13567         * fileread.cc (make_view): Add casts to avoid warning.
13568
13569 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13570
13571         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13572         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13573
13574 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13575
13576         * options.h (General_options::output_is_executable): New.
13577         (General_options::output_is_pie): New.
13578         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13579         for shared libraries.
13580         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13581
13582 2008-09-11  Chris Demetriou  <cgd@google.com>
13583
13584         * options.h (origin): New -z option.
13585         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13586         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13587         in DT_FLAGS_1.
13588
13589 2008-09-05  Cary Coutant  <ccoutant@google.com>
13590
13591         * fileread.cc (File_read::make_view): Add check for attempt to map
13592         beyond end of file.
13593
13594 2008-09-05  Cary Coutant  <ccoutant@google.com>
13595
13596         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13597         explicit instantiations.
13598
13599 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13600
13601         PR gold/6858
13602         * options.cc (General_options::finalize): Allow undefined symbols
13603         in shlibs if linking -shared.
13604
13605         PR gold/6859
13606         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13607         symbols as not needing a dynsym entry.
13608
13609 2008-08-20  Craig Silverstein  <csilvers@google.com>
13610
13611         * fileread.cc (File_read::open): Do not lock the file unless it
13612         was successfully opened.
13613
13614 2008-08-14  Cary Coutant  <ccoutant@google.com>
13615
13616         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13617         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13618         * testsuite/tls_test.cc (struct int128): 128-bit struct
13619         for testing TLS relocs with non-zero addend.
13620         (v12): New TLS variable.
13621         (t12): New test.
13622         (t_last): Add check for v12.
13623         * testsuite/tls_test.h (t12): New function.
13624         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13625
13626 2008-08-13  Ian Lance Taylor  <iant@google.com>
13627
13628         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13629         set tls_segment_ or relro_segment_.
13630         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13631         when appropriate.
13632         * output.h (Output_section::clear_is_relro): New function.
13633         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13634         sections specially even when output_data_ is empty.
13635         (Output_segment::maximum_alignment): When first section is relro,
13636         only force alignment for PT_LOAD segments.
13637         * script.cc (script_data_segment_align): New function.
13638         (script_data_segment_relro_end): New function.
13639         * script-c.h (script_data_segment_align): Declare.
13640         (script_data_segment_relro_end): Declare.
13641         * script-sections.h (class Script_sections): Declare
13642         data_segment_align and data_segment_relro_end.  Add fields
13643         segment_align_index_ and saw_relro_end_.
13644         * script-sections.cc (class Sections_element): Add set_is_relro
13645         virtual function.  Add new bool* parameter to place_orphan_here.
13646         Add get_output_section virtual function.
13647         (class Output_section_definition): Add set_is_relro.  Add new
13648         bool* parameter to place_orphan_here.  Add get_output_section.
13649         Add is_relro_ field.
13650         (Output_section_definition::Output_section_definition): Initialize
13651         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13652         and is_relro_ fields.
13653         (Output_section_definition::place_orphan_here): Add is_relro
13654         parameter.
13655         (Output_section_definition::set_section_addresses): Set relro for
13656         output section.
13657         (Output_section_definition::alternate_constraint): Likewise.
13658         (class Orphan_output_section): Add new bool* parameter to
13659         place_orphan_here.  Add get_output_section.
13660         (Orphan_output_section::place_orphan_here): Add is_relro
13661         parameter.
13662         (Script_sections::Script_sections): Initialize
13663         data_segment_align_index_ and saw_relro_end_.
13664         (Script_sections::data_segment_align): New function.
13665         (Script_sections::data_segment_relro_end): New function.
13666         (Script_sections::place_orphan): Set or clear is_relro.
13667         (Script_sections::set_section_addresses): Force alignment of first
13668         TLS section.
13669         * yyscript.y (exp): Call script_data_segment_align and
13670         script_data_segment_relro_end.
13671         * testsuite/relro_script_test.t: New file.
13672         * testsuite/relro_test.cc (using_script): Declare.
13673         (t1, t2): Test using_script.
13674         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13675         (relro_script_test_SOURCES): Define.
13676         (relro_script_test_DEPENDENCIES): Define.
13677         (relro_script_test_LDFLAGS): Define.
13678         (relro_script_test_LDADD): Define.
13679         (relro_script_test.so): New target.
13680         * testsuite/Makefile.in: Rebuild.
13681
13682 2008-08-06  Cary Coutant <ccoutant@google.com>
13683
13684         * archive.cc (Archive::total_archives, Archive::total_members)
13685         (Archive::total_members_loaded): New variables.
13686         (Archive::setup): Add parameter.  Add option to preread
13687         archive symbols.
13688         (Archive::read_armap): Add counter.
13689         (Archive::get_file_and_offset): New function.
13690         (Archive::get_elf_object_for_member): New function.
13691         (Archive::read_all_symbols): New function.
13692         (Archive::read_symbols): New function.
13693         (Archive::add_symbols): Add counters.
13694         (Archive::include_all_members): Use armap to find members if it's
13695         already built.
13696         (Archive::include_member): Skip reading symbols if already read.
13697         Factored code into Archive::get_file_and_offset and
13698         Archive::get_elf_object_for_member.  Changed call to
13699         Mapfile::report_include_archive_member.
13700         (Archive::print_stats): New function.
13701         * archive.h: Declare Object and Read_symbols_data classes.
13702         (Archive::Archive): Add initializers for new members.
13703         (Archive::setup): Add parameter.
13704         (Archive::print_stats): New function.
13705         (Archive::total_archives, Archive::total_members)
13706         (Archive::total_members_loaded): New variables.
13707         (Archive::get_file_and_offset): New function.
13708         (Archive::get_elf_object_for_member): New function.
13709         (Archive::read_all_symbols): New function.
13710         (Archive::read_symbols): New function.
13711         (Archive::Archive_member): New class.
13712         (Archive::members_): New member.
13713         (Archive::num_members_): New member.
13714         * main.cc: Include archive.h.
13715         (main): Call Archive::print_stats.
13716         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13717         archive parameter; member_name is now the fully-decorated name.
13718         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13719         * options.h: (General_options): Add --preread-archive-symbols option.
13720         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13721         Archive::setup.
13722
13723 2008-08-04  Ian Lance Taylor  <iant@google.com>
13724
13725         * symtab.h (Symbol::use_plt_offset): New function.
13726         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13727         * powerpc.cc (Relocate::relocate): Likewise.
13728         * sparc.cc (Relocate::relocate): Likewise.
13729         * x86_64.cc (Relocate::relocate): Likewise.
13730         * testsuite/weak_plt.sh: New test.
13731         * testsuite/weak_plt_main.cc: New test.
13732         * testsuite/weak_plt_shared.cc: New test.
13733         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13734         (check_PROGRAMS): Add weak_plt.
13735         (check_DATA): Add weak_plt_shared.so.
13736         (weak_plt_main_pic.o, weak_plt): New targets.
13737         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13738         * testsuite/Makefile.in: Rebuild.
13739
13740         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13741         gcctestdir/ld.
13742         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13743         * testsuite/Makefile.in: Rebuild.
13744
13745 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13746
13747         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13748         * Makefile.in: Regenerate.
13749         * po/POTFILES.in: Regenerate.
13750
13751 2008-07-29  Ian Lance Taylor  <iant@google.com>
13752
13753         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13754         symbols before other symbols.
13755         * testsuite/script_test_2.cc (test_addr): Declare.
13756         (test_addr_alias): Declare.
13757         (main): Check that test_addr and test_addr_alias have the right
13758         values.
13759         * testsuite/script_test_2.t: Define test_addr_alias and
13760         test_addr.
13761
13762 2008-07-24  Ian Lance Taylor  <iant@google.com>
13763
13764         PR 5990
13765         * descriptors.cc: New file.
13766         * descriptors.h: New file.
13767         * gold-threads.h (class Hold_optional_lock): New class.
13768         * fileread.cc: Include "descriptors.h".
13769         (File_read::~File_read): Release descriptor rather than closing
13770         it.
13771         (File_read::open) [file]: Call open_descriptor rather than open.
13772         Set is_descriptor_opened_.
13773         (File_read::open) [memory]: Assert that descriptor is not open.
13774         (File_read::reopen_descriptor): New function.
13775         (File_read::release): Release descriptor.
13776         (File_read::do_read): Make non-const.  Reopen descriptor.
13777         (File_read::read): Make non-const.
13778         (File_read::make_view): Reopen descriptor.
13779         (File_read::do_readv): Likewise.
13780         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13781         Update declarations.
13782         * layout.cc: Include "descriptors.h".
13783         (Layout::create_build_id): Use open_descriptor rather than open.
13784         * output.cc: Include "descriptors.h".
13785         (Output_file::open): Use open_descriptor rather than open.
13786         * archive.cc (Archive::const_iterator): Change Archive to be
13787         non-const.
13788         (Archive::begin, Archive::end): Make non-const.
13789         (Archive::count_members): Likewise.
13790         * archive.h (class Archive): Update declarations.
13791         * object.h (Object::read): Make non-const.
13792         * Makefile.am (CCFILES): Add descriptors.cc.
13793         (HFILES): Add descriptors.h.
13794         * Makefile.in: Rebuild.
13795
13796         PR 6716
13797         * gold.h: Always include <clocale>.  Add Solaris workarounds
13798         following code in binutils/sysdep.h.
13799
13800         PR 6048
13801         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13802         this->eh_frame_hdr_ is NULL before using it.
13803
13804         * dynobj.cc (Versions::Versions): Update comment.
13805
13806         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13807         the base version name.
13808
13809         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13810         array size plus one.
13811         (Stringpool_template::set_string_offsets): Subtract one from key
13812         before using it as an array index.
13813         (Stringpool_template::get_offset_with_length): Likewise.
13814         (Stringpool_template::write_to_buffer): Likewise.
13815         * stringpool.h (Stringpool_template::get_offset_from_key):
13816         Likewise.
13817
13818 2008-07-23  Ian Lance Taylor  <iant@google.com>
13819
13820         PR 6658
13821         * object.h (Merged_symbol_value::value): Do our best to handle a
13822         negative addend.
13823
13824         PR 6647
13825         * script.cc (Version_script_info::get_versions): Don't add empty
13826         version tag to return value.
13827         (Version_script_info::get_symbol_version_helper): Change return
13828         type to bool.  Add pversion parameter.  Change all callers.
13829         (script_register_vers_node): Don't require a non-NULL tag.
13830         * script.h (class Version_script_info): Update declarations.
13831         (Version_script_info::get_symbol_version): Change return type to
13832         bool.  Add version parameter.  Change all callers.
13833         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13834         handling.  Handle an empty version from a version script.
13835         (Symbol_table::define_special_symbol): Likewise.
13836         * testsuite/ver_test_10.script: New file.
13837         * testsuite/ver_test_10.sh: New file.
13838         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13839         (check_DATA): Add ver_test_10.syms.
13840         (ver_test_10.syms, ver_test_10.so): New target.
13841         * testsuite/Makefile.in: Rebuild.
13842
13843 2008-07-23  Simon Baldwin  <simonb@google.com>
13844
13845         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13846         to zero for undefined symbols from dynamic libraries.
13847
13848 2008-07-23  Ian Lance Taylor  <iant@google.com>
13849
13850         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13851         Change all callers.
13852         * symtab.h (class Symbol_table): Update declaration.
13853         * testsuite/ver_test_9.cc: New file.
13854         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13855         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13856         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13857         (ver_test_9.so, ver_test_9.o): New targets.
13858         * testsuite/Makefile.in: Rebuild.
13859
13860 2008-07-22  Ian Lance Taylor  <iant@google.com>
13861
13862         * options.h (class General_options): Define --check-sections.
13863         * layout.cc (Layout::set_segment_offsets): Handle
13864         --check-sections.
13865
13866         * options.h (class General_options): Define -n/--nmagic and
13867         -N/--omagic.
13868         * options.cc (General_options::finalize): For -n/--nmagic or
13869         -N/--omagic, set -static.
13870         * layout.cc (Layout::attach_allocated_section_to_segment): If
13871         -N/--omagic, don't put read-only and read-write sections in
13872         different segments.
13873         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13874         finding a read-only segment.
13875         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13876         don't set the minimum segment alignment to the common page size,
13877         and don't set the file offset to the address modulo the page size.
13878         * script-sections.cc (Script_sections::create_segments): If
13879         -n/--omagic, don't put read-only and read-write sections in
13880         different segments.
13881
13882         * cref.cc: New file.
13883         * cref.h: New file.
13884         * options.h (class General_options): Add --print-symbol-counts.
13885         * main.cc (main): Issue defined symbol report if requested.
13886         * archive.cc (Archive::interpret_header): Make into a const member
13887         function.
13888         (Archive::add_symbols): Call Input_objects::archive_start and
13889         archive_stop.
13890         (Archive::const_iterator): Define new class.
13891         (Archive::begin, Archive::end): New functions.
13892         (Archive::include_all_members): Rewrite to use iterator.
13893         (Archive::count_members): New function.
13894         * archive.h (class Archive): Update declarations.
13895         (Archive::filename): New function.
13896         * object.cc: Include "cref.h".
13897         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13898         (Sized_relobj::do_get_global_symbol_counts): New function.
13899         (Input_objects::add_object): Add object to cross-referencer.
13900         (Input_objects::archive_start): New function.
13901         (Input_objects::archive_stop): New function.
13902         (Input_objects::print_symbol_counts): New function.
13903         * object.h: Declare Cref and Archive.
13904         (Object::get_global_symbol_counts): New function.
13905         (Object::do_get_global_symbol_counts): New pure virtual function.
13906         (class Sized_relobj): Add defined_count_ field.  Update
13907         declarations.
13908         (class Input_objects): Add cref_ field.  Update constructor.
13909         Update declarations.
13910         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13911         defined_count_.
13912         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13913         symbol counts.
13914         (Sized_dynobj::do_get_global_symbol_counts): New function.
13915         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13916         defined_count_.  Update declarations.  Define Symbols typedef.
13917         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13918         parameter.  Change all callers.
13919         (Symbol_table::add_from_dynobj): Add sympointers and defined
13920         parameters.  Change all callers.
13921         * symtab.h (class Symbol_table): Update declarations.
13922         * Makefile.am (CCFILES): Add cref.cc.
13923         (HFILES): Add cref.h.
13924         * Makefile.in: Rebuild.
13925
13926 2008-07-22  Simon Baldwin  <simonb@google.com>
13927
13928         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13929         to zero when writing undefined symbols.
13930
13931 2008-07-22  Ian Lance Taylor  <iant@google.com>
13932
13933         * output.cc (Output_section::add_input_section): Don't try to
13934         merge empty merge sections.
13935
13936 2008-07-21  Craig Silverstein  <csilvers@google.com>
13937
13938         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13939         Include symbol version in error message.
13940
13941 2008-07-20  Chris Demetriou  <cgd@google.com>
13942
13943         * configure.ac (gold_cv_c_random_seed): New configured variable.
13944         (RANDOM_SEED_CFLAGS): New substituted variable.
13945         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13946         * configure: Rebuild.
13947         * Makefile.in: Likewise.
13948         * testsuite/Makefile.in: Likewise.
13949
13950 2008-07-18  Ian Lance Taylor  <iant@google.com>
13951
13952         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13953         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13954         * testsuite/ver_test_main.cc (main): Call t4.
13955         (t4, t4_2a): Define.
13956         * testsuite/ver_test_2.cc (t4_2): Define.
13957         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13958         * testsuite/ver_test_4.cc (t4_2a): Define.
13959         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13960         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13961
13962 2008-07-17  Ian Lance Taylor  <iant@google.com>
13963
13964         * dynobj.cc (Versions::add_def): If we give an error about a
13965         missing version, go ahead and create the version anyhow.
13966
13967 2008-07-10  Ian Lance Taylor  <iant@google.com>
13968
13969         Handle output sections with more than 0x7fffffff bytes.
13970         * object.h (class Relobj): Change map_to_output_ to
13971         output_sections_, and just keep a section pointer.  Change all
13972         uses.  Move comdat group support to Sized_relobj.
13973         (Relobj::is_section_specially_mapped): Remove.
13974         (Relobj::output_section): Remove poff parameter.  Change all
13975         callers.
13976         (Relobj::output_section_offset): New function.
13977         (Relobj::set_section_offset): Rewrite.
13978         (Relobj::map_to_output): Remove.
13979         (Relobj::output_sections): New function.
13980         (Relobj::do_output_section_offset): New pure virtual function.
13981         (Relobj::do_set_section_offset): Likewise.
13982         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13983         group support from Relobj.  Update declarations.
13984         (Sized_relobj::get_output_section_offset): New function.
13985         (Sized_relobj::do_output_section_offset): New function.
13986         (Sized_relobj::do_set_section_offset): New function.
13987         * object.cc (Relobj::output_section_address): Remove.
13988         (Sized_relobj::Sized_relobj): Initialize new fields.
13989         (Sized_relobj::include_section_group): Cast find_kept_object to
13990         Sized_relobj.
13991         (Sized_relobj::include_linkonce_section): Likewise.
13992         (Sized_relobj::do_layout): Use separate arrays for output section
13993         and output offset.
13994         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13995         output_sections.
13996         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13997         output_sections and section_offsets.
13998         (Sized_relobj::write_local_symbols): Likewise.
13999         (map_to_kept_section): Compute output address directly.
14000         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14001         output_sections and section_offsets.
14002         (Sized_relobj::write_sections): Likewise.
14003         (Sized_relobj::relocate_sections): Likewise.
14004         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14005         * output.h (class Output_reloc): Update declarations.  Change
14006         u2_.relobj to Sized_relobj*.
14007         (class Output_data_reloc): Change add functions to use
14008         Sized_relobj*.
14009         * output.cc (Output_reloc::Output_reloc): Change relobj to
14010         Sized_relobj*.
14011         (Output_reloc::local_section_offset): Change return type to
14012         Elf_Addr.  Use get_output_section_offset.
14013         (Output_reloc::get_address): Likewise.
14014         (Output_section::is_input_address_mapped): Don't call
14015         is_section_specially_mapped.
14016         (Output_section::output_offset): Likewise.
14017         (Output_section::output_address): Likewise.
14018         (Output_section::starting_output_address): Likewise.
14019         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14020         parameter to Sized_relobj*.
14021         (Copy_relocs::need_copy_reloc): Likewise.
14022         (Copy_relocs::save): Likewise.
14023         * copy-relocs.h (class Copy_relocs): Update declarations.
14024         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14025         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14026         * target-reloc.h (relocate_for_relocatable): Change
14027         offset_in_output_section type to Elf_Addr.  Change code that uses
14028         it as well.
14029         * layout.cc (Layout::layout): Always set *off.
14030         * mapfile.cc (Mapfile::print_input_section): Use
14031         output_section_offset.
14032         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14033         Sized_relobj*.
14034         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14035         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14036         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14037
14038 2008-07-03  Ian Lance Taylor  <iant@google.com>
14039
14040         * layout.cc (Layout::include_section): Do not discard unrecognized
14041         SHT_STRTAB sections.
14042
14043 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14044
14045         * script.cc (Lex::can_continue_name): Make '?' allowable in
14046         version-script names.
14047         * testsuite/version_script.map: Change glob pattern to use '?'
14048
14049 2008-06-30  Manish Singh  <yosh@gimp.org>
14050
14051         PR 6585
14052         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14053         Correct typo.
14054
14055 2008-06-30  Ian Lance Taylor  <iant@google.com>
14056
14057         PR 6660
14058         PR 6682
14059         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14060         versions]: Don't try to read the value in the contents, since we
14061         don't use it.  Use the template endianness when writing.
14062
14063 2008-06-25  Cary Coutant  <ccoutant@google.com>
14064
14065         * fileread.cc (File_read::make_view): Assert on zero-length view.
14066         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14067         symbol table when there are no symbols to read.
14068
14069 2008-06-23  Craig Silverstein  <csilvers@google.com>
14070
14071         * version.cc (version_string): Bump to 1.7
14072
14073 2008-06-18  Craig Silverstein  <csilvers@google.com>
14074
14075         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14076         constant 0xFFFF to type Valtype.
14077         (Powerpc_relocate_functions::rel16_ha): Likewise.
14078
14079 2008-06-17  Ian Lance Taylor  <iant@google.com>
14080
14081         * output.h (Output_section::Input_section): Initialize p2align_ to
14082         zero for Output_section_data constructors.
14083         (Output_section::Input_section::addralign): If not an input
14084         section, return the alignment of the Output_section_data.
14085         * testsuite/copy_test.cc: New file.
14086         * testsuite/copy_test_1.cc: New file.
14087         * testsuite/copy_test_2.cc: New file.
14088         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14089         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14090         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14091         (copy_test_1_pic.o, copy_test_1.so): New targets.
14092         (copy_test_2_pic.o, copy_test_2.so): New targets.
14093         * testsuite/Makefile.in: Rebuild.
14094
14095         * script-sections.cc (Script_sections::place_orphan): Initialize
14096         local variable exact.
14097
14098 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14099
14100         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14101
14102 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14103             David S. Miller  <davem@davemloft.net>
14104
14105         * powerpc.cc: New file.
14106         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14107         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14108         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14109         * Makefile.in: Rebuild.
14110
14111 2008-06-09  Ian Lance Taylor  <iant@google.com>
14112
14113         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14114         <exception>.
14115         (throwing, orig_terminate): New static variables.
14116         (terminate_handler): New static function.
14117         (t2): Set terminate handler.
14118
14119 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14120
14121         PR 6584
14122         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14123         alignment.
14124
14125 2008-05-30  Cary Coutant  <ccoutant@google.com>
14126
14127         * archive.cc (Archive::include_all_members) Correct to step
14128         over symbol table and extended name table in thin archives.
14129
14130 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14131
14132         PR 6407
14133         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14134         calculation.
14135
14136 2008-05-28  Caleb Howe  <cshowe@google.com>
14137
14138         * reduced_debug_output.cc: New file.
14139         * reduced_debug_output.h: New file.
14140         * options.h (class General_options): Add --strip-debug-non-line.
14141         * options.cc (General_options::finalize): Add strip_debug_non_line
14142         to the strip heirarchy.
14143         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14144         fields.
14145         * layout.cc: Include "reduced_debug_output.h".
14146         (Layout::Layout): Initialize new fields.
14147         (line_only_debug_sections): New static array.
14148         (is_lines_only_debug_sections): New static inline function.
14149         (Layout::include_section): Handle --strip-debug-non-line.
14150         (Layout::make_output_section): If --strip-debug-non-line, build
14151         new output sections for .debug_abbrev and .debug_info.
14152         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14153         gold.  Warn about possible overflow.
14154         (read_signed_LEB_128): Likewise.
14155         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14156         (read_signed_LEB_128): Declare.
14157         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14158         (HFILES): Add reduced_debug_output.h.
14159         * Makefile.in: Rebuild.
14160
14161 2008-05-21  Ian Lance Taylor  <iant@google.com>
14162
14163         * mapfile.cc: New file.
14164         * mapfile.h: New file.
14165         * options.h (class General_options): Add -M/--print-map and -Map.
14166         * options.cc (General_options::finalize): Make -M equivalent to
14167         -Map -.
14168         * main.cc: Include <cstdio> and "mapfile.h".
14169         (main): Open mapfile if requested.
14170         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14171         constructor.  Change caller.
14172         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14173         (queue_middle_tasks): Likewise.
14174         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14175         declarations.
14176         * archive.cc: Include "mapfile.h".
14177         (Archive::add_symbols): Add mapfile parameter.  Change all
14178         callers.  Pass mapfile, symbol, and reason to include_member.
14179         (Archive::include_all_members): Add mapfile parameter.  Change all
14180         callers.
14181         (Archive::include_member): Add mapfile, sym, and why parameters.
14182         Change all callers.  Report inclusion to map file.
14183         * archive.h: Include "fileread.h".
14184         (class Archive): Update declarations.
14185         (Archive::file): New const method.
14186         (class Add_archive_symbols): Add mapfile_ field.  Update
14187         constructor.  Change all callers.
14188         * readsyms.h (class Read_symbols): Likewise.
14189         (class Finish_group): Likewise.
14190         (class Read_script): Likewise.
14191         * common.cc: Include "mapfile.h".
14192         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14193         all callers.
14194         (Symbol_table::do_allocate_commons): Likewise.
14195         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14196         symbol allocation to mapfile.
14197         * common.h (class Allocate_commons_task): Add mapfile_ field.
14198         Update constructor.  Change all callers.
14199         * symtab.h (class Symbol_table): Update declarations.
14200         * layout.cc: Include "mapfile.h".
14201         (Layout_task_runner::run): Print information to mapfile.
14202         (Layout::create_gold_note): Change Output_data_fixed_space to
14203         Output_data_zero_fill.
14204         (Layout::create_build_id): Likewise.
14205         (Layout::print_to_mapfile): New function.
14206         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14207         constructor.  Change caller.
14208         (class Layout): Declare print_to_mapfile.
14209         * output.cc (Output_section::Input_section::print_to_mapfile): New
14210         function.
14211         (Output_section::add_input_section): If producing a map, always
14212         add to input_sections_ list.
14213         (Output_section::do_print_to_mapfile): New function.
14214         (Output_segment::print_sections_to_mapfile): New function.
14215         (Output_segment::print_section_list_to_mapfile): New function.
14216         * output.h: Include "mapfile.h".
14217         (Output_data::print_to_mapfile): New function.
14218         (Output_data::do_print_to_mapfile): New virtual function.
14219         (Output_segment_headers::do_print_to_mapfile): New function.
14220         (Output_file_header::do_print_to_mapfile): New function.
14221         (Output_data_const::do_print_to_mapfile): New function.
14222         (class Output_data_const_buffer): Add map_name_ field.  Update
14223         constructor.  Change all callers.  Add do_print_to_mapfile
14224         function.
14225         (class Output_data_fixed_space): Likewise.
14226         (class Output_data_space): Likewise.
14227         (class Output_data_zero_fill): New class.
14228         (Output_data_strtab::do_print_to_mapfile): New function.
14229         (Output_data_reloc_base::do_print_to_mapfile): New function.
14230         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14231         (Output_data_group::do_print_to_mapfile): New function.
14232         (Output_data_got::do_print_to_mapfile): New function.
14233         (Output_data_dynamic::do_print_to_mapfile): New function.
14234         (Output_symtab_xindex::do_print_to_mapfile): New function.
14235         (class Output_section): Declare do_print_to_mapflie.  Declare
14236         print_to_mapfile in Input_section.
14237         (class Output_segment): Declare new functions.
14238         * object.h (Sized_relobj::symbol_count): New function.
14239         * script-sections.cc
14240         (Output_section_element_dot_assignment::set_section_addresses):
14241         Change Output_data_fixed_space to Output_data_zero_fill.
14242         (Output_data_expression::do_print_to_mapfile): New function.
14243         * script.cc (read_input_script): Add mapfile parameter.  Change
14244         all callers.
14245         * script.h (read_input_script): Update declaration.
14246         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14247         (Eh_frame::do_print_to_mapfile): New function.
14248         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14249         (Output_merge_string::do_print_to_mapfile): New function.
14250         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14251         function.
14252         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14253         function.
14254         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14255         function.
14256         * Makefile.am (CCFILES): Add mapfile.cc.
14257         (HFILES): Add mapfile.h.
14258         * Makefile.in: Rebuild.
14259
14260 2008-05-19  Ian Lance Taylor  <iant@google.com>
14261
14262         * options.h (class General_options): Add -z relro.
14263         * layout.cc (Layout::Layout): Initialize relro_segment_.
14264         (Layout::add_output_section_data): Return the output section.
14265         (Layout::make_output_section): Rcognize relro sections and mark
14266         them appropriately.
14267         (Layout::attach_allocated_section_to_segment): Put relro sections
14268         in a PT_GNU_RELRO segment.
14269         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14270         section as relro.
14271         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14272         PT_TLS segments.
14273         (Layout::linkonce_mapping): Map d.rel.ro.local to
14274         .data.rel.ro.local.
14275         (Layout::output_section_name): Us .data.rel.ro.local for any
14276         section which begins with that.
14277         * layout.h (class Layout): Update add_output_section_data
14278         declaration.  Add relro_segment_ field.
14279         * output.cc (Output_section::Output_section): Initialize is_relro_
14280         and is_relro_local_ fields.
14281         (Output_segment::add_output_section): Group relro sections.
14282         (Output_segment::is_first_section_relro): New function.
14283         (Output_segment::maximum_alignment): If there is a relro section,
14284         align the segment to the common page size.
14285         (Output_segment::set_section_addresses): Track whether we are
14286         looking at relro sections.  If the last section is a relro
14287         section, align to the common page size.
14288         (Output_segment::set_section_list_addresses): Add in_relro
14289         parameter.  Change all callers.  Align to the page size when
14290         moving from relro to non-relro section.
14291         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14292         segment.
14293         * output.h (class Output_section): Add is_relro_ and
14294         is_relro_local_ fields.
14295         (Output_section::is_relro): New function.
14296         (Output_section::set_is_relro): New function.
14297         (Output_section::is_relro_local): New function.
14298         (Output_section::set_is_relro_local): New function.
14299         (class Output_segment): Update declarations.
14300         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14301         * sparc.cc (Target_sparc::got_section): Likewise.
14302         * x86_64.cc (Target_x86_64::got_section): Likewise.
14303         * testsuite/relro_test_main.cc: New file.
14304         * testsuite/relro_test.cc: New file.
14305         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14306         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14307         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14308         (relro_test.so, relro_test_pic.o): New targets.
14309         * testsuite/Makefile.in: Rebuild.
14310
14311 2008-05-16  Ian Lance Taylor  <iant@google.com>
14312
14313         * output.cc (Output_segment::add_output_section): Remove front
14314         parameter.
14315         * output.h (class Output_segment): Remove
14316         add_initial_output_section and overloaded add_output_section.
14317         Update declaration of remaining add_output_section.
14318         * layout.cc (Layout::create_interp): Call add_output_section
14319         rather than add_initial_output_section.
14320         (Layout::finish_dynamic_section): Likewise.
14321
14322         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14323         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14324         know the dynamic type.
14325         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14326         field.  Initialize it in constructor.
14327         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14328         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14329         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14330         reloc.
14331
14332         * output.cc (Output_reloc::get_address): Change return type to
14333         Elf_Addr.
14334         * output.h (class Output_reloc): Update get_address declaration.
14335         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14336         for section addresses.
14337
14338 2008-05-09  Ian Lance Taylor  <iant@google.com>
14339
14340         PR 6493
14341         * gold.cc (gold_nomem): Use return value of write.
14342
14343 2008-05-08  Ian Lance Taylor  <iant@google.com>
14344
14345         * symtab.c (Symbol::init_base_output_data): Add version
14346         parameter.  Change all callers.
14347         (Symbol::init_base_output_segment): Likewise.
14348         (Symbol::init_base_constant): Likewise.
14349         (Symbol::init_base_undefined): Likewise.
14350         (Sized_symbol::init_output_data): Likewise.
14351         (Sized_symbol::init_output_segment): Likewise.
14352         (Sized_symbol::init_constant): Likewise.
14353         (Sized_symbol::init_undefined): Likewise.
14354         (Symbol_table::do_define_in_output_data): If the new symbol has a
14355         version, mark it as the default.
14356         (Symbol_table::do_define_in_output_segment): Likewise.
14357         (Symbol_table::do_define_as_constant): Likewise.
14358         * symtab.h (class Symbol): Update declarations.
14359         (class Sized_symbol): Likewise.
14360         * resolve.cc (Symbol::override_version): New function.
14361         (Symbol::override_base): Call override_version.
14362         (Symbol::override_base_with_special): Likewise.
14363         * testsuite/ver_script_8.script: New file.
14364         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14365         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14366         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14367         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14368
14369 2008-05-06  Ian Lance Taylor  <iant@google.com>
14370
14371         PR 6049
14372         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14373         functions.
14374         (class General_options): Remove existing --undefined, and add
14375         --no-undefined instead.  Add new --undefined as synonym for -u.
14376         * archive.cc (Archive::add_symbols): Check whether symbol was
14377         named with -u.
14378         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14379         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14380         all uses.  Add IS_UNDEFINED.  Update declarations to split
14381         different versions of init_base.  Declare init_base_undefined.
14382         (Symbol::is_defined): Handle IS_UNDEFINED.
14383         (Symbol::is_undefined): Likewise.
14384         (Symbol::is_weak_undefined): Call is_undefined.
14385         (Symbol::is_absolute): Handle IS_CONSTANT.
14386         (class Sized_symbol): Update declarations to split different
14387         versions of init.  Declare init_undefined.
14388         (class Symbol_table): Declare new functions.
14389         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14390         Change all callers.
14391         (Symbol::init_base_output_data): Likewise.
14392         (Symbol::init_base_output_segment): Likewise.
14393         (Symbol::init_base_constant): Likewise.
14394         (Symbol::init_base_undefined): New function.
14395         (Sized_symbol::init_object): Rename from init.  Change all
14396         callers.
14397         (Sized_symbol::init_output_data): Likewise.
14398         (Sized_symbol::init_output_segment): Likewise.
14399         (Sized_symbol::init_constant): Likewise.
14400         (Sized_symbol::init_undefined): New function.
14401         (Symbol_table::add_undefined_symbols_from_command_line): New
14402         function.
14403         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14404         function.
14405         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14406         (Symbol::output_section): Likewise.
14407         (Symbol::set_output_section): Likewise.
14408         (Symbol_table::sized_finalize_symbol): Likewise.
14409         (Symbol_table::sized_write_globals): Likewise.
14410         * resolve.cc (Symbol_table::should_override): Likewise.
14411         (Symbol::override_base_with_special): Likewise.
14412
14413         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14414         symbol, change it to have default visibility.
14415         * testsuite/protected_1.cc: New file.
14416         * testsuite/protected_2.cc: New file.
14417         * testsuite/protected_3.cc: New file.
14418         * testsuite/protected_main_1.cc: New file.
14419         * testsuite/protected_main_2.cc: New file.
14420         * testsuite/protected_main_3.cc: New file.
14421         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14422         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14423         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14424         (protected_1.so): New target.
14425         (protected_1_pic.o, protected_2_pic.o): New targets.
14426         (protected_3_pic.o): New target.
14427         (check_PROGRAMS): Add protected_2.
14428         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14429         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14430         * testsuite/Makefile.in: Rebuild.
14431
14432         * options.h (DEFINE_var): Add set_user_set_##varname__.
14433         (DEFINE_bool_alias): New macro.
14434         (class General_options): Define -Bstatic using DEFINE_bool_alias
14435         rather than DEFINE_special.  Add --undefined as an alias for -z
14436         defs.
14437         * options.cc (General_options::parse_Bstatic): Remove.
14438
14439         * options.h (class General_options): Add --fatal-warnings.
14440         * main.cc (main): Implement --fatal-warnings.
14441         * errors.h (Errors::warning_count): New function.
14442
14443         * options.h (class General_options): Add -Bsymbolic-functions.
14444         * symtab.h (Symbol::is_preemptible): Check for
14445         -Bsymbolic-functions.
14446
14447 2008-05-05  Ian Lance Taylor  <iant@google.com>
14448
14449         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14450         as noVARNAME rather than no-VARNAME.
14451         (class General_options): Add option -z combreloc.
14452         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14453         get_address.
14454         (Output_reloc::sort_before) [SHT_REL]: New function.
14455         (Output_reloc::sort_before) [SHT_RELA]: New function.
14456         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14457         Sort_relocs_comparison.
14458         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14459         parameter.  Change all callers.
14460         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14461         sort_relocs parameter.  Change all callers.
14462         * output.cc (Output_reloc::get_address): New function, broken out
14463         of write_rel.
14464         (Output_reloc::write_rel): Call it.
14465         (Output_reloc::compare): New function.
14466         (Output_data_reloc_base::do_write): Optionally sort relocs.
14467
14468         * configure.ac: If targ_extra_obj is set, link it in.
14469         * configure.tgt: Initialize all variables.
14470         (x86_64*): Set targ_extra_obj and targ_extra_size.
14471         * configure: Rebuild.
14472
14473         * object.cc (Sized_relobj::include_section_group): Adjust section
14474         indexes read from group data.  Build vector to pass to
14475         layout_group.
14476         * layout.cc (Layout::layout_group): Add flags and shndxes
14477         parameters.  Remove contents parameter.  Change caller.  Update
14478         explicit instantiations.
14479         * layout.h (class Layout): Update layout_group declaration.
14480         * output.cc (Output_data_group::Output_data_group): Add flags and
14481         input_shndxes parameters.  Remove contents parameter.  Change
14482         caller.
14483         (Output_data_group::do_write): Change input_sections_ to
14484         input_shndxes_.
14485         * output.h (class Output_data_group): Update constructor
14486         declaration.  Rename input_sections_ to input_shndxes_.
14487         * testsuite/many_sections_test.cc: Add template.
14488
14489 2008-04-30  Cary Coutant  <ccoutant@google.com>
14490
14491         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14492
14493         * layout.cc (Layout::include_section): Refactored check for debug
14494         info section.
14495         (Layout::add_comdat): Add new parameters.  Change type
14496         of signature parameter.  Add object and shndx to signatures table.
14497         (Layout::find_kept_object): New function.
14498         * layout.h: Include <cstring>.
14499         (Layout::is_debug_info_section): New function.
14500         (Layout::add_comdat): Add new parameters.
14501         (Layout::find_kept_object): New function.
14502         (Layout::Kept_section): New struct.
14503         (Layout::Signatures): Change type of map range.
14504         * object.cc (Relobj::output_section_address): New function.
14505         (Sized_relobj::include_section_group): Add new parameters.  Change
14506         calls to Layout::add_comdat.  Change to build table of kept comdat
14507         groups and table mapping discarded sections to kept sections.
14508         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14509         (Sized_relobj::do_layout): Change calls to include_section_group and
14510         include_linkonce_section.
14511         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14512         value to zero when section is discarded.
14513         (Sized_relobj::map_to_kept_section): New function.
14514         * object.h (Relobj::output_section_address): New function.
14515         (Relobj::Comdat_group): New type.
14516         (Relobj::find_comdat_group): New function.
14517         (Relobj::Comdat_group_table): New type.
14518         (Relobj::Kept_comdat_section): New type.
14519         (Relobj::Kept_comdat_section_table): New type.
14520         (Relobj::add_comdat_group): New function.
14521         (Relobj::set_kept_comdat_section): New function.
14522         (Relobj::get_kept_comdat_section): New function.
14523         (Relobj::comdat_groups_): New field.
14524         (Relobj::kept_comdat_sections_): New field.
14525         (Symbol_value::input_value): Update comment.
14526         (Sized_relobj::map_to_kept_section) New function.
14527         (Sized_relobj::include_linkonce_section): Add new parameter.
14528         * target-reloc.h (Comdat_behavior): New type.
14529         (get_comdat_behavior): New function.
14530         (relocate_section): Add code to map a discarded section to the
14531         corresponding kept section when applying a relocation.
14532
14533 2008-04-30  Craig Silverstein  <csilvers@google.com>
14534
14535         * dwarf_reader.cc (next_generation_count): New static var.
14536         (Addr2line_cache_entry): New struct.
14537         (addr2line_cache): New static var.
14538         (Dwarf_line_info::one_addr2line): Added caching.
14539         (Dwarf_line_info::clear_addr2line_cache): New function.
14540         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14541         cache-size parameter.
14542         (Dwarf_line_info::one_addr2line_cache): New function.
14543         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14544         new cache-size argument to one_addr2line(), and clear cache.
14545
14546 2008-04-28  Cary Coutant  <ccoutant@google.com>
14547
14548         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14549         R_386_PC8 relocations.
14550
14551 2008-04-23  Ian Lance Taylor  <iant@google.com>
14552
14553         * object.cc (Sized_relobj::include_section_group): Check for
14554         invalid section group.
14555
14556         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14557         header size.
14558
14559         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14560         than read for file header.
14561         * archive.cc (Archive::include_member): Likewise.
14562
14563 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14564
14565         * aclocal.m4: Regenerate.
14566         * configure: Regenerate.
14567
14568 2008-04-19  Ian Lance Taylor  <iant@google.com>
14569
14570         * version.cc (version_string): Bump to 1.6.
14571
14572         * testsuite/Makefile.am (many_sections_r_test): New target.
14573         (many_sections_r_test_SOURCES): Remove.
14574         (many_sections_r_test_DEPENDENCIES): Remove.
14575         (many_sections_r_test_LDFLAGS): Remove.
14576         (many_sections_r_test_LDADD): Remove.
14577
14578         * object.cc (Sized_relobj::do_add_symbols): Always pass
14579         local_symbol_count_ to add_from_relobj.
14580
14581         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14582         every thousand variables.
14583         * testsuite/Makefile.in: Rebuild.
14584
14585         * object.cc (Xindex::initialize_symtab_xindex): New function.
14586         (Xindex::read_symtab_xindex): New function.
14587         (Xindex::sym_xindex_to_shndx): New function.
14588         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14589         available.
14590         (Sized_relobj::do_initialize_xindex): New function.
14591         (Sized_relobj::do_read_symbols): Adjust section links.
14592         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14593         parameter.  Change all callers.
14594         (Sized_relobj::include_section_group): Adjust section links and
14595         symbol section indexes.
14596         (Sized_relobj::do_layout): Adjust section links.
14597         (Sized_relobj::do_count_local_symbols): Adjust section links and
14598         symbol section indexes.
14599         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14600         ordinary and special symbols.
14601         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14602         dynsym_xindex parameters.  Change all callers.  Adjust section
14603         links.  Use SHN_XINDEX when needed.
14604         (Sized_relobj::get_symbol_location_info): Adjust section links.
14605         Don't get fooled by special symbols.
14606         * object.h (class Xindex): Define.
14607         (class Object): Add xindex_ parameter.  Declare virtual functoin
14608         do_initialize_xindex.
14609         (Object::adjust_sym_shndx): New function.
14610         (Object::set_xindex): New protected function.
14611         (class Symbol_value): Add is_ordinary_shndx_ field.
14612         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14613         (Symbol_value::value): Assert ordinary section.
14614         (Symbol_value::initialize_input_to_output_map): Likewise.
14615         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14616         Change all callers.
14617         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14618         all callers.
14619         (class Sized_relobj): Update declarations.
14620         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14621         parameter.  Change all callers.
14622         (Sized_relobj::adjust_shndx): New function.
14623         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14624         field.
14625         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14626         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14627         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14628         (Sized_dynobj::read_dynsym_section): Adjust section links.
14629         (Sized_dynobj::read_dynamic): Likewise.
14630         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14631         section links.
14632         (Sized_dynobj::do_initialize_xindex): New function.
14633         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14634         do_initialize_xindex.
14635         (Sized_dynobj::adjust_shndx): New function.
14636         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14637         dynsym_xindex_ fields.
14638         (Layout::finalize): Add a call to set_section_indexes before
14639         creating the symtab sections.
14640         (Layout::set_section_indexes): Don't do anything if the section
14641         already has a section index.
14642         (Layout::create_symtab_sections): Add shnum parameter.  Change
14643         caller.  Create .symtab_shndx section if needed.
14644         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14645         caller.
14646         (Layout::allocated_output_section_count): New function.
14647         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14648         needed.
14649         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14650         fields.  Update declarations.
14651         (Layout::symtab_xindex): New function.
14652         (Layout::dynsym_xindex): New function.
14653         (class Write_symbols_task): Add layout_ field.
14654         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14655         Change caller.
14656         * output.cc (Output_section_headers::Output_section_headers): Add
14657         shstrtab_section parameter.  Change all callers.
14658         (Output_section_headers::do_sized_write): Store overflow values
14659         for section count and section string table section index in
14660         section header zero.
14661         (Output_file_header::do_sized_write): Check for overflow of
14662         section count and section string table section index.
14663         (Output_symtab_xindex::do_write): New function.
14664         (Output_symtab_xindex::endian_do_write): New function.
14665         * output.h (class Output_section_headers): Add shstrtab_section_.
14666         Update declarations.
14667         (class Output_symtab_xindex): Define.
14668         (Output_section::has_out_shndx): New function.
14669         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14670         field.
14671         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14672         Change all callers.
14673         (Sized_symbol::init): Likewise.
14674         (Symbol::output_section): Check for ordinary symbol.
14675         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14676         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14677         callers.
14678         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14679         Change all callers.  Simplify handling of symbols from sections
14680         not included in the link.
14681         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14682         distinction.
14683         (Weak_alias_sorter::operator()): Assert that symbols are
14684         ordinary.
14685         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14686         distinction.
14687         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14688         parameters.  Change all callers.
14689         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14690         symbol distinction.  Use SHN_XINDEX when needed.
14691         (Symbol_table::write_section_symbol): Add symtab_xindex
14692         parameter.  Change all callers.
14693         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14694         SHN_XINDEX when needed.
14695         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14696         declarations.
14697         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14698         (Symbol::is_defined): Check is_ordinary.
14699         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14700         (Symbol::is_absolute, Symbol::is_common): Likewise.
14701         (class Sized_symbol): Update declarations.
14702         (class Symbol_table): Update declarations.
14703         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14704         parameters.  Change all callers.
14705         (Sized_symbol::override): Likewise.
14706         (Symbol_table::override): Likewise.
14707         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14708         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14709         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14710         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14711         to be in an ordinary section.
14712         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14713         object and is_ordinary parameters.  Change all callers.
14714         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14715         Change all callers.  Don't add undefined or non-ordinary symbols
14716         to reloc_map_.
14717         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14718         Change all callers.
14719         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14720         declarations.
14721         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14722         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14723         (Sized_relobj::relocate_sections): Likewise.
14724         * target-reloc.h (scan_relocs): Adjust section symbol index.
14725         (scan_relocatable_relocs): Likewise.
14726         * i386.cc (Scan::local): Check for ordinary symbols.
14727         * sparc.cc (Scan::local): Likewise.
14728         * x86_64.cc (Scan::local): Likewise.
14729         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14730         to symbol_section_and_value.
14731         * testsuite/many_sections_test.cc: New file.
14732         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14733         (check_PROGRAMS): Add many_sections_test.
14734         (many_sections_test_SOURCES): Define.
14735         (many_sections_test_DEPENDENCIES): Define.
14736         (many_sections_test_LDFLAGS): Define.
14737         (BUILT_SOURCES): Add many_sections_define.h.
14738         (many_sections_define.h): New target.
14739         (BUILT_SOURCES): Add many_sections_check.h.
14740         (many_sections_check.h): New target.
14741         (check_PROGRAMS): Add many_sections_r_test.
14742         (many_sections_r_test_SOURCES): Define.
14743         (many_sections_r_test_DEPENDENCIES): Define.
14744         (many_sections_r_test_LDFLAGS): Define.
14745         (many_sections_r_test_LDADD): Define.
14746         (many_sections_r_test.o): New target.
14747         * testsuite/Makefile.in: Rebuild.
14748
14749 2008-04-17  Cary Coutant  <ccoutant@google.com>
14750
14751         * errors.cc (Errors::info): New function.
14752         (gold_info): New function.
14753         * errors.h (Errors::info): New function.
14754         * gold.h (gold_info): New function.
14755         * object.cc (Input_objects::add_object): Print trace output.
14756         * options.cc (options::parse_set): New function.
14757         (General_options::parse_wrap): Deleted.
14758         (General_options::General_options): Deleted initializer.
14759         * options.h (options::String_set): New typedef.
14760         (options::parse_set): New function.
14761         (DEFINE_set): New macro.
14762         (General_options::wrap): Changed to use DEFINE_set. Changed
14763         callers of any_wrap_symbols and is_wrap_symbol.
14764         (General_options::trace, General_options::trace_symbol):
14765         New options.
14766         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14767         (General_options::wrap_symbols_): Deleted.
14768         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14769
14770 2008-04-17  David S. Miller  <davem@davemloft.net>
14771
14772         * options.cc (General_options::parse_V): New function.
14773         * options.h: Add entries for -V and -Qy.
14774
14775 2008-04-17  Ian Lance Taylor  <iant@google.com>
14776
14777         * common.cc (Symbol_table::allocate_commons): Remove options
14778         parameter.  Change caller.
14779         (Symbol_table::do_allocate_commons): Remove options parameter.
14780         Change caller.  Just call do_allocate_commons_list twice.
14781         (Symbol_table::do_allocate_commons_list): New function, broken out
14782         of do_allocate_commons.
14783         * common.h (class Allocate_commons_task): Remove options_ field.
14784         Update constructor.
14785         * symtab.cc (Symbol_table::Symbol_table): Initialize
14786         tls_commons_.
14787         (Symbol_table::add_from_object): Put TLS common symbols on
14788         tls_commons_ list.
14789         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14790         which are IN_OUTPUT_DATA.
14791         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14792         allocate_commons and do_allocate_commons declarations.  Declare
14793         do_allocate_commons_list.
14794         * gold.cc (queue_middle_tasks): Update creation of
14795         Allocate_commons_task to not pass options.
14796         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14797         (TLS_TEST_C_FLAGS): New variable.
14798         (tls_test_c_pic.o): New target.
14799         (tls_test_shared.so): Link in tls_test_c_pic.o.
14800         (tls_test_c_pic_ie.o): New target.
14801         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14802         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14803         (tls_test_c.o): New target.
14804         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14805         (tls_pic_test_LDADD): Likewise.
14806         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14807         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14808         (tls_test_c_gnu2.o): New target.
14809         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14810         tls_test_c_gnu2.o.
14811         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14812         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14813         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14814         * testsuite/tls_test.cc: Include "config.h".
14815         (t_last): Call t11_last.
14816         * testsuite/tls_test.h (t11, t11_last): Declare.
14817         * testsuite/tls_test_c.c: New file.
14818         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14819         * configure.ac: Check for OpenMP support.
14820         * configure, config.in, Makefile.in: Rebuild.
14821         * testsuite/Makefile.in: Rebuild.
14822
14823 2008-04-16  Cary Coutant  <ccoutant@google.com>
14824
14825         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14826         (Target_i386::tls_base_symbol_defined_): New field.
14827         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14828         (Target_i386::Scan::global): Likewise.
14829         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14830         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14831         (Target_x86_64::tls_base_symbol_defined_): New field.
14832         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14833         (Target_x86_64::Scan::global): Likewise.
14834
14835 2008-04-16  Cary Coutant  <ccoutant@google.com>
14836
14837         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14838         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14839         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14840         building shared libraries.
14841         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14842         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14843         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14844         * testsuite/Makefile.in: Rebuild.
14845         * testsuite/weak_undef.h: New file.
14846         * testsuite/weak_undef_file1.cc: Add extra test cases.
14847         * testsuite/weak_undef_file2.cc: Likewise.
14848         * testsuite/weak_undef_test.cc: Likewise.
14849
14850 2008-04-16  David S. Miller  <davem@davemloft.net>
14851
14852         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14853         Add issued_non_pic_error_ field.  Declare check_non_pic.
14854         (Target_sparc::Scan::check_non_pic): New function.
14855         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14856         (Target_sparc::Scan::global): Likewise.
14857
14858         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14859         * configure: Rebuild.
14860
14861         * options.h (DEFINE_enable): New macro.
14862         (new_dtags): New enable option.
14863         (initfirst, interpose, loadfltr, nodefaultlib,
14864         nodelete, nodlopen, nodump): New -z options.
14865         * layout.cc (Layout:finish_dynamic_section): If new
14866         dtags enabled, emit DT_RUNPATH.  Also, emit a
14867         DT_FLAGS_1 containing any specified -z flags.
14868
14869 2008-04-16  Ian Lance Taylor  <iant@google.com>
14870
14871         * copy-relocs.cc: New file.
14872         * copy-relocs.h: New file.
14873         * reloc.cc: Remove Copy_relocs code.
14874         * reloc.h: Likewise.
14875         * reloc-types.h (struct Reloc_types) [both versions]: Add
14876         get_reloc_addend_noerror.
14877         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14878         variants of add_global which take an addend which must be zero.
14879         * i386.cc: Include "copy-relocs.h".
14880         (class Target_i386): Change type of copy_relocs_ to variable,
14881         update initializer.
14882         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14883         Change all callers.
14884         (Target_i386::do_finalize_sections): Change handling of
14885         copy_relocs_.
14886         * sparc.cc: Include "copy-relocs.h".
14887         (class Target_sparc): Change type of copy_relocs_ to variable,
14888         update initializer.
14889         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14890         Change all callers.
14891         (Target_sparc::do_finalize_sections): Change handling of
14892         copy_relocs_.
14893         * x86_64.cc: Include "copy-relocs.h".
14894         (class Target_x86_64): Change type of copy_relocs_ to variable,
14895         update initializer.
14896         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14897         class.  Change all callers.
14898         (Target_x86_64::do_finalize_sections): Change handling of
14899         copy_relocs_.
14900         * Makefile.am (CCFILES): Add copy-relocs.cc.
14901         (HFILES): Add copy-relocs.h.
14902
14903         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14904
14905         * testsuite/script_test_4.sh: Permit leading zeroes.
14906
14907 2008-04-15  Ian Lance Taylor  <iant@google.com>
14908
14909         * script-sections.cc (Script_sections::create_segments): Use
14910         header_size_adjustment even when there is enough room for the
14911         headers.
14912         * testsuite/script_test_4.sh: New file.
14913         * testsuite/script_test_4.t: New file.
14914         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14915         (check_DATA): Add script_test_4.stdout.
14916         (MOSTLYCLEANFILES): Likewise.
14917         (script_test_4): New target.
14918         (script_test_4.stdout): New target.
14919         * testsuite/Makefile.in: Rebuild.
14920
14921         * sparc.cc: Add definitions for Output_data_plt_sparc class
14922         constants.
14923
14924 2008-04-14  David S. Miller  <davem@davemloft.net>
14925
14926         * sparc.cc: New file.
14927         * Makefile.am (TARGETSOURCES): Add sparc.cc
14928         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14929         * configure.tgt: Document targ_extra_size and
14930         targ_extra_big_endian.  Add entries for sparc-* and
14931         sparc64-*.
14932         * configure.ac: Handle targ_extra_size and
14933         targ_extra_big_endian.
14934         * Makefile.in: Rebuild.
14935         * configure: Likewise.
14936         * po/POTFILES.in: Likewise.
14937         * po/gold.pot: Likewise.
14938
14939 2008-04-14  Ian Lance Taylor  <iant@google.com>
14940
14941         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14942         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14943         in the name/type/flags to section mapping.  Don't call
14944         allocate_output_section.
14945         (Layout::choose_output_section): Change parameter from adjust_name
14946         to is_input_section.  Don't permit input sections after sections
14947         are attached to segments.  Don't call allocate_output_section.
14948         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14949         not write_enable_output_section.
14950         (Layout::make_output_section): Don't push to
14951         unattached_section_list_ nor call attach_to_segment.  Call
14952         attach_section_to_segment if sections are attached.
14953         (Layout::attach_sections_to_segments): New function.
14954         (Layout::attach_section_to_segment): New function.
14955         (Layout::attach_allocated_section_to_segment): Rename from
14956         attach_to_segment.  Remove flags parameter.
14957         (Layout::allocate_output_section): Remove function.
14958         (Layout::write_enable_output_section): Remove function.
14959         * layout.h (class Layout): Update for above changes.  Add new
14960         field sections_are_attached_.
14961         * output.h (Output_section::update_flags_for_input_section): New
14962         function.
14963         * output.cc (Output_section::add_input_section): Call
14964         update_flags_for_input_section.
14965         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14966
14967 2008-04-11  Cary Coutant  <ccoutant@google.com>
14968
14969         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14970         thought unnecessary.
14971         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14972
14973 2008-04-11  Ian Lance Taylor  <iant@google.com>
14974
14975         * output.h (class Output_section_data): Remove inline definition
14976         of set_addralign.
14977         * output.cc (Output_section_data::set_addralign): New function.
14978
14979 2008-04-11  Cary Coutant  <ccoutant@google.com>
14980
14981         Add support for TLS descriptors for i386 and x86_64.
14982         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14983         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14984         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14985         GOT_TYPE_TLS_DESC.
14986         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14987         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14988         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14989         relocations.
14990         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14991         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14992         Fix problem with initial-exec relocations.
14993         (Target_i386::Relocate::relocate_tls): Likewise.
14994         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14995         relaxation.
14996         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14997         support for section-plus-offset dynamic table entries.
14998         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14999         (Output_data_dynamic::Dynamic_entry): Add support for
15000         section-plus-offset dynamic table entries.
15001         (Output_data_dynamic::Classification): Likewise.
15002         (Output_data_dynamic::classification_): Renamed offset_.
15003         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15004         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15005         (Target_x86_64::make_plt_section): New function.
15006         (Target_x86_64::reserve_tlsdesc_entries): New function.
15007         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15008         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15009         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15010         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15011         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15012         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15013         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15014         add extra PLT entry for TLS descriptors.
15015         (Output_data_plt_x86_64::got_): New field.
15016         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15017         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15018         fields.
15019         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15020         descriptors.
15021         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15022         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15023         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15024         R_386_TLS_DESC_CALL relocations.
15025         (Target_x86_64::Scan::global): Likewise.
15026         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15027         for TLS descriptors.
15028         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15029         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15030         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15031         GD-to-IE relaxation.
15032         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15033         and TLS_DESCRIPTORS.
15034         * Makefile.in: Rebuild.
15035         * configure: Rebuild.
15036         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15037         (tls_test_shared2.so): New target.
15038         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15039         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15040         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15041         (tls_shared_gd_to_ie_test_LDADD): New variable.
15042         (tls_shared_gnu2_gd_to_ie_test): New target.
15043         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15044         New targets.
15045         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15046         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15047         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15048         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15049         (tls_shared_gnu2_test): New target.
15050         (tls_test_gnu2_shared.so): New target.
15051         (tls_shared_gnu2_test_SOURCES): New variable.
15052         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15053         (tls_shared_gnu2_test_LDFLAGS): New variable.
15054         (tls_shared_gnu2_test_LDADD): New variable.
15055         * testsuite/Makefile.in: Rebuild.
15056         * testsuite/Makefile.
15057
15058 2008-04-11  Ian Lance Taylor  <iant@google.com>
15059
15060         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15061         justsyms.t.
15062         * testsuite/Makefile.in: Rebuild.
15063
15064         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15065         long.
15066         * testsuite/script_test_2.cc (main): Adjust test.
15067
15068 2008-04-11  David S. Miller  <davem@davemloft.net>
15069             Ian Lance Taylor  <iant@google.com>
15070
15071         * options.h (General_options): Add entries for '-Y' and
15072         '-relax'.
15073         * options.cc (General_options:finalize): If -Y was used, add those
15074         entries to the library path instead of the default "/lib" and
15075         "/usr/lib".
15076
15077 2008-04-11  David S. Miller  <davem@davemloft.net>
15078
15079         * testsuite/justsyms.t: Start at 0x100.
15080         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15081         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15082         long.
15083         * testsuite/script_test_2.cc: Adjust string and section length
15084         checks.
15085
15086 2008-04-09  Ian Lance Taylor  <iant@google.com>
15087
15088         PR gold/5996
15089         * script-sections.cc (Sections_element::allocate_to_segment): Add
15090         orphan parameter.
15091         (Output_section_definition::allocate_to_segment): Likewise.
15092         (Orphan_output_section::allocate_to_segment): Likewise.
15093         (Script_sections::attach_sections_using_phdrs_clause): Don't
15094         propagate non-PT_LOAD segments to orphan sections.
15095         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15096         readelf rather than objdump.
15097         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15098         .interp section and PT_INTERP segment are the same size.
15099         * testsuite/Makefile.in: Rebuild.
15100
15101         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15102         aliases for symbols defined in the same object.
15103         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15104         (weak_alias_test_SOURCES): New variable.
15105         (weak_alias_test_DEPENDENCIES): New variable.
15106         (weak_alias_test_LDFLAGS): New variable.
15107         (weak_alias_test_LDADD): New variable.
15108         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15109         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15110         (weak_alias_test_3.o): New target.
15111         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15112         * testsuite/weak_alias_test_main.cc: New file.
15113         * testsuite/weak_alias_test_1.cc: New file.
15114         * testsuite/weak_alias_test_2.cc: New file.
15115         * testsuite/weak_alias_test_3.cc: New file.
15116
15117 2008-04-08  Ian Lance Taylor  <iant@google.com>
15118
15119         * options.h (class General_options): Add --noinhibit-exec option.
15120         * main.cc (main): Check --noinhibit-exec.
15121
15122         * options.h (class General_options): Define --wrap as a special
15123         option.  Add wrap_symbols_ field.
15124         (General_options::any_wrap_symbols): New function.
15125         (General_options::is_wrap_symbol): New function.
15126         * options.cc (General_options::parse_wrap): New function.
15127         (General_options::General_options): Initialize wrap_symbols_.
15128         * symtab.cc (Symbol_table::wrap_symbol): New function.
15129         (Symbol_table::add_from_object): Handle --wrap.
15130         * symtab.h (class Symbol_table): Declare wrap_symbol.
15131         * target.h (Target::wrap_char): New function.
15132         (Target::Target_info): Add wrap_char field.
15133         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15134         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15135         * testsuite/testfile.cc (Target_test::test_target_info):
15136         Likewise.
15137
15138         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15139         there is one.
15140
15141         * layout.h (class Layout): Add added_eh_frame_data_ field.
15142         * layout.cc (Layout::Layout): Initialize new field.
15143         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15144         output section until we find a section we merged successfully.
15145         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15146         that the size be non-zero.
15147
15148         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15149         qualifier.
15150
15151 2008-04-08  Craig Silverstein  <csilvers@google.com>
15152
15153         * configure.ac: Export new conditional variable HAVE_ZLIB.
15154         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15155         on HAVE_ZLIB.
15156         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15157         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15158
15159 2008-04-07  Ian Lance Taylor  <iant@google.com>
15160
15161         * version.cc (version_string): Set to "1.5".
15162
15163         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15164         Add issued_non_pic_error_ field.  Declare check_non_pic.
15165         (Target_x86_64::Scan::check_non_pic): New function.
15166         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15167         (Target_x86_64::Scan::global): Likewise.
15168
15169         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15170         addend parameter.  Change caller.  Handle merge sections.
15171         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15172         Address to Addend.  Don't add in the result of
15173         local_section_offset, pass down the addend and use the returned
15174         value.
15175         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15176         Update declarations of local_section_offset and symbol_value.
15177         * testsuite/two_file_test_1.cc (t18): New function.
15178         * testsuite/two_file_test_2.cc (f18): New function.
15179         * testsuite/two_file_test_main.cc (main): Call t18.
15180         * testsuite/two_file_test.h (t18, f18): Declare.
15181
15182         * configure.ac: Don't test for objdump, c++filt, or readelf.
15183         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15184         conditionals.
15185         (TEST_READELF): New variable.
15186         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15187         (check_PROGRAMS): Add two_file_strip_test.
15188         (two_file_strip_test): New target.
15189         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15190         (two_file_same_shared_strip_test_SOURCES): New variable.
15191         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15192         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15193         (two_file_same_shared_strip_test_LDADD): New variable.
15194         (two_file_shared_strip.so): New target.
15195         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15196         (ver_test_5.syms, ver_test_7.syms): Likewise.
15197         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15198         (strip_test_3.stdout): Use TEST_OBJDUMP.
15199         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15200
15201 2008-04-04  Cary Coutant  <ccoutant@google.com>
15202
15203         * symtab.h (Symbol::is_weak_undefined): New function.
15204         (Symbol::is_strong_undefined): New function.
15205         (Symbol::is_absolute): New function.
15206         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15207         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15208         absolute symbols.
15209         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15210         (weak_undef_test): New target.
15211         * testsuite/Makefile.in: Rebuild.
15212         * testsuite/weak_undef_file1.cc: New file.
15213         * testsuite/weak_undef_file2.cc: New file.
15214         * testsuite/weak_undef_test.cc: New file.
15215
15216 2008-04-03  Craig Silverstein  <csilvers@google.com>
15217
15218         * compressed_output.h (class Output_compressed_section): Use
15219         unsigned buffer.
15220         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15221         add zlib header.
15222         (zlib_compressed_suffix): Removed.
15223         (Output_compressed_section::set_final_data_size): Use unsigned
15224         buffers.
15225         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15226         Fix linker invocation.
15227         (flagstest_o_specialfile_and_compress_debug_sections):
15228         Likewise.
15229         * testsuite/Makefile.in: Regenerated.
15230
15231 2008-04-02  David S. Miller  <davem@davemloft.net>
15232
15233         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15234         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15235
15236 2008-04-02  Craig Silverstein  <csilvers@google.com>
15237
15238         * TODO: New file.
15239
15240 2008-04-02  Ian Lance Taylor  <iant@google.com>
15241
15242         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15243         parameters.  Update for new key type to views_.  Change all
15244         callers.
15245         (File_read::read): Adjust for byteshift in returned view.
15246         (File_read::add_view): New function, broken out of
15247         find_and_make_view.
15248         (File_read::make_view): New function, broken out of
15249         find_and_make_view.
15250         (File_read::find_or_make_view): Add offset and aligned
15251         parameters.  Rewrite accordingly.  Change all callers.
15252         (File_read::get_view): Add offset and aligned parameters.  Adjust
15253         for byteshift in return value.
15254         (File_read::get_lasting_view): Likewise.
15255         * fileread.h (class File_read): Update declarations.
15256         (class File_read::View): Add byteshift_ field.  Add byteshift to
15257         constructor.  Add byteshift method.
15258         * archive.h (Archive::clear_uncached_views): New function.
15259         (Archive::get_view): Add aligned parameter.  Change all callers.
15260         * object.h (Object::get_view): Add aligned parameter.  Change all
15261         callers.
15262         (Object::get_lasting_view): Likewise.
15263
15264         * fileread.cc (File_read::release): Don't call clear_views if
15265         there are multiple objects.
15266         * fileread.h (File_read::clear_uncached_views): New function.
15267         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15268         on the archive.
15269
15270 2008-03-31  Cary Coutant  <ccoutant@google.com>
15271
15272         Add thin archive support.
15273         * archive.cc (Archive::armagt): New const.
15274         (Archive::setup): Remove task parameter and calls to unlock.
15275         (Archive::unlock_nested_archives): New function.
15276         (Archive::read_header): Add nested_off parameter. Change
15277         all callers.
15278         (Archive::interpret_header): Likewise.
15279         (Archive::include_all_members): Change to handle thin
15280         archives.
15281         (Archive::include_member): Likewise.
15282         * archive.h (Archive::Archive): Add new parameters and
15283         initializers.
15284         (Archive::armagt): New const.
15285         (Archive::setup): Remove task parameter.
15286         (Archive::unlock_nested_archives): New function.
15287         (Archive::read_header): Add nested_off parameter.
15288         (Archive::interpret_header): Likewise.
15289         (Archive::Nested_archive_table): New typedef.
15290         (Archive::is_thin_archive_): New field.
15291         (Archive::nested_archives_): New field.
15292         (Archive::options_): New field.
15293         (Archive::dirpath_): New field.
15294         (Archive::task_): New field.
15295         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15296         for thin archives.  Pass additional parameters to
15297         Archive::Archive.  Unlock the archive file after calling
15298         Archive::setup.
15299
15300 2008-03-29  Ian Lance Taylor  <iant@google.com>
15301
15302         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15303         version symbol to be local.
15304         * testsuite/ver_test_4.sh: New file.
15305         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15306         (check_DATA): Add ver_test_4.syms.
15307         (ver_test_4.syms): New target.
15308         * testsuite/Makefile.in: Rebuild.
15309
15310         * output.cc
15311         (Output_section::Input_section_sort_entry::has_priority): New
15312         function.
15313         (Output_section::Input_section_sort_entry::match_file_name): New
15314         function.
15315         (Output_section::Input_section_sort_entry::match_section_name):
15316         Remove.
15317         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15318         Remove.
15319         (Output_section::Input_section_sort_entry::match_section_file):
15320         Remove.
15321         (Output_section::Input_section_sort_compare::operator()): Rewrite
15322         using new Input_section_sort_entry functions.  Sort crtbegin and
15323         crtend first.  Sort sections with no priority before sections with
15324         a priority.
15325         * testsuite/initpri1.c (d3): Check j != 4.
15326         (cd5): New constructor/destructor function.
15327         (main): Check j != 2.
15328
15329         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15330         new symbol when resolving, don't call set_is_default.
15331         * testsuite/ver_test_7.cc: New file.
15332         * testsuite/ver_test_7.sh: New file.
15333         * testsuite/Makefile.am (ver_test_7.so): New target.
15334         (ver_test_7.o): New target.
15335         (check_SCRIPTS): Add ver_test_7.sh.
15336         (check_DATA): Add ver_test_7.syms.
15337         (ver_test_7.syms): New target.
15338
15339 2008-03-28  Ian Lance Taylor  <iant@google.com>
15340
15341         * layout.cc (Layout::layout): If we see an input section with a
15342         name that needs sorting, set the must_sort flag for the output
15343         section.
15344         (Layout::make_output_section): If the name of the output section
15345         indicates that it might require sorting, set the may_sort flag.
15346         * output.h (Output_section::may_sort_attached_input_sections): New
15347         function.
15348         (Output_section::set_may_sort_attached_input_sections): New
15349         function.
15350         (Output_section::must_sort_attached_input_sections): New
15351         function.
15352         (Output_section::set_must_sort_attached_input_sections): New
15353         function.
15354         (class Output_section): Declare Input_section_sort_entry.  Define
15355         Input_section_sort_compare.  Declare
15356         sort_attached_input_sections.  Add new fields:
15357         may_sort_attached_input_sections_,
15358         must_sort_attached_input_sections_,
15359         attached_input_sections_are_sorted_.
15360         * output.cc (Output_section::Output_section): Initialize new
15361         fields.
15362         (Output_section::add_input_section): Add an entry to
15363         input_sections_ if may_sort or must_sort are true.
15364         (Output_section::set_final_data_size): Call
15365         sort_attached_input_sections if necessary.
15366         (Output_section::Input_section_sort_entry): Define new class.
15367         (Output_section::Input_section_sort_compare::operator()): New
15368         function.
15369         (Output_section::sort_attached_input_sections): New function.
15370         * configure.ac: Check whether the compiler supports constructor
15371         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15372         * testsuite/initpri1.c: New file.
15373         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15374         CONSTRUCTOR_PRIORITY.
15375         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15376         (initpri1_LDFLAGS): New variable.
15377         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15378
15379 2008-03-27  Ian Lance Taylor  <iant@google.com>
15380
15381         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15382         * testsuite/common_test_1.c: New file.
15383         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15384         (common_test_1_SOURCES): New variable.
15385         (common_test_1_DEPENDENCIES): New variable.
15386         (common_test_1_LDFLAGS): New variable.
15387
15388         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15389         and commons_ correctly when NAME/VERSION does not override
15390         NAME/NULL.
15391         * testsuite/ver_test_6.c: New file.
15392         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15393         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15394         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15395
15396 2008-03-26  Ian Lance Taylor  <iant@google.com>
15397
15398         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15399         of an undefined symbol from a version script.
15400         * testsuite/Makefile.am (ver_test_5.so): New target.
15401         (ver_test_5.o): New target.
15402         (check_SCRIPTS): Add ver_test_5.sh.
15403         (check_DATA): Add ver_test_5.syms.
15404         (ver_test_5.syms): New target.
15405         * testsuite/ver_test_5.cc: New file.
15406         * testsuite/ver_test_5.script: New file.
15407         * testsuite/ver_test_5.sh: New file.
15408         * Makefile.in, testsuite/Makefile.in: Rebuild.
15409
15410         PR gold/5986
15411         Fix problems building gold with gcc 4.3.0.
15412         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15413         (gold_error_at_location, gold_warning_at_location): Use it.
15414         * configure.ac: Check whether we can compile and use a template
15415         function with a printf attribute.
15416         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15417         when jumping over bytes.
15418         * object.cc: Instantiate Object::read_section_data.
15419         * debug.h: Include <cstring>
15420         * dwarf_reader.cc: Include <algorithm>
15421         * main.cc: Include <cstring>.
15422         * options.cc: Include <cstring>.
15423         * output.cc: Include <cstring>.
15424         * script.cc: Include <cstring>.
15425         * script.h: Include <string>.
15426         * symtab.cc: Include <cstring> and <algorithm>.
15427         * target-select.cc: Include <cstring>.
15428         * version.cc: Include <string>.
15429         * testsuite/testmain.cc: Include <cstdlib>.
15430         * configure, config.in: Rebuild.
15431
15432 2008-03-25  Ian Lance Taylor  <iant@google.com>
15433
15434         * options.cc: Include "../bfd/bfdver.h".
15435         (options::help): Print bug reporting address.
15436
15437         * version.cc (print_version): Adjust output for current value of
15438         BFD_VERSION_STRING.
15439
15440         * NEWS: New file.
15441
15442         * options.cc (options::help): Print list of supported targets.
15443         * target-select.h: Include <vector>.
15444         (class Target_selector): Make machine_, size_, and is_big_endian_
15445         fields const.  Add bfd_name_ and instantiated_target_ fields.
15446         (Target_selector::Target_selector): Add bfd_name parameter.
15447         (Target_selector::recognize): Make non-virtual, call
15448         do_recognize.
15449         (Target_selector::recognize_by_name): Make non-virtual, call
15450         do_recognize_by_name.
15451         (Target_selector::supported_names): New function.
15452         (Target_selector::bfd_name): New function.
15453         (Target_selector::do_instantiate_target): New pure virtual
15454         function.
15455         (Target_selector::do_recognize): New virtual function.
15456         (Target_selector::do_recognize_by_name): New virtual function.
15457         (Target_selector::instantiate_target): New private function.
15458         (supported_target_names): Declare.
15459         * target-select.cc (Target_selector::Target_selector): Update for
15460         new parameter and fields.
15461         (select_target_by_name): Check that the name matches before
15462         calling recognize_by_name.
15463         (supported_target_names): New function.
15464         * i386.cc (class Target_selector_i386): Update Target_selector
15465         constructor call.  Remove recognize and recognize_by_name.  Add
15466         do_instantiate_target.
15467         * x86_64.cc (class Target_selector_x86_64): Likewise.
15468         * testsuite/testfile.cc (class Target_selector_test): Update for
15469         changes to Target_selector.
15470
15471         * README: Rewrite, with some notes on unsupported features.
15472
15473 2008-03-24  Cary Coutant  <ccoutant@google.com>
15474
15475         * i386.cc (Target_i386::Got_type): New enum declaration.
15476         (Target_i386::Scan::local): Updated callers of Output_data_got
15477         member functions.
15478         (Target_i386::Scan::global): Likewise.
15479         (Target_i386::Relocate::relocate): Likewise.
15480         (Target_i386::Relocate::relocate_tls): Likewise.
15481         * object.h (Got_offset_list): New class.
15482         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15483         (Sized_relobj::local_got_offset): Likewise.
15484         (Sized_relobj::set_local_got_offset): Likewise.
15485         (Sized_relobj::local_has_tls_got_offset): Removed.
15486         (Sized_relobj::local_tls_got_offset): Removed.
15487         (Sized_relobj::set_local_tls_got_offset): Removed.
15488         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15489         * output.cc (Output_data_got::add_global): Added got_type parameter.
15490         (Output_data_got::add_global_with_rel): Likewise.
15491         (Output_data_got::add_global_with_rela): Likewise.
15492         (Output_data_got::add_global_pair_with_rel): New function.
15493         (Output_data_got::add_global_pair_with_rela): New function.
15494         (Output_data_got::add_local): Added got_type parameter.
15495         (Output_data_got::add_local_with_rel): Likewise.
15496         (Output_data_got::add_local_with_rela): Likewise.
15497         (Output_data_got::add_local_pair_with_rel): New function.
15498         (Output_data_got::add_local_pair_with_rela): New function.
15499         (Output_data_got::add_global_tls): Removed.
15500         (Output_data_got::add_global_tls_with_rel): Removed.
15501         (Output_data_got::add_global_tls_with_rela): Removed.
15502         (Output_data_got::add_local_tls): Removed.
15503         (Output_data_got::add_local_tls_with_rel): Removed.
15504         (Output_data_got::add_local_tls_with_rela): Removed.
15505         * output.h (Output_data_got::add_global): Added got_type parameter.
15506         (Output_data_got::add_global_with_rel): Likewise.
15507         (Output_data_got::add_global_with_rela): Likewise.
15508         (Output_data_got::add_global_pair_with_rel): New function.
15509         (Output_data_got::add_global_pair_with_rela): New function.
15510         (Output_data_got::add_local): Added got_type parameter.
15511         (Output_data_got::add_local_with_rel): Likewise.
15512         (Output_data_got::add_local_with_rela): Likewise.
15513         (Output_data_got::add_local_pair_with_rel): New function.
15514         (Output_data_got::add_local_pair_with_rela): New function.
15515         (Output_data_got::add_global_tls): Removed.
15516         (Output_data_got::add_global_tls_with_rel): Removed.
15517         (Output_data_got::add_global_tls_with_rela): Removed.
15518         (Output_data_got::add_local_tls): Removed.
15519         (Output_data_got::add_local_tls_with_rel): Removed.
15520         (Output_data_got::add_local_tls_with_rela): Removed.
15521         * resolve.cc (Symbol::override_base_with_special): Removed
15522         reference to has_got_offset_ field.
15523         * symtab.cc (Symbol::init_fields): Replaced initialization
15524         of got_offset_ with got_offsets_.  Removed initialization
15525         of has_got_offset_
15526         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15527         (Symbol::got_offset): Likewise.
15528         (Symbol::set_got_offset): Likewise.
15529         (Symbol::has_tls_got_offset): Removed.
15530         (Symbol::tls_got_offset): Removed.
15531         (Symbol::set_tls_got_offset): Removed.
15532         (Symbol::got_offset_): Removed.
15533         (Symbol::tls_mod_got_offset_): Removed.
15534         (Symbol::tls_pair_got_offset_): Removed.
15535         (Symbol::got_offsets_): New field.
15536         (Symbol::has_got_offset): Removed.
15537         (Symbol::has_tls_mod_got_offset): Removed.
15538         (Symbol::has_tls_pair_got_offset): Removed.
15539         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15540         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15541         member functions.
15542         (Target_x86_64::Scan::global): Likewise.
15543         (Target_x86_64::Relocate::relocate): Likewise.
15544         (Target_x86_64::Relocate::relocate_tls): Likewise.
15545
15546 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15547
15548         * yyscript.y: Fix spelling error in comment.
15549
15550 2008-03-24  Ian Lance Taylor  <iant@google.com>
15551
15552         * options.h (class General_options): Define build_id option.
15553         * layout.h (class Layout): Declare write_build_id, create_note,
15554         create_build_id.  Add build_id_note_ member.
15555         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15556         "libiberty.h", "md5.h", "sha1.h".
15557         (Layout::Layout): Initialize eh_frame_data_,
15558         eh_frame_hdr_section_, and build_id_note_.
15559         (Layout::finalize): Call create_build_id.
15560         (Layout::create_note): New function, broken out of
15561         Layout::create_gold_note.
15562         (Layout::create_gold_note): Call create_note.
15563         (Layout::create_build_id): New function.
15564         (Layout::write_build_id): New function.
15565         (Close_task_runner::run): Call write_build_id.
15566
15567         * x86_64.cc: Correct license to GPLv3.
15568
15569 2008-03-23  Ian Lance Taylor  <iant@google.com>
15570
15571         * options.cc: Include "demangle.h".
15572         (parse_optional_string): New function.
15573         (parse_long_option): Handle takes_optional_argument.
15574         (parse_short_option): Update dash_z initializer.  Handle
15575         takes_optional_argument.
15576         (General_options::General_options): Initialize do_demangle_.
15577         (General_options::finalize): Set do_demangle_.  Handle demangling
15578         style.
15579         * options.h (parse_optional_string): Declare.
15580         (struct One_option): Add optional_arg field.  Update constructor.
15581         Update call constructor calls.  Add takes_optional_argument
15582         function.
15583         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15584         (DEFINE_optional_string): Define.
15585         (General_options::demangle): Change from DEFINE_bool to
15586         DEFINE_optional_string.
15587         (General_options::no_demangle): New function.
15588         (General_options::do_demangle): New function.
15589         (General_options::set_do_demangle): New function.
15590         (General_options::execstack_status_): Move definition to end of
15591         class definition.
15592         (General_options::static_): Likewise.
15593         (General_options::do_demangle_): New field.
15594         * object.cc (big_endian>::get_symbol_location_info): Call
15595         Options::do_demangle, not Options::demangle.
15596         * symtab.cc (demangle): Likewise.
15597
15598 2008-03-22  Ian Lance Taylor  <iant@google.com>
15599
15600         * gold.h: Include <cstddef> and <sys/types.h>
15601         * options.h: Include <cstring>.
15602
15603 2008-03-21  Ian Lance Taylor  <iant@google.com>
15604
15605         * Added source code to GNU binutils.
15606 \f
15607 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15608
15609 Copying and distribution of this file, with or without modification,
15610 are permitted in any medium without royalty provided the copyright
15611 notice and this notice are preserved.
15612
15613 Local Variables:
15614 mode: change-log
15615 left-margin: 8
15616 fill-column: 74
15617 version-control: never
15618 End: