[PATCH] [Tsan] Fix test.h to work on FreeBSD

Phabricator reviews at reviews.llvm.org
Fri Mar 13 07:11:33 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8303

Files:
  compiler-rt/trunk/test/tsan/test.h

Index: compiler-rt/trunk/test/tsan/test.h
===================================================================
--- compiler-rt/trunk/test/tsan/test.h
+++ compiler-rt/trunk/test/tsan/test.h
@@ -11,10 +11,16 @@
 __typeof(pthread_barrier_wait) *barrier_wait;
 
 void barrier_init(pthread_barrier_t *barrier, unsigned count) {
+#if defined(__FreeBSD__)
+  static const char libpthread_name[] = "libpthread.so";
+#else
+  static const char libpthread_name[] = "libpthread.so.0";
+#endif
+
   if (barrier_wait == 0) {
-    void *h = dlopen("libpthread.so.0", RTLD_LAZY);
+    void *h = dlopen(libpthread_name, RTLD_LAZY);
     if (h == 0) {
-      fprintf(stderr, "failed to dlopen libpthread.so.0, exiting\n");
+      fprintf(stderr, "failed to dlopen %s, exiting\n", libpthread_name);
       exit(1);
     }
     barrier_wait = (__typeof(barrier_wait))dlsym(h, "pthread_barrier_wait");

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8303.21929.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150313/2069789a/attachment.bin>


More information about the llvm-commits mailing list