1 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
4 * Makefile.am (TARGETSOURCES): Add mips.cc
5 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
6 * configure.tgt: Add entries for mips*.
7 * configure.ac: Likewise.
8 * Makefile.in: Regenerate.
11 2014-06-09 Cary Coutant <ccoutant@google.com>
13 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
14 unit_length is within section bounds.
16 2014-06-09 Cary Coutant <ccoutant@google.com>
19 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
22 2014-06-07 Alan Modra <amodra@gmail.com>
24 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
26 2014-06-06 Cary Coutant <ccoutant@google.com>
28 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
29 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
30 (Dwarf_pubnames_table::read_header): Likewise.
31 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
34 2014-06-05 Joel Brobecker <brobecker@adacore.com>
36 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
37 * Makefile.in, configure: Regenerate.
39 2014-06-03 Alan Modra <amodra@gmail.com>
41 * powerpc.cc (addis_12_2): Define.
42 (Stub_table::do_write): Support fusion on ELFv2 stubs.
44 2014-06-03 Alan Modra <amodra@gmail.com>
46 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
49 2014-06-02 Alan Modra <amodra@gmail.com>
51 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
52 Only ignore relocs on ELFv1.
53 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
55 2014-05-30 Cary Coutant <ccoutant@google.com>
57 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
58 * testsuite/Makefile.in: Regenerate.
59 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
61 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
64 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
65 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
67 2014-05-15 Alan Modra <amodra@gmail.com>
69 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
70 Compare FDE contents with DW_CFA_nop rather than 0.
72 2014-05-13 Sriraman Tallam <tmsriram@google.com>
74 * symtab.h (may_need_copy_reloc): Remove check for position independent
76 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
77 position independence before pc absolute may_need_copy_reloc call.
78 Add check for executable output befor pc relative may_need_copy_reloc
84 * powerpc.cc: Add check for no position independence before
85 may_need_copy_reloc calls.
86 * testsuite/pie_copyrelocs_test.cc: New file.
87 * testsuite/pie_copyrelocs_shared_test.cc: New file.
88 * Makefile.am (pie_copyrelocs_test): New test.
89 * Makefile.in: Regenerate.
91 2014-05-08 Martin Liška <mliska@suse.cz>
93 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
95 2014-05-06 Cary Coutant <ccoutant@google.com>
98 * i386.cc (Output_data_got_plt_i386): New class.
99 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
100 parameter. Change all callers.
101 (Output_data_plt_i386::layout_): Remove.
102 (Output_data_plt_i386::got_plt_): Change type.
103 (Target_i386::got_plt_): Change type. Change all references.
104 (Target_i386::got_section): Create instance of new class.
105 (Output_data_got_plt_i386::do_write): New function.
106 * x86_64.cc (Output_data_got_plt_x86_64): New class.
107 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
108 parameter. Change all callers.
109 (Output_data_plt_x86_64::layout_): Remove.
110 (Output_data_plt_x86_64::got_plt_): Change type.
111 (Target_x86_64::got_plt_): Change type. Change all references.
112 (Target_x86_64::got_section): Create instance of new class.
113 (Output_data_got_plt_x86_64::do_write): New function.
114 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
115 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
118 2014-05-05 Cary Coutant <ccoutant@google.com>
120 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
121 if we have pubnames/pubtypes.
123 2014-05-02 Cary Coutant <ccoutant@google.com>
125 * defstd.cc (in_segment): Define __ehdr_start here...
126 * layout.cc (Layout::finalize): ...Instead of here. Set the
127 output segment when known.
128 * resolve.cc (Symbol::override_base_with_special): Remember
129 the original binding.
130 * symtab.cc (Symbol::set_output_segment): New function.
131 (Symbol::set_undefined): New function.
132 * symtab.h (Symbol::is_weak_undefined): Check original undef
134 (Symbol::is_strong_undefined): New function.
135 (Symbol::set_output_segment): New function.
136 (Symbol::set_undefined): New function.
137 * target-reloc.h (is_strong_undefined): Remove.
138 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
139 Check for hidden undefs.
140 (relocate_section): Call Symbol::is_strong_undefined.
142 * testsuite/Makefile.am (ehdr_start_test_1)
143 (ehdr_start_test_2, ehdr_start_test_3)
144 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
145 * testsuite/Makefile.in: Regenerate.
146 * testsuite/ehdr_start_def.cc: New source file.
147 * testsuite/ehdr_start_test.cc: New source file.
148 * testsuite/ehdr_start_test.t: New linker script.
149 * testsuite/ehdr_start_test_4.sh: New shell script.
151 2014-04-23 Cary Coutant <ccoutant@google.com>
154 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
156 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
158 * layout.cc (Layout::include_section): Allow a target to decide
159 whether to include a section.
160 * target.h (Target::should_include_section): New function.
161 (Target::do_should_include_section): New function.
163 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
165 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
167 (Copy_relocs::emit): ... here.
168 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
169 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
170 (Copy_reloc_entry::entries_): Change from private to protected.
172 2014-04-02 Sriraman Tallam <tmsriram@google.com>
174 * icf.cc (get_section_contents): Replace copies of reloc
175 vectors with const references.
177 2014-04-02 Cary Coutant <ccoutant@google.com>
179 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
180 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
181 * configure: Regenerate.
182 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
183 -fno-use-linker-plugin.
184 (LINK1, CXXLINK1): Add it to the link command.
185 * testsuite/Makefile.in: Regenerate.
187 2014-03-12 Alan Modra <amodra@gmail.com>
189 * Makefile.in: Regenerate.
191 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
193 * symtab.h (Symbol::set_nonvis): New function.
195 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
197 * symtab.cc (Sized_symbol<32>::init_output_data):
198 Instantiate the template.
199 (Sized_symbol<64>::init_output_data): Likewise.
201 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
203 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
204 adjust dynamic symbol value.
205 * target.h (Target::adjust_dyn_symbol): New function.
206 (Target::do_adjust_dyn_symbol): New function.
208 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
210 * output.cc (Output_data_dynamic::Dynamic_entry::write):
211 Get the value of DYNAMIC_CUSTOM dynamic entry.
212 * output.h (Output_data_dynamic::add_custom): New function.
213 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
215 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
216 * target.h (Target::dynamic_tag_custom_value): New function.
217 (Target::do_dynamic_tag_custom_value): New function.
219 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
221 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
223 * target.h (Target::has_custom_set_dynsym_indexes): New function.
224 (Target::do_has_custom_set_dynsym_indexes): New function.
225 (Target::set_dynsym_indexes): New function.
226 (Target::do_set_dynsym_indexes): New function.
228 2014-03-07 Alan Modra <amodra@gmail.com>
230 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
231 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
232 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
233 (Powerpc_relocate_functions::has_overflow_bitfield,
234 overflowed): Use the above.
235 (Target_powerpc::Relocate::relocate): Correct overflow checking
236 for a number of relocations. Modify overflow test for 16-bit
237 fields in instructions to signed/unsigned according to whether
238 the field takes a signed or unsigned value.
240 2014-03-05 Alan Modra <amodra@gmail.com>
242 Update copyright years.
244 2014-03-05 Alan Modra <amodra@gmail.com>
246 * powerpc.cc (Target_powerpc::Scan::local, global): Support
247 R_PPC64_ADDR64_LOCAL.
248 (Target_powerpc::Relocate::relocate): Likewise.
250 2014-03-03 Alan Modra <amodra@gmail.com>
252 * dwp.cc (print_version): Update copyright year to current.
254 2014-02-10 Alan Modra <amodra@gmail.com>
256 * po/gold.pot: Regenerate.
258 2014-02-06 Cary Coutant <ccoutant@google.com>
260 Fix problem where -u is ignored when a weak undef is seen.
262 * archive.cc (Library_base::should_include_member): Reorder
263 code to check for -u option if a weak undef has already been seen.
264 * testsuite/Makefile.am (weak_undef_test_2): New test case.
265 * testsuite/Makefile.in: Regenerate.
266 * testsuite/weak_undef_file3.cc: New file.
267 * testsuite/weak_undef_file4.cc: New file.
268 * testsuite/weak_undef_test_2.cc: New file.
270 2014-02-05 Cary Coutant <ccoutant@google.com>
272 Fix issues with gold undefined symbol diagnostics.
275 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
277 * target-reloc.h (is_strong_undefined): New function.
278 (relocate_section): Move undef vtable symbol check from here.
279 Check for is_strong_undefined.
281 2014-02-05 Cary Coutant <ccoutant@google.com>
283 Fix problems with the --dynamic-list option.
286 * options.cc (General_options::parse_dynamic_list):
287 Set have_dynamic_list_.
288 (General_options::General_options): Initialize have_dynamic_list_.
289 (General_options::finalize): Turn off -Bsymbolic and
290 -Bsymbolic-functions if --dynamic-list provided.
291 * options.h (General_options::have_dynamic_list): New function.
292 (General_options::have_dynamic_list_): New data member.
293 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
297 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
298 in --dynamic-list, mark it.
300 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
301 (dynamic_list_2): New test case.
302 * testsuite/Makefile.in: Regenerate.
303 * testsuite/dynamic_list_2.cc: New file.
304 * testsuite/dynamic_list_2.t: New file.
305 * testsuite/dynamic_list_lib1.cc: New file.
306 * testsuite/dynamic_list_lib2.cc: New file.
307 * testsuite/gc_dynamic_list_test.c: New file.
308 * testsuite/gc_dynamic_list_test.sh: New file.
309 * testsuite/gc_dynamic_list_test.t: New file.
311 2014-01-28 Cary Coutant <ccoutant@google.com>
313 Add .gdb_index version 7 support.
315 * gold/dwarf_reader.cc: include <utility> (for make_pair).
316 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
318 (Dwarf_ranges_table::read_ranges_table): Likewise.
319 (Dwarf_pubnames_table::read_section): Check for GNU-style
320 sections, and for compressed debug sections.
321 (Dwarf_pubnames_table::read_header): Compute end address of table.
322 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
323 for end of list by offset, not by offset == 0.
324 (Dwarf_info_reader::do_read_string_table): Check for compressed
326 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
327 Initialize new data members.
328 (Dwarf_pubnames_table::next_name): return flag_byte.
329 (Dwarf_pubnames_table::end_of_table_): New data member.
330 (Dwarf_pubnames_table::is_gnu_style_): New data member.
331 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
332 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
333 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
334 read skeleton type unit DIEs.
335 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
336 (Gdb_index::do_write): Write flag_byte.
337 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
338 (Gdb_index::Cu_vector): Store flags along with cu indexes.
339 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
340 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
342 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
344 * version.cc (print_version): Update copyright year to 2014.
346 2013-12-19 Dimitry Andric <dimitry@andric.com>
348 * stringpool.cc (Stringpool_template::reserve): Add
349 HAVE_UNORDERED_MAP case.
350 * stringpool.cc (Stringpool_template::print_stats): Likewise.
352 2013-12-18 Cary Coutant <ccoutant@google.com>
354 * configure.ac: Check for <unordered_set> and <unordered_map>.
355 * config.in: Regenerate.
356 * configure: Regenerate.
357 * system.h: Use <unordered_set> and <unordered_map> if available.
359 2013-12-10 Roland McGrath <mcgrathr@google.com>
361 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
362 with $(INSTALL_PROGRAM_ENV).
363 * Makefile.in: Regenerate.
365 2013-11-22 Cary Coutant <ccoutant@google.com>
367 * configure.ac: Add check for which library is needed for
369 * configure: Regenerate.
371 2013-11-22 Cary Coutant <ccoutant@google.com>
373 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
375 * testsuite/Makefile.in: Regenerate.
377 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
379 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
380 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
381 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
382 (Target_x86_64<size>::Scan::local): Likewise.
383 (Target_x86_64<size>::Scan::global): Likewise.
384 (Target_x86_64<size>::Relocate::relocate): Likewise.
385 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
387 (Target_x86_64<size>::Scan::check_non_pic(): Handle
390 * testsuite/Makefile.am (check_PROGRAMS): Add
391 exception_x86_64_bnd_test.
392 (exception_x86_64_bnd_test_SOURCES): New macro.
393 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
394 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
395 (exception_x86_64_bnd_test_LDADD): Likewise.
396 (exception_x86_64_bnd_1.o): New rule.
397 (exception_x86_64_bnd_2.o): Likewise.
398 * testsuite/Makefile.in: Regenerated.
400 2013-11-15 Alan Modra <amodra@gmail.com>
402 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
404 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
405 Only call ppc64_local_entry_offset for 64-bit. Restrict
406 symval_for_branch lookup to ELFv1.
407 (Stub_table::add_plt_call_entry): Use unsigned int off.
408 (Output_data_glink::Address, invalid_address): New.
409 (Output_data_glink::add_eh_frame): Move out of line. Add
411 (Output_data_glink::add_global_entry, find_global_entry,
412 global_entry_address): New functions.
413 (Output_data_glink::global_entry_stubs_, end_branch_table_,
414 ge_size): New variables.
415 (Output_data_glink::set_final_data_size): Add global entry
417 (Output_data_glink::do_write): Write global entry stubs.
418 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
419 parameter. Return true for ELFv2. Adjust callers.
420 (Target_powerpc::Scan::local, global): Restrict opd lookup to
421 ELFv1. Similarly for ifunc and dynamic relocation processing
422 specific to ELFv1. Recognize that symbols are defined on
423 their plt entries for ELFv2.
424 (Target_powerpc::symval_for_branch): Assert if called for
426 (Target_powerpc::Relocate::relocate): Use global entry plt
427 stub for symbol value if such exists on ELFv2.
428 (Target_powerpc::Relocate::relocate): Don't call
429 symval_for_branch when ELFv2. Do adjust for local entry
431 (Target_powerpc::do_dynsym_value): Set symbols to global entry
433 (Target_powerpc::do_plt_address_for_global): Similarly.
435 2013-11-14 Cary Coutant <ccoutant@google.com>
437 Revert patch -- this did not fix the problem, and there is
440 2013-11-14 Cary Coutant <ccoutant@google.com>
443 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
444 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
445 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
446 updating fde_offsets_.
447 (Eh_frame_hdr::lock_): New data member.
449 2013-11-14 Cary Coutant <ccoutant@google.com>
451 * dwp.cc (Dwo_file_entry): New type.
452 (File_list): Use Dwo_file_entry.
453 (Dwo_file::verify): New function.
454 (Dwo_file::verify_dwo_list): New function.
455 (Dwo_file::sized_verify_dwo_list): New function.
456 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
458 (Dwp_options): New enum type.
459 (dwp_options): Add --verify-only.
462 * dwp.h (gold_info): Add declaration.
464 2013-11-14 Cary Coutant <ccoutant@google.com>
467 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
468 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
469 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
470 updating fde_offsets_.
471 (Eh_frame_hdr::lock_): New data member.
473 2013-11-06 Cary Coutant <ccoutant@google.com>
476 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
477 before reloc sections.
479 2013-11-04 Alan Modra <amodra@gmail.com>
481 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
482 (Symbol::needs_dynamic_reloc): Test new flag.
483 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
484 (Target_powerpc::Scan::get_reference_flags): Add target param.
485 Return FUNC_DESC_ABI for 64-bit ELFv1.
486 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
488 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
489 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
491 2013-10-31 Cary Coutant <ccoutant@google.com>
493 Restore support for dwp v2 DWARF package file format.
495 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
496 tu_length parameter. Adjust all callers.
497 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
498 * dwp.cc: Include dwarf.h.
499 (Section_bounds): New struct type.
500 (Unit_set): New struct type.
501 (Dwo_file::Dwo_file): Initialize new data member.
502 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
503 Combine and rename to...
504 (Dwo_file::read_unit_index): ...this.
505 (Dwo_file::sized_read_compunit_index)
506 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
507 (Dwo_file::sized_read_unit_index): ...this.
508 (Dwo_file::copy_section): Remove section_name, is_str_offsets
509 parameters; add section_id parameter.
510 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
511 (Dwo_file::add_unit_set): ...this.
512 (Dwo_file::shndx_map_): Remove.
513 (Dwo_file::sect_offsets_): New data member.
514 (Dwp_output_file::Dwp_output_file): Initialize new data members.
515 (Dwp_output_file::add_section): Rename to...
516 (Dwp_output_file::add_contribution): ...this.
517 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
518 (Dwp_output_file::add_tu_set): Likewise.
519 (Dwp_output_file::Contribution): New type.
520 (Dwp_output_file::Section::contributions): New data member.
521 (Dwp_output_file::Cu_or_tu_set): Remove.
522 (Dwp_output_file::Section::Section): New ctor.
523 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
524 (Dwp_output_file::Dwp_index::Section_table): New type.
525 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
526 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
528 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
529 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
530 (Dwp_output_file::Dwp_index::section_table): New member function.
531 (Dwp_output_file::Dwp_index::section_table_end): New member function.
532 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
533 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
534 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
535 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
536 (Dwp_output_file::Dwp_index::section_table_): New data member.
537 (Dwp_output_file::Dwp_index::section_mask_): New data member.
538 (Dwp_output_file::add_output_section): New member function.
539 (Dwp_output_file::write_new_section): New member function.
540 (Dwp_output_file::write_contributions): New member function.
541 (Dwp_output_file::section_id_map_): New data member.
542 (class Dwo_id_info_reader): Remove.
543 (class Unit_reader): New class.
544 (get_dwarf_section_name): New function.
545 (Dwo_file::read_executable): Adjust initializations of class data.
546 (Dwo_file::read): Add support for v2 package file format.
547 (Dwo_file::read_unit_index): Likewise.
548 (Dwo_file::sized_read_unit_index): Likewise.
549 (Dwo_file::copy_section): Likewise.
550 (Dwo_file::add_unit_set): Likewise.
551 (Dwp_output_file::add_output_section): Likewise.
552 (Dwp_output_file::add_contribution): Likewise.
553 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
555 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
557 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
559 (Dwp_output_file::initialize): Remove unused function.
560 (Dwp_output_file::finalize): Add support for v2 package file format.
561 (Dwp_output_file::write_index): Likewise.
562 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
565 2013-10-31 Cary Coutant <ccoutant@google.com>
567 * configure.ac: Fix check for -fmerge-constants.
568 * configure.ac: Regenerate.
570 2013-10-30 Roland McGrath <mcgrathr@google.com>
572 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
573 Correct 9-byte nop sequence to match what the assembler generates.
575 2013-10-30 Alan Modra <amodra@gmail.com>
577 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
578 ppc64_local_entry_offset, ppc64_local_entry_offset,
579 do_read_symbols): New functions.
580 (Powerpc_relobj::e_flags_, st_other_): New vars.
581 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
582 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
583 (Powerpc_relobj::e_flags_): New var.
584 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
585 and adjust for ELFv2.
586 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
587 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
588 (Powerpc_dynobj::do_find_special_sections): Likewise.
589 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
590 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
591 to ELFv2 local entry.
592 (Target_powerpc::do_relax): No thread safe barriers needed for
594 (Output_data_plt_powerpc::initial_plt_entry_size_,
595 plt_entry_size): Delete. Replace all uses with
596 first_plt_entry_offset() and plt_entry_size().
597 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
598 reserved_size parm. Update callers.
599 (Output_data_plt_powerpc::entry_count): Update.
600 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
601 and use Target_powerpc::first_plt_entry_offset().
602 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
603 rename to plt_entry_size.
604 (Output_data_plt_powerpc::add_ifunc_entry,
605 add_local_ifunc_entry): Adjust reloc for ELFv2.
606 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
607 (glink_eh_frame_fde_64v2): New.
608 (Stub_table::plt_call_size): Support ELFv2 sizing.
609 (Output_data_glink::add_eh_frame): Use the new FDE.
610 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
611 (Stub_table::do_write): Write ELFv2 stubs and glink.
612 (Target_powerpc::Relocate::relocate): Replaces nop after call
613 with ld 2,24(1) and adjust local offset destination for ELFv2.
615 2013-10-30 Alan Modra <amodra@gmail.com>
617 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
618 (Target_powerpc::Scan::global, local): Likewise.
619 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
620 on all ppc64 @h and @ha relocs.
622 2013-10-14 Alan Modra <amodra@gmail.com>
624 * output.h (Output_data_got::add_constant): Tidy.
625 (Output_data_got::add_constant_pair): New function.
626 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
627 methods used so as to first call reserve_ent().
629 2013-10-11 Roland McGrath <mcgrathr@google.com>
631 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
632 add_got_entry and add_got_entry_pair.
634 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
635 (HAVE_PUBNAMES): Likewise.
636 * configure: Regenerate.
638 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
639 * testsuite/Makefile.in: Regenerate.
641 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
642 Remove const from declaration.
643 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
644 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
645 * output.h (Output_file_header): Remove const from member target_
646 and corresponding constructor argument.
647 * output.cc (Output_file_header::Output_file_header): Update prototype.
648 (Output_file_header::do_sized_write): Use this->target_ in place
649 of parameters()->target().
651 * testsuite/undef_symbol.cc (Foo::get_a): New method.
653 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
654 * configure: Regenerate.
655 * Makefile.in: Regenerate.
656 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
657 * testsuite/merge_string_literals_2.c: Likewise.
658 * testsuite/Makefile.am
659 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
660 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
661 literal -fmerge-constants.
662 * testsuite/Makefile.in: Regenerate.
664 * i386.cc (Target_i386): Remove unused member dynbss_.
665 * arm.cc (Target_arm): Likewise.
666 * powerpc.cc (Target_powerpc): Likewise.
667 * sparc.cc (Target_sparc): Likewise.
668 * tilegx.cc (Target_tilegx): Likewise.
669 * x86_64.cc (Target_x86_64): Likewise.
670 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
671 type_signature_, type_offset_.
672 * plugin.h (Plugin_hook): Remove unused member layout_.
673 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
675 (Read_member): Remove unused members input_objects_, symtab_,
677 (Check_library): Remove unused member symtab_.
678 * archive.h (Lib_group): Remove unused member lib_.
679 * archive.cc (Lib_group::Lib_group): Update initializer.
680 * incremental.h (Incremental_binary): Remove unused member target_.
681 (Incremental_script_entry): Removed unused member script_.
682 * layout.h (Write_symbols_task): Remove unused member input_objects_.
683 * icf.h (Icf): Remove unused member num_tracked_relocs.
685 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
686 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
688 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
690 * archive.h: Use struct rather than class for forward declaration
691 of Read_symbols_data.
693 2013-10-07 Cary Coutant <ccoutant@google.com>
696 * testsuite/Makefile.am (icf_test): Fix dependencies.
697 (icf_safe_test): Likewise.
698 (icf_safe_so_test): Likewise.
699 (large_symbol_alignment): Add empty _LDADD rule.
700 * testsuite/Makefile.in: Regenerate.
702 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
705 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
706 relocation for R_X86_64_32 on x32.
708 2013-08-27 Roland McGrath <mcgrathr@google.com>
710 * output.cc (Output_segment::set_section_addresses): Take new
711 Target* argument. If target->isolate_execinstr() and the segment
712 is executable and starts at a target->abi_pagesize() boundary,
713 pad its end out to a target->abi_pagesize() boundary with code fill.
714 * output.h (Output_segment::set_section_addresses): Update decl.
715 * layout.h (Layout::check_output_data_for_reset_values): Take new
716 argument RELAX_OUTPUTS.
717 (Layout): New member relax_output_list_.
718 (Layout::add_relax_output): New method.
719 * layout.cc (Layout::Layout): Update constructor.
720 (Layout::reset_relax_output): New method.
721 (Layout::clean_up_after_relaxation): Call it.
722 (Layout::prepare_for_relaxation): Update caller.
723 (Layout::set_segment_offsets): Update callers of set_section_addresses.
724 Call reset_relax_output before re-processing segments for
725 isolate_execinstr case.
726 (Layout::write_data): Handle relax_output_list_.
727 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
728 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
730 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
733 * object.h: Fix typos.
735 2013-08-16 Roland McGrath <mcgrathr@google.com>
737 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
738 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
740 2013-08-07 Cary Coutant <ccoutant@google.com>
742 Revert support for v2 DWP files:
744 2013-03-01 Cary Coutant <ccoutant@google.com>
746 Add dwp support for v2 DWARF package file format.
747 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
748 tu_length parameter. Adjust all callers.
749 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
750 * dwp.cc: Include dwarf.h.
751 (Section_bounds): New struct type.
752 (Unit_set): New struct type.
753 (Dwo_file::Dwo_file): Initialize new data member.
754 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
755 Combine and rename to...
756 (Dwo_file::read_unit_index): ...this.
757 (Dwo_file::sized_read_compunit_index)
758 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
759 (Dwo_file::sized_read_unit_index): ...this.
760 (Dwo_file::copy_section): Remove section_name, is_str_offsets
761 parameters; add section_id parameter.
762 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
763 (Dwo_file::add_unit_set): ...this.
764 (Dwo_file::shndx_map_): Remove.
765 (Dwo_file::sect_offsets_): New data member.
766 (Dwp_output_file::Dwp_output_file): Initialize new data members.
767 (Dwp_output_file::add_section): Rename to...
768 (Dwp_output_file::add_contribution): ...this.
769 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
770 (Dwp_output_file::add_tu_set): Likewise.
771 (Dwp_output_file::Contribution): New type.
772 (Dwp_output_file::Section::contributions): New data member.
773 (Dwp_output_file::Cu_or_tu_set): Remove.
774 (Dwp_output_file::Section::Section): New ctor.
775 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
776 (Dwp_output_file::Dwp_index::Section_table): New type.
777 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
778 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
780 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
781 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
782 (Dwp_output_file::Dwp_index::section_table): New member function.
783 (Dwp_output_file::Dwp_index::section_table_end): New member function.
784 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
785 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
786 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
787 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
788 (Dwp_output_file::Dwp_index::section_table_): New data member.
789 (Dwp_output_file::Dwp_index::section_mask_): New data member.
790 (Dwp_output_file::add_output_section): New member function.
791 (Dwp_output_file::write_new_section): New member function.
792 (Dwp_output_file::write_contributions): New member function.
793 (Dwp_output_file::section_id_map_): New data member.
794 (class Dwo_id_info_reader): Remove.
795 (class Unit_reader): New class.
796 (get_dwarf_section_name): New function.
797 (Dwo_file::read_executable): Adjust initializations of class data.
798 (Dwo_file::read): Add support for v2 package file format.
799 (Dwo_file::read_unit_index): Likewise.
800 (Dwo_file::sized_read_unit_index): Likewise.
801 (Dwo_file::copy_section): Likewise.
802 (Dwo_file::add_unit_set): Likewise.
803 (Dwp_output_file::add_output_section): Likewise.
804 (Dwp_output_file::add_contribution): Likewise.
805 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
807 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
809 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
811 (Dwp_output_file::initialize): Remove unused function.
812 (Dwp_output_file::finalize): Add support for v2 package file format.
813 (Dwp_output_file::write_index): Likewise.
814 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
817 2013-07-31 Cary Coutant <ccoutant@google.com>
819 * object.cc (Sized_relobj::do_output_section_address): New function.
820 (Sized_relobj): Instantiate explicitly.
821 * object.h (Object::output_section_address): New function.
822 (Object::do_output_section_address): New function.
823 (Sized_relobj::do_output_section_address): New function.
824 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
826 2013-07-30 Cary Coutant <ccoutant@google.com>
827 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
829 * parameters.cc (Parameters::entry): Return target-specific entry
831 * target.h (Target::entry_symbol_name): New function.
832 (Target_info::entry_symbol_name): New data member.
834 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
835 * i386.cc (Target_i386::i386_info): Likewise.
836 (Target_i386_nacl::i386_nacl_info): Likewise.
837 * sparc.cc (Target_sparc::sparc_info): Likewise.
838 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
839 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
840 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
841 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
843 2013-07-22 Sterling Augustine <saugustine@google.com>
845 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
846 Convert parameter shndx to local variable. Add parameters symtab
847 and symtab_size. Scan over section names. Find relocation
848 section corresponding to current section. Create and initialize
849 reloc_mapper_ and reloc_type_.
850 (Dwarf_pubnames_table::read_header): Add assertion. Change
851 unit_length to off_t. Initialize member unit_length_. Fill in field
853 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
854 Initialize new fields unit_length_ and cu_offset_.
855 (Dwarf_pubnames_table::read_section): Update prototype.
856 (Dwarf_pubnames_table::cu_offset): New member function.
857 (Dwarf_pubnames_table::subsection_size): Likewise.
858 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
860 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
861 member functions public.
862 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
863 Update comment. Rework logic. Move repeated parts to...
864 (Gdb_index_info_reader::read_pubtable): ...here. New function.
865 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
866 pubtypes_table_, and stmt_list_offset.
867 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
868 Gdb_index::find_pubtype_offset,
869 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
870 (Gdb_index::pubnames_read): Update prototype and rework logic.
871 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
873 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
874 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
875 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
876 Gdb_index::map_pubtable_to_dies):
878 (Gdb_index::pubnames_read): Update declaration.
879 (Gdb_index::Pubname_offset_map): New type.
880 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
881 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
882 Gdb_index::stmt_list_offset): Declare.
883 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
884 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
885 Gdb_index::pubtypes_offset_): Remove.
887 2013-07-19 Roland McGrath <mcgrathr@google.com>
889 * options.h (General_options): Add -Trodata-segment option.
890 * parameters.cc (Parameters::check_rodata_segment): New function.
891 (Parameters::set_target_once): Call it.
892 * parameters.h (Parameters): Declare it (private member function).
893 * layout.cc (load_seg_unusable_for_headers): New function, broken
894 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
895 then validate rodata segment rather than text segment.
896 (relaxation_loop_body): Call that.
897 (is_text_segment): New function. Don't admit a non-executable
898 segment if TARGET->isolate_execinstr().
899 (set_segment_offsets): Call it. Honor -Trodata-segment option.
901 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
904 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
905 * nacl.h (Sniff_file::View::View): Request aligned view.
907 2013-07-11 Cary Coutant <ccoutant@google.com>
909 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
910 correct BRLT entry size.
912 2013-07-03 Alan Modra <amodra@gmail.com>
914 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
917 2013-07-01 Cary Coutant <ccoutant@google.com>
919 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
921 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
922 (Dwarf_ranges_table::lookup_reloc): New function.
923 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
925 (Dwarf_ranges_table::lookup_reloc): New function.
926 (Dwarf_ranges_table::reloc_type_): New data member.
928 2013-06-27 Jing Yu <jingyu@google.com>
931 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
933 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
934 (Target_powerpc::do_relax): Call the above.
936 2013-06-27 Cary Coutant <ccoutant@google.com>
938 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
939 on garbage collected .opd section.
941 2013-06-27 Alan Modra <amodra@gmail.com>
943 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
945 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
946 (Target_powerpc::do_function_location): Likewise for loc->shndx.
948 2013-06-14 Cary Coutant <ccoutant@google.com>
950 * resolve.cc (Symbol::override_base): Don't override st_type
951 from plugin placeholder symbols.
952 (Symbol_table::resolve): Likewise.
953 (Symbol_table::should_override): Don't complain about TLS mismatch
954 if the TO symbol is a plugin placeholder.
955 * testsuite/Makefile.am (plugin_test_tls): New test.
956 * testsuite/Makefile.in: Regenerate.
957 * testsuite/plugin_test_tls.sh: New test script.
958 * testsuite/two_file_test_2_tls.cc: New test source.
959 * testsuite/two_file_test_tls.cc: New test source.
961 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
963 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
964 the maximum segment alignment is larger than the page size.
965 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
966 correctly aligns the symbols with large alignemnt.
967 * testsuite/Makefile.in: Regenerate.
968 * testsuite/large_symbol_alignment.cc: New file.
970 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
971 Sriraman Tallam <tmsriram@google.com>
973 * options.h (sort_section): New option.
974 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
975 Rename from Input_section_sort_section_name_special_ordering_compare.
976 (Input_section_sort_section_name_compare): New struct.
977 * output.cc (Output_section::Input_section_sort_section_name_compare::
978 operator()): New function.
979 (Output_section::sort_attached_input_sections): Use new sort function
980 for .text if --sort-section=name is specified.
981 * layout.cc (Layout::make_output_section):
982 Add sorting by name when --sort-section=name is specified.
983 * testsuite/Makefile.am (text_section_grouping): Test option
985 * testsuite/Makefile.in: Regenerate.
986 * testsuite/section_sorting_name.cc: New file.
987 * testsuite/section_sorting_name.sh: New file.
989 2013-05-21 Cary Coutant <ccoutant@google.com>
991 * symtab.h (Symbol::is_cxx_vtable): New function.
992 * target-reloc.h (relocate_section): Check for vtable symbol.
993 * testsuite/Makefile.am (missing_key_func.sh): New test case.
994 * testsuite/Makefile.in: Regenerate.
995 * testsuite/missing_key_func.cc: New test source.
996 * testsuite/missing_key_func.sh: New test script.
998 2013-05-21 Cary Coutant <ccoutant@google.com>
1000 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1001 type of enclosing symbol.
1002 (Relocate_info::location): Check symbol type when describing symbol.
1003 * object.h (Symbol_location_info): Remove unused line_number;
1004 add enclosing_symbol_type.
1005 * testsuite/debug_msg.sh: Adjust expected output.
1007 2013-05-13 Cary Coutant <ccoutant@google.com>
1009 * configure.ac: Export DEFAULT_TARGET.
1010 * configure: Regenerate.
1011 * Makefile.in: Regenerate.
1012 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1013 * testsuite/Makefile.in: Regenerate.
1014 * testsuite/debug_msg.sh: Delete duplicate tests.
1015 Don't check undef_int error message match for powerpc where the
1016 source file and line number aren't available.
1018 2013-05-10 Roland McGrath <mcgrathr@google.com>
1020 * options.h (General_options): Add --rosegment-gap option.
1021 * options.cc (finalize): --rosegment-gap implies --rosegment.
1022 * layout.cc (set_segment_offsets): Let user option override
1023 target->rosegment_gap().
1025 2013-05-10 Roland McGrath <mcgrathr@google.com>
1027 * options.h (General_options): Remove leading space from help
1028 messages for -nostdlib and --rosegment.
1030 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1033 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1035 2013-05-03 Alan Modra <amodra@gmail.com>
1037 * merge.cc (Output_merge_string::do_add_input_section): Correct
1038 scan for number of strings. Rename vars to avoid shadowing.
1039 Include missing terminator in input_size_.
1041 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1043 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1044 Restore empty string handling.
1046 2013-05-01 Cary Coutant <ccoutant@google.com>
1048 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1049 uninitialized warning.
1051 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1053 * output.cc (Output_section::add_merge_input_section): Allow
1054 to merge sections if the alignment is more than character size.
1055 * merge.h (Output_merge_string::Output_merge_string): Remove
1057 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1058 only not-null strings. Check the alignment of strings.
1060 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1061 alignment as the argument.
1062 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1063 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1064 Align non-zero length strings according to the addralign_.
1065 (Stringpool_template<Stringpool_char>::set_string_offsets):
1066 Updating offsets according to the given alignment.
1067 * testsuite/Makefile.am (text_section_grouping): Test if string
1068 literals are getting merged.
1069 * testsuite/Makefile.in: Regenerate.
1070 * testsuite/merge_string_literals_1.c: New file.
1071 * testsuite/merge_string_literals_2.c: Ditto.
1072 * testsuite/merge_string_literals.sh: Ditto.
1074 2013-04-26 Ian Lance Taylor <iant@google.com>
1076 * target-reloc.h (relocate_section): If the reloc offset is out of
1077 range, pass VIEW as NULL to relocate.relocate.
1078 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1079 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1080 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1081 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1082 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1083 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1085 2013-04-26 Geoff Pike <gpike@chromium.org>
1087 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1088 * layout.cc (Hash_task): New class.
1089 (Layout::queue_build_id_tasks): New function.
1090 (Layout::write_build_id): Handle single-thread portion of build ID
1091 computation. (In some cases, all of it is single-threaded.) Replace
1092 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1093 functionality in fewer lines of code.
1094 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1095 * options.h (General_options): make "--build-id" default to tree
1096 rather than sha1. Add two new options related to --build-id=tree:
1097 --build-id-chunk-size-for-treehash and
1098 --build-id-min-file-size-for-treehash.
1099 * Makefile.am: add testing of --build-id=tree and related new options
1100 (these tests will be invoked by "make check").
1101 * Makefile.in: Regenerate.
1103 2013-04-25 Alan Modra <amodra@gmail.com>
1105 * configure.tgt: Add powerpcle and powerpc64le.
1107 2013-04-22 Alan Modra <amodra@gmail.com>
1110 * layout.cc (Layout::segment_precedes): Allow more than one
1111 segment with the same type and flags.
1113 2013-04-15 Cary Coutant <ccoutant@google.com>
1115 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1116 allocate space in file for BSS sections.
1118 2013-04-15 Cary Coutant <ccoutant@google.com>
1120 * script-sections.cc (Orphan_output_section): Reset address
1121 to zero after each orphaned section for relocatable links.
1123 2013-04-15 Cary Coutant <ccoutant@google.com>
1125 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1126 section starting address for relocatable link.
1127 * testsuite/Makefile.am (script_test_11): New test.
1128 * testsuite/Makefile.in: Regenerate.
1129 * testsuite/script_test_11.c: New source file.
1130 * testsuite/script_test_11.t: New linker script.
1132 2013-04-13 Alan Modra <amodra@gmail.com>
1134 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1135 owner when sections are not adjacent and exceed group size.
1136 (Target_powerpc::group_sections): Handle corner case.
1137 (Target_powerpc::Branch_info::make_stub): Handle case where
1138 stub table doesn't exist due to branches in non-exec sections.
1139 (Target_powerpc::Relocate::relocate): Likewise.
1141 2013-04-11 Alan Modra <amodra@gmail.com>
1144 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1145 .branch_lt to match bfd ld. Adjust comments throughout file.
1147 2013-04-04 Ian Lance Taylor <iant@google.com>
1150 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1151 sections before checking whether they are included in the link.
1153 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1155 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1156 object before calling the plugin claim_file handler. Pass the elf
1157 object of the archive to the plugin. Delete the elf object if the
1158 plugin claims the file.
1160 2013-03-21 Alan Modra <amodra@gmail.com>
1162 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1163 segment when omagic.
1165 2013-03-21 Alan Modra <amodra@gmail.com>
1167 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1169 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1170 uninitialized" warning.
1172 2013-03-20 Alan Modra <amodra@gmail.com>
1174 * symtab.h (Symbol::clear_version): New function.
1175 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1176 is_needed by weak references. Clear version for symbols defined
1177 in as-needed objects that are not needed.
1179 2013-03-15 Alan Modra <amodra@gmail.com>
1181 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1182 static and public. Add report_err param. Return false for data refs.
1183 (Target_powerpc::rela_dyn_section): New overloaded function.
1184 (Target_powerpc::plt_, iplt_): Elucidate.
1185 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1186 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1187 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1188 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1189 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1190 push_branch and make_plt_entry for ifunc syms when
1191 reloc_needs_plt_for_ifunc.
1192 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1193 for ifunc unless reloc_needs_plt_for_ifunc.
1195 2013-03-15 Alan Modra <amodra@gmail.com>
1197 * gc.h (gc_process_relocs): Don't look through function descriptors.
1198 * icf.cc (get_section_contents): Do so here instead.
1200 2013-03-13 Alan Modra <amodra@gmail.com>
1202 * powerpc.cc (is_branch_reloc): Forward declare.
1203 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1204 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1205 false for 64-bit, true for 32-bit non-branch relocs.
1206 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1207 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1209 (icf_safe_test): Generate linker map file as well as nm output.
1210 (icf_safe_so_test): Likewise.
1211 * testsuite/Makefile.in: Regenerate.
1212 * testsuite/icf_test.sh: Parse linker map file to determine
1214 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1215 * testsuite/icf_safe_so_test.sh: Likewise.
1216 (X86_32_or_ARM_specific_safe_fold): Merge into..
1217 (arch_specific_safe_fold): ..this.
1218 (X86_64_specific_safe_fold): Delete unused function.
1220 2013-03-12 Alan Modra <amodra@gmail.com>
1222 * gc.h (gc_process_relocs): Look through function descriptors
1223 to determine shndx, symvalue and addend used by ICF. Tidy
1224 variable duplication.
1226 2013-03-11 Alan Modra <amodra@gmail.com>
1228 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1229 * layout.cc (Layout_task_runner::run): ..to here.
1230 * symtab.h (struct Symbol_location): Extract from..
1231 (class Symbol_table): ..here.
1232 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1233 * target.h (class Target): Add function_location and
1234 do_function_location functions.
1235 (class Sized_target): Add do_function_location.
1236 * object.h (class Sized_relobj_file): Move find_shdr..
1237 (class Object): ..to here.
1238 * object.cc: Likewise. Update to suit. Instantiate.
1239 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1240 * powerpc.cc (class Powerpc_dynobj): New.
1241 (Target_powerpc::do_function_location): New function.
1242 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1243 (Powerpc_dynobj::do_read_symbols): New function.
1244 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1246 2013-03-08 Ian Lance Taylor <iant@google.com>
1248 * options.cc (General_options::string_to_object_format): Accept
1251 2013-03-08 Alan Modra <amodra@gmail.com>
1253 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1254 pointer to Post_fde.
1255 (struct Post_fde): Move definition to here..
1256 * ehframe.cc (struct Post_fde): ..from here.
1257 (Cie::write): Don't alloc Post_fde.
1258 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1260 2013-03-07 Alan Modra <amodra@gmail.com>
1262 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1263 relocation referencing .LC0.
1264 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1266 2013-03-07 Alan Modra <amodra@gmail.com>
1268 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1269 always_inline. Add assembly for powerpc to avoid GOT.
1271 2013-03-07 Alan Modra <amodra@gmail.com>
1273 * testsuite/script_test_10.sh: Don't test .bss section
1276 2013-03-06 Alan Modra <amodra@gmail.com>
1278 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1279 (Target_powerpc::symval_for_branch): Add symtab param. Update
1280 all callers. Handle folded sections.
1281 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1283 (Global_symbol_visitor_opd::operator()): Likewise.
1285 2013-03-04 Alan Modra <amodra@gmail.com>
1287 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1288 * testsuite/Makefile.in: Regenerate.
1290 2013-03-01 Cary Coutant <ccoutant@google.com>
1292 Add dwp support for v2 DWARF package file format.
1293 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1294 tu_length parameter. Adjust all callers.
1295 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1296 * dwp.cc: Include dwarf.h.
1297 (Section_bounds): New struct type.
1298 (Unit_set): New struct type.
1299 (Dwo_file::Dwo_file): Initialize new data member.
1300 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1301 Combine and rename to...
1302 (Dwo_file::read_unit_index): ...this.
1303 (Dwo_file::sized_read_compunit_index)
1304 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1305 (Dwo_file::sized_read_unit_index): ...this.
1306 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1307 parameters; add section_id parameter.
1308 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1309 (Dwo_file::add_unit_set): ...this.
1310 (Dwo_file::shndx_map_): Remove.
1311 (Dwo_file::sect_offsets_): New data member.
1312 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1313 (Dwp_output_file::add_section): Rename to...
1314 (Dwp_output_file::add_contribution): ...this.
1315 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1316 (Dwp_output_file::add_tu_set): Likewise.
1317 (Dwp_output_file::Contribution): New type.
1318 (Dwp_output_file::Section::contributions): New data member.
1319 (Dwp_output_file::Cu_or_tu_set): Remove.
1320 (Dwp_output_file::Section::Section): New ctor.
1321 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1322 (Dwp_output_file::Dwp_index::Section_table): New type.
1323 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1324 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1326 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1327 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1328 (Dwp_output_file::Dwp_index::section_table): New member function.
1329 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1330 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1331 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1332 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1333 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1334 (Dwp_output_file::Dwp_index::section_table_): New data member.
1335 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1336 (Dwp_output_file::add_output_section): New member function.
1337 (Dwp_output_file::write_new_section): New member function.
1338 (Dwp_output_file::write_contributions): New member function.
1339 (Dwp_output_file::section_id_map_): New data member.
1340 (class Dwo_id_info_reader): Remove.
1341 (class Unit_reader): New class.
1342 (get_dwarf_section_name): New function.
1343 (Dwo_file::read_executable): Adjust initializations of class data.
1344 (Dwo_file::read): Add support for v2 package file format.
1345 (Dwo_file::read_unit_index): Likewise.
1346 (Dwo_file::sized_read_unit_index): Likewise.
1347 (Dwo_file::copy_section): Likewise.
1348 (Dwo_file::add_unit_set): Likewise.
1349 (Dwp_output_file::add_output_section): Likewise.
1350 (Dwp_output_file::add_contribution): Likewise.
1351 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1353 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1355 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1357 (Dwp_output_file::initialize): Remove unused function.
1358 (Dwp_output_file::finalize): Add support for v2 package file format.
1359 (Dwp_output_file::write_index): Likewise.
1360 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1363 2013-03-01 Cary Coutant <ccoutant@google.com>
1365 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1366 function into class definition in header file.
1367 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1368 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1370 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1372 2013-02-28 Alan Modra <amodra@gmail.com>
1374 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1375 * target.cc (Target::do_plt_fde_location): New function.
1376 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1377 accessor function, and constructor param.
1378 (struct Post_fde, Post_fdes): Declare.
1379 (Cie::write): Add post_fdes param.
1380 * ehframe.cc (Fde::write): Use plt_fde_location.
1381 (struct Post_fde): Define.
1382 (Cie::write): Stash FDEs added post merge mapping.
1383 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1384 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1385 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1387 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1388 (Target_powerpc::has_glink): New function.
1389 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1390 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1391 glink_eh_frame_fde_32, default_fde): New data.
1392 (Stub_table::eh_frame_added_): New var.
1393 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1395 (Stub_table::add_eh_frame): New function.
1396 (Output_data_glink::add_eh_frame): New function.
1397 (Target_powerpc::make_glink_section): Call add_eh_frame.
1399 2013-02-15 Ian Lance Taylor <iant@google.com>
1401 * options.h (DEFINE_uint64_alias): Define.
1402 (class General_options): Add -Ttext-segment as an alias for
1405 2013-02-15 Alan Modra <amodra@gmail.com>
1407 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1408 (Stub_table::do_write): ..here, two places.
1409 (Stub_table::plt_call_size): Use it here too.
1411 2013-02-11 Ian Lance Taylor <iant@google.com>
1413 * descriptors.cc (Descriptors::close_all): New function.
1414 * descriptors.h (class Descriptors): Declare close_all.
1415 (close_all_descriptors): New inline function.
1416 * plugin.cc: Include "descriptors.h".
1417 (Plugin_manager::cleanup): Call close_all_descriptors.
1419 2013-02-06 Alan Modra <amodra@gmail.com>
1421 * README: Update coding style link.
1423 2013-01-28 Cary Coutant <ccoutant@google.com>
1425 * dwp.cc (File_list): New typedef.
1426 (Dwo_name_info_reader): New class.
1427 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1428 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1429 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1430 (Dwo_file::read_executable): New function.
1431 (Dwo_file::read): Move common setup code to ...
1432 (Dwo_file::make_object): ... here.
1433 (dwp_options): Add --exec/-e.
1437 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1439 * layout.cc (Layout::layout): Check for option text_reorder.
1440 (Layout::make_output_section): Ditto.
1441 * options.h (text_reorder): New option.
1442 * output.cc (Input_section_sort_compare): Remove special ordering
1445 Input_section_sort_section_name_special_ordering_compare::
1446 operator()): New function.
1447 (Output_section::sort_attached_input_sections): Use new sort function
1449 * output.h (Input_section_sort_section_name_special_ordering_compare):
1451 * testsuite/Makefile.am (text_section_grouping): Test option
1453 * testsuite/Makefile.in: Regenerate.
1454 * testsuite/text_section_grouping.sh: Check order of functions without
1455 default text reordering.
1457 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1459 * options.h (General_options): Change default to true for new_dtags.
1461 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1463 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1464 when enable_new_dtags is false. Only add DT_RUNPATH when
1465 enable_new_dtags is true.
1467 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1469 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1470 used in declaration and definition consistent.
1471 (Target_powerpc::symval_for_branch): Ditto.
1473 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1475 * testsuite/plugin_final_layout.cc: Fix comment.
1477 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1479 * layout.cc (Layout::layout): Do not do default sorting for
1480 text sections when section ordering is specified.
1481 (make_output_section): Ditto.
1482 * testsuite/plugin_final_layout.cc: Name the function sections
1483 to catch reordering issues.
1485 2013-01-15 Alan Modra <amodra@gmail.com>
1487 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1490 2013-01-15 Alan Modra <amodra@gmail.com>
1492 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1493 * testsuite/Makefile.in: Regenerate.
1495 2013-01-14 Alan Modra <amodra@gmail.com>
1497 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1498 * testsuite/Makefile.in: Regenerate.
1500 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1503 Fix mingw gold build with plugins enabled
1504 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1505 * configure.ac: Export DLOPEN_LIBS and add headers check.
1506 * plugin.cc: Handle non-dlfcn case.
1507 * Makefile.in: Regenerate.
1508 * config.in: Regenerate.
1509 * configure: Regenerate.
1510 * testsuite/Makefile.in: Regenerate.
1512 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1514 * output.h (sort_attached_input_sections): Change to be public.
1515 * script-sections.cc
1516 (Output_section_definition::set_section_addresses): Sort
1517 attached input sections according to section order before linker
1518 script assigns section addresses.
1519 (Orphan_output_section::set_section_addresses): Sort
1520 attached input sections according to section order before linker
1521 script assigns section addresses.
1522 * Makefile.am (final_layout.sh): Use a simple linker script to
1523 check if section ordering still works.
1524 * Makefile.in: Regenerate.
1526 2013-01-09 Ben Cheng <bccheng@google.com>
1528 * arm.cc (Target_arm::attributes_accept_div): New function.
1529 (Target_arm::attributes_forbid_div): New function.
1530 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1531 attribute using the same new functions as what bfd/elf32_arm.c
1534 2013-01-07 Cary Coutant <ccoutant@google.com>
1537 * output.cc (Output_section::add_input_section): For incremental
1538 updates, don't track input sections that are allocated from patch
1541 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1542 Ian Lance Taylor <iant@google.com>
1545 * configure.ac (--enable-ld): Removed.
1546 (install_as_default): Set to yes only for --enable-gold=default
1548 * configure: Regenerated.
1550 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1552 * options.h (General_options): Add -fuse-ld= for GCC linker
1553 option compatibility.
1555 2013-01-04 Cary Coutant <ccoutant@google.com>
1557 * configure.ac: Fix typo restoring CXXFLAGS.
1558 * configure: Regenerate.
1560 2013-01-04 Cary Coutant <ccoutant@google.com>
1562 * testsuite/Makefile.am (CXXLINK_S): New macro.
1563 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1564 * testsuite/Makefile.in: Regenerate.
1566 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1568 * version.cc (print_version): Update copyright year to 2013.
1570 2012-12-20 Ian Lance Taylor <iant@google.com>
1572 * layout.cc (Layout::special_ordering_of_input_section): New
1574 (Layout::layout): If input section requires special ordering, must
1575 sort input sections.
1576 (Layout::make_output_section): May sort .text input sections.
1577 (Layout::is_section_name_prefix_grouped): Remove.
1578 * layout.h (class Layout): Declare
1579 special_ordering_of_input_section. Don't declare
1580 is_section_name_prefix_grouped.
1581 * output.cc (Output_section::add_input_section): Revert last
1583 (Output_section::Input_section_sort::match_file_name): Don't crash
1584 if called on output section data.
1585 (Output_section::Input_section_sort_compare): Sort based on
1587 (Output_section::Input_section_sort_section_order_index_compare):
1589 (Output_section::sort_attached_input_sections): Likewise.
1591 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1593 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1594 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1595 * output.cc (Output_section::add_input_section): Check if section
1596 name contains special prefix. Keep input sections to sort such
1598 (Output_section::Input_section_sort_section_order_index_compare
1599 ::operator()): Group sections according to prefixes.
1600 (Output_section::sort_attached_input_sections): Add condition to
1601 Input_section_entry constructor call.
1602 * testsuite/Makefile.am (text_section_grouping): New test.
1603 * testsuite/Makefile.in: Regenerate.
1604 * testsuite/text_section_grouping.cc: New file.
1605 * testsuite/text_section_grouping.sh: New file.
1607 2012-12-17 Nick Clifton <nickc@redhat.com>
1609 * Makefile.am: Add copyright notice.
1612 * configure.ac: Likewise.
1613 * ftruncate.c: Likewise.
1614 * Makefile.in: Regenerate.
1616 2012-12-14 Cary Coutant <ccoutant@google.com>
1618 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1619 --no-as-needed flag.
1620 (exception_separate_shared_12_test): Likewise.
1621 (incremental_copy_test): Likewise.
1622 * testsuite/Makefile.in: Regenerate.
1624 2012-12-14 Cary Coutant <ccoutant@google.com>
1626 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1627 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1629 2012-12-12 Alan Modra <amodra@gmail.com>
1631 * powerpc.cc (class Track_tls): New.
1632 (class Relocate, class Scan): Inherit Track_tls.
1633 (Target_powerpc::Scan::local, global): Track tls optimization
1634 and avoid creating plt entry for __tls_get_addr if all uses
1636 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1638 2012-12-12 Alan Modra <amodra@gmail.com>
1640 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1641 Replace no_toc_optimize with toc_optimize.
1642 * output.h (Output_section::input_sections): Provide non-const variant.
1643 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1644 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1646 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1647 (class Sort_toc_sections): New.
1648 (Target_powerpc::do_finalize_sections): Sort toc sections.
1649 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1651 2012-12-10 Roland McGrath <mcgrathr@google.com>
1653 * testsuite/binary_unittest.cc (read_all): New function.
1654 (Sized_binary_test): Use it instead of ::read.
1655 * fileread.cc (do_read): Don't assume pread always reads the whole
1656 amount in a single call.
1658 2012-12-10 Alan Modra <amodra@gmail.com>
1660 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1661 Set EM_PPC64 or EM_PPC here.
1662 (Target_selector_powerpc::do_recognize): Delete.
1664 2012-12-10 Alan Modra <amodra@gmail.com>
1666 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1668 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1670 2012-12-07 Roland McGrath <mcgrathr@google.com>
1672 * testsuite/binary_unittest.cc (Sized_binary_test):
1673 Use open_descriptor rather than ::open.
1675 2012-12-07 Alan Modra <amodra@gmail.com>
1677 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1678 typedef and invalid_address constant.
1679 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1680 instantiate constants.
1682 2012-12-06 Roland McGrath <mcgrathr@google.com>
1684 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1685 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1686 * aclocal.m4: Regenerate.
1687 * configure: Regenerate.
1688 * Makefile.in: Regenerate.
1689 * testsuite/Makefile.in: Regenerate.
1691 2012-12-07 Alan Modra <amodra@gmail.com>
1693 * options.h (General_options): Add no_toc_optimize.
1694 * powerpc.cc (ok_lo_toc_insn): New function.
1695 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1697 2012-12-06 Alan Modra <amodra@gmail.com>
1699 * options.h (General_options): Add plt_align, plt_static_chain,
1700 plt_thread_safe. Update stub_group_size help text.
1701 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1702 for new plt_thread_safe_ var.
1703 (use_plt_offset): Correct comments.
1704 (Target_powerpc::do_relax): Look for thread creation symbols to
1705 determine default plt_thread_safe value. Clear plt call stubs
1706 as well as branch stubs each iteration.
1707 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1709 (l, hi, ha, write_insn): Move earlier.
1710 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1711 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1713 (Stub_table::update_size): Adjust.
1714 (Stub_table::prev_size, set_prev_size): Delete.
1715 (Stub_table::stub_align): Let --plt-align affect result.
1716 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1717 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1718 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1719 (Stub_table::do_write): Support more stub variants.
1721 2012-12-04 Alan Modra <amodra@gmail.com>
1723 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1724 (Target_powerpc::do_define_standard_symbols): New function.
1726 2012-12-03 Alan Modra <amodra@gmail.com>
1728 * output.h: Formatting, whitespace.
1730 2012-12-03 Alan Modra <amodra@gmail.com>
1732 * layout.h (Layout::get_executable_sections): Declare.
1733 * layout.cc (Layout::get_executable_sections): New function.
1734 * arm.cc (Target_arm::group_sections): Use it.
1735 (Arm_output_section::group_sections): Delete now redundant test.
1736 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1737 param to handle relative relocs.
1738 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1739 (Output_data_reloc::add_absolute): Adjust.
1740 (Output_data_reloc::add_relative): New function.
1741 (Output_data::reset_data_size): New function.
1742 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1743 (Output_section::set_addralign): New function.
1744 (Output_section::checkpoint_set_addralign): New function.
1745 (Output_section::clear_section_offsets_need_adjustment): New function.
1746 (Output_section::input_sections): Make public.
1747 * powerpc.cc (class Output_data_brlt_powerpc): New.
1748 (class Stub_table, class Stub_control): New.
1749 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1750 stub_table_, set_stub_table, stub_table): New vectors and accessor
1752 (Target_powerpc::do_may_relax, do_relax, push_branch,
1753 new_stub_table, stub_tables, brlt_section, group_sections,
1754 add_branch_lookup_table, find_branch_lookup_table,
1755 write_branch_lookup_table, make_brlt_section): New functions.
1756 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1757 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1758 branch_info_): New vars.
1759 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1760 make call stubs here.
1761 (Output_data_glink): Remove all call stub handling from this class.
1762 (Target_powerpc::Scan::local, global): Save interesting branch
1763 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1764 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1765 functions on final link.
1766 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1767 Handle long branch destinations too.
1768 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1769 do_plt_address_for_local): Adjust lookup of plt call stubs.
1771 2012-11-30 Alan Modra <amodra@gmail.com>
1773 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1774 relocs against protected symbols when building 32-bit shared libs.
1776 2012-11-30 Alan Modra <amodra@gmail.com>
1778 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1779 param. Call got_section() to make .got. Update all callers
1780 and their callers and so on.
1782 2012-11-30 Alan Modra <amodra@gmail.com>
1784 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1785 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1786 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1787 value if it already exists.
1789 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1792 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1794 2012-11-14 Roland McGrath <mcgrathr@google.com>
1796 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1797 than bfc instruction for data sandboxing.
1799 2012-11-08 Alan Modra <amodra@gmail.com>
1801 * po/POTFILES.in: Regenerate.
1803 2012-11-05 Alan Modra <amodra@gmail.com>
1805 * configure.ac: Apply 2012-09-10 change to config.in here.
1806 * configure: Regenerate.
1808 2012-11-05 Alan Modra <amodra@gmail.com>
1810 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1811 (struct Opd_ent): Use "Address" rather than "Offset".
1812 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1813 (Target_powerpc::got_section): Make public.
1814 (Target_powerpc::scan_relocs): Move code setting symbols..
1815 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1816 Create _SDA_BASE_ only when referenced.
1818 2012-11-02 Roland McGrath <mcgrathr@google.com>
1820 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1823 2012-11-01 Roland McGrath <mcgrathr@google.com>
1825 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1826 for offset_in_output_section parameter.
1827 (Sized_target::relocate_special_relocatable): Likewise.
1828 * arm.cc (Target_arm::relocate_relocs): Likewise.
1829 (Target_arm::relocate_special_relocatable): Likewise.
1830 * i386.cc (Target_i386::relocate_relocs): Likewise.
1831 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1832 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1833 * target-reloc.h (relocate_relocs): Likewise.
1834 * testsuite/testfile.cc (Target_test): Likewise.
1835 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1836 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1838 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1839 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1841 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1842 parameter, which is unused in the [!F_SETFD] case.
1844 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1845 SYMNDX to off_t before comparing it to this->data_size().
1846 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1847 * incremental.cc (Output_section_incremental_inputs::do_write):
1848 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1850 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1852 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1854 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1855 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1858 2012-10-29 Cary Coutant <ccoutant@google.com>
1860 * dwp.cc (usage): Add file and exit status parameters;
1861 add --help and --version options.
1862 (print_version): New function.
1863 (main): Add --help and --version options.
1865 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1867 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1868 final_layout_sequence.txt.
1869 * testsuite/Makefile.in: Regenerated.
1871 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1873 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1874 COMPILE generated by automake.
1876 (CXXCOMPILE1): Likewise.
1877 (CXXLINK1): Likewise.
1878 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1880 (CXXCOMPILE): Likewise.
1881 (CXXLINK): Likewise.
1882 * testsuite/Makefile.in: Regenerated.
1884 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1886 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1887 on bad fwrite return.
1889 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1891 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1894 2012-10-23 Cary Coutant <ccoutant@google.com>
1896 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1897 * testsuite/Makefile.in: Regenerate.
1898 * testsuite/dwp_test.h: New source file.
1899 * testsuite/dwp_test_1.cc: New source file.
1900 * testsuite/dwp_test_1.s: New source file.
1901 * testsuite/dwp_test_1.sh: New source file.
1902 * testsuite/dwp_test_1b.cc: New source file.
1903 * testsuite/dwp_test_1b.s: New source file.
1904 * testsuite/dwp_test_2.cc: New source file.
1905 * testsuite/dwp_test_2.s: New source file.
1906 * testsuite/dwp_test_2.sh: New source file.
1907 * testsuite/dwp_test_main.cc: New source file.
1908 * testsuite/dwp_test_main.s: New source file.
1910 2012-10-23 Cary Coutant <ccoutant@google.com>
1912 * dwp.h: New header file.
1913 * dwp.cc: New source file.
1914 * gold.h: Move shared declarations to system.h.
1915 * system.h: New header file.
1916 * Makefile.am: Add dwp.
1917 * Makefile.in: Regenerate.
1919 2012-10-23 Cary Coutant <ccoutant@google.com>
1921 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1922 Dwarf_info_reader::read_from_pointer.
1923 (Dwarf_pubnames_table::read_header): Likewise.
1924 (Dwarf_pubnames_table::next_name): Likewise.
1925 (Dwarf_die::read_attributes): Likewise.
1926 (Dwarf_die::skip_attributes): Likewise.
1927 (Dwarf_info_reader::read_from_pointer): New function template.
1928 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1929 (Dwarf_pubnames_table): Likewise.
1930 (Dwarf_info_reader::read_from_pointer): New function template.
1931 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1932 Dwarf_pubnames_table ctor.
1934 2012-10-23 Cary Coutant <ccoutant@google.com>
1936 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1938 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1940 (Dwarf_info_reader::set_abbrev_shndx): New method.
1941 (Dwarf_info_reader::abbrev_shndx_): New data member.
1943 2012-10-23 Cary Coutant <ccoutant@google.com>
1945 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1946 from object, not parameters.
1947 (Dwarf_info_reader::parse): Likewise.
1948 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1949 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1950 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1953 2012-10-23 Cary Coutant <ccoutant@google.com>
1955 * fileread.cc (Input_file::Input_file): New constructor.
1956 * fileread.h (class Input_file): Add new constructor.
1958 2012-10-18 Alan Modra <amodra@gmail.com>
1961 * object.cc (Relobj::is_section_name_included): Also match
1962 .sdata personality section.
1964 2012-10-18 Alan Modra <amodra@gmail.com>
1966 * target-reloc.h (class Default_comdat_behavior): New, package up..
1967 (get_comdat_behaviour): ..this.
1968 (relocate_section): Add Relocate_comdat_behavior template arg,
1969 adjust code to suit.
1970 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1971 (Target_arm::scan_reloc_section): Likewise.
1972 * i386.cc (Target_i386::relocate_section): Likewise.
1973 * sparc.cc (Target_sparc::relocate_section): Likewise.
1974 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1975 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1976 * powerpc.cc (class Relocate_comdat_behavior): New.
1977 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1978 gold::relocate_section with new template arg.
1980 2012-10-18 Alan Modra <amodra@gmail.com>
1982 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1983 dynamic relocs for GOT_TPREL got entries, without symbol if
1985 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1986 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1987 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1989 2012-10-17 Alan Modra <amodra@gmail.com>
1992 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1994 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1996 * layout.cc (Layout::include_section): Keep sections marked
1997 SHF_EXCLUDE when doing relocatable links.
1999 2012-10-16 Alan Modra <amodra@gmail.com>
2001 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2002 (Target_powerpc::do_finalize_sections): Call it.
2003 (Output_data_save_res): New class and supporting functions.
2004 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2005 normal symbols defined in object files.
2007 2012-10-12 Alan Modra <amodra@gmail.com>
2009 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2010 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2011 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2012 section if scan_opd_relocs not yet called.
2013 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2015 2012-10-12 Alan Modra <amodra@gmail.com>
2017 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2018 add_local_ifunc_entry): Revert last change.
2019 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2021 2012-10-05 Alan Modra <amodra@gmail.com>
2023 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2024 do_plt_address_for_global): New functions.
2025 (Output_data_got_powerpc::do_write): Don't segfault when linking
2027 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2028 add_local_ifunc_entry): Return true on adding entry..
2029 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2030 glink->add_entry call. Remove unused symtab param. Adjust calls.
2031 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2032 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2033 set up symbols here.
2034 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2035 syms here. Do so even when no .iplt. Don't segfault when linking
2037 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2038 new variants without reloc param.
2039 (Glink_sym_ent::Glink_sym_ent): Likewise.
2040 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2041 reloc when refs will resolve to plt call stub.
2042 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2043 R_PPC_PLTREL24 to resolve locally.
2044 (Target_powerpc::Scan::global): Correct ifunc handling.
2045 (Target_powerpc::Relocate::relocate): Correct local sym glink
2046 lookup. Don't destroy "value" when we have a plt call stub,
2047 and when checking plt call validity.
2048 (Target_powerpc::do_dynsym_value): Simplify.
2050 2012-10-05 Alan Modra <amodra@gmail.com>
2052 * i386.cc (Output_data_plt_i386::address_for_global,
2053 address_for_local): Add plt offset to returned value. Adjust uses.
2054 * sparc.cc (Output_data_plt_sparc::address_for_global,
2055 address_for_local): Likewise.
2056 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2057 address_for_local): Likewise.
2058 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2059 address_for_local): Likewise.
2060 * target.h (Target::plt_address_for_global, plt_address_for_local):
2062 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2063 (Output_data_got::Got_entry::write): Nor here.
2064 * output.h: Comment fix.
2066 2012-10-02 Jiong Wang <jiwang@tilera.com>
2068 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2069 global_offset_table_ value for larget got.
2070 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2072 2012-09-29 Alan Modra <amodra@gmail.com>
2074 * powerpc.cc (Target_powerpc::iplt_): New output section.
2075 (Target_powerpc::iplt_section, make_iplt_section,
2076 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2077 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2078 Target_powerpc::plt_entry_count): Count iplt entries too.
2079 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2080 reloc section in constructor. New params.
2081 (Target_powerpc::make_plt_section): Create reloc section here instead.
2082 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2084 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2085 (Output_data_glink::add_entry, find_entry): New functions to
2086 deal with local syms.
2087 (Glink_sym_ent): Add support for local syms.
2088 (Output_data_glink::do_write): Handle ifunc plt entries.
2089 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2090 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2091 (Target_powerpc::Relocate::relocate): Likewise.
2092 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2094 2012-09-25 Alan Modra <amodra@gmail.com>
2096 * object.h (Sized_relobj_file::adjust_local_symbol,
2097 do_adjust_local_symbol): New functions.
2098 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2099 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2100 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2101 and irregular opd entry spacing.
2102 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2103 (Global_symbol_visitor_opd): New functor.
2104 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2105 on deleted opd entries.
2107 2012-09-15 Jiong Wang <jiwang@tilera.com>
2109 * tilegx.cc: New file.
2110 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2111 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2112 * configure.tgt: Add entries for tilegx*.
2113 * configure.ac: Likewise.
2114 * Makefile.in: Rebuild.
2115 * configure: Likewise.
2116 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2119 2012-09-13 Alan Modra <amodra@gmail.com>
2121 * target-reloc.h (scan_relocs): Call scan.local for relocs
2122 against symbols in discarded sections. Pass is_discarded
2124 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2125 Add is_discarded param.
2126 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2127 is_discarded to flag opd entry as discarded. Don't emit dyn
2128 relocs on such entries.
2129 (Target_powerpc::Scan::global): Similarly detect and handle
2131 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2132 opd_ent_. Update all uses.
2133 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2134 (Target_powerpc::relocate_section): Zero out discarded opd
2137 2012-09-12 Ian Lance Taylor <iant@google.com>
2140 * output.cc: Rename Output_data_got template parameter from size
2141 to got_size for all functions. Compile all variants of
2143 (Output_data_got::Got_entry::write): Correct use of size for
2144 symbol value. Use local_is_tls rather than casting to
2146 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2147 (class Sized_relobj_file): Add do_local_is_tls.
2148 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2150 2012-09-11 Alan Modra <amodra@gmail.com>
2153 * layout.cc (Layout::set_segment_offsets): When using
2154 common-page-size alignment, ensure we are on a new max-page-size
2156 * output.cc (Output_segment::set_section_addresses): Use
2157 abi_pagesize, not common_pagesize for relro boundary.
2158 (Output_segment::set_offset): Likewise.
2160 2012-09-11 Alan Modra <amodra@gmail.com>
2162 * output.h (Output_data_got::add_global_tls, add_local_tls,
2163 add_local_tls_pair): New functions.
2164 (Output_data_got::add_local_pair_with_rel): Remove second
2165 reloc param. Expand comment.
2166 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2167 use_plt_or_tls_offset_, similarly for constructor param.
2168 (Output_data_got::Got_entry::write): Add got_index param.
2169 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2170 add_local_tls_pair): New functions.
2171 (Output_data_got::Got_entry::write): Handle tls symbols
2172 with use_plt_or_tls_offset_ set specially.
2173 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2174 (Output_data_got::do_write): Replace iterator with index, pass
2175 index to entry write function.
2176 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2177 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2178 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2180 * i386.cc (Target_i386::Scan::local): Likewise.
2181 * sparc.cc (Target_sparc::Scan::local): Likewise.
2182 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2183 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2184 do_tls_offset_for_global): New functions.
2185 (Target_powerpc::Scan::local): Correct TLS relocations and got
2187 (Target_powerpc::Scan::global): Don't emit unnecessary
2188 dynamic relocations on TLS GOT entries.
2190 2012-09-10 Matthias Klose <doko@ubuntu.com>
2192 * config.in: Disable sanity check for kfreebsd.
2194 2012-09-10 Sterling Augustine <saugustine@google.com>
2196 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2197 (Gdb_index::pubtypes_read): New parameter.
2198 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2200 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2203 2012-09-09 Alan Modra <amodra@gmail.com>
2205 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2206 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2207 * gc.h (gc_process_relocs): Call target gc_add_reference.
2208 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2209 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2210 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2212 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2213 to cater for when we don't need code offset. Update use.
2214 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2215 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2216 set_opd_valid): New functions.
2217 (Target_powerpc::do_gc_add_reference): New function.
2218 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2220 (Target_powerpc::do_gc_mark_symbol): New function.
2222 2012-09-06 Cary Coutant <ccoutant@google.com>
2224 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2225 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2226 (Dwarf_die::skip_attributes): Likewise.
2227 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2228 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2230 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2232 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2234 * testsuite/script_test_3.t: Add .got.plt output section
2236 * testsuite/script_test_4.t: Likewise.
2238 2012-09-05 Alan Modra <amodra@gmail.com>
2240 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2241 update all uses and lose "enum" when using type.
2243 2012-09-05 Alan Modra <amodra@gmail.com>
2245 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2246 * configure: Regenerate.
2247 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2248 (plugin_final_layout.stdout): Likewise.
2249 (memory_test): Set page sizes to 0x1000.
2250 * testsuite/Makefile.in: Regenerate.
2251 * testsuite/discard_locals_test.sh: Add FIXME comment.
2252 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2253 * testsuite/pr14265.t: Add .got output section statement.
2254 * testsuite/script_test_2.t: Likewise.
2255 * testsuite/script_test_3.t: Likewise.
2256 * testsuite/script_test_4.t: Likewise.
2257 * testsuite/script_test_5.t: Likewise.
2258 * testsuite/script_test_6.t: Likewise.
2259 * testsuite/script_test_7.t: Likewise.
2260 * testsuite/script_test_9.t: Likewise.
2262 2012-09-05 Alan Modra <amodra@gmail.com>
2264 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2265 (Powerpc_relocate_functions::Status): New typedef.
2266 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2267 (Target_powerpc::Scan::local): Handle REL64.
2268 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2269 for REL32 and REL64.
2270 (Target_powerpc::symval_for_branch): New function, extracted from..
2271 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2272 checks. Report overflow errors.
2274 2012-09-05 Alan Modra <amodra@gmail.com>
2276 * object.h (Sized_relobj_file::emit_relocs): Delete.
2277 (Sized_relobj_file::emit_relocs_reltype): Delete.
2278 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2279 relocate_relocs for --emit-relocs.
2280 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2281 * output.h: Update comment.
2282 (Output_segment::first_section): New function.
2283 (Output_segment::first_section_load_address): Use first_section.
2284 * output.cc (Output_segment::first_section): New function extracted..
2285 (Output_segment::first_section_load_address): ..from here. Delete.
2286 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2287 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2288 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2289 adjust call to target.h function.
2290 * i386.cc (Target_i386): Likewise.
2291 * sparc.cc (Target_sparc): Likewise.
2292 * x86_64.cc (Target_x86_64): Likewise.
2293 * powerpc.cc (Target_powerpc): Likewise.
2294 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2295 first tls section has section symbol for optimised local dynamic
2297 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2298 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2300 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2301 Rename to relocate_relocs. Update error message.
2303 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2305 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2308 2012-08-31 Alan Modra <amodra@gmail.com>
2310 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2311 (Powerpc_relobj::toc_base_offset): New stub function.
2312 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2313 got_mod_index_offset to tlsld_got_offset. Update all refs.
2314 (Target_powerpc::Relocate::enum skip_tls): New.
2315 (Target_powerpc::call_tls_get_addr_): New var.
2316 (Target_powerpc::is_branch_reloc): Move to file scope.
2317 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2318 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2320 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2321 (powerpc_info): Correct common_pagesize for ppc64.
2322 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2323 (Powerpc_relocate_functions): Add overflow check enums and functions.
2324 Add non-shift version of rela, rela_ua. Delete all rel public
2325 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2326 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2327 addr16_ha3, addr14 functions.
2328 (Output_data_got_powerpc::add_constant_pair): New function.
2329 (Output_data_got_powerpc::got_base_offset): Likewise.
2330 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2331 (instruction constants): Sort, add some more.
2332 (Output_data_glink::do_write): Add and use Address typedef. Use
2333 object->toc_base_offset() stub for 64-bit.
2334 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2335 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2336 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2337 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2338 Always treat .opd relocs as against locally defined symbol.
2339 Correct condition for RELATIVE relocs.
2340 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2341 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2342 for 32-bit syms with a plt entry. Correct ppc64 toc base
2343 calculations. Handle TLS relocs, and more. Add overflow
2344 checking and adjust for Powerpc_relocate_functions changes.
2345 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2346 Reinstate --emit-relocs code with FIXME.
2348 2012-08-30 Alan Modra <amodra@gmail.com>
2350 * layout.cc (Layout::set_segment_offsets): Set p_align to
2351 abi_pagesize, not common_pagesize.
2352 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2353 to determine whether file header can go in segment.
2355 2012-08-30 Alan Modra <amodra@gmail.com>
2357 * output.h (Output_reloc::Output_reloc <output section>): Add
2358 is_relative param. Adjust calls.
2359 (Output_reloc::add_output_section_relative): New functions.
2360 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2362 (Output_reloc::symbol_value): Handle SECTION_CODE.
2364 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2366 * gold.cc (queue_middle_tasks): Call layout again when unique
2367 segments for sections is desired.
2368 * layout.cc (Layout::Layout): Initialize new members.
2369 (Layout::get_output_section_flags): New function.
2370 (Layout::choose_output_section): Call get_output_section_flags.
2371 (Layout::layout): Make output section for mapping to a unique segment.
2372 (Layout::insert_section_segment_map): New function.
2373 (Layout::attach_allocated_section_to_segment): Make unique segment for
2374 output sections marked so.
2375 (Layout::segment_precedes): Check for unique segments when sorting.
2376 * layout.h (Layout::Unique_segment_info): New struct.
2377 (Layout::Section_segment_map): New typedef.
2378 (Layout::insert_section_segment_map): New function.
2379 (Layout::get_output_section_flags): New function.
2380 (Layout::is_unique_segment_for_sections_specified): New function.
2381 (Layout::set_unique_segment_for_sections_specified): New function.
2382 (Layout::unique_segment_for_sections_specified_): New member.
2383 (Layout::section_segment_map_): New member.
2384 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2385 Rename is_gc_pass_one to is_pass_one.
2386 Rename is_gc_pass_two to is_pass_two.
2387 Rename is_gc_or_icf to is_two_pass.
2388 Check for which pass based on whether symbols data is present.
2389 Make it two pass when unique segments for sections is desired.
2390 * output.cc (Output_section::Output_section): Initialize new
2392 * output.h (Output_section::is_unique_segment): New function.
2393 (Output_section::set_is_unique_segment): New function.
2394 (Output_section::is_unique_segment_): New member.
2395 (Output_section::extra_segment_flags): New function.
2396 (Output_section::set_extra_segment_flags): New function.
2397 (Output_section::extra_segment_flags_): New member.
2398 (Output_section::segment_alignment): New function.
2399 (Output_section::set_segment_alignment): New function.
2400 (Output_section::segment_alignment_): New member.
2401 (Output_segment::Output_segment): Initialize is_unique_segment_.
2402 (Output_segment::is_unique_segment): New function.
2403 (Output_segment::set_is_unique_segment): New function.
2404 (Output_segment::is_unique_segment_): New member.
2405 * plugin.cc (allow_unique_segment_for_sections): New function.
2406 (unique_segment_for_sections): New function.
2407 (Plugin::load): Add new functions to transfer vector.
2408 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2409 * Makefile.in: Regenerate.
2410 * testsuite/plugin_final_layout.sh: Check if unique segment
2411 functionality works.
2412 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2414 (allow_unique_segment_for_sections): New global.
2415 (unique_segment_for_sections): New global.
2416 (claim_file_hook): Call allow_unique_segment_for_sections.
2417 (all_symbols_read_hook): Call unique_segment_for_sections.
2419 2012-08-22 Cary Coutant <ccoutant@google.com>
2421 * layout.cc (Layout::include_section): Don't assert on GROUP
2422 sections with --emit-relocs.
2424 2012-08-21 Cary Coutant <ccoutant@google.com>
2426 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2427 if --export-dynamic-symbol names an undef symbol.
2429 2012-08-18 Alan Modra <amodra@gmail.com>
2431 * powerpc.cc: Formatting and white space.
2432 (Powerpc_relobj): Rename got2_section_ to special_.
2433 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2434 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2435 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2436 (Target_powerpc): Add Address typedef and invalid_address. Use
2438 (Target_powerpc::is_branch_reloc): New function.
2439 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2440 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2441 for dst_mask, value and addend.
2442 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2443 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2444 (Output_data_glink::do_write): Correct toc base. Don't try to use
2445 uint16_t for 24-bit offset. Use get_output_section_offset and
2447 (Target_powerpc::Scan::local): Handle more relocs.
2448 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2449 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2450 Plug in toc restoring insn after plt calls. Translate branches
2451 to function descriptor symbols to corresponding entry point.
2452 (Target_powerpc::relocate_for_relocatable): Check return from
2453 get_output_section_offset.
2454 * symtab.h: Comment typo.
2456 2012-08-14 Ian Lance Taylor <iant@google.com>
2458 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2459 unsupported_relocal_local to call unsupported_reloc_global.
2461 2012-08-14 Nick Clifton <nickc@redhat.com>
2464 * script-sections.cc (Sections_element::output_section_name): Add
2465 keep return parameter.
2466 (Output_section_element::match_name): Add keep return parameter.
2467 Return the value of the keep_ member.
2468 * script-sections.h (class Output_section): Update
2469 output_section_name prototype.
2470 * layout.cc (Layout::keep_input_section): New public member
2472 (Layout::choose_output_section): Pass keep parameter to
2473 output_section_name.
2474 * layout.h (class Layout): Add keep_input_section.
2475 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2477 * testsuite/Makefile.am: Add a test.
2478 * testsuite/Makefile.in: Regenerate.
2479 * testsuite/pr14265.c: Source file for the test.
2480 * testsuite/pr14265.t: Linker script for the test.
2481 * testsuite/pr14265.sh: Shell script for the test.
2483 2012-08-14 Alan Modra <amodra@gmail.com>
2485 * target.h (Target::output_section_name): New function.
2486 (Target::do_output_section_name): New function.
2487 * layout.cc (Layout::choose_output_section): Call the above.
2488 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2490 2012-08-14 Alan Modra <amodra@gmail.com>
2492 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2493 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2494 for replace_constant call.
2495 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2496 (Output_data_glink::do_print_to_mapfile): New function.
2497 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2498 (Target_powerpc::Relocate::relocate): Likewise.
2500 2012-08-14 Alan Modra <amodra@gmail.com>
2502 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2503 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2504 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2505 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2506 all references to shndx_. Handle special case for R_PPC_PLTREL24
2508 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2509 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2510 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2512 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2513 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2515 2012-08-12 Alan Modra <amodra@gmail.com>
2517 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2518 (glink insn constants): Use uint32_t.
2519 (Output_data_glink::add_entry): Use insert, not [] operator.
2521 2012-08-11 Alan Modra <amodra@gmail.com>
2523 * object.h (Sized_relobj_file::find_shdr): New function.
2524 (Sized_relobj_file::find_special_sections): New function.
2525 * object.cc (Sized_relobj_file::find_shdr): New function.
2526 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2527 (Sized_relobj_file::find_special_sections): New function, split out..
2528 (Sized_relobj_file::do_read_symbols): ..from here.
2529 * output.h (Output_data_got::replace_constant): New function.
2530 (Output_data_got::num_entries): New function.
2531 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2532 (Output_data_got::got_offset): Protected rather than private.
2533 (Output_data_got::replace_got_entry): New function.
2534 * output.cc (Output_data_got::replace_got_entry): New function.
2535 * powerpc.cc (class Powerpc_relobj): New.
2536 (class Powerpc_relocate_functions): Delete all psymval variants or
2537 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2538 Implement _ha functions using corresponding _hi function.
2539 (Powerpc_relobj::find_special_sections): New function.
2540 (Target_powerpc::do_make_elf_object): New function.
2541 (class Output_data_got_powerpc): New.
2542 (class Output_data_glink): New.
2543 (class Powerpc_scan_relocatable_reloc): New.
2544 Many more changes througout file.
2546 2012-08-09 Nick Clifton <nickc@redhat.com>
2548 * po/vi.po: Updated Vietnamese translation.
2550 2012-08-07 Ian Lance Taylor <iant@google.com>
2552 * layout.cc (Layout::add_target_dynamic_tags): If
2553 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2556 2012-07-30 Nick Clifton <nickc@redhat.com>
2558 * po/gold.pot: Updated template.
2559 * po/es.po: Updated Spanish translation.
2561 2012-07-18 Cary Coutant <ccoutant@google.com>
2564 * configure.ac: Add check for -gpubnames support.
2565 * configure: Regenerate.
2566 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2567 support; force -gno-pubnames.
2568 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2570 (gdb_index_test_4): New test.
2571 * testsuite/Makefile.in: Regenerate.
2572 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2573 * testsuite/gdb_index_test_2.sh: Likewise.
2574 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2575 * testsuite/gdb_index_test_4.sh: New script.
2576 * testsuite/gdb_index_test_comm.sh: New script with common code;
2577 don't look for space after colon.
2579 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2581 * gold.cc (queue_middle_tasks): Update function order only after
2582 deferred objects due to plugins are processed.
2584 2012-07-11 Ian Lance Taylor <iant@google.com>
2586 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2587 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2588 (Target_arm::scan_reloc_for_stub): Likewise.
2589 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2590 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2591 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2592 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2593 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2595 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2596 Ian Lance Taylor <iant@google.com>
2599 * configure.ac: Test whether std::tr1::hash<off_t> works.
2600 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2602 * output.h (class Output_fill): Add virtual destructor.
2603 * configure, config.in: Rebuild.
2605 2012-06-22 Roland McGrath <mcgrathr@google.com>
2607 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2609 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2611 * plugin.cc (Plugin::load): Handle position independent executables.
2613 2012-06-06 Cary Coutant <ccoutant@google.com>
2615 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2617 (lines_only_debug_sections): Likewise.
2618 (gdb_fast_lookup_sections): New static array.
2619 (is_gdb_debug_section): Rename formal parameter.
2620 (is_lines_only_debug_section): Likewise.
2621 (is_gdb_fast_lookup_section): New function.
2622 (Layout::include_section): Check for ".zdebug_" prefix; pass
2623 section name suffix to is_gdb_debug_section, et al.; check for
2624 fast-lookup sections when building .gdb_index.
2625 * options.h (--strip-debug-gdb): Update GDB version number.
2627 2012-06-06 Cary Coutant <ccoutant@google.com>
2629 * configure.ac: Add check for fallocate.
2630 * configure: Regenerate.
2631 * config.in: Regenerate.
2633 * options.h (class General_options): Add --mmap-output-file and
2634 --posix-fallocate options.
2635 * output.cc: (posix_fallocate): Remove; replace with...
2636 (gold_fallocate): New function.
2637 (Output_file::map_no_anonymous): Call gold_fallocate.
2638 (Output_file::map): Check --mmap-output-file option.
2640 2012-06-05 Jing Yu <jingyu@google.com>
2642 * gold.h (textdomain): Add do {} to empty while(0).
2643 (bindtextdomain): Likewise.
2645 2012-06-04 Cary Coutant <ccoutant@google.com>
2647 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2650 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2652 * symtab.cc (Symbol_table::define_special_symbol):
2653 Initialize *poldsym to prevent uninitialized variable errors.
2655 2012-05-23 Cary Coutant <ccoutant@google.com>
2657 * layout.cc (Layout::section_name_mapping): Add rules to handle
2658 exact match on .data.rel.ro.local or .data.rel.ro.
2659 (Layout::output_section_name): Check for exact matches.
2661 2012-05-23 Cary Coutant <ccoutant@google.com>
2663 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2666 2012-05-22 Cary Coutant <ccoutant@google.com>
2668 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2669 object before exporting symbol.
2671 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2673 * testsuite/tls_test.cc: Include "config.h" first.
2674 * testsuite/tls_test_c.c: Likewise.
2676 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2677 Nick Clifton <nickc@redhat.com>
2680 * configure.in: Add check that sysdep.h has been included before
2681 any system header files.
2682 * configure: Regenerate.
2683 * config.in: Regenerate.
2685 2012-05-14 Cary Coutant <ccoutant@google.com>
2687 * layout.cc (Layout::make_output_section): Mark .tdata section
2689 * testsuite/relro_test.cc: Add a TLS variable.
2691 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2694 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2695 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2698 2012-05-08 Cary Coutant <ccoutant@google.com>
2700 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2701 (lines_only_debug_sections): Likewise.
2703 2012-05-02 Roland McGrath <mcgrathr@google.com>
2705 * nacl.cc: New file.
2707 * Makefile.am (CCFILES, HFILES): Add them.
2708 * Makefile.in: Regenerate.
2709 * i386.cc (Output_data_plt_i386_nacl): New class.
2710 (Output_data_plt_i386_nacl_exec): New class.
2711 (Output_data_plt_i386_nacl_dyn): New class.
2712 (Target_i386_nacl): New class.
2713 (Target_selector_i386_nacl): New class.
2714 (target_selector_i386): Use it instead of Target_selector_i386.
2715 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2716 (Target_x86_64_nacl): New class.
2717 (Target_selector_x86_64_nacl): New class.
2718 (target_selector_x86_64, target_selector_x32): Use it instead of
2719 Target_selector_x86_64.
2720 * arm.cc (Output_data_plt_arm_nacl): New class.
2721 (Target_arm_nacl): New class.
2722 (Target_selector_arm_nacl): New class.
2723 (target_selector_arm, target_selector_armbe): Use it instead of
2724 Target_selector_arm.
2726 * target-select.cc (select_target): Take new Input_file* and off_t
2727 arguments, pass them on to recognize method of selector.
2728 * object.cc (make_elf_sized_object): Update caller.
2729 * parameters.cc (parameters_force_valid_target): Likewise.
2730 * incremental.cc (make_sized_incremental_binary): Likewise.
2731 * target-select.h: Update decl.
2732 (Target_selector::recognize): Take new Input_file* argument,
2733 pass it on to do_recognize.
2734 (Target_selector::do_recognize): Take new Input_file* argument.
2735 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2736 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2737 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2738 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2740 * target.h (Target::Target_info): New members isolate_execinstr
2742 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2743 * arm.cc (Target_arm::arm_info): Update initializer.
2744 * i386.cc (Target_i386::i386_info): Likewise.
2745 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2746 * sparc.cc (Target_sparc::sparc_info): Likewise.
2747 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2748 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2749 * layout.cc (Layout::attach_allocated_section_to_segment):
2750 Take new const Target* argument. If target->isolate_execinstr(), act
2752 (Layout::find_first_load_seg): Take new const Target* argument;
2753 if target->isolate_execinstr(), reject PF_X segments.
2754 (Layout::relaxation_loop_body): Update caller.
2755 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2756 reset file offset to zero when we hit LOAD_SEG, and then do a second
2757 loop over the segments before LOAD_SEG to reassign offsets after
2758 addresses have been determined. Handle target->rosegment_gap().
2759 (Layout::attach_section_to_segment): Take new const Target* argument;
2760 pass it to attach_allocated_section_to_segment.
2761 (Layout::make_output_section): Update caller.
2762 (Layout::attach_sections_to_segments): Take new const Target* argument;
2763 pass it to attach_section_to_segment.
2764 * gold.cc (queue_middle_tasks): Update caller.
2765 * layout.h (Layout): Update method decls with new arguments.
2767 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2768 Target_info pointer to use.
2769 (Target_arm::do_make_data_plt): New virtual method.
2770 (Target_arm::make_data_plt): New method that calls it.
2771 (Target_arm::make_plt_entry): Use it.
2772 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2773 for the section alignment.
2774 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2776 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2777 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2779 (Output_data_plt_arm::get_plt_entry_size): Call it.
2780 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2781 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2782 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2784 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2785 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2786 method instead of sizeof(plt_entry).
2787 (Output_data_plt_arm::add_entry): Likewise.
2788 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2789 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2791 (Target_arm::plt_entry_size): Likewise.
2792 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2794 (Output_data_plt_arm_standard): ... here, new class.
2795 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2796 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2797 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2799 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2800 Take additional argument for the PLT entry size.
2801 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2802 Use get_plt_entry_size method rather than plt_entry_size variable.
2803 (Output_data_plt_x86_64::reserve_slot): Likewise.
2804 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2805 (Output_data_plt_x86_64::add_entry): Likewise.
2806 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2807 (Output_data_plt_x86_64::address_for_global): Likewise.
2808 (Output_data_plt_x86_64::address_for_local): Likewise.
2809 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2810 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2811 Make method non-static.
2812 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2814 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2815 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2816 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2817 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2819 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2820 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2822 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2823 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2825 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2826 (Output_data_plt_x86_64::plt_entry_size)
2827 (Output_data_plt_x86_64::first_plt_entry)
2828 (Output_data_plt_x86_64::plt_entry)
2829 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2830 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2831 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2832 (Output_data_plt_x86_64_standard): ... here, new class.
2833 (Target_x86_64::Target_x86_64): Take optional argument for the
2834 Target_info pointer to use.
2835 (Target_x86_64::do_make_data_plt): New virtual method.
2836 (Target_x86_64::make_data_plt): New method to call it.
2837 (Target_x86_64::init_got_plt_for_update): Use that.
2838 Call this->plt_->add_eh_frame method here.
2839 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2840 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2841 rather than static method.
2842 (Target_x86_64::plt_entry_size): Likewise.
2843 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2844 rather than plt_entry_size variable. Move guts of PLT filling to...
2845 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2846 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2847 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2849 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2850 additional argument for the section alignment.
2851 Don't do add_eh_frame_for_plt here.
2852 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2853 non-static. Use get_plt_entry_size method rather than plt_entry_size
2855 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2857 (Output_data_plt_i386::get_plt_entry_size): Call it.
2858 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2859 (Output_data_plt_i386::add_eh_frame): New method to call it.
2860 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2862 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2863 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2865 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2866 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2867 method instead of plt_entry_size.
2868 (Output_data_plt_i386::plt_entry_size)
2869 (Output_data_plt_i386::plt_eh_frame_fde_size)
2870 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2871 (Output_data_plt_i386_standard): ... here, new class.
2872 (Output_data_plt_i386_exec): New class.
2873 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2874 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2875 (Output_data_plt_i386::exec_plt_entry): Move to ...
2876 (Output_data_plt_i386_exec::plt_entry): ... here.
2877 (Output_data_plt_i386_dyn): New class.
2878 (Output_data_plt_i386::first_plt_entry): Move to ...
2879 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2880 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2881 (Output_data_plt_i386_dyn::plt_entry): ... here.
2882 (Target_i386::Target_i386): Take optional argument for the Target_info
2884 (Target_i386::do_make_data_plt): New virtual method.
2885 (Target_i386::make_data_plt): New method to call it.
2886 (Target_i386::make_plt_section): Use that.
2887 Call this->plt_->add_eh_frame method here.
2888 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2889 rather than plt_entry_size variable.
2890 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2891 (Output_data_plt_i386::address_for_local): Likewise.
2892 (Output_data_plt_i386::do_write): Likewise.
2893 Move guts of PLT filling to...
2894 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2895 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2896 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2897 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2899 2012-05-01 Cary Coutant <ccoutant@google.com>
2901 * dwarf_reader.cc (Dwarf_die::read_attributes)
2902 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2903 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2904 * reduced_debug_output.cc
2905 (Output_reduced_debug_info_section::get_die_end): Remove
2906 DW_FORM_GNU_ref_index. Add default case.
2908 2012-04-26 Mark Wielaard <mjw@redhat.com>
2910 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2911 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2912 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2913 DW_AT_high_pc as offset from DW_AT_low_pc.
2915 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2916 * testsuite/Makefile.in: Regenerate.
2917 * testsuite/gdb_index_test_3.c: New test source file.
2918 * testsuite/gdb_index_test_3.sh: New test source file.
2920 2012-04-25 Ian Lance Taylor <iant@google.com>
2922 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2924 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2925 as a class, not a struct.
2926 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2927 (Target_arm::apply_cortex_a8_workaround): Likewise.
2928 * gc.h: Declare Reloc_types as a struct, not a class.
2929 * object.h: Declare Symbols_data as a struct.
2930 * reloc.h: Declare Read_relocs_data as a struct.
2931 * target.h: Declare Relocate_info as a struct.
2933 2012-04-24 David S. Miller <davem@davemloft.net>
2935 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2936 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2939 2012-04-24 Cary Coutant <ccoutant@google.com>
2941 * incremental-dump.cc (find_input_containing_global): Replace
2942 magic number with symbolic constant.
2943 (dump_incremental_inputs): Update version number.
2944 * incremental.cc (Output_section_incremental_inputs): Update version
2945 number; import symbolic constants from Incremental_inputs_reader.
2946 (Incremental_inputs::create_data_sections): Align relocations
2947 section correctly for 64-bit targets.
2948 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2949 constants; add padding.
2950 (Output_section_incremental_inputs::write_header): Add assert for
2952 (Output_section_incremental_inputs::write_input_files): Add assert
2953 for input_entry_size.
2954 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2955 add assert for object_info_size, input_section_entry_size,
2956 global_sym_entry_size.
2957 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2958 for data structure sizes; use them.
2959 (Incremental_input_entry_reader): Import symbolic constants from
2960 Incremental_inputs_reader; use them.
2962 2012-04-23 David S. Miller <davem@davemloft.net>
2964 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2966 (Target_sparc::Target_sparc): Initialize new fields.
2967 (Target_sparc::do_make_elf_object): New function.
2968 (Target_sparc::do_adjust_elf_header): New function.
2970 2012-04-23 Cary Coutant <ccoutant@google.com>
2972 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2973 CU range table of gdb index.
2975 2012-04-20 David S. Miller <davem@davemloft.net>
2977 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2980 2012-04-16 David S. Miller <davem@davemloft.net>
2982 * sparc.cc (Target_sparc::got_address): New function.
2983 (Sparc_relocate_functions::gdop_hix22): New function.
2984 (Sparc_relocate_functions::gdop_lox10): New function.
2985 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2987 (Target_sparc::Scan::local): Likewise if the global symbol is not
2988 preemptible and is not IFUNC.
2989 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2990 transformations for local and non-preemptible non-IFUNC global
2993 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2994 writing out 64-bit part of ranges.
2996 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2997 -fpic and -fpie respectively.
2998 * Makefile.in: Regenerate.
3000 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3001 (Target_sparc::Target_sparc): Initialize new field.
3002 (Target_sparc::do_plt_section_for_global): New function.
3003 (Target_sparc::do_plt_section_for_local): New function.
3004 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3005 (Target_sparc::make_plt_section): New function, broken out of
3006 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3007 (Target_sparc::make_plt_entry): Call make_plt_section.
3008 (Target_sparc::make_local_ifunc_plt_entry): New function.
3009 (Target_sparc::rela_ifunc_section): New function.
3010 (Target_sparc::plt_section): Remove const.
3011 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3012 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3013 and ifunc_count_ fields.
3014 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3015 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3016 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3017 (Output_data_plt_sparc::rela_ifunc): New function.
3018 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3019 (Output_data_plt_sparc::has_ifunc_section): New function.
3020 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3021 (Output_data_plt_sparc::address_for_global): New function.
3022 (Output_data_plt_sparc::address_for_local): New function.
3023 (Output_data_plt_sparc::plt_index_to_offset): New function.
3024 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3026 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3028 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3029 R_SPARC_JMP_IREL to switch.
3030 (Target_sparc::Scan::check_non_pic): Likewise.
3031 (Target_sparc::Scan::local): Handle IFUNC symbols.
3032 (Target_sparc::Scan::local): Likewise.
3033 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3034 and plt_address_for_local.
3035 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3036 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3038 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3039 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3040 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3041 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3043 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3044 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3046 * sparc.cc (Target_sparc::Scan::global): Likewise.
3047 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3049 2012-04-16 Cary Coutant <ccoutant@google.com>
3051 * archive.cc (Library_base::should_include_member): Check for
3052 --export-dynamic-symbol.
3053 * options.h (class General_options): Add --export-dynamic-symbol.
3054 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3055 --export-dynamic-symbol.
3056 (Symbol_table::gc_mark_undef_symbols): Likewise.
3057 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3059 2012-04-12 David S. Miller <davem@davemloft.net>
3061 * sparc.cc (Reloc::wdisp10): New relocation method.
3062 (Reloc::h34): Likewise.
3063 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3064 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3066 (Target_sparc::Scan::local): Likewise.
3067 (Target_sparc::Scan::global): Likewise.
3068 (Target_sparc::Relocate::relocate): Likewise.
3070 2012-04-09 Cary Coutant <ccoutant@google.com>
3072 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3075 2012-04-06 Ian Lance Taylor <iant@google.com>
3077 * timer.cc: #include <unistd.h>.
3079 2012-04-06 Roland McGrath <mcgrathr@google.com>
3081 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3082 * config.in: Regenerate.
3083 * configure: Regenerate.
3085 2012-04-05 Nick Clifton <nickc@redhat.com>
3087 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3088 (AM_LC_MESSAGES): Add.
3089 * aclocal.m4: Regenerate.
3090 * config.in: Regenerate.
3091 * configure: Regenerate.
3093 2012-03-21 Cary Coutant <ccoutant@google.com>
3095 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3096 * Makefile.in: Regenerate.
3097 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3098 (Sized_elf_reloc_mapper::symbol_section): New function.
3099 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3100 (make_elf_reloc_mapper): New function.
3101 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3102 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3103 (Dwarf_abbrev_table::do_get_abbrev): New function.
3104 (Dwarf_ranges_table::read_ranges_table): New function.
3105 (Dwarf_ranges_table::read_range_list): New function.
3106 (Dwarf_pubnames_table::read_section): New function.
3107 (Dwarf_pubnames_table::read_header): New function.
3108 (Dwarf_pubnames_table::next_name): New function.
3109 (Dwarf_die::Dwarf_die): New function.
3110 (Dwarf_die::read_attributes): New function.
3111 (Dwarf_die::skip_attributes): New function.
3112 (Dwarf_die::set_name): New function.
3113 (Dwarf_die::set_linkage_name): New function.
3114 (Dwarf_die::attribute): New function.
3115 (Dwarf_die::string_attribute): New function.
3116 (Dwarf_die::int_attribute): New function.
3117 (Dwarf_die::uint_attribute): New function.
3118 (Dwarf_die::ref_attribute): New function.
3119 (Dwarf_die::child_offset): New function.
3120 (Dwarf_die::sibling_offset): New function.
3121 (Dwarf_info_reader::check_buffer): New function.
3122 (Dwarf_info_reader::parse): New function.
3123 (Dwarf_info_reader::do_parse): New function.
3124 (Dwarf_info_reader::do_read_string_table): New function.
3125 (Dwarf_info_reader::lookup_reloc): New function.
3126 (Dwarf_info_reader::get_string): New function.
3127 (Dwarf_info_reader::visit_compilation_unit): New function.
3128 (Dwarf_info_reader::visit_type_unit): New function.
3129 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3130 Sized_elf_reloc_mapper.
3131 (Sized_dwarf_line_info::symbol_section): Remove function.
3132 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3133 (Sized_dwarf_line_info::read_line_mappings): Remove object
3134 parameter, adjust callers.
3135 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3136 * dwarf_reader.h: Include <sys/types.h>.
3137 (class Track_relocs): Remove forward declaration.
3138 (class Elf_reloc_mapper): New class.
3139 (class Sized_elf_reloc_mapper): New class.
3140 (class Dwarf_abbrev_table): New class.
3141 (class Dwarf_range_list): New class.
3142 (class Dwarf_ranges_table): New class.
3143 (class Dwarf_pubnames_table): New class.
3144 (class Dwarf_die): New class.
3145 (class Dwarf_info_reader): New class.
3146 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3147 (Sized_dwarf_line_info::symbol_section): Remove member function.
3148 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3150 * gdb-index.cc: New source file.
3151 * gdb-index.h: New source file.
3152 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3153 and .debug_types sections, call Layout::add_to_gdb_index.
3154 (Sized_relobj_incr::do_section_name): Implement.
3155 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3156 return type; Implement.
3157 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3159 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3160 parameter list and return type.
3161 (Sized_incr_dynobj::do_section_contents): Likewise.
3162 * layout.cc: Include gdb-index.h.
3163 (Layout::Layout): Initialize gdb_index_data_.
3164 (Layout::init_fixed_output_section): Check for .gdb_index section.
3165 (Layout::add_to_gdb_index): New function. Instantiate.
3166 * layout.h: Add forward declaration for class Gdb_index.
3167 (Layout::add_to_gdb_index): New member function.
3168 (Layout::gdb_index_data_): New data member.
3169 * main.cc: Include gdb-index.h.
3170 (main): Print statistics for gdb index.
3171 * object.cc (Object::section_contents): Move code into
3172 do_section_contents.
3173 (need_decompressed_section): Check for sections needed when building
3175 (build_compressed_section_map): Likewise.
3176 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3178 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3179 sections; call Layout::add_to_gdb_index.
3180 (Sized_relobj_file::do_decompressed_section_contents): Call
3181 do_section_contents directly.
3182 * object.h (Object::do_section_contents): Adjust parameter list and
3184 (Object::do_decompressed_section_contents): Call do_section_contents
3186 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3188 * options.h (class General_options): Add --gdb-index option.
3189 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3190 list and return type.
3191 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3192 * reloc.h (Track_relocs::checkpoint): New function.
3193 (Track_relocs::reset): New function.
3195 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3197 * testsuite/Makefile.in: Regenerate.
3198 * testsuite/gdb_index_test.cc: New test source file.
3199 * testsuite/gdb_index_test_1.sh: New test source file.
3200 * testsuite/gdb_index_test_2.sh: New test source file.
3202 2012-03-19 Doug Kwan <dougkwan@google.com>
3204 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3205 (Target_arm::do_finalize_sections): Remove code which defines
3206 __exidx_start and __exidx_end. Make symbol table parameter
3207 anonymous as it is not used.
3208 * gold.cc (queue_middle_tasks): Call target hook to define any
3209 target-specific symbols.
3210 * target.h (Target::define_standard_symbols): New method.
3211 (Target::do_define_standard_symbols): Same.
3212 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3213 * testsuite/Makefile.in: Regenerate.
3214 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3216 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3217 relocations are generated for __exidx_start and __exidx_end.
3219 2012-03-16 Doug Kwan <dougkwan@google.com>
3221 * testsuite/Makefile.am: Disable test initpri3b.
3222 * testsuite/Makefile.in: Regenerate.
3224 2012-03-15 Doug Kwan <dougkwan@google.com>
3226 * arm.cc (Target_arm::got_section): Make .got section read-only
3229 2012-03-15 Ian Lance Taylor <iant@google.com>
3232 * layout.cc (Layout::make_output_section): Correctly mark
3233 SHT_INIT_ARRAY, et. al., as relro.
3235 2012-03-14 Doug Kwan <dougkwan@google.com>
3237 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3238 dynamic relocations for protected symbols in shared objects.
3240 2012-03-13 Ian Lance Taylor <iant@google.com>
3242 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3243 keep the larger alignment.
3245 2012-03-12 Cary Coutant <ccoutant@google.com>
3247 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3248 handling of DW_LNE_define_file.
3250 2012-03-12 Cary Coutant <ccoutant@google.com>
3252 * reduced_debug_output.cc
3253 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3256 2012-02-29 Cary Coutant <ccoutant@google.com>
3258 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3260 2012-02-29 Cary Coutant <ccoutant@google.com>
3262 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3263 Call Object::decompressed_section_contents.
3264 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3266 (Sized_dwarf_line_info::buffer_start_): New data member.
3267 * merge.cc (Output_merge_data::do_add_input_section): Call
3268 Object::decompressed_section_contents.
3269 (Output_merge_string::do_add_input_section): Likewise.
3270 * object.cc (need_decompressed_section): New function.
3271 (build_compressed_section_map): Decompress sections needed later.
3272 (Sized_relobj_file::do_decompressed_section_contents): New function.
3273 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3274 * object.h (Object::decompressed_section_contents): New function.
3275 (Object::discard_decompressed_sections): New function.
3276 (Object::do_decompressed_section_contents): New function.
3277 (Object::do_discard_decompressed_sections): New function.
3278 (Compressed_section_info): New type.
3279 (Compressed_section_map): Include decompressed section contents.
3280 (Sized_relobj_file::do_decompressed_section_contents): New function.
3281 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3283 2012-02-16 Cary Coutant <ccoutant@google.com>
3285 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3286 * testsuite/Makefile.in: Regenerate.
3288 2012-02-14 Cary Coutant <ccoutant@google.com>
3290 * options.cc (General_options::finalize): Disallow -pie and -static.
3292 2012-02-03 Doug Kwan <dougkwan@google.com>
3294 * arm.cc (Arm_relocate_functions::abs8,
3295 Arm_relocate_functions::abs16): Use
3296 Bits::has_signed_unsigned_overflow32.
3297 (Arm_relocate_functions::thm_abs8): Correct range of
3299 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3302 2012-02-02 Doug Kwan <dougkwan@google.com>
3304 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3305 position independent outputs, not just shared objects.
3307 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3309 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3310 * configure: Regenerated.
3312 2012-01-27 Ian Lance Taylor <iant@google.com>
3314 * reloc.h (Bits): New class with static functions, copied from
3315 namespace utils in arm.cc.
3316 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3319 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3321 * incremental.cc (write_info_blocks): Correct relocation offset.
3323 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3325 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3326 (Relocate::tls_gd_to_le): Likewise.
3328 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3330 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3332 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3334 * configure.ac: Check if -mcmodel=medium works.
3335 * configure: Regenerated.
3337 2012-01-24 Cary Coutant <ccoutant@google.com>
3339 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3341 (read_unsigned_LEB_128_x): ... this new function.
3342 (read_signed_LEB_128): Replaced with inline definition and ...
3343 (read_signed_LEB_128_x): ... this new function.
3344 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3345 (read_unsigned_LEB_128): Add inline definition.
3346 (read_signed_LEB_128_x): New function.
3347 (read_signed_LEB_128): Add inline definition.
3348 * testsuite/Makefile.am (leb128_unittest): New unit test.
3349 * testsuite/Makefile.in: Regenerate.
3350 * testsuite/leb128_unittest.cc: New unit test.
3352 2012-01-23 Ian Lance Taylor <iant@google.com>
3355 * i386.cc (Target_i386::do_code_fill): When using a jmp
3356 instruction, pad with nop instructions.
3357 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3359 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3361 * x86_64.cc (gc_process_relocs): Add typename on types used in
3363 (scan_relocs): Likewise.
3364 (relocate_section): Likewise.
3365 (apply_relocation): Likewise.
3367 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3369 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3370 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3373 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3375 * x86_64.cc: Initial support for x32.
3377 2012-01-03 Cary Coutant <ccoutant@google.com>
3379 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3380 Use abstract base class for GOT.
3381 * gold/output.h (class Output_data_got_base): New abstract base class.
3382 (class Output_data_got): Derive from new base class, adjust ctors.
3383 (Output_data_got::reserve_slot): Make virtual; rename to
3384 do_reserve_slot; Adjust callers.
3385 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3386 pointer to abstract base class.
3387 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3389 2011-12-18 Ian Lance Taylor <iant@google.com>
3391 * object.h (Relobj::local_symbol_value): New function.
3392 (Relobj::local_plt_offset): New function.
3393 (Relobj::local_has_got_offset): New function.
3394 (Relobj::local_got_offset): New function.
3395 (Relobj::set_local_got_offset): New function.
3396 (Relobj::do_local_symbol_value): New pure virtual function.
3397 (Relobj::do_local_plt_offset): Likewise.
3398 (Relobj::do_local_has_got_offset): Likewise.
3399 (Relobj::do_local_got_offset): Likewise.
3400 (Relobj::do_set_local_got_offset): Likewise.
3401 (Sized_relobj::do_local_has_got_offset): Rename from
3402 local_has_got_offset.
3403 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3404 (Sized_relobj::do_set_local_got_offset): Rename from
3405 set_local_got_offset.
3406 (Sized_relobj_file::do_local_plt_offset): Rename from
3408 (Sized_relobj_file::do_local_symbol_value): New function.
3409 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3411 * output.cc (Output_data_got::Got_entry::write): Change object to
3412 Relobj. Use local_symbol_value.
3413 (Output_data_got::add_global_with_rel): Change rel_dyn to
3414 Output_data_reloc_generic*. Use add_global_generic.
3415 (Output_data_got::add_global_with_rela): Remove. Change all
3416 callers to use add_global_with_rel.
3417 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3418 Output_data_reloc_generic*. Use add_global_generic.
3419 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3420 callers to use add_global_pair_with_rel.
3421 (Output_data_got::add_local): Change object to Relobj*.
3422 (Output_data_got::add_local_plt): Likewise.
3423 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3424 change rel_dyn to Output_data_reloc_generic*. Use
3426 (Output_data_got::add_local_with_rela): Remove. Change all
3427 callers to use all_local_with_rel.
3428 (Output_data_got::add_local_pair_with_rel): Change object to
3429 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3430 add_output_section_generic.
3431 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3432 callers to use add_local_pair_with_rel.
3433 (Output_data_got::reserve_local): Change object to Relobj*.
3434 * output.h: (class Output_data_reloc_generic): Add pure virtual
3435 declarations for add_global_generic, add_local_generic,
3436 add_output_section_generic.
3437 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3438 functions for Output_data_reloc_generic. Update declarations for
3439 changes listed in output.cc.
3440 (class Output_data_got): Change template parameter to got_size.
3441 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3442 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3444 (Sized_relobj_incr::do_local_plt_offset): New function.
3445 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3448 2011-12-17 Cary Coutant <ccoutant@google.com>
3450 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3451 * resolve.cc (Symbol_table::resolve): Likewise.
3452 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3454 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3456 2011-12-16 Ian Lance Taylor <iant@google.com>
3458 * output.h (Output_data_reloc_generic::add): Only call
3459 add_dynamic_reloc if this is a dynamic reloc section.
3461 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3464 * target-reloc.h (apply_relocation): Replace <64, false> with
3467 2011-11-25 Nick Clifton <nickc@redhat.com>
3469 * po/it.po: New Italian translation.
3471 2011-11-17 Sterling Augustine <saugustine@google.com>
3473 * script.cc (script_include_directive): Implement.
3474 (read_script_file): New local variables name and search_path. Update
3475 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3476 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3477 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3479 2011-11-11 Sterling Augustine <saugustine@google.com>
3481 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3482 (file_or_sections_cmd): Likewise.
3484 2011-11-11 Doug Kwan <dougkwan@google.com>
3486 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3487 if --just-symbols is given.
3489 2011-11-10 Doug Kwan <dougkwan@google.com>
3492 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3493 when processing data relocs.
3494 * reloc.h (Relocate_functions::rel_unaligned): New method.
3495 (Relocate_functions::pcrel_unaligned): Ditto.
3496 (Relocate_functions::rel32_unaligned): Ditto.
3497 (Relocate_functions::pcrel32_unaligned): Ditto.
3499 2011-11-09 Doug Kwan <dougkwan@google.com>
3502 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3503 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3504 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3505 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3506 (Relocate_functions::rel_unaligned): New.
3507 (Relocate_functions::rel32_unaligned): New.
3508 * target-reloc.h (relocate_for_relocatable): Add code to handle
3509 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3510 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3511 arm_unaligned_reloc_r): New targets.
3512 * testsuite/Makefile.in: Regenerate.
3513 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3516 2011-11-02 Ian Lance Taylor <iant@google.com>
3518 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3520 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3521 * options.cc (General_options::finalize): Use library search path
3522 from configure script if specified. If not native and no sysroot,
3523 only search TOOLLIBDIR.
3524 * options.h (Search_directory::Search_directory): Change name to
3526 (General_options::add_to_library_path_with_sysroot): Change arg to
3528 * configure, Makefile.in, config.in: Rebuild.
3530 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3532 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3533 we are working around the ARM1176 Erratum.
3534 * options.h (General_options::fix_arm1176): Add option.
3535 * testsuite/Makefile.am: Add testcases, and keep current ones
3537 * testsuite/Makefile.in: Regenerate.
3538 * testsuite/arm_fix_1176.s: New file.
3539 * testsuite/arm_fix_1176.sh: Likewise.
3541 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3543 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3545 (Target_arm::may_use_blx): Remove method.
3546 (Target_arm::set_may_use_blx): Likewise.
3547 (Target_arm::may_use_v4t_interworking): New method.
3548 (Target_arm::may_use_v5t_interworking): Likewise.
3549 (Target_arm::may_use_blx_): Remove member variable.
3550 (Arm_relocate_functions::arm_branch_common): Check for v5T
3552 (Arm_relocate_functions::thumb_branch_common): Likewise.
3553 (Reloc_stub::stub_type_for_reloc): Likewise.
3554 (Target_arm::do_finalize_sections): Correct interworking checks.
3555 * testsuite/Makefile.am: Add new tests.
3556 * testsuite/Makefile.in: Regenerate.
3557 * testsuite/arm_farcall_arm_arm.s: New test.
3558 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3559 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3560 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3561 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3562 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3563 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3564 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3566 2011-10-31 Cary Coutant <ccoutant@google.com>
3569 * expression.cc (Expression::eval_with_dot): Add
3570 is_section_dot_assignment parameter.
3571 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3572 absolute and assigning to dot within a section.
3573 * script-sections.cc
3574 (Output_section_element_assignment::set_section_addresses): Pass
3575 dot_section to set_if_absolute.
3576 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3577 as is_section_dot_assignment flag to eval_with_dot.
3578 (Output_section_element_dot_assignment::set_section_addresses):
3580 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3581 parameter. Also set value if relative to dot_section; set the
3582 symbol's output_section.
3583 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3584 parameter. Adjust all callers.
3585 (Expression::eval_maybe_dot): Likewise.
3586 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3588 * testsuite/script_test_2.t: Test assignment of an absolute value
3589 to dot within an output section element.
3591 2011-10-31 Cary Coutant <ccoutant@google.com>
3593 * options.h (class General_options): Add --[no-]gnu-unique options.
3594 * symtab.cc (Symbol_table::sized_write_globals): Convert
3595 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3597 2011-10-31 Cary Coutant <ccoutant@google.com>
3600 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3601 unnecessary assertion.
3602 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3604 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3606 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3608 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3610 Change to just keep the section associated with symbol.
3611 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3612 they are externally visible and --export-dynamic is turned on.
3613 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3615 2011-10-19 Ian Lance Taylor <iant@google.com>
3618 * script-sections.cc
3619 (Output_section_element_dot_assignment::needs_output_section): New
3622 2011-10-19 Ian Lance Taylor <iant@google.com>
3625 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3626 --section-start option was seen.
3627 * options.h (General_options::any_section_start): New function.
3629 2011-10-18 David S. Miller <davem@davemloft.net>
3632 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3633 member to track relocation locations that have moved during TLS
3634 reloc optimizations.
3635 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3636 (Target_sparc::Relocate::relocate): Adjust view down by 4
3637 bytes if it matches reloc_adjust_addr_.
3638 (Target_sparc::Relocate::relocate_tls): Always move the
3639 __tls_get_addr call delay slot instruction forward 4 bytes when
3640 performing relaxation.
3642 2011-10-18 Cary Coutant <ccoutant@google.com>
3644 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3645 (Output_file::map_no_anonymous): Check for non-zero
3646 return code from posix_fallocate.
3648 2011-10-17 Cary Coutant <ccoutant@google.com>
3651 * plugin.cc (is_visible_from_outside): Check for symbols
3652 referenced from dynamic objects.
3653 * resolve.cc (Symbol_table::resolve): Don't count references
3654 from dynamic objects as references from real ELF files.
3655 * testsuite/plugin_test_2.sh: Adjust expected result.
3657 2011-10-17 Cary Coutant <ccoutant@google.com>
3659 * gold.cc: Include timer.h.
3660 (queue_middle_tasks): Stamp time.
3661 (queue_final_tasks): Likewise.
3662 * main.cc (main): Store timer in parameters. Print timers
3664 * parameters.cc (Parameters::Parameters): Initialize timer_.
3665 (Parameters::set_timer): New function.
3666 (set_parameters_timer): New function.
3667 * parameters.h (Parameters::set_timer): New function.
3668 (Parameters::timer): New function.
3669 (Parameters::timer_): New data member.
3670 (set_parameters_timer): New function.
3671 * timer.cc (Timer::stamp): New function.
3672 (Timer::get_pass_time): New function.
3673 * timer.h (Timer::stamp): New function.
3674 (Timer::get_pass_time): New function.
3675 (Timer::pass_times_): New data member.
3677 2011-10-17 Cary Coutant <ccoutant@google.com>
3679 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3680 task for members of lib groups.
3682 2011-10-17 Cary Coutant <ccoutant@google.com>
3685 * fileread.cc (File_read::find_view): Add assert.
3686 (File_read::make_view): Move bounds check (replace with assert)...
3687 (File_read::find_or_make_view): ... to here.
3689 2011-10-12 Cary Coutant <ccoutant@google.com>
3691 * output.cc (Output_file::open_base_file): Handle case where
3692 ::read returns less than requested size.
3694 2011-10-10 Cary Coutant <ccoutant@google.com>
3696 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3697 Initialize defined_count_.
3698 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3699 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3700 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3701 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3702 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3703 * incremental.h (Sized_relobj_incr::defined_count_): New data
3705 (Sized_incr_dynobj::defined_count_): New data member.
3706 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3707 Return zeroes instead of internal error.
3709 2011-10-10 Cary Coutant <ccoutant@google.com>
3712 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3713 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3714 * output.h (class Output_reloc): Add use_plt_offset flag.
3715 (Output_reloc::type_): Adjust size of bit field.
3716 (Output_reloc::use_plt_offset_): New bit field.
3717 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3718 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3719 flag. Adjust all callers.
3720 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3721 creating RELATIVE relocations.
3723 2011-10-10 Nick Clifton <nickc@redhat.com>
3725 * po/es.po: Updated Spanish translation.
3726 * po/fi.po: Updated Finnish translation.
3728 2011-10-03 Diego Novillo <dnovillo@google.com>
3730 * options.cc (parse_uint): Fix dereference of RETVAL.
3732 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3734 * layout.h (section_order_map_): New member.
3735 (get_section_order_map): New member function.
3736 * output.cc (Output_section::add_input_section): Check for patterns
3737 only when --section-ordering-file is specified.
3738 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3739 output_sections have been formed.
3740 * layout.cc (Layout_Layout): Initialize section_order_map_.
3741 * plugin.cc (update_section_order): Store order in order_map. Do not
3743 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3744 * testsuite/Makefile.in: Regenerate.
3745 * testsuite/plugin_section_order.c: New file.
3746 * testsuite/plugin_final_layout.cc: New file.
3747 * testsuite/plugin_final_layout.sh: New file.
3749 2011-09-29 Cary Coutant <ccoutant@google.com>
3751 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3753 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3754 symbols during incremental update.
3755 (Symbol_table::add_from_dynobj): Likewise.
3757 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3758 Ian Lance Taylor <iant@google.com>
3760 * symtab.cc (Symbol_table::define_special_symbol): Always
3761 canonicalize version string.
3763 2011-09-26 Cary Coutant <ccoutant@google.com>
3765 * gold.cc (queue_initial_tasks): Move option checks ...
3766 * options.cc (General_options::finalize): ... to here. Disable
3767 some options; make others fatal.
3769 2011-09-26 Cary Coutant <ccoutant@google.com>
3772 * plugin.cc (get_symbols_v2): New function.
3773 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3774 (is_referenced_from_outside): New function.
3775 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3776 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3777 (get_symbols): Pass version parameter.
3778 (get_symbols_v2): New function.
3779 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3781 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3782 (onload): Add LDPT_GET_SYMBOLS_V2.
3783 (all_symbols_read_hook): Use get_symbols_v2; check for
3784 LDPR_PREVAILING_DEF_IRONLY_EXP.
3785 * testsuite/plugin_test_3.sh: Update expected results.
3787 2011-09-23 Simon Baldwin <simonb@google.com>
3789 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3790 configuration options.
3791 * configure: Regenerate.
3792 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3793 * Makefile.in: Regenerate.
3794 * testsuite/Makefile.in: Regenerate.
3796 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3798 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3800 2011-09-19 Cary Coutant <ccoutant@google.com>
3802 * incremental.cc (can_incremental_update): Fix typo in comment.
3803 * incremental.h (can_incremental_update): Likewise.
3805 2011-09-18 Cary Coutant <ccoutant@google.com>
3807 * incremental.cc (can_incremental_update): New function.
3808 * incremental.h (can_incremental_update): New function.
3809 * layout.cc (Layout::init_fixed_output_section): Call it.
3810 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3811 * object.cc (Sized_relobj_file::do_layout): Call
3812 can_incremental_update.
3814 2011-09-13 Cary Coutant <ccoutant@google.com>
3816 * configure.ac: Check for glibc support for gnu_indirect_function
3817 support with static linking, setting automake conditional
3819 * Makefile.in: Regenerate.
3820 * configure: Regenerate.
3822 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3823 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3825 * testsuite/Makefile.in: Regenerate.
3827 2011-09-13 Cary Coutant <ccoutant@google.com>
3829 * incremental.cc (Sized_relobj_incr::do_layout): Call
3830 report_comdat_group for kept comdat sections.
3831 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3832 * testsuite/Makefile.in: Regenerate.
3833 * testsuite/incr_comdat_test_1.cc: New source file.
3834 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3835 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3836 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3838 2011-09-13 Ian Lance Taylor <iant@google.com>
3840 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3841 variable external_symbols_offset.
3843 2011-09-12 Ian Lance Taylor <iant@google.com>
3845 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3846 triggered if object has no symbols.
3848 2011-09-09 David S. Miller <davem@davemloft.net>
3850 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3851 (Output_fill_debug_line::do_write): Likewise.
3853 2011-08-29 Cary Coutant <ccoutant@google.com>
3855 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3856 casts to match formatting specs.
3857 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3859 2011-08-26 Cary Coutant <ccoutant@google.com>
3861 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3862 remaining hole size when allocating.
3863 (Layout::make_output_section): Set fill methods for debug sections.
3864 * layout.h (Free_list::Free_list_node): Move from private to
3866 (Free_list::set_min_hole_size): New function.
3867 (Free_list::begin, Free_list::end): New functions.
3868 (Free_list::min_hole_): New data member.
3869 * output.cc: Include dwarf.h.
3870 (Output_fill_debug_info::do_minimum_hole_size): New function.
3871 (Output_fill_debug_info::do_write): New function.
3872 (Output_fill_debug_line::do_minimum_hole_size): New function.
3873 (Output_fill_debug_line::do_write): New function.
3874 (Output_section::Output_section): Initialize new data member.
3875 (Output_section::set_final_data_size): Ensure patch space is larger
3876 than minimum hole size.
3877 (Output_section::do_write): Fill holes in debug sections.
3878 * output.h (Output_fill): New class.
3879 (Output_fill_debug_info): New class.
3880 (Output_fill_debug_line): New class.
3881 (Output_section::set_free_space_fill): New function.
3882 (Output_section::free_space_fill_): New data member.
3883 * testsuite/Makefile.am (incremental_test_3): Add
3884 --incremental-patch option.
3885 (incremental_test_4): Likewise.
3886 (incremental_test_5): Likewise.
3887 (incremental_test_6): Likewise.
3888 (incremental_copy_test): Likewise.
3889 (incremental_common_test_1): Likewise.
3890 * testsuite/Makefile.in: Regenerate.
3892 2011-08-26 Nick Clifton <nickc@redhat.com>
3894 * po/es.po: Updated Spanish translation.
3896 2011-08-01 Cary Coutant <ccoutant@google.com>
3898 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3899 * gold/testsuite/Makefile.in: Regenerate.
3900 * gold/testsuite/justsyms_exec.c: New source file.
3901 * gold/testsuite/justsyms_lib.c: New source file.
3903 2011-08-01 Cary Coutant <ccoutant@google.com>
3905 * layout.cc (Layout::set_segment_offsets): Don't realign text
3906 segment if -Ttext was specified.
3907 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3909 * object.h (Sized_relobj_file::e_type): New function.
3910 (Sized_relobj_file::e_type_): New data member.
3911 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3912 base address for ET_EXEC files.
3913 * target.cc (Target::do_make_elf_object_implementation): Allow
3914 ET_EXEC files with --just-symbols option.
3916 2011-07-28 Cary Coutant <ccoutant@google.com>
3918 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3919 Add thread_number parameter.
3920 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3921 * workqueue-threads.cc
3922 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3923 current thread if its thread number is greater than desired thread
3925 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3926 Add thread_number parameter.
3927 (Workqueue::should_cancel_thread): Likewise.
3928 (Workqueue::find_runnable_or_wait): Pass thread_number to
3929 should_cancel_thread.
3930 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3933 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3935 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3936 only after checking if it cannot be forced local.
3937 * symtab.h (is_externally_visible): Check if the symbol is not forced
3940 2011-07-15 Ian Lance Taylor <iant@google.com>
3942 * options.h (class General_options): Add --print-output-format.
3943 Move -EL next to -EB, for better --help output.
3944 * target-select.cc: Include <cstdio>, "options.h", and
3946 (Target_selector::do_target_bfd_name): New function.
3947 (print_output_format): New function.
3948 * target-select.h (class Target_selector): Update declarations.
3949 (Target_selector::target_bfd_name): New function.
3950 (print_output_format): Declare.
3951 * main.cc: Include "target-select.h".
3952 (main): Handle --print-output-format.
3953 * gold.cc: Include "target-select.h".
3954 (queue_initial_tasks): Handle --print-output-format when there are
3956 * parameters.cc (parameters_force_valid_target): Give a better
3957 error message if -EB/-EL does not match target.
3958 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3961 2011-07-15 Ian Lance Taylor <iant@google.com>
3963 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3964 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3965 (Output_data_plt_i386::do_write): Write address of .dynamic
3966 section to first entry in .got.plt section.
3967 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3968 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3970 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3971 section to first entry in .got.plt section.
3972 * layout.h (Layout::dynamic_section): New function.
3974 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3976 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3978 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3979 input_section_position_, and input_section_glob_.
3980 (read_layout_from_file): Call function section_ordering_specified.
3981 * layout.h (is_section_ordering_specified): New function.
3982 (section_ordering_specified): New function.
3983 (section_ordering_specified_): New boolean member.
3984 * main.cc(main): Call load_plugins after layout object is defined.
3985 * output.cc (Output_section::add_input_section): Use
3986 function section_ordering_specified to check if section ordering is
3988 * output.cc (Output_section::add_relaxed_input_section): Use
3989 function section_ordering_specified to check if section ordering is
3991 (Output_section::update_section_layout): New function.
3992 (Output_section::sort_attached_input_sections): Check if input section
3994 * output.h (Output_section::update_section_layout): New function.
3995 * plugin.cc (get_section_count): New function.
3996 (get_section_type): New function.
3997 (get_section_name): New function.
3998 (get_section_contents): New function.
3999 (update_section_order): New function.
4000 (allow_section_ordering): New function.
4001 (Plugin::load): Add the new interfaces to the transfer vector.
4002 (Plugin_manager::load_plugins): New parameter.
4003 (Plugin_manager::all_symbols_read): New parameter.
4004 (Plugin_manager::claim_file): New parameter. Save the elf object for
4006 (Plugin_manager::get_elf_object): New function.
4007 (Plugin_manager::get_view): Change to directly use the bool to check
4008 if get_view is called from claim_file_hook.
4009 * plugin.h (input_objects): New function
4010 (Plugin__manager::load_plugins): New parameter.
4011 (Plugin_manager::claim_file): New parameter.
4012 (Plugin_manager::get_elf_object): New function.
4013 (Plugin_manager::in_claim_file_handler): New function.
4014 (Plugin_manager::in_claim_file_handler_): New member.
4015 (layout): New function.
4016 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4017 handler with an extra parameter. Make the elf object before calling
4019 * testsuite/plugin_test.c (get_section_count): New function pointer.
4020 (get_section_type): New function pointer.
4021 (get_section_name): New function pointer.
4022 (get_section_contents): New function pointer.
4023 (update_section_order): New function pointer.
4024 (allow_section_ordering): New function pointer.
4025 (onload): Check if the new interfaces exist.
4027 2011-07-13 Ian Lance Taylor <iant@google.com>
4029 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4031 * x86_64.cc (Target_x86_64::got_section): Likewise.
4032 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4033 (relro_now_test_SOURCES): New variable.
4034 (relro_now_test_DEPENDENCIES): New variable.
4035 (relro_now_test_LDFLAGS): New variable.
4036 (relro_now_test_LDADD): New variable.
4037 (relro_now_test.so): New target.
4038 * testsuite/Makefile.in: Rebuild.
4040 2011-07-12 Ian Lance Taylor <iant@google.com>
4043 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4044 GLOB_DAT relocation rather than a RELATIVE relocation for a
4045 protected symbol when creating a shared library.
4046 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4047 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4048 * testsuite/protected_main_1.cc (main): Test that protected
4049 function has same address.
4051 2011-07-11 Ian Lance Taylor <iant@google.com>
4054 * options.h (class General_options): Add -Bgroup.
4055 * options.cc (General_options::finalize): If -Bgroup is set,
4056 default to --unresolved-symbols=report-all.
4057 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4058 * target-reloc.h (issue_undefined_symbol_error): Handle
4059 --unresolved-symbols=report-all.
4061 2011-07-08 Ian Lance Taylor <iant@google.com>
4064 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4065 if linker script discards key sections.
4066 (Layout::create_dynamic_symtab): Likewise.
4067 (Layout::assign_local_dynsym_offsets): Likewise.
4068 (Layout::sized_create_version_sections): Likewise.
4069 (Layout::create_interp): Likewise.
4070 (Layout::finish_dynamic_section): Likewise.
4071 (Layout::set_dynamic_symbol_size): Likewise.
4073 2011-07-08 Ian Lance Taylor <iant@google.com>
4076 * options.h (class General_options): Add --unresolved-symbols.
4077 * target-reloc.h (issue_undefined_symbol_error): Check
4078 --unresolved-symbols. Add comments.
4080 2011-07-08 Ian Lance Taylor <iant@google.com>
4082 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4083 expression more complex.
4085 2011-07-08 Ian Lance Taylor <iant@google.com>
4088 * target-reloc.h (issue_undefined_symbol_error): New inline
4089 function, broken out of relocate_section.
4090 (relocate_section): Call issue_undefined_symbol_error.
4091 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4092 there is no TLS segment if we are about to issue an undefined
4094 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4096 2011-07-08 Ian Lance Taylor <iant@google.com>
4099 * resolve.cc (Symbol_table::should_override): Add fromtype
4100 parameter. Change all callers. Give error when linking together
4101 TLS and non-TLS symbol.
4102 (Symbol_table::should_override_with_special): Add fromtype
4103 parameter. Change all callers.
4104 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4105 there is no TLS segment if we have reported some errors.
4106 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4108 2011-07-08 Ian Lance Taylor <iant@google.com>
4111 * target.h (Target::plt_address_for_global): New function.
4112 (Target::plt_address_for_local): New function.
4113 (Target::plt_section_for_global): Remove.
4114 (Target::plt_section_for_local): Remove.
4115 (Target::do_plt_address_for_global): New virtual function.
4116 (Target::do_plt_address_for_local): New virtual function.
4117 (Target::do_plt_section_for_global): Remove.
4118 (Target::do_plt_section_for_local): Remove.
4119 (Target::register_global_plt_entry): Add Symbol_table and Layout
4121 * output.cc (Output_data_got::Got_entry::write): Use
4122 plt_address_for_global and plt_address_for_local.
4123 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4124 address of output section.
4125 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4126 got_irelative_, and irelative_count_ fields. Update
4128 (Output_data_plt_i386::has_irelative_section): New function.
4129 (Output_data_plt_i386::entry_count): Add irelative_count_.
4130 (Output_data_plt_i386::set_final_data_size): Likewise.
4131 (class Target_i386): Add got_irelative_ and rel_irelative_
4132 fields. Update declarations.
4133 (Target_i386::Target_i386): Initialize new fields.
4134 (Target_i386::do_plt_address_for_global): New function replacing
4135 do_plt_section_for_global.
4136 (Target_i386::do_plt_address_for_local): New function replacing
4137 do_plt_section_for_local.
4138 (Target_i386::got_section): Create got_irelative_.
4139 (Target_i386::rel_irelative_section): New function.
4140 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4141 fields. Don't define __rel_iplt_{start,end}.
4142 (Output_data_plt_i386::add_entry): Add symtab and layout
4143 parameters. Change all callers. Use different PLT and GOT for
4145 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4146 layout parameters. Change all callers. Use different PLT and
4148 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4149 (Output_data_plt_i386::rel_irelative): New function.
4150 (Output_data_plt_i386::address_for_global): New function.
4151 (Output_data_plt_i386::address_for_local): New function.
4152 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4153 IRELATIVE GOT when changing IFUNC GOT entries.
4154 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4156 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4157 if we didn't create an IRELATIVE GOT.
4158 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4159 plt_address_for_local.
4160 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4161 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4162 got_irelative_, and irelative_count_ fields. Update
4164 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4165 Initialize new fields. Remove symtab parameter. Change all
4167 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4169 (Output_data_plt_x86_64::has_irelative_section): New function.
4170 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4171 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4172 fields. Update declarations.
4173 (Target_x86_64::Target_x86_64): Initialize new fields.
4174 (Target_x86_64::do_plt_address_for_global): New function replacing
4175 do_plt_section_for_global.
4176 (Target_x86_64::do_plt_address_for_local): New function replacing
4177 do_plt_section_for_local.
4178 (Target_x86_64::got_section): Create got_irelative_.
4179 (Target_x86_64::rela_irelative_section): New function.
4180 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4181 all callers. Don't create __rel_iplt_{start,end}.
4182 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4183 parameters. Change all callers. Use different PLT and GOT for
4185 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4186 layout parameters. Change all callers. Use different PLT and
4188 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4189 parameters. Change all callers. Use different PLT and GOT for
4191 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4192 (Output_data_plt_x86_64::rela_irelative): New function.
4193 (Output_data_plt_x86_64::address_for_global): New function.
4194 (Output_data_plt_x86_64::address_for_local): New function.
4195 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4196 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4197 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4198 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4200 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4202 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4203 symbols if we didn't create an IRELATIVE GOT.
4204 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4205 plt_address_for_local.
4206 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4207 * testsuite/ifuncvar1.c: New test file.
4208 * testsuite/ifuncvar2.c: New test file.
4209 * testsuite/ifuncvar3.c: New test file.
4210 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4211 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4212 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4213 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4214 * testsuite/Makefile.in: Rebuild.
4216 2011-07-07 Cary Coutant <ccoutant@google.com>
4218 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4219 (two_file_test_1_ndebug.o): Likewise.
4220 (two_file_test_1b_ndebug.o): Likewise.
4221 (two_file_test_2_ndebug.o): Likewise.
4222 (two_file_test_main_ndebug.o): Likewise.
4223 (incremental_test_2): Link with no-debug versions.
4225 2011-07-06 Cary Coutant <ccoutant@google.com>
4227 * gold/incremental.cc
4228 (Output_section_incremental_inputs::write_info_blocks): Check for
4229 hidden and internal symbols.
4231 2011-07-06 Cary Coutant <ccoutant@google.com>
4233 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4234 Check disposition for startup file.
4235 (Incremental_inputs::report_command_line): Ignore
4236 --incremental-startup-unchanged option.
4237 * options.cc (General_options::parse_incremental_startup_unchanged):
4239 (General_options::General_options): Initialize new data member.
4240 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4241 (General_options): Add --incremental-startup-unchanged option.
4242 (General_options::incremental_startup_disposition): New function.
4243 (General_options::incremental_startup_disposition_): New data member.
4245 2011-07-06 Cary Coutant <ccoutant@google.com>
4247 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4248 input file index to Script_info ctor.
4249 (Sized_incremental_binary::do_file_has_changed): Find the
4250 command-line argument for files named in scripts.
4251 * incremental.h (Script_info::Script_info): New ctor
4252 with input file index.
4253 (Script_info::input_file_index): New function.
4254 (Script_info::input_file_index_): New data member.
4255 (Incremental_binary::get_library): Add const.
4256 (Incremental_binary::get_script_info): Add const.
4257 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4258 * testsuite/Makefile.am (incremental_test_5): New test case.
4259 (incremental_test_6): New test case.
4260 * testsuite/Makefile.in: Regenerate.
4262 2011-07-06 Cary Coutant <ccoutant@google.com>
4264 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4265 debug output when command lines differ.
4267 2011-07-06 Cary Coutant <ccoutant@google.com>
4269 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4270 --incremental-patch option.
4271 * layout.cc (Free_list::allocate): Extend allocation beyond original
4273 (Layout::make_output_section): Mark sections that should get
4275 * options.cc (parse_percent): New function.
4276 * options.h (parse_percent): New function.
4277 (DEFINE_percent): New macro.
4278 (General_options): Add --incremental-patch option.
4279 * output.cc (Output_section::Output_section): Initialize new data
4281 (Output_section::add_input_section): Print section name when out
4283 (Output_section::add_output_section_data): Likewise.
4284 (Output_section::set_final_data_size): Add patch space when
4285 doing --incremental-full.
4286 (Output_section::do_reset_address_and_file_offset): Remove patch
4288 (Output_segment::set_section_list_addresses): Print debug output
4289 only if --incremental-update.
4290 * output.h (Output_section::set_is_patch_space_allowed): New function.
4291 (Output_section::is_patch_space_allowed_): New data member.
4292 (Output_section::patch_space_): New data member.
4293 * parameters.cc (Parameters::incremental_full): New function.
4294 * parameters.h (Parameters::incremental_full): New function
4295 * testsuite/Makefile.am (incremental_test_2): Add test for
4296 --incremental-patch option.
4297 * testsuite/Makefile.in: Regenerate.
4298 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4299 (t18): Remove function body.
4301 2011-07-05 Doug Kwan <dougkwan@google.com>
4304 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4305 Arm_Address type for relocation result.
4306 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4308 (Arm_relocate_functions::abs32): Use unaligned access.
4309 (Arm_relocate_functions::rel32): Ditto.
4310 (Arm_relocate_functions::prel31): Ditto.
4311 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4312 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4313 static data relocations.
4314 * testsuite/Makefile.in: Regnerate.
4315 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4317 2011-07-05 Ian Lance Taylor <iant@google.com>
4320 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4321 symbols if necessary.
4322 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4324 2011-07-05 Ian Lance Taylor <iant@google.com>
4327 * resolve.cc (Symbol::override_base_with_special): Simply override
4328 version with special symbol version, ignoring previous version.
4330 2011-07-05 Ian Lance Taylor <iant@google.com>
4332 * object.cc (Sized_relobj_file::include_section_group): Add
4333 information to comment about signature location.
4335 2011-07-02 Ian Lance Taylor <iant@google.com>
4338 * options.h (class General_options): Add -f and -F.
4339 * options.cc (General_options::finalize): Fatal error if -f/-F
4340 are used without -shared.
4341 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4343 2011-07-02 Ian Lance Taylor <iant@google.com>
4345 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4347 2011-07-01 Ian Lance Taylor <iant@google.com>
4351 * resolve.cc (Symbol::override_base_with_special): Don't override
4352 the version if the overriding symbol has a different name.
4353 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4354 all callers. If we give an error about an undefined version,
4355 define the base version if necessary.
4356 * dynobj.h (class Versions): Update declaration.
4357 * testsuite/weak_alias_test_5.cc: New file.
4358 * testsuite/weak_alias_test.script: New file.
4359 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4360 and versioned_alias have the right value, and call t2.
4361 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4362 weak_alias_test_5.so.
4363 (weak_alias_test_LDADD): Likewise.
4364 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4365 * testsuite/Makefile.in: Rebuild.
4367 2011-07-01 Ian Lance Taylor <iant@google.com>
4370 * options.h (class General_options): Support -z notext.
4371 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4373 (two_file_shared_nonpic.so): Likewise.
4374 (two_file_shared_mixed.so): Likewise.
4375 (two_file_shared_mixed_1.so): Likewise.
4376 (weak_undef_lib_nonpic.so): Likewise.
4377 (alt/weak_undef_lib_nonpic.so): Likewise.
4378 (tls_test_shared_nonpic.so): Likewise.
4379 * testsuite/Makefile.in: Rebuild.
4381 2011-07-01 Ian Lance Taylor <iant@google.com>
4384 * configure.ac: Test whether static linking works, setting
4385 the automake conditional HAVE_STATIC.
4386 * testsuite/Makefile.am: Disable tests using -static if
4387 HAVE_STATIC is not true.
4388 * configure, testsuite/Makefile.in: Rebuild.
4390 2011-07-01 Ian Lance Taylor <iant@google.com>
4393 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4394 Assert if we see DW_EH_PE_indirect.
4395 * target.h (Target::ehframe_datarel_base): New function.
4396 (Target::do_ehframe_datarel_base): New target function.
4397 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4398 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4401 2011-07-01 Ian Lance Taylor <iant@google.com>
4404 * options.h (class General_options): Add
4405 --ld-generated-unwind-info.
4406 * ehframe.cc (Fde::write): Add address parameter. Change all
4407 callers. If associated with PLT, fill in address and size.
4408 (Cie::set_output_offset): Only add merge mapping if there is an
4410 (Cie::write): Add address parameter. Change all callers.
4411 (Eh_frame::add_ehframe_for_plt): New function.
4412 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4413 input_offset_ fields into union u_, with new plt field.
4414 (Fde::Fde): Adjust for new union field.
4415 (Fde::Fde) [Output_data version]: New constructor.
4416 (Fde::add_mapping): Only add merge mapping if there is an object.
4417 (class Cie): Update declarations.
4418 (class Eh_frame): Declare add_ehframe_for_plt.
4419 * layout.cc (Layout::layout_eh_frame): Break out code into
4420 make_eh_frame_section, and call it.
4421 (Layout::make_eh_frame_section): New function.
4422 (Layout::add_eh_frame_for_plt): New function.
4423 * layout.h (class Layout): Update declarations.
4424 * merge.cc (Merge_map::add_mapping): Add assertion.
4425 * i386.cc: Include "dwarf.h".
4426 (class Output_data_plt_i386): Make first_plt_entry,
4427 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4428 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4429 and plt_eh_frame_fde.
4430 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4431 boundary. Call add_eh_frame_for_plt if appropriate.
4432 * x86_64.cc: Include "dwarf.h".
4433 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4434 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4435 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4436 and plt_eh_frame_fde.
4437 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4440 2011-06-29 Ian Lance Taylor <iant@google.com>
4443 * object.cc (Sized_relobj_file::layout_section): Change shdr
4444 parameter to be const.
4445 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4447 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4448 appropriate. Call layout_eh_frame_section.
4449 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4451 * object.h (class Sized_relobj_file): Update declarations.
4453 2011-06-29 Ian Lance Taylor <iant@google.com>
4456 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4458 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4460 2011-06-29 Ian Lance Taylor <iant@google.com>
4463 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4465 * layout.cc (Layout::layout_eh_frame): Likewise.
4467 2011-06-29 Ian Lance Taylor <iant@google.com>
4470 * layout.cc (Layout::symtab_section_shndx): New function.
4471 * layout.h (class Layout): Declare symtab_section_shndx.
4472 * output.cc (Output_section::write_header): Call it.
4474 2011-06-29 Ian Lance Taylor <iant@google.com>
4477 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4478 symbols which are not used in a relocation.
4480 2011-06-28 Ian Lance Taylor <iant@google.com>
4483 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4484 script create indistinguishable segments.
4485 (Layout::set_segment_offsets): Use stable_sort when sorting
4486 segments. Pass this to Compare_segments constructor.
4487 * layout.h (class Layout): Make segment_precedes non-static.
4488 (class Compare_segments): Change from struct to class. Add
4489 layout_ field. Add constructor.
4490 * script-sections.cc
4491 (Script_sections::attach_sections_using_phdrs_clause): Rename
4492 local orphan to is_orphan. Don't report failure to put empty
4493 section in segment. On attachment failure, report name of
4494 section, and attach to first PT_LOAD segment.
4496 2011-06-28 Ian Lance Taylor <iant@google.com>
4499 * target-select.cc (Target_selector::Target_selector): Add
4500 emulation parameter. Change all callers.
4501 (select_target_by_bfd_name): Rename from select_target_by_name.
4503 (select_target_by_emulation): New function.
4504 (supported_emulation_names): New function.
4505 * target-select.h (class Target_selector): Add emulation_ field.
4506 Update declarations.
4507 (Target_selector::recognize_by_bfd_name): Rename from
4508 recognize_by_name. Change all callers.
4509 (Target_selector::supported_bfd_names): Rename from
4510 supported_names. Change all callers.
4511 (Target_selector::recognize_by_emulation): New function.
4512 (Target_selector::supported_emulations): New function.
4513 (Target_selector::emulation): New function.
4514 (Target_selector::do_recognize_by_bfd_name): Rename from
4515 do_recognize_by_name. Change all callers.
4516 (Target_selector::do_supported_bfd_names): Rename from
4517 do_supported_names. Change all callers.
4518 (Target_selector::do_recognize_by_emulation): New function.
4519 (Target_selector::do_supported_emulations): New function.
4520 (select_target_by_bfd_name): Change name in declaration.
4521 (select_target_by_emulation): Declare.
4522 (supported_emulation_names): Declare.
4523 * parameters.cc (parameters_force_valid_target): Try to find
4524 target based on emulation from -m option.
4525 * options.h (class General_options): Change doc string for -m.
4526 * options.cc (help): Print emulations.
4527 (General_options::parse_V): Likewise.
4528 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4529 Add emulation parameter. Change all callers.
4531 2011-06-28 Ian Lance Taylor <iant@google.com>
4533 * target.h (class Target): Add osabi_ field.
4534 (Target::osabi): New function.
4535 (Target::set_osabi): New function.
4536 (Target::Target): Initialize osabi_.
4537 (Target::do_adjust_elf_header): Make pure virtual.
4538 (Sized_target::do_adjust_elf_header): Declare.
4539 * target.cc (Sized_target::do_adjust_elf_header): New function.
4540 (class Sized_target): Instantiate all versions.
4541 * freebsd.h (class Target_freebsd): Remove.
4542 (Target_selector_freebsd::do_recognize): Call set_osabi on
4544 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4545 (Target_selector_freebsd::set_osabi): Remove.
4546 * i386.cc (class Target_i386): Inherit from Sized_target rather
4547 than Target_freebsd.
4548 * x86_64.cc (class Target_x86_64): Likewise.
4550 2011-06-28 Ian Lance Taylor <iant@google.com>
4552 * target.h (Target::can_check_for_function_pointers): Rewrite.
4554 (Target::can_icf_inline_merge_sections): Likewise.
4555 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4556 (Target::Target_info): Add can_icf_inline_merge_sections field.
4557 (Target::do_can_check_for_function_pointers): New virtual
4559 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4560 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4561 from can_check_for_function_pointers, move in file.
4562 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4563 section_may_have_icf_unsafe_poineters, move in file.
4564 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4565 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4566 Rename from can_check_for_function_pointers, move in file.
4567 (Target_i386::can_icf_inline_merge_sections): Remove.
4568 (Target_i386::i386_info): Initialize
4569 can_icf_inline_merge_sections.
4570 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4571 Initialize can_icf_inline_merge_sections.
4572 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4573 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4574 Rename from can_check_for_function_pointers, move in file.
4575 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4576 (Target_x86_64::x86_64_info): Initialize
4577 can_icf_inline_merge_sections.
4578 * testsuite/testfile.cc (Target_test::test_target_info):
4580 * icf.cc (get_section_contents): Correct formatting.
4582 2011-06-27 Ian Lance Taylor <iant@google.com>
4584 * symtab.cc (Symbol::versioned_name): New function.
4585 (Symbol_table::add_to_final_symtab): Use versioned_name when
4587 (Symbol_table::sized_write_symbol): Likewise.
4588 * symtab.h (class Symbol): Declare versioned_name.
4589 * stringpool.h (class Stringpool_template): Add variant of add
4590 which takes a std::basic_string.
4591 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4592 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4593 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4594 (ver_test_12.o): New target.
4595 * testsuite/Makefile.in: Rebuild.
4597 2011-06-27 Doug Kwan <dougkwan@google.com>
4599 * arm.cc (Arm_relocate_functions::thm_jump8,
4600 Arm_relocate_functions::thm_jump11): Use a wider signed
4601 type to compute offset.
4602 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4604 * testsuite/Makefile.in: Regenerate.
4605 * testsuite/arm_branch_in_range.sh: Check test results of
4606 arm_thm_jump11 and arm_thm_jump8.
4607 * testsuite/arm_thm_jump11.s: New test source file.
4608 * testsuite/arm_thm_jump11.t: New linker script.
4609 * testsuite/arm_thm_jump8.s: New test source file.
4610 * testsuite/arm_thm_jump8.t: New linker script.
4612 2011-06-24 Ian Lance Taylor <iant@google.com>
4614 * layout.cc: Include "object.h".
4615 (ctors_sections_in_init_array): New static variable.
4616 (Layout::is_ctors_in_init_array): New function.
4617 (Layout::layout): Add entry to ctors_sections_in_init_array if
4619 * layout.h (class Layout): Declare is_ctors_in_init_array.
4620 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4621 is_ctors_reverse_view is set.
4622 (Sized_relobj_file::write_sections): Add layout parameter. Change
4623 all callers. Set is_ctors_reverse_view field of View_size.
4624 (Sized_relobj_file::reverse_words): New function.
4625 * object.h (Sized_relobj_file::View_size): Add
4626 is_ctors_reverse_view field.
4627 (class Sized_relobj_file): Update declarations.
4628 * testsuite/initpri3.c: New test.
4629 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4631 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4632 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4633 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4634 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4635 * testsuite/Makefile.in: Rebuild.
4637 2011-06-24 Cary Coutant <ccoutant@google.com>
4639 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4640 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4641 (debug_msg_cdebug.err): New targets.
4642 * testsuite/Makefile.in: Regenerate.
4643 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4644 Fix checks for link with shared library.
4646 2011-06-24 Doug Kwan <dougkwan@google.com>
4648 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4649 skip empty text sections.
4650 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4652 2011-06-22 Ian Lance Taylor <iant@google.com>
4655 * options.h (class General_options): Add --ctors-in-init-array.
4656 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4657 friends as SHT_PROGBITS for merging sections.
4658 (Layout::layout): Remove special handling of .init_array and
4659 friends. Don't sort if doing relocatable link. Sort for .ctors
4660 and .dtors if ctors_in_init_array.
4661 (Layout::make_output_section): Force correct section types for
4662 .init_array and friends. Don't sort if doing relocatable link,
4663 Don't sort .ctors and .dtors if ctors_in_init_array.
4664 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4665 (Layout::output_section_name): Add relobj parameter. Change all
4666 callers. Handle .ctors. and .dtors. in code rather than table.
4667 Handle .ctors and .dtors if ctors_in_init_array.
4668 (Layout::match_file_name): New function, moved from output.cc.
4669 * layout.h (class Layout): Update declarations.
4670 * output.cc: Include "layout.h".
4671 (Input_section_sort_entry::get_priority): New function.
4672 (Input_section_sort_entry::match_file_name): Just call
4673 Layout::match_file_name.
4674 (Output_section::Input_section_sort_init_fini_compare::operator()):
4675 Handle .ctors and .dtors. Sort by explicit priority rather than
4677 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4678 * testsuite/initpri2.c: New test.
4679 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4680 (check_PROGRAMS): Add initpri2.
4681 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4682 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4683 * configure, testsuite/Makefile.in: Rebuild.
4685 2011-06-19 Ian Lance Taylor <iant@google.com>
4688 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4689 .interp section to a PT_INTERP segment even if we have seen a
4690 --dynamic-linker option. Don't do it if we have seen a PHDRS
4691 clause in a linker script.
4692 (Layout::finalize): Don't create a .interp section if we've
4693 already create a PT_INTERP segment.
4694 (Layout::create_interp): Always call choose_output_section (revert
4695 patch of 2011-06-17). Don't create PT_INTERP segment.
4696 * script-sections.cc
4697 (Script_sections::create_note_and_tls_segments): Add a .interp
4698 section to a PT_INTERP segment even if we have seen a
4699 --dynamic-linker option.
4701 2011-06-18 Ian Lance Taylor <iant@google.com>
4703 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4704 merely because a non-PT_LOAD segment has a dynamic reloc.
4706 2011-06-18 Ian Lance Taylor <iant@google.com>
4708 * layout.cc (Layout::finish_dynamic_section): Don't create
4709 DT_FLAGS entry if not needed.
4711 2011-06-18 Ian Lance Taylor <iant@google.com>
4714 * layout.cc (Layout::layout_eh_frame): Correct handling of
4715 writable .eh_frame section.
4717 2011-06-17 Ian Lance Taylor <iant@google.com>
4720 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4721 symbol is redefined with the exact same object and value.
4723 2011-06-17 Ian Lance Taylor <iant@google.com>
4726 * layout.h (class Layout): Add interp_segment_ field.
4727 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4728 (Layout::attach_allocated_section_to_segment): If making shared
4729 library, put .interp section in PT_INTERP segment.
4730 (Layout::finalize): Also call create_interp if -dynamic-linker
4732 (Layout::create_interp): Assert that there is no PT_INTERP
4733 segment. If not using a SECTIONS clause, use make_output_section.
4734 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4735 * script-sections.cc
4736 (Script_sections::create_note_and_tls_segments): If making shared
4737 library, put .interp section in PT_INTERP segment.
4739 2011-06-17 Ian Lance Taylor <iant@google.com>
4741 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4742 when making a shared library.
4744 2011-06-17 Ian Lance Taylor <iant@google.com>
4746 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4747 parameter. Change all callers. Don't issue warning about PC32
4748 against locally defined symbol.
4750 2011-06-16 Ian Lance Taylor <iant@google.com>
4752 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4753 occurs in same object.
4755 2011-06-14 Alan Modra <amodra@gmail.com>
4757 * po/POTFILES.in: Regenerate.
4759 2011-06-09 Ian Lance Taylor <iant@google.com>
4761 * script-sections.cc
4762 (Orphan_output_section::set_section_addresses): For a relocatable
4763 link set address to 0.
4765 2011-06-09 Cary Coutant <ccoutant@google.com>
4768 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4769 used with --compress-debug-sections.
4770 * gold/object.cc (Sized_relobj_file::do_layout): Report
4771 uncompressed size of compressed input sections.
4773 2011-06-08 Cary Coutant <ccoutant@google.com>
4776 * testsuite/two_file_test_2_v1.cc: Change initialization of
4777 v2 to keep it in .data.
4779 2011-06-07 Cary Coutant <ccoutant@google.com>
4781 * common.cc (Symbol_table::do_allocate_commons_list): Call
4783 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4784 (Errors::fallback): New function.
4785 (gold_fallback): New function.
4786 * errors.h (Errors::fallback): New function.
4787 * gold.cc (gold_exit): Change status parameter to enum; adjust
4789 (queue_initial_tasks): Call gold_fallback.
4790 * gold.h: Include cstdlib.
4791 (Exit_status): New enum type.
4792 (gold_exit): Change status parameter to enum.
4793 (gold_fallback): New function.
4794 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4795 (Layout::create_symtab_sections): Likewise.
4796 (Layout::create_shdrs): Likewise.
4797 * main.cc (main): Adjust call to gold_exit.
4798 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4799 (Output_data_got::add_got_entry_pair): Likewise.
4800 (Output_section::add_input_section): Likewise.
4801 (Output_section::add_output_section_data): Likewise.
4802 (Output_segment::set_section_list_addresses): Likewise.
4803 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4805 2011-06-07 Cary Coutant <ccoutant@google.com>
4807 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4808 for incremental links.
4809 * output.cc (Output_segment::set_section_list_addresses): Remove
4810 FIXME and test for TLS or BSS.
4812 2011-06-07 Cary Coutant <ccoutant@google.com>
4814 * testsuite/Makefile.am: Add incremental_copy_test,
4815 incremental_common_test_1.
4816 * testsuite/Makefile.in: Regenerate.
4817 * testsuite/common_test_1_v1.c: New source file.
4818 * testsuite/common_test_1_v2.c: New source file.
4819 * testsuite/copy_test_v1.cc: New source file.
4821 2011-06-07 Cary Coutant <ccoutant@google.com>
4823 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4824 update, allocate common from bss section's free list.
4825 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4826 linker-defined symbols.
4827 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4828 Skip GOT and PLT entries that are no longer referenced.
4829 (Output_section_incremental_inputs::write_info_blocks): Mark
4830 linker-defined symbols.
4831 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4832 * output.cc (Output_section::allocate): New function.
4833 * output.h (Output_section::allocate): New function.
4834 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4835 linker-defined symbols.
4836 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4837 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4838 (Symbol::init_base_output_data): Likewise.
4839 (Symbol::init_base_output_segment): Likewise.
4840 (Symbol::init_base_constant): Likewise.
4841 (Sized_symbol::init_output_data): Likewise.
4842 (Sized_symbol::init_output_segment): Likewise.
4843 (Sized_symbol::init_constant): Likewise.
4844 (Symbol_table::do_define_in_output_data): Likewise.
4845 (Symbol_table::do_define_in_output_segment): Likewise.
4846 (Symbol_table::do_define_as_constant): Likewise.
4847 * symtab.h (Symbol::is_predefined): New function.
4848 (Symbol::init_base_output_data): Add is_predefined parameter.
4849 (Symbol::init_base_output_segment): Likewise.
4850 (Symbol::init_base_constant): Likewise.
4851 (Symbol::is_predefined_): New data member.
4852 (Sized_symbol::init_output_data): Add is_predefined parameter.
4853 (Sized_symbol::init_output_segment): Likewise.
4854 (Sized_symbol::init_constant): Likewise.
4855 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4857 2011-06-07 Cary Coutant <ccoutant@google.com>
4859 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4860 instead of emit_copy_reloc.
4861 (Copy_relocs::emit_copy_reloc): Refactor.
4862 (Copy_relocs::make_copy_reloc): New function.
4863 (Copy_relocs::add_copy_reloc): Remove.
4864 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4866 (Copy_relocs::make_copy_reloc): New function.
4867 (Copy_relocs::add_copy_reloc): Remove.
4868 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4869 unchanged input files.
4870 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4871 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4872 Reserve BSS space for COPY relocations.
4873 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4874 (Output_section_incremental_inputs::write_info_blocks): Record
4875 whether a symbol is copied from a shared object.
4876 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4877 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4878 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4879 (Incremental_input_entry_reader::get_output_symbol_index): Add
4881 (Incremental_binary::emit_copy_relocs): New function.
4882 (Incremental_binary::do_emit_copy_relocs): New function.
4883 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4885 (Sized_incremental_binary::add_copy_reloc): New function.
4886 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4887 (Sized_incremental_binary::Copy_reloc): New struct.
4888 (Sized_incremental_binary::Copy_relocs): New typedef.
4889 (Sized_incremental_binary::copy_relocs_): New data member.
4890 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4891 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4892 * target.h (Sized_target::emit_copy_reloc): New function.
4893 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4895 2011-06-02 Cary Coutant <ccoutant@google.com>
4898 * gold/archive.cc (Archive::Archive): Initialize new data member.
4899 (Archive::include_all_members): Return if archive has already been
4901 * gold/archive.h (Archive::include_all_members_): New data member.
4903 2011-06-02 Nick Clifton <nickc@redhat.com>
4905 * dynobj.h: Fix spelling mistake in comment.
4906 * output.cc: Likewise.
4908 2011-05-31 Doug Kwan <dougkwan@google.com>
4912 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4913 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4914 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4915 redundant arm_exidx_test.so.
4916 * testsuite/Makefile.in: Regenerate.
4917 (check_SCRIPTS): Add pr12826.sh
4918 (check_DATA): Add pr12826.stdout
4919 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4920 * testsuite/pr12826.sh: New file.
4921 * testsuite/pr12826_1.s: Ditto.
4922 * testsuite/pr12826_1.s: Ditto.
4924 2011-05-30 Ian Lance Taylor <iant@google.com>
4926 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4929 2011-05-29 Ian Lance Taylor <iant@google.com>
4932 * testsuite/Makefile.am: Use different file name for two_file_test
4933 temporary file for each incremental test.
4934 * testsuite/Makefile.in: Rebuild.
4936 2011-05-29 Ian Lance Taylor <iant@google.com>
4938 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4939 binary input file is empty.
4941 2011-05-27 Ian Lance Taylor <iant@google.com>
4943 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4944 (ver_test_9.so): Likewise.
4945 * testsuite/Makefile.in: Rebuild.
4947 2011-05-26 Cary Coutant <ccoutant@google.com>
4949 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4950 * incremental.cc (Incremental_inputs::report_input_section): Fix
4951 comment, indentation.
4952 (Incremental_inputs::report_comdat_group): New function.
4953 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4954 of data for incremental input file entry.
4955 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4956 group count, COMDAT group signatures.
4957 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4958 an unchanged input file.
4959 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4960 Initialize new data member.
4961 (Incremental_object_entry::add_comdat_group): New function.
4962 (Incremental_object_entry::get_comdat_group_count): New function.
4963 (Incremental_object_entry::get_comdat_signature_key): New function.
4964 (Incremental_object_entry::groups_): New data member.
4965 (Incremental_inputs::report_comdat_group): New function.
4966 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4967 data for incremental input file entry.
4968 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4969 (Incremental_input_entry_reader::get_input_section): Adjust size of
4970 data for incremental input file entry.
4971 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4972 (Incremental_input_entry_reader::get_comdat_group_signature): New
4974 * object.cc (Sized_relobj::include_section_group): Report kept
4975 COMDAT groups for incremental links.
4977 2011-05-24 David Meyer <pdox@google.com>
4979 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4980 with name parameter. Add found_name parameter.
4981 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4982 * dirsearch.h (class Dirsearch): Update declaration.
4984 2011-05-24 Ian Lance Taylor <iant@google.com>
4986 * archive.cc (Library_base::should_include_member): Pull in object
4987 from archive if it defines the entry symbol.
4988 * parameters.cc (Parameters::entry): New function.
4989 * parameters.h (class Parameters): Declare entry.
4990 * output.h (class Output_file_header): Remove entry_ field.
4991 * output.cc (Output_file_header::Output_file_header): Remove entry
4992 parameter. Change all callers.
4993 (Output_file_header::entry): Use parameters->entry.
4994 * gold.cc (queue_middle_tasks): Likewise.
4995 * plugin.cc (Plugin_hook::run): Likewise.
4997 2011-05-24 Cary Coutant <ccoutant@google.com>
4999 * gold.cc (queue_initial_tasks): Pass incremental base filename
5000 to Output_file::open_base_file; don't print error message.
5001 * incremental-dump.cc (main): Adjust call to
5002 Output_file::open_for_modification.
5003 * incremental-dump.cc (main): Likewise.
5004 * incremental.cc (Incremental_inputs::report_command_line):
5005 Ignore --incremental-base option when comparing command lines.
5006 Ignore parameter when given as separate argument.
5007 * options.h (class General_options): Add --incremental-base.
5008 * output.cc (Output_file::Output_file):
5009 (Output_file::open_base_file): Add base_name and writable parameters;
5010 read base file into new file; print error message here.
5011 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5013 * output.h (Output_file::open_for_modification): Rename to...
5014 (Output_file::open_base_file): ...this; add base_name and
5015 writable parameters; adjust all callers.
5016 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5018 * testsuite/Makefile.am (incremental_test_4): Test
5020 * testsuite/Makefile.in: Regenerate.
5022 2011-05-24 Cary Coutant <ccoutant@google.com>
5024 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5026 * testsuite/Makefile.in: Regenerate.
5027 * testsuite/two_file_test_1_v1.cc: New test source file.
5028 * testsuite/two_file_test_1b_v1.cc: New test source file.
5029 * testsuite/two_file_test_2_v1.cc: New test source file.
5031 2011-05-24 Cary Coutant <ccoutant@google.com>
5033 * dynobj.h (Dynobj::do_dynobj): New function.
5034 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5035 flag and soname for shared objects.
5036 * incremental.cc (Incremental_inputs::report_object): Make
5037 either Incremental_object_entry or Incremental_dynobj_entry; add
5038 soname to string table.
5039 (Incremental_inputs::report_input_section): Add assertion.
5040 (Output_section_incremental_inputs::set_final_data_size): Adjust
5041 type of input file entry for shared libraries; adjust size of
5042 shared library info entry.
5043 (Output_section_incremental_inputs::write_input_files): Write
5044 as_needed flag for shared libraries.
5045 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5046 of input file entry for shared libraries; write soname.
5047 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5048 soname from incremental info.
5049 * incremental.h (enum Incremental_input_flags): Add
5050 INCREMENTAL_INPUT_AS_NEEDED.
5051 (Incremental_input_entry::Incremental_input_entry): Initialize new
5053 (Incremental_input_entry::set_as_needed): New function.
5054 (Incremental_input_entry::as_needed): New function.
5055 (Incremental_input_entry::do_dynobj_entry): New function.
5056 (Incremental_input_entry::as_needed_): New data member.
5057 (Incremental_object_entry::Incremental_object_entry): Don't check
5059 (Incremental_object_entry::do_type): Likewise.
5060 (class Incremental_dynobj_entry): New class.
5061 (Incremental_input_entry_reader::as_needed): New function.
5062 (Incremental_input_entry_reader::get_soname): New function.
5063 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5064 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5065 size of shared library info entry.
5066 * layout.cc (Layout::finish_dynamic_section): Don't test for
5067 incremental link when adding DT_NEEDED entries.
5068 * object.h (Object::Object): Initialize new data member.
5069 (Object::dynobj): New function.
5070 (Object::set_as_needed): New function.
5071 (Object::as_needed): New function.
5072 (Object::do_dynobj): New function.
5073 (Object::as_needed_): New data member.
5075 2011-05-24 Cary Coutant <ccoutant@google.com>
5077 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5078 info; adjust display of GOT entries.
5079 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5080 vector of input objects; remove file_status_.
5081 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5082 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5083 got_plt reader; call target hooks to reserve GOT entries.
5084 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5085 of input file info header and GOT info entry.
5086 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5088 (Got_plt_view_info::got_descriptor): Remove.
5089 (Got_plt_view_info::sym_index): New data member.
5090 (Got_plt_view_info::input_index): New data member.
5091 (Local_got_offset_visitor::visit): Write input file index.
5092 (Global_got_offset_visitor::visit): Write 0 for input file index.
5093 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5094 with sym_index and input_index.
5095 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5096 incremental info GOT entry; replace got_descriptor with input_index.
5097 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5098 map from input file index to object.
5099 (Sized_relobj_incr::do_layout): Replace direct data member reference
5100 with accessor function.
5101 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5102 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5103 Adjust size of input file info header.
5104 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5105 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5106 (Incremental_input_entry_reader::get_input_section): Adjust size of
5107 input file info header.
5108 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5109 of incremental info GOT entry.
5110 (Incremental_got_plt_reader::get_got_desc): Remove.
5111 (Incremental_got_plt_reader::get_got_symndx): New function.
5112 (Incremental_got_plt_reader::get_got_input_index): New function.
5113 (Sized_incremental_binary::Sized_incremental_binary): Remove
5114 file_status_; add input_objects_.
5115 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5116 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5117 (Sized_incremental_binary::file_is_unchanged): Remove.
5118 (Sized_incremental_binary::set_input_object): New function.
5119 (Sized_incremental_binary::input_object): New function.
5120 (Sized_incremental_binary::file_status_): Remove.
5121 (Sized_incremental_binary::input_objects_): New data member.
5122 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5124 (Sized_relobj_incr::invalid_address): Move to base class.
5125 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5127 (Sized_relobj_incr::do_output_section_offset): Likewise.
5128 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5129 (Sized_relobj_incr::section_offsets_): Likewise.
5130 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5132 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5133 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5134 with accessor function.
5135 (Sized_relobj_file::do_layout): Likewise.
5136 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5137 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5138 (Sized_relobj_file::compute_final_local_value): Replace refs to
5139 section_offsets_ with accessor function.
5140 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5141 * object.h (Relobj::Relobj): Initialize new data members.
5142 (Relobj::add_dyn_reloc): New function.
5143 (Relobj::first_dyn_reloc): New function.
5144 (Relobj::dyn_reloc_count): New function.
5145 (Relobj::first_dyn_reloc_): New data member.
5146 (Relobj::dyn_reloc_count_): New data member.
5147 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5149 (Sized_relobj::Address): New typedef.
5150 (Sized_relobj::invalid_address): Move here from child class.
5151 (Sized_relobj::Sized_relobj): Initialize new data members.
5152 (Sized_relobj::sized_relobj): New function.
5153 (Sized_relobj::is_output_section_offset_invalid): Move here from
5155 (Sized_relobj::get_output_section_offset): Likewise.
5156 (Sized_relobj::local_has_got_offset): Likewise.
5157 (Sized_relobj::local_got_offset): Likewise.
5158 (Sized_relobj::set_local_got_offset): Likewise.
5159 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5160 (Sized_relobj::clear_got_offsets): New function.
5161 (Sized_relobj::section_offsets): Move here from child class.
5162 (Sized_relobj::do_output_section_offset): Likewise.
5163 (Sized_relobj::do_set_section_offset): Likewise.
5164 (Sized_relobj::Local_got_offsets): Likewise.
5165 (Sized_relobj::local_got_offsets_): Likewise.
5166 (Sized_relobj::section_offsets_): Likewise.
5167 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5169 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5171 (Sized_relobj_file::sized_relobj): New function
5172 (Sized_relobj_file::local_has_got_offset): Move to base class.
5173 (Sized_relobj_file::local_got_offset): Likewise.
5174 (Sized_relobj_file::set_local_got_offset): Likewise.
5175 (Sized_relobj_file::get_output_section_offset): Likewise.
5176 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5177 (Sized_relobj_file::do_output_section_offset): Likewise.
5178 (Sized_relobj_file::do_set_section_offset): Likewise.
5179 (Sized_relobj_file::Local_got_offsets): Likewise.
5180 (Sized_relobj_file::local_got_offsets_): Likewise.
5181 (Sized_relobj_file::section_offsets_): Likewise.
5182 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5184 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5185 (Output_reloc::get_symbol_index): Likewise.
5186 (Output_reloc::local_section_offset): Likewise.
5187 (Output_reloc::get_address): Likewise.
5188 (Output_reloc::symbol_value): Likewise.
5189 (Output_data_got::reserve_slot): Move to class definition.
5190 (Output_data_got::reserve_local): New function.
5191 (Output_data_got::reserve_slot_for_global): Remove.
5192 (Output_data_got::reserve_global): New function.
5193 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5194 (all constructors, two instantiations).
5195 (Output_reloc::get_relobj): New function (two instantiations).
5196 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5197 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5198 (Output_data_reloc::add_global): Adjust type of relobj.
5199 (Output_data_reloc::add_global_relative): Likewise.
5200 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5201 (Output_data_reloc::add_local): Likewise.
5202 (Output_data_reloc::add_local_relative): Likewise.
5203 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5204 (Output_data_reloc::add_local_section): Likewise.
5205 (Output_data_reloc::add_output_section): Likewise.
5206 (Output_data_reloc::add_absolute): Likewise.
5207 (Output_data_reloc::add_target_specific): Likewise.
5208 (Output_data_got::reserve_slot): Move definition here.
5209 (Output_data_got::reserve_local): New function.
5210 (Output_data_got::reserve_global): New function.
5211 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5212 section_offsets_ with accessor function.
5213 (Sized_relobj_file::write_sections): Likewise.
5214 (Sized_relobj_file::do_relocate_sections): Likewise.
5215 * target.h (Sized_target::reserve_local_got_entry): New function.
5216 (Sized_target::reserve_global_got_entry): New function.
5217 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5218 (Target_x86_64::reserve_global_got_entry): New function.
5219 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5221 2011-05-23 Cary Coutant <ccoutant@google.com>
5223 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5224 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5225 bit when checking got_type.
5226 * incremental.cc (Sized_incremental_binary::setup_readers):
5227 Store symbol table and string table locations; initialize bit vector
5228 of file status flags.
5229 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5231 (Sized_incremental_binary::do_process_got_plt): New function.
5232 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5233 (Output_section_incremental_inputs::set_final_data_size): Record
5234 file index for each input file.
5235 (Output_section_incremental_inputs::write_got_plt): Store file index
5236 instead of input entry offset for each GOT entry.
5238 (Incremental_input_entry::Incremental_input_entry): Initialize new
5240 (Incremental_input_entry::set_offset): Store file index.
5241 (Incremental_input_entry::get_file_index): New function.
5242 (Incremental_input_entry::file_index_): New data member.
5243 (Incremental_binary::process_got_plt): New function.
5244 (Incremental_binary::do_process_got_plt): New function.
5245 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5247 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5248 (Sized_incremental_binary::set_file_is_unchanged): New function.
5249 (Sized_incremental_binary::file_is_unchanged): New function.
5250 (Sized_incremental_binary::do_process_got_plt): New function.
5251 (Sized_incremental_binary::file_status_): New data member.
5252 (Sized_incremental_binary::main_symtab_loc_): New data member.
5253 (Sized_incremental_binary::main_strtab_loc_): New data member.
5254 * output.cc (Output_data_got::Got_entry::write): Add case
5256 (Output_data_got::add_global): Call add_got_entry.
5257 (Output_data_got::add_global_plt): Likewise.
5258 (Output_data_got::add_global_with_rel): Likewise.
5259 (Output_data_got::add_global_with_rela): Likewise.
5260 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5261 (Output_data_got::add_global_pair_with_rela): Likewise.
5262 (Output_data_got::add_local): Call add_got_entry.
5263 (Output_data_got::add_local_plt): Likewise.
5264 (Output_data_got::add_local_with_rel): Likewise.
5265 (Output_data_got::add_local_with_rela): Likewise.
5266 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5267 (Output_data_got::add_local_pair_with_rela): Likewise.
5268 (Output_data_got::reserve_slot): New function.
5269 (Output_data_got::reserve_slot_for_global): New function.
5270 (Output_data_got::add_got_entry): New function.
5271 (Output_data_got::add_got_entry_pair): New function.
5272 (Output_section::add_output_section_data): Edit FIXME.
5274 (Output_section_data_build::Output_section_data_build): New
5275 constructor with size parameter.
5276 (Output_data_space::Output_data_space): Likewise.
5277 (Output_data_got::Output_data_got): Initialize new data member; new
5278 constructor with size parameter.
5279 (Output_data_got::add_constant): Call add_got_entry.
5280 (Output_data_got::reserve_slot): New function.
5281 (Output_data_got::reserve_slot_for_global): New function.
5282 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5283 (Output_data_got::add_got_entry): New function.
5284 (Output_data_got::add_got_entry_pair): New function.
5285 (Output_data_got::free_list_): New data member.
5286 * target.h (Sized_target::init_got_plt_for_update): New function.
5287 (Sized_target::register_global_plt_entry): New function.
5288 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5289 Initialize new data member; call init; add constructor with PLT count.
5290 (Output_data_plt_x86_64::init): New function.
5291 (Output_data_plt_x86_64::add_relocation): New function.
5292 (Output_data_plt_x86_64::reserve_slot): New function.
5293 (Output_data_plt_x86_64::free_list_): New data member.
5294 (Target_x86_64::init_got_plt_for_update): New function.
5295 (Target_x86_64::register_global_plt_entry): New function.
5296 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5297 incremental updates.
5298 (Output_data_plt_x86_64::add_relocation): New function.
5299 * testsuite/object_unittest.cc (Object_test): Set default options.
5301 2011-05-16 Ian Lance Taylor <iant@google.com>
5303 * options.h (class General_options): Make -i a synonym for -r.
5305 2011-05-16 Ian Lance Taylor <iant@google.com>
5307 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5309 2011-05-10 Cary Coutant <ccoutant@google.com>
5311 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5314 2011-05-06 Ian Lance Taylor <iant@google.com>
5316 * layout.cc (Layout::layout): If the output section flags change,
5317 update the ordering.
5319 2011-04-25 Cary Coutant <ccoutant@google.com>
5321 * incremental-dump.cc (dump_incremental_inputs): Print local
5322 symbol info for each input file.
5324 (Output_section_incremental_inputs::set_final_data_size): Add local
5325 symbol info to input file entries in incremental info.
5326 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5327 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5328 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5329 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5331 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5332 (Sized_incr_relobj::do_relocate): Write the local symbols.
5333 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5334 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5335 Adjust size of input file header.
5336 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5337 (Incremental_inputs_reader::get_local_symbol_count): New function.
5338 (Incremental_inputs_reader::get_input_section): Adjust size of input
5340 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5341 (Sized_incr_relobj::This): New typedef.
5342 (Sized_incr_relobj::sym_size): New const data member.
5343 (Sized_incr_relobj::Local_symbol): New struct.
5344 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5345 (Sized_incr_relobj::do_local_symbol_offset): New function.
5346 (Sized_incr_relobj::local_symbol_count_): New data member.
5347 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5348 (Sized_incr_relobj::local_symbol_index_): New data member.
5349 (Sized_incr_relobj::local_symbol_offset_): New data member.
5350 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5351 (Sized_incr_relobj::local_symbols_): New data member.
5352 * object.h (Relobj::output_local_symbol_count): New function.
5353 (Relobj::local_symbol_offset): New function.
5354 (Relobj::do_output_local_symbol_count): New function.
5355 (Relobj::do_local_symbol_offset): New function.
5356 (Sized_relobj::do_output_local_symbol_count): New function.
5357 (Sized_relobj::do_local_symbol_offset): New function.
5359 2011-04-22 Vladimir Simonov <sv@sw.ru>
5361 * descriptors.cc (set_close_on_exec): New function.
5362 (Descriptors::open): Use set_close_on_exec.
5363 * output.cc (S_ISLNK): Define if not defined.
5365 2011-04-22 Cary Coutant <ccoutant@google.com>
5367 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5369 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5370 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5371 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5373 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5374 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5375 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5377 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5379 (Incremental_binary::apply_incremental_relocs): New function.
5380 (Incremental_binary::do_apply_incremental_relocs): New function.
5381 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5383 (Sized_incremental_binary::add_global_symbol): New function.
5384 (Sized_incremental_binary::global_symbol): New function.
5385 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5386 (Sized_incremental_binary::symbol_map_): New data member.
5387 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5388 * target.h (Sized_target::apply_relocation): New function.
5389 * target-reloc.h (apply_relocation): New function.
5390 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5392 2011-04-22 Doug Kwan <dougkwan@google.com>
5394 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5395 flag of a SHT_ARM_EXIDX section.
5396 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5397 * testsuite/Makefile.in: Regenerate.
5398 * testsuite/arm_exidx_test.s: New file.
5399 * testsuite/arm_exidx_test.sh: Same.
5401 2011-04-20 Cary Coutant <ccoutant@google.com>
5404 * archive.h (Incremental_archive_entry::Archive_member):
5405 Initialize arg_serial_ (second constructor).
5407 2011-04-17 Ian Lance Taylor <iant@google.com>
5409 * object.cc (Relocate_info::location): Simplify location string.
5410 * errors.cc (Errors::error_at_location): Don't print program
5412 (Errors::warning_at_location): Likewise.
5413 (Errors::undefined_symbol): Likewise.
5414 * testsuite/debug_msg.sh: Update accordingly.
5416 2011-04-14 Cary Coutant <ccoutant@google.com>
5418 * gold/layout.cc (Layout::symtab_section_offset): New function.
5419 * gold/layout.h (Layout::symtab_section_offset): New function.
5420 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5422 2011-04-12 Ian Lance Taylor <iant@google.com>
5424 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5425 with MREMAP_MAYMOVE.
5426 * output.h (class Output_file): Add map_is_allocated_ field.
5427 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5428 not available, provide stubs. If mremap is not available, #define
5430 (MREMAP_MAYMOVE): Define if not defined.
5431 (Output_file::Output_file): Initialize map_is_allocated_.
5432 (Output_file::resize): Check map_is_allocated_.
5433 (Output_file::map_anonymous): If mmap fails, use malloc.
5434 (Output_file::unmap): Don't do anything for an anonymous map.
5435 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5436 is not available, provide stubs.
5437 (File_read::View::~View): Use free rather than delete[].
5438 (File_read::make_view): Use malloc rather than new[]. If mmap
5440 (File_read::find_or_make_view): Use malloc rather than new[].
5441 * gold.h: Remove HAVE_REMAP code.
5442 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5443 exists. Rename mremap to gold_mremap. If mmap is not available
5445 * configure, config.in: Rebuild.
5447 2011-04-11 Ian Lance Taylor <iant@google.com>
5449 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5450 initialize local variable v.
5452 2011-04-11 Cary Coutant <ccoutant@google.com>
5454 * archive.cc (Archive::include_member): Adjust call to
5456 (Add_archive_symbols::run): Track argument serial numbers.
5457 (Lib_group::include_member): Likewise.
5458 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5459 * archive.h (Incremental_archive_entry::Archive_member):
5460 Initialize arg_serial_.
5461 (Archive_member::arg_serial_): New data member.
5462 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5463 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5465 (Sized_dynobj::do_for_all_local_got_entries): New function.
5466 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5468 * fileread.cc (get_mtime): New function.
5469 * fileread.h (get_mtime): New function.
5470 * gold.cc (queue_initial_tasks): Check for incremental update.
5471 (process_incremental_input): New function.
5472 (queue_middle_tasks): Don't force valid target for incremental
5474 * incremental-dump.cc (find_input_containing_global): Adjust
5475 size of symbol info entry.
5476 (dump_incremental_inputs): Dump argument serial number and
5477 in_system_directory flag; bias shndx by 1; print symbol names
5478 when dumping per-file symbol lists; use new symbol info readers.
5480 (Output_section_incremental_inputs:update_data_size): New function.
5481 (Sized_incremental_binary::setup_readers): Setup input readers
5482 for each input file; build maps for files added from libraries
5484 (Sized_incremental_binary::check_input_args): New function.
5485 (Sized_incremental_binary::do_check_inputs): Build map of argument
5486 serial numbers to input arguments.
5487 (Sized_incremental_binary::do_file_has_changed): Rename
5488 do_file_is_unchanged to this; compare file modification times.
5489 (Sized_incremental_binary::do_init_layout): New function.
5490 (Sized_incremental_binary::do_reserve_layout): New function.
5491 (Sized_incremental_binary::do_get_input_reader): Remove.
5492 (Sized_incremental_binary::get_symtab_view): New function.
5493 (Incremental_checker::can_incrementally_link_output_file): Remove.
5494 (Incremental_inputs::report_command_line): Exclude --debug options.
5495 (Incremental_inputs::report_archive_begin): Add parameter; track
5496 argument serial numbers; don't put input file entry for archive
5497 before archive members.
5498 (Incremental_inputs::report_archive_end): Put input file entry
5499 for archive after archive members.
5500 (Incremental_inputs::report_object): Add parameter; track argument
5501 serial numbers and in_system_directory flag.
5502 (Incremental_inputs::report_script): Add parameter; track argument
5504 (Output_section_incremental_inputs::set_final_data_size): Adjust
5505 size of symbol info entry; check for forwarding symbols.
5506 (Output_section_incremental_inputs::write_input_files): Write
5507 in_system_directory flag and argument serial number.
5508 (Output_section_incremental_inputs::write_info_blocks): Map section
5509 indices between incremental info and original input file; store
5510 input section index for each symbol.
5511 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5512 change operator() to visit().
5513 (class Global_got_offset_visitor): Likewise.
5514 (class Global_symbol_visitor_got_plt):
5515 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5517 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5518 (Sized_incr_relobj::do_read_symbols): New function.
5519 (Sized_incr_relobj::do_layout): New function.
5520 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5521 (Sized_incr_relobj::do_add_symbols): New function.
5522 (Sized_incr_relobj::do_should_include_member): New function.
5523 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5524 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5525 (Sized_incr_relobj::do_section_size): New function.
5526 (Sized_incr_relobj::do_section_name): New function.
5527 (Sized_incr_relobj::do_section_contents): New function.
5528 (Sized_incr_relobj::do_section_flags): New function.
5529 (Sized_incr_relobj::do_section_entsize): New function.
5530 (Sized_incr_relobj::do_section_address): New function.
5531 (Sized_incr_relobj::do_section_type): New function.
5532 (Sized_incr_relobj::do_section_link): New function.
5533 (Sized_incr_relobj::do_section_info): New function.
5534 (Sized_incr_relobj::do_section_addralign): New function.
5535 (Sized_incr_relobj::do_initialize_xindex): New function.
5536 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5537 (Sized_incr_relobj::do_read_relocs): New function.
5538 (Sized_incr_relobj::do_gc_process_relocs): New function.
5539 (Sized_incr_relobj::do_scan_relocs): New function.
5540 (Sized_incr_relobj::do_count_local_symbols): New function.
5541 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5542 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5543 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5544 (Sized_incr_relobj::do_relocate): New function.
5545 (Sized_incr_relobj::do_set_section_offset): New function.
5546 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5547 (Sized_incr_dynobj::do_read_symbols): New function.
5548 (Sized_incr_dynobj::do_layout): New function.
5549 (Sized_incr_dynobj::do_add_symbols): New function.
5550 (Sized_incr_dynobj::do_should_include_member): New function.
5551 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5552 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5553 (Sized_incr_dynobj::do_section_size): New function.
5554 (Sized_incr_dynobj::do_section_name): New function.
5555 (Sized_incr_dynobj::do_section_contents): New function.
5556 (Sized_incr_dynobj::do_section_flags): New function.
5557 (Sized_incr_dynobj::do_section_entsize): New function.
5558 (Sized_incr_dynobj::do_section_address): New function.
5559 (Sized_incr_dynobj::do_section_type): New function.
5560 (Sized_incr_dynobj::do_section_link): New function.
5561 (Sized_incr_dynobj::do_section_info): New function.
5562 (Sized_incr_dynobj::do_section_addralign): New function.
5563 (Sized_incr_dynobj::do_initialize_xindex): New function.
5564 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5565 (make_sized_incremental_object): New function.
5566 (Incremental_library::copy_unused_symbols): New function.
5567 (Incremental_library::do_for_all_unused_symbols): New function.
5568 * incremental.h (enum Incremental_input_flags): New type.
5569 (class Incremental_checker): Remove.
5570 (Incremental_input_entry::Incremental_input_entry): Add argument
5572 (Incremental_input_entry::arg_serial): New function.
5573 (Incremental_input_entry::set_is_in_system_directory): New function.
5574 (Incremental_input_entry::is_in_system_directory): New function.
5575 (Incremental_input_entry::arg_serial_): New data member.
5576 (Incremental_input_entry::is_in_system_directory_): New data member.
5577 (class Script_info): Move here from script.h.
5578 (Script_info::Script_info): Add filename parameter.
5579 (Script_info::filename): New function.
5580 (Script_info::filename_): New data member.
5581 (Incremental_script_entry::Incremental_script_entry): Add argument
5583 (Incremental_object_entry::Incremental_object_entry): Likewise.
5584 (Incremental_object_entry::add_input_section): Build list of input
5585 sections with map to original shndx.
5586 (Incremental_object_entry::get_input_section_index): New function.
5587 (Incremental_object_entry::shndx_): New data member.
5588 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5589 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5590 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5592 (Incremental_inputs::report_archive_begin): Likewise.
5593 (Incremental_inputs::report_object): Likewise.
5594 (Incremental_inputs::report_script): Likewise.
5595 (class Incremental_global_symbol_reader): New class.
5596 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5597 and store flags and input file type.
5598 (Incremental_input_entry_reader::arg_serial): New function.
5599 (Incremental_input_entry_reader::type): Extract type from flags.
5600 (Incremental_input_entry_reader::is_in_system_directory): New function.
5601 (Incremental_input_entry_reader::get_input_section_count): Call
5602 accessor function for type.
5603 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5604 function for type; adjust size of global symbol entry.
5605 (Incremental_input_entry_reader::get_global_symbol_count): Call
5606 accessor function for type.
5607 (Incremental_input_entry_reader::get_object_count): Likewise.
5608 (Incremental_input_entry_reader::get_object_offset): Likewise.
5609 (Incremental_input_entry_reader::get_member_count): Likewise.
5610 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5611 (Incremental_input_entry_reader::get_member_offset): Likewise.
5612 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5613 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5614 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5615 (Incremental_input_entry_reader::get_global_symbol_reader): New
5617 (Incremental_input_entry_reader::get_output_symbol_index): New
5619 (Incremental_input_entry_reader::type_): Remove.
5620 (Incremental_input_entry_reader::flags_): New data member.
5621 (Incremental_inputs_reader::input_file_offset): New function.
5622 (Incremental_inputs_reader::input_file_index): New function.
5623 (Incremental_inputs_reader::input_file): Call input_file_offset.
5624 (Incremental_inputs_reader::input_file_at_offset): New function.
5625 (Incremental_relocs_reader::get_r_type): Reformat.
5626 (Incremental_relocs_reader::get_r_shndx): Reformat.
5627 (Incremental_relocs_reader::get_r_offset): Reformat.
5628 (Incremental_relocs_reader::data): New function.
5629 (Incremental_binary::Incremental_binary): Initialize new data members.
5630 (Incremental_binary::check_inputs): Add cmdline parameter.
5631 (Incremental_binary::file_is_unchanged): Remove.
5632 (Input_reader::arg_serial): New function.
5633 (Input_reader::get_unused_symbol_count): New function.
5634 (Input_reader::get_unused_symbol): New function.
5635 (Input_reader::do_arg_serial): New function.
5636 (Input_reader::do_get_unused_symbol_count): New function.
5637 (Input_reader::do_get_unused_symbol): New function.
5638 (Incremental_binary::input_file_count): New function.
5639 (Incremental_binary::get_input_reader): Change signature to use
5640 index instead of filename.
5641 (Incremental_binary::file_has_changed): New function.
5642 (Incremental_binary::get_input_argument): New function.
5643 (Incremental_binary::get_library): New function.
5644 (Incremental_binary::get_script_info): New function.
5645 (Incremental_binary::init_layout): New function.
5646 (Incremental_binary::reserve_layout): New function.
5647 (Incremental_binary::output_file): New function.
5648 (Incremental_binary::do_check_inputs): New function.
5649 (Incremental_binary::do_file_is_unchanged): Remove.
5650 (Incremental_binary::do_file_has_changed): New function.
5651 (Incremental_binary::do_init_layout): New function.
5652 (Incremental_binary::do_reserve_layout): New function.
5653 (Incremental_binary::do_input_file_count): New function.
5654 (Incremental_binary::do_get_input_reader): Change signature.
5655 (Incremental_binary::input_args_map_): New data member.
5656 (Incremental_binary::library_map_): New data member.
5657 (Incremental_binary::script_map_): New data member.
5658 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5660 (Sized_incremental_binary::output_section): New function.
5661 (Sized_incremental_binary::inputs_reader): Add const.
5662 (Sized_incremental_binary::symtab_reader): Add const.
5663 (Sized_incremental_binary::relocs_reader): Add const.
5664 (Sized_incremental_binary::got_plt_reader): Add const.
5665 (Sized_incremental_binary::get_symtab_view): New function.
5666 (Sized_incremental_binary::Inputs_reader): New typedef.
5667 (Sized_incremental_binary::Input_entry_reader): New typedef.
5668 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5669 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5670 (Sized_incremental_binary::do_file_has_changed): New function.
5671 (Sized_incremental_binary::do_init_layout): New function.
5672 (Sized_incremental_binary::do_reserve_layout): New function.
5673 (Sized_input_reader::Inputs_reader): Remove.
5674 (Sized_input_reader::Input_entry_reader): Remove.
5675 (Sized_input_reader::do_arg_serial): New function.
5676 (Sized_input_reader::do_get_unused_symbol_count): New function.
5677 (Sized_input_reader::do_get_unused_symbol): New function.
5678 (Sized_incremental_binary::do_input_file_count): New function.
5679 (Sized_incremental_binary::do_get_input_reader): Change signature;
5680 use index instead of filename.
5681 (Sized_incremental_binary::section_map_): New data member.
5682 (Sized_incremental_binary::input_entry_readers_): New data member.
5683 (class Sized_incr_relobj): New class.
5684 (class Sized_incr_dynobj): New class.
5685 (make_sized_incremental_object): New function.
5686 (class Incremental_library): New class.
5687 * layout.cc (Free_list::num_lists): New static data member.
5688 (Free_list::num_nodes): New static data member.
5689 (Free_list::num_removes): New static data member.
5690 (Free_list::num_remove_visits): New static data member.
5691 (Free_list::num_allocates): New static data member.
5692 (Free_list::num_allocate_visits): New static data member.
5693 (Free_list::init): New function.
5694 (Free_list::remove): New function.
5695 (Free_list::allocate): New function.
5696 (Free_list::dump): New function.
5697 (Free_list::print_stats): New function.
5698 (Layout_task_runner::run): Resize output file for incremental updates.
5699 (Layout::Layout): Initialize new data members.
5700 (Layout::set_incremental_base): New function.
5701 (Layout::init_fixed_output_section): New function.
5702 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5703 incremental updates.
5704 (Layout::create_gold_note): Do not create gold note section for
5705 incremental updates.
5706 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5707 for incremental updates.
5708 (Layout::set_section_offsets): For incremental updates, allocate space
5710 (Layout::create_symtab_sections): Layout with offsets relative to
5711 start of section; for incremental updates, allocate space from free
5713 (Layout::create_shdrs): For incremental updates, allocate space from
5715 (Layout::finish_dynamic_section): For incremental updates, do not
5716 check --as-needed (fixed in subsequent patch).
5717 * layout.h (class Free_list): New class.
5718 (Layout::set_incremental_base): New function.
5719 (Layout::incremental_base): New function.
5720 (Layout::init_fixed_output_section): New function.
5721 (Layout::allocate): New function.
5722 (Layout::incremental_base_): New data member.
5723 (Layout::free_list_): New data member.
5724 * main.cc (main): Print Free_list statistics.
5725 * object.cc (Relobj::finalize_incremental_relocs): Add
5726 clear_counts parameter; clear counts only when clear_counts is set.
5727 (Sized_relobj::Sized_relobj): Initialize new base class.
5728 (Sized_relobj::do_layout): Don't report special sections.
5729 (Sized_relobj::do_for_all_local_got_entries): New function.
5730 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5731 symtab_off to all symbol table offsets.
5732 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5733 * object.h (class Got_offset_list): Move to top of file.
5734 (Object::Object): Allow case where input_file == NULL.
5735 (Object::~Object): Likewise.
5736 (Object::input_file): Assert that input_file != NULL.
5737 (Object::lock): Allow case where input_file == NULL.
5738 (Object::unlock): Likewise.
5739 (Object::is_locked): Likewise.
5740 (Object::token): Likewise.
5741 (Object::release): Likewise.
5742 (Object::is_incremental): New function.
5743 (Object::get_mtime): New function.
5744 (Object::for_all_local_got_entries): New function.
5745 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5746 (Object::set_is_in_system_directory): New function.
5747 (Object::is_in_system_directory): New function.
5748 (Object::do_is_incremental): New function.
5749 (Object::do_get_mtime): New function.
5750 (Object::do_for_all_local_got_entries): New function.
5751 (Object::is_in_system_directory_): New data member.
5752 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5753 (class Sized_relobj_base): New class.
5754 (class Sized_relobj): Derive from Sized_relobj_base.
5755 (class Sized_relobj::Symbols): Redeclare from base class.
5756 (class Sized_relobj::local_got_offset_list): Remove.
5757 (class Sized_relobj::Output_sections): Redeclare from base class.
5758 (class Sized_relobj::do_for_all_local_got_entries): New function.
5759 (class Sized_relobj::write_local_symbols): Add offset parameter.
5760 (class Sized_relobj::local_symbol_offset_): Update comment.
5761 (class Sized_relobj::local_dynsym_offset_): Update comment.
5762 * options.cc (Input_arguments::add_file): Remove const.
5763 * options.h (Input_file_argument::Input_file_argument):
5764 Initialize arg_serial_ (all constructors).
5765 (Input_file_argument::set_arg_serial): New function.
5766 (Input_file_argument::arg_serial): New function.
5767 (Input_file_argument::arg_serial_): New data member.
5768 (Input_arguments::Input_arguments): Initialize file_count_.
5769 (Input_arguments::add_file): Remove const.
5770 (Input_arguments::number_of_input_files): New function.
5771 (Input_arguments::file_count_): New data member.
5772 (Command_line::number_of_input_files): Call
5773 Input_arguments::number_of_input_files.
5774 * output.cc (Output_segment_headers::Output_segment_headers):
5776 (Output_section::Input_section::current_data_size): New function.
5777 (Output_section::Output_section): Initialize new data members.
5778 (Output_section::add_input_section): Don't do merge sections for
5779 an incremental link; allocate space from free list for an
5781 (Output_section::add_output_section_data): Allocate space from
5782 free list for an incremental update.
5783 (Output_section::update_data_size): New function.
5784 (Output_section::set_fixed_layout): New function.
5785 (Output_section::reserve): New function.
5786 (Output_segment::set_section_addresses): Remove const.
5787 (Output_segment::set_section_list_addresses): Remove const; allocate
5788 space from free list for an incremental update.
5789 (Output_segment::set_offset): Adjust size of RELRO segment for an
5791 * output.h (Output_data::current_data_size): Move here from
5793 (Output_data::pre_finalize_data_size): New function.
5794 (Output_data::update_data_size): New function.
5795 (Output_section_headers::update_data_size): new function.
5796 (Output_section_data_build::current_data_size): Move to Output_data.
5797 (Output_data_strtab::update_data_size): New function.
5798 (Output_section::current_data_size): Move to Output_data.
5799 (Output_section::set_fixed_layout): New function.
5800 (Output_section::has_fixed_layout): New function.
5801 (Output_section::reserve): New function.
5802 (Output_section::update_data_size): New function.
5803 (Output_section::has_fixed_layout_): New data member.
5804 (Output_section::free_list_): New data member.
5805 (Output_segment::set_section_addresses): Remove const.
5806 (Output_segment::set_section_list_addresses): Remove const.
5807 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5809 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5811 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5812 parameter when calling Add_symbols constructor; store argument
5813 serial number for members of a lib group.
5814 (Add_symbols::locks): Allow case where token == NULL.
5815 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5816 (Read_member::~Read_member): New function.
5817 (Read_member::is_runnable): New function.
5818 (Read_member::locks): New function.
5819 (Read_member::run): New function.
5820 (Check_script::~Check_script): New function.
5821 (Check_script::is_runnable): New function.
5822 (Check_script::locks): New function.
5823 (Check_script::run): New function.
5824 (Check_library::~Check_library): New function.
5825 (Check_library::is_runnable): New function.
5826 (Check_library::locks): New function.
5827 (Check_library::run): New function.
5828 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5829 (Add_symbols::library_): New data member.
5830 (class Read_member): New class.
5831 (class Check_script): New class.
5832 (class Check_library): New class.
5833 * reloc.cc (Read_relocs::is_runnable): Allow case where
5835 (Read_relocs::locks): Likewise.
5836 (Scan_relocs::locks): Likewise.
5837 (Relocate_task::locks): Likewise.
5838 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5840 (Sized_relobj::incremental_relocs_scan): Fix comment.
5841 (Sized_relobj::do_relocate): Pass output file offset to
5842 write_local_symbols.
5843 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5844 from class declaration.
5845 * script.cc (read_input_script): Allocate Script_info; pass
5846 argument serial number to report_script.
5847 * script.h (class Script_info): Move to incremental.h.
5848 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5849 * symtab.h (Symbol_table::add_from_incrobj): New function.
5850 (Symbol_table::set_file_offset): New function.
5852 2011-04-05 Cary Coutant <ccoutant@google.com>
5854 * incremental-dump.cc (dump_incremental_inputs): Change signature
5855 to take a Sized_incremental_binary; change caller. Use readers
5856 in Sized_incremental_binary.
5858 (Sized_incremental_binary::find_incremental_inputs_sections):
5859 Rename do_find_incremental_inputs_sections to this.
5860 (Sized_incremental_binary::setup_readers): New function.
5861 (Sized_incremental_binary::do_check_inputs): Check
5862 has_incremental_info_ flag; move setup code to setup_readers;
5864 (Sized_incremental_binary::do_file_is_unchanged): New function.
5865 (Sized_incremental_binary::do_get_input_reader): New function.
5866 * incremental.h (class Incremental_binary): Move to end of file.
5867 (Incremental_binary::file_is_unchanged): New function.
5868 (Incremental_binary::do_file_is_unchanged): New function.
5869 (Incremental_binary::Input_reader): New class.
5870 (Incremental_binary::get_input_reader): New function.
5871 (class Sized_incremental_binary): Move to end of file.
5872 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5873 input section reader classes.
5874 (Sized_incremental_binary::has_incremental_info): New function.
5875 (Sized_incremental_binary::inputs_reader): New function.
5876 (Sized_incremental_binary::symtab_reader): New function.
5877 (Sized_incremental_binary::relocs_reader): New function.
5878 (Sized_incremental_binary::got_plt_reader): New function.
5879 (Sized_incremental_binary::do_file_is_unchanged): New function.
5880 (Sized_incremental_binary::Sized_input_reader): New class.
5881 (Sized_incremental_binary::get_input_reader): New function.
5882 (Sized_incremental_binary::find_incremental_inputs_sections):
5883 Rename do_find_incremental_inputs_sections to this.
5884 (Sized_incremental_binary::setup_readers): New function.
5885 (Sized_incremental_binary::has_incremental_info_): New data member.
5886 (Sized_incremental_binary::inputs_reader_): New data member.
5887 (Sized_incremental_binary::symtab_reader_): New data member.
5888 (Sized_incremental_binary::relocs_reader_): New data member.
5889 (Sized_incremental_binary::got_plt_reader_): New data member.
5890 (Sized_incremental_binary::current_input_file_): New data member.
5892 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5895 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5898 2011-03-30 Cary Coutant <ccoutant@google.com>
5900 * archive.cc (Archive::include_member): Adjust call to report_object.
5901 (Add_archive_symbols::run): Add script_info to call to
5902 report_archive_begin.
5903 (Lib_group::include_member): Adjust call to report_object.
5904 (Add_lib_group_symbols::run): Adjust call to report_object.
5905 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5906 blocks. Add object count for script input files.
5907 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5908 script_info parameter; change all callers.
5909 (Incremental_inputs::report_object): Add script_info parameter;
5911 (Incremental_inputs::report_script): Store backpointer to
5912 incremental info entry.
5913 (Output_section_incremental_inputs::set_final_data_size): Record
5914 additional information for scripts.
5915 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5916 * incremental.h (Incremental_script_entry::add_object): New function.
5917 (Incremental_script_entry::get_object_count): New function.
5918 (Incremental_script_entry::get_object): New function.
5919 (Incremental_script_entry::objects_): New data member; adjust
5921 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5922 (Incremental_inputs::report_object): Add script_info parameter.
5923 (Incremental_inputs_reader::get_object_count): New function.
5924 (Incremental_inputs_reader::get_object_offset): New function.
5925 * options.cc (Input_arguments::add_file): Return reference to
5927 * options.h (Input_argument::set_script_info): New function.
5928 (Input_argument::script_info): New function.
5929 (Input_argument::script_info_): New data member; adjust all
5931 (Input_file_group::add_file): Return reference to new input argument.
5932 (Input_file_lib::add_file): Likewise.
5933 (Input_arguments::add_file): Likewise.
5934 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5935 * script.cc (Parser_closure::Parser_closure): Add script_info
5936 parameter; adjust all callers.
5937 (Parser_closure::script_info): New function.
5938 (Parser_closure::script_info_): New data member.
5939 (read_input_script): Report scripts earlier to incremental info.
5940 (script_add_file): Set script_info in Input_argument.
5941 (script_add_library): Likewise.
5942 * script.h (Script_options::Script_info): Rewrite class.
5944 2011-03-29 Cary Coutant <ccoutant@google.com>
5946 * archive.cc (Library_base::should_include_member): Move
5947 method here from class Archive.
5948 (Archive::Archive): Initialize base class.
5949 (Archive::should_include_member): Move to base class.
5950 (Archive::do_for_all_unused_symbols): New function.
5951 (Add_archive_symbols::run): Remove redundant access to
5953 (Lib_group::Lib_group): Initialize base class.
5954 (Lib_group::do_filename): New function.
5955 (Lib_group::include_member): Pass pointer to Lib_group to
5957 (Lib_group::do_for_all_unused_symbols): New function.
5958 (Add_lib_group_symbols::run): Report archive information for
5960 * archive.h (class Library_base): New base class.
5961 (class Archive): Derive from Library_base.
5962 (Archive::filename): Move to base class.
5963 (Archive::set_incremental_info): Likewise.
5964 (Archive::incremental_info): Likewise.
5965 (Archive::Should_include): Likewise.
5966 (Archive::should_include_member): Likewise.
5967 (Archive::Armap_entry): Remove.
5968 (Archive::Unused_symbol_iterator): Remove.
5969 (Archive::unused_symbols_begin): Remove.
5970 (Archive::unused_symbols_end): Remove.
5971 (Archive::do_filename): New function.
5972 (Archive::do_get_mtime): New function.
5973 (Archive::do_for_all_unused_symbols): New function.
5974 (Archive::task_): Move to base class.
5975 (Archive::incremental_info_): Likewise.
5976 (class Lib_group): Derive from Library_base.
5977 (Lib_group::do_filename): New function.
5978 (Lib_group::do_get_mtime): New function.
5979 (Lib_group::do_for_all_unused_symbols): New function.
5980 (Lib_group::task_): Move to base class.
5981 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5983 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5985 * incremental.cc (Incremental_inputs::report_archive_begin):
5986 Use Library_base; call library's get_mtime; add incremental inputs
5987 entry before members.
5988 (class Unused_symbol_visitor): New class.
5989 (Incremental_inputs::report_archive_end): Use Library_base; use
5990 visitor class to record unused symbols; don't add incremental inputs
5991 entry after members.
5992 (Incremental_inputs::report_object): Use Library_base.
5994 (Incremental_archive_entry::Incremental_archive_entry): Remove
5995 unused Archive parameter.
5996 (Incremental_inputs::report_archive_begin): Use Library_base.
5997 (Incremental_inputs::report_archive_end): Likewise.
5998 (Incremental_inputs::report_object): Likewise.
5999 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6001 * object.h (Object::for_all_global_symbols): New function.
6002 (Object::do_for_all_global_symbols): New function.
6003 (Sized_relobj::do_for_all_global_symbols): New function.
6004 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6006 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6009 2011-03-27 Ian Lance Taylor <iant@google.com>
6011 * archive.cc (Archive::interpret_header): Return -1 if something
6012 goes wrong. Change callers accordingly.
6014 2011-03-25 Cary Coutant <ccoutant@google.com>
6016 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6017 * testsuite/Makefile.in: Regenerate.
6019 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6021 * plugin.cc (get_view): New.
6022 (Plugin::load): Pass get_view to the plugin.
6023 (Plugin_manager::get_view): New.
6025 2011-03-21 Ian Lance Taylor <iant@google.com>
6027 * testsuite/final_layout.sh: Rewrite to not use dc.
6028 * testsuite/relro_test.sh: Fail if dc is not present.
6030 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6032 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6034 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6035 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6037 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6038 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6040 2011-03-14 Ian Lance Taylor <iant@google.com>
6042 * script-sections.cc (Sort_output_sections::script_compare):
6043 Rename from is_before, change return type.
6044 (Sort_output_sections::operator()): Adjust accordingly.
6046 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6049 * testsuite/odr_violation2.cc: Add comment to make all error line
6050 numbers double digits.
6051 * testsuite/debug_msg.sh: Adjust expected errors.
6053 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6055 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6056 but mark earlier ones as non-canonical
6057 (offset_to_iterator): Update search target and example
6058 (do_addr2line): Return extra lines in a vector*
6059 (format_file_lineno): Extract from do_addr2line
6060 (one_addr2line): Add vector* out-param
6061 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6062 when a lineno entry appeared last for its instruction
6063 (Dwarf_line_info): Add vector* out-param
6064 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6065 * symtab.cc (Odr_violation_compare): Include the lineno in the
6067 (linenos_from_loc): New. Combine the canonical line for an
6068 address with its other lines.
6069 (True_if_intersect): New. Helper functor to make
6070 std::set_intersection a query.
6071 (detect_odr_violations): Compare sets of lines instead of just
6072 one line for each function. This became less deterministic, but
6073 has fewer false positives.
6074 * symtab.h: Declarations.
6075 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6076 mix an optimized and non-optimized object in the same binary
6077 (odr_violation2.so): Same.
6078 * testsuite/Makefile.in: Regenerate from Makefile.am.
6079 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6080 * testsuite/debug_msg.sh: Update line numbers and add
6082 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6083 non-optimized context.
6084 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6085 isn't inlined, and use OdrDerived in an optimized context.
6086 * testsuite/odr_header1.h: Defines OdrDerived, where
6087 optimization will change the
6088 first-instruction-in-the-destructor's file and line number.
6089 * testsuite/odr_header2.h: Defines OdrBase.
6091 2011-03-09 Ian Lance Taylor <iant@google.com>
6093 * fileread.cc (File_read::clear_views): Don't delete the whole
6096 2011-03-08 Ian Lance Taylor <iant@google.com>
6099 * fileread.cc: #include <climits>.
6100 (GOLD_IOV_MAX): Define.
6101 (File_read::read_multiple): Limit number of entries by iov_max.
6102 * fileread.h (class File_read): Always set max_readv_entries to
6105 2011-03-07 Ian Lance Taylor <iant@google.com>
6108 * options.h (class General_options): Add -dy and -dn.
6110 2011-03-02 Cary Coutant <ccoutant@google.com>
6112 * testsuite/script_test_9.t: Add TLS segment.
6114 2011-03-02 Simon Baldwin <simonb@google.com>
6116 * configure.ac: Add check for gnu_indirect_function support in
6117 the toolchain building binutils.
6118 * configure: Rebuild.
6120 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6122 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6123 plugin only symbols.
6124 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6125 in plugin files as not needed in the symbol table.
6127 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6129 * output.cc (Output_section::add_input_section): Delay fill
6130 generation for section ordering.
6132 2011-02-09 Ian Lance Taylor <iant@google.com>
6135 * object.h (class Sized_relobj): Remove clear_local_symbols.
6136 * reloc.cc (Sized_relobj::do_relocate): Don't call
6137 clear_local_symbols.
6139 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6141 * plugin.cc (is_visible_from_outside): Return true for symbols
6144 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6146 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6149 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6151 * icf.h (is_section_foldable_candidate): Change type of parameter
6153 * icf.cc (Icf::find_identical_sections): Change type of local variable
6154 section_name to be std::string.
6155 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6157 2011-01-25 Ian Lance Taylor <iant@google.com>
6159 * script.cc (script_add_extern): Rewrite to use
6160 add_symbol_reference.
6162 2011-01-25 Doug Kwan <dougkwan@google.com>
6164 * icf.cc (get_section_contents): Always lock section's object.
6166 2011-01-24 Ian Lance Taylor <iant@google.com>
6168 * options.h (class General_options): Accept
6169 --no-detect-odr-violations.
6171 2011-01-24 Ian Lance Taylor <iant@google.com>
6173 * version.cc (version_string): Bump to 1.11.
6175 2011-01-24 Ian Lance Taylor <iant@google.com>
6177 * plugin.cc (class Plugin_rescan): Define new class.
6178 (Plugin_manager::claim_file): Set any_claimed_.
6179 (Plugin_manager::save_archive): New function.
6180 (Plugin_manager::save_input_group): New function.
6181 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6183 (Plugin_manager::new_undefined_symbol): New function.
6184 (Plugin_manager::rescan): New function.
6185 (Plugin_manager::rescannable_defines): New function.
6186 (Plugin_manager::add_input_file): Set any_added_.
6187 * plugin.h (class Plugin_manager): define new fields rescannable_,
6188 undefined_symbols_, any_claimed_, and any_added_. Declare
6189 Plugin_rescan as friend. Declare new functions.
6190 (Plugin_manager::Rescannable): Define type.
6191 (Plugin_manager::Rescannable_list): Define type.
6192 (Plugin_manager::Undefined_symbol_list): Define type.
6193 (Plugin_manager::Plugin_manager): Initialize new fields.
6194 * archive.cc (Archive::defines_symbol): New function.
6195 (Add_archive_symbols::run): Pass archive to plugins if any.
6196 * archive.h (class Archive): Declare defines_symbol.
6197 * readsyms.cc (Input_group::~Input_group): New function.
6198 (Finish_group::run): Pass input_group to plugins if any.
6199 * readsyms.h (class Input_group): Declare destructor.
6200 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6203 2011-01-10 Ian Lance Taylor <iant@google.com>
6205 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6207 (Layout::set_segment_offsets): Reset increase_relro before calling
6208 set_section_addresses a second time.
6210 2011-01-04 Cary Coutant <ccoutant@google.com>
6212 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6213 sections before NOBITS sections.
6215 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6217 * version.cc (print_version): Update copyright to 2011.
6219 2010-12-23 Cary Coutant <ccoutant@google.com>
6221 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6222 of OS to this->add. Add OD parameter to second form of the function.
6224 2010-12-20 Ian Lance Taylor <iant@google.com>
6226 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6227 second of two consecutive entries with same offset.
6229 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6231 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6232 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6233 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6234 to avoid unneeded links against $(LDADD).
6235 * testsuite/Makefile.in: Regenerate.
6237 2010-12-15 Ian Lance Taylor <iant@google.com>
6240 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6241 for R_X86_64_32 and R_X86_64_PC32.
6242 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6243 ver_matching_def_pic.o.
6244 (ver_matching_def_pic.o): New target.
6246 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6248 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6249 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6250 Move definition before File_read::View member definitions.
6251 (File_read::View::~View): Initialize and hold lock before
6252 updating current_mapped_bytes.
6254 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6256 * dwarf_reader.cc: Remove outdated comment.
6257 * gold-threads.cc: Fix typo in error message.
6258 * archive.cc: Fix typos in comments.
6259 * archive.h: Likewise.
6260 * arm-reloc-property.cc: Likewise.
6261 * arm-reloc-property.h: Likewise.
6262 * arm-reloc.def: Likewise.
6264 * attributes.h: Likewise.
6265 * cref.cc: Likewise.
6266 * ehframe.cc: Likewise.
6267 * fileread.h: Likewise.
6269 * i386.cc: Likewise.
6271 * incremental.h: Likewise.
6272 * int_encoding.cc: Likewise.
6273 * layout.h: Likewise.
6274 * main.cc: Likewise.
6275 * merge.h: Likewise.
6276 * object.cc: Likewise.
6277 * object.h: Likewise.
6278 * options.cc: Likewise.
6279 * readsyms.cc: Likewise.
6280 * reduced_debug_output.cc: Likewise.
6281 * reloc.cc: Likewise.
6282 * script-sections.cc: Likewise.
6283 * sparc.cc: Likewise.
6284 * symtab.h: Likewise.
6285 * target-reloc.h: Likewise.
6286 * target.cc: Likewise.
6287 * target.h: Likewise.
6288 * timer.cc: Likewise.
6289 * timer.h: Likewise.
6290 * x86_64.cc: Likewise.
6292 2010-12-09 Cary Coutant <ccoutant@google.com>
6294 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6296 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6297 parameter; change all callers.
6298 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6299 * options.h (warn_execstack): New option.
6301 2010-12-07 Doug Kwan <dougkwan@google.com>
6303 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6304 like function call relocations.
6306 2010-12-07 Ian Lance Taylor <iant@google.com>
6308 * archive.cc (Archive::get_elf_object_for_member): Permit
6309 punconfigured to be NULL.
6310 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6311 (Archive::include_member): Pass NULL to get_elf_object_for_member
6312 if we searched for the archive and this is the first included
6315 2010-12-01 Ian Lance Taylor <iant@google.com>
6317 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6318 track_relocs_type_ field.
6319 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6320 Set track_relocs_type_.
6321 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6322 contents when using RELA relocs.
6323 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6325 * reloc.cc (Track_relocs::next_addend): New function.
6326 * reloc.h (class Track_relocs): Declare next_addend.
6328 2010-12-01 Ian Lance Taylor <iant@google.com>
6330 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6333 2010-12-01 Ian Lance Taylor <iant@google.com>
6335 * README: Update compilers known to work and fail.
6337 2010-11-23 Matthias Klose <doko@ubuntu.com>
6339 * configure.in: For --enable-gold, handle value `default' instead of
6340 `both*'. Always install ld as ld.bfd, install as ld if gold is
6342 * configure: Regenerate.
6344 2010-11-18 Doug Kwan <dougkwan@google.com>
6346 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6347 and right_alignment to be zero. Store result alignment only if it is
6348 greater than existing alignment.
6350 2010-11-16 Cary Coutant <ccoutant@google.com>
6353 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6354 Check for ".zdebug_line".
6356 2010-11-16 Doug Kwan <dougkwan@google.com>
6357 Cary Coutant <ccoutant@google.com>
6359 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6360 by reference; adjust all callers.
6361 * output.cc (Output_segment::set_section_addresses): Adjust references
6362 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6364 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6365 end at page boundary.
6367 2010-11-16 Cary Coutant <ccoutant@google.com>
6370 * layout.cc (Layout::choose_output_section): Transform names of
6371 compressed sections even when using a script with a SECTIONS clause.
6372 (Layout::output_section_name): Remove code to transform
6373 compressed debug section names.
6374 * output.cc (Output_section::add_input_section): Use uncompressed
6375 section size when tracking input sections.
6377 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6379 * symtab.h (Symbol::NON_PIC_REF): Remove.
6380 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6381 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6382 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6383 (Symbol::use_plt_offset): Take a flags argument and pass it
6384 directly to needs_dynamic_reloc. Restrict check for undefined
6385 weak symbols to function calls.
6386 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6387 (Target_arm::Scan::global): Use it.
6388 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6389 (Target_arm::Relocate::relocate): Likewise.
6390 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6391 parameter with an r_type parameter. Use get_reference_flags
6393 (Target_arm::Relocate::relocate): Update accordingly.
6394 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6395 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6396 (Target_i386::Scan::global): Likewise.
6397 (Target_i386::Relocate::relocate): Likewise.
6398 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6399 parameter with an r_type parameter. Use get_reference_flags
6401 (Target_i386::Relocate::relocate): Update accordingly.
6402 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6403 (Target_powerpc::Scan::global): Use it.
6404 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6405 (Target_powerpc::Relocate::relocate): Likewise.
6406 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6407 (Target_sparc::Scan::global): Use it.
6408 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6409 (Target_sparc::Relocate::relocate): Likewise.
6410 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6411 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6412 (Target_x86_64::Scan::global): Likewise.
6413 (Target_x86_64::Relocate::relocate): Likewise.
6415 2010-11-08 Doug Kwan <dougkwan@google.com>
6416 Cary Coutant <ccoutant@google.com>
6418 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6419 (Arm_exidx_merge_section::section_contents_): New data member.
6420 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6421 (Arm_input_section::~Arm_input_section): De-allocate memory.
6422 (Arm_input_section::original_contents_): New data member.
6423 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6424 in parameters instead of calling Object::section_contents without
6426 (Arm_output_section::group_section): New parameter TASK. Pass it
6427 to callees that need locking objects.
6428 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6429 to lock EXIDX input sections. Fix a formatting issue. Call
6430 Arm_exidx_merged_section::build_contents to create merged section
6432 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6433 to lock object of stub table owner.
6434 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6435 TEXT_SIZE to initialize data member TEXT_SIZE_.
6436 (Arm_exidx_input_section::addralign): Fix typo in comment.
6437 (Arm_exidx_input_section::text_size): New method.
6438 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6439 that require locking objects. Lock objects before scanning for stubs
6440 and updating local symbols.
6441 (Arm_input_section<big_endian>::init): Copy contents of original
6443 (Arm_input_section<big_endian>::do_write): Use saved contents of
6444 original input section instead of calling Object::section_contents
6446 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6447 size without calling Object::section_size().
6448 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6449 for size. Allocate a buffer for merged EXIDX entries.
6450 (Arm_exidx_merged_section::build_contents): New method.
6451 (Arm_exidx_merged_section::do_write): Move merge section contents
6452 building code to Arm_exidx_merged_section::build_contetns. Write
6453 out contetns in buffer instead of building it on the fly.
6454 (Arm_relobj::make_exidx_input_section): Also pass text section size
6455 to Arm_exidx_input_section constructor.
6456 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6457 (Arm_dynobj::do_read_symbols): Fix memory leak.
6458 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6459 * target.h: (class Task): Add forward declaration.
6460 (Target::relax): Add new parameter TASK and pass it to
6462 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6464 2010-11-05 Cary Coutant <ccoutant@google.com>
6467 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6468 object when reading from the file.
6469 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6471 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6472 when reading section contents.
6473 (get_section_contents): Likewise.
6474 (icf::find_identical_sections): Likewise.
6475 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6476 object when reading from the file.
6477 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6478 the object when doing deferred section layout.
6480 2010-11-03 Nick Clifton <nickc@redhat.com>
6483 * script.h (class Symbol_assignment: name): New member. Returns
6484 the name of the symbol.
6485 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6486 Returns true if the given symbol name is on the list of
6487 assignments wating to be processed.
6488 * archive.cc (should_incldue_member): If the symbol is undefined,
6489 check to see if it is on the list of symbols pending assignment.
6491 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6493 * script-sections.cc (Script_sections::find_memory_region): Check
6494 for a NULL output section pointer.
6496 2010-10-29 Doug Kwan <dougkwan@google.com>
6498 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6499 Output_section::add_relaxed_input_section.
6500 * output.cc (Output_section::add_relaxed_input_section): Add new
6501 arguments LAYOUT and NAME. Set section order index.
6502 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6503 Copy section order index.
6504 * output.h (Output_section::add_relaxed_input_section): Add new
6505 arguments LAYOUT and NAME.
6507 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6509 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6510 NATIVE_OR_CROSS_LINKER.
6511 * testsuite/Makefile.in: Regenerate.
6513 2010-10-20 Doug Kwan <dougkwan@google.com>
6515 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6516 without SHF_LINK_ORDER flags.
6517 * layout.cc (Layout::choose_output_section): Do not filter
6518 SHF_LINK_ORDER flag in a relocatable link.
6520 2010-10-17 Cary Coutant <ccoutant@google.com>
6522 * output.h (Output_segment::set_section_addresses): Change function
6523 signature. Update all callers.
6524 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6526 (Output_segment::set_section_addresses): Align after last TLS
6527 section. Add padding before last relro section instead of after.
6529 2010-10-17 Doug Kwan <dougkwan@google.com>
6531 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6532 GOT output section to be writable.
6534 2010-10-14 Cary Coutant <ccoutant@google.com>
6536 * debug.h (DEBUG_INCREMENTAL): New flag.
6537 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6538 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6540 * incremental.cc (report_command_line): Ignore all forms of
6542 * layout.cc (Layout::Layout): Check parameters for incremental link
6544 * options.cc (General_options::parse_incremental): New function.
6545 (General_options::parse_no_incremental): New function.
6546 (General_options::parse_incremental_full): New function.
6547 (General_options::parse_incremental_update): New function.
6548 (General_options::incremental_mode_): New data member.
6549 (General_options::finalize): Check incremental_mode_.
6550 * options.h (General_options): Update help text for --incremental.
6551 Add --no-incremental, --incremental-full, --incremental-update.
6552 (General_options::Incremental_mode): New enum type.
6553 (General_options::incremental_mode): New function.
6554 (General_options::incremental_mode_): New data member.
6555 * parameters.cc (Parameters::incremental_mode_): New data member.
6556 (Parameters::set_options): Set incremental_mode_.
6557 (Parameters::set_incremental_full): New function.
6558 (Parameters::incremental): New function.
6559 (Parameters::incremental_update): New function.
6560 (set_parameters_incremental_full): New function.
6561 * parameters.h (Parameters::set_incremental_full): New function.
6562 (Parameters::incremental): New function.
6563 (Parameters::incremental_update): New function.
6564 (Parameters::incremental_mode_): New data member.
6565 (set_parameters_incremental_full): New function.
6566 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6567 incremental link mode.
6568 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6569 (Sized_relobj::do_relocate_sections): Likewise.
6570 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6572 * testsuite/Makefile.in: Regenerate.
6573 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6575 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6577 * script-sections.h (class Script_sections): Make
6578 Sections_elements typedef public.
6579 * script-sections.cc (class Sort_output_sections): Add elements_
6580 field. Add constructor which sets it; change all callers.
6581 (Sort_output_sections::is_before): New function.
6582 (Sort_output_sections::operator()): Call is_before.
6583 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6585 * testsuite/script_test_10.sh: New test. Test script section
6587 * testsuite/script_test_10.t: Likewise.
6588 * testsuite/script_test_10.s: Likewise.
6589 * testsuite/Makefile.am: Wrap the cross linker tests and the
6590 common tests into NATIVE_OR_CROSS_LINKER.
6591 (check_SCRIPTS): Add script_test_10.sh.
6592 (check_DATA): Add script_test_10.stdout.
6593 (script_test_10.o, script_test_10): New targets.
6594 (script_test_10.stdout): New target.
6595 * configure, testsuite/Makefile.in: Regenerate.
6597 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6599 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6600 error for the deprecated relocations.
6601 (Target_arm::Scan::global): Likewise.
6602 (Target_arm::Relocate::relocate): Likewise.
6604 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6606 * fileread.cc (Input_file::find_file): Initialize *found_name
6607 and *namep when using the fallback search for case 4.
6609 2010-10-11 Cary Coutant <ccoutant@google.com>
6611 * options.h (class General_options): Redefine -z lazy as an alias for
6612 the negation of -z now.
6614 2010-10-11 Ian Lance Taylor <iant@google.com>
6616 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6619 2010-10-06 Nick Clifton <nickc@redhat.com>
6621 * script-sections.cc(class Memory_region): Remove
6622 current_lma_offset_ field. Rename current_vma_offset_ to
6623 current_offset_. Add last_section_ field.
6624 (Memory_region::get_current_vma_address): Rename to
6625 get_current_address.
6626 (Memory_region::get_current_lma_address): Delete.
6627 (Memory_region::increment_vma_offset): Rename to
6629 (Memory_region::increment_lma_offset): Delete.
6630 (Memory_region::attributes_compatible): New method. Returns
6631 true if the provided section is compatible with the region.
6632 (Memory_region::get_last_section): New method. Returns the last
6633 section to use the region.
6634 (Memory_region::set_last_section): New method. Stores the last
6635 section to use the region.
6636 (Script_sections::block_in_region): New method. Returns true if
6637 a block of memory is contained within a region.
6638 (Script_sections::find_memory_region): New method. Locates a
6639 memory region to be used to set a VMA or LMA address.
6640 (Output_section_definition::set_section_addresses): Add code to
6641 check for addresses set by memory regions.
6642 (Output_segment::set_section_addresses): Remove memory region
6644 (Script_sections::create_segment): Add a warning if a header
6645 segment is created outside of any region.
6646 * script-sections.h (class Script_sections): Add prototypes for
6647 find_memory_region and block_in_region methods.
6648 * testsuite/memory_test.s: Use .long instead of .word.
6649 * testsuite/memory_test.t: Add some more output sections.
6650 * testsuite/memory_test.sh: Update expected output.
6652 2010-10-02 Doug Kwan <dougkwan@google.com>
6654 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6655 defintion to symtab.h
6656 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6657 declaration to defintion.
6659 2010-10-01 Nick Clifton <nickc@redhat.com>
6661 * expression.cc (eval): Replace dummy argument with NULL.
6662 (eval_maybe_dot): Check for a NULL result section pointer.
6663 (Symbol_expression::value): Likewise.
6664 (Dot_expression::value): Likewise.
6665 (BINARY_EXPRESSION): Likewise.
6666 (Max_expression::value): Likewise.
6667 (Min_expression::value): Likewise.
6668 (Absolute_expression::value): Likewise.
6669 (Addr_expression::value_from_output_section): Likewise.
6670 (Loaddddr_expression::value_from_output_section): Likewise.
6671 (Segment_start_expression::value): Likewise.
6672 * script-sections.cc
6673 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6675 (Sections_elememt_dot_assignment::set_section_addresses):
6677 (Output_data_expression::do_write_to_buffer): Likewise.
6678 (Output_section_definition::finalize_symbols): Likewise.
6679 (Output_section_definition::set_section_addresses): Likewise.
6681 2010-09-30 Doug Kwan <dougkwan@google.com>
6683 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6685 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6687 * target.h (Target::can_icf_inline_merge_sections): New virtual
6689 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6691 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6693 * icf.cc (get_section_contents): Inline merge sections only when
6696 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6698 * configure: Regenerate.
6700 2010-09-17 Ian Lance Taylor <iant@google.com>
6702 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6703 * testsuite/Makefile.am (memory_test.o): New target.
6704 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6706 * testsuite/Makefile.in: Rebuild.
6708 2010-09-17 Doug Kwan <dougkwan@google.com>
6710 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6711 defintion if relocation uses GOT entries of the symbol.
6712 * testsuite/icf_safe_test.sh: Fix test.
6713 * testsuite/icf_safe_so_test.sh: Fix test.
6715 2010-09-16 Cary Coutant <ccoutant@google.com>
6717 * script_sections.cc (class Memory_region): Remove "NULL" from
6718 vector initializations.
6720 2010-09-15 Cary Coutant <ccoutant@google.com>
6722 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6723 Resolve forwarding symbols.
6725 2010-09-15 Doug Kwan <dougkwan@google.com>
6727 * gold/testsuite/script_test_3.t: Add ARM special sections.
6728 * gold/testsuite/script_test_4.t: Same.
6729 * gold/testsuite/script_test_5.t: Same.
6730 * gold/testsuite/script_test_6.t: Same.
6731 * gold/testsuite/script_test_7.t: Same.
6732 * gold/testsuite/script_test_7.t: Same.
6733 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6735 2010-09-14 Cary Coutant <ccoutant@google.com>
6737 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6738 (Target_x86_64::Relocate::relocate_tls): Replace check for
6739 saw_tls_block_reloc_ with test for executable section.
6741 2010-09-12 Cary Coutant <ccoutant@google.com>
6743 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6744 position-independent executables to shared libraries need dynamic
6746 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6747 position-independent executables.
6748 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6749 * testsuite/Makefile.in: Regenerate.
6751 2010-09-10 Nick Clifton <nickc@redhat.com>
6754 * testsuite/memory_test.t: Discard any sections that are not
6757 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6760 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6761 "This::" to work around a bug in gcc 4.2.
6763 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6765 2010-09-09 Rafael Espindola <espindola@google.com>
6767 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6768 sections with different PF_X flags in the same segment.
6769 (Layout::find_first_load_seg): Search all segments to find the first
6771 * options.h (rosegment): New.
6773 2010-09-08 Rafael Espindola <espindola@google.com>
6775 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6777 2010-09-08 Doug Kwan <dougkwan@google.com>
6779 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6780 (Arm_relobj::do_relocate_sections): Add new parameter for output
6781 file to match the parent.
6782 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6783 of local symbols instead of input values. Update code to track
6784 changes in gold::relocate_section.
6785 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6786 (Sized_relobj::compute_final_local_value_internal): New methods.
6787 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6788 body into private version of Sized_relobj::compute_final_local_value.
6789 Call the inline method.
6790 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6791 merged symbol value if there is one.
6792 (Symbol_value::has_output_value): New method defintiion.
6793 (Sized_relobj::Compute_final_local_value_status): New enum type.
6794 (Sized_relobj::compute_final_local_value): New methods.
6795 (Sized_relobj::compute_final_local_value_internal): New methods.
6796 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6797 and arm_cortex_a8.sh.
6798 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6799 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6801 * Makefile.in: Regenerate.
6802 * testsuite/arm_bl_out_of_range.s: Update test.
6803 * testsuite/thumb_bl_out_of_range.s: Ditto.
6804 * testsuite/thumb_blx_out_of_range.s: Ditto.
6805 * testsuite/arm_branch_out_of_range.sh: New file.
6806 * testsuite/arm_cortex_a8.sh: Ditto.
6807 * testsuite/arm_cortex_a8_b.s: Ditto.
6808 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6809 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6810 * testsuite/arm_cortex_a8_bl.s: Ditto.
6811 * testsuite/arm_cortex_a8_blx.s: Ditto.
6812 * testsuite/arm_cortex_a8_local.s: Ditto.
6813 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6814 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6816 2010-09-08 Rafael Espindola <espindola@google.com>
6818 * Makefile.am (memory_test.stdout): Run readelf with -W.
6819 * Makefile.in: Regenerate.
6820 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6823 2010-09-08 Rafael Espindola <espindola@google.com>
6825 * script-sections.cc (Script_sections::add_memory_region): Convert
6826 field precision to int.
6827 * script.cc (script_set_section_region, script_set_section_region):
6828 Convert field precision to int.
6830 2010-09-08 Rafael Espindola <espindola@google.com>
6832 * arm.cc (do_finalize_sections): Create the __exidx_start and
6833 __exdix_end symbols even when the section is missing.
6835 2010-09-08 Nick Clifton <nickc@redhat.com>
6837 * README: Remove claim that MEMORY is not supported.
6838 * expression.cc (script_exp_function_origin)
6839 (script_exp_function_length): Move from here to ...
6840 * script.cc: ... here.
6841 (script_set_section_region, script_add_memory)
6842 (script_parse_memory_attr, script_include_directive): New
6844 * script-sections.cc
6845 (class Memory_region): New class.
6846 (class Output_section_definition): Add set_memory_region,
6847 set_section_vma, set_section_lma and get_section_name methods.
6848 (class Script_Sections): Add add_memory_region,
6849 find_memory_region, find_memory_region_origin,
6850 find_memory_region_length and set_memory_region methods.
6851 Have set_section_addresses method walk the list of set memory
6853 Extend the print methos to display memory regions.
6854 * script-sections.h: Add prototypes for new methods.
6855 Add enum for MEMORY region attributes.
6856 * yyscript.y: Add support for parsing MEMORY regions.
6857 * script-c.h: Add prototypes for new functions.
6858 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6859 * testsuite/Makefile.in: Regenerate.
6860 * testsuite/memory_test.sh: New script.
6861 * testsuite/memory_test.s: New assembler source file.
6862 * testsuite/memory_test.t: New linker script.
6864 2010-08-27 Doug Kwan <dougkwan@google.com>
6866 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6867 reference override an existing dynamic weak reference.
6868 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6869 * testsuite/Makefile.in: Regenerate.
6870 * testsuite/dyn_weak_ref.sh: New file.
6871 * testsuite/dyn_weak_ref_1.c: Ditto.
6872 * testsuite/dyn_weak_ref_2.c: Ditto.
6874 2010-08-27 Ian Lance Taylor <iant@google.com>
6876 * incremental.h (class Incremental_input_entry): Add virtual
6879 2010-08-27 Ian Lance Taylor <iant@google.com>
6881 * testsuite/start_lib_test_3.c: Mark t3 as used.
6883 2010-08-27 Nick Clifton <nickc@redhat.com>
6885 * options.cc (version_script): Fix small typo in previous
6888 2010-08-25 Nick Clifton <nickc@redhat.com>
6890 * archive.cc: Formatting fixes: Remove whitespace between
6891 typename and following asterisk. Remove whitespace between
6892 function name and opening parenthesis.
6893 * archive.h: Likewise.
6895 * attributes.cc: Likewise.
6896 * attributes.h: Likewise.
6897 * common.cc: Likewise.
6898 * copy-relocs.cc: Likewise.
6899 * dirsearch.h: Likewise.
6900 * dynobj.cc: Likewise.
6901 * ehframe.cc: Likewise.
6902 * ehframe.h: Likewise.
6903 * expression.cc: Likewise.
6904 * fileread.cc: Likewise.
6905 * fileread.h: Likewise.
6907 * gold-threads.cc: Likewise.
6908 * gold.cc: Likewise.
6909 * i386.cc: Likewise.
6911 * incremental-dump.cc: Likewise.
6912 * incremental.cc: Likewise.
6913 * layout.cc: Likewise.
6914 * layout.h: Likewise.
6915 * main.cc: Likewise.
6916 * merge.cc: Likewise.
6917 * merge.h: Likewise.
6918 * object.cc: Likewise.
6919 * object.h: Likewise.
6920 * options.cc: Likewise.
6921 * options.h: Likewise.
6922 * output.cc: Likewise.
6923 * output.h: Likewise.
6924 * plugin.cc: Likewise.
6925 * plugin.h: Likewise.
6926 * powerpc.cc: Likewise.
6927 * reloc.cc: Likewise.
6928 * script-c.h: Likewise.
6929 * script-sections.cc: Likewise.
6930 * script.cc: Likewise.
6931 * stringpool.cc: Likewise.
6932 * symtab.cc: Likewise.
6933 * symtab.h: Likewise.
6934 * target.cc: Likewise.
6935 * timer.cc: Likewise.
6936 * timer.h: Likewise.
6937 * version.cc: Likewise.
6938 * x86_64.cc: Likewise.
6940 2010-08-24 Nick Clifton <nickc@redhat.com>
6943 * layout.cc (segment_precedes): Sort segments by their physical
6944 addresses, if they have been set.
6946 2010-08-23 Cary Coutant <ccoutant@google.com>
6948 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6950 (Lib_group::include_member): Unlock object after deleting its
6952 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6955 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6956 Cary Coutant <ccoutant@google.com>
6958 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6959 constructor, and set_blocker.
6960 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6962 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6963 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6964 * testsuite/Makefile.am (start_lib_test): New test case.
6965 * testsuite/Makefile.in: Regenerate.
6966 * testsuite/start_lib_test_main.c: New file.
6967 * testsuite/start_lib_test_1.c: New file.
6968 * testsuite/start_lib_test_2.c: New file.
6969 * testsuite/start_lib_test_3.c: New file.
6971 2010-08-19 Ian Lance Taylor <iant@google.com>
6973 * Makefile.in: Rebuild with automake 1.11.1.
6974 * aclocal.m4: Likewise.
6975 * testsuite/Makefile.in: Likewise.
6977 2010-08-19 Ian Lance Taylor <iant@google.com>
6980 * i386.cc (class Output_data_plt_i386): Update declarations.
6981 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6982 local_ifuncs_ fields.
6983 (Target_i386::do_plt_section_for_global): New function.
6984 (Target_i386::do_plt_section_for_local): New function.
6985 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6986 parameter; change all callers. Initialize global_ifuncs_ and
6987 local_ifuncs_. If doing a static link define __rel_iplt_start and
6989 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6990 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6991 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6993 (Target_i386::make_plt_section): New function, broken out of
6994 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6995 (Target_i386::make_plt_entry): Call make_plt_section.
6996 (Target_i386::make_local_ifunc_plt_entry): New function.
6997 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6998 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6999 R_386_IRELATIVE to switch.
7000 (Target_i386::Scan::global): Likewise.
7001 (Target_i386::Relocate::relocate): Likewise.
7002 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7004 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7005 (Target_x86_64::do_plt_section_for_global): New function.
7006 (Target_x86_64::do_plt_section_for_local): New function.
7007 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7008 parameter; change all callers. If doing a static link define
7009 __rela_iplt_start and __rela_iplt_end.
7010 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7011 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7012 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7014 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7015 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7017 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7018 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7019 R_X86_64_IRELATIVE to switch.
7020 (Target_x86_64::Scan::global): Likewise.
7021 (Target_x86_64::Relocate::relocate): Likewise.
7022 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7024 * target.h (class Target): Add plt_section_for_global and
7025 plt_section_for_local functions. Add do_plt_section_for_global
7026 and do_plt_section_for_local virtual functions.
7027 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7028 clarifying comments.
7029 (Symbol::use_plt_offset): Handle IFUNC symbol.
7030 * object.cc (Sized_relobj::Sized_relobj): Initialize
7032 (Sized_relobj::local_has_plt_offset): New function.
7033 (Sized_relobj::local_plt_offset): New function.
7034 (Sized_relobj::set_local_plt_offset): New function.
7035 (Sized_relobj::do_count): Handle IFUNC symbol.
7036 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7037 a bit away from input_shndx_ field. Add set_is_func_symbol and
7038 is_ifunc_symbol functions.
7039 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7040 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7041 local_plt_offsets_ field.
7042 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7043 * output.h (class Output_section_data): Add non-const
7044 output_section function.
7045 (class Output_data_got): Update declarations.
7046 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7047 Add use_plt_offset parameter to global and local constructors.
7048 Change all callers. Change local_sym_index_ field to 31 bits.
7049 Change GSYM_CODE and CONSTANT_CODE accordingly.
7050 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7051 doing a static link don't set sh_link field.
7052 (Output_data_got::Got_entry::write): Use PLT offset if
7054 (Output_data_got::add_global_plt): New function.
7055 (Output_data_got::add_local_plt): New function.
7056 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7057 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7058 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7059 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7060 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7062 * testsuite/ifunc-sel.h: New file.
7063 * testsuite/ifuncmain1.c: New file.
7064 * testsuite/ifuncmain1vis.c: New file.
7065 * testsuite/ifuncmod1.c: New file.
7066 * testsuite/ifuncdep2.c: New file.
7067 * testsuite/ifuncmain2.c: New file.
7068 * testsuite/ifuncmain3.c: New file.
7069 * testsuite/ifuncmod3.c: New file.
7070 * testsuite/ifuncmain4.c: New file.
7071 * testsuite/ifuncmain5.c: New file.
7072 * testsuite/ifuncmod5.c: New file.
7073 * testsuite/ifuncmain6pie.c: New file.
7074 * testsuite/ifuncmod6.c: New file.
7075 * testsuite/ifuncmain7.c: New file.
7076 * configure, testsuite/Makefile.in: Rebuild.
7078 2010-08-18 Ian Lance Taylor <iant@google.com>
7081 (Output_section_incremental_inputs::write_input_files): Add cast
7082 to avoid signed/unsigned comparison warning.
7083 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7085 2010-08-12 Cary Coutant <ccoutant@google.com>
7087 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7089 2010-08-13 Ian Lance Taylor <iant@google.com>
7091 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7093 2010-08-12 Cary Coutant <ccoutant@google.com>
7094 Doug Kwan <dougkwan@google.com>
7096 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7097 defintion overrides non-weak undef, remember that the original undef
7099 * symtab.cc (Symbol_table::sized_write_global): For undef without
7100 an original weak binding, set binding to global in output.
7101 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7102 * testsuite/Makefile.in: Regenerate.
7103 * testsuite/strong_ref_weak_def.sh: New file.
7104 * testsuite/strong_ref_weak_def_1.c: Ditto.
7105 * testsuite/strong_ref_weak_def_2.c: Ditto.
7107 2010-08-12 Cary Coutant <ccoutant@google.com>
7109 * testsuite/incremental_test.sh: Rewrite.
7110 * testsuite/incremental_test_1.c: Rewrite.
7111 * testsuite/incremental_test_2.c: Rewrite.
7113 2010-08-12 Cary Coutant <ccoutant@google.com>
7115 * arm.cc (Target_arm::got_size): Add const.
7116 (Target_arm::got_entry_count): New function.
7117 (Target_arm::plt_entry_count): New function.
7118 (Target_arm::first_plt_entry_offset): New function.
7119 (Target_arm::plt_entry_size): New function.
7120 (Output_data_plt_arm::entry_count): New function.
7121 (Output_data_plt_arm::first_plt_entry_offset): New function.
7122 (Output_data_plt_arm::get_plt_entry_size): New function.
7123 * i386.cc (Target_i386::got_size): Add const.
7124 (Target_i386::got_entry_count): New function.
7125 (Target_i386::plt_entry_count): New function.
7126 (Target_i386::first_plt_entry_offset): New function.
7127 (Target_i386::plt_entry_size): New function.
7128 (Output_data_plt_i386::entry_count): New function.
7129 (Output_data_plt_i386::first_plt_entry_offset): New function.
7130 (Output_data_plt_i386::get_plt_entry_size): New function.
7131 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7132 find_incremental_inputs_sections. Dump incremental_got_plt section.
7133 * incremental.cc: Include target.h.
7134 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7135 parameter. Adjust all callers. Find incremental_got_plt section.
7136 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7138 (Output_section_incremental_inputs::set_final_data_size): Calculate
7139 size of incremental_got_plt section.
7140 (Output_section_incremental_inputs::do_write): Write the
7141 incremental_got_plt section.
7142 (Got_plt_view_info): New struct.
7143 (Local_got_offset_visitor): New class.
7144 (Global_got_offset_visitor): New class.
7145 (Global_symbol_visitor_got_plt): New class.
7146 (Output_section_incremental_inputs::write_got_plt): New function.
7147 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7148 Add parameter. Adjust all callers.
7149 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7150 (Incremental_inputs::got_plt_section): New function.
7151 (Incremental_inputs::got_plt_section_): New data member.
7152 (Incremental_got_plt_reader): New class.
7153 * layout.cc (Layout::create_incremental_info_sections): Add the
7154 incremental_got_plt section.
7155 * object.h (Got_offset_list::get_list): New function.
7156 (Got offset_list::for_all_got_offsets): New function.
7157 (Sized_relobj::local_got_offset_list): New function.
7158 * powerpc.cc (Target_powerpc::got_size): Add const.
7159 (Target_powerpc::got_entry_count): New function.
7160 (Target_powerpc::plt_entry_count): New function.
7161 (Target_powerpc::first_plt_entry_offset): New function.
7162 (Target_powerpc::plt_entry_size): New function.
7163 (Output_data_plt_powerpc::entry_count): New function.
7164 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7165 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7166 * sparc.cc (Target_sparc::got_size): Add const.
7167 (Target_sparc::got_entry_count): New function.
7168 (Target_sparc::plt_entry_count): New function.
7169 (Target_sparc::first_plt_entry_offset): New function.
7170 (Target_sparc::plt_entry_size): New function.
7171 (Output_data_plt_sparc::entry_count): New function.
7172 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7173 (Output_data_plt_sparc::get_plt_entry_size): New function.
7174 * symtab.h (Symbol::got_offset_list): New function.
7175 (Symbol_table::for_all_symbols): New function.
7176 * target.h (Sized_target::got_entry_count): New function.
7177 (Sized_target::plt_entry_count): New function.
7178 (Sized_target::plt_entry_size): New function.
7179 * x86_64.cc (Target_x86_64::got_size): Add const.
7180 (Target_x86_64::got_entry_count): New function.
7181 (Target_x86_64::plt_entry_count): New function.
7182 (Target_x86_64::first_plt_entry_offset): New function.
7183 (Target_x86_64::plt_entry_size): New function.
7184 (Output_data_plt_x86_64::entry_count): New function.
7185 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7186 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7188 2010-08-12 Cary Coutant <ccoutant@google.com>
7190 * archive.cc: Include incremental.h.
7191 (Archive::Archive): Initialize incremental_info_.
7192 (Archive::include_member): Record archive members in incremental info.
7193 (Add_archive_symbols::run): Record begin and end of an archive in
7195 (Lib_group::include_member): Record objects in incremental info.
7196 * archive.h (Incremental_archive_entry): Forward declaration.
7197 (Archive::set_incremental_info): New member function.
7198 (Archive::incremental_info): New member function.
7199 (Archive::Unused_symbol_iterator): New class.
7200 (Archive::unused_symbols_begin): New member function.
7201 (Archive::unused_symbols_end): New member function.
7202 (Archive::incremental_info_): New data member.
7203 * incremental-dump.cc (find_input_containing_global): New function.
7204 (dump_incremental_inputs): Dump new incremental info sections.
7205 * incremental.cc: Include symtab.h.
7206 (Output_section_incremental_inputs): New class.
7207 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7208 new incremental info sections.
7209 (Sized_incremental_binary::do_check_inputs): Likewise.
7210 (Incremental_inputs::report_archive): Remove.
7211 (Incremental_inputs::report_archive_begin): New function.
7212 (Incremental_inputs::report_archive_end): New function.
7213 (Incremental_inputs::report_object): New function.
7214 (Incremental_inputs::finalize_inputs): Remove.
7215 (Incremental_inputs::report_input_section): New function.
7216 (Incremental_inputs::report_script): Rewrite.
7217 (Incremental_inputs::finalize): Do nothing but finalize string table.
7218 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7219 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7220 (Incremental_inputs::create_data_sections): New function.
7221 (Incremental_inputs::relocs_entsize): New function.
7222 (Output_section_incremental_inputs::set_final_data_size): New function.
7223 (Output_section_incremental_inputs::do_write): New function.
7224 (Output_section_incremental_inputs::write_header): New function.
7225 (Output_section_incremental_inputs::write_input_files): New function.
7226 (Output_section_incremental_inputs::write_info_blocks): New function.
7227 (Output_section_incremental_inputs::write_symtab): New function.
7228 * incremental.h (Incremental_script_entry): Forward declaration.
7229 (Incremental_object_entry): Forward declaration.
7230 (Incremental_archive_entry): Forward declaration.
7231 (Incremental_inputs): Forward declaration.
7232 (Incremental_inputs_header_data): Remove.
7233 (Incremental_inputs_header): Remove.
7234 (Incremental_inputs_header_write): Remove.
7235 (Incremental_inputs_entry_data): Remove.
7236 (Incremental_inputs_entry): Remove.
7237 (Incremental_inputs_entry_write): Remove.
7238 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7239 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7240 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7241 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7243 (Incremental_input_entry): New class.
7244 (Incremental_script_entry): New class.
7245 (Incremental_object_entry): New class.
7246 (Incremental_archive_entry): New class.
7247 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7248 (Incremental_inputs::report_inputs): Remove.
7249 (Incremental_inputs::report_archive): Remove.
7250 (Incremental_inputs::report_archive_begin): New function.
7251 (Incremental_inputs::report_archive_end): New function.
7252 (Incremental_inputs::report_object): Change prototype.
7253 (Incremental_inputs::report_input_section): New function.
7254 (Incremental_inputs::report_script): Change prototype.
7255 (Incremental_inputs::get_reloc_count): New function.
7256 (Incremental_inputs::set_reloc_count): New function.
7257 (Incremental_inputs::create_data_sections): New function.
7258 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7259 (Incremental_inputs::inputs_section): New function.
7260 (Incremental_inputs::symtab_section): New function.
7261 (Incremental_inputs::relocs_section): New function.
7262 (Incremental_inputs::get_stringpool): Add const.
7263 (Incremental_inputs::command_line): Add const.
7264 (Incremental_inputs::inputs): Remove.
7265 (Incremental_inputs::command_line_key): New function.
7266 (Incremental_inputs::input_file_count): New function.
7267 (Incremental_inputs::input_files): New function.
7268 (Incremental_inputs::relocs_entsize): New function.
7269 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7270 (Incremental_inputs::finalize_inputs): Remove.
7271 (Incremental_inputs::Input_info): Remove.
7272 (Incremental_inputs::lock_): Remove.
7273 (Incremental_inputs::inputs_): Change type.
7274 (Incremental_inputs::inputs_map_): Remove.
7275 (Incremental_inputs::current_object_entry_): New data member.
7276 (Incremental_inputs::inputs_section_): New data member.
7277 (Incremental_inputs::symtab_section_): New data member.
7278 (Incremental_inputs::relocs_section_): New data member.
7279 (Incremental_inputs::reloc_count_): New data member.
7280 (Incremental_inputs_reader): New class.
7281 (Incremental_symtab_reader): New class.
7282 (Incremental_relocs_reader): New class.
7283 * layout.cc (Layout::finalize): Move finalization of incremental info
7284 and creation of incremental info sections to follow finalization of
7285 symbol table. Set offsets for postprocessing sections.
7286 (Layout::create_incremental_info_sections): Call
7287 Incremental_inputs::create_data_sections. Add incremental symtab
7288 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7289 sections to layout after input sections.
7290 * layout.h (struct Timespec): Forward declaration.
7291 (Layout::incremental_inputs): Add const.
7292 (Layout::create_incremental_info_sections): Add parameter.
7293 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7294 * object.cc: Include incremental.h.
7295 (Relobj::finalize_incremental_relocs): New function.
7296 (Sized_relobj::do_layout): Record input sections in incremental info.
7297 * object.h (Object::output_section): New function.
7298 (Object::output_section_offset): Moved from Relobj.
7299 (Object::get_incremental_reloc_base): New function.
7300 (Object::get_incremental_reloc_count): New function.
7301 (Object::do_output_section): New function.
7302 (Object::do_output_section_offset): Moved from Relobj.
7303 (Object::do_get_incremental_reloc_base): New function.
7304 (Object::do_get_incremental_reloc_count): New function.
7305 (Object::Object): Initialize new data members.
7306 (Relobj::output_section): Renamed do_output_section and moved to
7308 (Relobj::output_section_offset): Moved to Object.
7309 (Relobj::do_get_incremental_reloc_base): New function.
7310 (Relobj::do_get_incremental_reloc_count): New function.
7311 (Relobj::allocate_incremental_reloc_counts): New function.
7312 (Relobj::count_incremental_reloc): New function.
7313 (Relobj::finalize_incremental_relocs): New function.
7314 (Relobj::next_incremental_reloc_index): New function.
7315 (Relobj::reloc_counts_): New data member.
7316 (Relobj::reloc_bases_): New data member.
7317 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7318 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7319 (Sized_relobj::incremental_relocs_scan): New function.
7320 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7321 (Sized_relobj::incremental_relocs_write): New function.
7322 (Sized_relobj::incremental_relocs_write_reltype): New function.
7323 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7325 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7326 archives and object files elsewhere.
7327 (Add_symbols::run): Report object files here.
7328 (Finish_group::run): Report end of archive at end of group.
7329 * reloc.cc: Include layout.h, incremental.h.
7330 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7331 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7332 (Sized_relobj::incremental_relocs_scan): New function.
7333 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7334 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7335 (Sized_relobj::incremental_relocs_write): New function.
7336 (Sized_relobj::incremental_relocs_write_reltype): New function.
7337 * script.cc (read_input_script): Rewrite test for incremental link.
7338 Change call to Incremental_inputs::report_script.
7339 * symtab.h (Symbol_table::first_global_index): New function.
7340 (Symbol_table::output_count): New function.
7342 2010-08-12 Doug Kwan <dougkwan@google.com>
7344 * arm.cc (Target_arm::merge_object_attributes): Check command line
7345 options --no-wchar-size-warning and --no-enum-size-warning.
7346 * options.h (General_options): Add ld-compatible options
7347 --no-enum-size-warning and --no-wchar-size-warning.
7349 2010-08-04 Ian Lance Taylor <iant@google.com>
7351 * x86_64.cc (Target_x86_64::Scan::local): Use
7352 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7353 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7354 (Target_x86_64::Scan::global): Likewise.
7355 (Target_x86_64::Relocate::relocate): Likewise.
7356 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7359 2010-08-03 Cary Coutant <ccoutant@google.com>
7361 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7362 to reserve space in merged_strings vector. Keep total input size
7364 (Output_merge_string::do_print_merge_stats): Print total input size.
7365 * merge.h (Output_merge_string): Add input_size_ field.
7366 * stringpool.cc (Stringpool_template::string_length): Move
7367 implementations out of Stringpool_template class and place in
7369 * stringpool.h (string_length): Move out of Stringpool_template.
7371 2010-08-03 Ian Lance Taylor <iant@google.com>
7374 * layout.cc (relaxation_loop_body): If address of load segment is
7375 set, adjust address to include headers if possible.
7377 2010-08-03 Ian Lance Taylor <iant@google.com>
7379 * version.cc (version_string): Bump to 1.10.
7381 2010-08-03 Ian Lance Taylor <iant@google.com>
7384 * layout.h (enum Output_section_order): Define.
7385 (class Layout): Update declarations.
7386 * layout.cc (Layout::get_output_section): Add order parameter.
7387 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7388 is_first_non_relro parameters. Change all callers.
7389 (Layout::choose_output_section): Likewise.
7390 (Layout::add_output_section_data): Likewise.
7391 (Layout::make_output_section): Likewise. Set order.
7392 (Layout::default_section_order): New function.
7393 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7394 * output.cc (Output_section::Output_section): Initialize order_.
7395 Don't initialize deleted fields.
7396 (Output_segment::Output_segment): Don't initialize deleted
7398 (Output_segment::add_output_section_to_load): New function
7399 replacing add_output_section. Change all callers to call this or
7400 add_output_section_to_nonload.
7401 (Output_segment::add_output_section_to_nonload): New function.
7402 (Output_segment::remove_output_section): Rewrite.
7403 (Output_segment::add_initial_output_data): Likewise.
7404 (Output_segment::has_any_data_sections): Likewise.
7405 (Output_segment::is_first_section_relro): Likewise.
7406 (Output_segment::maximum_alignment): Likewise.
7407 (Output_segment::has_dynamic_reloc): New function replacing
7408 dynamic_reloc_count. Change all callers.
7409 (Output_segment::has_dynamic_reloc_list): New function replacing
7410 dynamic_reloc_count_list. Change all callers.
7411 (Output_segment::set_section_addresses): Rewrite.
7412 (Output_segment::set_offset): Rewrite.
7413 (Output_segment::find_first_and_last_list): Remove.
7414 (Output_segment::set_tls_offsets): Rewrite.
7415 (Output_segment::first_section_load_address): Likewise.
7416 (Output_segment::output_section_count): Likewise.
7417 (Output_segment::section_with_lowest_load_address): Likewise.
7418 (Output_segment::write_section_headers): Likewise.
7419 (Output_segment::print_sections_to_map): Likewise.
7420 * output.h (class Output_data): Remove dynamic_reloc_count_
7421 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7422 (Output_data::add_dynamic_reloc): Rewrite.
7423 (Output_data::has_dynamic_reloc): New function.
7424 (Output_data::dynamic_reloc_count): Remove.
7425 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7426 is_last_relro_, is_first_non_relro_, is_interp_,
7427 is_dynamic_linker_section_ fields. Add order and set_order
7428 functions. Remove is_relro_local, set_is_relro_local,
7429 is_last_relro, set_is_last_relro, is_first_non_relro,
7430 set_is_first_non_relro functions, is_interp, set_is_interp,
7431 is_dynamic_linker_section, and set_is_dynamic_linker_section
7433 (class Output_segment): Change Output_data_list from std::list to
7434 std:;vector. Add output_lists_ field. Remove output_data_ and
7435 output_bss_ fields. Update declarations.
7437 2010-08-02 Ian Lance Taylor <iant@google.com>
7439 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7440 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7441 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7443 2010-08-02 Ian Lance Taylor <iant@google.com>
7446 * script.cc (Script_options::Script_options): Initialize
7447 symbol_definitions_ and symbol_references_.
7448 (Script_options::add_symbol_assignment): Update
7449 symbol_definitions_ and symbol_references_.
7450 (Script_options::add_symbol_reference): New function.
7451 (script_symbol): New function.
7452 * script.h (class Script_options): Add symbol_definitions_ and
7453 symbol_references_ fields.
7454 (Script_options::referenced_const_iterator): New type.
7455 (Script_options::referenced_begin): New function.
7456 (Script_options::referenced_end): New function.
7457 (Script_options::is_referenced): New function.
7458 (Script_options::any_unreferenced): New function.
7459 * script-c.h (script_symbol): Declare.
7460 * yyscript.y (exp): Call script_symbol.
7461 * symtab.cc: Include "script.h".
7462 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7463 Change all callers. Check symbols referenced by scripts.
7464 (Symbol_table::add_undefined_symbols_from_command_line): Add
7465 layout parameter. Change all callers.
7466 (Symbol_table::do_add_undefined_symbols_from_command_line):
7467 Likewise. Break out loop body. Check symbols referenced by
7469 (Symbol_table::add_undefined_symbol_from_command_line): New
7470 function broken out of
7471 do_add_undefined_symbols_from_command_line.
7472 * symtab.h (class Symbol_table): Update declarations.
7473 * archive.cc: Include "layout.h".
7474 (Archive::should_include_member): Add layout parameter. Change
7475 all callers. Check for symbol mentioned in expression.
7476 * archive.h (class Archive): Update declaration.
7477 * object.cc (Sized_relobj::do_should_include_member): Add layout
7479 * object.h (Object::should_include_member): Add layout parameter.
7481 (Object::do_should_include_member): Add layout parameter.
7482 (class Sized_relobj): Update declaration.
7483 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7485 * dynobj.h (class Sized_dynobj): Update declaration.
7486 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7488 * plugin.h (class Sized_pluginobj): Update declaration.
7490 2010-08-02 Ian Lance Taylor <iant@google.com>
7493 * output.cc (Output_segment::set_offset): Search for the first and
7494 last sections rather than assuming that the list is in order.
7495 (Output_segment::find_first_and_last_list): New function.
7496 * output.h (class Output_segment): Update declarations.
7497 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7498 (relro_strip_test_SOURCES): New variable.
7499 (relro_strip_test_DEPENDENCIES): New variable.
7500 (relro_strip_test_LDFLAGS): New variable.
7501 (relro_strip_test_LDADD): New variable.
7502 (relro_strip_test.so): New target.
7504 2010-08-02 Ian Lance Taylor <iant@google.com>
7506 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7507 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7508 (Target_i386::got_tlsdesc_section): New function.
7509 (Target_i386::got_section): Create space for GOT entries for
7510 TLSDESC relocations.
7511 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7513 (Target_i386::Scan::global): Likewise.
7514 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7516 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7517 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7518 (Target_x86_64::got_tlsdesc_section): New function.
7519 (Target_x86_64::got_section): Create space for GOT entries for
7520 TLSDESC relocations.
7521 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7523 (Target_x86_64::Scan::global): Likewise.
7524 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7527 2010-08-02 Ian Lance Taylor <iant@google.com>
7529 * testsuite/final_layout.sh: Use dc to convert from hex to
7532 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7534 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7535 paramter to the call to gold::gc_process_relocs.
7536 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7537 paramter to the call to gold::gc_process_relocs.
7538 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7539 parameter to the call to gold::gc_process_relocs.
7540 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7541 template parameter to the call to gold::gc_process_relocs.
7542 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7543 paramter to the call to gold::gc_process_relocs.
7544 * gc.h (get_embedded_addend_size): New function.
7545 (gc_process_relocs): Save the size of the reloc for use by ICF.
7546 * icf.cc (get_section_contents): Get the addend from the text section
7547 for SHT_REL relocation sections.
7548 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7549 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7550 * int_encoding.h (read_from_pointer): New overloaded function.
7551 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7552 * testsuite/icf_sht_rel_addend_test.sh: New file.
7553 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7554 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7556 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7558 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7559 * Makefile.in: Regenerate.
7560 * testsuite/Makefile.in: Regenerate.
7562 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7564 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7565 * gold/testsuite/debug_msg.cc: Likewise.
7566 * gold/testsuite/odr_violation1.cc
7567 * gold/testsuite/odr_violation2.cc
7569 2010-07-21 Cary Coutant <ccoutant@google.com>
7571 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7572 string, and length fields.
7573 (Output_merge_string::Merged_strings_list): New type.
7574 (Output_merge_string::Merged_strings_lists): New typedef.
7575 (Output_merge_string): Replace merged_strings_ with
7576 merged_strings_lists_.
7577 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7578 Merged_strings_list per input object and section. Don't store pointer
7579 to the string. Don't store length with each merged string entry.
7580 (Output_merge_string::finalize_merged_data): Loop over list of merged
7581 strings lists. Recompute length of each merged string.
7583 2010-07-15 Cary Coutant <ccoutant@google.com>
7585 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7588 2010-07-14 Ian Lance Taylor <iant@google.com>
7590 * descriptors.cc (Descriptors::open): Report correct name in error
7593 2010-07-13 Doug Kwan <dougkwan@google.com>
7595 * arm.cc (Arm_input_section::Arm_input_section): For a
7596 SHT_ARM_EXIDX section, always keeps the input sections.
7597 (Arm_input_section::set_exidx_section_link): New method.
7598 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7599 has_errors_ to false.
7600 (Arm_exidx_input_section::has_errors,
7601 Arm_exidx_input_section::set_has_errors): New methods.
7602 (Arm_exidx_input_section::has_errors_): New data member.
7603 (Arm_relobj::get_exidx_shndx_list): New method.
7604 (Arm_output_section::append_text_sections_to_list): Do not skip
7605 section without SHF_EXECINSTR.
7606 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7608 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7609 section header. Make error messages more verbose. Check for
7610 a non-executable section linked to an EXIDX section.
7611 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7612 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7613 check that there is no deferred EXIDX section if we exit early.
7614 Instead of not making an EXIDX section in case of an error, make one
7615 and set the has_errors flag of it.
7616 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7617 in a relocatable link.
7618 (Target_arm::do_relax): Look for the EXIDX output section instead of
7619 assuming that it is called .ARM.exidx.
7620 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7621 section list. Do not check for SHF_EXECINSTR section flags but
7622 skip any input section with errors.
7623 * output.cc (Output_section::Output_section): Initialize
7624 always_keeps_input_sections_ to false.
7625 (Output_section::add_input_section): Check for
7626 always_keeps_input_sections_.
7627 * output.h (Output_section::always_keeps_input_sections,
7628 Output_section::set_always_keeps_input_sections): New methods.
7629 (Output_section::always_keeps_input_sections): New data member.
7631 2010-07-13 Rafael Espindola <espindola@google.com>
7633 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7634 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7636 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7637 Ian Lance Taylor <iant@google.com>
7639 * output.h (Output_section_lookup_maps::add_merge_section):
7640 Correct check of whether value was inserted.
7641 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7642 (Output_section_lookup_maps::add_relaxed_input_section):
7644 * arm.cc (Target_arm::got_section): Remove used local os.
7645 * i386.cc (Target_i386::got_section): Likewise.
7646 * x86_64.cc (Target_x86_64::got_section): Likewise.
7647 * sparc.cc (Target_sparc::got_section): Likewise.
7648 (Target_sparc::relocate): Remove unused local have_got_offset.
7649 * powerpc.cc (Target_powerpc::relocate): Likewise.
7651 2010-07-13 Ian Lance Taylor <iant@google.com>
7653 * compressed_output.cc (zlib_decompress): Fix signature in
7656 * archive.cc (Archive::include_member): Unlock an external member
7657 of a thin archive. Don't bother to delete an object we know is
7660 2010-07-12 Cary Coutant <ccoutant@google.com>
7662 * compressed_output.cc (zlib_decompress): New function.
7663 (get_uncompressed_size): New function.
7664 (decompress_input_section): New function.
7665 * compressed_output.h (get_uncompressed_size): New function.
7666 (decompress_input_section): New function.
7667 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7668 Handle compressed debug sections.
7669 * layout.cc (is_compressed_debug_section): New function.
7670 (Layout::output_section_name): Map compressed section names to
7672 * layout.h (is_compressed_debug_section): New function.
7673 (is_debug_info_section): Recognize compressed debug sections.
7674 * merge.cc: Include compressed_output.h.
7675 (Output_merge_data::do_add_input_section): Handle compressed
7677 (Output_merge_string::do_add_input_section): Handle compressed
7679 * object.cc: Include compressed_output.h.
7680 (Sized_relobj::Sized_relobj): Initialize new data members.
7681 (build_compressed_section_map): New function.
7682 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7683 * object.h (Object::section_is_compressed): New method.
7684 (Object::do_section_is_compressed): New method.
7685 (Sized_relobj::Compressed_section_map): New type.
7686 (Sized_relobj::do_section_is_compressed): New method.
7687 (Sized_relobj::compressed_sections_): New data member.
7688 * output.cc (Output_section::add_input_section): Handle compressed
7690 * reloc.cc: Include compressed_output.h.
7691 (Sized_relobj::write_sections): Handle compressed debug sections.
7693 2010-07-08 Cary Coutant <ccoutant@google.com>
7695 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7696 weak when resolving to a dynamic def.
7697 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7698 for weak undef/dynamic def cases. Adjust callers.
7699 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7700 undef_binding_weak_.
7701 (Symbol_table::sized_write_globals): Adjust symbol binding.
7702 (Symbol_table::sized_write_symbol): Add binding parameter.
7703 * symtab.h (Symbol::set_undef_binding): New method.
7704 (Symbol::is_undef_binding_weak): New method.
7705 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7706 (Symbol_table::should_override): Add new parameter.
7707 (Symbol_table::sized_write_symbol): Add new parameter.
7709 * testsuite/weak_undef_file1.cc: Add new test case.
7710 * testsuite/weak_undef_file2.cc: Fix header comment.
7711 * testsuite/weak_undef_test.cc: Add new test case.
7713 2010-06-29 Doug Kwan <dougkwan@google.com>
7715 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7716 Initialize USE_SYMBOL_.
7717 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7719 (Arm_reloc_property::uses_symbol_): New data member declaration.
7720 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7721 uses symbol value and symbol is undefined but not weakly undefined.
7723 2010-06-28 Rafael Espindola <espindola@google.com>
7725 * plugin.cc (Plugin::load): Use dlerror.
7727 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7729 * symtab.cc (detect_odr_violations): When reporting an ODR
7730 violation, report an object where the symbol is defined.
7732 2010-06-25 Doug Kwan <dougkwan@google.com>
7734 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7735 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7737 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7738 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7739 target hook to detect function points.
7740 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7741 * icf.h (Icf::check_section_for_function_pointers): Change type of
7742 parameter SECTION_NAME to const reference to std::string. Use
7743 target hook to determine if section may have unsafe pointers.
7744 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7747 2010-06-21 Rafael Espindola <espindola@google.com>
7749 * fileread.cc (Input_file::find_fie): New
7750 (Input_file::open): Use Input_file::find_fie.
7751 * fileread.h (Input_file::find_fie): New
7752 * plugin.cc (set_extra_library_path): New.
7753 (Plugin::load): Add set_extra_library_path to the transfer vector.
7754 (Plugin_manager::set_extra_library_path): New.
7755 (Plugin_manager::add_input_file): Use the extra search path if set.
7756 (set_extra_library_path(): New.
7757 * plugin.h (Plugin_manager): Add set_extra_library_path and
7760 2010-06-19 Cary Coutant <ccoutant@google.com>
7762 * layout.cc (gdb_sections): Add .debug_types.
7763 (lines_only_debug_sections): Likewise.
7765 2010-06-18 Rafael Espindola <espindola@google.com>
7767 * plugin.cc (add_input_file,add_input_library)
7768 (Plugin_manager::add_input_file): Make filename arguments const.
7769 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7772 2010-06-16 Doug Kwan <dougkwan@google.com>
7774 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7775 .ARM.attributes section if we have not merged any input
7776 attributes sections.
7778 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7780 * arm.cc: Allow combining objects with no EABI version
7783 2010-06-15 Rafael Espindola <espindola@google.com>
7785 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7787 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7789 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7790 (struct iovec): Correct !HAVE_READV definition.
7792 2010-06-10 Cary Coutant <ccoutant@google.com>
7794 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7795 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7797 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7800 * symtab.h (Symbol::is_placeholder): New member function.
7801 * target-reloc.h (relocate_section): Check for placeholder symbols.
7803 * testsuite/Makefile.am (plugin_test_8): New test.
7804 (plugin_test_9): New test.
7805 * testsuite/Makefile.in: Regenerate.
7807 2010-06-09 Nick Clifton <nickc@redhat.com>
7809 * yyscript.y (input_list_element): Allow strings prefixed with
7810 the '-' character. Treat these as libraries.
7811 * script.cc (script_add_library): New function. Adds a library
7812 specified by "-l<name>" found in an input script.
7813 * script-c.h: Add prototype for script_add_library.
7815 2010-06-07 Doug Kwan <dougkwan@google.com>
7817 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7818 Restrict stub-group size to be within long conditional branch
7819 range when working around cortex-A8 erratum.
7821 2010-06-07 Damien Diederen <dd@crosstwine.com>
7823 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7826 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7830 (Output_section::Input_section_sort_entry::compare_section_ordering):
7831 Change to return non-zero correctly.
7832 (Output_section::Input_section_sort_section_order_index_compare
7833 ::operator()): Change to fix ambiguity in comparisons.
7835 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7837 * gold.h (is_wildcard_string): New function.
7838 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7839 (Layout::layout_eh_frame): Ditto.
7840 (Layout::find_section_order_index): New method.
7841 (Layout::read_layout_from_file): New method.
7842 * layout.h (Layout::find_section_order_index): New method.
7843 (Layout::read_layout_from_file): New method.
7844 (Layout::input_section_position_): New private member.
7845 (Layout::input_section_glob_): New private member.
7846 * main.cc (main): Call read_layout_from_file here.
7847 * options.h (--section-ordering-file): New option.
7848 * output.cc (Output_section::input_section_order_specified_): New
7850 (Output_section::Output_section): Initialize new member.
7851 (Output_section::add_input_section): Add new parameter.
7852 Keep input sections when --section-ordering-file is used.
7853 (Output_section::set_final_data_size): Sort input sections when
7854 section ordering file is specified.
7855 (Output_section::Input_section_sort_entry): Add new parameter.
7857 (Output_section::Input_section_sort_entry::compare_section_ordering):
7859 (Output_section::Input_section_sort_compare::operator()): Change to
7860 consider section_order_index.
7861 (Output_section::Input_section_sort_init_fini_compare::operator()):
7862 Change to consider section_order_index.
7863 (Output_section::Input_section_sort_section_order_index_compare
7864 ::operator()): New method.
7865 (Output_section::sort_attached_input_sections): Change to sort
7866 according to section order when specified.
7867 (Output_section::add_input_section<32, true>): Add new parameter.
7868 (Output_section::add_input_section<64, true>): Add new parameter.
7869 (Output_section::add_input_section<32, false>): Add new parameter.
7870 (Output_section::add_input_section<64, false>): Add new parameter.
7871 * output.h (Output_section::add_input_section): Add new parameter.
7872 (Output_section::input_section_order_specified): New
7874 (Output_section::set_input_section_order_specified): New method.
7875 (Input_section::Input_section): Initialize section_order_index_.
7876 (Input_section::section_order_index): New method.
7877 (Input_section::set_section_order_index): New method.
7878 (Input_section::section_order_index_): New member.
7879 (Input_section::Input_section_sort_section_order_index_compare): New
7881 (Output_section::input_section_order_specified_): New member.
7882 * script-sections.cc (is_wildcard_string): Delete and move modified
7884 (Output_section_element_input::Output_section_element_input): Modify
7885 call to is_wildcard_string.
7886 (Output_section_element_input::Input_section_pattern
7887 ::Input_section_pattern): Ditto.
7888 (Output_section_element_input::Output_section_element_input): Ditto.
7889 * testsuite/Makefile.am (final_layout): New test case.
7890 * testsuite/Makefile.in: Regenerate.
7891 * testsuite/final_layout.cc: New file.
7892 * testsuite/final_layout.sh: New file.
7894 2010-06-01 Rafael Espindola <espindola@google.com>
7896 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7898 2010-06-01 Rafael Espindola <espindola@google.com>
7900 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7901 visibility of symbols.
7903 2010-05-27 Doug Kwan <dougkwan@google.com>
7905 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7906 from start of output section instead of address for a local symbol
7907 in a merged or relaxed section when doing a relocatable link.
7909 2010-05-26 Rafael Espindola <espindola@google.com>
7912 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7913 adding sections the garbage collector removed.
7914 * gold/testsuite/Makefile.am: Add test.
7915 * gold/testsuite/Makefile.in: Regenerate.
7916 * gold/testsuite/plugin_test_7.sh: New.
7917 * gold/testsuite/plugin_test_7_1.c: New.
7918 * gold/testsuite/plugin_test_7_2.c: New.
7920 2010-05-26 Rafael Espindola <espindola@google.com>
7922 * script-sections.cc (Output_section_definition::set_section_addresses):
7923 Check for --section-start.
7925 2010-05-26 Doug Kwan <dougkwan@google.com>
7927 * arm.cc (Arm_scan_relocatable_relocs): New class.
7928 (Target_arm::relocate_special_relocatable): New method.
7929 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7930 (Arm_relocate_functions::thumb_branch_common): Same.
7931 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7932 instead of Default_scan_relocatable_relocs.
7933 * target-reloc.h (relocate_for_relocatable): Let target handle
7934 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7935 * target.h (Sized_target::relocate_special_relocatable): New method.
7937 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7939 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7941 2010-05-23 Doug Kwan <dougkwan@google.com>
7943 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7945 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7946 with a direct branch, not a conditional branch, to a stub.
7947 * merge.cc (Output_merge_base::record_input_section): New method
7949 (Output_merge_data::do_add_input_section): Record input section if
7950 keeps-input-sections flag is set.
7951 (Output_merge_string::do_add_input_section): Ditto.
7952 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7953 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7955 (Output_merge_base::keeps_input_sections,
7956 Output_merge_base::set_keeps_input_sections,
7957 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7959 (Output_merge_base::Input_sections): New type declaration.
7960 (Output_merge_base::input_sections_begin,
7961 Output_merge_base::input_sections_end,
7962 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7963 (Output_merge_base::bool keeps_input_sections_,
7964 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7965 Output_merge_base::input_sections_): New data members.
7966 (Output_merge_data::do_set_keeps_input_sections): New method
7968 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7969 * output.cc (Output_section::Input_section::relobj): Move method
7970 defintion from class declaration to here and handle merge sections.
7971 (Output_section::Input_section::shndx): Ditto.
7972 (Output_section::Output_section): Remove initializations of removed
7973 data members and initialize new data member LOOKUP_MAPS_.
7974 (Output_section::add_input_section): Set keeps-input-sections flag
7975 for a newly created merge output section as appropriate. Adjust code
7976 to use Output_section_lookup_maps class.
7977 (Output_section::add_relaxed_input_section): Adjst code for lookup
7978 maps code refactoring.
7979 (Output_section::add_merge_input_section): Add a new parameter
7980 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7981 class. If adding input section to a newly created merge output
7982 section fails, remove the new merge section.
7983 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7984 Adjust code for use of the Output_section_lookup_maps class.
7985 (Output_section::find_merge_section): Ditto.
7986 (Output_section::build_lookup_maps): New method defintion.
7987 (Output_section::find_relaxed_input_section): Adjust code to use
7988 Output_section_lookup_maps class.
7989 (Output_section::get_input_sections): Export merge sections. Adjust
7990 code to use Output_section_lookup_maps class.
7991 (Output_section:::add_script_input_section): Adjust code to use
7992 Output_section_lookup_maps class. Update lookup maps for merge
7994 (Output_section::discard_states): Use Output_section_lookup_maps.
7995 (Output_section::restore_states): Same.
7996 * output.h (Merge_section_properties): Move class defintion out of
7998 (Output_section_lookup_maps): New class.
7999 (Output_section::Input_section::is_merge_section): New method
8001 (Output_section::Input_section::relobj): Move defintion out of class
8002 defintion. Declare method only.
8003 (Output_section::Input_section::shndx): Ditto.
8004 (Output_section::Input_section::output_merge_base): New method defintion.
8005 (Output_section::Input_section::u2_.pomb): New union field.
8006 (Output_section::Merge_section_by_properties_map,
8007 Output_section::Output_section_data_by_input_section_map,
8008 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8010 (Output_section::add_merge_input_section): Add new parameter
8011 KEEPS_INPUT_SECTIONS.
8012 (Output_section::build_lookup_maps): New method declaration.
8013 (Output_section::merge_section_map_,
8014 Output_section::merge_section_by_properties_map_,
8015 Output_section::relaxed_input_section_map_,
8016 Output_section::is_relaxed_input_section_map_valid_): Remove data
8018 (Output_section::lookup_maps_): New data member.
8020 2010-05-21 Doug Kwan <dougkwan@google.com>
8023 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8024 avoid a compilation error.
8026 2010-05-19 Rafael Espindola <espindola@google.com>
8028 * script-sections.cc (Output_section_definition::allocate_to_segment):
8029 Update the phdrs_list even when the output section is NULL.
8030 * testsuite/Makefile.am: Add test.
8031 * testsuite/Makefile.in: Regenerate.
8032 * testsuite/script_test_9.cc: New.
8033 * testsuite/script_test_9.sh: New.
8034 * testsuite/script_test_9.t: New.
8036 2010-05-19 Doug Kwan <dougkwan@google.com>
8038 * arm.cc (Arm_input_section::original_size): New method.
8039 (Arm_input_section::do_addralign): Add a cast.
8040 (Arm_input_section::do_output_offset): Remove static cast.
8041 (Arm_input_section::original_addralign,
8042 Arm_input_section::original_size_): Change type to uint32_t.
8043 (Arm_input_section::init): Add safe casts for section alignment
8045 (Arm_input_section::set_final_data_size): Do not set address and
8046 offset of stub table.
8047 (Arm_output_section::fix_exidx_coverage): Change use of of
8048 Output_section::Simple_input_section to that of
8049 Output_section::Input_section.
8050 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8051 except for the first pass.
8052 * output.cc (Output_section::get_input_sections): Change type of
8053 input_sections to std::list<Input_section>.
8054 (Output_section::add_script_input_section): Rename from
8055 Output_section::add_simple_input_section. Change type of SIS
8056 parameter from Simple_input_section to Input_section.
8057 * output.h (Output_section::Simple_input_section): Remove class.
8058 (Output_section::Input_section): Change class visibility to public.
8059 (Output_section::Input_section::addralign): Use stored alignments
8060 for special input sections if set.
8061 (Output_section::Input_section::set_addralign): New method.
8062 (Output_section::get_input_sections): Change parameter type from
8063 list of Simple_input_section to list of Input_section.
8064 (Output_section::add_script_input_section): Rename from
8065 Output_section::add_simple_input_section. Change first parameter's
8066 type from Simple_input_section to Input_section and remove the
8067 second and third parameters.
8068 * script-sections.cc (Input_section::Input_section_list): Change
8069 type to list of Output_section::Input_section/
8070 (Input_section_info::Input_section_info): Change parameter type of
8071 INPUT_SECTION to Output_section::Input_section.
8072 (Input_section_info::input_section): Change return type.
8073 (Input_section_info::input_section_): Change type to
8074 Output_section::Input_section.
8075 (Output_section_element_input::set_section_addresses): Adjust code
8076 to use Output_section::Input_section instead of
8077 Output_section::Simple_input_section. Adjust code for renaming
8078 of Output_section::add_simple_input_section.
8079 (Orphan_output_section::set_section_addresses): Ditto.
8081 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8083 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8084 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8086 2010-05-18 Rafael Espindola <espindola@google.com>
8088 * options.cc (General_options::finalize): Handle -nostdlib.
8089 * options.h (nostdlib): New option.
8090 * script.cc (script_add_search_dir): Handle -nostdlib.
8092 2010-05-12 Doug Kwan <dougkwan@google.com>
8094 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8095 attributes section only if there no attributes section after merging.
8096 (Target_arm::merge_object_attributes): Move value of
8097 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8098 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8099 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8100 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8101 and arm_attr_merge_7.stdout.
8102 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8103 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8104 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8105 arm_attr_merge_7b.o): New rules.
8106 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8108 * testsuite/Makefile.in: Regenerate.
8109 * testsuite/arm_attr_merge.sh: New file.
8110 * testsuite/arm_attr_merge_[67][ab].s: Same.
8112 2010-05-05 Nick Clifton <nickc@redhat.com>
8114 * po/es.po: Updated Spanish translation.
8116 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8118 * Makefile.am (install-exec-local): Properly install gold as
8119 default cross linker.
8120 * Makefile.in: Regenerated.
8122 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8123 Nick Clifton <nickc@redhat.com>
8125 * configure.ac (install_as_default): Define and set to false
8126 unless --enable-gold or --enable-gold=both/gold has been
8128 * configure: Regenerate.
8130 * Makefile.am (install-exec-local): Install the executable as
8131 'ld.gold'. If install_as_default is true then also install it as
8133 * Makefile.in: Regenerated.
8135 2010-04-24 Ian Lance Taylor <iant@google.com>
8137 * layout.cc (Layout::layout_reloc): In relocatable link don't
8138 combine reloc sections for grouped sections.
8140 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8142 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8143 sections that are not ordinary to icf.
8144 * icf.cc (get_section_contents): Handle relocation pointing to section
8145 with no object or shndx information.
8146 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8147 * testsuite/Makefile.in: Regenerate.
8148 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8149 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8151 2010-04-22 Ian Lance Taylor <iant@google.com>
8153 * expression.cc (Expression::Expression_eval_info): Add
8154 result_alignment_pointer field.
8155 (Expression::eval_with_dot): Add result_alignment_pointer
8156 parameter. Change all callers.
8157 (Expression::eval_maybe_dot): Likewise.
8158 (class Binary_expression): Add alignment_pointer parameter to
8159 left_value and right_value. Change all callers.
8160 (BINARY_EXPRESSION): Set result alignment.
8161 (class Trinary_expression): Add alignment_pointer parameter to
8162 arg2_value and arg3_value. Change all callers.
8163 (Trinary_cond::value): Set result alignment.
8164 (Max_expression::value, Min_expression::value): Likewise.
8165 (Align_expression::value): Likewise.
8166 * script-sections.cc (class Sections_element): Add dot_alignment
8167 parameter to set_section_addresses virtual function. Update
8169 (class Output_section_element): Likewise.
8170 (Script_sections::create_segments): Add dot_alignment parameter.
8172 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8173 (Script_sections::set_phdrs_clause_addresses): Likewise.
8174 * script-sections.h: Update declarations.
8175 * script.h: Update declarations.
8176 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8178 * testsuite/script_test_3.t: Set large alignment.
8179 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8180 segment has expected alignment.
8182 2010-04-22 Nick Clifton <nickc@redhat.com>
8184 * po/gold.pot: Updated by the Translation project.
8185 * po/vi.po: Updated Vietnamese translation.
8187 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8189 * testsuite/Makefile.am (check_PROGRAMS): Add
8190 icf_virtual_function_folding_test.
8191 * testsuite/Makefile.in: Regenerated.
8193 2010-04-15 Andrew Haley <aph@redhat.com>
8195 * options.h (merge_exidx_entries): New option.
8196 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8197 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8198 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8199 (Target_arm::merge_exidx_entries): New function.
8200 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8201 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8202 to Arm_exidx_fixup constructor.
8203 Add new arg, merge_exidx_entries.
8204 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8205 Arm_output_section::fix_exidx_coverage.
8207 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8209 * icf.cc (get_section_contents): Check for preemptible functions.
8210 Ignore addend when appropriate.
8211 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8213 (add_from_relobj): Check for section folded.
8214 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8215 * symtab.h (should_add_dynsym_entry): Add new parameter.
8216 * target-reloc.h (scan_relocs): Check for section folded.
8217 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8218 Check reloc types for function pointers in shared objects.
8219 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8221 (icf_preemptible_functions_test): New test case.
8222 (icf_string_merge_test): New test case.
8223 * testsuite.Makefile.in: Regenerate.
8224 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8225 bar_glob. Refactor code.
8226 * testsuite/icf_preemptible_functions_test.cc: New file.
8227 * testsuite/icf_preemptible_functions_test.sh: New file.
8228 * testsuite/icf_string_merge_test.cc: New file.
8229 * testsuite/icf_string_merge_test.sh: New file.
8230 * testsuite/icf_virtual_function_folding_test.cc: New file.
8231 * testsuite/icf_virtual_function_folding_test.sh: New file.
8233 2010-04-14 Doug Kwan <dougkwan@google.com>
8235 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8236 for local symbol recounting if we remove a section due to ICF.
8237 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8238 there are no regular objects in input.
8240 2010-04-13 Doug Kwan <dougkwan@google.com>
8242 * arm.cc (Arm_input_section::set_final_data_size): Compute
8243 accurate final data size instead of using current data size.
8245 2010-04-09 Doug Kwan <dougkwan@google.com>
8247 * layout.cc (Layout::choose_output_section): Handle script section
8249 (Layout::make_output_section_for_script): Add section type parameter.
8250 Handle script section types.
8251 * layout.h (Layout::make_output_section_for_script): Add section
8253 * output.cc (Output_section::Output_section): Initialize data member
8255 (Output_section::do_reset_address_and_file_offset): Do not set address
8256 to 0 if section is a NOLOAD section.
8257 * output.h (Output_section::is_noload): New method.
8258 (Output_section::set_is_noload): Ditto.
8259 (Output_section::is_noload_): New data member.
8260 * script-c.h (Script_section_type): New enum type.
8261 (struct Parser_output_section_header): Add new file section_type.
8262 * script-sections.cc (Sections_element::output_section_name): Add
8263 parameter for returning script section type.
8264 (Output_section_definition::output_section_name): Ditto.
8265 (Output_section_definition::section_type)P; New method.
8266 (Output_section_definiton::script_section_type_name): Ditto.
8267 (Output_section_definition::script_section_type_): New data member.
8268 (Output_section_definition::Output_section_definition): Initialize
8269 data member Output_section_definition::script_section_type_.
8270 (Output_section_definition::create_sections): Pass script section type
8271 to Layout::make_output_section_for_script.
8272 (Output_section_definition::output_section_name): Return script
8273 section type to caller.
8274 (Output_section_definition::set_section_address): Do not advance
8275 dot value and load address if section type is NOLOAD. Set address
8276 of NOLOAD sections regardless of section flags.
8277 (Output_section_definition::print): Print section type if it is
8278 not SCRIPT_SECTION_TYPE_NONE.
8279 (Output_section_definition::section_type): New method.
8280 (Output_section_definition::script_section_type_name): Ditto.
8281 (Script_sections::output_section_name): Add new parameter
8282 PSECTION_TYPE for returning script section type. Pass it to
8283 section elements. Handle discard sections.
8284 (Sort_output_sections::operator()): Handle NOLOAD sections.
8285 * script-sections.h (Script_sections::Section_type): New enum type.
8286 (Script_sections::output_section_name): Add a new parameter for
8287 returning script section type.
8288 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8290 * yyscript.y (union): Add new field SECTION_TYPE.
8291 (COPY, DSECT, INFO, NOLOAD): New tokens.
8292 (opt_address_and_section_type): Change type to output_section_header.
8293 (section_type): New non-terminal
8294 (section_header): Handle section type.
8295 (opt_address_and_section_type): Return section type value.
8297 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8299 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8300 * testsuite/plugin_common_test_2.c (foo): Likewise.
8302 2010-04-08 Doug Kwan <dougkwan@google.com>
8304 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8306 * output.cc (Output_section::add_merge_input_section): Simplify
8307 code and return status of Output_merge_base::add_input_section.
8308 Update merge section map only if Output_merge_base::add_input_section
8311 2010-04-07 Doug Kwan <dougkwan@google.com>
8313 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8314 if section is marked as containing instructions but has no mapping
8316 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8317 correct section index.
8318 (Arm_relobj::find_linked_text_section): Ditto.
8320 2010-04-07 Cary Coutant <ccoutant@google.com>
8322 * archive.cc (include_member): Destroy Read_symbols_data object before
8324 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8325 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8326 (Read_symbols_data::~Read_symbols_data) New destructor.
8327 (Section_relocs::Section_relocs) New constructor.
8328 (Section_relocs::~Section_relocs) New destructor.
8329 (Read_relocs_data::Read_relocs_data) New constructor.
8330 (Read_relocs_data::~Read_relocs_data) New destructor.
8331 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8332 pointers to NULL after deleting.
8334 2010-04-07 Doug Kwan <dougkwan@google.com>
8336 * arm.cc: Replace "endianity" with "endianness" in comments.
8337 (Arm_exidx_cantunwind): Ditto.
8338 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8339 (Arm_relobj::merge_flags_and_attributes): New method.
8340 (Arm_relobj::merge_flags_and_attributes_): New data member.
8341 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8342 (Arm_relobj::scan_sections_for_stubs): Ditto.
8343 (Arm_relobj::do_read_symbols): Check to see if we really want to
8344 merge processor-specific flags and attributes. Exit early if
8345 an object is empty except for section names and the undefined symbol.
8346 (Target_arm::do_finalize_sections): Move check for ELF format to
8347 Arm_relobj::do_read_symbols. Merge processor specific flags and
8348 attributes from a regular object only when we have determined that
8349 it is aapropriate. Do not create an .ARM.attributes section in
8350 output if there is no regular input object.
8351 (Target_arm::merge_processor_specific_flags): Check
8352 --warn-mismatch before printing any error.
8353 (Target_arm::merge_object_attributes): Ditto.
8354 * gold.cc (queue_middle_tasks): Handle the case in which there is
8355 no regular object in input.
8356 * options.cc (General_options::parse_EB): New method.
8357 (General_options::parse_EL): Same.
8358 (General_options::General_options): Initialize endianness_.
8359 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8361 (General_options::Endianness): New enum.
8362 (General_options::endianness): New method.
8363 (General_options::endianness_): New data member.
8364 * parameters.cc (Parameters::set_options): Check target endianness.
8365 (Parameters::set_target_once): Ditto.
8366 (Parameters::check_target_endianness): New method.
8367 (parameters_force_valid_target): If either -EL or -EB is specified,
8368 use it to define endianness of default target.
8369 * parameters.h (Parameters::check_target_endianness): New method
8371 * target.h (class Target): Change "endianity" to "endianness"
8374 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8376 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8377 * configure: Regenerate.
8378 * Makefile.in: Regenerate.
8379 * testsuite/Makefile.in: Regenerate.
8381 2010-04-06 Cary Coutant <ccoutant@google.com>
8384 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8385 prevailing definitions of common symbols.
8386 * testsuite/plugin_test_6.sh: New test case.
8387 * testsuite/plugin_common_test_1.c: New test case.
8388 * testsuite/plugin_common_test_2.c: New test case.
8389 * testsuite/Makefile.am (plugin_test_6): New test case.
8390 * testsuite/Makefile.in: Regenerate.
8392 2010-04-06 Nick Clifton <nickc@redhat.com>
8394 * po/vi.po: New Vietnamese translation.
8396 2010-03-30 Doug Kwan <dougkwan@google.com>
8398 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8400 2010-03-25 Doug Kwan <dougkwan@google.com>
8402 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8403 to avoid a conversion warning on a 32-bit host.
8405 2010-03-24 Ian Lance Taylor <iant@google.com>
8407 * testsuite/script_test_3.t: Add a TLS segment.
8408 * testsuite/Makefile.am (check_PROGRAMS): Add
8409 tls_phdrs_script_test.
8410 (tls_phdrs_script_test_SOURCES): Define.
8411 (tls_phdrs_script_test_DEPENDENCIES): Define.
8412 (tls_phdrs_script_test_LDFLAGS): Define.
8413 (tls_phdrs_script_test_LDADD): Define.
8414 * testsuite/Makefile.in: Rebuild.
8416 2010-03-23 Cary Coutant <ccoutant@google.com>
8418 * fileread.cc (find_or_make_view): Fix comment.
8420 2010-03-23 Ian Lance Taylor <iant@google.com>
8422 * script-sections.cc (class Orphan_section_placement): Define
8423 PLACE_TLS and PLACE_TLS_BSS.
8424 (Orphan_section_placement::Orphan_section_placement): Initialize
8426 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8427 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8428 (tls_script_test_SOURCES): Define.
8429 (tls_script_test_DEPENDENCIES): Define.
8430 (tls_script_test_LDFLAGS): Define.
8431 (tls_script_test_LDADD): Define.
8432 * testsuite/Makefile.in: Rebuild.
8434 2010-03-22 Doug Kwan <dougkwan@google.com>
8436 * arm.cc (Arm_relocate_functions::abs8,
8437 Arm_relocate_functions::abs16): Use correct check for overflow
8438 specified in the ARM ELF specs.
8439 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8440 target of a BLX instruction specially.
8441 (Reloc_stub::stub_type_for_reloc): Ditto.
8442 (Relocate::relocate): Use symbolic names instead of numeric relocation
8443 codes to report error.
8444 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8446 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8447 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8448 thumb2_blx_out_of_range.stdout
8449 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8450 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8451 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8452 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8453 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8454 thumb2_blx_in_range, thumb2_blx_in_range.o,
8455 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8456 thumb2_blx_out_of_range.o): New rules.
8457 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8458 thumb2_blx_in_range and thumb2_blx_out_of_range.
8459 * testsuite/Makefile.in: Regenerate.
8460 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8461 * testsuite/thumb_blx_in_range.s: New file.
8462 * testsuite/thumb_blx_out_of_range.s: New file.
8464 2010-03-22 Rafael Espindola <espindola@google.com>
8466 * archive.cc (Should_include): Move to archive.h.
8467 (should_include_member): Make it a member of Archive.
8469 (Add_lib_group_symbols): New.
8470 * archive.h: Include options.h.
8471 (Archive_member): Moved from Archive.
8472 (Should_include): Moved from archive.cc.
8474 (Add_lib_group_symbols): New.
8475 * dynobj.cc (do_should_include_member): New.
8476 * dynobj.h (do_should_include_member): New.
8477 * gold.cc (queue_initial_tasks): Update call to queue.
8478 * main.cc (main): Print lib group stats.
8479 * object.cc (do_should_include_member): New.
8480 * object.h: Include archive.h.
8481 (Object::should_include_member): New.
8482 (Object::do_should_include_member): New.
8483 (Sized_relobj::do_should_include_member): New.
8484 * options.cc (General_options::parse_start_lib): New.
8485 (General_options::parse_end_lib): New.
8486 (Input_arguments::add_file): Handle lib groups.
8487 (Input_arguments::start_group): Check we are not in a lib.
8488 (Input_arguments::start_lib): New.
8489 (Input_arguments::end_lib): New.
8490 * options.h (General_options): Add start_lib and end_lib.
8491 (Input_argument::lib_): New.
8492 (Input_argument::lib): New.
8493 (Input_argument::is_lib): New.
8494 (Input_file_lib): New.
8495 (Input_arguments::in_lib_): New.
8496 (Input_arguments::in_lib): New.
8497 (Input_arguments::start_lib): New.
8498 (Input_arguments::end_lib_): New.
8499 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8500 in unused members as preempted.
8501 (Sized_pluginobj::do_should_include_member): New.
8502 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8503 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8505 (Read_symbols::do_whole_lib_group): New.
8506 (Read_symbols::do_lib_group): New.
8507 (Read_symbols::do_read_symbols): Handle lib groups.
8508 (Read_symbols::get_name): Handle lib groups.
8509 * readsyms.h (Read_symbols): Add an archive member pointer.
8510 (Read_symbols::do_whole_lib_group): New.
8511 (Read_symbols::do_lib_group): New.
8512 (Read_symbols::member_): New.
8513 * script.cc (read_input_script): Update call to queue_soon.
8515 2010-03-19 Doug Kwan <dougkwan@google.com>
8517 * arm.cc (Stub_table::Stub_table): Initialize new data members
8518 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8519 (Stub_table::add_reloc_stub): Assign stub offset and update
8520 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8521 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8523 (Stub_table::update_data_size_and_addralign): Use
8524 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8525 instead of going over all reloc stubs.
8526 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8527 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8528 Stringpool_template::offset_ to size of Stringpool_char.
8529 (Stringpool_template::new_key_offset): Remove code to initialize
8530 Stringpool_template::offset_.
8531 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8532 Stringpool_template::offset_ to zero.
8534 2010-03-15 Doug Kwan <dougkwan@google.com>
8536 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8538 (Stringpool_template::new_key_offset): New method.
8539 (Stringpool_template::add_string): Assign offsets when adding new
8541 (Stringpool_template::set_string_offsets): Do not set string offsets
8542 when not optimizing.
8543 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8545 (Chunked_vector::clear): Clear size_.
8546 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8547 (Chunked_vector::size): Return size_.
8548 (Chunked_vector::push_back): Use size_ to find insert position.
8549 (Chunked_vector::size_): New data member.
8550 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8551 (Stringpool_template::new_key_offset): New method declaration.
8552 (Stringpool_template::offset_): New data member.
8554 2010-03-15 Rafael Espindola <espindola@google.com>
8556 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8557 Add_symbols' constructor.
8558 * readsyms.h (Add_symbols): Remove the input_group member.
8560 2010-03-10 Ian Lance Taylor <iant@google.com>
8562 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8563 target to ask whether a reference to a symbol requires a stack
8565 * target.h (Target::is_call_to_non_split): New function.
8566 (Target::do_is_call_to_non_split): Declare virtual function.
8567 * target.cc: Include "symtab.h".
8568 (Target::do_is_call_to_non_split): New function.
8569 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8571 2010-03-10 Cary Coutant <ccoutant@google.com>
8573 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8574 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8575 (File_read::open[2]): Add whole_file_view_ to list of views.
8576 (File_read::make_view): Remove test of whole_file_view_.
8577 (File_read::find_or_make_view): Create whole_file_view_ if
8579 (File_read::clear_views): Replace bool parameter with enum;
8580 adjust all callers. Don't delete views with permanent data;
8581 do delete cached views and views from archives if
8582 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8583 if clearing the corresponding view.
8584 * fileread.h (File_read::Clear_views_mode): New enum.
8585 (File_read::View::is_permanent_view): New method.
8586 (File_read::clear_views): Replace bool parameter
8587 with enum; adjust all callers.
8588 * options.h (General_options): Change keep_files_mapped option;
8589 add map_whole_files.
8590 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8592 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8595 2010-03-10 David S. Miller <davem@davemloft.net>
8597 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8599 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8601 * icf.cc (get_section_contents): Add '@' marker after processing the
8604 2010-03-08 Doug Kwan <dougkwan@google.com>
8606 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8607 due to a conversion warning.
8608 (Arm_relobj::update_output_local_symbol_count): Check for local
8609 symbol with unset output index.
8611 2010-03-05 Ian Lance Taylor <iant@google.com>
8613 * options.h (class General_options): Add --spare-dynamic-tags.
8614 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8615 --spare-dynamic-tags.
8617 2010-03-05 Ian Lance Taylor <iant@google.com>
8619 * incremental.cc: Include "libiberty.h".
8621 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8623 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8624 function, is_info_ member.
8625 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8626 (Versions::Versions): Update caller.
8627 (Versions::define_base_version): Likewise.
8628 (Versions::add_def): Likewise.
8630 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8632 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8633 (Scan::possible_function_pointer_reloc): New function.
8634 (Scan::local_reloc_may_be_function_pointer): Change to call
8635 possible_function_pointer_reloc.
8636 (Scan::global_reloc_may_be_function_pointer): Ditto.
8637 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8638 relocations in ".data.rel.ro._ZTV" section.
8639 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8640 * testsuite/icf_safe_so_test.cc: Ditto.
8641 * testsuite/icf_safe_test.cc: Ditto.
8642 * testsuite/icf_safe_test.sh: Ditto.
8644 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8645 Ian Lance Taylor <iant@google.com>
8647 * target-reloc.h (relocate_section): Check the symbol table index
8648 for -1U before setting the local symbol index.
8649 (scan_relocatable_relocs): If copying the relocation, record that
8650 the local symbol is required.
8651 * object.h (Symbol_value::is_output_symtab_index_set): New
8653 (Symbol_value::may_be_discarded_from_output_symtab): New
8655 (Symbol_value::has_output_symtab_entry): New function.
8656 (Symbol_value::needs_output_symtab_entry): Remove.
8657 (Symbol_value::output_symtab_index): Make sure the symbol index is
8659 (Symbol_value::set_output_symtab_index): Make sure the symbol
8660 index is not set. Make sure the new index is valid.
8661 (Symbol_value::set_must_have_output_symtab_entry): New function.
8662 (Symbol_value::has_output_dynsym_entry): New function.
8663 (Symbol_value::set_output_dynsym_index): Make sure the new index
8665 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8666 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8667 local symbol if permitted.
8668 (Sized_relobj::do_finalize_local_symbols): Call
8669 is_output_symtab_index_set rather than needs_output_symtab_entry.
8670 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8671 rather than needs_output_symtab_entry. Call
8672 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8673 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8674 is_output_symtab_index_set rather than needs_output_symtab_entry.
8675 * testsuite/discard_locals_relocatable_test.c: New file.
8676 * testsuite/discard_locals_test.sh: Test -r.
8677 * testsuite/Makefile.am (check_DATA): Add
8678 discard_locals_relocatable_test1.syms,
8679 discard_local_relocatable_test2.syms.
8680 (MOSTLYCLEANFILES): Likewise. Also add
8681 discard_locals_relocatable_test1.lout and
8682 discard_locals_relocatable_test2.out.
8683 (discard_locals_relocatable_test1.syms): New target.
8684 (discard_locals_relocatable_test.o): New target.
8685 (discard_locals_relocatable_test1.out): New target.
8686 (discard_locals_relocatable_test2.syms): New target.
8687 (discard_locals_relocatable_test2.out): New target.
8688 (various): Add missing ../ld-new dependencies.
8689 * testsuite/Makefile.in: Rebuild.
8691 2010-03-03 Nick Clifton <nickc@redhat.com>
8693 * po/fi.po: New Finnish translation.
8695 2010-03-01 Doug Kwan <dougkwan@google.com>
8697 * layout.cc (Layout::Layout): Force section types of .init_array*,
8698 .preinit_array* and .fini_array* sections.
8699 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8700 Fix check of return value of std::string::find.().
8701 (Output_section::Input_section_sort_compare::operator()): Remove
8702 comment about .init_array.
8703 (Output_section::Input_section_sort_init_fini_compare::operator()):
8705 (Output_section::sort_attached_input_sections): Handle .init_array
8706 and .fini_array specially.
8707 * output.h (Output_section::Inut_section_sort_compare): Update
8709 (Output_section::Input_section_sort_init_fini_compare): New struct.
8711 2010-02-26 Doug Kwan <dougkwan@google.com>
8713 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8714 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8715 * testsuite/debug_msg.sh: Avoid matching source line number for
8716 use of global variable undef_int.
8718 2010-02-26 Doug Kwan <dougkwan@google.com>
8720 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8721 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8722 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8723 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8724 * options.cc (General_options::General_options): Initialize member
8726 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8727 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8728 and rm_no_fix_v4bx.stdout
8729 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8730 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8731 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8732 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8733 and arm_no_fix_v4bx.
8734 * Makefile.in: Regenerate.
8735 * testsuite/arm_fix_v4bx.s: New file.
8736 * testsuite/arm_fix_v4bx.sh: Ditto.
8738 2010-02-24 Doug Kwan <dougkwan@google.com>
8740 * arm.cc (Target_arm::got_section): Make the .got section the first
8741 non RELRO section in the data segment.
8742 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8743 suffixes of section names.
8745 2010-02-24 Doug Kwan <dougkwan@google.com>
8747 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8748 flags and attributes merging if an input file is a binary file.
8749 * fileread.cc (Input_file::open): Record format of original file.
8750 * fileread.h (Input_file::Format): New enum type.
8751 (Input_file::Input_file): Initialize data member format_.
8752 (Input_file::format): New method definition.
8753 (Input_file::format_):: New data member.
8755 2010-02-24 Doug Kwan <dougkwan@google.com>
8757 * arm.cc (Arm_output_data_got): New class.
8758 (ARM_TCB_SIZE): New constant
8759 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8760 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8761 If user uses a script with a SECTIONS clause, issue only a warning
8762 for a misplaced EXIDX input section. Otherwise, issue an error.
8763 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8765 (Target_arm::got_mode_index_entry): Handle static linking.
8766 (Target_arm::Scan::local): Ditto.
8767 (Target_arm::Scan::global): Ditto.
8768 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8769 all incorrectly implemented relocations.
8770 (Target_arm::fix_exidx_coverage): Pass layout to
8771 Arm_output_section::fix_exidx_coverage.
8772 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8773 from ".ARM.exidx." and ".ARM.extab.".
8775 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8777 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8778 section if it does not already exist.
8779 * attributes.cc (Attributes_section_data::Attributes_section_data):
8780 Don't crash if size is zero.
8782 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8783 Ian Lance Taylor <iant@google.com>
8785 * gold.cc (queue_middle_tasks): If no input files were opened,
8787 * workqueue.h (Task_function::Task_function): Assert that there is
8790 2010-02-22 Doug Kwan <dougkwan@google.com>
8792 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8793 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8794 types to avoid warnings due to different uint64_t implementations
8797 2010-02-21 Doug Kwan <dougkwan@google.com>
8799 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8800 handling of the maximum backward branch offset.
8801 (Arm_relocate_functions::thumb_branch_common): Ditto.
8802 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8803 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8804 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8805 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8806 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8807 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8808 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8809 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8810 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8811 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8812 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8813 thumb2_bl_out_of_range.o): New rules.
8814 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8815 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8816 thumb2_bl_out_of_range
8817 * testsuite/Makefile.in: Regenerate.
8818 * testsuite/arm_bl_in_range.s: New file.
8819 * testsuite/arm_bl_out_of_range.s: Ditto.
8820 * testsuite/arm_branch_in_range.sh: Ditto.
8821 * testsuite/arm_branch_range.t: Ditto.
8822 * testsuite/thumb2_branch_range.t: Ditto.
8823 * testsuite/thumb_bl_in_range.s: Ditto.
8824 * testsuite/thumb_bl_out_of_range.s: Ditto.
8825 * testsuite/thumb_branch_range.t: Ditto.
8827 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8829 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8830 Add reloc offset information.
8831 * icf.cc (get_section_contents): Change iterators to point to the new
8832 vectors. Add reloc offset information to the contents.
8833 * icf.h (Icf::Sections_reachable_info): New typedef.
8834 (Icf::Sections_reachable_list): New typedef.
8835 (Icf::Offset_info): New typedef.
8836 (Icf::Reloc_info): New struct typedef.
8837 (Icf::Reloc_info_list): New typedef.
8838 (Icf::symbol_reloc_list): Delete method.
8839 (Icf::addend_reloc_list): Delete method.
8840 (Icf::section_reloc_list): Delete method.
8841 (Icf::reloc_info_list): New method.
8842 (Icf::reloc_info_list_): New member.
8844 2010-02-19 Doug Kwan <dougkwan@google.com>
8846 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8847 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8848 * arm.cc (Arm_relocation_functions): New forward declaration.
8849 (Target_arm::Target_arm): Initialize new data members
8850 got_mod_index_offset_ and tls_base_symbol_defined_.
8851 (Target_arm::Relocate::relocate_tls): New method.
8852 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8853 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8855 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8856 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8857 (Target_arm::got_mod_index_offset_,
8858 Target_arm::tls_base_symbol_defined_): New data members.
8859 (Target_arm::Scan::local, Target::Scan::global,
8860 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8863 2010-02-18 Doug Kwan <dougkwan@google.com>
8865 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8866 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8867 text section as a parameter becuase some broken tools may not set
8868 the link in section header.
8869 (Target_arm::has_got_section): New method.
8870 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8871 without any mapping symbol as data only. Remove warning.
8872 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8873 link in its section header, try to discover the link by inspecting the
8874 REL31 relocation at the beginning of the section.
8875 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8877 (Target_arm::Scan::global): Treat any reference to the symbol
8878 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8880 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8882 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8883 (Scan::global_reloc_may_be_function_pointer): New function.
8884 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8885 (Scan::global_reloc_may_be_function_pointer): New function.
8886 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8887 (Scan::global_reloc_may_be_function_pointer): New function.
8888 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8889 (Scan::global_reloc_may_be_function_pointer): New function.
8890 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8891 (Scan::global_reloc_may_be_function_pointer): New function.
8892 (Scan::possible_function_pointer_reloc): New function.
8893 (Target_x86_64::can_check_for_function_pointers): New function.
8894 * gc.h (gc_process_relocs): Scan relocation types to determine if
8895 function pointers were taken for targets that support it.
8896 * icf.cc (Icf::find_identical_sections): Include functions for
8897 folding in safe ICF whose pointer is not taken.
8898 * icf.h (Secn_fptr_taken_set): New typedef.
8899 (fptr_section_id_): New member.
8900 (section_has_function_pointers): New function.
8901 (set_section_has_function_pointers): New function.
8902 (check_section_for_function_pointers): New function.
8903 * options.h: Fix comment for safe ICF option.
8904 * target.h (can_check_for_function_pointers): New function.
8905 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8906 Modify icf_safe_test for X86-64.
8907 * testsuite/Makefile.in: Regenerate.
8908 * testsuite/icf_safe_so_test.cc: New file.
8909 * testsuite/icf_safe_so_test.sh: New file.
8910 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8911 (main): Change to take pointer to function kept_func_3.
8912 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8913 folding is done correctly for X86-64.
8915 2010-02-12 David S. Miller <davem@davemloft.net>
8917 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8918 is_symbolless parameter.
8919 (Output_reloc<SHT_REL>::is_symbolless): New.
8920 (Output_reloc<SHT_REL>::is_symbolless_): New.
8921 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8922 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8923 (Output_reloc<SHT_RELA>::is_symbolless): New.
8924 (Output_data_reloc::add_global): Handle is_symbolless.
8925 (Output_data_reloc::add_global_relative): Likewise.
8926 (Output_data_reloc::add_local): Likewise.
8927 (Output_data_reloc::add_local_relative): Likewise.
8928 (Output_data_reloc::add_symbolless_global_addend): New.
8929 (Output_data_reloc::add_symbolless_local_addend): New.
8930 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8932 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8933 instead of ->is_relative_
8934 (Output_reloc::write): Likewise.
8935 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8936 (Output_reloc::write_rel): Simplify.
8938 * sparc.cc (Target_sparc::Scan::local): Use
8939 ->add_symbolless_local_addend as needed.
8940 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8941 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8942 based upon relocation offset.
8944 2010-02-11 Doug Kwan <dougkwan@google.com>
8946 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8947 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8948 beginning of function.
8949 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8950 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8951 parameter is_32bit in calls to should_apply_static_reloc.
8952 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8953 (check_DATA): Add arm_abs_global.stdout.
8954 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8955 arm_abs_global.stdout): New rules.
8956 (MOSTLLYCLEANFILES): Add arm_abs_global
8957 * Makefile.in: Regenerate.
8958 * testsuite/arm_abs_global.s: New file.
8959 * testsuite/arm_abs_global.sh: Ditto.
8960 * testsuite/arm_abs_lib.s: Ditto.
8962 2010-02-11 Ian Lance Taylor <iant@google.com>
8964 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8966 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8967 Allocate_commons_task first.
8968 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8969 task, rather than symtab_lock_.
8970 (Gc_process_relocs::~Gc_process_relocs): New function.
8971 (Gc_process_relocs::is_runnable): Check this_blocker_.
8972 (Gc_process_relocs::locks): Use next_blocker_ rather than
8974 (Scan_relocs::~Scan_relocs): New function.
8975 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8977 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8979 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8980 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8981 constructor accordingly.
8982 (class Gc_process_relocs): Likewise.
8983 (class Scan_relocs): Likewise.
8984 * common.h (class Allocate_commons_task): Remove symtab_lock_
8985 field, and corresponding constructor parameter.
8986 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8988 (Allocate_commons_task::locks): Likewise.
8990 2010-02-11 Ian Lance Taylor <iant@google.com>
8992 * gold-threads.h (class Once): Define.
8993 (class Initialize_lock): Rewrite as child of Once.
8994 * gold-threads.cc (class Once_initialize): Define.
8995 (once_pointer_control): New static variable.
8996 (once_pointer, once_arg): New static variables.
8997 (c_run_once): New static function.
8998 (Once::Once, Once::run_once, Once::internal_run): New functions.
8999 (class Initialize_lock_once): Remove.
9000 (initialize_lock_control): Remove.
9001 (initialize_lock_pointer): Remove.
9002 (initialize_lock_once): Remove.
9003 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9004 (Initialize_lock::initialize): Rewrite.
9005 (Initialize_lock::do_run_once): New function.
9006 * archive.cc (Archive::interpret_header): Only clear name if it is
9008 * fileread.cc: Include "gold-threads.h"
9009 (file_counts_lock): New static variable.
9010 (file_counts_initialize_lock): Likewise.
9011 (File_read::release): Only increment counts when using --stats.
9012 Use a lock around the increment.
9013 * parameters.cc (class Set_parameters_target_once): Define.
9014 (set_parameters_target_once): New static variable.
9015 (Parameters::Parameters): Move here from parameters.h.
9016 (Parameters::set_target): Rewrite.
9017 (Parameters::set_target_once): New function.
9018 (Parameters::clear_target): Move here and rewrite.
9019 * parameters.h (class Parameters): Update declarations. Add
9020 set_parameters_target_once_ field.
9021 (Parameters::Parameters): Move to parameters.cc.
9022 (Parameters::clear_target): Likewise.
9023 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9025 (Start_group::~Start_group): New function.
9026 (Start_group::is_runnable): New function.
9027 (Start_group::locks, Start_group::run): New functions.
9028 (Finish_group::run): Change saw_undefined to size_t.
9029 * readsyms.h (class Start_group): Define.
9030 (class Finish_group): Change saw_undefined_ field to size_t.
9031 (Finish_group::Finish_group): Remove saw_undefined and
9032 this_blocker parameters. Change all callers.
9033 (Finish_group::set_saw_undefined): New function.
9034 (Finish_group::set_blocker): New function.
9035 * symtab.h (class Symbol_table): Change saw_undefined to return
9036 size_t. Change saw_undefined_ field to size_t.
9037 * target-select.cc (Set_target_once::do_run_once): New function.
9038 (Target_selector::Target_selector): Initialize set_target_once_
9039 field. Don't initialize lock_ and initialize_lock_ fields.
9040 (Target_selector::instantiate_target): Rewrite.
9041 (Target_selector::set_target): New function.
9042 * target-select.h (class Set_target_once): Define.
9043 (class Target_selector): Update declarations. Make
9044 Set_target_once a friend. Remove lock_ and initialize_lock_
9045 fields. Add set_target_once_ field.
9047 2010-02-10 Ian Lance Taylor <iant@google.com>
9049 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9051 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9052 (queue_middle_tasks): Add all blockers before queueing any tasks.
9053 (queue_final_tasks): Likewise.
9054 * token.h (Task_token::add_blockers): New function.
9055 * object.h (Input_objects::number_of_relobjs): New function.
9057 2010-02-10 Ian Lance Taylor <iant@google.com>
9059 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9060 shared, not if not position independent.
9061 * x86_64.cc (Relocate::relocate_tls): Likewise.
9062 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9063 (tls_pie_pic_test): New target.
9064 * testsuite/Makefile.in: Rebuild.
9066 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9067 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9068 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9069 * testsuite/Makefile.in: Rebuild.
9071 2010-02-09 David S. Miller <davem@davemloft.net>
9073 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9074 R_SPARC_RELATIVE using ->add_local_relative().
9075 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9077 * output.h (Output_data_dynamic::add_section_size): New method
9078 that takes two Output_data objects.
9079 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9080 entry param. Handle it in initializers.
9081 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9082 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9083 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9085 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9086 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9087 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9088 for dynrel_includes_plt.
9089 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9090 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9091 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9093 (Target_sparc::do_finalize_sections): Update to pass true for
9094 dynrel_includes_plt.
9095 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9096 output before .rela.plt
9097 (Target_powerpc::do_finalize_sections): Update to pass true for
9098 dynrel_includes_plt when 32-bit.
9100 2010-02-08 Doug Kwan <dougkwan@google.com>
9102 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9104 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9105 Arm_relobj::scan_section_for_cortex_a8_stubs,
9106 Arm_relobj::do_relocation_section): Instead of calling
9107 Output_section::output_address, use faster
9108 Arm_relobj::simple_input_section_output_address.
9110 2010-02-08 David S. Miller <davem@davemloft.net>
9112 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9113 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9114 relocation helper function.
9116 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9117 just like R_SPARC_GOT{10,13,22}.
9118 (Target_sparc::Scan::local): Likewise.
9119 (Target_sparc::Relocate:relocate): Likewise.
9121 2010-02-06 Ian Lance Taylor <iant@google.com>
9123 * configure.ac: Rewrite targetobjs duplicate removal code to use
9124 only shell constructs.
9125 * configure: Rebuild.
9127 2010-02-05 Doug Kwan <dougkwan@google.com>
9130 * arm.cc (Arm_relobj::section_is_scannable): New method.
9131 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9132 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9134 2010-02-04 Doug Kwan <dougkwan@google.com>
9137 * arm-reloc-property.cc (cstdio): Include.
9138 * configure.ac (targetobjs): Remove duplicates.
9139 * configure: Regenerate.
9140 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9141 big and little endian version for a given address size.
9143 2010-02-03 Doug Kwan <dougkwan@google.com>
9145 * arm-reloc-property.cc
9146 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9148 * arm-reloc-property.h
9149 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9150 New method definition.
9151 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9153 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9155 (GOT_PREL): Change implemented to Y.
9156 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9157 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9158 (Arm_relocate_functions::movw_abs_nc): Remove method.
9159 (Arm_relocate_functions::movt_abs): Ditto.
9160 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9161 (Arm_relocate_functions::thm_movt_abs): Ditto.
9162 (Arm_relocate_functions::movw_rel_nc): Ditto.
9163 (Arm_relocate_functions::movw_rel): Ditto.
9164 (Arm_relocate_functions::movt_rel): Ditto.
9165 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9166 (Arm_relocate_functions:thm_movw_rel): Ditto.
9167 (Arm_relocate_functions:thm_movt_rel): Ditto.
9168 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9169 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9170 New method definitions.
9171 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9172 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9173 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9174 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9175 (Target_arm::Relocate::relocate): Check for non-static or
9176 unimplemented relocation code and exit early. Change calls to
9177 Target_arm::reloc_uses_thumb_bit and
9178 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9179 instead. Refactor code to handle similar relocations to increase
9180 code sharing. Remove check for unsupported relocation code in switch
9182 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9183 relocation property table to find out size. Change error message to
9184 print out the name of a relocation code instead of the numeric value.
9185 (Target_arm::scan_reloc_for_stub): Use relocation property table
9186 instead of calling Target_arm::reloc_uses_thumb_bit().
9188 2010-02-02 Doug Kwan <dougkwan@google.com>
9190 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9191 types of relaxed input section.
9193 2010-02-02 Doug Kwan <dougkwan@google.com>
9195 * Makefile.am (HFILES): Add arm-reloc-property.h.
9197 (TARGETSOURCES): Add arm-reloc-property.cc
9198 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9199 (libgold_a_SOURCES): $(DEFFILES)
9200 * Makefile.in: Regenerate.
9201 * arm-reloc-property.cc: New file.
9202 * arm-reloc-property.h: New file.
9203 * arm-reloc.def: New file.
9204 * arm.cc: Update comments.
9205 (arm-reloc-property.h): New included header.
9206 (arm_reloc_property_table): New global variable.
9207 (Target_arm::do_select_as_default_target): New method definition.
9208 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9209 arm-reloc-property to targ_extra_obj.
9210 * parameters.cc (set_parameters_target): Call
9211 Target::select_as_default_target().
9212 * target.h (Target::select_as_default_target): New method definition.
9213 (Target::do_select_as_default_target): Same.
9215 2010-02-01 Doug Kwan <dougkwan@google.com>
9217 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9218 first_output_text_section_.
9219 (Arm_exidx_fixup::first_output_text_section): New method definition.
9220 (Arm_exidx_fixup::first_output_text_section_): New data member.
9221 (Arm_exidx_fixup::process_exidx_section): Record the first text
9222 output section seen.
9223 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9224 and entsize in output section header.
9226 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9228 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9229 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9230 (Arm_relocate_functions::thm_alu11): New Method.
9231 (Arm_relocate_functions::thm_pc8): New Method.
9232 (Arm_relocate_functions::thm_pc12): New Method.
9233 (Target_arm::Scan::local): Handle the relocations.
9234 (Target_arm::Scan::global): Likewise.
9235 (Target_arm::Relocate::relocate): Likewise.
9236 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9238 2010-01-29 Doug Kwan <dougkwan@google.com>
9240 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9241 of relocation types as ld.
9243 2010-01-29 Doug Kwan <dougkwan@google.com>
9245 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9247 (Arm_relocate_functions::thumb_branch_common): Ditto.
9248 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9249 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9250 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9251 Arm_relocate_functions::jump24): Remove.
9252 (Target_arm::Relocate::relocate): Adjust code to call
9253 Arm_relocation_functions::arm_branch_common and
9254 Arm_relocation_functions::thumb_branch_common instead of their removed
9255 wrappers. Merge switch-cases together to reduce source code size.
9257 2010-01-29 Doug Kwan <dougkwan@google.com>
9259 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9260 output_local_symbol_count_needs_update_.
9261 (Arm_relobj::output_local_symbol_count_needs_update,
9262 Arm_relobj::set_output_local_symbol_count_needs_update,
9263 Arm_relobj::update_output_local_symbol_count): New methods.
9264 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9266 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9267 of pointed function as in a R_ARM_PREL31 relocation.
9268 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9269 for output local symbol count updating.
9270 (Target_arm::do_relax): Update output local symbol counts in objects
9272 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9274 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9276 * arm.cc: Added support for the ARM relocations:
9277 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9278 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9279 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9281 (Arm_relocate_functions::movw_rel): New method.
9282 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9283 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9285 (Arm_relocate_functions::thm_movw_rel): New method.
9286 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9288 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9290 (Target_arm::Scan::global): Likewise.
9291 (Target_arm::Relocate::relocate): Likewise.
9292 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9295 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9297 * arm.cc: Added support for ARM group relocations.
9298 (Target_arm::reloc_needs_sym_origin): New method.
9299 (Arm_relocate_functions::calc_grp_kn): New method.
9300 (Arm_relocate_functions::calc_grp_residual): New method.
9301 (Arm_relocate_functions::calc_grp_gn): New method.
9302 (Arm_relocate_functions::arm_grp_alu): New Method.
9303 (Arm_relocate_functions::arm_grp_ldr): New Method.
9304 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9305 (Arm_relocate_functions::arm_grp_ldc): New Method.
9306 (Target_arm::Scan::local): Handle the ARM group relocations.
9307 (Target_arm::Scan::global): Likewise.
9308 (Target_arm::Relocate::relocate): Likewise.
9309 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9312 2010-01-26 Doug Kwan <dougkwan@google.com>
9314 * arm.cc (set): Include.
9315 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9317 (Arm_output_section::Text_section_list): New type.
9318 (Arm_output_section::append_text_sections_to_list): New method.
9319 (Arm_output_section::fix_exidx_coverage): Ditto.
9320 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9321 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9322 Relobj::set_section_offset() instead of
9323 Sized_relobj::invalidate_section_offset().
9324 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9325 parameter for section headers. Ignore relocation sections for
9326 unallocated sections and EXIDX sections.
9327 (Target_arm::fix_exidx_coverage): New method.
9328 (Target_arm::output_section_address_less_than): New type.
9329 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9330 linked text section instead of the EXIDX section.
9331 (Arm_output_section::create_stub_group): Add an assertion to check
9332 that this is not an EXIDX output section.
9333 (Arm_output_section::append_text_sections_to_list): New method.
9334 (Arm_output_section::fix_exidx_coverage): Ditto.
9335 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9336 Arm_relobj::section_needs_reloc_stub_scanning.
9337 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9339 (Target_arm::fix_exidx_coverage): New method.
9340 * object.h (Relobj::set_output_section): New method.
9341 (Sized_relobj::invalidate_section_offset): Remove method.
9342 (Sized_relobj::do_invalidate_section_offset): Remove method.
9343 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9345 2010-01-25 Doug Kwan <dougkwan@google.com>
9347 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9348 Fix warning due to signed and unsigned comparison on a 32-bit host.
9350 2010-01-22 Doug Kwan <dougkwan@google.com>
9352 * arm.cc (Target_arm::do_relax): Record an output section for section
9353 offset adjustment it contains any stub table that has changed.
9354 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9355 offsets in an output section if necessary.
9356 * output.cc (Output_section::Output_section): Initialize
9357 section_offsets_need_adjustments_.
9358 (Output_section::add_input_section_for_script): Renamed to
9359 Output_section::add_simple_input_section.
9360 (Output_section::save_states): Add a comment.
9361 (Output_section::discard_states): New method defintion.
9362 (Output_section::adjust_section_offsets): Same.
9363 * output.h (Output_section::add_input_section_for_script): Renamed to
9364 Output_section::add_simple_input_section.
9365 (Output_section::discard_states): New method declaration.
9366 (Output_section::adjust_section_offsets): Same.
9367 (Output_section::section_offsets_need_adjustment,
9368 Output_section::set_section_offsets_need_adjustment): New method
9370 (Output_section::section_offsets_need_adjustment_): New data member.
9371 * script-sections.cc
9372 (Output_section_element_input::set_section_address): Adjust code for
9373 renaming of Output_section::add_input_section_for_script.
9374 (Orphan_output_section::set_section_address): Same.
9376 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9378 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9379 Fix_v4bx enum values .
9380 * gold/options.h (General_options): New option definitions.
9381 (General_options::fix_v4bx): New method.
9382 (General_options::Fix_v4bx): New enum.
9383 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9384 (General_options::parse_fix_v4bx_interworking): New method.
9386 2010-01-22 Doug Kwan <dougkwan@google.com>
9388 * arm.cc (Arm_exidx_fixup): New class.
9390 2010-01-21 Doug Kwan <dougkwan@google.com>
9392 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9394 (Arm_exidx_section_offset_map): New type.
9396 2010-01-21 Doug Kwan <dougkwan@google.com>
9398 * arm.cc (Arm_exidx_input_section): New class.
9399 (Arm_relobj::exidx_input_section_by_link,
9400 Arm_relobj::exidx_input_section_by_shndx,
9401 Arm_relobj::make_exidx_input_section): New methods.
9402 (read_arm_attributes_section): Remove.
9403 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9404 information about them.
9405 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9408 2010-01-20 Doug Kwan <dougkwan@google.com>
9410 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9411 Input_section_specifier to Section_id.
9412 (Target_arm::new_arm_input_section: Adjust code for change of key
9414 (Target_arm::find_arm_input_section): Ditto.
9415 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9416 (Section_id): Remove.
9417 (Garbage_collection::Section_id_hash): Remove.
9418 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9419 (Section_id): Remove.
9420 (Icf::Section_id_hash): Remove.
9421 * object.h (Section_id, Const_section_id, Section_id_hash,
9422 Const_section_id_hash): New type definitions.
9423 * output.cc (Output_section::add_relaxed_input_section): Change to
9424 use Const_section_id instead of Input_section_specifier as key type.
9425 (Output_section::add_merge_input_section): Ditto.
9426 (Output_section::build_relaxation_map): Change to use Section_id
9427 instead of Input_section_specifier as key type.
9428 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9430 (Output_section::convert_input_sections_to_relaxed_sections): Change
9431 to use Const_section_id instead of Input_section_specifier as key type.
9432 (Output_section::find_merge_section): Ditto.
9433 (Output_section::find_relaxed_input_section): Ditto.
9434 * output.h (Input_section_specifier): Remove class.
9435 (Output_section::Output_section_data_by_input_section_map): Change
9436 key type to Const_section_id.
9437 (Output_section::Output_relaxed_input_section_by_input_section_map):
9439 (Output_section::Relaxation_map): Change key type to Section_id.
9441 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9443 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9444 (class Arm_v4bx_stub): New class.
9445 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9446 (Stub_factory::make_arm_v4bx_stub): New method.
9447 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9448 (Stub_table::empty): Handle v4bx stubs.
9449 (Stub_table::add_arm_v4bx_stub): New method.
9450 (Stub_table::find_arm_v4bx_stub): New method.
9451 (Arm_relocate_functions::v4bx): New method.
9452 (Target_arm::fix_v4bx): New method.
9453 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9454 (Stub_table::relocate_stubs): Likewise.
9455 (Stub_table::do_write): Likewise.
9456 (Stub_table::update_data_size_and_addralign): Likewise.
9457 (Stub_table::finalize_stubs): Likewise.
9458 (Target_arm::Scan::local): Likewise.
9459 (Target_arm::Scan::global): Likewise.
9460 (Target_arm::do_finalize_sections): Likewise.
9461 (Target_arm::Relocate::relocate): Likewise.
9462 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9464 (Target_arm::scan_reloc_for_stub): Likewise.
9465 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9467 2010-01-19 Ian Lance Taylor <iant@google.com>
9469 * output.cc (Output_section_headers::do_sized_write): Write large
9470 segment count to sh_info field.
9471 (Output_file_header::do_sized_write): For large segment count,
9472 write PN_XNUM to e_phnum field.
9474 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9476 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9477 (Arm_relocate_functions::thm_jump8): New function.
9478 (Arm_relocate_functions::thm_jump11): New function.
9479 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9481 (Target_arm::Scan::global): Likewise.
9482 (Target_arm::Relocate::relocate): Likewise.
9483 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9486 2010-01-14 Doug Kwan <dougkwan@google.com>
9488 * arm.cc (map, utility): Include headers.
9489 (Target_arm::apply_cortex_a8_workaround): New method.
9490 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9491 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9492 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9493 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9494 the --[no-]fix-cortex-a8 command line options.
9495 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9496 (Target_arm::relocate_stub): Use addend in instruction template.
9497 * options.h (DEFINE_bool): Set the user-set flag.
9498 (General_options): Add --[no-]-fix-cortex options.
9499 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9500 : Update fast look-up map after conversion.
9502 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9504 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9505 in the first pass of do_layout.
9507 2010-01-13 Doug Kwan <dougkwan@google.com>
9509 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9510 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9511 apparent compiler problem of not folding static constant integral
9512 data members of elfcpp::Elf_sizes<32>.
9514 2010-01-13 Doug Kwan <dougkwan@google.com>
9516 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9517 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9518 Arm_relobj::scan_section_for_cortex_a8_erratum,
9519 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9520 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9521 sections to scan for relocation stubs into a new method
9522 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9523 relocation and Cortex-A8 stub scanning.
9524 (Target_arm::do_relax): Force stubs to be after stubbed sections
9525 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9526 the beginning of a new relaxation pass. Update a comment.
9527 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9529 2010-01-12 Ian Lance Taylor <iant@google.com>
9531 * target-reloc.h (visibility_error): New inline function.
9532 (relocate_section): Call visibility_error.
9533 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9534 (MOSTLYCLEANFILES): Likewise.
9535 (protected_4_pic.o, protected_3.err): New targets.
9536 * testsuite/protected_4.cc: New file.
9538 2010-01-12 Doug Kwan <dougkwan@google.com>
9540 * arm.cc (Cortex_a8_reloc): New class.
9541 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9542 and cortex_a8_relocs_info_.
9543 (Target_arm::fix_cortex_a8): New method definition.
9544 (Target_arm::Cortex_a8_relocs_info): New type.
9545 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9546 New data member declarations.
9547 (Target_arm::scan_reloc_for_stub): Record information about
9548 relocations for THUMB branches that might be exempted from the
9549 Cortex-A8 workaround.
9550 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9551 at the beginning of a relaxation pass.
9553 2010-01-12 Doug Kwan <dougkwan@google.com>
9555 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9556 (Arm_relobj::Mapping_symbol_position,
9557 Arm_reloj::Mapping_symbol_position_less,
9558 Arm_relobj::Mapping_symbols_info): New types.
9559 (Target_arm::is_mapping_symbol_name): New method definition.
9560 (Arm_relobj::do_count_local_symbols): Save information about mapping
9563 2010-01-11 Doug Kwan <dougkwan@google.com>
9565 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9566 Arm_relocate_functions::thumb32_branch_upper,
9567 Arm_relocate_functions::thumb32_branch_lower,
9568 Arm_relocate_functions::thumb32_cond_branch_offset,
9569 Arm_relocate_functions::thumb32_cond_branch_upper,
9570 Arm_relocate_functions::thumb32_cond_branch_lower,
9571 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9572 branch offset encoding.
9573 (Arm_relocate_functions::thumb_branch_common): Use new branch
9574 offset encoding methods to avoid code duplication.
9575 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9576 (Stub_addend_reader::operator()): Use new branch encoding method
9577 to avoid code duplication.
9579 2010-01-11 Doug Kwan <dougkwan@google.com>
9581 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9582 (Target_arm::do_finalize_sections): Define special EXIDX section
9583 symbols only if referenced.
9584 * gc.h (Garbage_collection::add_reference): New method.
9585 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9588 2010-01-11 Ian Lance Taylor <iant@google.com>
9590 * script.cc (Version_script_info::build_expression_list_lookup):
9591 Change complaing about duplicate wildcard match from error to
9594 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9596 (Version_script_info::Version_script_info): Initialize globs_,
9597 default_version_, default_is_global_, and exact_. Don't
9598 initialize globals_ or locals_.
9599 (Version_script_info::build_lookup_tables): Build local symbols
9601 (Version_script_info::unquote): New function.
9602 (Version_script_info::add_exact_match): New function.
9603 (Version_script_info::build_expression_list_lookup): Remove lookup
9604 parameter. Add is_global parameter. Change all callers. Handle
9605 wildcard pattern specially. Unquote pattern. Call
9607 (Version_script_info::get_name_to_match): New function.
9608 (Version_script_info::get_symbol_version): New function.
9609 (Version_script_info::get_symbol_version_helper): Remove.
9610 (Version_script_info::check_unmatched_names): Call unquote.
9611 * script.h (class Version_script_info): Change get_symbol_version
9612 to be non-inline and add is_global parameter; change all callers.
9613 Rewrite symbol_is_local. Update declarations. Define struct
9614 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9615 Remove globals_ and locals_ members. Add exact_, globs_,
9616 default_version_, is_global_.
9617 (Version_script_info::Glob): Remove pattern, add expression and
9618 is_global. Update constructor. Change all callers.
9619 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9621 (Versions::symbol_section_contents): If a symbol is undefined, or
9622 defined in a dynamic object, set the version index to
9624 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9626 (Symbol_table::add_from_pluginobj): Likewise.
9627 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9629 2010-01-11 Doug Kwan <dougkwan@google.com>
9631 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9632 (incremental_dump_LDADD): Add linking option for libintl.
9633 * Makefile.in: Regenerate.
9635 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9638 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9640 * testsuite/Makefile.in: Regenerated.
9642 2010-01-10 Doug Kwan <dougkwan@google.com>
9644 * options.h (DEFINE_var): Use parentheses around argument varname__
9645 in macro body to avoid any unintended subsequent substitutions.
9647 2010-01-10 Ian Lance Taylor <iant@google.com>
9649 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9650 candidates before doing symbol resolution.
9652 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9653 ODR candidates if only one is weak.
9655 2010-01-08 Ian Lance Taylor <iant@google.com>
9657 * script.cc (Version_script_info::build_expression_list_lookup):
9658 Don't warn about ambiguous version, just record the ambiguity.
9659 (Version_script_info::get_symbol_version_helper): Give error if
9660 version is ambiguous.
9662 2010-01-08 Doug Kwan <dougkwan@google.com>
9664 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9665 prev_data_size_ and prev_addralign_. Remove initializer for
9666 deleted data member has_been_changed_.
9667 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9668 to determine if the table is empty.
9669 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9671 (Stub_table::add_reloc_stub): Define method in class definition
9672 instead of just declaring it there.
9673 (Stub_table::add_cortex_a8_stub): New method definition.
9674 (Stub_table::update_data_size_and_addralign): Ditto.
9675 (Stub_table::finalize_stubs): Ditto.
9676 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9677 (Stub_table::do_addralign_): Return address alignment in the
9678 (Stub_table::do_reset_address_and_file_offset): Define method in
9679 class definition instead of declaring it there. Set current data
9680 size to be the data size of the previous pass.
9681 (Stub_table::set_final_data_size): Use current data size as the
9683 (Stub_table::relocate_stub): Change parameter type of stub from
9684 Reloc_stub pointer to Stub pointer.
9685 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9686 (Stub_table::Cortex_a8_stub_list): New typedef.
9687 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9688 Stub_table::prev_addralign_): New data member.
9689 (Arm_relobj::Arm_relobj): Initialize data member
9690 section_has_cortex_a8_workaround_.
9691 (Arm_relobj::section_has_cortex_a8_workaround,
9692 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9694 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9696 (Target_arm::relocate_stub): Change parameter type of stub from
9697 Reloc_stub pointer to Stub pointer.
9698 (Insn_template::size, Insn_template::alignment): Handle
9699 THUMB16_SPECIAL_TYPE.
9700 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9701 Stub_table::update_data_size_and_addralign,
9702 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9704 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9705 (Stub_table::do_write): Ditto.
9706 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9708 2010-01-08 Ian Lance Taylor <iant@google.com>
9711 * symtab.h (class Symbol): Remove fields is_target_special_ and
9712 has_plt_offset_. Add field is_defined_in_discarded_section_.
9713 (Symbol::is_defined_in_discarded_section): New function.
9714 (Symbol::set_is_defined_in_discarded_section): New function.
9715 (Symbol::has_plt_offset): Rewrite.
9716 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9717 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9718 Don't initialize is_target_special_ or has_plt_offset_.
9719 Initialize is_defined_in_discarded_section_.
9720 (Symbol_table::add_from_relobj): If appropriate, set
9721 is_defined_in_discarded_section.
9722 * resolve.cc (Symbol::override_base_with_special): Don't test
9723 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9724 * target-reloc.h (relocate_section): Do special handling for
9725 symbols defined in discarded sections for global symbols as well
9728 2010-01-08 Ian Lance Taylor <iant@google.com>
9730 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9731 the SHT_SYMTAB case.
9733 2010-01-08 Ian Lance Taylor <iant@google.com>
9735 * object.cc (Sized_relobj::do_layout): Don't get confused if
9736 layout_eh_frame returns NULL.
9738 2010-01-08 Ian Lance Taylor <iant@google.com>
9741 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9742 dynamic symbol table, use the normal symbol table.
9743 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9746 2010-01-08 Ian Lance Taylor <iant@google.com>
9749 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9752 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9754 * version.cc (print_version): Change to "Copyright 2010".
9756 2010-01-08 Ian Lance Taylor <iant@google.com>
9760 * i386.cc (class Target_i386): Change return type of plt_section
9762 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9763 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9764 tls_desc_rel_ field.
9765 (Output_data_plt_i386::rel_tls_desc): New function.
9766 (Target_i386::rel_tls_desc_section): New function.
9767 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9768 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9769 R_386_TLS_DESC reloc in rel_tls_desc_section.
9770 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9771 Define struct Tlsdesc_info.
9772 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9773 (Target_x86_64::do_reloc_symbol_index): New function.
9774 (Target_x86_64::add_tlsdesc_info): New function.
9775 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9776 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9778 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9780 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9781 (Target_x86_64::rela_tlsdesc_section): New function.
9782 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9784 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9785 (Target_x86_64::do_reloc_addend): New function.
9786 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9787 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9788 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9789 (Output_reloc::type): New function.
9790 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9791 (Output_reloc::is_target_specific): New function.
9792 (Output_reloc::target_arg): New function.
9793 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9794 absolute relocs and target specific relocs.
9795 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9796 add_target_specific.
9797 (class Output_data_reloc) [SHT_RELA]: Likewise.
9798 * output.cc (Output_reloc::Output_reloc): Add four new versions
9799 for absolute relocs and target specific relocs.
9800 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9801 (Output_reloc::get_symbol_index): Likewise.
9802 (Output_reloc::local_section_offset): Check that local_sym_index_
9803 is not TARGET_CODE or 0.
9804 (Output_reloc::symbol_value): Likewise.
9805 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9807 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9808 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9810 * layout.cc (add_target_dynamic_tags): Use output section for
9811 DT_PLTRELSZ and DT_JMPREL.
9813 2010-01-07 Ian Lance Taylor <iant@google.com>
9816 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9818 (class Output_data_reloc_generic): Define.
9819 (class Output_data_reloc_base): Change base class to
9820 Output_data_reloc_generic. Change add() method to call
9821 bump_relative_reloc_count for a relative reloc. Remove
9823 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9825 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9826 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9828 * layout.h (class Layout): Update declaration.
9830 2010-01-07 Ian Lance Taylor <iant@google.com>
9832 * output.h (class Output_data): Add const version of
9833 output_section and do_output_section.
9834 (class Output_section_data): Add const version of
9836 (class Output_section): Likewise.
9837 * layout.cc (Layout::add_target_dynamic_tags): New function.
9838 * layout.h (class Layout): Update declarations.
9839 * arm.cc (Target_arm::do_finalize_sections): Use
9840 add_target_dynamic_tags.
9841 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9842 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9843 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9844 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9846 2010-01-07 Ian Lance Taylor <iant@google.com>
9849 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9852 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9853 Ian Lance Taylor <iant@google.com>
9856 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9857 Xindex::read_symtab_xindex.
9859 2010-01-07 Doug Kwan <dougkwan@google.com>
9861 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9862 (Insn_template::thumb16_bcond_insn): New method declaration.
9863 (Insn_template): Fix spelling.
9864 (Stub::thumb16_special): New method declaration.
9865 (Stub::do_write): Define virtual method which was previously pure
9867 (Stub::do_thumb16_special): New method declaration.
9868 (Stub::do_fixed_endian_write): New template member.
9869 (Reloc_stub::do_write): Remove.
9870 (Reloc_stub::do_fixed_endian_write): Remove.
9871 (Cortex_a8_stub): New class definition.
9872 (Stub_factory::make_cortex_a8_stub): New method definition.
9873 (Stub_factory::Stub_factory): Add missing static storage class
9874 qualifier for elf32_arm_stub_a8_veneer_blx.
9876 2010-01-07 Ian Lance Taylor <iant@google.com>
9879 * options.h (class General_options): Add --warn-unresolved-symbols
9880 and --error-unresolved-symbols.
9881 * errors.cc (Errors::undefined_symbol): Implement
9882 --warn-unresolved-symbols.
9884 * options.h (class General_options): Add -z text and -z textoff.
9885 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9887 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9889 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9890 (Garbage_collection::cident_sections): New function.
9891 (Garbage_collection::add_cident_section): New function.
9892 (Garbage_collection::cident_sections_): New member.
9893 (gc_process_relocs): Add references to sections whose names are C
9895 * gold.h (cident_section_start_prefix): New constant.
9896 (cident_section_stop_prefix): New constant.
9897 (is_cident): New function.
9898 * layout.cc (Layout::define_section_symbols): Replace string constants
9899 with the newly defined constants.
9900 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9902 * testsuite/Makefile.am: Add gc_orphan_section_test.
9903 * testsuite/Makefile.in: Regenerate.
9904 * testsuite/gc_orphan_section_test.cc: New file.
9905 * testsuite/gc_orphan_section_test.sh: New file.
9907 2010-01-06 Ian Lance Taylor <iant@google.com>
9910 * options.h (class General_options): Add --warn-shared-textrel.
9911 * layout.cc (Layout::finish_dynamic_section): Implement
9912 --warn-shared-textrel.
9915 * options.h (class General_options): Add --warn-multiple-gp.
9917 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9919 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9920 $(THREADSLIB) and $(LIBDL).
9921 * Makefile.in: Rebuild.
9923 2010-01-06 Ian Lance Taylor <iant@google.com>
9926 * options.cc (General_options::parse_section_start): New function.
9927 (General_options::section_start): New function.
9928 (General_options::General_options): Initialize all members.
9929 * options.h: Include <map>
9930 (class General_options): Add --section-start. Add section_starts_
9932 * layout.cc (Layout::attach_allocated_section_to_segment): If
9933 --section-start was used, set the address of the segment. Remove
9934 local sort_sections.
9935 (Layout::relaxation_loop_body): If the address of the load segment
9936 has been set by --section-start, don't use it.
9937 * output.h (Output_segment::update_flags_for_output_section): New
9939 * output.cc (Output_segment::add_output_section): Call
9940 update_flags_for_output_section.
9942 2010-01-05 Ian Lance Taylor <iant@google.com>
9945 * options.h (class General_options): Add --undefined-version.
9946 * script.cc (struct Version_expression): Add was_matched_by_symbol
9948 (Version_script_info::matched_symbol): New function.
9949 (Version_script_info::get_symbol_version_helper): Call
9951 (Version_script_info::check_unmatched_names): New function.
9952 * script.h (class Version_script_info): Update declarations.
9953 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9955 * options.h (class General_options): Use DEFINE_bool_alias for
9956 allow_multiple_definition.
9957 * resolve.cc (Symbol_table::should_override): Don't test
9958 allow_multiple_definition.
9961 * options.h (class General_options): Add --cref.
9962 * main.cc (main): Print cref table if --cref. Don't close mapfile
9963 until after printing cref table.
9964 * cref.cc: Include "symtab.h".
9965 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9966 (Cref_table_compare::operator()): New function.
9967 (Cref_inputs::gather_cref): New function.
9968 (filecol): New static const.
9969 (Cref_inputs::print_cref): New function.
9970 (Cref::print_cref): New function.
9971 * cref.h: Include <cstdio>.
9972 (class Cref): Update declarations.
9973 * mapfile.h (Mapfile::file): New function.
9974 * object.h (class Object): Define Symbols. Declare virtual
9975 do_get_global_symbols.
9976 (Object::get_global_symbols): New function.
9977 * object.cc (Input_objects::add_object): Pass object to cref_ if
9979 (Input_objects::archive_start): Likewise.
9980 (Input_objects::archive_stop): Likewise.
9981 (Input_objects::print_cref): New function.
9982 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9983 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9985 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9987 * plugin.h (class Sized_pluginobj): Update declarations.
9989 2010-01-05 Ian Lance Taylor <iant@google.com>
9991 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9992 to is_default_version. Rename insdef to insdefault.
9993 (Symbol_table::add_from_relobj): Rename def to is_default_version
9994 and local to is_forced_local.
9995 (Symbol_table::add_from_pluginobj): Likewise.
9996 (Symbol_table::add_from_dynobj): Likewise.
9997 (Symbol_table::define_special_symbol): Rename insdef to
10000 2010-01-04 Ian Lance Taylor <iant@google.com>
10003 * options.h (class General_options): Add
10004 --allow-multiple-definition and -z muldefs.
10005 * resolve.cc (Symbol_table::should_override): Don't warn about a
10006 multiple symbol definition if --allow-multiple-definition or -z
10010 * options.h (class General_options): Add --add-needed and
10011 --copy-dt-needed-entries. Tweak --as-needed help entry.
10012 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10013 error if --copy-dt-needed-entries aka --add-needed is used and
10014 would cause a change in behaviour.
10017 * options.h (class General_options): Add -G as a short version of
10018 --shared. Add no-op options -assert, -g, and -i.
10020 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10022 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10023 check for .text or .gnu.linkonce.t sections.
10024 * icf.cc (Icf::find_identical_sections): Ditto.
10025 Change the detection for mangled function name within the section
10027 * icf.h (is_section_foldable_candidate): New function.
10029 2009-12-30 Ian Lance Taylor <iant@google.com>
10032 * options.h (class General_options): Permit two dashes with
10033 --retain-symbols-file.
10035 2009-12-30 Ian Lance Taylor <iant@google.com>
10038 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10039 don't put the file header and segment headers in the text
10043 * common.cc (Sort_commons::operator()): Stabilize sort when both
10045 (Symbol_table::do_allocate_commons_list): When allocating common
10046 symbols, skip a symbol which is no longer common.
10047 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10048 an object before checking its type.
10049 * testsuite/common_test_2.c: New file.
10050 * testsuite/common_test_3.c: New file.
10051 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10052 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10053 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10054 (common_test_2_pic.o, common_test_2.so): New targets.
10055 (common_test_3_pic.o, common_test_3.so): New targets.
10056 * testsuite/Makefile.in: Rebuild.
10059 * script.cc (read_input_script): If we see a new SECTIONS clause,
10060 and we have added an input section, give an error.
10061 * layout.h (class Layout): Add have_added_input_section function.
10062 Add have_added_input_section_ field.
10063 * layout.cc (Layout::Layout): Initialize
10064 have_added_input_section_.
10065 (Layout::layout): Set have_added_input_section_.
10066 (Layout::layout_eh_frame): Likewise.
10068 2009-12-30 Ian Lance Taylor <iant@google.com>
10071 * options.h (class General_options): Add --sort-common option.
10072 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10073 * common.cc (Sort_common): Add sort_order parameter to
10074 constructor. Add sort_order_ field.
10075 (Sort_commons::operator): Check sort_order_.
10076 (Symbol_table::allocate_commons): Determine the sort order.
10077 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10078 Change all callers.
10079 (Symbol_table::do_allocate_commons_list): Likewise.
10081 2009-12-30 Ian Lance Taylor <iant@google.com>
10084 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10085 symbols from this object, don't change the visibility of an
10087 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10089 2009-12-30 Ian Lance Taylor <iant@google.com>
10092 * script.h (class Version_script_info): Define Language enum.
10093 Update declarations. Define Glob, Exact, and Lookup types. Add
10094 new fields globals_, locals_, and is_finalized_.
10095 * script.cc: Various formatting fixes.
10096 (class Parser_closure): Change language_stack_ from a vector of
10097 std::string to one of Version_script_info::Language. Adjust all
10099 (class Lazy_demangler): Remove.
10100 (struct Version_expression): Change language from std::string to
10101 Version_script_info::Language.
10102 (Version_script_info::Version_script_info): New function.
10103 (Version_script_info::~Version_script_info): Don't call clear.
10104 (Version_script_info::finalize): New function.
10105 (Version_script_info::build_lookup_tables): New function.
10106 (Version_script_info::build_expression_list_lookup): New
10108 (Version_script_info::get_symbol_version_helper): Rewrite to use
10110 (Version_script_info::print_expression_list): Adjust to use
10111 Version_script_info::Language.
10112 (script_push_lex_into_version_mode): Check that the version script
10113 has not been finalized.
10114 (version_script_push_lang): Change language string to
10115 Version_script_info::Language.
10116 * options.cc (Command_line::version_script): New function.
10117 * options.h (class General_options): Add finalize_dynamic_list
10118 function. Change version_script from declaration to definition.
10119 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10120 * testsuite/version_script.map: Remove duplicate def of foo.
10121 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10122 version_script.map.
10123 * testsuite/Makefile.in: Rebuild.
10125 2009-12-30 Ian Lance Taylor <iant@google.com>
10128 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10129 if the input symbol index is 0, make the output symbol index 0.
10131 2009-12-30 Ian Lance Taylor <iant@google.com>
10134 * options.h (class General_options): Add -x/--discard-all.
10135 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10136 --discard-all. If the local symbol needs a dynamic entry, check
10137 that before handling --discard-locals.
10139 2009-12-30 Ian Lance Taylor <iant@google.com>
10142 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10144 (Output_segment::add_output_section): Don't change the flags if
10145 the type is PT_TLS.
10148 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10149 GNU hash table if they need a dynamic value. Otherwise, don't add
10150 them if they are defined in a dynamic object or are forced local.
10152 2009-12-29 Ian Lance Taylor <iant@google.com>
10155 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10156 .gnu.hash table for a 32-bit target.
10159 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10160 regular and a dynamic object only needs a dynamic symbol table
10161 entry if it is externally visible.
10164 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10165 constructor. Add global_offset_table_ field.
10166 (Target_i386::got_section): Set global_offset_table_.
10167 (Target_i386::do_finalize_sections): Set global_offset_table_
10169 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10170 in constructor. Add global_offset_table_ field.
10171 (Target_x86_64::got_section): Set global_offset_table_.
10172 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10175 * layout.cc (Layout::Layout): Initialize increase_relro_.
10176 (Layout::get_output_section): Add is_relro, is_last_relro, and
10177 is_first_non_relro parameters. Change all callers.
10178 (Layout::choose_output_section): Likewise.
10179 (Layout::add_output_section_data): Likewise.
10180 (Layout::make_output_section): Likewise.
10181 (Layout::set_segment_offsets): Clear increase_relro when using a
10183 * layout.h (class Layout): Add increase_relro method. Add
10184 increase_relro_ field. Update declarations.
10185 * output.cc (Output_section::Output_section): Initialize
10186 is_last_relro_ and is_first_non_relro_.
10187 (Output_segment::add_output_section): Group relro sections is
10188 do_sort is true. Handle is_last_relro and is_first_non_relro.
10189 (Output_segment::maximum_alignment): Remove relro handling.
10190 (Output_segment::set_section_addresses): Add increase_relro
10191 parameter. Change all callers. Add initial alignment to align
10192 relro sections on separate page. Remove old relro handling.
10193 (Output_segment::set_section_list_addresses): Remove in_relro
10194 parameter. Change all callers.
10195 (Output_segment::set_offset): Add increase parameter. Change all
10196 callers. Remove old relro handling.
10197 * output.h (class Output_section): Add new methods: is_last_relro,
10198 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10199 Add is_last_relro_ and is_first_non_relro_ fields.
10200 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10201 Create separate .got.plt section. Call increase_relro.
10202 * x86_64.cc (Target_x86_64::got_section): Likewise.
10203 * testsuite/relro_script_test.t: Add .got.plt.
10206 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10207 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10208 (Layout::finalize): Call set_dynamic_symbol_size.
10209 (Layout::set_dynamic_symbol_size): New function.
10210 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10211 set_dynamic_symbol_size.
10214 * output.h (class Output_section): Add is_entsize_zero_ field.
10215 * output.cc (Output_section::Output_section): Initialize
10217 (Output_section::set_entsize): If two different entsizes are
10218 requested, force it to zero.
10219 (Output_section::add_input_section): Set flags for .debug_str
10220 before updating section flags. Set entsize.
10221 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10222 and SHF_STRING if all input sections have those flags.
10224 2009-12-29 Rafael Espindola <espindola@google.com>
10226 * main.cc (main): Fix the sys time reporting.
10227 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10230 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10232 * options.cc (General_options::parse_version): Allow -v to exit
10233 without an error if there is nothing to link.
10235 2009-12-29 Ian Lance Taylor <iant@google.com>
10237 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10238 using a version of gcc before 4.1.
10239 * configure: Rebuild.
10241 2009-12-28 Chris Demetriou <cgd@google.com>
10243 * attributes.cc (Output_attributes_section_data::do_write): Use
10244 std::vector::front rather than std::vector::data.
10246 2009-12-28 Ian Lance Taylor <iant@google.com>
10248 * symtab.h (class Symbol_table): Add enum Defined.
10249 * resolve.cc (Symbol_table::should_override): Add defined
10250 parameter. Change all callers. Test whether object is NULL
10251 before calling a method on it.
10252 (Symbol_table::report_resolve_problem): Add defined parameter.
10253 Change all callers.
10254 (Symbol_table::should_override_with_special): Likewise.
10255 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10256 parameter. Change all callers.
10257 (Symbol_table::do_define_in_output_data): Likewise.
10258 (Symbol_table::define_in_output_segment): Likewise.
10259 (Symbol_table::do_define_in_output_segment): Likewise.
10260 (Symbol_table::define_as_constant): Likewise.
10261 (Symbol_table::do_define_as_constant): Likewise.
10262 * script.h (class Symbol_assignment): Add is_defsym parameter to
10263 constructor; change all callers.
10264 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10265 parameter. Change all callers. Add is_defsym_ field.
10266 (class Parser_closure): Add parsing_defsym parameter to
10267 constructor; change all callers. Add parsing_defsym accessor
10268 function. Add parsing_defsym_ field.
10270 2009-12-28 Ian Lance Taylor <iant@google.com>
10272 * gold.cc (queue_middle_tasks): Fix formatting.
10273 * object.cc (Relobj::is_section_name_included): Likewise.
10275 2009-12-23 Ian Lance Taylor <iant@google.com>
10277 * i386.cc (Target_i386::do_calls_non_split): Recognize
10278 -fsplit-stack prologue for a function with a static chain.
10279 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10280 -fsplit-stack prologue when using %r11.
10282 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10284 * options.cc (General_options::parse_version): Make -v continue and do
10285 the link like GNU ld does.
10287 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10289 * Makefile.am (CCFILES): Add timer.cc.
10290 (HFILES): Add timer.h.
10291 * configure.ac: Check for sysconf and times.
10292 * main.cc: include timer.h.
10293 (main): Use Timer instead of get_run_time.
10296 * workqueue.cc: include timer.h.
10297 (Workqueue::find_and_run_task):
10298 Report user, sys and wall time.
10299 * Makefile.in: Regenerate.
10300 * config.in: Regenerate.
10301 * configure: Regenerate.
10303 2009-12-16 Doug Kwan <dougkwan@google.com>
10305 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10307 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10308 relaxed input sections.
10309 * output.cc (Output_section::find_relaxed_input_section): Change
10310 return type to Output_relaxed_input_section pointer. Adjust code
10311 for new type of relaxed_input_section_map_.
10312 * output.h (Output_section::find_relaxed_input_section): Change
10313 return type to Output_relaxed_input_section pointer.
10314 (Output_section::Output_relaxed_input_section_by_input_section_map):
10316 (Output_section::relaxed_input_section_map_): Change type to
10317 Output_section::Output_relaxed_input_section_by_input_section_map.
10318 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10321 2009-12-15 Ian Lance Taylor <iant@google.com>
10323 * layout.cc (Layout::create_shstrtab): Only write out after input
10324 sections if we are compressing debug sections.
10326 2009-12-15 Ian Lance Taylor <iant@google.com>
10328 * archive.cc (Archive::add_symbols): Only look up a symbol without
10329 a version if there is, in fact, a version.
10331 2009-12-14 Ian Lance Taylor <iant@google.com>
10333 Revert -Wshadow changes, all changes from:
10334 2009-12-11 Doug Kwan <dougkwan@google.com>
10335 2009-12-11 Nick Clifton <nickc@redhat.com>
10336 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10338 2009-12-11 Doug Kwan <dougkwan@google.com>
10340 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10342 * attributes.cc (Object_attribute::size): Ditto.
10343 (Attributes_section_data::size): Ditto.
10344 (Attributes_section_data::Attributes_section_data): Ditto.
10345 (Output_attributes_section_data::do_write): Ditto.
10346 * attributes.h (Object_attribute::set_type): Ditto.
10347 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10349 2009-12-11 Nick Clifton <nickc@redhat.com>
10351 * archive.cc: Fix shadowed variable warnings.
10352 * arm.cc: Likewise.
10353 * compressed_output.cc: Likewise.
10354 * compressed_output.h: Likewise.
10355 * configure: Likewise.
10356 * dwarf_reader.cc: Likewise.
10357 * dynobj.cc: Likewise.
10358 * dynobj.h: Likewise.
10359 * ehframe.cc: Likewise.
10360 * ehframe.h: Likewise.
10361 * errors.cc: Likewise.
10362 * expression.cc: Likewise.
10363 * fileread.cc: Likewise.
10364 * fileread.h: Likewise.
10365 * freebsd.h: Likewise.
10366 * i386.cc: Likewise.
10367 * icf.cc: Likewise.
10368 * incremental.h: Likewise.
10369 * layout.cc: Likewise.
10370 * layout.h: Likewise.
10371 * mapfile.cc: Likewise.
10372 * merge.cc: Likewise.
10373 * merge.h: Likewise.
10374 * object.cc: Likewise.
10375 * object.h: Likewise.
10376 * options.h: Likewise.
10377 * output.cc: Likewise.
10378 * output.h: Likewise.
10379 * parameters.cc: Likewise.
10380 * plugin.cc: Likewise.
10381 * powerpc.cc: Likewise.
10382 * reduced_debug_output.cc: Likewise.
10383 * reduced_debug_output.h: Likewise.
10384 * reloc.cc: Likewise.
10385 * reloc.h: Likewise.
10386 * resolve.cc: Likewise.
10387 * script-sections.cc: Likewise.
10388 * script.cc: Likewise.
10389 * script.h: Likewise.
10390 * sparc.cc: Likewise.
10391 * symtab.cc: Likewise.
10392 * symtab.h: Likewise.
10393 * target-select.cc: Likewise.
10394 * target-select.h: Likewise.
10395 * token.h: Likewise.
10396 * workqueue.cc: Likewise.
10397 * workqueue.h: Likewise.
10398 * x86_64.cc: Likewise.
10400 2009-12-10 Doug Kwan <dougkwan@google.com>
10402 * arm.cc (attributes.h): New include.
10403 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10404 (Arm_relobj::~Arm_relobj): Delete object pointed by
10405 attributes_section_data_.
10406 (Arm_relobj::attributes_section_data): New method definition.
10407 (Arm_relobj::attributes_section_data_): New data member declaration.
10408 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10409 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10410 attributes_section_data_.
10411 (Arm_dynobj::attributes_section_data): New method definition.
10412 (Arm_dynobj::attributes_section_data_): New data member declaration.
10413 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10414 initialization value of may_use_blx_ to false.
10415 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10416 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10417 object attributes to compute results instead of hard-coding.
10418 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10419 Target_arm::get_secondary_compatible_arch,
10420 Target_arm::set_secondary_compatible_arch
10421 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10422 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10423 New method declarations.
10424 (Target_arm::get_aeabi_object_attribute): New method definition.
10425 (Target_arm::attributes_section_data_): New data member declaration.
10426 (read_arm_attributes_section): New template definition.
10427 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10428 (Arm_dynobj::do_read_symbols): Ditto.
10429 (Target_arm::do_finalize_sections): Merge attributes sections from
10430 input. Check for BLX use after attributes section merging.
10431 Fix __exidx_start and __exidx_end visibility. Create an
10432 .ARM.attributes section if necessary.
10433 (Target_arm::get_secondary_compatible_arch,
10434 Target_arm::set_secondary_compatible_arch,
10435 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10436 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10437 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10438 New method definitions.
10440 2009-12-09 Ian Lance Taylor <iant@google.com>
10442 * plugin.cc (Plugin::load): Don't cast from void* to a function
10445 2009-12-09 Ian Lance Taylor <iant@google.com>
10447 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10448 information fields.
10450 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10452 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10453 Replace two_file_shared_1.so with two_file_shared_2.so.
10454 * testsuite/Makefile.in: Regenerated.
10456 2009-12-08 Doug Kwan <dougkwan@google.com>
10458 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10459 (HFILES): Add attributes.h and int_encoding.h.
10460 * Makefile.in: Regenerate.
10461 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10462 function definitions to int_encoding.cc
10463 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10464 prototypes to int_encoding.h
10465 * reduced_debug_output.cc (int_encoding.h): New include.
10466 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10467 function definitions to int_encoding.cc
10468 (insert_into_vector, read_from_pointer): Move template definitions to
10470 * attributes.cc: New file.
10471 * attributes.h: New file.
10472 * int_encoding.cc: New file.
10473 * int_encoding.h: New file.
10475 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10478 * incremental-dump.cc (dump_incremental_inputs): New.
10479 (main): Use dump_incremental_inputs.
10481 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10484 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10485 checking elfcpp::STT_FUNC.
10486 (Target_i386::Relocate::relocate): Likewise.
10487 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10489 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10490 symbols from shared libraries into normal FUNC symbols.
10492 * symtab.h (Symbol): Add is_func and use it.
10494 2009-12-05 Doug Kwan <dougkwan@google.com>
10496 * arm.cc (Target_arm::arm_info): Initialize new fields
10497 attributes_section and attributes_vendor.
10498 * i386.cc (Target_i386::i386_info): Same.
10499 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10500 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10501 fields attributes_section and attributes_vendor.
10502 * sparc.cc (Target_sparc::sparc_info): Same.
10503 * target.h (Target::attributes_section, Target::attributes_vendor,
10504 Target::is_attributes_section, Target::attribute_arg_type,
10505 Target::attributes_order): New method definitions.
10506 (Target::Target_info::attributes_section,
10507 Target::Target_info::attributes_vendor): New fields.
10508 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10509 virtual method definitions.
10510 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10511 attributes_section and attributes_vendor.
10512 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10514 2009-12-05 Doug Kwan <dougkwan@google.com>
10516 * arm.cc: Update comments about interworking and stub generation.
10517 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10518 considered as non-PIC.
10519 (Arm_relocate_functions::base_abs): Fix formatting.
10520 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10521 of function to use GOT entry address instead of offset.
10522 (Target_arm::Scan::global): Issue an error if a symbol would need a
10523 PLT does not get one because it is untyped. Remove code to create
10524 dynamic symbols for relative branches.
10525 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10526 takes unsigned integer instead of boolean.
10528 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10530 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10531 (two_file_test_LDADD): Likewise.
10532 (common_test_1_LDADD): Likewise.
10533 (exception_test_LDADD) Likewise.
10534 (weak_test_LDADD): Likewise.
10535 (many_sections_test_LDADD): Likewise.
10536 (initpri1_LDADD): Likewise.
10537 (script_test_1_LDADD): Likewise.
10538 (script_test_2_LDADD): Likewise.
10539 (justsyms_LDADD): Likewise.
10540 (binary_test_LDADD): Likewise.
10541 (large_LDADD): Likewise.
10542 * testsuite/Makefile.in: Regenerated.
10544 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10546 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10547 (Symbol_table::override_with_special): Likewise.
10548 (Symbol_table::add_from_object): Likewise.
10550 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10552 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10553 Don't set the data_offset twice.
10555 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10557 * testsuite/Makefile.in: Regenerate.
10559 2009-12-03 Doug Kwan <dougkwan@google.com>
10561 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10562 (Target_arm::do_finalize_sections): Add parameter for symbol table
10563 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10564 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10565 parameter for symbol table pointer.
10566 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10567 an additional parameter for a pointer to symbol table.
10568 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10569 parameter for a symbol table pointer.
10570 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10571 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10573 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10574 parameter for a symbol table pointer.
10576 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10578 * incremental.cc (Incremental_inputs_header)
10579 (Incremental_inputs_header_write, Incremental_inputs_entry)
10580 (Incremental_inputs_entry_write): Move ...
10581 * incremental.h (Incremental_inputs_header)
10582 (Incremental_inputs_header_write, Incremental_inputs_entry)
10583 (Incremental_inputs_entry_write): here.
10585 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10587 * incremental.cc (make_sized_incremental_binary): Set the target.
10588 Error if it is incompatible.
10589 * output.h (Output_file): Add filename method.
10591 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10593 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10594 from the get_* methods.
10596 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10598 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10599 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10600 Write 0 for the data_offset of scripts.
10602 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10604 * testsuite/Makefile.am: Add the incremental_test.sh test.
10605 * testsuite/incremental_test.sh: New.
10606 * testsuite/incremental_test_1.c: New.
10607 * testsuite/incremental_test_2.c: New.
10609 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10611 * incremental-dump.cc (main): Fix typos.
10613 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10616 * incremental-dump.cc (main): Use llu to print 64 bit values.
10618 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10619 H.J. Lu <hongjiu.lu@intel.com>
10621 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10623 (incremental_dump_LDADD): Likewise.
10624 * Makefile.in: Regenerated.
10626 2009-11-25 Doug Kwan <dougkwan@google.com>
10630 2009-11-25 Doug Kwan <dougkwan@google.com>
10632 * arm.cc (Target_arm::Target_arm): Move method definition
10633 outside of class definition. Add code to handle
10634 --target1-rel, --target1-abs and --target2= options.
10635 (Target_arm::get_reloc_reloc_type): Change method to be
10636 non-static and const.
10637 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10638 New data member declaration.
10639 (Target_arm::Scan::local, Target_arm::Scan::global,
10640 Target_arm::Relocate::relocate,
10641 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10642 Adjust call to Target_arm::get_real_reloc_type.
10643 (Target_arm::get_real_reloc_type): Use command line options
10644 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10645 * options.h (--target1-rel, --target1-abs, --target2): New
10648 2009-11-25 Doug Kwan <dougkwan@google.com>
10650 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10651 class definition. Add code to handle --target1-rel, --target1-abs
10652 and --target2= options.
10653 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10655 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10656 member declaration.
10657 (Target_arm::Scan::local, Target_arm::Scan::global,
10658 Target_arm::Relocate::relocate,
10659 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10660 call to Target_arm::get_real_reloc_type.
10661 (Target_arm::get_real_reloc_type): Use command line options to
10662 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10663 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10666 2009-11-25 Doug Kwan <dougkwan@google.com>
10668 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10669 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10670 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10672 (Arm_relocate_functions::thm_call): Replace body with a call to
10673 Arm_relocate_functions::thumb_branch_common.
10674 (Arm_relocate_functions::thm_jump24,
10675 Arm_relocate_functions::thm_xpc22): New method definitions.
10676 (Arm_relocate_functions::thumb_branch_common): New method definition.
10677 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10679 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10680 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10682 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10684 * Makefile.am: Build incremental-dump
10685 * Makefile.in: Regenerate.
10686 * incremental-dump.cc: New.
10687 * incremental.cc (Incremental_inputs_header_data,
10688 Incremental_inputs_entry_data): Move to incremental.h
10689 * incremental.h: (Incremental_inputs_header_data,
10690 Incremental_inputs_entry_data): Move from incremental.cc
10692 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10694 * incremental.cc (Incremental_inputs_header,
10695 Incremental_inputs_header_write, Incremental_inputs_entry,
10696 Incremental_inputs_entry_write): Add a typedef with the data type.
10698 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10700 * incremental.cc (Incremental_inputs_header,
10701 Incremental_inputs_header_write, Incremental_inputs_entry,
10702 Incremental_inputs_entry_write): Update comment about which
10703 type has the filed descriptions.
10705 2009-11-15 Doug Kwan <dougkwan@google.com>
10707 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10708 (Arm_relocate_functions::arm_branch_common): Change method defintion
10709 in class definition to a method declaration and update list of formal
10711 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10712 Arm_relocation_functions::jump24): Adjust call to
10713 Arm_relocate_functions::arm_branch_common. Update list of formal
10715 (Arm_relocate_functions::xpc25): New method definition.
10716 (Arm_relocate_functions::arm_branch_common): Move method defintion
10717 out from class definition. Use stubs for mode-switching and extending
10719 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10720 specially. Change code to enable use of stubs in ARM branches.
10722 2009-11-10 Doug Kwan <dougkwan@google.com>
10724 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10725 in method declaration.
10726 (Target_arm::relocate_stub): New method declaration.
10727 (Target_arm::default_target): Change to return a pointer instead of
10729 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10730 Target_arm::default_target.
10731 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10733 (Target_arm::relocate_section): Adjust view.
10734 (Target_arm::relocate_stub): New method definition.
10736 2009-11-10 Doug Kwan <dougkwan@google.com>
10738 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10740 * incremental.cc (open_incremental_binary): Initialized local
10741 variables to avoid warnings.
10742 * object.cc (make_elf_object): Ditto.
10743 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10746 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10749 * testsuite/plugin_test.c: Include "config.h".
10751 2009-11-09 Doug Kwan <dougkwan@google.com>
10753 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10754 (arm_symbol_value): Remove.
10755 (Arm_relocate_functions::arm_branch_common,
10756 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10757 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10758 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10759 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10760 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10761 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10762 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10763 Arm_relocate_functions::thm_mobw_abs_nc,
10764 Arm_relocate_functions::thm_mov_abs,
10765 Arm_relocate_functions::movw_prel_nc,
10766 Arm_relocate_functions::thm_movt_abs,
10767 Arm_relocate_functions::movt_prel,
10768 Arm_relocate_functions::thm_movw_prel_nc,
10769 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10770 (Target_arm::Relocate::relocate): Only decompose address into two
10771 parts if relocation type uses the thumb-bit and pass the actual
10772 bit instead of a flag indicating that the thumb-bit is used. Adjust
10773 calls to methods in Arm_relocate_functions for this change.
10775 2009-11-08 Ian Lance Taylor <iant@google.com>
10778 * reloc.cc: Instantiate
10779 Sized_relobj::initialize_input_to_output_maps and
10780 Sized_relobj:free_input_to_output_maps.
10782 2009-11-06 Ian Lance Taylor <iant@google.com>
10785 * defstd.cc (in_segment): Set only_if_ref true for "end".
10787 2009-11-06 Doug Kwan <dougkwan@google.com>
10789 * arm.cc (class Reloc_stub): Correct a comment.
10790 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10791 (Target_arm::scan_section_for_stubs): New method declaration.
10792 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10793 Change methods from private to protected.
10794 (Target_arm::do_may_relax): New method definition.
10795 (Target_arm::do_relax, Target_arm::group_sections,
10796 Target_arm::scan_reloc_for_stub,
10797 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10798 (Target_arm::arm_input_section_map_): New data member declaration.
10799 (Target_arm::scan_reloc_for_stub,
10800 Target_arm::scan_reloc_section_for_stubs,
10801 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10802 Target_arm::do_relax): New method definitions.
10804 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10806 * configure.ac: Check for (struct stat)::st_mtim
10807 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10808 * config.in: Regenerate.
10809 * configure: Regenerate.
10811 2009-11-05 Ian Lance Taylor <iant@google.com>
10814 * output.cc (Output_segment::add_output_section): Add missing
10817 2009-11-04 Ian Lance Taylor <iant@google.com>
10820 * object.h (class Object): Add is_needed and set_is_needed
10821 methods. Add is_needed_ field. Make bool fields into bitfields.
10822 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10823 defined in a dynamic object and referenced by a regular object,
10824 set is_needed for the dynamic object.
10825 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10826 if the file is marked with as_needed and it is not needed.
10828 2009-11-04 Ian Lance Taylor <iant@google.com>
10831 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10832 tags if data is discarded by linker script.
10833 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10834 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10835 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10836 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10838 2009-11-04 Ian Lance Taylor <iant@google.com>
10840 * layout.cc (Layout::get_output_section): Add is_interp and
10841 is_dynamic_linker_section parameters. Change all callers.
10842 (Layout::choose_output_section): Likewise.
10843 (Layout::make_output_section): Likewise.
10844 (Layout::add_output_section_data): Add is_dynamic_linker_section
10845 parameter. Change all callers.
10846 * layout.h (class Layout): Update declarations.
10847 * output.h (class Output_section): Add is_interp, set_is_interp,
10848 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10849 Add is_interp_, is_dynamic_linker_section_ fields. Change
10850 generate_code_fills_at_write_ to a bitfield.
10851 * output.cc (Output_section::Output_sections): Initialize new
10853 (Output_segment::add_output_section): Add do_sort parameter.
10854 Change all callers.
10856 2009-11-03 Ian Lance Taylor <iant@google.com>
10859 * options.h (class General_options): Add --warn-common.
10860 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10861 merging two common symbols.
10862 (Symbol_table::should_override): Handle --warn-common when merging
10863 a common symbol with a defined symbol. Use report_resolve_problem
10864 for multiple definitions.
10865 (Symbol_table::report_resolve_problem): New function.
10866 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10868 2009-11-03 Doug Kwan <dougkwan@google.com>
10870 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10872 (Target_arm::stub_factory): New method definition.
10873 (Target_arm::new_arm_input_section,
10874 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10875 Target_arm::reloc_uses_thumb_bit): New method declarations.
10876 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10877 New type definitions.
10878 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10879 member declarations.
10880 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10881 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10882 New method definitions.
10884 2009-11-03 Ian Lance Taylor <iant@google.com>
10886 * options.h (class General_options): Add --warn_constructors.
10888 2009-11-03 Ian Lance Taylor <iant@google.com>
10891 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10892 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10894 2009-11-03 Ian Lance Taylor <iant@google.com>
10897 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10898 --msgid-bugs-address.
10899 (install-pdf): New target.
10900 (install-data_yes): Look up one directory to find mkinstalldirs.
10902 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10904 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10907 2009-10-30 Doug Kwan <dougkwan@google.com>
10909 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10911 2009-10-30 Doug Kwan <dougkwan@google.com>
10913 * arm.cc (Stub_addend_reader): New struct template definition
10914 and partial specializations.
10915 (Stub_addend_reader::operator()): New method definition for a
10916 partially specialized template.
10918 2009-10-30 Doug Kwan <dougkwan@google.com>
10920 * arm.cc (Arm_relobj::processor_specific_flags): New method
10922 (Arm_relobj::do_read_symbols): New method declaration.
10923 (Arm_relobj::processor_specific_flags_): New data member declaration.
10924 (Arm_dynobj): New class definition.
10925 (Target_arm::do_finalize_sections): Add input_objects parameter.
10926 (Target_arm::do_adjust_elf_header): New method declaration.
10927 (Target_arm::are_eabi_versions_compatible,
10928 (Target_arm::merge_processor_specific_flags): New method declaration.
10929 (Target_arm::do_make_elf_object): New overloaded method definitions
10931 (Arm_relobj::do_read_symbols): New method definition.
10932 (Arm_dynobj::do_read_symbols): Ditto.
10933 (Target_arm::do_finalize_sections): Add input_objects parameters.
10934 Merge processor-specific flags from all input objects.
10935 (Target_arm::are_eabi_versions_compatible,
10936 Target_arm::merge_processor_specific_flags,
10937 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10938 New method definitions.
10939 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10940 Input_objects pointer type parameter.
10941 * layout.cc (Layout::finalize): Pass input objects to target's.
10942 finalize_sections function.
10943 * output.cc (Output_file_header::do_sized_write): Set ELF file
10944 header's processor-specific flags.
10945 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10946 Input_objects pointer type parameter.
10947 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10948 * target.h (Input_objects): New forward class declaration.
10949 (Target::processor_specific_flags,
10950 Target::are_processor_specific_flags_sect): New method definitions.
10951 (Target::finalize_sections): Add input_objects parameter.
10952 (Target::Target): Initialize processor_specific_flags_ and
10953 are_processor_specific_flags_set_.
10954 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10956 (Target::set_processor_specific_flags): New method definition.
10957 (Target::processor_specific_flags_,
10958 Target::are_processor_specific_flags_set_): New data member
10960 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10961 Input_objects pointer type parameter.
10963 2009-10-30 Doug Kwan <dougkwan@google.com>
10965 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10967 2009-10-28 Ian Lance Taylor <iant@google.com>
10969 * object.h (class Relobj): Drop options parameter from
10970 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10971 do_scan_relocs, do_relocate. Change all callers.
10972 (class Sized_relobj): Drop options parameters from
10973 do_gc_process_relocs, do_scan_relocs, do_relocate,
10974 do_relocate_sections, relocate_sections, emit_relocs_scan,
10975 emit_relocs_scan_reltype. Change all callers.
10976 (struct Relocate_info): Remove options field and all references to
10978 * reloc.h (class Read_relocs): Remove options constructor
10979 parameter and options_ field. Change all callers.
10980 (class Gc_process_relocs, class Scan_relocs): Likewise.
10981 (class Relocate_task): Likewise.
10982 * target-reloc.h (scan_relocs): Remove options parameter. Change
10984 (scan_relocatable_relocs): Likewise.
10985 * target.h (class Sized_target): Remove options parameter from
10986 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10988 * gc.h (gc_process_relocs): Remove options parameter. Change all
10990 * arm.cc: Update functions to remove options parameters.
10991 * i386.cc: Likewise.
10992 * powerpc.cc: Likewise.
10993 * sparc.cc: Likewise.
10994 * x86_64.cc: Likewise.
10995 * testsuite/testfile.cc: Likewise.
10997 2009-10-28 Doug Kwan <dougkwan@google.com>
10999 * arm.cc (Arm_relobj): New class definition.
11000 (Arm_relobj::scan_sections_for_stubs,
11001 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11002 New method definitions.
11004 2009-10-28 Cary Coutant <ccoutant@google.com>
11006 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11007 (Plugin::cleanup_done_): New member.
11008 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11009 (Plugin_manager::cleanup_done_): Remove.
11010 (Plugin_manager::add_input_file): Edit error message.
11011 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11012 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11014 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11016 * fileread.cc: (File_read::View::~View): Use the new
11017 data_ownership_ filed.
11018 (File_read::~File_read): Dispose the new whole_file_view_.
11019 (File_read::open): Mmap the whole file if needed.
11020 (File_read::open): Use whole_file_view_ instead of contents_.
11021 (File_read::find_view): Use whole_file_view_ if applicable.
11022 (File_read::do_read): Use whole_file_view_ instead of contents_.
11023 (File_read::make_view): Use whole_file_view_ instead of contents_,
11024 update File_read::View::View call.
11025 (File_read::find_or_make_view): Update File_read::View::View
11027 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11029 (File_read::View::Data_ownership): New enum.
11030 (File_read::View::View): Replace bool mapped_ with Data_ownership
11032 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11033 (File_read::View::data_ownership_): New field.
11034 (File_read::contents_): Remove (replaced by whole_file_view_).
11035 (File_read::whole_file_view_): New field.
11036 * options.h (class General_options): Add --keep-files-mapped.
11038 2009-10-27 Cary Coutant <ccoutant@google.com>
11040 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11041 * testsuite/Makefile.am (plugin_test_5): New test case.
11042 * testsuite/Makefile.in: Regenerate.
11044 2009-10-25 Doug Kwan <dougkwan@google.com>
11046 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11047 from private to protected to allow access by child class.
11048 (Sized_relobj::do_relocate_sections): New method declaration.
11049 (Sized_relobj::relocate_sections): Virtualize.
11050 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11051 Sized_relobj::relocate_sections. Instantiate template explicitly
11052 for different target sizes and endianity.
11054 2009-10-24 Doug Kwan <dougkwan@google.com>
11056 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11057 (Arm_input_section::as_arm_input_section): New method.
11058 (Arm_output_section): New class definition.
11059 (Arm_output_section::create_stub_group,
11060 Arm_output_section::group_sections): New method definitions.
11062 2009-10-22 Doug Kwan <dougkwan@google.com>
11064 * arm.cc (Arm_input_section): New class definition.
11065 (Arm_input_section::init, Arm_input_section:do_write,
11066 Arm_input_section::set_final_data_size,
11067 Arm_input_section::do_reset_address_and_file_offset): New method
11070 2009-10-21 Doug Kwan <dougkwan@google.com>
11072 * arm.cc (Stub_table, Arm_input_section): New forward class
11074 (Stub_table): New class defintion.
11075 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11076 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11077 New method definition.
11079 2009-10-21 Doug Kwan <dougkwan@google.com>
11081 * arm.cc: Update copyright comments.
11082 (Target_arm): New forward class template declaration.
11083 (Arm_address): New type.
11084 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11085 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11086 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11088 (Insn_template): Same.
11089 (DEF_STUBS): New macro.
11090 (Stub_type): New enum type.
11091 (Stub_template): New class definition.
11093 (Reloc_stub): Same.
11094 (Stub_factory): Same.
11095 (Target_arm::Target_arm): Initialize may_use_blx_ and
11096 should_force_pic_veneer_.
11097 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11098 Target_arm::should_force_pic_veneer,
11099 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11100 Target_arm::using_thumb_only, Target_arm:;default_target): New
11102 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11103 New data member declarations.
11104 (Insn_template::size, Insn_template::alignment): New method defintions.
11105 (Stub_template::Stub_template): New method definition.
11106 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11107 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11108 (Stub_factory::Stub_factory): New method definition.
11109 * gold.h (string_hash): New template.
11110 * output.h (Input_section_specifier::hash_value): Use
11112 (Input_section_specifier::string_hash): Remove.
11113 * stringpool.cc (Stringpool_template::string_hash): Use
11116 2009-10-20 Doug Kwan <dougkwan@google.com>
11118 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11119 symbols of relaxed input sections.
11120 * output.h (Output_section::find_relaxed_input_section): Make
11123 2009-10-16 Doug Kwan <dougkwan@google.com>
11125 * dynobj.cc (Versions::Versions): Initialize version_script_.
11126 Only insert base version symbol definition for a shared object
11127 if version script defines any version versions.
11128 (Versions::define_base_version): New method definition.
11129 (Versions::add_def): Check that base version is not needed.
11130 (Versions::add_need): Define base version lazily.
11131 * dynobj.h (Versions::define_base_version): New method declaration.
11132 (Versions::needs_base_version_): New data member declaration.
11133 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11134 (check_DATA): Add no_version_test.stdout.
11135 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11137 * testsuite/Makefile.in: Regenerate.
11138 * testsuite/no_version_test.c: New file.
11139 * testsuite/no_version_test.sh: Ditto.
11141 2009-10-16 Doug Kwan <dougkwan@google.com>
11143 * expression.cc (class Segment_start_expression): New class definition.
11144 (Segment_start_expression::value): New method definition.
11145 (script_exp_function_segment_start): Return a new
11146 Segment_start_expression.
11147 * gold/script-c.h (script_saw_segment_start_expression): New function
11149 * script-sections.cc (Script_sections::Script_sections): Initialize
11150 SAW_SEGMENT_START_EXPRESSION_ to false.
11151 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11152 and -Tbbs options to specify section addresses if given in
11153 command line and no SEGMENT_START expression is seen in a script.
11154 * script-sections.h (Script_sections::saw_segment_start_expression,
11155 Script_sections::set_saw_segment_start_expression): New method
11157 (Script_sections::saw_segment_start_expression_): New data member
11159 * script.cc (script_saw_segment_start_expression): New function.
11160 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11161 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11162 script_test_7.sh and script_test_8.sh.
11163 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11164 script_test_8.stdout.
11165 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11166 (script_test_6, script_test_6.stdout, script_test_7,
11167 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11168 * Makefile.in: Regenerate.
11169 * testsuite/script_test_6.sh: New file.
11170 * testsuite/script_test_6.t: Same.
11171 * testsuite/script_test_7.sh: Same.
11172 * testsuite/script_test_7.t: Same.
11173 * testsuite/script_test_8.sh: Same.
11175 2009-10-16 Doug Kwan <dougkwan@google.com>
11177 * output.cc (Output_segment::set_section_list_address): Cast
11178 expressions to unsigned long long type to avoid format warnings.
11180 2009-10-15 Ian Lance Taylor <iant@google.com>
11182 * script.cc (Script_options::add_symbol_assignment): Always add a
11183 dot assignment to script_sections_.
11184 * script-sections.cc (Script_sections::add_dot_assignment):
11185 Initialize if necessary.
11187 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11188 program headers with no load segment if there is a linker script.
11190 * layout.cc (Layout::set_segment_offsets): Align the file offset
11191 to the segment aligment for -N or -n with no load segment.
11192 * output.cc (Output_segment::add_output_section): Don't crash if
11193 the first section is a TLS section.
11194 (Output_segment::set_section_list_addresses): Print an error
11195 message if the address moves backward in a linker script.
11196 * script-sections.cc
11197 (Output_section_element_input::set_section_addresses): Don't
11198 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11199 (Orphan_output_section::set_section_addresses): Likewise.
11201 2009-10-15 Doug Kwan <dougkwan@google.com>
11203 * layout.cc (Layout::finish_dynamic_section): Generate tags
11204 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11205 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11206 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11208 2009-10-14 Ian Lance Taylor <iant@google.com>
11210 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11212 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11213 data_shdr fields of relinfo.
11214 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11215 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11216 R_386_TLS_LDO_32, adjust based on section flags.
11217 (Target_i386::Relocate::fix_up_ldo): Remove.
11219 2009-10-13 Ian Lance Taylor <iant@google.com>
11221 Add support for -pie.
11222 * options.h (class General_options): Add -pie and
11224 (General_options::output_is_position_independent): Test -pie.
11225 (General_options::output_is_executable): Return true if not shared
11226 and not relocatable.
11227 (General_options::output_is_pie): Remove.
11228 * options.cc (General_options::finalize): Reject incompatible uses
11230 * gold.cc (queue_middle_tasks): A -pie link is not static.
11231 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11232 * symtab.cc (Symbol::final_value_is_known): Return false if
11233 output_is_position_independent.
11234 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11235 output_is_position_independent.
11236 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11237 output_is_position_independent.
11238 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11239 output_is_position_independent.
11240 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11242 (basic_pie_test.o, basic_pie_test): New targets.
11243 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11244 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11245 (two_file_pie_test): New target.
11246 * testsuite/Makefile.in: Rebuild.
11247 * README: Remove note saying that -pie is not supported.
11249 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11251 * options.h (class General_options): Add -init and -fini.
11252 * layout.cc (Layout::finish_dynamic_section): Emit
11253 given init and fini functions.
11255 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11257 * gc.h (gc_process_relocs): Check if icf is enabled using new
11259 * gold.cc (queue_initial_tasks): Likewise.
11260 (queue_middle_tasks): Likewise.
11261 * object.cc (do_layout): Likewise.
11262 * symtab.cc (is_section_folded): Likewise.
11263 * main.cc (main): Likewise.
11264 * reloc.cc (Read_relocs::run): Likewise.
11265 (Sized_relobj::do_scan_relocs): Likewise.
11266 * icf.cc (is_function_ctor_or_dtor): New function.
11267 (Icf::find_identical_sections): Check if function is ctor or dtor when
11268 safe icf is chosen.
11269 * options.h (General_options::icf): Change option to be an enum.
11270 (Icf_status): New enum.
11271 (icf_enabled): New method.
11272 (icf_safe_folding): New method.
11273 (set_icf_status): New method.
11274 (icf_status_): New variable.
11275 * (options.cc) (General_options::finalize): Set icf_status_.
11276 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11277 icf_test and icf_keep_unique_test to use the --icf enum flag.
11278 * testsuite/icf_safe_test.sh: New file.
11279 * testsuite/icf_safe_test.cc: New file.
11281 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11283 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11284 includes to gc.h and icf.h.
11285 * arm.cc: Include gc.h.
11286 * gold.cc: Likewise.
11287 * i386.cc: Likewise.
11288 * powerpc.cc: Likewise.
11289 * sparc.cc: Likewise.
11290 * x86_64.cc: Likewise.
11291 * gc.h: Include icf.h.
11293 2009-10-11 Ian Lance Taylor <iant@google.com>
11295 * plugin.cc: Include "gold.h" before other header files.
11297 2009-10-10 Chris Demetriou <cgd@google.com>
11299 * options.h (Input_file_argument::Input_file_type): New enum.
11300 (Input_file_argument::is_lib_): Replace with...
11301 (Input_file_argument::type_): New member.
11302 (Input_file_argument::Input_file_argument): Take Input_file_type
11303 'type' rather than boolean 'is_lib' as second argument.
11304 (Input_file_argument::is_lib): Use type_.
11305 (Input_file_argument::is_searched_file): New function.
11306 (Input_file_argument::may_need_search): Handle is_searched_file.
11307 * options.cc (General_options::parse_library): Support -l:filename.
11308 (General_options::parse_just_symbols): Update for Input_file_argument
11310 (Command_line::process): Likewise.
11311 * archive.cc (Archive::get_file_and_offset): Likewise.
11312 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11313 * script.cc (read_script_file, script_add_file): Likewise.
11314 * fileread.cc (Input_file::Input_file): Likewise.
11315 (Input_file::will_search_for): Handle is_searched_file.
11316 (Input_file::open): Likewise.
11317 * readsyms.cc (Read_symbols::get_name): Likewise.
11318 * testsuite/Makefile.am (searched_file_test): New test.
11319 * testsuite/Makefile.in: Regenerate.
11320 * testsuite/searched_file_test.cc: New file.
11321 * testsuite/searched_file_test_lib.cc: New file.
11323 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11324 Ian Lance Taylor <iant@google.com>
11326 * descriptor.cc: Include <cstdio> and "binary-io.h".
11327 (Descriptors::open): Open the files in binary mode always.
11328 * script.cc (Lex::get_token): Treat \r as whitespace.
11330 2009-10-09 Ian Lance Taylor <iant@google.com>
11332 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11334 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11335 Ian Lance Taylor <iant@google.com>
11337 * configure.ac: Check for readv function also.
11338 * fileread.cc (readv): Define if not HAVE_READV.
11339 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11341 * config.in: Regenerate.
11342 * configure: Regenerate.
11344 2009-10-09 Doug Kwan <dougkwan@google.com>
11346 * layout.cc (Layout::make_output_section): Call target hook to make
11347 ordinary output section.
11348 (Layout::finalize): Adjust parameter list of call the
11349 Target::may_relax().
11350 * layout.h (class Layout::section_list): New method.
11351 * merge.h (Output_merge_base::entsize): Change visibility to public.
11352 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11354 (Output_merge_string::do_is_string): New method.
11355 * object.cc (Sized_relobj::do_setup): renamed from
11356 Sized_relobj::set_up.
11357 * object.h (Sized_relobj::adjust_shndx,
11358 Sized_relobj::initializ_input_to_output_maps,
11359 Sized_relobj::free_input_to_output_maps): Change visibilities to
11361 (Sized_relobj::setup): Virtualize.
11362 (Sized_relobj::do_setup): New method declaration.
11363 (Sized_relobj::invalidate_section_offset,
11364 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11365 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11366 * options.cc (parse_int): New function.
11367 * options.h (parse_int): New declaration.
11368 (DEFINE_int): New macro.
11369 (stub_group_size): New option.
11370 * output.cc (Output_section::Output_section): Initialize memebers
11371 merge_section_map_, merge_section_by_properties_map_,
11372 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11373 (Output_section::add_input_section): Handled deferred code-fill
11374 generation and remove an old comment.
11375 (Output_section::add_relaxed_input_section): New method definition.
11376 (Output_section::add_merge_input_section): Use merge section by
11377 properties map to speed to search. Update merge section maps
11379 (Output_section::build_relaxation_map): New method definition.
11380 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11382 (Output_section::relax_input_section): Renamed to
11383 Output_section::convert_input_sections_to_relaxed_sections and change
11384 interface to take a vector of pointers to relaxed sections.
11385 (Output_section::find_merge_section,
11386 Output_section::find_relaxed_input_section): New method definitions.
11387 (Output_section::is_input_address_mapped,
11388 Output_section::output_offset, Output_section::output_address):
11389 Use output section data maps to speed up searching.
11390 (Output_section::find_starting_output_address): Add comments.
11391 (Output_section::do_write,
11392 Output_section::write_to_postprocessing_buffer): Do code-fill
11393 generation as appropriate.
11394 (Output_section::get_input_sections): Invalidate relaxed input section
11396 (Output_section::restore_states): Adjust type of checkpoint .
11397 Invalidate relaxed input section map.
11398 * output.h (Output_merge_base): New class declaration.
11399 (Input_section_specifier): New class defintion.
11400 (class Output_relaxed_input_section) Change base class to
11401 Output_section_data_build.
11402 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11403 base class initializer.
11404 (Output_section::add_relaxed_input_section): New method declaration.
11405 (Output_section::Input_section): Change visibility to protected.
11406 (Output_section::Input_section::relobj,
11407 Output_section::Input_section::shndx): Handle relaxed input sections.
11408 Output_section::input_sections) Change visibility to protected. Also
11409 define overload to return a non-const pointer.
11410 (Output_section::Merge_section_properties): New class defintion.
11411 (Output_section::Merge_section_by_properties_map,
11412 Output_section::Output_section_data_by_input_section_map,
11413 Output_section::Relaxation_map): New types.
11414 (Output_section::relax_input_section): Rename method to
11415 Output_section::convert_input_sections_to_relaxed_sections and change
11416 interface to take a vector of relaxed section pointers.
11417 (Output_section::find_merge_section,
11418 Output_section::find_relaxed_input_section,
11419 Output_section::build_relaxation_map,
11420 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11421 New method declarations.
11422 (Output_section::merge_section_map_
11423 Output_section::merge_section_by_properties_map_,
11424 Output_section::relaxed_input_section_map_,
11425 Output_section::is_relaxed_input_section_map_valid_,
11426 Output_section::generate_code_fills_at_write_): New data members.
11427 * script-sections.cc
11428 (Output_section_element_input::set_section_addresses): Call
11429 current_data_size and addralign methods of relaxed input sections.
11430 (Orphan_output_section::set_section_addresses): Call current_data_size
11431 and addralign methods of relaxed input sections.
11432 * symtab.cc (Symbol_table::compute_final_value): Extract template
11433 from the body of Symbol_table::sized_finalize_symbol.
11434 (Symbol_table::sized_finalized_symbol): Call
11435 Symbol_table::compute_final_value.
11436 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11437 (Symbol_table::compute_final_value): New templated method declaration.
11438 * target.cc (Target::do_make_output_section): New method defintion.
11439 * target.h (Target::make_output_section): New method declaration.
11440 (Target::relax): Add more parameters for input objects, symbol table
11441 and layout. Adjust call to do_relax.
11442 (Target::do_make_output_section): New method declaration.
11443 (Target::do_relax): Add parameters for input objects, symbol table
11446 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11448 * pread.c: Include stdio.h.
11450 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11452 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11455 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11457 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11458 Change read_shndx type to unsigned int.
11459 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11461 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11462 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11463 Change read_shndx type to unsigned int.
11464 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11466 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11467 * layout.cc (Layout::create_symtab_sections): Cast the result of
11468 local_symcount * symsize to off_t in the gold_assert.
11470 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11472 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11473 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11475 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11476 (Arm_relocate_functions::thm_abs5): New function.
11477 (Arm_relocate_functions::abs12): New function.
11478 (Arm_relocate_functions::abs16): New function.
11479 (Arm_relocate_functions::base_abs): New function.
11480 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11481 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11482 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11484 (Scan::global): Likewise.
11485 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11486 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11487 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11488 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11491 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11493 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11494 (Arm_relocate_functions::movt_prel): New function.
11495 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11496 (Arm_relocate_functions::thm_movt_prel): New function.
11497 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11498 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11499 (Scan::global, Relocate::relocate): Likewise.
11500 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11502 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11504 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11505 Incremental_checker.
11506 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11508 (class Incremental_inputs_header): New class.
11509 (Incremental_inputs_header_writer): Edit comment.
11510 (Incremental_inputs_entry): New class.
11511 (Incremental_inputs_entry_writer): Edit comment.
11512 (Sized_incremental_binary::do_find_incremental_inputs_section):
11513 Add *strtab_shndx parameter, fill it.
11514 (Sized_incremental_binary::do_check_inputs): New method.
11515 (Incremental_checker::can_incrementally_link_output_file): Use
11516 Sized_incremental_binary::check_inputs.
11517 (Incremental_inputs::report_command_line): Save command line in
11520 (Incremental_binary::find_incremental_inputs_section): New
11522 (Incremental_binary::do_find_incremental_inputs_section): Add
11523 strtab_shndx parameter.
11524 (Incremental_binary::do_check_inputs): New pure virtual method.
11525 (Sized_incremental_binary::do_check_inputs): Declare.
11526 (Incremental_checker::Incremental_checker): Add incremental_inputs
11527 parameter, use it to initialize incremental_inputs_.
11528 (Incremental_checker::incremental_inputs_): New field.
11529 (Incremental_checker::command_line): New method.
11530 (Incremental_checker::inputs): New method.
11531 (Incremental_checker::command_line_): New field.
11533 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11535 * incremental.cc: Include <cstdarg> and "target-select.h".
11536 (vexplain_no_incremental): New function.
11537 (explain_no_incremental): New function.
11538 (Incremental_binary::error): New method.
11539 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11541 (make_sized_incremental_binary): New function.
11542 (open_incremental_binary): New function.
11543 (can_incrementally_link_file): Add checks if output is ELF and has
11545 * incremental.h: Include "elfcpp_file.h" and "output.h".
11546 (Incremental_binary): New class.
11547 (Sized_incremental_binary): New class.
11548 (open_incremental_binary): Declare.
11549 * object.cc (is_elf_object): Use
11550 elfcpp::Elf_recognizer::is_elf_file.
11551 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11552 * output.h (Output_file::filesize): New method.
11554 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11556 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11558 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11559 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11561 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11563 (Arm_relocate_functions::movw_abs_nc): New function.
11564 (Arm_relocate_functions::movt_abs): New function.
11565 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11566 (Arm_relocate_functions::thm_movt_abs): New function.
11567 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11568 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11569 (Scan::global): Likewise.
11570 (Relocate::relocate): Likewise.
11571 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11573 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11575 * arm.cc (Arm_relocate_functions::got_prel) New function.
11576 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11577 (Relocate::relocate): Likewise.
11578 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11580 2009-10-06 Ian Lance Taylor <iant@google.com>
11582 * options.h (class General_options): Define
11583 split_stack_adjust_size parameter.
11584 * object.h (class Object): Add uses_split_stack_ and
11585 has_no_split_stack_ fields. Add uses_split_stack and
11586 has_no_split_stack accessor functions. Declare
11587 handle_split_stack_section.
11588 (class Reloc_symbol_changes): Define.
11589 (class Sized_relobj): Define Function_offsets. Declare
11590 split_stack_adjust, split_stack_adjust_reltype, and
11592 * object.cc (Object::handle_split_stack_section): New function.
11593 (Sized_relobj::do_layout): Call handle_split_stack_section.
11594 * dynobj.cc (Sized_dynobj::do_layout): Call
11595 handle_split_stack_section.
11596 * reloc.cc (Sized_relobj::relocate_sections): Call
11597 split_stack_adjust for executable sections in split_stack
11598 objects. Pass reloc_map to relocate_section.
11599 (Sized_relobj::split_stack_adjust): New function.
11600 (Sized_relobj::split_stack_adjust_reltype): New function.
11601 (Sized_relobj::find_functions): New function.
11602 * target-reloc.h: Include "object.h".
11603 (relocate_section): Add reloc_symbol_changes parameter. Change
11605 * target.h (class Target): Add calls_non_split method. Declare
11606 do_calls_non_split virtual method. Declare match_view and
11608 * target.cc: Include "elfcpp.h".
11609 (Target::do_calls_non_split): New function.
11610 (Target::match_view): New function.
11611 (Target::set_view_to_nop): New function.
11612 * gold.cc (queue_middle_tasks): Give an error if mixing
11613 split-stack and non-split-stack objects with -r.
11614 * i386.cc (Target_i386::relocate_section): Add
11615 reloc_symbol_changes parameter.
11616 (Target_i386::do_calls_non_split): New function.
11617 * x86_64.cc (Target_x86_64::relocate_section): Add
11618 reloc_symbol_changes parameter.
11619 (Target_x86_64::do_calls_non_split): New function.
11620 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11622 * powerpc.cc (Target_powerpc::relocate_section): Add
11623 reloc_symbol_changes parameter.
11624 * sparc.cc (Target_sparc::relocate_section): Add
11625 reloc_symbol_changes parameter.
11626 * configure.ac: Call AM_CONDITIONAL for the default target.
11627 * configure: Rebuild.
11628 * testsuite/Makefile.am (TEST_AS): New variable.
11629 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11630 (check_DATA): Add split_i386 and split_x86_64 files.
11631 (SPLIT_DEFSYMS): Define.
11632 (split_i386_[1234n].o): New targets.
11633 (split_i386_[124]): New targets.
11634 (split_i386_[1234r].stdout): New targets.
11635 (split_x86_64_[1234n].o): New targets.
11636 (split_x86_64_[124]): New targets.
11637 (split_x86_64_[1234r].stdout): New targets.
11638 (MOSTLYCLEANFILES): Add new executables.
11639 * testsuite/split_i386.sh: New file.
11640 * testsuite/split_x86_64.sh: New file.
11641 * testsuite/split_i386_1.s: New file.
11642 * testsuite/split_i386_2.s: New file.
11643 * testsuite/split_i386_3.s: New file.
11644 * testsuite/split_i386_4.s: New file.
11645 * testsuite/split_i386_n.s: New file.
11646 * testsuite/split_x86_64_1.s: New file.
11647 * testsuite/split_x86_64_2.s: New file.
11648 * testsuite/split_x86_64_3.s: New file.
11649 * testsuite/split_x86_64_4.s: New file.
11650 * testsuite/split_x86_64_n.s: New file.
11651 * testsuite/testfile.cc (Target_test): Update relocation_section
11653 * testsuite/Makefile.in: Rebuild.
11655 2009-10-06 Ian Lance Taylor <iant@google.com>
11657 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11658 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11659 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11660 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11661 the address on ldo_addrs_.
11662 (Target_i386::Relocate::fix_up_ldo): New function.
11664 2009-10-06 Rafael Espindola <espindola@google.com>
11666 * plugin.cc (add_input_library): New.
11667 (Plugin::load): Add add_input_library to tv.
11668 (Plugin_manager::add_input_file): Add the is_lib argument.
11669 (add_input_file): Update call to Plugin_manager::add_input_file.
11670 (add_input_library): New.
11671 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11673 2009-09-30 Doug Kwan <dougkwan@google.com>
11675 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11676 symbol and call Symbol::may_need_copy_reloc to determine if
11677 a copy reloc is needed.
11678 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11679 nocopyreloc is given in command line.
11680 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11681 given in command line.
11682 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11683 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11684 of the removed Target_i386::may_need_copy_reloc.
11685 * options.h (copyreloc): New option with default value false.
11686 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11687 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11688 instead of the removed Target_powerpc::may_need_copy_reloc.
11689 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11690 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11691 instead of the removed Target_sparc::may_need_copy_reloc.
11692 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11693 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11694 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11695 instead of the removed Target_x86_64::may_need_copy_reloc.
11697 2009-09-30 Ian Lance Taylor <iant@google.com>
11699 * object.h (class Object): Remove target_ field, and target,
11700 sized_target, and set_target methods.
11701 (Object::sized_target): Remove.
11702 (class Sized_relobj): Update declarations. Remove sized_target.
11703 * object.cc (Sized_relobj::setup): Remove target parameter.
11704 Change all callers.
11705 (Input_objects::add_object): Don't do anything with the target.
11706 (make_elf_sized_object): Add punconfigured parameter. Change all
11707 callers. Set or test parameter target.
11708 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11709 Change all callers.
11710 * parameters.cc (Parameters::set_target): Change parameter type to
11712 (Parameters::default_target): Remove.
11713 (set_parameters_target): Change parameter type to be non-const.
11714 (parameters_force_valid_target): New function.
11715 (parameters_clear_target): New function.
11716 * parameters.h (class Parameters): Update declarations. Remove
11717 default_target method. Add sized_target and clear_target
11718 methods. Change target_ to be non-const.
11719 (set_parameters_target): Update declaration.
11720 (parameters_force_valid_target): Declare.
11721 (parameters_clear_target): Declare.
11722 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11723 as NULL if we aren't searching.
11724 (Add_symbols::run): Don't check for compatible target.
11725 * fileread.cc (Input_file::open_binary): Call
11726 parameters_force_valid_target.
11727 * gold.cc (queue_middle_tasks): Likewise.
11728 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11729 set_target on object.
11730 * dynobj.h (class Sized_dynobj): Update declarations.
11731 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11732 make_elf_object returns NULL.
11733 (Archive::include_member): Don't check whether object target is
11735 * output.cc (Output_section::add_input_section): Get target from
11737 (Output_section::relax_input_section): Likewise.
11738 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11740 (Sized_relobj::do_scan_relocs): Likewise.
11741 (Sized_relobj::relocate_sections): Likewise.
11742 * resolve.cc (Symbol_table::resolve): Likewise.
11743 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11744 parameter. Change all callers.
11745 (Symbol_table::add_from_object): Get target from parameters.
11746 (Symbol_table::add_from_relobj): Don't check object target.
11747 (Symbol_table::add_from_dynobj): Likewise.
11748 (Symbol_table::define_special_symbol): Get target from
11750 * symtab.h (class Symbol_table): Update declaration.
11751 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11752 parameter. Change all callers. Clear parameter target.
11753 (Binary_test): Test target here.
11754 * testsuite/object_unittest.cc (gold_testsuite): Remove
11755 target_test_pointer parameter. Change all callers.
11756 (Object_test): Test target here.
11758 2009-09-26 Ian Lance Taylor <iant@google.com>
11760 * testsuite/initpri1.c: Don't try to use constructor priorities if
11761 compiling with gcc before 4.3.
11763 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11765 * testsuite/retain_symbols_file_test.sh (check_present): Change
11766 output file name to retain_symbols_file_test.stdout.
11767 (check_absent): Likewise.
11769 2009-09-18 Craig Silverstein <csilvers@google.com>
11771 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11772 * options.cc: Include <cerrno> and <fstream>.
11773 (General_options::finalize): Parse -retain-symbols-file tag.
11774 * options.h: New flag.
11775 (General_options): New method should_retain_symbol, new
11776 variable symbols_to_retain.
11777 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11778 should_retain_symbol map.
11779 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11780 * testsuite/Makefile.in: Regenerate.
11781 * testsuite/retain_symbols_file_test.sh: New file.
11783 2009-09-18 Nick Clifton <nickc@redhat.com>
11785 * po/es.po: Updated Spanish translation.
11787 2009-09-17 Doug Kwan <dougkwan@google.com>
11789 * debug.h (DEBUG_RELAXATION): New constant.
11790 (DEBUG_ALL): Add DEBUG_RELAXATION.
11791 (debug_string_to_enum): Add relaxation debug option.
11793 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11794 Layout::Relaxation_debug_check::read_sections,
11795 Layout::Relaxation_debug_check::read_sections): New method definitions.
11796 (Layout::Layout): Initialize data members
11797 record_output_section_data_from_scrips_,
11798 script_output_section_data_list_ and relaxation_debug_check_.
11799 (Layout::save_segments, Layout::restore_segments,
11800 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11801 Layout::relaxation_loop_body): New method definitions.
11802 (Layout::finalize): Support relaxation. Move section layout code to
11803 Layout::relaxation_loop_body.
11804 (Layout::set_asection_address_from_script): Move code for orphan
11805 section placement out.
11806 (Layout::place_orphan_sections_in_script): New method definition.
11807 * layout.h (Output_segment_headers, Output_file_header):
11808 New forward class declarations.
11809 (Layout::~Layout): Define.
11810 (Layout::new_output_section_data_from_script): New method definition.
11811 (Layout::place_orphan_sections_in_script): New method declaration.
11812 (Layout::Segment_states): New type declaration.
11813 (Layout::save_segments, Layout::restore_segments,
11814 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11815 Layout::relaxation_loop_body): New method declarations.
11816 (Layout::Output_section_data_list): New type declaration.
11817 (Layout::Relaxation_debug_check): New class definition.
11818 (Layout::record_output_section_data_from_script_,
11819 Layout::script_output_section_data_list_, Layout::segment_states_,
11820 Layout::relaxation_debug_check_): New data members.
11821 * output.cc: (Output_section_headers::do_size): New method definition.
11822 (Output_section_headers::Output_section_headers): Move size
11823 computation to Output_section_headers::do_size.
11824 (Output_segment_headers::do_size): New method definition.
11825 (Output_file_header::Output_file_header): Move size computation to
11826 Output_file_header::do_size and call it.
11827 (Output_file_header::do_size): New method definition.
11828 (Output_data_group::Output_data_group): Adjust call to
11829 Output_section_data.
11830 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11831 (Output_symtab_xindex::do_write): Add array bound check.
11832 (Output_section::Input_section::print_to_mapfile): Handle
11833 RELAXED_INPUT_SECTION_CODE.
11834 (Output_section::Output_section): Initialize data member checkpoint_.
11835 (Output_section::~Output_section): Delete checkpoint object pointed
11837 (Output_section::add_input_section): Always add an Input_section if
11839 (Output_section::add_merge_input_section): Add assert.
11840 (Output_section::relax_input_section): New method definition.
11841 (Output_section::set_final_data_size): Set load address to zero for
11842 an unallocated section.
11843 (Output_section::do_address_and_file_offset_have_reset_values):
11844 New method definition.
11845 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11846 Handle relaxed input section.
11847 (Output_section::sort_attached_input_sections): Checkpoint input
11848 section list lazily.
11849 (Output_section::get_input_sections): Change type of input_sections to
11850 list of Simple_input_section pointers. Checkpoint input section list
11851 lazily. Also handle relaxed input sections.
11852 (Output_section::add_input_section_for_script): Take a reference to
11853 a Simple_input_section object instead of Relobj pointer and section
11854 index as parameter. Handle relaxed input sections.
11855 (Output_section::save_states, Output_section::restore_states): New
11856 method definitions.
11857 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11858 (Output_data::is_data_size_fixed): New method definition.
11859 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11861 (Output_data::address_and_file_offset_have_reset_values): New method
11863 (Output_data::do_address_and_file_offset_have_reset_values): New method
11865 (Output_data::set_data_size): Check that data size is not fixed.
11866 (Output_data::fix_data_size): New method definition.
11867 (Output_data::is_data_size_fixed_): New data member.
11868 (Output_section_headers::set_final_data_size): New method definition.
11869 (Output_section_headers::do_size): New method declaration.
11870 (Output_segment_headers::set_final_data_size): New method definition.
11871 (Output_segment_headers::do_size): New method declaration.
11872 (Output_file_header::set_final_data_size)::New method definition.
11873 (Output_file_header::do_size)::New method declaration.
11874 (Output_section_data::Output_section_data): Add new parameter
11875 is_data_size_fixed and use it to fix data size.
11876 (Output_data_const::Output_data_const): Adjust call to base class
11877 constructor and fix data size.
11878 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11879 base class constructor and fix data size.
11880 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11881 base class constructor and fix data size.
11882 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11883 class constructor and fix data size.
11884 (Output_data_group::set_final_data_size): New method definition.
11885 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11886 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11887 class constructor and fix data size.
11888 (Output_relaxed_input_section): New class definition.
11889 (Output_section::Simple_input_section): New class definition.
11890 (Output_section::get_input_sections): Adjust parameter list.
11891 (Output_section::add_input_section_for_script): Same.
11892 (Output_section::save_states, Output_section::restore_states,
11893 Output_section::do_address_and_file_offset_have_reset_values,
11894 (Output_section::Input_section::Input_section): Handle
11895 RELAXED_INPUT_SECTION_CODE. Add new overload for
11896 Output_relaxed_input_section.
11897 (Output_section::Input_section::is_input_section,
11898 Output_section::Input_section::set_output_section): Handle relaxed
11900 (Output_section::Input_section::is_relaxed_input_section,
11901 Output_section::Input_section::output_section_data,
11902 Output_section::Input_section::relaxed_input_section): New method
11904 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11906 (Output_section::Input_section::u1_): Update comments.
11907 (Output_section::Input_section::u2_): Add new union member poris.
11908 (Output_section::Checkpoint_output_section): New classs definition.
11909 (Output_section::relax_input_section): New method declaration.
11910 (Output_section::checkpoint_): New data member.
11911 (Output_segment): Update comments.
11912 (Output_segment::Output_segment): Un-privatize copy constructor.
11913 (Output_segment::operator=): Un-privatize.
11914 * script-sections.cc (Output_section_element::Input_section_list):
11915 Change element type to Output_section::Simple_input_section.
11916 (Output_section_element_dot_assignment::set_section_addresses):
11917 Register output section data for relaxation clean up.
11918 (Output_data_exression::Output_data_expression): Adjust call to base
11919 constructor to fix data size.
11920 (Output_section_element_data::set_section_addresses): Register
11921 Output_data_expression object for relaxation clean up.
11922 (struct Input_section_info): Replace Relobj pointer and section index
11923 pair with Output_section::Simple_input_section and Convert struct to a
11925 (Input_section_sorter::operator()): Adjust access to
11926 Input_section_info data member to use accessors.
11927 (Output_section_element_input::set_section_addresses): Use layout
11928 parameter. Adjust code to use Output_section::Simple_input_section
11929 and Input_secction_info classes. Register filler for relaxation
11931 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11932 and section index pair with Output_section::Simple_input_section
11933 class. Adjust code accordingly.
11934 (Phdrs_element::release_segment): New method definition.
11935 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11937 (Script_sections::release_segments): New method definition.
11938 * gold/script-sections.h (Script_sections::release_segments): New
11939 method declaration.
11940 * gold/target.h (Target::may_relax, Target::relax,
11941 Target::do_may_relax, Target::do_relax): New method definitions.
11943 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11945 * arm.cc (has_signed_unsigned_overflow): New function.
11946 (Arm_relocate_functions::abs8): New function.
11947 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11948 (Target_arm::Scan::global): Likewise.
11949 (Target_arm::relocate::relocate): Likewise.
11950 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11953 2009-09-16 Cary Coutant <ccoutant@google.com>
11955 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11956 * testsuite/Makefile.in: Regenerate.
11958 2009-09-11 Nick Clifton <nickc@redhat.com>
11960 * po/gold.pot: Updated by the Translation project.
11962 2009-09-08 Cary Coutant <ccoutant@google.com>
11964 * output.cc (Output_file::open): Add execute permission to empty file.
11965 * testsuite/Makefile.am (permission_test): New test.
11966 * testsuite/Makefile.in: Regenerate.
11968 2009-09-02 Ian Lance Taylor <iant@google.com>
11970 * output.cc (Output_file::resize): Call map_no_anonymous rather
11973 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11975 * gold.cc: Include "incremental.h".
11976 (queue_initial_tasks): Call Incremental_checker methods.
11977 * incremental.cc: Include "output.h".
11978 (Incremental_checker::can_incrementally_link_output_file): New
11980 * incremental.h (Incremental_checker): New class.
11982 * output.cc (Output_file::open_for_modification): New method.
11983 (Output_file::map_anonymous): Changed return type to bool. Record
11984 map in base_ field.
11985 (Output_file::map_no_anonymous): New method, broken out of map.
11986 (Output_file::map): Use map_no_anonymous and map_anonymous.
11987 * output.h (class Output_file): Update declarations.
11989 2009-08-24 Cary Coutant <ccoutant@google.com>
11991 * options.h (Command_line::Pre_options): New class.
11992 (Command_line::pre_options): New member.
11993 * options.cc (gold::options::ready_to_register): New variable.
11994 (One_option::register_option): Do nothing if not registering options.
11995 Assert if same short option registered twice.
11996 (General_options::General_options): Turn off option registration when
11998 (Command_line::Pre_options::Pre_options): New constructor.
12000 2009-08-24 Cary Coutant <ccoutant@google.com>
12002 * options.h (General_options::no_keep_memory): Remove incorrect
12005 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12007 * Makefile.am (am__skiplex, am__skipyacc): New.
12008 * Makefile.in: Regenerate.
12010 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12012 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12013 (INCLUDES): ... this.
12014 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12015 (AM_CPPFLAGS): Renamed from ...
12016 (INCLUDE): ... this.
12017 * Makefile.in, testsuite/Makefile.in: Regenerate.
12019 * Makefile.in: Regenerate.
12020 * aclocal.m4: Likewise.
12021 * config.in: Likewise.
12022 * configure: Likewise.
12023 * testsuite/Makefile.in: Likewise.
12025 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12026 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12027 * Makefile.in: Regenerate.
12028 * testsuite/Makefile.in: Regenerate.
12030 2009-08-19 Cary Coutant <ccoutant@google.com>
12032 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12033 symbols in shared libraries overridden by hidden or internal symbols
12034 in the main program.
12036 2009-08-19 Chris Demetriou <cgd@google.com>
12038 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12039 checking source file names in error messages.
12041 2009-08-18 Doug Kwan <dougkwan@google.com>
12043 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12044 an elcpp::Ehdr as parameter. Adjust call to set_target.
12045 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12046 an elfcpp::Ehdr as parameter.
12047 * object.cc (Object::set_target): Remove the version that looks up
12048 a target and sets it.
12049 (Sized_relobj::setup): Take a Target object instead of
12050 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12051 (make_elf_sized_object): Find target and ask target to
12052 make an ELF object.
12053 * object.h: (Object::set_target): Remove the version that looks up
12054 a target and sets it.
12055 (Sized_relobj::setup): Take a Target object instead of
12056 an elfcpp:Ehdr as parameter.
12057 * target.cc: Include dynobj.h.
12058 (Target::do_make_elf_object_implementation): New.
12059 (Target::do_make_elf_object): New.
12060 * target.h (Target::make_elf_object): New template declaration.
12061 (Target::do_make_elf_object): New method declarations.
12062 (Target::do_make_elf_object_implementation): New template declaration.
12064 2009-08-14 Ian Lance Taylor <iant@google.com>
12066 * gold.h (FUNCTION_NAME): Define.
12067 (gold_unreachable): Use FUNCTION_NAME.
12069 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12071 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12072 symbol in the --keep-unique list is not found.
12074 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12076 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12077 been maked as --keep-unique.
12078 (Icf::unfold_section): New function.
12079 * icf.h (Icf::unfold_section): New function.
12080 * options.h (General_options::keep_unique): New option.
12081 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12082 * testsuite/Makefile.in: Regenerate.
12083 * testsuite/icf_keep_unique_test.sh: New file.
12084 * testsuite/icf_keep_unique_test.cc: New file.
12086 2009-08-12 Cary Coutant <ccoutant@google.com>
12089 * resolve.cc (Symbol_table::resolve): Check for references from
12090 dynamic objects to hidden and internal symbols.
12091 * testsuite/Makefile.am (hidden_test.sh): New test.
12092 * testsuite/Makefile.in: Regenerate.
12093 * testsuite/hidden_test.sh: New script.
12094 * testsuite/hidden_test_1.c: New test source.
12095 * testsuite/hidden_test_main.c: New test source.
12097 2009-08-11 Doug Kwan <dougkwan@google.com>
12099 * arm.cc: Update comments.
12100 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12101 segment to locate the .ARM.exidx section if present.
12103 2009-08-09 Doug Kwan <dougkwan@google.com>
12105 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12108 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12109 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12112 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12114 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12115 valid tls_segment only for non-debug-section relocations.
12116 * testsuite/Makefile.am: Add gc_tls_test.
12117 * testsuite/Makefile.in: Regenerate.
12118 * testsuite/gc_tls_test.cc: New file.
12119 * testsuite/gc_tls_test.sh: New file.
12121 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12123 * icf.cc: New file.
12125 * Makefile.am (CCFILES): Add icf.cc.
12126 (HFILES): Add icf.h
12127 * Makefile.in: Regenerate.
12128 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12129 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12130 section, symbol and addend information for the relocs.
12131 * gold.cc (queue_middle_tasks): Call identical code folding.
12132 * gold.h: Add defines for multimap.
12133 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12134 to the call of finalize_local_symbols.
12135 * main.cc (main): Create object of class Icf.
12136 * object.cc (Sized_relobj::do_layout): Allow this function to be
12137 called twice during icf.
12138 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12139 to sections marked as identical by icf.
12140 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12142 (Sized_relobj::do_section_entsize): New function.
12143 * object.h (Object::section_entsize): New function.
12144 (Object::do_section_entsize): New pure virtual function.
12145 (Relobj::finalize_local_symbols): Add new parameter.
12146 (Relobj::do_section_entsize): New function.
12147 * options.h (General_options::icf): New option.
12148 (General_options::icf_iterations): New option.
12149 (General_options::print_icf_sections): New option.
12150 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12151 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12152 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12154 * symtab.cc (Symbol_table::is_section_folded): New function.
12155 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12156 to sections marked as identical by icf.
12157 * symtab.h (Symbol_table::set_icf): New function.
12158 (Symbol_table::icf): New function.
12159 (Symbol_table::is_section_folded): New function.
12160 (Symbol_table::icf_): New data member.
12161 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12162 * testsuite/Makefile.am: Add commands to build icf_test.
12163 * testsuite/Makefile.in: Regenerate.
12164 * testsuite/icf_test.sh: New file.
12165 * testsuite/icf_test.cc: New file.
12167 2009-07-24 Chris Demetriou <cgd@google.com>
12169 * layout.cc (is_compressible_debug_section): Fix incorrect
12170 comment about compressed section names.
12172 2009-07-20 Ian Lance Taylor <ian@airs.com>
12175 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12177 2009-07-16 Ian Lance Taylor <iant@google.com>
12180 * layout.h: #include <map>.
12181 (class Kept_section): Change from struct to class. Add accessors
12182 and setters. Add section size to Comdat_group mapping. Change
12183 Comdat_group to std::map. Add is_comdat_ field. Add
12184 linkonce_size field in union.
12185 (class Layout): Update declaration of find_or_add_kept_section.
12186 Don't declare find_kept_object.
12187 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12188 parameter. Add object, shndx, is_comdat, and is_group_name
12189 parameters. Change all callers. Adjust for new Kept_section.
12190 (Layout::find_kept_object): Remove.
12191 * object.cc (Sized_relobj::include_section_group): Update use of
12192 Kept_section. Rename secnum to shndx. Only record
12193 Kept_comdat_section if sections are the same size.
12194 (Sized_relobj::include_linkonce_section): Update use of
12195 Kept_section. Only record Kept_comdat_section if sections are the
12196 same size. Set size of linkonce section.
12197 (Sized_relobj::map_to_kept_section): Update call to
12198 get_kept_comdat_section.
12199 * object.h (class Sized_relobj): Rename fields in
12200 Kept_comdat_section to drop trailing underscores; change object
12201 field to Relobj*. Change Kept_comdat_section_table to store
12202 struct rather than pointer.
12203 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12204 Add kept_object and kept_shndx parameters. Change all callers.
12205 (Sized_relobj::get_kept_comdat_section): Change return type to
12206 bool. Add kept_object and kept_shndx parameters. Change all
12208 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12209 Layout::find_or_add_kept_section.
12211 2009-07-09 Ian Lance Taylor <iant@google.com>
12213 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12214 Reserve space in the hash table.
12216 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12218 * fileread.cc (File_read::get_mtime): New method.
12219 * fileread.h (Timespec): New structure.
12220 (File_read::get_mtime): New method.
12221 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12222 Renamed from timestamp_nsec.
12223 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12225 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12227 (Incremental_inputs::report_archive): Save mtime; style fix.
12228 (Incremental_inputs::report_obejct): Save mtime; style fix.
12229 (Incremental_inputs::report_script): Save mtime; style fix.
12230 (Incremental_inputs::finalize_inputs): Style fix.
12231 (Incremental_inputs::finalize): Style fix.
12232 (Incremental_inputs::create_input_section_data): Store inputs
12234 * incremental.h (Incremental_inputs::report_script): Add mtime
12236 (Incremental_inputs::Input_info::Input_info): Intialize only one
12238 (Incremental_inputs::Input_info::archive): Move to nameless
12240 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12241 (Incremental_inputs::Input_info::script): Move to nameless union.
12242 (Incremental_inputs::mtime): New field.
12243 * script.cc (read_input_script): Pass file mtime to
12245 * script.h (Script_info::inputs): Style fix.
12247 2009-07-01 Ian Lance Taylor <ian@airs.com>
12249 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12252 2009-06-24 Ian Lance Taylor <iant@google.com>
12255 * layout.cc (Layout::choose_output_section): If we find an
12256 existing section, update the flags.
12257 (Layout::create_notes): New function, broken out of
12259 (Layout::finalize): Don't create note sections.
12260 (Layout::create_note): Don't crash if linker script discards
12262 (Layout::create_gold_note): Likewise.
12263 (Layout::create_build_id): Likewise. Don't set
12264 after_input_sections on the section.
12265 (Layout::create_executable_stack_info): Remove target parameter.
12267 * layout.h (class Layout): Declare create_notes. Update
12268 declaration of create_executable_stack_info.
12269 * gold.cc (queue_middle_tasks): Call create_notes.
12270 * output.cc (Output_section::update_flags_for_input_section): Move
12271 here from output.h. If SHF_ALLOC flag is newly set, mark address
12273 * output.h (Output_data::mark_address_invalid): New function.
12274 (class Output_section): Only declare, not define,
12275 update_flags_for_input_section. Remove set_flags.
12277 2009-06-24 Ian Lance Taylor <iant@google.com>
12279 * script-sections.cc (Output_section_definition::
12280 set_section_addresses): Rename shadowing local load_address to
12283 2009-06-24 Ian Lance Taylor <iant@google.com>
12286 * reloc.cc (relocate_sections): Skip empty relocation sections.
12288 2009-06-23 Ian Lance Taylor <iant@google.com>
12291 * layout.cc (Layout::create_note): Use choose_output_section
12292 rather than make_output_section.
12294 2009-06-23 Ian Lance Taylor <iant@google.com>
12297 * options.cc (General_options::parse_V): Set printed_version_.
12298 (General_options::General_options): Initialize printed_version_.
12299 * options.h (class General_options): Add printed_version_ field.
12300 * gold.cc (queue_initial_tasks): If there are no input files,
12301 don't give a fatal error if we printed the version information.
12302 (queue_middle_tasks): If using -r with a shared object, give a
12303 fatal error rather than an ordinary error.
12305 2009-06-23 Ian Lance Taylor <iant@google.com>
12308 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12309 (Layout::make_output_section): Set have_stabstr_section_ if we see
12310 a .stab*str section.
12311 (Layout::finalize): Call link_stabs_sections.
12312 (Layout::link_stabs_sections): New file.
12313 * layout.h (class Layout): Add have_stabstr_section_ field.
12314 Declare link_stabs_sections.
12316 2009-06-23 Doug Kwan <dougkwan@google.com>
12318 * Makefile.am (libgold_a_LIBADD): New.
12319 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12320 * Makefile.in: Regenerate.
12321 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12322 * configure: Regenerate.
12323 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12324 * fileread.cc: Include sys/state.h
12325 * gold.h: Declare memmem and strndup if found missing.
12326 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12328 2009-06-23 Ian Lance Taylor <iant@google.com>
12330 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12331 * configure: Rebuild.
12333 2009-06-23 Ian Lance Taylor <iant@google.com>
12336 * object.cc (Object::section_contents): Don't try to get a view if
12337 the section has length zero.
12338 (Object::handle_gnu_warning_section): If the section is empty, use
12339 the name of the section as the warning.
12341 2009-06-23 Ian Lance Taylor <iant@google.com>
12344 * stringpool.h (class Stringpool_template): Add optimize_ field.
12345 (Stringpool_template::set_optimize): New function.
12346 * stringpool.cc (Stringpool_template::Stringpool_template):
12347 Initialize optimize_ field.
12348 (Stringpool_template::set_string_offsets): Test local optimize
12349 fild rather than parameter.
12350 * layout.cc (Layout::Layout): Call set_optimize on the section
12353 2009-06-22 Ian Lance Taylor <iant@google.com>
12356 * yyscript.y: Parse TARGET.
12357 * script.cc (script_set_target): New function.
12358 * script-c.h (script_set_target): Declare.
12359 * options.cc (General_options::string_to_object_format): Rename
12360 from string_to_object_format in anonymous namespace. Change
12362 * options.h (class General_options): Declare
12363 string_to_object_format.
12365 2009-06-22 Ian Lance Taylor <iant@google.com>
12367 * script-sections.cc (Script_sections::create_segments): Don't put
12368 program headers in a PT_LOAD segment if -n or -N.
12370 2009-06-22 Ian Lance Taylor <iant@google.com>
12373 * options.h (class General_options): Add -z lazy and -z now. Sort
12374 -z options into alphabetical order.
12375 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12377 2009-06-21 Ian Lance Taylor <iant@google.com>
12379 * layout.cc (Layout::make_output_section): Call
12380 Target::new_output_section.
12381 (Layout::attach_allocated_section_to_segment): Put large section
12382 sections in a separate load segment with the large segment flag
12384 (Layout::segment_precedes): Sort large data segments after other
12386 (align_file_offset): New static function.
12387 (Layout::set_segment_offsets): Use align_file_offset.
12388 * output.h (class Output_section): Add is_small_section_ and
12389 is_large_section_ fields.
12390 (Output_section::is_small_section): New function.
12391 (Output_section::set_is_small_section): New function.
12392 (Output_section::is_large_section): New function.
12393 (Output_section::set_is_large_section): New function.
12394 (Output_section::is_large_data_section): New function.
12395 (class Output_segment): Add is_large_data_segment_ field.
12396 (Output_segment::is_large_data_segment): New function.
12397 (Output_segment::set_is_large_data_segment): New function.
12398 * output.cc (Output_section::Output_section): Initialize new
12400 (Output_segment::Output_segment): Likewise.
12401 (Output_segment::add_output_section): Add assertion that large
12402 data sections always go in large data segments. Force small data
12403 sections to the end of the list of data sections. Force small BSS
12404 sections to the start of the list of BSS sections. For large BSS
12405 sections to the end of the list of BSS sections.
12406 * symtab.h (class Symbol): Declare is_common_shndx.
12407 (Symbol::is_defined): Check Symbol::is_common_shndx.
12408 (Symbol::is_common): Likewise.
12409 (class Symbol_table): Define enum Commons_section_type. Update
12410 declarations. Add small_commons_ and large_commons_ fields.
12411 * symtab.cc (Symbol::is_common_shndx): New function.
12412 (Symbol_table::Symbol_table): Initialize new fields.
12413 (Symbol_table::add_from_object): Put small and large common
12414 symbols in the right list.
12415 (Symbol_table::sized_finalized_symbol): Check
12416 Symbol::is_common_shndx.
12417 (Symbol_table::sized_write_globals): Likewise.
12418 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12419 common symbol lists. Don't call do_allocate_commons_list if the
12421 (Symbol_table::do_allocate_commons_list): Remove is_tls
12422 parameter. Add comons_section_type parameter. Change all
12423 callers. Handle small and large common symbols.
12424 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12425 Symbol::is_common_shndx.
12426 * resolve.cc (symbol_to_bits): Likewise.
12427 * target.h (Target::small_common_shndx): New function.
12428 (Target::small_common_section_flags): New function.
12429 (Target::large_common_shndx): New function.
12430 (Target::large_common_section_flags): New function.
12431 (Target::new_output_section): New function.
12432 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12433 small_common_section_flags, and large_common_section_flags
12435 (Target::do_new_output_section): New virtual function.
12436 * arm.cc (Target_arm::arm_info): Initialize new fields.
12437 * i386.cc (Target_i386::i386_info): Likewise.
12438 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12440 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12441 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12442 (Target_x86_64::do_new_output_section): New function.
12443 * configure.ac: Define conditional MCMODEL_MEDIUM.
12444 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12445 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12446 (large_LDFLAGS): Define.
12447 * testsuite/large.c: New file.
12448 * testsuite/testfile.cc (Target_test::test_target_info):
12449 Initialize new fields.
12450 * configure, testsuite/Makefile.in: Rebuild.
12452 2009-06-05 Doug Kwan <dougkwan@google.com>
12454 * Makefile.am (CCFILES): Add target.cc.
12455 * Makefile.in: Regenerate.
12456 * i386.cc (class Target_i386): Define new virtual method to
12457 override do_is_local_label_name in parent.
12458 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12459 local symbols if --discard-locals or -X is given.
12460 * options.h (class General_options): Declare new options
12461 '--discard-locals' and '-X' for discarding locals.
12462 * target.h (class Target): Define new methods is_local_label_name.
12463 Declare new virtual method do_is_local_label_name.
12464 * target.cc: New file.
12465 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12466 (check_SCRIPTS): Add discard_locals_test.sh.
12467 (check_DATA): Add discard_local_tests.syms.
12468 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12469 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12470 * testsuite/Makefile.in: Regenerate.
12471 * testsuite/discard_locals_test.c: New file.
12472 * testsuite/discard_locals_test.sh: Same.
12474 2009-06-05 Doug Kwan <dougkwan@google.com>
12476 * object.cc (Sized_relobj::Sized_relobj): Initialize
12477 discarded_eh_frame_shndx_ to -1U.
12478 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12480 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12481 a discarded .eh_frame section.
12482 (Sized_relobj::do_finalize_local_symbols): Ditto.
12483 * object.h (class Sized_relobj): Declare new member
12484 discarded_eh_frame_shndx_.
12485 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12486 (local_labels_test.o, local_labels_test): New rules.
12487 * testsuite/Makefile.in: Regenerate.
12489 2009-06-04 Doug Kwan <dougkwan@google.com>
12491 * layout.cc (Layout::section_name_mapping): Add mapping for
12492 special ARM sections.
12494 2009-06-03 Doug Kwan <dougkwan@google.com>
12496 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12497 (utils::has_overflow): Same.
12499 2009-06-03 Ian Lance Taylor <iant@google.com>
12501 * layout.cc (Layout::section_name_mapping): New array, replacing
12502 Layout::linkonce_mapping.
12503 (Layout::section_name_mapping_count): New variable, replacing
12504 Layout::linkonce_mapping_count.
12505 (Layout::linkonce_output_name): Remove.
12506 (Layout::output_section_name): Rewrite.
12507 * layout.h (class Layout): Rename Linkonce_mapping to
12508 Section_name_mapping, linkonce_mapping to section_name_mapping,
12509 linkonce_mapping_count to section_name_mapping_count. Don't
12510 declare linkonce_output_name.
12512 2009-06-03 Doug Kwan <dougkwan@google.com>
12514 * gold/arm.cc (namespace utils): New.
12515 (Target_arm::reloc_is_non_pic): Define new method.
12516 (class Arm_relocate_functions): New.
12517 (Target_arm::Relocate::relocate): Handle relocation types used by
12520 2009-06-03 Ian Lance Taylor <iant@google.com>
12522 * arm.cc (Target_arm::scan::global): Use || instead of |.
12524 2009-06-02 Doug Kwan <dougkwan@google.com>
12526 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12527 issued_non_pic_error_.
12528 (class Target_arm::Scan): Declare new method check_non_pic.
12529 Define new method symbol_needs_plt_entry.
12530 Declare new data member issued_non_pic_error_.
12531 (class Target_arm::Relocate): Declare new method
12532 should_apply_static_reloc.
12533 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12534 (Target_arm::Scan::check_non_pic): Define new method.
12535 (Target_arm::Scan::local): Handle a small subset of reloc types used
12537 (Target_arm::Scan::local): Same.
12538 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12540 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12542 * incremental.cc (Incremental_inputs::report_command_line): Filter
12543 out --incremental-* options.
12545 2009-05-29 Doug Kwan <dougkwan@google.com>
12547 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12549 (class Target_arm): Update comment.
12550 (Target_arm::Target_arm): Initialize new data members GOT_,
12551 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12552 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12553 and Target_arm::rel_dyn_section.
12554 Declare new_enum Target_arm::Got_type.
12555 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12557 Update commments for member do_dynsym_value.
12558 (Target_arm::got_size, Target_arm::plt_section,
12559 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12560 new methods inside class defintion.
12561 (Target_arm::got_section): Define new method.
12562 (Target_arm::rel_dyn_section): Same.
12563 (Output_data_plt_arm): New template class.
12564 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12565 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12566 (Output_data_plt_arm::add_entry): Same.
12567 (Output_data_plt_arm::first_plt_entry): Define new
12568 static data member for PLT instruction template.
12569 (Output_data_plt_arm::plt_entry): Same.
12570 (Output_data_plt_arm::do_write): Define new method.
12571 (Target_arm::make_plt_entry): Same.
12572 (Target_arm::do_finalize_sections): Same.
12573 (Target_arm::do_dynsym_value): Same.
12575 2009-05-28 Doug Kwan <dougkwan@google.com>
12577 * Makefile.am (TARGETSOURCES): Add arm.cc.
12578 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12579 * Makefile.in: Regenerate.
12580 * arm.cc: New file.
12581 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12583 2009-05-26 Doug Kwan <dougkwan@google.com>
12585 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12586 (General_options::check_excluded_libs): Strip off directories in
12587 archive name before matching like GNU ld does.
12588 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12589 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12590 (exclude_libs_test_LDFLAGS): Add linker option
12591 -Wl,--exclude-libs,libexclude_libs_test_3
12592 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12593 an explicit archive without using -l.
12594 (alt/libexclude_libs_test_3.a): New make rule.
12595 * testsuite/Makefile.in: Regenerate.
12596 * testsuite/exclude_libs_test.c : Declare lib3_default().
12598 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12599 * exclude_libs_test_3.c: New file.
12601 2009-05-26 Nick Clifton <nickc@redhat.com>
12603 * po/id.po: New Indonesian translation.
12604 * po/gold.pot: Updated template file.
12606 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12608 * testsuite/Makefile.am: Add -ffunction-sections to compile
12609 gc_comdat_test files. Add -Wl,--gc-sections to build
12611 * testsuite/Makefile.in: Regenerate.
12612 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12614 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12616 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12617 kept comdat section was garbage collected.
12618 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12619 * testsuite/Makefile.in: Regenerate.
12620 * testsuite/gc_comdat_test.sh: New file.
12621 * testsuite/gc_comdat_test_1.cc: New file.
12622 * testsuite/gc_comdat_test_2.cc: New file.
12624 2009-05-19 Doug Kwan <dougkwan@google.com>
12626 * archive.cc (Archive::Archive): Move constructor from archive.h
12627 to here. Initialize no_export_.
12628 (Archive::get_elf_object_for_member): Set no_export flag of object.
12629 * archive.h (Archive::Archive): Move constructor body to
12631 (Archive::no_export): New method.
12632 (Archive::no_export_): New field.
12633 * object.h (Object::Object): Initialize no_export_ to false.
12634 (Object::no_export, Object::set_no_export): New methods.
12635 (Object::no_export_): New field.
12636 * options.cc (General_options::parse_exclude_libs): New method.
12637 (General_options::check_excluded_libs) Same.
12638 * options.h (exclude_libs): New option.
12639 (General_options::check_excluded_libs): New method declaration.
12640 (General_options::excluded_libs_): New field.
12641 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12642 default or protected visibility if an object has no-export flag set.
12643 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12644 (check_SCRIPTS): Add exclude_libs_test.sh.
12645 (check_DATA): Add exclude_libs_test.syms.
12646 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12647 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12648 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12649 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12650 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12651 libexclude_libs_test_2.a): New rules.
12652 * testsuite/Makefile.in: Regenerate.
12653 * testsuite/exclude_libs_test.c: New file.
12654 * testsuite/exclude_libs_test.sh: Ditto.
12655 * testsuite/exclude_libs_test_1.c: Ditto.
12656 * testsuite/exclude_libs_test_2.c: Ditto.
12658 2009-05-15 Ian Lance Taylor <iant@google.com>
12660 * configure.ac: Check for declarations for cases where libiberty.h
12661 checks HAVE_DECL_xxx.
12662 * configure, config.in: Rebuild.
12664 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12666 * gold.h (Incremental_argument_list): Remove (invalid) forward
12668 * incremental.cc (Incremental_inputs::report_achive): New method.
12669 (Incremental_inputs::report_object): New method.
12670 (Incremental_inputs::report_script): New method.
12671 (Incremental_inputs::finalize_inputs): New method.
12672 (Incremental_inputs::finalize): Call finalize_inputs().
12673 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12674 Create inputs entries.
12675 * incremental.h (Incremental_input_type): New enum.
12676 (Incremental_inputs::Incremental_input): Initialize new fields.
12677 (Incremental_inputs::report_inputs): New method.
12678 (Incremental_inputs::report_achive): New method.
12679 (Incremental_inputs::report_object): New method.
12680 (Incremental_inputs::report_script): New method.
12681 (Incremental_inputs::finalize_inputs): New method.
12682 (Incremental_inputs::Input_info): New struct.
12683 (Incremental_inputs::Input_info_map): New typedef.
12684 (Incremental_inputs::lock_): New field.
12685 (Incremental_inputs::Inputs_): New field.
12686 (Incremental_inputs::Inputs_map): New field.
12687 * main.cc (main): Call Incremental_input::report_inputs.
12688 * options.h (Input_argument_list): Typedef moved from
12690 (Input_file_group::Files): Remove, use ::Input_argument_list.
12691 (Input_file_group::Input_argument_list): Remove, use
12692 ::Input_argument_list.
12693 * plugin.cc (Plugin_manager::add_input_file): Add error in
12695 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12697 * script.cc (read_input_script): Call
12698 Incremental_input::report_script.
12699 * script.h (Script_info): New class.
12701 2009-04-27 Ian Lance Taylor <iant@google.com>
12703 * x86_64.cc (do_adjust_output_section): Set entsize to
12706 2009-04-23 Elliott Hughes <enh@google.com>
12708 * output.cc (Output_file::close): After short writes, continue
12709 writing from the correct offset in the buffer being written.
12711 2009-04-23 Chris Demetriou <cgd@google.com>
12713 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12714 * configure: Regenerate.
12715 * config.in: Regenerate.
12716 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12717 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12719 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12721 * incremental.cc (Incremental_inputs_header_data): Renamed from
12722 Incremental_input_header_data.
12723 (Incremental_inputs_header_data::data_size): New field.
12724 (Incremental_inputs_header_data::put_input_file_count): Renamed
12725 from input_file_count.
12726 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12727 from command_line_offset.
12728 (Incremental_inputs_header_data::put_reserved): Renamed from
12730 (Incremental_inputs_entry_data): Renamed from
12731 Incremental_input_entry_data.
12732 (Incremental_inputs_entry_data::data_size): New field.
12733 (Incremental_inputs::report_command_line): New method.
12734 (Incremental_inputs::finalize): New method.
12735 (Incremental_inputs::create_incremental_inputs_data): New method.
12736 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12737 * incremental.h: New file.
12738 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12739 (Layout::finalize): Create incremental inputs section in
12740 incremental builds.
12741 (Layout::create_incremental_info_sections): New method.
12742 * layout.h (Layout::incremental_inputs): New method.
12743 (Layout::create_incremental_info_sections): New method.
12744 (Layout::incremental_inputs_): New field.
12745 * main.cc (main): Notify Incremental_input of the command line.
12747 2009-04-01 Ian Lance Taylor <iant@google.com>
12748 Mikolaj Zalewski <mikolajz@google.com>
12750 * gold.h (reserve_unordered_map): Define, three versions, one for
12751 each version of Unordered_map.
12752 * layout.cc (Layout::Layout): Remove options parameter. Add
12753 number_of_input_files parameter. Don't initialize options_.
12754 Initialize number_of_input_files_ and resized_signatures_. Move
12755 sections_are_attached_.
12756 (Layout::layout_group): Reserve space for group_signatures_.
12757 (Layout::find_or_add_kept_section): Change name parameter to be a
12758 reference. Resize signatures_ map when it gets large enough.
12759 (Layout::layout_eh_frame): Use parameters->options() instead of
12761 (Layout::make_output_section): Likewise.
12762 (Layout::attach_allocated_section_to_segment): Likewise.
12763 (Layout::finalize, Layout::create_executable_stack): Likewise.
12764 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12765 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12766 * layout.h (class Layout): Update declarations. Remove options_
12767 field. Add number_of_input_files_ and resized_signatures_
12768 fields. Move sections_are_attached_ field.
12769 * main.cc (main): Pass number of input files to Layout
12770 constructor. Don't pass options.
12772 2009-03-30 Ian Lance Taylor <iant@google.com>
12774 * ffsll.c (ffsll): Correct implementation.
12776 2009-03-27 Ian Lance Taylor <iant@google.com>
12778 * ffsll.c: New file.
12779 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12780 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12781 * ftruncate.c (ftruncate): Declare before definition.
12782 * mremap.c (mremap): Likewise.
12783 * pread.c (pread): Likewise.
12784 * configure, Makefile.in, config.in: Rebuild.
12786 * mremap.c: New file.
12787 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12788 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12789 (mremap): Declare if HAVE_MREMAP is not defined.
12790 * configure, Makefile.in, config.in: Rebuild.
12792 2009-03-27 Cary Coutant <ccoutant@google.com>
12794 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12795 position independent.
12796 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12797 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12799 2009-03-24 Cary Coutant <ccoutant@google.com>
12801 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12803 (needs_dynamic_reloc): Likewise.
12805 2009-03-24 Ian Lance Taylor <iant@google.com>
12807 * yyscript.y (file_cmd): Recognize EXTERN.
12808 (extern_name_list, extern_name_list_body): New nonterminals.
12809 * script.cc (script_add_extern): Define.
12810 * script-c.h (script_add_extern): Declare.
12812 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12814 * object.cc (is_elf_object): Define.
12815 * object.h (is_elf_object): Declare.
12816 * archive.cc (Archive::get_elf_object_for_member): Call
12818 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12820 2009-03-24 Elliott Hughes <enh@google.com>
12822 * output.cc (Output_file::map_anonymous): Define.
12823 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12824 try an anonymous one. Report the size if the mmap fails.
12825 * output.h (class Output_file): Declare map_anonymous.
12827 2009-03-24 Ian Lance Taylor <iant@google.com>
12829 * target-select.cc (instantiate_target): Don't acquire the lock if
12830 the instantiated_target_ field has already been set.
12832 2009-03-23 Ian Lance Taylor <iant@google.com>
12834 * gold-threads.h (class Initialize_lock): Define.
12835 * gold-threads.cc (class Initialize_lock_once): Define.
12836 (initialize_lock_control): New static variable.
12837 (initialize_lock_pointer): New static variable.
12838 (initialize_lock_once): New static function.
12839 (Initialize_lock::Initialize_lock): Define.
12840 (Initialize_lock::initialize): Define.
12841 * target-select.h: Include "gold-threads.h".
12842 (class Target_selector): Add lock_ and initialize_lock_ fields.
12843 Don't define instantiate_target, just declare it.
12844 * target-select.cc (Target_selector::Target_selector): Initialize
12846 (Target_selector::instantiate_target): Define.
12847 * descriptors.h: Include "gold-threads.h".
12848 (class Descriptors): Add initialize_lock_ field.
12849 * descriptors.cc (Descriptors::Descriptors): Initialize new
12851 (Descriptors::open): Use initialize_lock_ field
12852 * errors.h (class Errors): Add initialize_lock_ field.
12853 * errors.cc (Errors::Errors): Initialize new field.
12854 (Errors::initialize_lock): Use initialize_lock_ field.
12855 * powerpc.cc (class Target_selector_powerpc): Remove
12856 instantiated_target_ field. In do_recognize call
12857 instantiate_target rather than do_instantiate_target. In
12858 do_instantiate_target just allocate a new target.
12859 * sparc.cc (class Target_selector_sparc): Likewise.
12861 * freebsd.h: New file.
12862 * i386.cc: Include "freebsd.h".
12863 (Target_i386): Derive from Target_freebsd rather than
12865 (Target_selector_i386): Derive from Target_selector_freebsd rather
12866 than Target_selector.
12867 * x86_64.cc: Include "freebsd.h".
12868 (Target_x86_64): Derive from Target_freebsd rather than
12870 (Target_selector_x86_64): Derive from Target_selector_freebsd
12871 rather than Target_selector.
12872 * target.h (class Target): Add adjust_elf_header and
12873 do_adjust_elf_header.
12874 * output.cc (Output_file_header:: do_sized_write): Call target
12875 adjust_elf_header routine.
12876 * configure.tgt: Set targ_osabi.
12877 * configure.ac: Define GOLD_DEFAULT_OSABI.
12878 * parameters.cc (Parameters::default_target): Pass
12879 GOLD_DEFAULT_OSABI to select_target.
12880 * target-select.h (class Target_selector): Make instantiate_target
12881 protected rather than private.
12882 * Makefile.am (HFILES): Add freebsd.h.
12883 * configure, Makefile.in, config.in: Rebuild.
12885 * merge.cc (do_add_input_section): Correct pend value. Change
12886 message about last entry not being null terminated from error to
12889 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12891 * incremental.cc: New file.
12892 * Makefile.am (CCFILES): Add incremental.cc.
12893 * Makefile.in: Rebuild.
12895 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12897 * layout.cc (Layout::output_section_name): Preserve names
12898 of '.note.' sections.
12900 2009-03-19 Ian Lance Taylor <iant@google.com>
12902 * descriptors.cc (Descriptors::open): Check that the options are
12903 valid before using them.
12905 2009-03-18 Ian Lance Taylor <iant@google.com>
12907 * script-sections.h: Include <list>.
12908 (class Script_sections): Change Sections_elements from std::vector
12909 to std::list. Typedef public Elements_iterator. Add
12910 orphan_section_placement_, data_segment_align_start_, and
12911 saw_data_segment_align_ fields. Remove data_segment_align_index_
12913 * script-sections.cc (class Orphan_section_placement): New class.
12914 (class Sections_element): Add virtual functions is_relro and
12915 orphan_section_init. Remove virtual function place_orphan_here.
12916 (class Output_section_definition): Add is_relro and
12917 orphan_section_init. Remove place_orphan_here.
12918 (class Orphan_output_section): Likewise.
12919 (Script_sections::Script_sections): Update for field changes.
12920 (Script_sections::data_segment_align): Set saw_data_segment_align_
12921 and data_segment_align_start_, not data_segment_align_index.
12922 (Script_sections::data_segment_relro_end): Check
12923 saw_data_segment_align_. Use data_segment_align_start_ rather
12924 than data_segment_align_index_.
12925 (Script_sections::place_orphan): Rewrite to use
12926 Orphan_section_placement.
12928 2009-03-17 Ian Lance Taylor <iant@google.com>
12930 * archive.cc (Archive::add_symbols): Check for a version attached
12931 to the symbol name in the archive map.
12932 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12933 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12934 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12935 (ver_test_11.a): New target.
12936 * testsuite/Makefile.in: Rebuild.
12938 * configure.ac: Check for chsize and posix_fallocate. Replace
12940 * ftruncate.c: New file, from gnulib.
12941 * output.cc (posix_fallocate): Define dummy version if not
12942 HAVE_POSIX_FALLOCATE.
12943 (Output_file::map): Call posix_fallocate rather than lseek and
12945 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12946 * configure, Makefile.in, config.in: Rebuild.
12948 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12950 * layout.h (Layout::create_note): Add section_name parameter.
12951 * layout.cc (Layout::create_note): Likewise.
12952 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12954 2009-03-17 Ian Lance Taylor <iant@google.com>
12956 * descriptors.cc: Include "options.h".
12957 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12958 (Descriptors::open): Always use O_CLOEXEC when opening a new
12959 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12960 then set FD_CLOEXEC.
12962 * sparc.cc (class Target_sparc): Add has_got_section.
12963 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12964 make sure we have a GOT section.
12966 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12967 (Target_sparc::Scan::local): Likewise.
12968 (Target_sparc::Scan::global): Likewise.
12969 (Target_sparc::Relocate::relocate): Likewise.
12970 (Target_sparc::Relocate::relocate_tls): Likewise.
12972 * symtab.cc (Symbol_table::define_default_version): New function,
12973 broken out of add_from_object.
12974 (Symbol_table::add_from_object): Call define_default_version.
12975 (Symbol_table::define_special_symbol): Add resolve_oldsym
12976 parameter. Change all callers. If the version for a symbol comes
12977 from a version script, resolve it with the symbol with the same
12978 name with no version. Also add the symbol without a version if
12980 (do_define_in_output_data): If resolving with oldsym, don't delete
12982 (do_define_in_output_segment): Likewise.
12983 (do_define_as_constant): Likewise.
12984 * symtab.h (class Symbol_table): Update declarations.
12986 2009-03-13 Ian Lance Taylor <iant@google.com>
12988 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12989 (Read_symbols::requeue): New function.
12990 (Read_symbols::do_read_symbols): If make_elf_object fails because
12991 the target type is not configured, and the file was searched for,
12992 issue a warning and retry with the next directory.
12993 (Add_symbols::run): If the file has an incompatible format, and
12994 it was searched for, requeue the Read_symbols task. On error,
12995 release the object.
12996 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12997 dirindex parameter to constructor. Change all callers. Declare
12998 incompatible_warning and requeue.
12999 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13000 input_argument_ and input_group_ fields. Add them to
13001 constructor. Change all callers.
13002 (class Read_script): Add dirindex_ field. Add it to constructor.
13003 Change all callers.
13004 * archive.cc (Archive::setup): Remove input_objects parameter.
13005 Change all callers.
13006 (Archive::get_file_and_offset): Likewise.
13007 (Archive::read_all_symbols): Likewise.
13008 (Archive::read_symbols): Likewise.
13009 (Archive::get_elf_object_for_member): Remove input_objects
13010 parameter. Add punconfigured parameter. Change all callers.
13011 (Archive::add_symbols): Change return type to bool. Check return
13012 value of include_member.
13013 (Archive::include_all_members): Likewise.
13014 (Archive::include_member): Change return type to bool. Return
13015 false if first included object has incompatible target. Set
13016 included_member_ field.
13017 (Add_archive_symbols::run): If add_symbols returns false, requeue
13019 * archive.h (class Archive): Add included_member_ field.
13020 Initialize it in constructor. Add input_file and searched_for
13021 methods. Update declarations.
13022 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13023 input_argument_ fields. Add them to constructor. Change all
13025 * script.cc: Include "target-select.h".
13026 (class Parser_closure): Add skip_on_incompatible_target_ and
13027 found_incompatible_target_ fields. Add
13028 skip_on_incompatible_target parameter to constructor. Change all
13029 callers. Add methods skip_on_incompatible_target,
13030 clear_skip_on_incompatible_target, found_incompatible_target, and
13031 set_found_incompatible_target.
13032 (read_input_script): Add dirindex parameter. Change all callers.
13033 If parser finds an incompatible target, requeue Read_symbols
13035 (script_set_symbol): Clear skip_on_incompatible_target in
13037 (script_add_assertion, script_parse_option): Likewise.
13038 (script_start_sections, script_add_phdr): Likewise.
13039 (script_check_output_format): New function.
13040 * script.h (read_input_script): Update declaration.
13041 * script-c.h (script_check_output_format): Declare.
13042 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13043 (ignore_cmd): Remove OUTPUT_FORMAT.
13044 * fileread.cc (Input_file::Input_file): Add explicit this.
13045 (Input_file::will_search_for): New function.
13046 (Input_file::open): Add pindex parameter. Change all callers.
13047 * fileread.h (class Input_file): Add input_file_argument method.
13048 Declare will_search_for. Update declarations.
13049 * object.cc (make_elf_object): Add punconfigured parameter.
13050 Change all callers.
13051 * object.h (class Object): Make input_file public. Add
13052 searched_for method.
13053 (make_elf_object): Update declaration.
13054 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13056 * dirsearch.h (class Dirsearch): Update declaration.
13057 * options.h (class General_options): Add --warn-search-mismatch.
13058 * parameters.cc (Parameters::is_compatible_target): New function.
13059 * parameters.h (class Parameters): Declare is_compatible_target.
13060 * workqueue.cc (Workqueue::add_blocker): New function.
13061 * workqueue.h (class Workqueue): Declare add_blocker.
13063 * fileread.cc (Input_file::open): Remove options parameter.
13064 Change all callers.
13065 (Input_file::open_binary): Likewise.
13066 * script.cc (read_input_script): Likewise.
13067 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13068 options parameter from constructor. Change all callers.
13069 (class Read_script): Likewise.
13070 * fileread.h (class Input_file): Update declarations.
13071 * script.h (read_input_script): Update declaration.
13073 2009-03-10 Nick Clifton <nickc@redhat.com>
13075 * po/es.po: New Spanish translation.
13077 2009-03-06 Cary Coutant <ccoutant@google.com>
13079 * options.cc (parse_short_option): Keep dash_z from registering itself.
13081 2009-03-03 Ian Lance Taylor <iant@google.com>
13084 * target-reloc.h (relocate_section): Pass output_section to
13086 * i386.cc (Target_i386::should_apply_static_reloc): Add
13087 output_section parameter. Change all callers.
13088 (Target_i386::Relocate::relocate): Add output_section parameter.
13089 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13090 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13091 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13092 * testsuite/two_file_shared.sh: New script.
13093 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13094 (check_DATA): Add two_file_shared.dbg.
13095 (two_file_shared.dbg): New target.
13096 * testsuite/Makefile.in: Rebuild.
13098 2009-03-01 Ian Lance Taylor <iant@google.com>
13100 * configure.ac: Check for byteswap.h.
13101 * configure: Rebuild.
13102 * config.in: Rebuild.
13104 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13106 * layout.cc (Layout::find_or_add_kept_section): New function.
13107 (Layout::add_comdat): Removed.
13108 * layout.h (struct Kept_section): Move out of class Layout.
13109 Remove trailing underscores from field names. Add group_sections
13110 field. Rename group_ field to is_group. Change all uses.
13111 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13112 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13113 comdat_groups_ field.
13114 (Sized_relobj::include_section_group): Use
13115 find_or_add_kept_section and Kept_section::group_sections.
13116 (Sized_relobj::include_linkonce_section): Likewise.
13117 * object.cc (class Sized_relobj): Don't define Comdat_group or
13118 Comdat_group_table. Remove find_comdat_group and
13119 add_comdat_group. Remove comdat_groups_ field.
13120 * plugin.cc (include_comdat_group): Use
13121 Layout::find_or_add_kept_section.
13123 2009-02-28 Ian Lance Taylor <iant@google.com>
13125 * README: --gc-sections and map files are now supported. Document
13126 some build requirements.
13129 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13130 relocatable link set the value of the section symbol to zero.
13131 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13132 relocatable link don't include the section address in the local
13135 2009-02-27 Ian Lance Taylor <iant@google.com>
13138 * options.h (class Search_directory): Add is_system_directory.
13139 (class General_options): Declare is_in_system_directory.
13140 * options.cc (get_relative_sysroot): Make static.
13141 (get_default_sysroot): Make static.
13142 (General_optoins::is_in_system_directory): New function.
13143 * fileread.cc (Input_file::is_in_system_directory): New function.
13144 * fileread.h (class Input_file): Declare is_in_system_directory.
13145 * object.h (class Object): Add is_in_system_directory.
13146 (class Input_objects): Remove system_library_directory_ field.
13147 * object.cc (Input_objects::add_object): Don't set
13148 system_library_directory_.
13149 (input_objects::found_in_system_library_directory): Remove.
13150 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13151 parameter. Change all callers.
13152 (Symbol_table::sized_write_globals): Likewise.
13153 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13154 Call Object::is_in_system_directory.
13155 * symtab.h (class Symbol_table): Update declarations.
13158 * descriptors.h (Open_descriptor): Add is_on_stack field.
13159 * descriptors.cc (Descriptors::open): If the descriptor is on the
13160 top of the stack, remove it. Initialize is_on_stack field.
13161 (Descriptors::release): Only add pod to stack if it is not on the
13163 (Descriptors::close_some_descriptor): Clear stack_next and
13164 is_on_stack fields.
13167 * output.cc (Output_section::find_starting_output_address): Rename
13168 from starting_output_address; add PADDR parameter; change return
13170 * output.h (class Output_section): Declare
13171 find_starting_output_address instead of starting_output_address.
13172 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13173 section symbol for which we can't find a merge section.
13176 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13177 hidden or internal, force the symbol to be local.
13178 * resolve.cc (Symbol::override_visibility): Define.
13179 (Symbol::override_base): Use override_visibility.
13180 (Symbol_table::resolve): Likewise.
13181 (Symbol::override_base_with_special): Likewise.
13182 (Symbol_table::override_with_special): If the visibility is hidden
13183 or internal, force the symbol to be local.
13184 * symtab.h (class Symbol): Add set_visibility and
13185 override_visibility.
13186 * testsuite/ver_test_1.sh: New file.
13187 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13188 (check_DATA): Add ver_test_1.syms.
13189 (ver_test_1.syms): New target.
13190 * testsuite/Makefile.in: Rebuild.
13192 2009-02-25 Cary Coutant <ccoutant@google.com>
13194 * layout.cc (Layout::choose_output_section): Don't rename sections
13195 when using a linker script that has a SECTIONS clause.
13196 * Makefile.in: Regenerate.
13198 * testsuite/Makefile.am (script_test_5.sh): New test case.
13199 * testsuite/Makefile.in: Regenerate.
13200 * testsuite/script_test_5.cc: New file.
13201 * testsuite/script_test_5.sh: New file.
13202 * testsuite/script_test_5.t: New file.
13204 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13206 * archive.cc (Archive::include_member): Update calls to add_symbols.
13207 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13208 the Layout argument.
13209 * dynobj.h (do_add_symbols): Add the Layout argument.
13210 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13212 * object.h (Object::add_symbols): Add the Layout argument.
13213 (Object::do_add_symbols): Add the Layout argument.
13214 (Sized_relobj::do_add_symbols): Add the Layout argument.
13215 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13216 Unify the two versions.
13217 (Add_plugin_symbols): Remove.
13218 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13219 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13220 (Add_plugin_symbols): Remove.
13221 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13222 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13223 (Add_symbols::run): Make it work with Pulginobj.
13225 2009-02-06 Ian Lance Taylor <iant@google.com>
13227 * object.cc (Sized_relobj::do_layout): Make info message start
13228 with lower case letter.
13230 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13232 * binary.cc: Fix file comment.
13234 * options.h (enum Incremental_disposition): Define.
13235 (class General_options): Add new options: --incremental,
13236 --incremental_changed, --incremental_unchanged,
13237 --incremental_unknown. Add incremental_disposition_ and
13238 implicit_incremental_ fields.
13239 (General_options::incremental_disposition): New function.
13240 (class Position_dependent_options): Add incremental_disposition
13242 (Position_dependent_options::copy_from_options): Set incremental
13244 * options.cc (General_options::parse_incremental_changed): New
13246 (General_options::parse_incremental_unchanged): New function.
13247 (General_options::parse_incremental_unknown): New function.
13248 (General_options::General_options): Initialize new fields
13249 incremental_disposition_ and implicit_incremental_.
13250 (General_options::finalize): Check for uasge of --incremental-*
13251 without --incremental.
13253 2009-02-06 Chris Demetriou <cgd@google.com>
13255 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13256 pointer and to report location as the file name associated with
13258 (gold_undefined_symbol_at_location): New function to replace the
13259 old gold_undefined_symbol functionality.
13260 * target-reloc.h (relocate_section): Update to use
13261 gold_undefined_symbol_at_location.
13262 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13263 Call gold_undefined_symbol function rather than gold_error.
13264 * errors.h (Errors::undefined_symbol): Take location as a
13265 string, rather than calculating it from a relocation.
13266 * errors.cc (Errors::fatal): Print "fatal error:" before the
13268 (Errors::error, Errors::error_at_location): Print "error: "
13269 before the formatted message.
13270 (Errors::undefined_symbol): Take location as a string, rather
13271 than calculating it from a relocation.
13272 (gold_undefined_symbol_at_location): New function akin to
13273 old gold_undefined_symbol, calculates location from relocation.
13274 (gold_undefined_symbol): Change to take only a Symbol pointer
13275 and to report location as the file name associated with the symbol.
13276 * testsuite/debug_msg.sh: Update for changed error messages.
13277 * testsuite/undef_symbol.sh: Likewise.
13279 2009-02-04 Duncan Sands <baldrick@free.fr>
13282 * reduced_debug_output.h
13283 (Output_reduced_debug_abbrev_section::failed): Use format for
13285 (Output_reduced_debug_info_section::faild): Likewise.
13287 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13289 * script.cc (Lazy_demangler): New class.
13290 (Version_script_info::get_symbol_version_helper): Demangle a
13293 2009-01-29 Cary Coutant <ccoutant@google.com>
13295 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13297 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13299 2009-01-28 Ian Lance Taylor <iant@google.com>
13301 * version.cc (version_string): Bump to 1.9.
13303 * gold.h: Include <cstring> and <stdint.h>.
13304 * version.cc: Include <cstdio>.
13305 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13307 * reduced_debug_output.cc (insert_into_vector): Rename from
13308 Insert_into_vector; change all callers. Use Swap_unaligned to
13309 avoid aliasing issue; remove union since it is unnecessary.
13311 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13313 * Makefile.am (CCFILES): Add gc.cc.
13314 (HFILES): Add gc.h.
13315 * Makefile.in: Regenerate.
13316 * gold.cc (Gc_runner): New class.
13317 (queue_initial_tasks): Call garbage collection related tasks
13318 when corresponding options are invoked.
13319 (queue_middle_gc_tasks): New function.
13320 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13321 processed early before laying out sections during garbage collection.
13322 * gold.h (queue_middle_gc_tasks): New function.
13323 (is_prefix_of): Move from "layout.cc".
13324 * i386.cc (Target_i386::gc_process_relocs): New function.
13325 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13326 * main.cc (main): Create object of class "Garbage_collection".
13327 * object.cc (Relobj::copy_symbols_data): New function.
13328 (Relobj::is_section_name_included): New function.
13329 (Sized_relobj::do_layout): Allow this function to be called twice
13330 during garbage collection and defer layout of section during the
13332 * object.h (Relobj::get_symbols_data): New function.
13333 (Relobj::is_section_name_included): New function.
13334 (Relobj::copy_symbols_data): New function.
13335 (Relobj::set_symbols_data): New function.
13336 (Relobj::get_relocs_data): New function.
13337 (Relobj::set_relocs_data): New function.
13338 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13339 (Relobj::gc_process_relocs): New function.
13340 (Relobj::do_gc_process_relocs): New pure virtual function.
13341 (Relobj::sd_): New data member.
13342 (Sized_relobj::is_output_section_offset_invalid): New function.
13343 (Sized_relobj::do_gc_process_relocs): New function.
13344 * options.h (General_options::gc_sections): Modify to not be a no-op.
13345 (General_options::print_gc_sections): New option.
13346 * plugin.cc (Plugin_finish::run): Remove function call to
13347 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13348 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13349 * reloc.cc (Read_relocs::run): Add task to process relocs and
13350 determine unreferenced sections when doing garbage collection.
13351 (Gc_process_relocs): New class.
13352 (Sized_relobj::do_gc_process_relocs): New function.
13353 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13354 sections that are garbage collected.
13355 * reloc.h (Gc_process_relocs): New class.
13356 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13357 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13358 symbols whose corresponding sections are garbage collected.
13359 (Symbol_table::Symbol_table): Add new parameter for the garbage
13361 (Symbol_table::gc_mark_undef_symbols): New function.
13362 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13363 (Symbol_table::gc_mark_dyn_syms): New function.
13364 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13366 (Symbol_table::add_from_object): Likewise.
13367 (Symbol_table::add_from_relobj): When building shared objects, do not
13368 treat externally visible symbols as garbage.
13369 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13370 table information for static and relocatable links.
13371 * symtab.h (Symbol_table::set_gc): New function.
13372 (Symbol_table::gc): New function.
13373 (Symbol_table::gc_mark_undef_symbols): New function.
13374 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13375 (Symbol_table::gc_mark_dyn_syms): New function.
13376 (Symbol_table::gc_): New data member.
13377 * target.h (Sized_target::gc_process_relocs): New pure virtual
13379 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13380 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13382 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13384 * options.h (General_options::gc_sections): Define as a no-op for now.
13385 (General_options::no_keep_memory): Ditto.
13386 (General_options::Bshareable): Define.
13387 * options.cc (General_options::finalize): Honor -Bshareable.
13389 2009-01-20 Andreas Schwab <schwab@suse.de>
13391 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13392 read the value in the contents, since we don't use it. Use the
13393 template endianness when writing.
13394 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13396 2009-01-19 Andreas Schwab <schwab@suse.de>
13398 * configure.tgt (powerpc64-*): Fix targ_obj.
13400 2009-01-15 Ian Lance Taylor <iant@google.com>
13402 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13403 local symbols when stripping all symbols.
13405 2009-01-14 Cary Coutant <ccoutant@google.com>
13407 * output.cc (Output_reloc): Add explicit instantiations.
13409 2009-01-14 Cary Coutant <ccoutant@google.com>
13411 * archive.cc (Archive::get_elf_object_for_member): Remove call
13412 to File_read::claim_for_plugin.
13413 * descriptors.cc (Descriptors::open): Remove reference to
13415 (Descriptors::claim_for_plugin): Remove.
13416 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13417 (Descriptors::is_claimed): Remove.
13418 (claim_descriptor_for_plugin): Remove.
13419 * fileread.cc (File_read::claim_for_plugin): Remove.
13420 * fileread.h (File_read::claim_for_plugin): Remove.
13421 (File_read::descriptor): Reopen descriptor if necessary.
13422 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13423 (Plugin_manager::all_symbols_read): Add task parameter. Change
13425 (Plugin_manager::get_input_file): New function.
13426 (Plugin_manager::release_input_file): New function.
13427 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13428 corresponding data member.
13429 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13430 and pass to base constructor. Change all callers.
13431 (get_input_file, release_input_file): New functions.
13432 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13433 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13434 (Plugin_manager::all_symbols_read): Add task parameter.
13435 (Plugin_manager::get_input_file): New function.
13436 (Plugin_manager::release_input_file): New function.
13437 (Plugin_manager::task_): New data member.
13438 (Pluginobj::Pluginobj): Add filesize parameter.
13439 (Pluginobj::filename): New function.
13440 (Pluginobj::descriptor): New function.
13441 (Pluginobj::filesize): New function.
13442 (Pluginobj::filesize_): New data member.
13443 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13444 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13445 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13447 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13448 with archive libraries.
13449 * testsuite/Makefile.in: Regenerate.
13450 * testsuite/plugin_test.c (struct sym_info): New type.
13451 (get_input_file, release_input_file): New static variables.
13452 (onload): Capture new transfer vector entries.
13453 (claim_file_hook): Stop reading at end of file according to filesize.
13454 Factor out parsing of readelf output into separate function.
13455 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13456 APIs and get the source file name from the symbol table. Convert
13457 source file name to corresponding object file name. Print info
13458 message when adding new input files.
13459 (parse_readelf_line): New function.
13460 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13461 * testsuite/plugin_test_2.sh: Likewise.
13462 * testsuite/plugin_test_3.sh: Likewise.
13463 * testsuite/plugin_test_4.sh: New test case.
13465 2009-01-07 Ian Lance Taylor <iant@google.com>
13467 * version.cc (version_string): Bump to 1.8.
13469 2008-12-23 Cary Coutant <ccoutant@google.com>
13471 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13472 * plugin.cc (Plugin_manager::finish): Rename as
13473 layout_deferred_objects. Move cleanup to separate function.
13474 (Plugin_manager::cleanup): New function.
13475 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13477 * plugin.h (Plugin_manager::finish): Rename as
13478 layout_deferred_objects.
13479 (Plugin_manager::cleanup): New function.
13480 (Plugin_manager::cleanup_done): New field.
13482 2008-12-23 Cary Coutant <ccoutant@google.com>
13484 * plugin.cc (is_visible_from_outside): New function.
13485 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13486 so we don't return "IR only" status for exported symbols or -r links.
13488 * testsuite/Makefile.am (plugin_test_3): New test case.
13489 * testsuite/Makefile.in: Regenerate.
13490 * testsuite/plugin_test_3.sh: New file.
13492 2008-12-22 Cary Coutant <ccoutant@google.com>
13494 * object.cc (Sized_relobj::layout_section): New function.
13495 (Sized_relobj::do_layout): Defer layout of input sections until after
13496 plugin has provided replacement files.
13497 (Sized_relobj::do_layout_deferred_sections): New function.
13498 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13499 (Relobj::layout_deferred_sections): New function.
13500 (Relobj::do_layout_deferred_sections): New function.
13501 (Sized_relobj::do_layout_deferred_sections): New function.
13502 (Sized_relobj::layout_section): New function.
13503 (Sized_relobj::Deferred_layout): New structure.
13504 (Sized_relobj::deferred_layout_): New field.
13505 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13506 Change all callers. Layout deferred sections.
13507 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13509 (Plugin_hook::run): Move code from do_plugin_hook inline.
13510 (Plugin_hook::do_plugin_hook): Remove.
13511 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13512 (Plugin_manager::finish): Renamed, was cleanup.
13513 (Plugin_manager::should_defer_layout): New function.
13514 (Plugin_manager::add_deferred_layout_object): New function.
13515 (Plugin_manager::Deferred_layout_list): New type.
13516 (Plugin_manager::deferred_layout_objects_): New field.
13517 (Plugin_hook::do_plugin_hook): Remove.
13519 2008-12-17 Ian Lance Taylor <iant@google.com>
13521 * options.h (class General_options): Add --no case for
13524 2008-12-16 Cary Coutant <ccoutant@google.com>
13526 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13528 (Plugin_manager::claim_file): Create plugin object even if
13529 plugin did not call the add_symbols callback.
13530 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13531 asking for more symbols than were added.
13532 * testsuite/Makefile.am (plugin_test_1): Add test case with
13534 (empty.syms): New target.
13535 * testsuite/Makefile.in: Regenerate.
13536 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13537 message. Don't call add_symbols if no globals.
13538 (all_symbols_read_hook): Don't provide replacement for empty
13541 2008-12-12 Ian Lance Taylor <iant@google.com>
13543 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13544 r_type == 0 for a local symbol with r_sym == 0.
13545 (scan_relocatable_relocs): Pass r_sym to
13546 local_non_section_strategy.
13547 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13550 * configure.ac: Update test for TLS descriptors: they are
13551 supported as of glibc 2.9.
13552 * configure: Rebuild.
13554 2008-12-11 Ian Lance Taylor <iant@google.com>
13557 * target-reloc.h (Default_scan_relocatable_relocs): For each
13558 function, map r_type == 0 to RELOC_DISCARD.
13560 2008-12-10 Cary Coutant <ccoutant@google.com>
13562 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13563 object to override a kept COMDAT group from a plugin object.
13565 2008-12-09 Ian Lance Taylor <iant@google.com>
13568 * yyscript.y (file_cmd): Handle INPUT.
13570 * testsuite/initpri1.c: Change all declarations to be full
13571 prototypes by adding void, to avoid compiler warnings.
13573 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13575 * options.cc (General_options::parse_plugin_opt): New.
13576 (General_options::add_plugin): The argument now is just the filename.
13577 (General_options::add_plugin_option): New.
13578 * options.h (plugin_opt): New.
13579 (add_plugin): Change argument name.
13580 (add_plugin_option): New.
13581 * plugin.cc (Plugin::load): Don't parse the plugin option.
13582 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13583 (Plugin::add_option): New.
13584 (Plugin::args_): Change type.
13585 (Plugin::filename_): New.
13586 (Plugin_manager::add_plugin_option): New.
13587 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13588 * testsuite/Makefile.in: Regenerate.
13590 2008-12-05 Cary Coutant <ccoutant@google.com>
13592 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13593 Handle --strip-lto-sections option.
13594 * options.h (strip_lto_sections): New option.
13596 2008-12-01 Cary Coutant <ccoutant@google.com>
13598 * plugin.cc (ld_plugin_message): Change format parameter to const.
13599 Fix mismatch between new[] and delete.
13601 2008-11-14 Cary Coutant <ccoutant@google.com>
13603 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13606 2008-11-05 Craig Silverstein <csilvers@google.com>
13608 * options.cc (General_options::parse_dynamic_list): New function.
13609 * options.h (General_options): New flags dynamic_list,
13610 dynamic_list_data, dynamic_list_cpp_new, and
13611 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13612 (General_options::in_dynamic_list): New function.
13613 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13614 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13615 (Lex::can_continue_name): Likewise.
13617 (read_script_file): New parameter script_options.
13618 (read_dynamic_list): New function.
13619 (Script_options::define_dynamic_list): New function.
13620 (dynamic_list_keyword_parsecodes): New variable.
13621 (dynamic_list_keywords): New variable.
13622 * script.h (Script_options::define_dynamic_list): New function
13624 (read_dynamic_list): New function prototype.
13625 * symtab.cc (strprefix): New macro.
13626 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13627 dynamic_list_data, dynamic_list_cpp_new, and
13628 dynamic_list_cpp_typeinfo.
13629 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13630 (dynamic_list_expr): New rule.
13631 (dynamic_list_nodes): Likewise.
13632 (dynamic_list_node): Likewise.
13633 * testsuite/Makefile.am (dynamic_list): New test.
13634 * testsuite/Makefile.in: Regenerated.
13635 * testsuite/dynamic_list.t: New file.
13636 * testsuite/dynamic_list.sh: New file.
13638 2008-11-05 Craig Silverstein <csilvers@google.com>
13640 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13641 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13642 (t11_last): Likewise.
13643 * testsuite/ver_test_6.c (main): Likewise.
13645 2008-10-07 Cary Coutant <ccoutant@google.com>
13647 * options.c (General_options::finalize): Add check for -static and
13649 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13652 2008-10-02 Cary Coutant <ccoutant@google.com>
13654 * plugin.cc (make_sized_plugin_object): Fix conditional
13655 compilation to work when not all targets are enabled.
13657 2008-09-29 Cary Coutant <ccoutant@google.com>
13659 * archive.cc (Archive::get_file_and_offset): Use filename instead
13660 of name to get library path.
13661 (Archive::include_member): Unlock external member of a thin archive.
13663 * testsuite/Makefile.am (TEST_AR): New variable.
13664 (thin_archive_test_1): New test.
13665 (thin_archive_test_2): New test.
13666 * testsuite/Makefile.in: Regenerate.
13667 * testsuite/thin_archive_main.cc: New file.
13668 * testsuite/thin_archive_test_1.cc: New file.
13669 * testsuite/thin_archive_test_2.cc: New file.
13670 * testsuite/thin_archive_test_3.cc: New file.
13671 * testsuite/thin_archive_test_4.cc: New file.
13673 2008-09-29 Cary Coutant <ccoutant@google.com>
13675 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13676 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13678 (Sized_relobj::do_finalize_local_symbols): Likewise.
13679 (Sized_relobj::map_to_kept_section): Likewise.
13680 * object.h (Sized_relobj::invalid_address): New constant.
13681 (Sized_relobj::do_output_section_offset): Check for invalid_address
13683 * output.cc (Output_reloc::local_section_offset): Use constant
13684 invalid_address instead of -1U.
13685 (Output_reloc::get_address): Likewise.
13686 (Output_section::output_address): Change -1U to -1ULL.
13687 * output.h (Output_reloc::invalid_address): New constant.
13688 * reloc.cc (Sized_relobj::write_sections): Use constant
13689 invalid_address instead of -1U.
13690 (Sized_relobj::relocate_sections): Likewise.
13691 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13692 values for merge sections.
13693 * target-reloc.h (relocate_for_relocatable): Use constant
13694 invalid_address instead of -1U.
13696 2008-09-19 Cary Coutant <ccoutant@google.com>
13698 Add plugin functionality for link-time optimization (LTO).
13699 * configure.ac (plugins): Add --enable-plugins option.
13700 * configure: Regenerate.
13701 * config.in: Regenerate.
13702 * Makefile.am (LIBDL): New variable.
13703 (CCFILES): Add plugin.cc.
13704 (HFILES): Add plugin.h.
13705 (ldadd_var): Add LIBDL.
13706 * Makefile.in: Regenerate.
13708 * archive.cc: Include "plugin.h".
13709 (Archive::setup): Don't preread archive symbols when using a plugin.
13710 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13711 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13713 (Archive::include_member): Add symbols from plugin objects.
13714 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13715 * descriptors.cc (Descriptors::open): Check for file descriptors
13716 abandoned by plugins.
13717 (Descriptors::claim_for_plugin): New function.
13718 * descriptors.h (Descriptors::claim_for_plugin): New function.
13719 (Open_descriptor::is_claimed): New field.
13720 (claim_descriptor_for_plugin): New function.
13721 * fileread.cc (File_read::claim_for_plugin): New function.
13722 * fileread.h (File_read::claim_for_plugin): New function.
13723 (File_read::descriptor): New function.
13724 * gold.cc: Include "plugin.h".
13725 (queue_initial_tasks): Add task to call plugin hooks for generating
13727 * main.cc: Include "plugin.h".
13728 (main): Load plugin libraries.
13729 * object.h (Pluginobj): Declare.
13730 (Object::pluginobj): New function.
13731 (Object::do_pluginobj): New function.
13732 (Object::set_target): New function.
13733 * options.cc: Include "plugin.h".
13734 (General_options::parse_plugin): New function.
13735 (General_options::General_options): Initialize plugins_ field.
13736 (General_options::add_plugin): New function.
13737 * options.h (Plugin_manager): Declare.
13738 (General_options): Add --plugin option.
13739 (General_options::has_plugins): New function.
13740 (General_options::plugins): New function.
13741 (General_options::add_plugin): New function.
13742 (General_options::plugins_): New field.
13743 * plugin.cc: New file.
13744 * plugin.h: New file.
13745 * readsyms.cc: Include "plugin.h".
13746 (Read_symbols::do_read_symbols): Check for archive before checking
13747 for ELF file. Call plugin hooks to claim files.
13748 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13749 from a real object file; force override when processing replacement
13751 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13752 (Symbol::init_base_object): Likewise.
13753 (Symbol::init_base_output_data): Likewise.
13754 (Symbol::init_base_output_segment): Likewise.
13755 (Symbol::init_base_constant): Likewise.
13756 (Symbol::init_base_undefined): Likewise.
13757 (Symbol::output_section): Assert that object is not a plugin.
13758 (Symbol_table::add_from_pluginobj): New function.
13759 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13761 (Symbol_table::sized_write_globals): Likewise.
13762 (Symbol_table::add_from_pluginobj): Instantiate template.
13763 * symtab.h (Sized_pluginobj): Declare.
13764 (Symbol::in_real_elf): New function.
13765 (Symbol::set_in_real_elf): New function.
13766 (Symbol::in_real_elf_): New field.
13767 (Symbol_table::add_from_pluginobj): New function.
13769 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13770 (LIBDL): New variable.
13771 (LDADD): Add LIBDL.
13772 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13773 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13774 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13775 (MOSTLYCLEANFILES): Likewise.
13776 * testsuite/Makefile.in: Regenerate.
13777 * testsuite/plugin_test.c: New file.
13778 * testsuite/plugin_test_1.sh: New file.
13779 * testsuite/plugin_test_2.sh: New file.
13781 2008-09-16 Ian Lance Taylor <iant@google.com>
13783 * target-reloc.h (relocate_section): Check whether a symbol is
13784 defined by the ABI before reporting an undefined symbol error.
13785 * target.h (Target::is_defined_by_abi): Make parameter const.
13786 (Target::do_is_defined_by_abi): Likewise.
13787 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13788 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13789 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13790 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13791 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13792 * testsuite/Makefile.in: Rebuild.
13794 * fileread.cc (make_view): Add casts to avoid warning.
13796 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13798 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13799 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13801 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13803 * options.h (General_options::output_is_executable): New.
13804 (General_options::output_is_pie): New.
13805 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13806 for shared libraries.
13807 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13809 2008-09-11 Chris Demetriou <cgd@google.com>
13811 * options.h (origin): New -z option.
13812 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13813 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13816 2008-09-05 Cary Coutant <ccoutant@google.com>
13818 * fileread.cc (File_read::make_view): Add check for attempt to map
13819 beyond end of file.
13821 2008-09-05 Cary Coutant <ccoutant@google.com>
13823 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13824 explicit instantiations.
13826 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13829 * options.cc (General_options::finalize): Allow undefined symbols
13830 in shlibs if linking -shared.
13833 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13834 symbols as not needing a dynsym entry.
13836 2008-08-20 Craig Silverstein <csilvers@google.com>
13838 * fileread.cc (File_read::open): Do not lock the file unless it
13839 was successfully opened.
13841 2008-08-14 Cary Coutant <ccoutant@google.com>
13843 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13844 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13845 * testsuite/tls_test.cc (struct int128): 128-bit struct
13846 for testing TLS relocs with non-zero addend.
13847 (v12): New TLS variable.
13849 (t_last): Add check for v12.
13850 * testsuite/tls_test.h (t12): New function.
13851 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13853 2008-08-13 Ian Lance Taylor <iant@google.com>
13855 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13856 set tls_segment_ or relro_segment_.
13857 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13859 * output.h (Output_section::clear_is_relro): New function.
13860 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13861 sections specially even when output_data_ is empty.
13862 (Output_segment::maximum_alignment): When first section is relro,
13863 only force alignment for PT_LOAD segments.
13864 * script.cc (script_data_segment_align): New function.
13865 (script_data_segment_relro_end): New function.
13866 * script-c.h (script_data_segment_align): Declare.
13867 (script_data_segment_relro_end): Declare.
13868 * script-sections.h (class Script_sections): Declare
13869 data_segment_align and data_segment_relro_end. Add fields
13870 segment_align_index_ and saw_relro_end_.
13871 * script-sections.cc (class Sections_element): Add set_is_relro
13872 virtual function. Add new bool* parameter to place_orphan_here.
13873 Add get_output_section virtual function.
13874 (class Output_section_definition): Add set_is_relro. Add new
13875 bool* parameter to place_orphan_here. Add get_output_section.
13876 Add is_relro_ field.
13877 (Output_section_definition::Output_section_definition): Initialize
13878 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13879 and is_relro_ fields.
13880 (Output_section_definition::place_orphan_here): Add is_relro
13882 (Output_section_definition::set_section_addresses): Set relro for
13884 (Output_section_definition::alternate_constraint): Likewise.
13885 (class Orphan_output_section): Add new bool* parameter to
13886 place_orphan_here. Add get_output_section.
13887 (Orphan_output_section::place_orphan_here): Add is_relro
13889 (Script_sections::Script_sections): Initialize
13890 data_segment_align_index_ and saw_relro_end_.
13891 (Script_sections::data_segment_align): New function.
13892 (Script_sections::data_segment_relro_end): New function.
13893 (Script_sections::place_orphan): Set or clear is_relro.
13894 (Script_sections::set_section_addresses): Force alignment of first
13896 * yyscript.y (exp): Call script_data_segment_align and
13897 script_data_segment_relro_end.
13898 * testsuite/relro_script_test.t: New file.
13899 * testsuite/relro_test.cc (using_script): Declare.
13900 (t1, t2): Test using_script.
13901 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13902 (relro_script_test_SOURCES): Define.
13903 (relro_script_test_DEPENDENCIES): Define.
13904 (relro_script_test_LDFLAGS): Define.
13905 (relro_script_test_LDADD): Define.
13906 (relro_script_test.so): New target.
13907 * testsuite/Makefile.in: Rebuild.
13909 2008-08-06 Cary Coutant <ccoutant@google.com>
13911 * archive.cc (Archive::total_archives, Archive::total_members)
13912 (Archive::total_members_loaded): New variables.
13913 (Archive::setup): Add parameter. Add option to preread
13915 (Archive::read_armap): Add counter.
13916 (Archive::get_file_and_offset): New function.
13917 (Archive::get_elf_object_for_member): New function.
13918 (Archive::read_all_symbols): New function.
13919 (Archive::read_symbols): New function.
13920 (Archive::add_symbols): Add counters.
13921 (Archive::include_all_members): Use armap to find members if it's
13923 (Archive::include_member): Skip reading symbols if already read.
13924 Factored code into Archive::get_file_and_offset and
13925 Archive::get_elf_object_for_member. Changed call to
13926 Mapfile::report_include_archive_member.
13927 (Archive::print_stats): New function.
13928 * archive.h: Declare Object and Read_symbols_data classes.
13929 (Archive::Archive): Add initializers for new members.
13930 (Archive::setup): Add parameter.
13931 (Archive::print_stats): New function.
13932 (Archive::total_archives, Archive::total_members)
13933 (Archive::total_members_loaded): New variables.
13934 (Archive::get_file_and_offset): New function.
13935 (Archive::get_elf_object_for_member): New function.
13936 (Archive::read_all_symbols): New function.
13937 (Archive::read_symbols): New function.
13938 (Archive::Archive_member): New class.
13939 (Archive::members_): New member.
13940 (Archive::num_members_): New member.
13941 * main.cc: Include archive.h.
13942 (main): Call Archive::print_stats.
13943 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13944 archive parameter; member_name is now the fully-decorated name.
13945 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13946 * options.h: (General_options): Add --preread-archive-symbols option.
13947 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13950 2008-08-04 Ian Lance Taylor <iant@google.com>
13952 * symtab.h (Symbol::use_plt_offset): New function.
13953 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13954 * powerpc.cc (Relocate::relocate): Likewise.
13955 * sparc.cc (Relocate::relocate): Likewise.
13956 * x86_64.cc (Relocate::relocate): Likewise.
13957 * testsuite/weak_plt.sh: New test.
13958 * testsuite/weak_plt_main.cc: New test.
13959 * testsuite/weak_plt_shared.cc: New test.
13960 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13961 (check_PROGRAMS): Add weak_plt.
13962 (check_DATA): Add weak_plt_shared.so.
13963 (weak_plt_main_pic.o, weak_plt): New targets.
13964 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13965 * testsuite/Makefile.in: Rebuild.
13967 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13969 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13970 * testsuite/Makefile.in: Rebuild.
13972 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13974 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13975 * Makefile.in: Regenerate.
13976 * po/POTFILES.in: Regenerate.
13978 2008-07-29 Ian Lance Taylor <iant@google.com>
13980 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13981 symbols before other symbols.
13982 * testsuite/script_test_2.cc (test_addr): Declare.
13983 (test_addr_alias): Declare.
13984 (main): Check that test_addr and test_addr_alias have the right
13986 * testsuite/script_test_2.t: Define test_addr_alias and
13989 2008-07-24 Ian Lance Taylor <iant@google.com>
13992 * descriptors.cc: New file.
13993 * descriptors.h: New file.
13994 * gold-threads.h (class Hold_optional_lock): New class.
13995 * fileread.cc: Include "descriptors.h".
13996 (File_read::~File_read): Release descriptor rather than closing
13998 (File_read::open) [file]: Call open_descriptor rather than open.
13999 Set is_descriptor_opened_.
14000 (File_read::open) [memory]: Assert that descriptor is not open.
14001 (File_read::reopen_descriptor): New function.
14002 (File_read::release): Release descriptor.
14003 (File_read::do_read): Make non-const. Reopen descriptor.
14004 (File_read::read): Make non-const.
14005 (File_read::make_view): Reopen descriptor.
14006 (File_read::do_readv): Likewise.
14007 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14008 Update declarations.
14009 * layout.cc: Include "descriptors.h".
14010 (Layout::create_build_id): Use open_descriptor rather than open.
14011 * output.cc: Include "descriptors.h".
14012 (Output_file::open): Use open_descriptor rather than open.
14013 * archive.cc (Archive::const_iterator): Change Archive to be
14015 (Archive::begin, Archive::end): Make non-const.
14016 (Archive::count_members): Likewise.
14017 * archive.h (class Archive): Update declarations.
14018 * object.h (Object::read): Make non-const.
14019 * Makefile.am (CCFILES): Add descriptors.cc.
14020 (HFILES): Add descriptors.h.
14021 * Makefile.in: Rebuild.
14024 * gold.h: Always include <clocale>. Add Solaris workarounds
14025 following code in binutils/sysdep.h.
14028 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14029 this->eh_frame_hdr_ is NULL before using it.
14031 * dynobj.cc (Versions::Versions): Update comment.
14033 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14034 the base version name.
14036 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14037 array size plus one.
14038 (Stringpool_template::set_string_offsets): Subtract one from key
14039 before using it as an array index.
14040 (Stringpool_template::get_offset_with_length): Likewise.
14041 (Stringpool_template::write_to_buffer): Likewise.
14042 * stringpool.h (Stringpool_template::get_offset_from_key):
14045 2008-07-23 Ian Lance Taylor <iant@google.com>
14048 * object.h (Merged_symbol_value::value): Do our best to handle a
14052 * script.cc (Version_script_info::get_versions): Don't add empty
14053 version tag to return value.
14054 (Version_script_info::get_symbol_version_helper): Change return
14055 type to bool. Add pversion parameter. Change all callers.
14056 (script_register_vers_node): Don't require a non-NULL tag.
14057 * script.h (class Version_script_info): Update declarations.
14058 (Version_script_info::get_symbol_version): Change return type to
14059 bool. Add version parameter. Change all callers.
14060 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14061 handling. Handle an empty version from a version script.
14062 (Symbol_table::define_special_symbol): Likewise.
14063 * testsuite/ver_test_10.script: New file.
14064 * testsuite/ver_test_10.sh: New file.
14065 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14066 (check_DATA): Add ver_test_10.syms.
14067 (ver_test_10.syms, ver_test_10.so): New target.
14068 * testsuite/Makefile.in: Rebuild.
14070 2008-07-23 Simon Baldwin <simonb@google.com>
14072 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14073 to zero for undefined symbols from dynamic libraries.
14075 2008-07-23 Ian Lance Taylor <iant@google.com>
14077 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14078 Change all callers.
14079 * symtab.h (class Symbol_table): Update declaration.
14080 * testsuite/ver_test_9.cc: New file.
14081 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14082 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14083 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14084 (ver_test_9.so, ver_test_9.o): New targets.
14085 * testsuite/Makefile.in: Rebuild.
14087 2008-07-22 Ian Lance Taylor <iant@google.com>
14089 * options.h (class General_options): Define --check-sections.
14090 * layout.cc (Layout::set_segment_offsets): Handle
14093 * options.h (class General_options): Define -n/--nmagic and
14095 * options.cc (General_options::finalize): For -n/--nmagic or
14096 -N/--omagic, set -static.
14097 * layout.cc (Layout::attach_allocated_section_to_segment): If
14098 -N/--omagic, don't put read-only and read-write sections in
14099 different segments.
14100 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14101 finding a read-only segment.
14102 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14103 don't set the minimum segment alignment to the common page size,
14104 and don't set the file offset to the address modulo the page size.
14105 * script-sections.cc (Script_sections::create_segments): If
14106 -n/--omagic, don't put read-only and read-write sections in
14107 different segments.
14109 * cref.cc: New file.
14110 * cref.h: New file.
14111 * options.h (class General_options): Add --print-symbol-counts.
14112 * main.cc (main): Issue defined symbol report if requested.
14113 * archive.cc (Archive::interpret_header): Make into a const member
14115 (Archive::add_symbols): Call Input_objects::archive_start and
14117 (Archive::const_iterator): Define new class.
14118 (Archive::begin, Archive::end): New functions.
14119 (Archive::include_all_members): Rewrite to use iterator.
14120 (Archive::count_members): New function.
14121 * archive.h (class Archive): Update declarations.
14122 (Archive::filename): New function.
14123 * object.cc: Include "cref.h".
14124 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14125 (Sized_relobj::do_get_global_symbol_counts): New function.
14126 (Input_objects::add_object): Add object to cross-referencer.
14127 (Input_objects::archive_start): New function.
14128 (Input_objects::archive_stop): New function.
14129 (Input_objects::print_symbol_counts): New function.
14130 * object.h: Declare Cref and Archive.
14131 (Object::get_global_symbol_counts): New function.
14132 (Object::do_get_global_symbol_counts): New pure virtual function.
14133 (class Sized_relobj): Add defined_count_ field. Update
14135 (class Input_objects): Add cref_ field. Update constructor.
14136 Update declarations.
14137 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14139 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14141 (Sized_dynobj::do_get_global_symbol_counts): New function.
14142 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14143 defined_count_. Update declarations. Define Symbols typedef.
14144 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14145 parameter. Change all callers.
14146 (Symbol_table::add_from_dynobj): Add sympointers and defined
14147 parameters. Change all callers.
14148 * symtab.h (class Symbol_table): Update declarations.
14149 * Makefile.am (CCFILES): Add cref.cc.
14150 (HFILES): Add cref.h.
14151 * Makefile.in: Rebuild.
14153 2008-07-22 Simon Baldwin <simonb@google.com>
14155 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14156 to zero when writing undefined symbols.
14158 2008-07-22 Ian Lance Taylor <iant@google.com>
14160 * output.cc (Output_section::add_input_section): Don't try to
14161 merge empty merge sections.
14163 2008-07-21 Craig Silverstein <csilvers@google.com>
14165 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14166 Include symbol version in error message.
14168 2008-07-20 Chris Demetriou <cgd@google.com>
14170 * configure.ac (gold_cv_c_random_seed): New configured variable.
14171 (RANDOM_SEED_CFLAGS): New substituted variable.
14172 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14173 * configure: Rebuild.
14174 * Makefile.in: Likewise.
14175 * testsuite/Makefile.in: Likewise.
14177 2008-07-18 Ian Lance Taylor <iant@google.com>
14179 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14180 where we see NAME/NULL and NAME/VERSION as separate symbols.
14181 * testsuite/ver_test_main.cc (main): Call t4.
14182 (t4, t4_2a): Define.
14183 * testsuite/ver_test_2.cc (t4_2): Define.
14184 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14185 * testsuite/ver_test_4.cc (t4_2a): Define.
14186 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14187 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14189 2008-07-17 Ian Lance Taylor <iant@google.com>
14191 * dynobj.cc (Versions::add_def): If we give an error about a
14192 missing version, go ahead and create the version anyhow.
14194 2008-07-10 Ian Lance Taylor <iant@google.com>
14196 Handle output sections with more than 0x7fffffff bytes.
14197 * object.h (class Relobj): Change map_to_output_ to
14198 output_sections_, and just keep a section pointer. Change all
14199 uses. Move comdat group support to Sized_relobj.
14200 (Relobj::is_section_specially_mapped): Remove.
14201 (Relobj::output_section): Remove poff parameter. Change all
14203 (Relobj::output_section_offset): New function.
14204 (Relobj::set_section_offset): Rewrite.
14205 (Relobj::map_to_output): Remove.
14206 (Relobj::output_sections): New function.
14207 (Relobj::do_output_section_offset): New pure virtual function.
14208 (Relobj::do_set_section_offset): Likewise.
14209 (class Sized_relobj): Add section_offsets_ field. Add comdat
14210 group support from Relobj. Update declarations.
14211 (Sized_relobj::get_output_section_offset): New function.
14212 (Sized_relobj::do_output_section_offset): New function.
14213 (Sized_relobj::do_set_section_offset): New function.
14214 * object.cc (Relobj::output_section_address): Remove.
14215 (Sized_relobj::Sized_relobj): Initialize new fields.
14216 (Sized_relobj::include_section_group): Cast find_kept_object to
14218 (Sized_relobj::include_linkonce_section): Likewise.
14219 (Sized_relobj::do_layout): Use separate arrays for output section
14221 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14223 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14224 output_sections and section_offsets.
14225 (Sized_relobj::write_local_symbols): Likewise.
14226 (map_to_kept_section): Compute output address directly.
14227 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14228 output_sections and section_offsets.
14229 (Sized_relobj::write_sections): Likewise.
14230 (Sized_relobj::relocate_sections): Likewise.
14231 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14232 * output.h (class Output_reloc): Update declarations. Change
14233 u2_.relobj to Sized_relobj*.
14234 (class Output_data_reloc): Change add functions to use
14236 * output.cc (Output_reloc::Output_reloc): Change relobj to
14238 (Output_reloc::local_section_offset): Change return type to
14239 Elf_Addr. Use get_output_section_offset.
14240 (Output_reloc::get_address): Likewise.
14241 (Output_section::is_input_address_mapped): Don't call
14242 is_section_specially_mapped.
14243 (Output_section::output_offset): Likewise.
14244 (Output_section::output_address): Likewise.
14245 (Output_section::starting_output_address): Likewise.
14246 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14247 parameter to Sized_relobj*.
14248 (Copy_relocs::need_copy_reloc): Likewise.
14249 (Copy_relocs::save): Likewise.
14250 * copy-relocs.h (class Copy_relocs): Update declarations.
14251 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14252 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14253 * target-reloc.h (relocate_for_relocatable): Change
14254 offset_in_output_section type to Elf_Addr. Change code that uses
14256 * layout.cc (Layout::layout): Always set *off.
14257 * mapfile.cc (Mapfile::print_input_section): Use
14258 output_section_offset.
14259 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14261 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14262 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14263 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14265 2008-07-03 Ian Lance Taylor <iant@google.com>
14267 * layout.cc (Layout::include_section): Do not discard unrecognized
14268 SHT_STRTAB sections.
14270 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14272 * script.cc (Lex::can_continue_name): Make '?' allowable in
14273 version-script names.
14274 * testsuite/version_script.map: Change glob pattern to use '?'
14276 2008-06-30 Manish Singh <yosh@gimp.org>
14279 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14282 2008-06-30 Ian Lance Taylor <iant@google.com>
14286 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14287 versions]: Don't try to read the value in the contents, since we
14288 don't use it. Use the template endianness when writing.
14290 2008-06-25 Cary Coutant <ccoutant@google.com>
14292 * fileread.cc (File_read::make_view): Assert on zero-length view.
14293 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14294 symbol table when there are no symbols to read.
14296 2008-06-23 Craig Silverstein <csilvers@google.com>
14298 * version.cc (version_string): Bump to 1.7
14300 2008-06-18 Craig Silverstein <csilvers@google.com>
14302 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14303 constant 0xFFFF to type Valtype.
14304 (Powerpc_relocate_functions::rel16_ha): Likewise.
14306 2008-06-17 Ian Lance Taylor <iant@google.com>
14308 * output.h (Output_section::Input_section): Initialize p2align_ to
14309 zero for Output_section_data constructors.
14310 (Output_section::Input_section::addralign): If not an input
14311 section, return the alignment of the Output_section_data.
14312 * testsuite/copy_test.cc: New file.
14313 * testsuite/copy_test_1.cc: New file.
14314 * testsuite/copy_test_2.cc: New file.
14315 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14316 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14317 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14318 (copy_test_1_pic.o, copy_test_1.so): New targets.
14319 (copy_test_2_pic.o, copy_test_2.so): New targets.
14320 * testsuite/Makefile.in: Rebuild.
14322 * script-sections.cc (Script_sections::place_orphan): Initialize
14323 local variable exact.
14325 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14327 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14329 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14330 David S. Miller <davem@davemloft.net>
14332 * powerpc.cc: New file.
14333 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14334 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14335 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14336 * Makefile.in: Rebuild.
14338 2008-06-09 Ian Lance Taylor <iant@google.com>
14340 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14342 (throwing, orig_terminate): New static variables.
14343 (terminate_handler): New static function.
14344 (t2): Set terminate handler.
14346 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14349 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14352 2008-05-30 Cary Coutant <ccoutant@google.com>
14354 * archive.cc (Archive::include_all_members) Correct to step
14355 over symbol table and extended name table in thin archives.
14357 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14360 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14363 2008-05-28 Caleb Howe <cshowe@google.com>
14365 * reduced_debug_output.cc: New file.
14366 * reduced_debug_output.h: New file.
14367 * options.h (class General_options): Add --strip-debug-non-line.
14368 * options.cc (General_options::finalize): Add strip_debug_non_line
14369 to the strip heirarchy.
14370 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14372 * layout.cc: Include "reduced_debug_output.h".
14373 (Layout::Layout): Initialize new fields.
14374 (line_only_debug_sections): New static array.
14375 (is_lines_only_debug_sections): New static inline function.
14376 (Layout::include_section): Handle --strip-debug-non-line.
14377 (Layout::make_output_section): If --strip-debug-non-line, build
14378 new output sections for .debug_abbrev and .debug_info.
14379 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14380 gold. Warn about possible overflow.
14381 (read_signed_LEB_128): Likewise.
14382 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14383 (read_signed_LEB_128): Declare.
14384 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14385 (HFILES): Add reduced_debug_output.h.
14386 * Makefile.in: Rebuild.
14388 2008-05-21 Ian Lance Taylor <iant@google.com>
14390 * mapfile.cc: New file.
14391 * mapfile.h: New file.
14392 * options.h (class General_options): Add -M/--print-map and -Map.
14393 * options.cc (General_options::finalize): Make -M equivalent to
14395 * main.cc: Include <cstdio> and "mapfile.h".
14396 (main): Open mapfile if requested.
14397 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14398 constructor. Change caller.
14399 (queue_initial_tasks): Add mapfile parameter. Change caller.
14400 (queue_middle_tasks): Likewise.
14401 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14403 * archive.cc: Include "mapfile.h".
14404 (Archive::add_symbols): Add mapfile parameter. Change all
14405 callers. Pass mapfile, symbol, and reason to include_member.
14406 (Archive::include_all_members): Add mapfile parameter. Change all
14408 (Archive::include_member): Add mapfile, sym, and why parameters.
14409 Change all callers. Report inclusion to map file.
14410 * archive.h: Include "fileread.h".
14411 (class Archive): Update declarations.
14412 (Archive::file): New const method.
14413 (class Add_archive_symbols): Add mapfile_ field. Update
14414 constructor. Change all callers.
14415 * readsyms.h (class Read_symbols): Likewise.
14416 (class Finish_group): Likewise.
14417 (class Read_script): Likewise.
14418 * common.cc: Include "mapfile.h".
14419 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14421 (Symbol_table::do_allocate_commons): Likewise.
14422 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14423 symbol allocation to mapfile.
14424 * common.h (class Allocate_commons_task): Add mapfile_ field.
14425 Update constructor. Change all callers.
14426 * symtab.h (class Symbol_table): Update declarations.
14427 * layout.cc: Include "mapfile.h".
14428 (Layout_task_runner::run): Print information to mapfile.
14429 (Layout::create_gold_note): Change Output_data_fixed_space to
14430 Output_data_zero_fill.
14431 (Layout::create_build_id): Likewise.
14432 (Layout::print_to_mapfile): New function.
14433 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14434 constructor. Change caller.
14435 (class Layout): Declare print_to_mapfile.
14436 * output.cc (Output_section::Input_section::print_to_mapfile): New
14438 (Output_section::add_input_section): If producing a map, always
14439 add to input_sections_ list.
14440 (Output_section::do_print_to_mapfile): New function.
14441 (Output_segment::print_sections_to_mapfile): New function.
14442 (Output_segment::print_section_list_to_mapfile): New function.
14443 * output.h: Include "mapfile.h".
14444 (Output_data::print_to_mapfile): New function.
14445 (Output_data::do_print_to_mapfile): New virtual function.
14446 (Output_segment_headers::do_print_to_mapfile): New function.
14447 (Output_file_header::do_print_to_mapfile): New function.
14448 (Output_data_const::do_print_to_mapfile): New function.
14449 (class Output_data_const_buffer): Add map_name_ field. Update
14450 constructor. Change all callers. Add do_print_to_mapfile
14452 (class Output_data_fixed_space): Likewise.
14453 (class Output_data_space): Likewise.
14454 (class Output_data_zero_fill): New class.
14455 (Output_data_strtab::do_print_to_mapfile): New function.
14456 (Output_data_reloc_base::do_print_to_mapfile): New function.
14457 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14458 (Output_data_group::do_print_to_mapfile): New function.
14459 (Output_data_got::do_print_to_mapfile): New function.
14460 (Output_data_dynamic::do_print_to_mapfile): New function.
14461 (Output_symtab_xindex::do_print_to_mapfile): New function.
14462 (class Output_section): Declare do_print_to_mapflie. Declare
14463 print_to_mapfile in Input_section.
14464 (class Output_segment): Declare new functions.
14465 * object.h (Sized_relobj::symbol_count): New function.
14466 * script-sections.cc
14467 (Output_section_element_dot_assignment::set_section_addresses):
14468 Change Output_data_fixed_space to Output_data_zero_fill.
14469 (Output_data_expression::do_print_to_mapfile): New function.
14470 * script.cc (read_input_script): Add mapfile parameter. Change
14472 * script.h (read_input_script): Update declaration.
14473 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14474 (Eh_frame::do_print_to_mapfile): New function.
14475 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14476 (Output_merge_string::do_print_to_mapfile): New function.
14477 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14479 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14481 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14483 * Makefile.am (CCFILES): Add mapfile.cc.
14484 (HFILES): Add mapfile.h.
14485 * Makefile.in: Rebuild.
14487 2008-05-19 Ian Lance Taylor <iant@google.com>
14489 * options.h (class General_options): Add -z relro.
14490 * layout.cc (Layout::Layout): Initialize relro_segment_.
14491 (Layout::add_output_section_data): Return the output section.
14492 (Layout::make_output_section): Rcognize relro sections and mark
14493 them appropriately.
14494 (Layout::attach_allocated_section_to_segment): Put relro sections
14495 in a PT_GNU_RELRO segment.
14496 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14498 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14500 (Layout::linkonce_mapping): Map d.rel.ro.local to
14501 .data.rel.ro.local.
14502 (Layout::output_section_name): Us .data.rel.ro.local for any
14503 section which begins with that.
14504 * layout.h (class Layout): Update add_output_section_data
14505 declaration. Add relro_segment_ field.
14506 * output.cc (Output_section::Output_section): Initialize is_relro_
14507 and is_relro_local_ fields.
14508 (Output_segment::add_output_section): Group relro sections.
14509 (Output_segment::is_first_section_relro): New function.
14510 (Output_segment::maximum_alignment): If there is a relro section,
14511 align the segment to the common page size.
14512 (Output_segment::set_section_addresses): Track whether we are
14513 looking at relro sections. If the last section is a relro
14514 section, align to the common page size.
14515 (Output_segment::set_section_list_addresses): Add in_relro
14516 parameter. Change all callers. Align to the page size when
14517 moving from relro to non-relro section.
14518 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14520 * output.h (class Output_section): Add is_relro_ and
14521 is_relro_local_ fields.
14522 (Output_section::is_relro): New function.
14523 (Output_section::set_is_relro): New function.
14524 (Output_section::is_relro_local): New function.
14525 (Output_section::set_is_relro_local): New function.
14526 (class Output_segment): Update declarations.
14527 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14528 * sparc.cc (Target_sparc::got_section): Likewise.
14529 * x86_64.cc (Target_x86_64::got_section): Likewise.
14530 * testsuite/relro_test_main.cc: New file.
14531 * testsuite/relro_test.cc: New file.
14532 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14533 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14534 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14535 (relro_test.so, relro_test_pic.o): New targets.
14536 * testsuite/Makefile.in: Rebuild.
14538 2008-05-16 Ian Lance Taylor <iant@google.com>
14540 * output.cc (Output_segment::add_output_section): Remove front
14542 * output.h (class Output_segment): Remove
14543 add_initial_output_section and overloaded add_output_section.
14544 Update declaration of remaining add_output_section.
14545 * layout.cc (Layout::create_interp): Call add_output_section
14546 rather than add_initial_output_section.
14547 (Layout::finish_dynamic_section): Likewise.
14549 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14550 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14551 know the dynamic type.
14552 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14553 field. Initialize it in constructor.
14554 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14555 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14556 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14559 * output.cc (Output_reloc::get_address): Change return type to
14561 * output.h (class Output_reloc): Update get_address declaration.
14562 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14563 for section addresses.
14565 2008-05-09 Ian Lance Taylor <iant@google.com>
14568 * gold.cc (gold_nomem): Use return value of write.
14570 2008-05-08 Ian Lance Taylor <iant@google.com>
14572 * symtab.c (Symbol::init_base_output_data): Add version
14573 parameter. Change all callers.
14574 (Symbol::init_base_output_segment): Likewise.
14575 (Symbol::init_base_constant): Likewise.
14576 (Symbol::init_base_undefined): Likewise.
14577 (Sized_symbol::init_output_data): Likewise.
14578 (Sized_symbol::init_output_segment): Likewise.
14579 (Sized_symbol::init_constant): Likewise.
14580 (Sized_symbol::init_undefined): Likewise.
14581 (Symbol_table::do_define_in_output_data): If the new symbol has a
14582 version, mark it as the default.
14583 (Symbol_table::do_define_in_output_segment): Likewise.
14584 (Symbol_table::do_define_as_constant): Likewise.
14585 * symtab.h (class Symbol): Update declarations.
14586 (class Sized_symbol): Likewise.
14587 * resolve.cc (Symbol::override_version): New function.
14588 (Symbol::override_base): Call override_version.
14589 (Symbol::override_base_with_special): Likewise.
14590 * testsuite/ver_script_8.script: New file.
14591 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14592 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14593 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14594 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14596 2008-05-06 Ian Lance Taylor <iant@google.com>
14599 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14601 (class General_options): Remove existing --undefined, and add
14602 --no-undefined instead. Add new --undefined as synonym for -u.
14603 * archive.cc (Archive::add_symbols): Check whether symbol was
14605 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14606 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14607 all uses. Add IS_UNDEFINED. Update declarations to split
14608 different versions of init_base. Declare init_base_undefined.
14609 (Symbol::is_defined): Handle IS_UNDEFINED.
14610 (Symbol::is_undefined): Likewise.
14611 (Symbol::is_weak_undefined): Call is_undefined.
14612 (Symbol::is_absolute): Handle IS_CONSTANT.
14613 (class Sized_symbol): Update declarations to split different
14614 versions of init. Declare init_undefined.
14615 (class Symbol_table): Declare new functions.
14616 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14617 Change all callers.
14618 (Symbol::init_base_output_data): Likewise.
14619 (Symbol::init_base_output_segment): Likewise.
14620 (Symbol::init_base_constant): Likewise.
14621 (Symbol::init_base_undefined): New function.
14622 (Sized_symbol::init_object): Rename from init. Change all
14624 (Sized_symbol::init_output_data): Likewise.
14625 (Sized_symbol::init_output_segment): Likewise.
14626 (Sized_symbol::init_constant): Likewise.
14627 (Sized_symbol::init_undefined): New function.
14628 (Symbol_table::add_undefined_symbols_from_command_line): New
14630 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14632 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14633 (Symbol::output_section): Likewise.
14634 (Symbol::set_output_section): Likewise.
14635 (Symbol_table::sized_finalize_symbol): Likewise.
14636 (Symbol_table::sized_write_globals): Likewise.
14637 * resolve.cc (Symbol_table::should_override): Likewise.
14638 (Symbol::override_base_with_special): Likewise.
14640 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14641 symbol, change it to have default visibility.
14642 * testsuite/protected_1.cc: New file.
14643 * testsuite/protected_2.cc: New file.
14644 * testsuite/protected_3.cc: New file.
14645 * testsuite/protected_main_1.cc: New file.
14646 * testsuite/protected_main_2.cc: New file.
14647 * testsuite/protected_main_3.cc: New file.
14648 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14649 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14650 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14651 (protected_1.so): New target.
14652 (protected_1_pic.o, protected_2_pic.o): New targets.
14653 (protected_3_pic.o): New target.
14654 (check_PROGRAMS): Add protected_2.
14655 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14656 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14657 * testsuite/Makefile.in: Rebuild.
14659 * options.h (DEFINE_var): Add set_user_set_##varname__.
14660 (DEFINE_bool_alias): New macro.
14661 (class General_options): Define -Bstatic using DEFINE_bool_alias
14662 rather than DEFINE_special. Add --undefined as an alias for -z
14664 * options.cc (General_options::parse_Bstatic): Remove.
14666 * options.h (class General_options): Add --fatal-warnings.
14667 * main.cc (main): Implement --fatal-warnings.
14668 * errors.h (Errors::warning_count): New function.
14670 * options.h (class General_options): Add -Bsymbolic-functions.
14671 * symtab.h (Symbol::is_preemptible): Check for
14672 -Bsymbolic-functions.
14674 2008-05-05 Ian Lance Taylor <iant@google.com>
14676 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14677 as noVARNAME rather than no-VARNAME.
14678 (class General_options): Add option -z combreloc.
14679 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14681 (Output_reloc::sort_before) [SHT_REL]: New function.
14682 (Output_reloc::sort_before) [SHT_RELA]: New function.
14683 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14684 Sort_relocs_comparison.
14685 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14686 parameter. Change all callers.
14687 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14688 sort_relocs parameter. Change all callers.
14689 * output.cc (Output_reloc::get_address): New function, broken out
14691 (Output_reloc::write_rel): Call it.
14692 (Output_reloc::compare): New function.
14693 (Output_data_reloc_base::do_write): Optionally sort relocs.
14695 * configure.ac: If targ_extra_obj is set, link it in.
14696 * configure.tgt: Initialize all variables.
14697 (x86_64*): Set targ_extra_obj and targ_extra_size.
14698 * configure: Rebuild.
14700 * object.cc (Sized_relobj::include_section_group): Adjust section
14701 indexes read from group data. Build vector to pass to
14703 * layout.cc (Layout::layout_group): Add flags and shndxes
14704 parameters. Remove contents parameter. Change caller. Update
14705 explicit instantiations.
14706 * layout.h (class Layout): Update layout_group declaration.
14707 * output.cc (Output_data_group::Output_data_group): Add flags and
14708 input_shndxes parameters. Remove contents parameter. Change
14710 (Output_data_group::do_write): Change input_sections_ to
14712 * output.h (class Output_data_group): Update constructor
14713 declaration. Rename input_sections_ to input_shndxes_.
14714 * testsuite/many_sections_test.cc: Add template.
14716 2008-04-30 Cary Coutant <ccoutant@google.com>
14718 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14720 * layout.cc (Layout::include_section): Refactored check for debug
14722 (Layout::add_comdat): Add new parameters. Change type
14723 of signature parameter. Add object and shndx to signatures table.
14724 (Layout::find_kept_object): New function.
14725 * layout.h: Include <cstring>.
14726 (Layout::is_debug_info_section): New function.
14727 (Layout::add_comdat): Add new parameters.
14728 (Layout::find_kept_object): New function.
14729 (Layout::Kept_section): New struct.
14730 (Layout::Signatures): Change type of map range.
14731 * object.cc (Relobj::output_section_address): New function.
14732 (Sized_relobj::include_section_group): Add new parameters. Change
14733 calls to Layout::add_comdat. Change to build table of kept comdat
14734 groups and table mapping discarded sections to kept sections.
14735 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14736 (Sized_relobj::do_layout): Change calls to include_section_group and
14737 include_linkonce_section.
14738 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14739 value to zero when section is discarded.
14740 (Sized_relobj::map_to_kept_section): New function.
14741 * object.h (Relobj::output_section_address): New function.
14742 (Relobj::Comdat_group): New type.
14743 (Relobj::find_comdat_group): New function.
14744 (Relobj::Comdat_group_table): New type.
14745 (Relobj::Kept_comdat_section): New type.
14746 (Relobj::Kept_comdat_section_table): New type.
14747 (Relobj::add_comdat_group): New function.
14748 (Relobj::set_kept_comdat_section): New function.
14749 (Relobj::get_kept_comdat_section): New function.
14750 (Relobj::comdat_groups_): New field.
14751 (Relobj::kept_comdat_sections_): New field.
14752 (Symbol_value::input_value): Update comment.
14753 (Sized_relobj::map_to_kept_section) New function.
14754 (Sized_relobj::include_linkonce_section): Add new parameter.
14755 * target-reloc.h (Comdat_behavior): New type.
14756 (get_comdat_behavior): New function.
14757 (relocate_section): Add code to map a discarded section to the
14758 corresponding kept section when applying a relocation.
14760 2008-04-30 Craig Silverstein <csilvers@google.com>
14762 * dwarf_reader.cc (next_generation_count): New static var.
14763 (Addr2line_cache_entry): New struct.
14764 (addr2line_cache): New static var.
14765 (Dwarf_line_info::one_addr2line): Added caching.
14766 (Dwarf_line_info::clear_addr2line_cache): New function.
14767 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14768 cache-size parameter.
14769 (Dwarf_line_info::one_addr2line_cache): New function.
14770 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14771 new cache-size argument to one_addr2line(), and clear cache.
14773 2008-04-28 Cary Coutant <ccoutant@google.com>
14775 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14776 R_386_PC8 relocations.
14778 2008-04-23 Ian Lance Taylor <iant@google.com>
14780 * object.cc (Sized_relobj::include_section_group): Check for
14781 invalid section group.
14783 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14786 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14787 than read for file header.
14788 * archive.cc (Archive::include_member): Likewise.
14790 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14792 * aclocal.m4: Regenerate.
14793 * configure: Regenerate.
14795 2008-04-19 Ian Lance Taylor <iant@google.com>
14797 * version.cc (version_string): Bump to 1.6.
14799 * testsuite/Makefile.am (many_sections_r_test): New target.
14800 (many_sections_r_test_SOURCES): Remove.
14801 (many_sections_r_test_DEPENDENCIES): Remove.
14802 (many_sections_r_test_LDFLAGS): Remove.
14803 (many_sections_r_test_LDADD): Remove.
14805 * object.cc (Sized_relobj::do_add_symbols): Always pass
14806 local_symbol_count_ to add_from_relobj.
14808 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14809 every thousand variables.
14810 * testsuite/Makefile.in: Rebuild.
14812 * object.cc (Xindex::initialize_symtab_xindex): New function.
14813 (Xindex::read_symtab_xindex): New function.
14814 (Xindex::sym_xindex_to_shndx): New function.
14815 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14817 (Sized_relobj::do_initialize_xindex): New function.
14818 (Sized_relobj::do_read_symbols): Adjust section links.
14819 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14820 parameter. Change all callers.
14821 (Sized_relobj::include_section_group): Adjust section links and
14822 symbol section indexes.
14823 (Sized_relobj::do_layout): Adjust section links.
14824 (Sized_relobj::do_count_local_symbols): Adjust section links and
14825 symbol section indexes.
14826 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14827 ordinary and special symbols.
14828 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14829 dynsym_xindex parameters. Change all callers. Adjust section
14830 links. Use SHN_XINDEX when needed.
14831 (Sized_relobj::get_symbol_location_info): Adjust section links.
14832 Don't get fooled by special symbols.
14833 * object.h (class Xindex): Define.
14834 (class Object): Add xindex_ parameter. Declare virtual functoin
14835 do_initialize_xindex.
14836 (Object::adjust_sym_shndx): New function.
14837 (Object::set_xindex): New protected function.
14838 (class Symbol_value): Add is_ordinary_shndx_ field.
14839 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14840 (Symbol_value::value): Assert ordinary section.
14841 (Symbol_value::initialize_input_to_output_map): Likewise.
14842 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14843 Change all callers.
14844 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14846 (class Sized_relobj): Update declarations.
14847 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14848 parameter. Change all callers.
14849 (Sized_relobj::adjust_shndx): New function.
14850 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14852 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14853 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14854 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14855 (Sized_dynobj::read_dynsym_section): Adjust section links.
14856 (Sized_dynobj::read_dynamic): Likewise.
14857 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14859 (Sized_dynobj::do_initialize_xindex): New function.
14860 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14861 do_initialize_xindex.
14862 (Sized_dynobj::adjust_shndx): New function.
14863 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14864 dynsym_xindex_ fields.
14865 (Layout::finalize): Add a call to set_section_indexes before
14866 creating the symtab sections.
14867 (Layout::set_section_indexes): Don't do anything if the section
14868 already has a section index.
14869 (Layout::create_symtab_sections): Add shnum parameter. Change
14870 caller. Create .symtab_shndx section if needed.
14871 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14873 (Layout::allocated_output_section_count): New function.
14874 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14876 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14877 fields. Update declarations.
14878 (Layout::symtab_xindex): New function.
14879 (Layout::dynsym_xindex): New function.
14880 (class Write_symbols_task): Add layout_ field.
14881 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14883 * output.cc (Output_section_headers::Output_section_headers): Add
14884 shstrtab_section parameter. Change all callers.
14885 (Output_section_headers::do_sized_write): Store overflow values
14886 for section count and section string table section index in
14887 section header zero.
14888 (Output_file_header::do_sized_write): Check for overflow of
14889 section count and section string table section index.
14890 (Output_symtab_xindex::do_write): New function.
14891 (Output_symtab_xindex::endian_do_write): New function.
14892 * output.h (class Output_section_headers): Add shstrtab_section_.
14893 Update declarations.
14894 (class Output_symtab_xindex): Define.
14895 (Output_section::has_out_shndx): New function.
14896 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14898 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14899 Change all callers.
14900 (Sized_symbol::init): Likewise.
14901 (Symbol::output_section): Check for ordinary symbol.
14902 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14903 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14905 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14906 Change all callers. Simplify handling of symbols from sections
14907 not included in the link.
14908 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14910 (Weak_alias_sorter::operator()): Assert that symbols are
14912 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14914 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14915 parameters. Change all callers.
14916 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14917 symbol distinction. Use SHN_XINDEX when needed.
14918 (Symbol_table::write_section_symbol): Add symtab_xindex
14919 parameter. Change all callers.
14920 (Symbol_table::sized_write_section_symbol): Likewise. Use
14921 SHN_XINDEX when needed.
14922 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14924 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14925 (Symbol::is_defined): Check is_ordinary.
14926 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14927 (Symbol::is_absolute, Symbol::is_common): Likewise.
14928 (class Sized_symbol): Update declarations.
14929 (class Symbol_table): Update declarations.
14930 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14931 parameters. Change all callers.
14932 (Sized_symbol::override): Likewise.
14933 (Symbol_table::override): Likewise.
14934 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14935 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14936 is_ordinary, and orig_st_shndx parameters. Change all callers.
14937 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14938 to be in an ordinary section.
14939 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14940 object and is_ordinary parameters. Change all callers.
14941 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14942 Change all callers. Don't add undefined or non-ordinary symbols
14944 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14945 Change all callers.
14946 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14948 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14949 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14950 (Sized_relobj::relocate_sections): Likewise.
14951 * target-reloc.h (scan_relocs): Adjust section symbol index.
14952 (scan_relocatable_relocs): Likewise.
14953 * i386.cc (Scan::local): Check for ordinary symbols.
14954 * sparc.cc (Scan::local): Likewise.
14955 * x86_64.cc (Scan::local): Likewise.
14956 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14957 to symbol_section_and_value.
14958 * testsuite/many_sections_test.cc: New file.
14959 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14960 (check_PROGRAMS): Add many_sections_test.
14961 (many_sections_test_SOURCES): Define.
14962 (many_sections_test_DEPENDENCIES): Define.
14963 (many_sections_test_LDFLAGS): Define.
14964 (BUILT_SOURCES): Add many_sections_define.h.
14965 (many_sections_define.h): New target.
14966 (BUILT_SOURCES): Add many_sections_check.h.
14967 (many_sections_check.h): New target.
14968 (check_PROGRAMS): Add many_sections_r_test.
14969 (many_sections_r_test_SOURCES): Define.
14970 (many_sections_r_test_DEPENDENCIES): Define.
14971 (many_sections_r_test_LDFLAGS): Define.
14972 (many_sections_r_test_LDADD): Define.
14973 (many_sections_r_test.o): New target.
14974 * testsuite/Makefile.in: Rebuild.
14976 2008-04-17 Cary Coutant <ccoutant@google.com>
14978 * errors.cc (Errors::info): New function.
14979 (gold_info): New function.
14980 * errors.h (Errors::info): New function.
14981 * gold.h (gold_info): New function.
14982 * object.cc (Input_objects::add_object): Print trace output.
14983 * options.cc (options::parse_set): New function.
14984 (General_options::parse_wrap): Deleted.
14985 (General_options::General_options): Deleted initializer.
14986 * options.h (options::String_set): New typedef.
14987 (options::parse_set): New function.
14988 (DEFINE_set): New macro.
14989 (General_options::wrap): Changed to use DEFINE_set. Changed
14990 callers of any_wrap_symbols and is_wrap_symbol.
14991 (General_options::trace, General_options::trace_symbol):
14993 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14994 (General_options::wrap_symbols_): Deleted.
14995 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14997 2008-04-17 David S. Miller <davem@davemloft.net>
14999 * options.cc (General_options::parse_V): New function.
15000 * options.h: Add entries for -V and -Qy.
15002 2008-04-17 Ian Lance Taylor <iant@google.com>
15004 * common.cc (Symbol_table::allocate_commons): Remove options
15005 parameter. Change caller.
15006 (Symbol_table::do_allocate_commons): Remove options parameter.
15007 Change caller. Just call do_allocate_commons_list twice.
15008 (Symbol_table::do_allocate_commons_list): New function, broken out
15009 of do_allocate_commons.
15010 * common.h (class Allocate_commons_task): Remove options_ field.
15011 Update constructor.
15012 * symtab.cc (Symbol_table::Symbol_table): Initialize
15014 (Symbol_table::add_from_object): Put TLS common symbols on
15016 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15017 which are IN_OUTPUT_DATA.
15018 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15019 allocate_commons and do_allocate_commons declarations. Declare
15020 do_allocate_commons_list.
15021 * gold.cc (queue_middle_tasks): Update creation of
15022 Allocate_commons_task to not pass options.
15023 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15024 (TLS_TEST_C_FLAGS): New variable.
15025 (tls_test_c_pic.o): New target.
15026 (tls_test_shared.so): Link in tls_test_c_pic.o.
15027 (tls_test_c_pic_ie.o): New target.
15028 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15029 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15030 (tls_test_c.o): New target.
15031 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15032 (tls_pic_test_LDADD): Likewise.
15033 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15034 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15035 (tls_test_c_gnu2.o): New target.
15036 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15038 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15039 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15040 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15041 * testsuite/tls_test.cc: Include "config.h".
15042 (t_last): Call t11_last.
15043 * testsuite/tls_test.h (t11, t11_last): Declare.
15044 * testsuite/tls_test_c.c: New file.
15045 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15046 * configure.ac: Check for OpenMP support.
15047 * configure, config.in, Makefile.in: Rebuild.
15048 * testsuite/Makefile.in: Rebuild.
15050 2008-04-16 Cary Coutant <ccoutant@google.com>
15052 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15053 (Target_i386::tls_base_symbol_defined_): New field.
15054 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15055 (Target_i386::Scan::global): Likewise.
15056 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15057 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15058 (Target_x86_64::tls_base_symbol_defined_): New field.
15059 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15060 (Target_x86_64::Scan::global): Likewise.
15062 2008-04-16 Cary Coutant <ccoutant@google.com>
15064 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15065 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15066 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15067 building shared libraries.
15068 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15069 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15070 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15071 * testsuite/Makefile.in: Rebuild.
15072 * testsuite/weak_undef.h: New file.
15073 * testsuite/weak_undef_file1.cc: Add extra test cases.
15074 * testsuite/weak_undef_file2.cc: Likewise.
15075 * testsuite/weak_undef_test.cc: Likewise.
15077 2008-04-16 David S. Miller <davem@davemloft.net>
15079 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15080 Add issued_non_pic_error_ field. Declare check_non_pic.
15081 (Target_sparc::Scan::check_non_pic): New function.
15082 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15083 (Target_sparc::Scan::global): Likewise.
15085 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15086 * configure: Rebuild.
15088 * options.h (DEFINE_enable): New macro.
15089 (new_dtags): New enable option.
15090 (initfirst, interpose, loadfltr, nodefaultlib,
15091 nodelete, nodlopen, nodump): New -z options.
15092 * layout.cc (Layout:finish_dynamic_section): If new
15093 dtags enabled, emit DT_RUNPATH. Also, emit a
15094 DT_FLAGS_1 containing any specified -z flags.
15096 2008-04-16 Ian Lance Taylor <iant@google.com>
15098 * copy-relocs.cc: New file.
15099 * copy-relocs.h: New file.
15100 * reloc.cc: Remove Copy_relocs code.
15101 * reloc.h: Likewise.
15102 * reloc-types.h (struct Reloc_types) [both versions]: Add
15103 get_reloc_addend_noerror.
15104 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15105 variants of add_global which take an addend which must be zero.
15106 * i386.cc: Include "copy-relocs.h".
15107 (class Target_i386): Change type of copy_relocs_ to variable,
15108 update initializer.
15109 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15110 Change all callers.
15111 (Target_i386::do_finalize_sections): Change handling of
15113 * sparc.cc: Include "copy-relocs.h".
15114 (class Target_sparc): Change type of copy_relocs_ to variable,
15115 update initializer.
15116 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15117 Change all callers.
15118 (Target_sparc::do_finalize_sections): Change handling of
15120 * x86_64.cc: Include "copy-relocs.h".
15121 (class Target_x86_64): Change type of copy_relocs_ to variable,
15122 update initializer.
15123 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15124 class. Change all callers.
15125 (Target_x86_64::do_finalize_sections): Change handling of
15127 * Makefile.am (CCFILES): Add copy-relocs.cc.
15128 (HFILES): Add copy-relocs.h.
15130 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15132 * testsuite/script_test_4.sh: Permit leading zeroes.
15134 2008-04-15 Ian Lance Taylor <iant@google.com>
15136 * script-sections.cc (Script_sections::create_segments): Use
15137 header_size_adjustment even when there is enough room for the
15139 * testsuite/script_test_4.sh: New file.
15140 * testsuite/script_test_4.t: New file.
15141 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15142 (check_DATA): Add script_test_4.stdout.
15143 (MOSTLYCLEANFILES): Likewise.
15144 (script_test_4): New target.
15145 (script_test_4.stdout): New target.
15146 * testsuite/Makefile.in: Rebuild.
15148 * sparc.cc: Add definitions for Output_data_plt_sparc class
15151 2008-04-14 David S. Miller <davem@davemloft.net>
15153 * sparc.cc: New file.
15154 * Makefile.am (TARGETSOURCES): Add sparc.cc
15155 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15156 * configure.tgt: Document targ_extra_size and
15157 targ_extra_big_endian. Add entries for sparc-* and
15159 * configure.ac: Handle targ_extra_size and
15160 targ_extra_big_endian.
15161 * Makefile.in: Rebuild.
15162 * configure: Likewise.
15163 * po/POTFILES.in: Likewise.
15164 * po/gold.pot: Likewise.
15166 2008-04-14 Ian Lance Taylor <iant@google.com>
15168 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15169 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15170 in the name/type/flags to section mapping. Don't call
15171 allocate_output_section.
15172 (Layout::choose_output_section): Change parameter from adjust_name
15173 to is_input_section. Don't permit input sections after sections
15174 are attached to segments. Don't call allocate_output_section.
15175 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15176 not write_enable_output_section.
15177 (Layout::make_output_section): Don't push to
15178 unattached_section_list_ nor call attach_to_segment. Call
15179 attach_section_to_segment if sections are attached.
15180 (Layout::attach_sections_to_segments): New function.
15181 (Layout::attach_section_to_segment): New function.
15182 (Layout::attach_allocated_section_to_segment): Rename from
15183 attach_to_segment. Remove flags parameter.
15184 (Layout::allocate_output_section): Remove function.
15185 (Layout::write_enable_output_section): Remove function.
15186 * layout.h (class Layout): Update for above changes. Add new
15187 field sections_are_attached_.
15188 * output.h (Output_section::update_flags_for_input_section): New
15190 * output.cc (Output_section::add_input_section): Call
15191 update_flags_for_input_section.
15192 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15194 2008-04-11 Cary Coutant <ccoutant@google.com>
15196 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15197 thought unnecessary.
15198 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15200 2008-04-11 Ian Lance Taylor <iant@google.com>
15202 * output.h (class Output_section_data): Remove inline definition
15204 * output.cc (Output_section_data::set_addralign): New function.
15206 2008-04-11 Cary Coutant <ccoutant@google.com>
15208 Add support for TLS descriptors for i386 and x86_64.
15209 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15210 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15211 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15213 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15214 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15215 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15217 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15218 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15219 Fix problem with initial-exec relocations.
15220 (Target_i386::Relocate::relocate_tls): Likewise.
15221 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15223 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15224 support for section-plus-offset dynamic table entries.
15225 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15226 (Output_data_dynamic::Dynamic_entry): Add support for
15227 section-plus-offset dynamic table entries.
15228 (Output_data_dynamic::Classification): Likewise.
15229 (Output_data_dynamic::classification_): Renamed offset_.
15230 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15231 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15232 (Target_x86_64::make_plt_section): New function.
15233 (Target_x86_64::reserve_tlsdesc_entries): New function.
15234 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15235 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15236 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15237 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15238 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15239 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15240 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15241 add extra PLT entry for TLS descriptors.
15242 (Output_data_plt_x86_64::got_): New field.
15243 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15244 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15246 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15248 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15249 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15250 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15251 R_386_TLS_DESC_CALL relocations.
15252 (Target_x86_64::Scan::global): Likewise.
15253 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15254 for TLS descriptors.
15255 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15256 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15257 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15258 GD-to-IE relaxation.
15259 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15260 and TLS_DESCRIPTORS.
15261 * Makefile.in: Rebuild.
15262 * configure: Rebuild.
15263 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15264 (tls_test_shared2.so): New target.
15265 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15266 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15267 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15268 (tls_shared_gd_to_ie_test_LDADD): New variable.
15269 (tls_shared_gnu2_gd_to_ie_test): New target.
15270 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15272 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15273 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15274 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15275 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15276 (tls_shared_gnu2_test): New target.
15277 (tls_test_gnu2_shared.so): New target.
15278 (tls_shared_gnu2_test_SOURCES): New variable.
15279 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15280 (tls_shared_gnu2_test_LDFLAGS): New variable.
15281 (tls_shared_gnu2_test_LDADD): New variable.
15282 * testsuite/Makefile.in: Rebuild.
15283 * testsuite/Makefile.
15285 2008-04-11 Ian Lance Taylor <iant@google.com>
15287 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15289 * testsuite/Makefile.in: Rebuild.
15291 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15293 * testsuite/script_test_2.cc (main): Adjust test.
15295 2008-04-11 David S. Miller <davem@davemloft.net>
15296 Ian Lance Taylor <iant@google.com>
15298 * options.h (General_options): Add entries for '-Y' and
15300 * options.cc (General_options:finalize): If -Y was used, add those
15301 entries to the library path instead of the default "/lib" and
15304 2008-04-11 David S. Miller <davem@davemloft.net>
15306 * testsuite/justsyms.t: Start at 0x100.
15307 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15308 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15310 * testsuite/script_test_2.cc: Adjust string and section length
15313 2008-04-09 Ian Lance Taylor <iant@google.com>
15316 * script-sections.cc (Sections_element::allocate_to_segment): Add
15318 (Output_section_definition::allocate_to_segment): Likewise.
15319 (Orphan_output_section::allocate_to_segment): Likewise.
15320 (Script_sections::attach_sections_using_phdrs_clause): Don't
15321 propagate non-PT_LOAD segments to orphan sections.
15322 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15323 readelf rather than objdump.
15324 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15325 .interp section and PT_INTERP segment are the same size.
15326 * testsuite/Makefile.in: Rebuild.
15328 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15329 aliases for symbols defined in the same object.
15330 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15331 (weak_alias_test_SOURCES): New variable.
15332 (weak_alias_test_DEPENDENCIES): New variable.
15333 (weak_alias_test_LDFLAGS): New variable.
15334 (weak_alias_test_LDADD): New variable.
15335 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15336 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15337 (weak_alias_test_3.o): New target.
15338 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15339 * testsuite/weak_alias_test_main.cc: New file.
15340 * testsuite/weak_alias_test_1.cc: New file.
15341 * testsuite/weak_alias_test_2.cc: New file.
15342 * testsuite/weak_alias_test_3.cc: New file.
15344 2008-04-08 Ian Lance Taylor <iant@google.com>
15346 * options.h (class General_options): Add --noinhibit-exec option.
15347 * main.cc (main): Check --noinhibit-exec.
15349 * options.h (class General_options): Define --wrap as a special
15350 option. Add wrap_symbols_ field.
15351 (General_options::any_wrap_symbols): New function.
15352 (General_options::is_wrap_symbol): New function.
15353 * options.cc (General_options::parse_wrap): New function.
15354 (General_options::General_options): Initialize wrap_symbols_.
15355 * symtab.cc (Symbol_table::wrap_symbol): New function.
15356 (Symbol_table::add_from_object): Handle --wrap.
15357 * symtab.h (class Symbol_table): Declare wrap_symbol.
15358 * target.h (Target::wrap_char): New function.
15359 (Target::Target_info): Add wrap_char field.
15360 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15361 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15362 * testsuite/testfile.cc (Target_test::test_target_info):
15365 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15368 * layout.h (class Layout): Add added_eh_frame_data_ field.
15369 * layout.cc (Layout::Layout): Initialize new field.
15370 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15371 output section until we find a section we merged successfully.
15372 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15373 that the size be non-zero.
15375 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15378 2008-04-08 Craig Silverstein <csilvers@google.com>
15380 * configure.ac: Export new conditional variable HAVE_ZLIB.
15381 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15383 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15384 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15386 2008-04-07 Ian Lance Taylor <iant@google.com>
15388 * version.cc (version_string): Set to "1.5".
15390 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15391 Add issued_non_pic_error_ field. Declare check_non_pic.
15392 (Target_x86_64::Scan::check_non_pic): New function.
15393 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15394 (Target_x86_64::Scan::global): Likewise.
15396 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15397 addend parameter. Change caller. Handle merge sections.
15398 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15399 Address to Addend. Don't add in the result of
15400 local_section_offset, pass down the addend and use the returned
15402 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15403 Update declarations of local_section_offset and symbol_value.
15404 * testsuite/two_file_test_1.cc (t18): New function.
15405 * testsuite/two_file_test_2.cc (f18): New function.
15406 * testsuite/two_file_test_main.cc (main): Call t18.
15407 * testsuite/two_file_test.h (t18, f18): Declare.
15409 * configure.ac: Don't test for objdump, c++filt, or readelf.
15410 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15412 (TEST_READELF): New variable.
15413 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15414 (check_PROGRAMS): Add two_file_strip_test.
15415 (two_file_strip_test): New target.
15416 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15417 (two_file_same_shared_strip_test_SOURCES): New variable.
15418 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15419 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15420 (two_file_same_shared_strip_test_LDADD): New variable.
15421 (two_file_shared_strip.so): New target.
15422 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15423 (ver_test_5.syms, ver_test_7.syms): Likewise.
15424 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15425 (strip_test_3.stdout): Use TEST_OBJDUMP.
15426 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15428 2008-04-04 Cary Coutant <ccoutant@google.com>
15430 * symtab.h (Symbol::is_weak_undefined): New function.
15431 (Symbol::is_strong_undefined): New function.
15432 (Symbol::is_absolute): New function.
15433 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15434 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15436 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15437 (weak_undef_test): New target.
15438 * testsuite/Makefile.in: Rebuild.
15439 * testsuite/weak_undef_file1.cc: New file.
15440 * testsuite/weak_undef_file2.cc: New file.
15441 * testsuite/weak_undef_test.cc: New file.
15443 2008-04-03 Craig Silverstein <csilvers@google.com>
15445 * compressed_output.h (class Output_compressed_section): Use
15447 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15449 (zlib_compressed_suffix): Removed.
15450 (Output_compressed_section::set_final_data_size): Use unsigned
15452 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15453 Fix linker invocation.
15454 (flagstest_o_specialfile_and_compress_debug_sections):
15456 * testsuite/Makefile.in: Regenerated.
15458 2008-04-02 David S. Miller <davem@davemloft.net>
15460 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15461 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15463 2008-04-02 Craig Silverstein <csilvers@google.com>
15467 2008-04-02 Ian Lance Taylor <iant@google.com>
15469 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15470 parameters. Update for new key type to views_. Change all
15472 (File_read::read): Adjust for byteshift in returned view.
15473 (File_read::add_view): New function, broken out of
15474 find_and_make_view.
15475 (File_read::make_view): New function, broken out of
15476 find_and_make_view.
15477 (File_read::find_or_make_view): Add offset and aligned
15478 parameters. Rewrite accordingly. Change all callers.
15479 (File_read::get_view): Add offset and aligned parameters. Adjust
15480 for byteshift in return value.
15481 (File_read::get_lasting_view): Likewise.
15482 * fileread.h (class File_read): Update declarations.
15483 (class File_read::View): Add byteshift_ field. Add byteshift to
15484 constructor. Add byteshift method.
15485 * archive.h (Archive::clear_uncached_views): New function.
15486 (Archive::get_view): Add aligned parameter. Change all callers.
15487 * object.h (Object::get_view): Add aligned parameter. Change all
15489 (Object::get_lasting_view): Likewise.
15491 * fileread.cc (File_read::release): Don't call clear_views if
15492 there are multiple objects.
15493 * fileread.h (File_read::clear_uncached_views): New function.
15494 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15497 2008-03-31 Cary Coutant <ccoutant@google.com>
15499 Add thin archive support.
15500 * archive.cc (Archive::armagt): New const.
15501 (Archive::setup): Remove task parameter and calls to unlock.
15502 (Archive::unlock_nested_archives): New function.
15503 (Archive::read_header): Add nested_off parameter. Change
15505 (Archive::interpret_header): Likewise.
15506 (Archive::include_all_members): Change to handle thin
15508 (Archive::include_member): Likewise.
15509 * archive.h (Archive::Archive): Add new parameters and
15511 (Archive::armagt): New const.
15512 (Archive::setup): Remove task parameter.
15513 (Archive::unlock_nested_archives): New function.
15514 (Archive::read_header): Add nested_off parameter.
15515 (Archive::interpret_header): Likewise.
15516 (Archive::Nested_archive_table): New typedef.
15517 (Archive::is_thin_archive_): New field.
15518 (Archive::nested_archives_): New field.
15519 (Archive::options_): New field.
15520 (Archive::dirpath_): New field.
15521 (Archive::task_): New field.
15522 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15523 for thin archives. Pass additional parameters to
15524 Archive::Archive. Unlock the archive file after calling
15527 2008-03-29 Ian Lance Taylor <iant@google.com>
15529 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15530 version symbol to be local.
15531 * testsuite/ver_test_4.sh: New file.
15532 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15533 (check_DATA): Add ver_test_4.syms.
15534 (ver_test_4.syms): New target.
15535 * testsuite/Makefile.in: Rebuild.
15538 (Output_section::Input_section_sort_entry::has_priority): New
15540 (Output_section::Input_section_sort_entry::match_file_name): New
15542 (Output_section::Input_section_sort_entry::match_section_name):
15544 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15546 (Output_section::Input_section_sort_entry::match_section_file):
15548 (Output_section::Input_section_sort_compare::operator()): Rewrite
15549 using new Input_section_sort_entry functions. Sort crtbegin and
15550 crtend first. Sort sections with no priority before sections with
15552 * testsuite/initpri1.c (d3): Check j != 4.
15553 (cd5): New constructor/destructor function.
15554 (main): Check j != 2.
15556 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15557 new symbol when resolving, don't call set_is_default.
15558 * testsuite/ver_test_7.cc: New file.
15559 * testsuite/ver_test_7.sh: New file.
15560 * testsuite/Makefile.am (ver_test_7.so): New target.
15561 (ver_test_7.o): New target.
15562 (check_SCRIPTS): Add ver_test_7.sh.
15563 (check_DATA): Add ver_test_7.syms.
15564 (ver_test_7.syms): New target.
15566 2008-03-28 Ian Lance Taylor <iant@google.com>
15568 * layout.cc (Layout::layout): If we see an input section with a
15569 name that needs sorting, set the must_sort flag for the output
15571 (Layout::make_output_section): If the name of the output section
15572 indicates that it might require sorting, set the may_sort flag.
15573 * output.h (Output_section::may_sort_attached_input_sections): New
15575 (Output_section::set_may_sort_attached_input_sections): New
15577 (Output_section::must_sort_attached_input_sections): New
15579 (Output_section::set_must_sort_attached_input_sections): New
15581 (class Output_section): Declare Input_section_sort_entry. Define
15582 Input_section_sort_compare. Declare
15583 sort_attached_input_sections. Add new fields:
15584 may_sort_attached_input_sections_,
15585 must_sort_attached_input_sections_,
15586 attached_input_sections_are_sorted_.
15587 * output.cc (Output_section::Output_section): Initialize new
15589 (Output_section::add_input_section): Add an entry to
15590 input_sections_ if may_sort or must_sort are true.
15591 (Output_section::set_final_data_size): Call
15592 sort_attached_input_sections if necessary.
15593 (Output_section::Input_section_sort_entry): Define new class.
15594 (Output_section::Input_section_sort_compare::operator()): New
15596 (Output_section::sort_attached_input_sections): New function.
15597 * configure.ac: Check whether the compiler supports constructor
15598 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15599 * testsuite/initpri1.c: New file.
15600 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15601 CONSTRUCTOR_PRIORITY.
15602 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15603 (initpri1_LDFLAGS): New variable.
15604 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15606 2008-03-27 Ian Lance Taylor <iant@google.com>
15608 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15609 * testsuite/common_test_1.c: New file.
15610 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15611 (common_test_1_SOURCES): New variable.
15612 (common_test_1_DEPENDENCIES): New variable.
15613 (common_test_1_LDFLAGS): New variable.
15615 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15616 and commons_ correctly when NAME/VERSION does not override
15618 * testsuite/ver_test_6.c: New file.
15619 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15620 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15621 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15623 2008-03-26 Ian Lance Taylor <iant@google.com>
15625 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15626 of an undefined symbol from a version script.
15627 * testsuite/Makefile.am (ver_test_5.so): New target.
15628 (ver_test_5.o): New target.
15629 (check_SCRIPTS): Add ver_test_5.sh.
15630 (check_DATA): Add ver_test_5.syms.
15631 (ver_test_5.syms): New target.
15632 * testsuite/ver_test_5.cc: New file.
15633 * testsuite/ver_test_5.script: New file.
15634 * testsuite/ver_test_5.sh: New file.
15635 * Makefile.in, testsuite/Makefile.in: Rebuild.
15638 Fix problems building gold with gcc 4.3.0.
15639 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15640 (gold_error_at_location, gold_warning_at_location): Use it.
15641 * configure.ac: Check whether we can compile and use a template
15642 function with a printf attribute.
15643 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15644 when jumping over bytes.
15645 * object.cc: Instantiate Object::read_section_data.
15646 * debug.h: Include <cstring>
15647 * dwarf_reader.cc: Include <algorithm>
15648 * main.cc: Include <cstring>.
15649 * options.cc: Include <cstring>.
15650 * output.cc: Include <cstring>.
15651 * script.cc: Include <cstring>.
15652 * script.h: Include <string>.
15653 * symtab.cc: Include <cstring> and <algorithm>.
15654 * target-select.cc: Include <cstring>.
15655 * version.cc: Include <string>.
15656 * testsuite/testmain.cc: Include <cstdlib>.
15657 * configure, config.in: Rebuild.
15659 2008-03-25 Ian Lance Taylor <iant@google.com>
15661 * options.cc: Include "../bfd/bfdver.h".
15662 (options::help): Print bug reporting address.
15664 * version.cc (print_version): Adjust output for current value of
15665 BFD_VERSION_STRING.
15669 * options.cc (options::help): Print list of supported targets.
15670 * target-select.h: Include <vector>.
15671 (class Target_selector): Make machine_, size_, and is_big_endian_
15672 fields const. Add bfd_name_ and instantiated_target_ fields.
15673 (Target_selector::Target_selector): Add bfd_name parameter.
15674 (Target_selector::recognize): Make non-virtual, call
15676 (Target_selector::recognize_by_name): Make non-virtual, call
15677 do_recognize_by_name.
15678 (Target_selector::supported_names): New function.
15679 (Target_selector::bfd_name): New function.
15680 (Target_selector::do_instantiate_target): New pure virtual
15682 (Target_selector::do_recognize): New virtual function.
15683 (Target_selector::do_recognize_by_name): New virtual function.
15684 (Target_selector::instantiate_target): New private function.
15685 (supported_target_names): Declare.
15686 * target-select.cc (Target_selector::Target_selector): Update for
15687 new parameter and fields.
15688 (select_target_by_name): Check that the name matches before
15689 calling recognize_by_name.
15690 (supported_target_names): New function.
15691 * i386.cc (class Target_selector_i386): Update Target_selector
15692 constructor call. Remove recognize and recognize_by_name. Add
15693 do_instantiate_target.
15694 * x86_64.cc (class Target_selector_x86_64): Likewise.
15695 * testsuite/testfile.cc (class Target_selector_test): Update for
15696 changes to Target_selector.
15698 * README: Rewrite, with some notes on unsupported features.
15700 2008-03-24 Cary Coutant <ccoutant@google.com>
15702 * i386.cc (Target_i386::Got_type): New enum declaration.
15703 (Target_i386::Scan::local): Updated callers of Output_data_got
15705 (Target_i386::Scan::global): Likewise.
15706 (Target_i386::Relocate::relocate): Likewise.
15707 (Target_i386::Relocate::relocate_tls): Likewise.
15708 * object.h (Got_offset_list): New class.
15709 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15710 (Sized_relobj::local_got_offset): Likewise.
15711 (Sized_relobj::set_local_got_offset): Likewise.
15712 (Sized_relobj::local_has_tls_got_offset): Removed.
15713 (Sized_relobj::local_tls_got_offset): Removed.
15714 (Sized_relobj::set_local_tls_got_offset): Removed.
15715 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15716 * output.cc (Output_data_got::add_global): Added got_type parameter.
15717 (Output_data_got::add_global_with_rel): Likewise.
15718 (Output_data_got::add_global_with_rela): Likewise.
15719 (Output_data_got::add_global_pair_with_rel): New function.
15720 (Output_data_got::add_global_pair_with_rela): New function.
15721 (Output_data_got::add_local): Added got_type parameter.
15722 (Output_data_got::add_local_with_rel): Likewise.
15723 (Output_data_got::add_local_with_rela): Likewise.
15724 (Output_data_got::add_local_pair_with_rel): New function.
15725 (Output_data_got::add_local_pair_with_rela): New function.
15726 (Output_data_got::add_global_tls): Removed.
15727 (Output_data_got::add_global_tls_with_rel): Removed.
15728 (Output_data_got::add_global_tls_with_rela): Removed.
15729 (Output_data_got::add_local_tls): Removed.
15730 (Output_data_got::add_local_tls_with_rel): Removed.
15731 (Output_data_got::add_local_tls_with_rela): Removed.
15732 * output.h (Output_data_got::add_global): Added got_type parameter.
15733 (Output_data_got::add_global_with_rel): Likewise.
15734 (Output_data_got::add_global_with_rela): Likewise.
15735 (Output_data_got::add_global_pair_with_rel): New function.
15736 (Output_data_got::add_global_pair_with_rela): New function.
15737 (Output_data_got::add_local): Added got_type parameter.
15738 (Output_data_got::add_local_with_rel): Likewise.
15739 (Output_data_got::add_local_with_rela): Likewise.
15740 (Output_data_got::add_local_pair_with_rel): New function.
15741 (Output_data_got::add_local_pair_with_rela): New function.
15742 (Output_data_got::add_global_tls): Removed.
15743 (Output_data_got::add_global_tls_with_rel): Removed.
15744 (Output_data_got::add_global_tls_with_rela): Removed.
15745 (Output_data_got::add_local_tls): Removed.
15746 (Output_data_got::add_local_tls_with_rel): Removed.
15747 (Output_data_got::add_local_tls_with_rela): Removed.
15748 * resolve.cc (Symbol::override_base_with_special): Removed
15749 reference to has_got_offset_ field.
15750 * symtab.cc (Symbol::init_fields): Replaced initialization
15751 of got_offset_ with got_offsets_. Removed initialization
15753 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15754 (Symbol::got_offset): Likewise.
15755 (Symbol::set_got_offset): Likewise.
15756 (Symbol::has_tls_got_offset): Removed.
15757 (Symbol::tls_got_offset): Removed.
15758 (Symbol::set_tls_got_offset): Removed.
15759 (Symbol::got_offset_): Removed.
15760 (Symbol::tls_mod_got_offset_): Removed.
15761 (Symbol::tls_pair_got_offset_): Removed.
15762 (Symbol::got_offsets_): New field.
15763 (Symbol::has_got_offset): Removed.
15764 (Symbol::has_tls_mod_got_offset): Removed.
15765 (Symbol::has_tls_pair_got_offset): Removed.
15766 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15767 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15769 (Target_x86_64::Scan::global): Likewise.
15770 (Target_x86_64::Relocate::relocate): Likewise.
15771 (Target_x86_64::Relocate::relocate_tls): Likewise.
15773 2008-03-25 Ben Elliston <bje@au.ibm.com>
15775 * yyscript.y: Fix spelling error in comment.
15777 2008-03-24 Ian Lance Taylor <iant@google.com>
15779 * options.h (class General_options): Define build_id option.
15780 * layout.h (class Layout): Declare write_build_id, create_note,
15781 create_build_id. Add build_id_note_ member.
15782 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15783 "libiberty.h", "md5.h", "sha1.h".
15784 (Layout::Layout): Initialize eh_frame_data_,
15785 eh_frame_hdr_section_, and build_id_note_.
15786 (Layout::finalize): Call create_build_id.
15787 (Layout::create_note): New function, broken out of
15788 Layout::create_gold_note.
15789 (Layout::create_gold_note): Call create_note.
15790 (Layout::create_build_id): New function.
15791 (Layout::write_build_id): New function.
15792 (Close_task_runner::run): Call write_build_id.
15794 * x86_64.cc: Correct license to GPLv3.
15796 2008-03-23 Ian Lance Taylor <iant@google.com>
15798 * options.cc: Include "demangle.h".
15799 (parse_optional_string): New function.
15800 (parse_long_option): Handle takes_optional_argument.
15801 (parse_short_option): Update dash_z initializer. Handle
15802 takes_optional_argument.
15803 (General_options::General_options): Initialize do_demangle_.
15804 (General_options::finalize): Set do_demangle_. Handle demangling
15806 * options.h (parse_optional_string): Declare.
15807 (struct One_option): Add optional_arg field. Update constructor.
15808 Update call constructor calls. Add takes_optional_argument
15810 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15811 (DEFINE_optional_string): Define.
15812 (General_options::demangle): Change from DEFINE_bool to
15813 DEFINE_optional_string.
15814 (General_options::no_demangle): New function.
15815 (General_options::do_demangle): New function.
15816 (General_options::set_do_demangle): New function.
15817 (General_options::execstack_status_): Move definition to end of
15819 (General_options::static_): Likewise.
15820 (General_options::do_demangle_): New field.
15821 * object.cc (big_endian>::get_symbol_location_info): Call
15822 Options::do_demangle, not Options::demangle.
15823 * symtab.cc (demangle): Likewise.
15825 2008-03-22 Ian Lance Taylor <iant@google.com>
15827 * gold.h: Include <cstddef> and <sys/types.h>
15828 * options.h: Include <cstring>.
15830 2008-03-21 Ian Lance Taylor <iant@google.com>
15832 * Added source code to GNU binutils.
15834 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15836 Copying and distribution of this file, with or without modification,
15837 are permitted in any medium without royalty provided the copyright
15838 notice and this notice are preserved.
15844 version-control: never