diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-06-18 16:31:58 -0700 |
---|---|---|
committer | Jade Lovelace <lix@jade.fyi> | 2024-06-18 19:25:58 -0700 |
commit | e0a3a5f2267b28b242c5e2fbaca261b0bbd607c0 (patch) | |
tree | cc81f3960da0ab304f57597c0892b0ed0fae81a5 | |
parent | 1eef1927b6505cdc848b037b3af53c46a01e3871 (diff) |
build: make UBSan work :)
This is really just a question of turning off the production sanitizer
configuration so we get nice diagnostics. Not much else to say.
Change-Id: I76bd6d225320056ed95bd89955f00beff2db0d2f
-rw-r--r-- | meson.build | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/meson.build b/meson.build index 672db4ddf..e6151e0a2 100644 --- a/meson.build +++ b/meson.build @@ -437,7 +437,9 @@ add_project_arguments( language : 'cpp', ) -if cxx.get_id() in ['gcc', 'clang'] +# We turn off the production UBSan if the slower dev UBSan is requested, to +# give better diagnostics. +if cxx.get_id() in ['gcc', 'clang'] and 'undefined' not in get_option('b_sanitize') # 2024-03-24: jade benchmarked the default sanitize reporting in clang and got # a regression of about 10% on hackage-packages.nix with clang. So we are trapping instead. # @@ -452,6 +454,11 @@ if cxx.get_id() in ['gcc', 'clang'] add_project_arguments(sanitize_args, language: 'cpp') add_project_link_arguments(sanitize_args, language: 'cpp') endif +# Clang's default of -no-shared-libsan on Linux causes link errors; on macOS it defaults to shared. +# GCC defaults to shared libsan so is fine. +if cxx.get_id() == 'clang' and get_option('b_sanitize') != '' + add_project_link_arguments('-shared-libsan', language : 'cpp') +endif add_project_link_arguments('-pthread', language : 'cpp') if cxx.get_linker_id() in ['ld.bfd', 'ld.gold'] |