Skip to content

Commit a4ed163

Browse files
committed
aarch64: use -mtls-size=12 for
1 parent a7f40d1 commit a4ed163

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Zend/Zend.m4

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,22 @@ AC_MSG_RESULT([$ZEND_ZTS])
178178
AS_VAR_IF([ZEND_ZTS], [yes], [
179179
AC_DEFINE([ZTS], [1], [Define to 1 if thread safety (ZTS) is enabled.])
180180
AS_VAR_APPEND([CFLAGS], [" -DZTS"])
181+
182+
dnl -mtls-size=12 drops the dead high-bits offset add from TLS access,
183+
dnl valid while the thread-local block stays under 4 KiB.
184+
AC_CACHE_CHECK([whether -mtls-size=12 compiles and links],
185+
[php_cv_flag_mtls_size_12],
186+
[save_CFLAGS=$CFLAGS
187+
AS_VAR_IF([GCC], [yes], [php_tls_size_werror=-Werror], [php_tls_size_werror=])
188+
CFLAGS="$CFLAGS -mtls-size=12 $php_tls_size_werror"
189+
AC_LINK_IFELSE([AC_LANG_PROGRAM(
190+
[[static __thread void *tls_probe __attribute__((tls_model("local-exec")));]],
191+
[[tls_probe = &tls_probe; return !!tls_probe;]])],
192+
[php_cv_flag_mtls_size_12=yes],
193+
[php_cv_flag_mtls_size_12=no])
194+
CFLAGS=$save_CFLAGS])
195+
AS_VAR_IF([php_cv_flag_mtls_size_12], [yes],
196+
[AS_VAR_APPEND([CFLAGS], [" -mtls-size=12"])])
181197
])
182198
183199
AC_MSG_CHECKING([whether to enable Zend debugging])

0 commit comments

Comments
 (0)