diff --git a/Misc/NEWS.d/next/Build/2026-10-21-18-00-00.gh-issue-128883.perf-trampoline.rst b/Misc/NEWS.d/next/Build/2026-10-21-18-00-00.gh-issue-128883.perf-trampoline.rst new file mode 100644 index 00000000000000..f5b066d31ec71c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-10-21-18-00-00.gh-issue-128883.perf-trampoline.rst @@ -0,0 +1,2 @@ +Add a byte after the ELF perf trampoline end marker so it does not share +the following function's address, which BOLT may otherwise move. diff --git a/Python/asm_trampoline_aarch64.S b/Python/asm_trampoline_aarch64.S index b3aeb728de200c..aef34014ae8552 100644 --- a/Python/asm_trampoline_aarch64.S +++ b/Python/asm_trampoline_aarch64.S @@ -57,6 +57,7 @@ __Py_trampoline_func_end: #else .globl _Py_trampoline_func_end _Py_trampoline_func_end: + .byte 0 .section .note.GNU-stack,"",@progbits #endif diff --git a/Python/asm_trampoline_riscv64.S b/Python/asm_trampoline_riscv64.S index 6125ba95373f95..21aafbcf23d6f0 100644 --- a/Python/asm_trampoline_riscv64.S +++ b/Python/asm_trampoline_riscv64.S @@ -9,4 +9,5 @@ _Py_trampoline_func_start: jr ra .globl _Py_trampoline_func_end _Py_trampoline_func_end: + .byte 0 .section .note.GNU-stack,"",@progbits diff --git a/Python/asm_trampoline_x86_64.S b/Python/asm_trampoline_x86_64.S index 0e6b11589eafc8..e1a714413abfd4 100644 --- a/Python/asm_trampoline_x86_64.S +++ b/Python/asm_trampoline_x86_64.S @@ -21,6 +21,7 @@ __Py_trampoline_func_end: #else .globl _Py_trampoline_func_end _Py_trampoline_func_end: + .byte 0 .section .note.GNU-stack,"",@progbits #endif # Note for indicating the assembly code supports CET