diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2017-05-12 15:24:32 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2017-05-12 15:24:32 -0700 |
commit | 6bf56e7482e220ff98655b5285736a37dd602c17 (patch) | |
tree | 2c83989be2758619d2192cd734717e4287673255 /gold/aarch64.cc | |
parent | 73caa85d4a97eb991e581ccba3ff4eccce5e2e1d (diff) | |
download | gdb-6bf56e7482e220ff98655b5285736a37dd602c17.zip gdb-6bf56e7482e220ff98655b5285736a37dd602c17.tar.gz gdb-6bf56e7482e220ff98655b5285736a37dd602c17.tar.bz2 |
Fix misplacement of a relaxed section on AArch64.
gold/ChangeLog
PR gold/21430
* aarch64.cc
(AArch64_relobj::convert_input_section_to_relaxed_section):
Set the section offset to -1ULL.
(Target_aarch64::relocate_section): Adjust the view in case
of a relaxed input section.
* testsuite/Makefile.am (pr21430): New test.
* testsuite/Makefile.in: Regenerate
* testsuite/pr21430.s: New test source file.
* testsuite/pr21430.sh: New test script.
Diffstat (limited to 'gold/aarch64.cc')
-rw-r--r-- | gold/aarch64.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/gold/aarch64.cc b/gold/aarch64.cc index b282ccf..c9bb6b7 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -1769,10 +1769,11 @@ class AArch64_relobj : public Sized_relobj_file<size, big_endian> // Convert regular input section with index SHNDX to a relaxed section. void - convert_input_section_to_relaxed_section(unsigned /* shndx */) + convert_input_section_to_relaxed_section(unsigned shndx) { // The stubs have relocations and we need to process them after writing // out the stubs. So relocation now must follow section write. + this->set_section_offset(shndx, -1ULL); this->set_relocs_must_follow_section_writes(); } @@ -7960,6 +7961,7 @@ Target_aarch64<size, big_endian>::relocate_section( section_size_type view_size, const Reloc_symbol_changes* reloc_symbol_changes) { + typedef typename elfcpp::Elf_types<size>::Elf_Addr Address; typedef Target_aarch64<size, big_endian> Aarch64; typedef typename Target_aarch64<size, big_endian>::Relocate AArch64_relocate; typedef gold::Default_classify_reloc<elfcpp::SHT_RELA, size, big_endian> @@ -7967,6 +7969,29 @@ Target_aarch64<size, big_endian>::relocate_section( gold_assert(sh_type == elfcpp::SHT_RELA); + // See if we are relocating a relaxed input section. If so, the view + // covers the whole output section and we need to adjust accordingly. + if (needs_special_offset_handling) + { + const Output_relaxed_input_section* poris = + output_section->find_relaxed_input_section(relinfo->object, + relinfo->data_shndx); + if (poris != NULL) + { + Address section_address = poris->address(); + section_size_type section_size = poris->data_size(); + + gold_assert((section_address >= address) + && ((section_address + section_size) + <= (address + view_size))); + + off_t offset = section_address - address; + view += offset; + address += offset; + view_size = section_size; + } + } + gold::relocate_section<size, big_endian, Aarch64, AArch64_relocate, gold::Default_comdat_behavior, Classify_reloc>( relinfo, |