Skip to content

Commit

Permalink
Disable -fsanitize=function on Clang 17
Browse files Browse the repository at this point in the history
Closes GH-12642
  • Loading branch information
iluuu1994 committed Nov 11, 2023
1 parent 7440a1b commit ca22505
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,23 @@ if test "$PHP_UNDEFINED_SANITIZER" = "yes"; then
CFLAGS="$CFLAGS -fno-sanitize=object-size"
CXXFLAGS="$CFLAGS -fno-sanitize=object-size"
])
dnl Clang 17 adds stricter function pointer compatibility checks where pointer args cannot be
dnl cast to void*. In that case, set -fno-sanitize=function.
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-sanitize-recover=undefined"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
void foo(char *string) {}
int main(void) {
void (*f)(void *) = (void (*)(void *))foo;
f("foo");
}
]])],,[ubsan_needs_no_function=yes],)
CFLAGS="$OLD_CFLAGS"
if test "$ubsan_needs_no_function" = yes; then
CFLAGS="$CFLAGS -fno-sanitize=function"
CXXFLAGS="$CFLAGS -fno-sanitize=function"
fi
], [AC_MSG_ERROR([UndefinedBehaviorSanitizer is not available])])
fi

Expand Down

0 comments on commit ca22505

Please sign in to comment.