Skip to content

Commit a785b2f

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Disable -fsanitize=function on Clang 17
2 parents a202bf5 + d5a25d5 commit a785b2f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

configure.ac

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,23 @@ if test "$PHP_UNDEFINED_SANITIZER" = "yes"; then
16201620
CFLAGS="$CFLAGS -fno-sanitize=object-size"
16211621
CXXFLAGS="$CFLAGS -fno-sanitize=object-size"
16221622
])
1623+
1624+
dnl Clang 17 adds stricter function pointer compatibility checks where pointer args cannot be
1625+
dnl cast to void*. In that case, set -fno-sanitize=function.
1626+
OLD_CFLAGS="$CFLAGS"
1627+
CFLAGS="$CFLAGS -fno-sanitize-recover=undefined"
1628+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1629+
void foo(char *string) {}
1630+
int main(void) {
1631+
void (*f)(void *) = (void (*)(void *))foo;
1632+
f("foo");
1633+
}
1634+
]])],,[ubsan_needs_no_function=yes],)
1635+
CFLAGS="$OLD_CFLAGS"
1636+
if test "$ubsan_needs_no_function" = yes; then
1637+
CFLAGS="$CFLAGS -fno-sanitize=function"
1638+
CXXFLAGS="$CFLAGS -fno-sanitize=function"
1639+
fi
16231640
], [AC_MSG_ERROR([UndefinedBehaviorSanitizer is not available])])
16241641
fi
16251642

0 commit comments

Comments
 (0)