[PATCH] D85082: On FreeBSD, add -pthread to ASan dynamic compile flags for tests
Dimitry Andric via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 1 15:40:38 PDT 2020
dim created this revision.
dim added reviewers: emaste, kcc, rnk, arichardson.
Herald added subscribers: Sanitizers, krytarowski.
Herald added a project: Sanitizers.
dim requested review of this revision.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85082
Files:
compiler-rt/test/asan/lit.cfg.py
Index: compiler-rt/test/asan/lit.cfg.py
===================================================================
--- compiler-rt/test/asan/lit.cfg.py
+++ compiler-rt/test/asan/lit.cfg.py
@@ -91,9 +91,12 @@
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")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85082.282420.patch
Type: text/x-patch
Size: 892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200801/6adf1c1f/attachment.bin>
More information about the llvm-commits
mailing list