[PATCH] D39254: On FreeBSD, add -pthread to the flags for dynamic ASan tests
Dimitry Andric via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 12:50:49 PDT 2017
dim created this revision.
Herald added a subscriber: kubamracek.
When the dynamic ASan tests are linked on FreeBSD, -pthread must be
added to the link flags (so that libthr.so is put in the NEEDED section
of the executable), otherwise the initial call to pthread_key_create()
in AsanTSDInit() will return ENOSYS, and ASan will fail to initialize.
I'm not completely sure if this is the correct way to add the flag, but
it worked for me...
https://reviews.llvm.org/D39254
Files:
test/asan/lit.cfg
Index: test/asan/lit.cfg
===================================================================
--- test/asan/lit.cfg
+++ test/asan/lit.cfg
@@ -77,6 +77,9 @@
asan_dynamic_flags = []
if config.asan_dynamic:
asan_dynamic_flags = ["-shared-libasan"]
+ # On FreeBSD, we need to add -pthread to ensure pthread functions are available.
+ if platform.system() == 'FreeBSD':
+ asan_dynamic_flags += ['-pthread']
# On Windows, we need to simulate "clang-cl /MD" on the clang driver side.
if platform.system() == 'Windows':
asan_dynamic_flags += ["-D_MT", "-D_DLL", "-Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames"]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39254.120118.patch
Type: text/x-patch
Size: 642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171024/7cf29a47/attachment.bin>
More information about the llvm-commits
mailing list