aboutsummaryrefslogtreecommitdiff
path: root/elfcpp
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2023-07-02 07:46:21 -0700
committerH.J. Lu <hjl.tools@gmail.com>2023-12-28 08:47:17 -0800
commit00a17c6ad068c95019e1f37cfc2d1b8aaebd6ecb (patch)
treeb45ac33f86f86ad32fbf3205cd48948397f6af52 /elfcpp
parenta533c8df598b5ef99c54a13e2b137c98b34b043c (diff)
downloadgdb-00a17c6ad068c95019e1f37cfc2d1b8aaebd6ecb.zip
gdb-00a17c6ad068c95019e1f37cfc2d1b8aaebd6ecb.tar.gz
gdb-00a17c6ad068c95019e1f37cfc2d1b8aaebd6ecb.tar.bz2
Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF
Handle R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC. Convert add name@gottpoff(%rip), %reg mov name@gottpoff(%rip), %reg to add $name@tpoff, %reg mov $name@tpoff, %reg and lea name@tlsdesc(%rip), %reg to mov $name@tpoff, %reg mov name@gottpoff(%rip), %reg if the instruction is encoded with the REX2 prefix when possible. elfcpp/ * x86_64.h (R_X86_64_CODE_4_GOTTPOFF): New. (R_X86_64_CODE_4_GOTPC32_TLSDESC): Likewise. gold/ * x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle R_X86_64_CODE_4_GOTPC32_TLSDESC and R_X86_64_CODE_4_GOTTPOFF. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. (Target_x86_64::Relocate::relocate_tls): Likewise. (Target_x86_64::Relocate::tls_desc_gd_to_ie): Handle R_X86_64_CODE_4_GOTPC32_TLSDESC. (Target_x86_64::Relocate::tls_desc_gd_to_le): Likewise. (Target_x86_64::Relocate::tls_ie_to_le): Handle. R_X86_64_CODE_4_GOTTPOFF. * testsuite/Makefile.am: Add x86_64_ie_to_le test. * testsuite/Makefile.in: Regenerated. * testsuite/x86_64_gd_to_le.s: Add R_X86_64_CODE_4_GOTPC32_TLSDESC test. * testsuite/x86_64_gd_to_le.sh: Check GDesc to LE conversion. * testsuite/x86_64_ie_to_le.s: New file. * testsuite/x86_64_ie_to_le.sh: Likewise.
Diffstat (limited to 'elfcpp')
-rw-r--r--elfcpp/x86_64.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/elfcpp/x86_64.h b/elfcpp/x86_64.h
index 97a87ae..da6ac19 100644
--- a/elfcpp/x86_64.h
+++ b/elfcpp/x86_64.h
@@ -102,6 +102,14 @@ enum
// GOT if the instruction starts at 4
// bytes before the relocation offset,
// relaxable.
+ R_X86_64_CODE_4_GOTTPOFF = 44, // 32 bit signed PC relative offset to
+ // GOT entry for IE symbol if the
+ // instruction starts at 4 bytes before
+ // the relocation offset.
+ R_X86_64_CODE_4_GOTPC32_TLSDESC = 45, // 32-bit PC relative to TLS
+ // descriptor in GOT if the
+ // instruction starts at 4 bytes
+ // before the relocation offset.
// GNU vtable garbage collection extensions.
R_X86_64_GNU_VTINHERIT = 250,
R_X86_64_GNU_VTENTRY = 251