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')