8334618: ubsan: support setting additional ubsan check options

Reviewed-by: stuefe, lucy
This commit is contained in:
Matthias Baesken 2024-06-26 13:37:58 +00:00
parent b2ac7259c9
commit efb905e57a

View File

@ -496,9 +496,15 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER],
#
AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
[
UTIL_ARG_WITH(NAME: additional-ubsan-checks, TYPE: string,
DEFAULT: [],
DESC: [Customizes the ubsan checks],
OPTIONAL: true)
# GCC reports lots of likely false positives for stringop-truncation and format-overflow.
# Silence them for now.
UBSAN_CHECKS="-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment"
UBSAN_CHECKS="-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment \
$ADDITIONAL_UBSAN_CHECKS"
UBSAN_CFLAGS="$UBSAN_CHECKS -Wno-stringop-truncation -Wno-format-overflow -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER"
UBSAN_LDFLAGS="$UBSAN_CHECKS"
UTIL_ARG_ENABLE(NAME: ubsan, DEFAULT: false, RESULT: UBSAN_ENABLED,