diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2017-08-28 08:03:00 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2017-08-28 08:03:00 -0700 |
commit | cefdd1cd64f3b67aba1b219547b8f895c22d48ed (patch) | |
tree | 1fbc8b87099dd20997e241e8057cf0b58280a25b /gold/aarch64.cc | |
parent | 565ed01a4e0e3584f24580177822a5271b1c0c8b (diff) | |
download | gdb-cefdd1cd64f3b67aba1b219547b8f895c22d48ed.zip gdb-cefdd1cd64f3b67aba1b219547b8f895c22d48ed.tar.gz gdb-cefdd1cd64f3b67aba1b219547b8f895c22d48ed.tar.bz2 |
Fix bad offset calculation for R_AARCH64_TLSDESC_* relocs.
If a custom linker script with an unexpected relative layout of .got
and .got.plt sections was used, gold might produce a wrong offset
when applying R_AARCH64_TLSDESC_* relocations.
This patch fixes the issue by calculating "got_tlsdesc_offset"
in a more direct way.
gold/
* aarch64.cc (Target_aarch64::Relocate::relocate_tls):
Make got_tlsdesc_offset signed and fix its calculation.
* testsuite/Makefile.am (aarch64_tlsdesc): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/aarch64_tlsdesc.s: New test source file.
* testsuite/aarch64_tlsdesc.sh: New test script.
* testsuite/aarch64_tlsdesc.t: New test linker script.
Diffstat (limited to 'gold/aarch64.cc')
-rw-r--r-- | gold/aarch64.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gold/aarch64.cc b/gold/aarch64.cc index 58c7449..2194a21 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -7563,15 +7563,15 @@ Target_aarch64<size, big_endian>::Relocate::relocate_tls( tls_got_offset_type = (tlsopt == tls::TLSOPT_TO_IE ? GOT_TYPE_TLS_OFFSET : GOT_TYPE_TLS_DESC); - unsigned int got_tlsdesc_offset = 0; + int got_tlsdesc_offset = 0; if (r_type != elfcpp::R_AARCH64_TLSDESC_CALL && tlsopt == tls::TLSOPT_NONE) { // We created GOT entries in the .got.tlsdesc portion of the // .got.plt section, but the offset stored in the symbol is the // offset within .got.tlsdesc. - got_tlsdesc_offset = (target->got_->data_size() - + target->got_plt_section()->data_size()); + got_tlsdesc_offset = (target->got_tlsdesc_->address() + - target->got_->address()); } typename elfcpp::Elf_types<size>::Elf_Addr got_entry_address; if (gsym != NULL) |