summaryrefslogtreecommitdiff
path: root/gold/layout.cc
AgeCommit message (Collapse)Author
2018-01-03Update year range in copyright notice of binutils filesAlan Modra
2017-11-08gold: Ignore def/ref from a dynamic object for special symbolsH.J. Lu
Since special symbol must be defined in a regular object, definition from a dynamic object should be ignored. If special symbol has the hidden or internal visibility, reference from a dynamic object should also be ignored. Also __start and __stop symbols in a dynamic object shouldn't be preempted. PR gold/22291 * layout.cc (Layout::define_section_symbols): Use STV_PROTECTED for __start and __stop symbols. * symtab.cc (Symbol_table::define_special_symbol): Add an argument, visibility. Ignore definition and reference from a dynamic object, depending on visibility. (Symbol_table::do_define_in_output_data): Pass visibility to define_special_symbol. (Symbol_table::do_define_in_output_segment): Likewise. (Symbol_table::do_define_as_constant): Likewise. (Symbol_table::add_undefined_symbol_from_command_line): Pass STV_DEFAULT to define_special_symbol. * symtab.h (Symbol_table::define_special_symbol): Add an argument, visibility.
2017-10-20New gold linker option -z,text-unlikely-segment.Sriraman Tallam
2017-10-04 Sriraman Tallam <tmsriram@google.com> * options.h (-z,text_unlikely_segment): New option. * layout.cc (Layout::layout): Create new output section for .text.unlikely sections with the new option. (Layout::segment_precedes): Check for the new option when segment flags match. * testsuite/text_unlikely_segment.cc: New test source. * testsuite/text_unlikely_segment.sh: New test script. * testsuite/Makefile.am (text_unlikely_segment): New test. * testsuite/Makefile.in: Regenerate.
2017-08-01[GOLD] PowerPC recreate eh_frame for stubs on each relax passAlan Modra
There is a very small but non-zero probability that a stub group contains stubs on one relax pass, but does not on the next. In that case we would get an FDE covering a zero length address range. (Actually, it's even worse. Alignment padding for stubs can mean the address for the non-existent stubs is past the end of the original section to which stubs are attached, and due to the way do_plt_fde_location calculates the length we can get a negative length.) Fixing this properly requires removing the FDE. Also, I have been implementing the __tls_get_addr_opt support for gold, and that stub needs something other than the default FDE. The necessary FDE will depend on the offset to the __tls_get_addr_opt stub, which of course can change during relaxation. That means at the very least, rewriting the FDE on each pass, possibly changing the FDE size. I think that is better done by completely recreating PLT eh_frame FDEs. * ehframe.cc (Fde::operator==): New. (Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): New. * ehframe.h (Fde::operator==): Declare. (Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): Likewise. * layout.cc (Layout::remove_eh_frame_for_plt): New. * layout.h (Layout::remove_eh_frame_for_plt): Declare. * powerpc.cc (Target_powerpc::do_relax): Remove old eh_frame FDEs. (Stub_table::add_eh_frame): Delete eh_frame_added_ condition. Don't add eh_frame for empty stub section. (Stub_table::remove_eh_frame): New.
2017-07-18Fix spelling typos.Yuri Chornovian
2017-05-152017-05-15 Eric Christopher <echristo@gmail.com>Eric Christopher
* layout.cc (Layout::segment_precedes): Add a case for testing pointer equality when determining which segment precedes another.
2017-01-02Update year range in copyright notice of all files.Alan Modra
2016-12-22Fix placement of forced local symbols in the dynamic symbol table.Cary Coutant
Gold was not placing forced-local symbols (e.g., hidden visibility) at the front of the dynamic symbol table, or including them in the count of local symbols recorded in the .dynsym section's sh_info field. gold/ * layout.cc (Layout::finalize): Track count of forced-local symbols in .dynsym. (Layout::create_symtab_sections): Add local_dynamic_count parameter; use that instead of sh_info value. (Layout::create_dynamic_symtab): Add pforced_local_dynamic_count parameter; pass it to Symtab::set_dynsym_indexes(). Include forced locals in sh_info value. Pass index of first real global to Dynobj::create_gnu_hash_table() and Dynobj::create_elf_hash_table(). * layout.h (Layout::create_symtab_sections): Add local_dynamic_count parameter. (Layout::create_dynamic_symtab): Add pforced_local_dynamic_count parameter. * symtab.cc (Symbol_table::set_dynsym_indexes): Add pforced_local_count parameter. Process forced-local symbols first and return the count. (Symbol_table::finalize): Update comments. * symtab.h (Symbol_table::set_dynsym_indexes): Add pforced_local_count parameter. (Symbol_table::first_dynamic_global_index_): Update comment. (Symbol_table::dynamic_count_): Update comment. * testsuite/Makefile.am (ifuncmod1.sh): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/ifuncmod1.sh: New shell script.
2016-12-19Fix problem where linker does not place .note sections according to script.Cary Coutant
gold/ PR gold/14676 PR gold/20983 * layout.h (Layout::choose_output_section): Add match_input_spec parameter. Adjust all callers. * layout.cc (Layout::choose_output_section): Likewise. Pass match_input_spec to Script_sections::output_section_name(). (Layout::create_note): Pass true for match_input_spec. * script-sections.h (Script_sections::output_section_name): Add match_input_spec parameter. * script-sections.cc (Sections_element::output_section_name): Likewise. (Output_section_definition::output_section_name): Likewise. (Script_sections::output_section_name): Likewise.
2016-12-13Do not use linker script to place static relocation sections.Cary Coutant
gold/ PR gold/20522 * layout.cc (Layout::choose_output_section): Add is_reloc parameter. Adjust all callers. Do not use linker script for is_reloc sections. (Layout::layout_reloc): Pass is_reloc == true. * layout.h (Layout::choose_output_section): Add is_reloc parameter.
2016-11-27Fix spelling in comments in C source files (gold)Ambrogino Modigliani
* aarch64.cc: Fix spelling in comments. * arm.cc: Fix spelling in comments. * icf.cc: Fix spelling in comments. * layout.cc: Fix spelling in comments. * layout.h: Fix spelling in comments. * mips.cc: Fix spelling in comments. * output.h: Fix spelling in comments. * plugin.h: Fix spelling in comments. * script-sections.h: Fix spelling in comments. * script.h: Fix spelling in comments. * stringpool.h: Fix spelling in comments. * tilegx.cc: Fix spelling in comments.
2016-11-21Add --build-id=uuid support for MinGW32.Igor Kudrin
2016-11-21 Igor Kudrin <ikudrin@accesssoftek.com> gold/ * layout.cc: Include windows.h and rpcdce.h (for MinGW32). (Layout::create_build_id): Generate uuid using UuidCreate().
2016-08-23[gold] Implement -z stack-size optionRoland McGrath
gold/ * options.h (General_options): Grok -z stack-size. * output.h (Output_segment::set_size): New method. * layout.cc (Layout::create_executable_stack_info): Renamed to ... (Layout::create_stack_segment): ... this. Always create the segment if -z stack-size was used. (Layout::set_segment_offsets): Don't call ->set_offset on the PT_GNU_STACK segment.
2016-03-03Add support for STT_SPARC_REGISTER symbols.Cary Coutant
gold/ PR gold/19019 * layout.h (Layout::add_target_specific_dynamic_tag): New function. * layout.cc (Layout::add_target_specific_dynamic_tag): New function. * mips.cc (Target_mips::make_symbol): Adjust function signature. * sparc.cc (Target_sparc::Target_sparc): Initialize register_syms_. (Target_sparc::do_is_defined_by_abi): Remove test for STT_SPARC_REGISTER. (Target_sparc::Register_symbol): New struct type. (Target_sparc::register_syms_): New data member. (Target_sparc<64, true>::sparc_info): Set has_make_symbol to true. (Target_sparc::make_symbol): New function. (Target_sparc::do_finalize_sections): Add register symbols and new dynamic table entries. * symtab.h (Sized_symbol::init_undefined): Add value parameter. (Symbol_table::add_target_global_symbol): New function. (Symbol_table::target_symbols_): New data member. * symtab.cc (Sized_symbol::init_undefined): Add value parameter. (Symbol_table::Symbol_table): Initialize target_symbols_. (Symbol_table::add_from_object): Pass additional parameters to Target::make_symbol. (Symbol_table::define_special_symbol): Likewise. (Symbol_table::add_undefined_symbol_from_command_line): Pass 0 for undefined symbol value. (Symbol_table::set_dynsym_indexes): Process target-specific symbols. (Symbol_table::sized_finalize): Likewise. (Symbol_table::sized_write_globals): Likewise. * target.h (Sized_target::make_symbol): Add name, st_type, object, st_shndx, and value parameters.
2016-01-01Copyright update for binutilsAlan Modra
2015-10-28Support 64-bit entry size in SHT_HASH (for s390).Marcin Koƛcielnicki
gold/ * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with target-specific entry size. (Dynobj::sized_create_elf_hash_table): Add size template parameter. * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise. * layout.cc (Layout::create_dynamic_symtab): Set entsize to hash_entry_size. * target.h (Target::hash_entry_size): New method. (Target::Target_info::hash_entry_size): New data member. * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size. * arm.cc (Target_arm::arm_info): Likewise. (Target_arm_nacl::arm_nacl_info): Likewise. * i386.cc (Target_i386::i386_info): Likewise. (Target_i386_nacl::i386_nacl_info): Likewise. (Target_iamcu::iamcu_info): Likewise. * mips.cc (Target_mips::mips_info): Likewise. (Target_mips_nacl::mips_nacl_info): Likewise. * powerpc.cc (Target_powerpc::powerpc_info): Likewise. * sparc.cc (Target_sparc::sparc_info): Likewise. * tilegx.cc (Target_tilegx::tilegx_info): Likewise. * x86_64.cc (Target_x86_64::x86_64_info): Likewise. (Target_x86_64_nacl::x86_64_nacl_info): Likewise. * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2015-07-20Clear SHF_COMPRESSED flag bit from input to outputH.J. Lu
For relocatable link, we should clear the SHF_COMPRESSED flag bit from input group section. PR gold/18689 * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit from input group section for relocatable link. * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh. (check_DATA): Add pr18689.stdout. (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o. (pr18689.stdout): New rule. (pr18689a.o): Likewise. (pr18689b.o): Likewise. (pr18689.o): Likewise. * testsuite/pr18689.c: New file. * testsuite/pr18689.sh: Likewise. * testsuite/Makefile.in: Regenerated.
2015-07-12Add SHF_COMPRESSED section decompression to goldH.J. Lu
This patch adds SHF_COMPRESSED section decompression to gold. PR gold/18321 * compressed_output.h (decompress_input_section): Add arguments for ELF class, big endian and sh_flags. * compressed_output.cc (decompress_input_section): Likewise. Support the SHF_COMPRESSED section. * dynobj.h (Dynobj): Add elfsize and is_big_endian member functions. * plugin.h (Pluginobj): Likewise. * layout.cc (Layout::get_output_section_flags): Also clear the SHF_COMPRESSED bit. * object.h (Compressed_section_info): Add flag to store sh_flags. (Object): Add pure virtual elfsize and is_big_endian member functions. * object.cc (need_decompressed_section): Don't skip the ".zdebug" prefix here. (build_compressed_section_map): Check SHF_COMPRESSED for uncompressed size. Store sh_flags in Compressed_section_info. Pass size, big_endian and sh_flags to decompress_input_section. Skip the ".debug"/".zdebug" prefix when passing section name to need_decompressed_section. (Sized_relobj_file<size, big_endian>::do_find_special_section): Don't check ".zdebug_*" sections. (Object::decompressed_section_contents): Pass ELF class, big endian and sh_flags to decompress_input_section. * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections): Likewise. * testsuite/Makefile.am (check_DATA): Add debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout. (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout. (debug_msg_cdebug_gabi.o): New. (odr_violation1_cdebug_gabi.o): Likewise. (odr_violation2_cdebug_gabi.o): Likewise. (debug_msg_cdebug_gabi.err): Likewise. (check_SCRIPTS): Add gdb_index_test_2_gabi.sh. (gdb_index_test_cdebug_gabi.o): Likewise. (gdb_index_test_2_gabi): Likewise. (gdb_index_test_2_gabi.stdout): Likewise. * testsuite/gdb_index_test_2_gabi.sh: New file. * testsuite/Makefile.in: Regenerated.
2015-06-11Fix bug where SECTIONS clause does not handle compressed debug sections.Cary Coutant
When laying out .debug_* sections, we translate the names of compressed debug sections that start with ".zdebug", but when processing input section specs in a linker script, we do not handle the translation there. This results in an internal error as reported in PR 17731. gold/ PR gold/17731 * layout.cc (corresponding_uncompressed_section_name): New function. (Layout::choose_output_section): Call it. * layout.h (corresponding_uncompressed_section_name): New function. * script-sections.cc (Input_section_info::set_section_name): Check for compressed debug section (.zdebug style).
2015-06-02PR 17819: Fix --build-id=tree when using --compress-debug-sections.Cary Coutant
When --build-id=tree is selected, gold would schedule a set of tasks to run to compute md5 hashes in parallel on chunks of the file. The scheduling was done before the Write_after_input_sections_task ran, so if we are compressing debug sections, the output file will change size and be remapped to a new address, sometimes causing the build id computation to crash, but even when it doesn't crash, it wouldn't include the debug information in the hash computation. This patch delays the scheduling of the md5 tasks until after Write_after_input_sections_task. gold/ PR gold/17819 * gold.cc (queue_final_tasks): When --build-id=tree, queue a separate task to schedule the build id computation. * layout.cc (Hash_task::Hash_task): Remove build_id_blocker, add Output_file and offset. (Hash_task::run): Get and release the input views. (Hash_task::is_runnable): Always return NULL (always runnable). (Layout::queue_build_id_tasks): Remove. (Layout::write_build_id): Add array_of_hashes and size_of_hashes parameters; use them instead of class members. (Build_id_task_runner::run): New function. (Close_task_runner::run): Pass array_of_hashes and size_of_hashes to write_build_id. * layout.h (Layout::queue_build_id_tasks): Remove. (Layout::write_build_id): Add array_of_hashes and size_of_hashes parameters. (Layout::array_of_hashes_): Remove. (Layout::size_of_array_of_hashes_): Remove. (Layout::input_view_): Remove. (Build_id_task_runner): New class. (Close_task_runner::Close_task_runner): Add array_of_hashes and size_of_hashes parameters. (Close_task_runner::array_of_hashes_): New data member. (Close_task_runner::size_of_hashes_): New data member. * testsuite/Makefile.am (flagstest_compress_debug_sections_and_build_id_tree): New test. * testsuite/Makefile.in: Regenerate.
2015-03-09Fix failure in exception_static_test.Cary Coutant
Because the __EH_FRAME_BEGIN__ symbol is provided in an empty .eh_frame section in crtbeginT.o, if crt1.o has a non-empty .eh_frame section, we place all optimized .eh_frame sections into the output section ahead of the __EH_FRAME_BEGIN__ symbol, which breaks EH for statically-linked binaries. This patch fixes the problem by delaying the attachment of the optimized .eh_frame sections to the output section until we see the end marker section (or to the end of pass 1 if we never see an end marker). gold/ PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type; return enum indicating whether .eh_frame section is empty, optimizable, unrecognized, or an end marker. Adjust explicit instantiations. * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type. (Eh_frame::add_ehframe_input_section): Change return type. * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section. * layout.cc (Layout::layout_eh_frame): Don't add optimized sections to the .eh_frame output section until we see the end marker. (Layout::finalize_eh_frame_section): New. * layout.h: (Layout::finalize_eh_frame_section): New.
2015-02-16Fix --dynamic-list so that symbols not in the list are still exported.Cary Coutant
In PR 13577, the complaint was that -Bsymbolic was overriding the binding behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC tag in the dynamic table. In reading the Gnu ld manual, I decided that --dynamic-list should be mutually exclusive of -Bsymbolic, and modified gold so that --dynamic-list would treat symbols listed as preemptible, and all other symbols as internally bound. I was wrong. PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol not listed in the dynamic list is being internally bound within the shared library, but because it's still in the dynamic symbol table, we expose it to a COPY relocation, and things go really bad from there. (I can reproduce the same failure, simply by turning on -Bsymbolic-functions with the Gnu linker. Even though the symbol is bound internally, it's still exported to the dynamic symbol table, and is exposed to a COPY relocation.) I've backed out part of the fix for PR 13577, and -Bsymbolic (or -Bsymbolic-functions) can now be used with --dynamic-list, but if the two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC (this matches Gnu ld behavior). We now treat symbols listed in the dynamic list as premptible, but we do not automatically treat symbols not listed there as non-premptible. gold/ PR gold/13577 PR gold/16992 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or DF_SYMBOLIC if --dynamic-list option is used. * options.cc (General_options::finalize): --dynamic-list is not mutually exclusive with -Bsymbolic. * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not listed in --dynamic-list. * testsuite/Makefile.am (dynamic_list_lib2.so): Add -Bsymbolic-functions. * testsuite/Makefile.in: Regenerate.
2015-01-09Don't align start of segment unless alignment is larger than page size.Cary Coutant
This fixes an issue where a page-aligned data section, combined with -z relro, could lead to a gap between text and data segments larger than a page, and we would fail to overlap the segments in the file. gold/ * layout.cc (Layout::set_segment_offsets): Don't align start of segment unless alignment is larger than page size.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra
2014-12-01Add support for -z global.Dmitriy Ivanov
gold/ * layout.cc (Layout::finish_dynamic_section): When '-z global' is specified set DF_1_GLOBAL in DT_FLAGS_1 flags. * options.h (General_options): New -z option (global).
2014-12-01Fix extraneous warning about executable stack.Cary Coutant
PR gold/17578 notes that gold will print a warning about an executable stack when the -z execstack option is given, even when there is no --warn_execstack option. The warning is completely useless and unexpected, since the user explicitly requested an executable stack, and did not even ask for warnings. This patch fixes that, and adds an extra warning when --warn_execstack and -z noexecstack are both given and an input file requires an executable stack. gold/ PR gold/17578 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack is given. (Layout::create_executable_stack_info): Warn when -z noexecstack is given but some inputs require executable stack.
2014-11-26Update list of debug sections for --strip-debug-xxx options.Cary Coutant
Add .debug_gdb_scripts, .debug_gnu_pubnames, .debug_gnu_pubtypes, and .debug_str_offsets to lists of sections to strip or keep when stripping debug info. gold/ * layout.cc (gdb_sections): Keep .debug_gdb_scripts and .debug_str_offsets; strip .debug_gnu_pubnames and .debug_gnu_pubtypes. (lines_only_debug_sections): Strip all four new sections.
2014-09-30Fix SysV-style hash table when --hash-style=both.Kito Cheng
When --hash-style-both is used, gold currently builds the sysv hash table first, then the gnu hash table. Building the gnu hash table renumbers the dynamic symbol table, invalidating the sysv hash table. This patch reverses the order in which the hash tables are build so that both hash tables are correct. gold/ PR gold/13597 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style hash table before sysv-style hash table.
2014-09-23Fix race condition causing assert in Eh_frame_hdr::do_sized_write().Cary Coutant
2014-09-23 Taiju Tsuiki <tzik@google.com> Cary Coutant <ccoutant@google.com> gold/ * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker on input_sections_blocker. * layout.cc (Write_sections_task::locks): Unblock input_sections_blocker_. * layout.h (Write_sections_task::Write_sections_task): Add input_sections_blocker. * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld to DEPENDENCIES. * testsuite/Makefile.in: Regenerate.
2014-06-09Print unattached sections in the link map.Cary Coutant
gold/ PR gold/16980 * layout.cc (Layout::print_to_mapfile): Print unattached sections in map.
2014-06-06Strip .debug_gnu_pubnames and .debug_gnu_pubtypes when building .gdb_index.Cary Coutant
When not stripping those sections, there was a bug where gold was incorrectly adjusting section-relative offsets by the offset of the input section within the output section. That adjustment was both unnecessary and wrong, causing gold to miss a number of debug entries that should have been added to .gdb_index. (With stripping, the adjustment was always 0, so the bug in dwarf_reader.cc would have been hidden by the change to layout.cc.) gold/ * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_. * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise. (Dwarf_pubnames_table::read_header): Likewise. * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and .debug_gnu_pubtypes.
2014-05-02Fix handling of __ehdr_start when it cannot be defined.Cary Coutant
2014-05-02 Cary Coutant <ccoutant@google.com> * defstd.cc (in_segment): Define __ehdr_start here... * layout.cc (Layout::finalize): ...Instead of here. Set the output segment when known. * resolve.cc (Symbol::override_base_with_special): Remember the original binding. * symtab.cc (Symbol::set_output_segment): New function. (Symbol::set_undefined): New function. * symtab.h (Symbol::is_weak_undefined): Check original undef binding. (Symbol::is_strong_undefined): New function. (Symbol::set_output_segment): New function. (Symbol::set_undefined): New function. * target-reloc.h (is_strong_undefined): Remove. (issue_undefined_symbol_error): Call Symbol::is_weak_undefined. Check for hidden undefs. (relocate_section): Call Symbol::is_strong_undefined. * testsuite/Makefile.am (ehdr_start_test_1) (ehdr_start_test_2, ehdr_start_test_3) (ehdr_start_test_4, ehdr_start_test_5): New test cases. * testsuite/Makefile.in: Regenerate. * testsuite/ehdr_start_def.cc: New source file. * testsuite/ehdr_start_test.cc: New source file. * testsuite/ehdr_start_test.t: New linker script. * testsuite/ehdr_start_test_4.sh: New shell script.
2014-04-15Allow target to decide whether to include a section.Cary Coutant
2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * layout.cc (Layout::include_section): Allow a target to decide whether to include a section. * target.h (Target::should_include_section): New function. (Target::do_should_include_section): New function.
2014-03-05Update copyright yearsAlan Modra
2013-08-27gold/Roland McGrath
* output.cc (Output_segment::set_section_addresses): Take new Target* argument. If target->isolate_execinstr() and the segment is executable and starts at a target->abi_pagesize() boundary, pad its end out to a target->abi_pagesize() boundary with code fill. * output.h (Output_segment::set_section_addresses): Update decl. * layout.h (Layout::check_output_data_for_reset_values): Take new argument RELAX_OUTPUTS. (Layout): New member relax_output_list_. (Layout::add_relax_output): New method. * layout.cc (Layout::Layout): Update constructor. (Layout::reset_relax_output): New method. (Layout::clean_up_after_relaxation): Call it. (Layout::prepare_for_relaxation): Update caller. (Layout::set_segment_offsets): Update callers of set_section_addresses. Call reset_relax_output before re-processing segments for isolate_execinstr case. (Layout::write_data): Handle relax_output_list_. (Layout::Relaxation_debug_check::check_output_data_for_reset_values): Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
2013-07-19gold/Roland McGrath
* options.h (General_options): Add -Trodata-segment option. * parameters.cc (Parameters::check_rodata_segment): New function. (Parameters::set_target_once): Call it. * parameters.h (Parameters): Declare it (private member function). * layout.cc (load_seg_unusable_for_headers): New function, broken out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr() then validate rodata segment rather than text segment. (relaxation_loop_body): Call that. (is_text_segment): New function. Don't admit a non-executable segment if TARGET->isolate_execinstr(). (set_segment_offsets): Call it. Honor -Trodata-segment option.
2013-06-052013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>Cary Coutant
gold/ * layout.cc (Layout::set_segment_offsets): Taking care of the case when the maximum segment alignment is larger than the page size. * testsuite/Makefile.am (large_symbol_alignment): Test that Gold correctly aligns the symbols with large alignemnt. * testsuite/Makefile.in: Regenerate. * testsuite/large_symbol_alignment.cc: New file.
2013-05-302013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>Cary Coutant
Sriraman Tallam <tmsriram@google.com> * options.h (sort_section): New option. * output.h (Input_section_sort_section_prefix_special_ordering_compare): Rename from Input_section_sort_section_name_special_ordering_compare. (Input_section_sort_section_name_compare): New struct. * output.cc (Output_section::Input_section_sort_section_name_compare:: operator()): New function. (Output_section::sort_attached_input_sections): Use new sort function for .text if --sort-section=name is specified. * layout.cc (Layout::make_output_section): Add sorting by name when --sort-section=name is specified. * testsuite/Makefile.am (text_section_grouping): Test option --sort-section=name. * testsuite/Makefile.in: Regenerate. * testsuite/section_sorting_name.cc: New file. * testsuite/section_sorting_name.sh: New file.
2013-05-10gold/Roland McGrath
* options.h (General_options): Add --rosegment-gap option. * options.cc (finalize): --rosegment-gap implies --rosegment. * layout.cc (set_segment_offsets): Let user option override target->rosegment_gap().
2013-05-03 gold/Maciej W. Rozycki
PR ld/15365 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN. ld/ PR ld/15365 * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Restrict __ehdr_start's export class to no less than STV_HIDDEN. ld/testsuite/ PR ld/15365 * ld-elf/ehdr_start.d: Expect __ehdr_start to be STB_LOCAL. * ld-mips-elf/ehdr_start-1.nd: New test. * ld-mips-elf/ehdr_start-2.nd: New test. * ld-mips-elf/ehdr_start-1.ld: New test linker script. * ld-mips-elf/ehdr_start-2.ld: New test linker script. * ld-mips-elf/ehdr_start-new.s: New test source. * ld-mips-elf/ehdr_start-o32.s: New test source. * ld-mips-elf/mips-elf.exp: Run the new tests.
2013-04-262013-04-26 Geoff Pike <gpike@chromium.org>Cary Coutant
gold/ * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks(). * layout.cc (Hash_task): New class. (Layout::queue_build_id_tasks): New function. (Layout::write_build_id): Handle single-thread portion of build ID computation. (In some cases, all of it is single-threaded.) Replace {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same functionality in fewer lines of code. * layout.h (Layout::queue_build_id_tasks): New function declaration. * options.h (General_options): make "--build-id" default to tree rather than sha1. Add two new options related to --build-id=tree: --build-id-chunk-size-for-treehash and --build-id-min-file-size-for-treehash. * Makefile.am: add testing of --build-id=tree and related new options (these tests will be invoked by "make check"). * Makefile.in: Regenerate.
2013-04-21 PR gold/15355Alan Modra
* layout.cc (Layout::segment_precedes): Allow more than one segment with the same type and flags.
2013-04-15gold/Cary Coutant
* layout.cc (Layout::set_relocatable_section_offsets): Don't allocate space in file for BSS sections.
2013-03-21 * layout.cc (Layout::set_segment_offsets): Accept writable .textAlan Modra
segment when omagic.
2013-03-21 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsignedAlan Modra
comparison warning. * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used uninitialized" warning.
2013-03-10 * gold.cc (queue_middle_tasks): Move detect_odr_violations..Alan Modra
* layout.cc (Layout_task_runner::run): ..to here. * symtab.h (struct Symbol_location): Extract from.. (class Symbol_table): ..here. * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location. * target.h (class Target): Add function_location and do_function_location functions. (class Sized_target): Add do_function_location. * object.h (class Sized_relobj_file): Move find_shdr.. (class Object): ..to here. * object.cc: Likewise. Update to suit. Instantiate. (Sized_relobj_file::find_eh_frame): Update find_shdr call. * powerpc.cc (class Powerpc_dynobj): New. (Target_powerpc::do_function_location): New function. (Powerpc_relobj::do_find_special_sections): Update find_shdr call. (Powerpc_dynobj::do_read_symbols): New function. (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2013-01-24Default text reordering fix with a flag to turn it off.Sriraman Tallam
2013-01-24 Sriraman Tallam <tmsriram@google.com> * layout.cc (Layout::layout): Check for option text_reorder. (Layout::make_output_section): Ditto. * options.h (text_reorder): New option. * output.cc (Input_section_sort_compare): Remove special ordering of section names. (Output_section:: Input_section_sort_section_name_special_ordering_compare:: operator()): New function. (Output_section::sort_attached_input_sections): Use new sort function for .text. * output.h (Input_section_sort_section_name_special_ordering_compare): New struct. * testsuite/Makefile.am (text_section_grouping): Test option --no-text-reorder * testsuite/Makefile.in: Regenerate. * testsuite/text_section_grouping.sh: Check order of functions without default text reordering.
2013-01-18ld: change --enable-new-dtags to only generate new dtagsMike Frysinger
The "new" dtags options have been around for 14+ years, so there shouldn't be a need to generate both new & old tags anymore. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-162013-01-16 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam
* layout.cc (Layout::layout): Do not do default sorting for text sections when section ordering is specified. (make_output_section): Ditto. * testsuite/plugin_final_layout.cc: Name the function sections to catch reordering issues.
2012-12-21 * layout.cc (Layout::special_ordering_of_input_section): NewIan Lance Taylor
function. (Layout::layout): If input section requires special ordering, must sort input sections. (Layout::make_output_section): May sort .text input sections. (Layout::is_section_name_prefix_grouped): Remove. * layout.h (class Layout): Declare special_ordering_of_input_section. Don't declare is_section_name_prefix_grouped. * output.cc (Output_section::add_input_section): Revert last change. (Output_section::Input_section_sort::match_file_name): Don't crash if called on output section data. (Output_section::Input_section_sort_compare): Sort based on special ordering. (Output_section::Input_section_sort_section_order_index_compare): Revert last patch. (Output_section::sort_attached_input_sections): Likewise.