Skip to content

Commit b3c8afe

Browse files
committed
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: https://github.com/bminor/binutils-gdb/blob/ec181e1710e37007a8d95c284609bfaa5868d086/gas/config/tc-i386.c#L6793 gottpoff is unaffected. Closes GH-18779.
1 parent 786090b commit b3c8afe

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ PHP NEWS
2424
- ODBC:
2525
. Fix memory leak on php_odbc_fetch_hash() failure. (nielsdos)
2626

27+
- Opcache:
28+
. Fixed bug GH-18743 (Incompatibility in Inline TLS Assembly on Alpine 3.22).
29+
(nielsdos, Arnaud)
30+
2731
- OpenSSL:
2832
. Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure.
2933
(nielsdos)

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,15 +2910,15 @@ static int zend_jit_setup(void)
29102910

29112911
__asm__(
29122912
"leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
2913-
: "=a" (ti));
2913+
: "=D" (ti));
29142914
tsrm_tls_offset = ti[1];
29152915
tsrm_tls_index = ti[0] * 8;
29162916
#elif defined(__FreeBSD__)
29172917
size_t *ti;
29182918

29192919
__asm__(
29202920
"leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
2921-
: "=a" (ti));
2921+
: "=D" (ti));
29222922
tsrm_tls_offset = ti[1];
29232923
/* Index is offset by 1 on FreeBSD (https://github.com/freebsd/freebsd-src/blob/bf56e8b9c8639ac4447d223b83cdc128107cc3cd/libexec/rtld-elf/rtld.c#L5260) */
29242924
tsrm_tls_index = (ti[0] + 1) * 8;
@@ -2927,7 +2927,7 @@ static int zend_jit_setup(void)
29272927

29282928
__asm__(
29292929
"leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
2930-
: "=a" (ti));
2930+
: "=D" (ti));
29312931
tsrm_tls_offset = ti[1];
29322932
tsrm_tls_index = ti[0] * 16;
29332933
#endif

0 commit comments

Comments
 (0)