[compiler-rt] r232167 - [Tsan] Fix test.h to work on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Fri Mar 13 07:08:56 PDT 2015


Author: vkutuzov
Date: Fri Mar 13 09:08:55 2015
New Revision: 232167

URL: http://llvm.org/viewvc/llvm-project?rev=232167&view=rev
Log:
[Tsan] Fix test.h to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D8303

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

Modified: compiler-rt/trunk/test/tsan/test.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/test.h?rev=232167&r1=232166&r2=232167&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/test.h (original)
+++ compiler-rt/trunk/test/tsan/test.h Fri Mar 13 09:08:55 2015
@@ -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");





More information about the llvm-commits mailing list