summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2020-11-14 18:54:26 +1100
committerDamien George <damien@micropython.org>2021-05-20 23:34:20 +1000
commit04927dfaca06d68a35ff1a5700a5e4eb283b5f2d (patch)
tree1d8811e8b109a6582741e6e14e8fdb1f0c43c1c3
parent47b778332a0e89740775db544e7c22065df528c2 (diff)
tools/mpy_ld.py: Support R_X86_64_GOTPCREL reloc for x86-64 arch.
This can be treated by the linker the same as R_X86_64_REX_GOTPCRELX, according to https://reviews.llvm.org/D18301. Signed-off-by: Damien George <damien@micropython.org>
-rwxr-xr-xtools/mpy_ld.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py
index 774966a7f..852249943 100755
--- a/tools/mpy_ld.py
+++ b/tools/mpy_ld.py
@@ -73,6 +73,7 @@ R_XTENSA_SLOT0_OP = 20
R_ARM_BASE_PREL = 25 # aka R_ARM_GOTPC
R_ARM_GOT_BREL = 26 # aka R_ARM_GOT32
R_ARM_THM_JUMP24 = 30
+R_X86_64_GOTPCREL = 9
R_X86_64_REX_GOTPCRELX = 42
R_386_GOT32X = 43
@@ -132,7 +133,7 @@ ARCH_DATA = {
| MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE,
2,
8,
- (R_X86_64_REX_GOTPCRELX,),
+ (R_X86_64_GOTPCREL, R_X86_64_REX_GOTPCRELX),
asm_jump_x86,
),
"armv7m": ArchData(
@@ -536,7 +537,10 @@ def do_relocation_text(env, text_addr, r):
# Relcation pointing to GOT
reloc = addr = env.got_entries[s.name].offset
- elif env.arch.name == "EM_X86_64" and r_info_type == R_X86_64_REX_GOTPCRELX:
+ elif env.arch.name == "EM_X86_64" and r_info_type in (
+ R_X86_64_GOTPCREL,
+ R_X86_64_REX_GOTPCRELX,
+ ):
# Relcation pointing to GOT
got_entry = env.got_entries[s.name]
addr = env.got_section.addr + got_entry.offset