Commit 21d4da28ac7 for php.net

commit 21d4da28ac711a5cb6e957417e8b913e48653642
Author: henderkes <m@pyc.ac>
Date:   Thu Jun 11 01:36:04 2026 +0000

    TSRM: use local-exec TLS in PIE executables

    Closes GH-22278

diff --git a/NEWS b/NEWS
index 71f67c39665..ce6e46a4c36 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ PHP                                                                        NEWS
     surrounding property access). (timwolla)
   . Fixed GH-22422 (zend_arena layout mismatch leaked memory in separately
     built extensions under AddressSanitizer). (iliaal)
+  . TSRM: use local-exec TLS in PIE executables. (henderkes)

 - BCMath:
   . Added NUL-byte validation to BCMath functions. (jorgsowa)
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
index ea13552c837..639b1134ddd 100644
--- a/TSRM/TSRM.h
+++ b/TSRM/TSRM.h
@@ -155,7 +155,7 @@ TSRM_API bool tsrm_is_managed_thread(void);
 #if !__has_attribute(tls_model) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__MUSL__) || defined(__HAIKU__)
 # define TSRM_TLS_MODEL_ATTR
 # define TSRM_TLS_MODEL_DEFAULT
-#elif __PIC__
+#elif defined(__PIC__) && !defined(__PIE__)
 # define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec")))
 # define TSRM_TLS_MODEL_INITIAL_EXEC
 #else
diff --git a/UPGRADING b/UPGRADING
index 1ae5bbe1f40..ae0e3afc97a 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -481,6 +481,7 @@ PHP 8.6 UPGRADE NOTES
   . The performance of the TAILCALL VM has been improved.
   . The TAILCALL VM is now enabled on Windows when compiling with Clang >= 19
     x86_64.
+  . The performance of ZTS+PIE builds has been improved.

 - DOM:
   . Made splitText() faster and consume less memory.