mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
py/misc: Add a way to detect sanitizer builds.
Clang and gcc>=14 can use __has_feature() to detect if a sanitizer is enabled, but older GCC has no mechanism - need to set a macro explicitly for this to be recognised. Necessary for increasing some resource limits in sanitizer builds. Important not to use to avoid real issues! This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
@@ -518,12 +518,14 @@ CI_UNIX_OPTS_QEMU_RISCV64=(
|
||||
)
|
||||
|
||||
CI_UNIX_OPTS_SANITIZE_ADDRESS=(
|
||||
CFLAGS_EXTRA="-fsanitize=address --param asan-use-after-return=0"
|
||||
# Macro MP_ASAN allows detecting ASan on gcc<=13
|
||||
CFLAGS_EXTRA="-fsanitize=address --param asan-use-after-return=0 -DMP_ASAN=1"
|
||||
LDFLAGS_EXTRA="-fsanitize=address --param asan-use-after-return=0"
|
||||
)
|
||||
|
||||
CI_UNIX_OPTS_SANITIZE_UNDEFINED=(
|
||||
CFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute"
|
||||
# Macro MP_UBSAN allows detecting UBSan on gcc<=13
|
||||
CFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute -DMP_UBSAN=1"
|
||||
LDFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user