Skip to content

Commit 6714906

Browse files
committed
Revert changes for Linux x86-64
1 parent 89e4994 commit 6714906

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Improve JIT code generation on Linux targets by reducing the indirect call to external symbols. Patch by Diego Russo.
1+
Improve JIT code generation on Linux AArch64 by reducing the indirect call to external symbols. Patch by Diego Russo.

Python/jit.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -316,25 +316,18 @@ patch_32(unsigned char *location, uint64_t value)
316316
memcpy(location, &final_value, sizeof(final_value));
317317
}
318318

319-
// 32-bit absolute address, sign-extended by the instruction.
319+
// 32-bit relative address.
320320
void
321-
patch_32s(unsigned char *location, uint64_t value)
321+
patch_32r(unsigned char *location, uint64_t value)
322322
{
323+
value -= (uintptr_t)location;
323324
// Check that we're not out of range of 32 signed bits:
324325
assert((int64_t)value >= -(1LL << 31));
325326
assert((int64_t)value < (1LL << 31));
326-
int32_t final_value = (int32_t)value;
327+
uint32_t final_value = (uint32_t)value;
327328
memcpy(location, &final_value, sizeof(final_value));
328329
}
329330

330-
// 32-bit relative address.
331-
void
332-
patch_32r(unsigned char *location, uint64_t value)
333-
{
334-
value -= (uintptr_t)location;
335-
patch_32s(location, value);
336-
}
337-
338331
// 64-bit absolute address.
339332
void
340333
patch_64(unsigned char *location, uint64_t value)

Tools/jit/_stencils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class HoleValue(enum.Enum):
9090
"R_AARCH64_MOVW_UABS_G2_NC": "patch_aarch64_16c",
9191
"R_AARCH64_MOVW_UABS_G3": "patch_aarch64_16d",
9292
# x86_64-unknown-linux-gnu:
93-
"R_X86_64_32S": "patch_32s",
9493
"R_X86_64_64": "patch_64",
9594
"R_X86_64_GOTPCRELX": "patch_x86_64_32rx",
9695
"R_X86_64_PLT32": "patch_32r",

Tools/jit/_targets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO:
622622
elif re.fullmatch(r"x86_64-.*-linux-gnu", host):
623623
host = "x86_64-unknown-linux-gnu"
624624
condition = "defined(__x86_64__) && defined(__linux__)"
625-
args = ["-fno-pic", "-mcmodel=medium", "-mlarge-data-threshold=0"]
625+
args = ["-fno-pic", "-mcmodel=medium", "-mlarge-data-threshold=0", "-fno-plt"]
626626
optimizer = _optimizers.OptimizerX86
627627
target = _ELF(
628628
host, condition, args=args, optimizer=optimizer, frame_pointers=True

0 commit comments

Comments
 (0)