Skip to content

Commit e6450de

Browse files
Only patch x86_64 GOT relocations when relaxation succeeds
1 parent 94f1a89 commit e6450de

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Python/jit.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,22 +400,21 @@ patch_x86_64_32rx(unsigned char *location, uint64_t value)
400400
if (loc8[-2] == 0x8B) {
401401
// mov reg, dword ptr [rip + AAA] -> lea reg, [rip + XXX]
402402
loc8[-2] = 0x8D;
403-
value = relaxed;
403+
patch_32r(location, relaxed);
404404
}
405405
else if (loc8[-2] == 0xFF && loc8[-1] == 0x15) {
406406
// call qword ptr [rip + AAA] -> nop; call XXX
407407
loc8[-2] = 0x90;
408408
loc8[-1] = 0xE8;
409-
value = relaxed;
409+
patch_32r(location, relaxed);
410410
}
411411
else if (loc8[-2] == 0xFF && loc8[-1] == 0x25) {
412412
// jmp qword ptr [rip + AAA] -> nop; jmp XXX
413413
loc8[-2] = 0x90;
414414
loc8[-1] = 0xE9;
415-
value = relaxed;
415+
patch_32r(location, relaxed);
416416
}
417417
}
418-
patch_32r(location, value);
419418
}
420419

421420
void patch_aarch64_trampoline(unsigned char *location, int ordinal, jit_state *state);

Tools/jit/_targets.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO:
585585
elif re.fullmatch(r"x86_64-apple-darwin.*", host):
586586
host = "x86_64-apple-darwin"
587587
condition = "defined(__x86_64__) && defined(__APPLE__)"
588-
args = ["-fno-plt"]
589588
optimizer = _optimizers.OptimizerX86
590589
target = _MachO(host, condition, optimizer=optimizer)
591590
elif re.fullmatch(r"x86_64-pc-windows-msvc", host):

0 commit comments

Comments
 (0)