aboutsummaryrefslogtreecommitdiff
path: root/elfcpp
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2023-06-08 12:12:48 -0700
committerH.J. Lu <hjl.tools@gmail.com>2023-12-28 08:47:17 -0800
commit4a54cb06585f568031dfd291d0fe45979ad75e98 (patch)
tree2469a2d8eb9ce968fd9ef5039d25679bae946e3b /elfcpp
parent3d5a60de52556f6a53d71d7e607c6696450ae3e4 (diff)
downloadgdb-4a54cb06585f568031dfd291d0fe45979ad75e98.zip
gdb-4a54cb06585f568031dfd291d0fe45979ad75e98.tar.gz
gdb-4a54cb06585f568031dfd291d0fe45979ad75e98.tar.bz2
gold: Handle R_X86_64_CODE_4_GOTPCRELX
Handle R_X86_64_CODE_4_GOTPCRELX and convert mov name@GOTPCREL(%rip), %r31 to lea name@GOTPCREL(%rip), %r31 if the instruction is encoded with the REX2 prefix when possible. elfcpp/ * x86_64.h (R_X86_64_CODE_4_GOTPCRELX): New. gold/ * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): Handle R_X86_64_CODE_4_GOTPCRELX. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::possible_function_pointer_reloc): Likewise. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. * testsuite/x86_64_mov_to_lea1.s: Add a test for R_X86_64_CODE_4_GOTPCRELX. * testsuite/x86_64_mov_to_lea2.s: Likewise. * testsuite/x86_64_mov_to_lea3.s: Likewise. * testsuite/x86_64_mov_to_lea4.s: Likewise. * testsuite/x86_64_mov_to_lea5.s: Likewise. * testsuite/x86_64_mov_to_lea.sh: Updated.
Diffstat (limited to 'elfcpp')
-rw-r--r--elfcpp/x86_64.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/elfcpp/x86_64.h b/elfcpp/x86_64.h
index 0377e77..97a87ae 100644
--- a/elfcpp/x86_64.h
+++ b/elfcpp/x86_64.h
@@ -95,9 +95,13 @@ enum
R_X86_64_PC32_BND = 39, // PC relative 32 bit signed with BND prefix
R_X86_64_PLT32_BND = 40, // 32 bit PLT address with BND prefix
R_X86_64_GOTPCRELX = 41, // 32 bit signed PC relative offset to GOT
- // without REX prefix, relaxable.
+ // without REX nor REX2 prefixes, relaxable.
R_X86_64_REX_GOTPCRELX = 42, // 32 bit signed PC relative offset to GOT
// with REX prefix, relaxable.
+ R_X86_64_CODE_4_GOTPCRELX = 43, // 32 bit signed PC relative offset to
+ // GOT if the instruction starts at 4
+ // bytes before the relocation offset,
+ // relaxable.
// GNU vtable garbage collection extensions.
R_X86_64_GNU_VTINHERIT = 250,
R_X86_64_GNU_VTENTRY = 251