forked from OSchip/llvm-project
On FreeBSD, add -pthread to ASan dynamic compile flags for tests
Otherwise, lots of these tests fail with a CHECK error similar to: ==12345==AddressSanitizer CHECK failed: compiler-rt/lib/asan/asan_posix.cpp:120 "((0)) == ((pthread_key_create(&tsd_key, destructor)))" (0x0, 0x4e) This is because the default pthread stubs in FreeBSD's libc always return failures (such as ENOSYS for pthread_key_create) in case the pthread library is not linked in. Reviewed By: arichardson Differential Revision: https://reviews.llvm.org/D85082
This commit is contained in:
parent
f134fc4f1b
commit
3aecf4bdf3
|
@ -91,9 +91,12 @@ clang_asan_static_cxxflags = config.cxx_mode_flags + clang_asan_static_cflags
|
|||
asan_dynamic_flags = []
|
||||
if config.asan_dynamic:
|
||||
asan_dynamic_flags = ["-shared-libasan"]
|
||||
# On Windows, we need to simulate "clang-cl /MD" on the clang driver side.
|
||||
if platform.system() == 'Windows':
|
||||
# On Windows, we need to simulate "clang-cl /MD" on the clang driver side.
|
||||
asan_dynamic_flags += ["-D_MT", "-D_DLL", "-Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames"]
|
||||
elif platform.system() == 'FreeBSD':
|
||||
# On FreeBSD, we need to add -pthread to ensure pthread functions are available.
|
||||
asan_dynamic_flags += ['-pthread']
|
||||
config.available_features.add("asan-dynamic-runtime")
|
||||
else:
|
||||
config.available_features.add("asan-static-runtime")
|
||||
|
|
Loading…
Reference in New Issue