From 9aefde7fc740b73cd93ac5ccb6889dcb20c0f561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Izzo?= Date: Wed, 17 Feb 2021 09:52:36 +0100 Subject: [PATCH] Add undefined behaviour sanitizer option --- meson.build | 5 +++++ meson_options.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/meson.build b/meson.build index 4a8256fd..395acd21 100644 --- a/meson.build +++ b/meson.build @@ -280,6 +280,11 @@ if get_option('asan') linux_c_args += '-fsanitize=address' linux_l_args += '-fsanitize=address' endif +# Add Undefined Behaviour Sanitizer if required +if get_option('ubsan') + linux_c_args += '-fsanitize=undefined' + linux_l_args += '-fsanitize=undefined' +endif foreach k, v : linux_def if v == '' diff --git a/meson_options.txt b/meson_options.txt index ff520d51..9d797cb2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,3 @@ option('asan', type : 'boolean', value : false, description : 'Compile the software with AddressSanitizer') +option('ubsan', type : 'boolean', value : false, description : 'Compile the software with Undefined Behaviour Sanitizer') option('test', type: 'string', description: 'Replace the main OpenRTX source file with a specialized test')