mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-31 23:15:44 +00:00
build-sys: add --enable-sanitizers
Typical slowdown introduced by AddressSanitizer is 2x. UBSan shouldn't have much impact on runtime cost. Enable it by default when --enable-debug, unless --disable-sanitizers. Backports commit 247724cb302af5d70c8853154b640dfabf2bbb56 from qemu
This commit is contained in:
parent
a78892c2f5
commit
001a86f02d
34
qemu/configure
vendored
34
qemu/configure
vendored
|
@ -161,6 +161,7 @@ unset target_list
|
|||
|
||||
debug_tcg="no"
|
||||
debug="no"
|
||||
sanitizers="no"
|
||||
strip_opt="yes"
|
||||
tcg_interpreter="no"
|
||||
bigendian="no"
|
||||
|
@ -199,6 +200,10 @@ for opt do
|
|||
;;
|
||||
--disable-debug-info) debug_info="no"
|
||||
;;
|
||||
--enable-sanitizers) sanitizers="yes"
|
||||
;;
|
||||
--disable-sanitizers) sanitizers="no"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# OS specific
|
||||
|
@ -656,6 +661,7 @@ Advanced options (experts only):
|
|||
--enable-debug-info enable debugging information (default)
|
||||
--disable-debug-info disable debugging information
|
||||
--enable-debug enable common debug build options
|
||||
--enable-sanitizers enable default sanitizers
|
||||
--disable-strip disable stripping binaries
|
||||
--disable-werror disable compilation abort on warning
|
||||
--disable-stack-protector disable compiler-provided stack protection
|
||||
|
@ -1129,6 +1135,34 @@ if compile_prog "" "" ; then
|
|||
atomic64=yes
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# checks for sanitizers
|
||||
|
||||
write_c_skeleton
|
||||
|
||||
have_asan=no
|
||||
have_ubsan=no
|
||||
|
||||
if test "$sanitizers" = "yes" ; then
|
||||
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
|
||||
have_asan=yes
|
||||
fi
|
||||
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
|
||||
have_ubsan=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# End of CC checks
|
||||
# After here, no more $cc or $ld runs
|
||||
|
||||
if test "$have_asan" = "yes"; then
|
||||
CFLAGS="-fsanitize=address $CFLAGS"
|
||||
fi
|
||||
if test "$have_ubsan" = "yes"; then
|
||||
CFLAGS="-fsanitize=undefined $CFLAGS"
|
||||
fi
|
||||
|
||||
# Now we've finished running tests it's OK to add -Werror to the compiler flags
|
||||
if test "$werror" = "yes"; then
|
||||
QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
|
||||
|
|
Loading…
Reference in a new issue