mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 10:14:13 +08:00
meson: Add blacklist when compiling with tsan
Check whether the compiler actually supports it and if not than warn about it. Note that meson will also suggest that one should use the build-in flag, but this is just sloppy testing for -fsanitize, -fsanitize-blacklist is actually not available as build-in option. v2: define THREAD_SANITIZER to 1 or 0 (suggested by Yonggang Luo) v3: Update comment about meson warning (Dylan Baker) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28650>
This commit is contained in:
parent
446672f9b1
commit
0d46e0e88b
17
meson.build
17
meson.build
@ -1909,6 +1909,23 @@ else
|
||||
asan_c_args = ['-DBUILT_WITH_ASAN=0']
|
||||
endif
|
||||
|
||||
# ThreadSanitizer can't deal with futexes, and reports races for cases we don't care about
|
||||
# so add a define to work silence these issues.
|
||||
if get_option('b_sanitize') == 'thread'
|
||||
pre_args += '-DTHREAD_SANITIZER=1'
|
||||
# meson versions prior to 1.4 will warn "Consider using the built-in option for sanitizers ..."
|
||||
# later on because it only checks whether the option starts with "-fsanitize",
|
||||
# but there is no built-in option for adding a blacklist
|
||||
tsan_blacklist = '-fsanitize-blacklist=@0@'.format(join_paths(meson.project_source_root(), 'tsan-blacklist.txt'))
|
||||
if cc.has_argument(tsan_blacklist)
|
||||
pre_args += tsan_blacklist
|
||||
else
|
||||
warning('Compiler does not support "-fsanitize-blacklist", expected race conditions will not be surpressed')
|
||||
endif
|
||||
else
|
||||
pre_args += '-DTHREAD_SANITIZER=0'
|
||||
endif
|
||||
|
||||
yacc_is_bison = true
|
||||
needs_flex_bison = with_any_opengl or with_freedreno_vk or with_intel_tools or with_gallium
|
||||
|
||||
|
2
tsan-blacklist.txt
Normal file
2
tsan-blacklist.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# Placeholder file, will be filled with surpressions for TSAN
|
||||
|
Loading…
Reference in New Issue
Block a user