Fix bad offset calculation for R_AARCH64_TLSDESC_* relocs.
authorIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 28 Aug 2017 15:03:00 +0000 (08:03 -0700)
committerCary Coutant <ccoutant@gmail.com>
Mon, 28 Aug 2017 15:03:00 +0000 (08:03 -0700)
commitcefdd1cd64f3b67aba1b219547b8f895c22d48ed
tree1fbc8b87099dd20997e241e8057cf0b58280a25b
parent565ed01a4e0e3584f24580177822a5271b1c0c8b
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.
gold/ChangeLog
gold/aarch64.cc
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/aarch64_tlsdesc.s [new file with mode: 0644]
gold/testsuite/aarch64_tlsdesc.sh [new file with mode: 0755]
gold/testsuite/aarch64_tlsdesc.t [new file with mode: 0644]