1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-18743: Incompatibility in Inline TLS Assembly on Alpine 3.22

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: ec181e1710/gas/config/tc-i386.c (L6793)

gottpoff is unaffected.

Closes GH-18779.
This commit is contained in:
Niels Dossche
2025-06-05 19:37:46 +02:00
parent 786090b35d
commit b3c8afe272
2 changed files with 7 additions and 3 deletions

4
NEWS
View File

@@ -24,6 +24,10 @@ PHP NEWS
- ODBC:
. Fix memory leak on php_odbc_fetch_hash() failure. (nielsdos)
- Opcache:
. Fixed bug GH-18743 (Incompatibility in Inline TLS Assembly on Alpine 3.22).
(nielsdos, Arnaud)
- OpenSSL:
. Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure.
(nielsdos)

View File

@@ -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__)
@@ -2918,7 +2918,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];
/* Index is offset by 1 on FreeBSD (https://github.com/freebsd/freebsd-src/blob/bf56e8b9c8639ac4447d223b83cdc128107cc3cd/libexec/rtld-elf/rtld.c#L5260) */
tsrm_tls_index = (ti[0] + 1) * 8;
@@ -2927,7 +2927,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] * 16;
#endif