aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-08-13 19:52:15 +1000
committerThomas Huth <thuth@redhat.com>2024-09-11 09:49:11 +0200
commitcb771ac1f59ced0aba5acedacfd4e92a9d0727b6 (patch)
tree68cce5c1dfbb16e2561333ee8c390deaac62578e /meson.build
parenta66f28df650166ae8b50c992eea45e7b247f4143 (diff)
downloadqemu-cb771ac1f59ced0aba5acedacfd4e92a9d0727b6.zip
qemu-cb771ac1f59ced0aba5acedacfd4e92a9d0727b6.tar.gz
qemu-cb771ac1f59ced0aba5acedacfd4e92a9d0727b6.tar.bz2
meson: Split --enable-sanitizers to --enable-{asan, ubsan}
We do not always want both address and undefined behavior sanitizers running at the same time. For the gitlab custom-runners, drop to only --enable-ubsan. These jobs are not run by default, but as will be obvious in the next patch, we don't run ASan on x86 either, and it seems wrong to hold aarch64 and s390x to a different standard. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-ID: <20240813095216.306555-2-richard.henderson@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build15
1 files changed, 11 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index b89b713..583123e 100644
--- a/meson.build
+++ b/meson.build
@@ -479,24 +479,31 @@ if get_option('safe_stack') and coroutine_backend != 'ucontext'
error('SafeStack is only supported with the ucontext coroutine backend')
endif
-if get_option('sanitizers')
+if get_option('asan')
if cc.has_argument('-fsanitize=address')
qemu_cflags = ['-fsanitize=address'] + qemu_cflags
qemu_ldflags = ['-fsanitize=address'] + qemu_ldflags
+ else
+ error('Your compiler does not support -fsanitize=address')
endif
+endif
- # Detect static linking issue with ubsan - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
+if get_option('ubsan')
+ # Detect static linking issue with ubsan:
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
if cc.links('int main(int argc, char **argv) { return argc + 1; }',
args: [qemu_ldflags, '-fsanitize=undefined'])
qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags
qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags
+ else
+ error('Your compiler does not support -fsanitize=undefined')
endif
endif
# Thread sanitizer is, for now, much noisier than the other sanitizers;
# keep it separate until that is not the case.
if get_option('tsan')
- if get_option('sanitizers')
+ if get_option('asan') or get_option('ubsan')
error('TSAN is not supported with other sanitizers')
endif
if not cc.has_function('__tsan_create_fiber',
@@ -2525,7 +2532,7 @@ if rdma.found()
endif
have_asan_fiber = false
-if get_option('sanitizers') and \
+if get_option('asan') and \
not cc.has_function('__sanitizer_start_switch_fiber',
args: '-fsanitize=address',
prefix: '#include <sanitizer/asan_interface.h>')