-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c
#18743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for reporting this. This is the same root cause as #15074 (see #15074 (comment)), and will be fixed by #18660 (specifically ba04798). |
@arnaud-lb But this can be fixed on lower branches, and I think we should. diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 1f1abb59a1c..6ea8521ba6d 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -2910,7 +2910,7 @@ static int zend_jit_setup(void)
__asm__(
"leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
- : "=a" (ti));
+ : "=D" (ti));
tsrm_tls_offset = ti[1];
tsrm_tls_index = ti[0] * 8;
#elif defined(__FreeBSD__)
|
@nielsdos I agree, and it's great that there is a simpler fix, as ba04798 felt a bit risky for release branches. The change you propose looks good to me. We don't need to use the entire code sequence as in ba04798, because Glibc seems unaffected as we use Do you want to take care of this or shall I? |
Thanks for the link, I'm on it. |
GAS started checking the relocation for tlsgd: it must use the %rdi register. However, the inline assembly now uses %rax instead. Fix it by changing the "=a" output register to "=D". Source: https://github.com/bminor/binutils-gdb/blob/ec181e1710e37007a8d95c284609bfaa5868d086/gas/config/tc-i386.c#L6793 gottpoff is unaffected.
Uh oh!
There was an error while loading. Please reload this page.
Description
When building PHP on Alpine Linux 3.22 with musl and targeting 32-bit or 64-bit x86 platforms, a regression is observed related to inline assembly in
ext/opcache/jit/zend_jit_ir.c
, specifically:This error does not occur on Alpine 3.21 using the same compilation toolchain. The issue stems from the
@TLSGD
usage which implicitly expects%rdi
on x86_64 or%eax
on i386, depending on the TLS model.ext/opcache/jit/zend_jit_ir.c:3459: Error: @TLSGD operator requires
%rdi' as dest register`Environment
build-base
)x86_64
ori386
ext/opcache/jit/zend_jit_ir.c
Related PR / Reference
PHP Version
Operating System
Alpine 3.22
The text was updated successfully, but these errors were encountered: