forked from lix-project/lix
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
This commit is contained in:
parent
1eef1927b6
commit
e0a3a5f226
|
@ -437,7 +437,9 @@ add_project_arguments(
|
||||||
language : 'cpp',
|
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
|
# 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.
|
# 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_arguments(sanitize_args, language: 'cpp')
|
||||||
add_project_link_arguments(sanitize_args, language: 'cpp')
|
add_project_link_arguments(sanitize_args, language: 'cpp')
|
||||||
endif
|
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')
|
add_project_link_arguments('-pthread', language : 'cpp')
|
||||||
if cxx.get_linker_id() in ['ld.bfd', 'ld.gold']
|
if cxx.get_linker_id() in ['ld.bfd', 'ld.gold']
|
||||||
|
|
Loading…
Reference in a new issue