include: Ensure that x86_64 syscall thunks have a consistent length when built with Clang.

GCC always assembles 'jmp 1f' to 'eb 01', as does Clang when using -O1
or higher optimization.
But with -O0, Clang outputs 'e9 01 00 00 00'.

The 'subq $0xb,0x70(%rcx)' line in __wine_syscall_dispatcher relies on
'jmp 1f' being 2 bytes.

Based on patch by Alex S.
This commit is contained in:
Brendan Shanks 2024-07-30 11:55:42 -07:00 committed by Alexandre Julliard
parent 6de806d62c
commit 0291c9f9fb
Notes: Alexandre Julliard 2024-07-31 23:43:58 +02:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/-/merge_requests/6179

View file

@ -245,9 +245,9 @@
".byte 0x75,0x03\n\t" /* jne 1f */ \
".byte 0x0f,0x05\n\t" /* syscall */ \
".byte 0xc3\n\t" /* ret */ \
"jmp 1f\n\t" \
".byte 0xc3\n" /* ret */ \
"1:\t.byte 0xff,0x14,0x25\n\t" /* 1: callq *(0x7ffe1000) */ \
".byte 0xeb,0x01\n\t" /* jmp 1f */ \
".byte 0xc3\n\t" /* ret */ \
".byte 0xff,0x14,0x25\n\t" /* 1: callq *(0x7ffe1000) */ \
".long 0x7ffe1000\n\t" \
"ret" )
# else
@ -260,10 +260,10 @@
".byte 0x75,0x03\n\t" /* jne 1f */ \
".byte 0x0f,0x05\n\t" /* syscall */ \
".byte 0xc3\n\t" /* ret */ \
"jmp 1f\n\t" \
".byte 0xeb,0x02\n\t" /* jmp 1f */ \
".byte 0xc3\n" /* ret */ \
"nop\n" \
"1:\tcallq *" __ASM_NAME("__wine_syscall_dispatcher") "(%rip)\n\t" \
"nop\n\t" \
"callq *" __ASM_NAME("__wine_syscall_dispatcher") "(%rip)\n\t" /* 1: callq __wine_syscall_dispatcher */ \
"ret" )
# endif
#elif defined __arm__