@@ -1322,9 +1322,9 @@ else
1322
1322
fiber_asm="no"
1323
1323
fi
1324
1324
1325
- dnl Check whether syscall to create shadow stack exists, should be a better way, but...
1326
- AC_CACHE_CHECK ( [ whether syscall to create shadow stack exists ] , ac_cv_syscall_shadow_stack_exists ,
1327
- [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
1325
+ AC_CACHE_CHECK ( [ whether syscall to create shadow stack exists] ,
1326
+ [ php_cv_have_shadow_stack_syscall ] ,
1327
+ [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [
1328
1328
#include <unistd.h>
1329
1329
#include <sys/mman.h>
1330
1330
int main(void) {
@@ -1334,18 +1334,19 @@ int main(void) {
1334
1334
munmap(base, 0x20000);
1335
1335
return 0;
1336
1336
}
1337
- else
1338
- return 1;
1337
+ return 1;
1339
1338
}
1340
- ] ] ) ] , [ ac_cv_syscall_shadow_stack_exists=yes] , [ ac_cv_syscall_shadow_stack_exists=no] , [ ac_cv_syscall_shadow_stack_exists=no] )
1339
+ ] ) ] ,
1340
+ [ php_cv_have_shadow_stack_syscall=yes] ,
1341
+ [ php_cv_have_shadow_stack_syscall=no] ,
1342
+ [ php_cv_have_shadow_stack_syscall=no] )
1341
1343
] )
1342
- if test "$ac_cv_syscall_shadow_stack_exists" = yes; then
1343
- AC_DEFINE ( [ SHADOW_STACK_SYSCALL] , 1 , [ ] )
1344
- # asm file can't see macro from AC_DEFINE, workaround this via cflag
1345
- fiber_asm_cflag="-DSHADOW_STACK_SYSCALL=1"
1346
- # if the syscall doesn't exist, we may block the final ELF from __PROPERTY_SHSTK
1347
- # via redefine macro as "-D__CET__=1"
1348
- fi
1344
+ dnl The asm files can't see macro from AC_DEFINE, workaround this via cflag. If
1345
+ dnl the syscall doesn't exist, we may block the final ELF from __PROPERTY_SHSTK
1346
+ dnl via redefine macro as "-D__CET__=1".
1347
+ AS_VAR_IF ( [ php_cv_have_shadow_stack_syscall] , [ yes] ,
1348
+ [ fiber_asm_cflag="-DSHADOW_STACK_SYSCALL=1"] ,
1349
+ [ fiber_asm_cflag="-DSHADOW_STACK_SYSCALL=0"] )
1349
1350
1350
1351
if test "$fiber_asm" = 'yes'; then
1351
1352
AC_MSG_CHECKING ( [ for fiber switching context] )
@@ -1776,7 +1777,7 @@ PHP_ADD_SOURCES(Zend, \
1776
1777
Optimizer/escape_analysis.c \
1777
1778
Optimizer/compact_vars.c \
1778
1779
Optimizer/zend_dump.c \
1779
- , -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1780
+ , [ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $fiber_asm_cflag ] )
1780
1781
1781
1782
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
1782
1783
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
0 commit comments