From: Viktor Kutuzov Date: Fri, 13 Mar 2015 14:08:55 +0000 (+0000) Subject: [Tsan] Fix test.h to work on FreeBSD X-Git-Tag: llvmorg-3.7.0-rc1~9325 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=281347aa5992f34b8609efe1e162aa9a0260eb4a;p=platform%2Fupstream%2Fllvm.git [Tsan] Fix test.h to work on FreeBSD Differential Revision: http://reviews.llvm.org/D8303 llvm-svn: 232167 --- diff --git a/compiler-rt/test/tsan/test.h b/compiler-rt/test/tsan/test.h index bb861b0..4e877f6 100644 --- a/compiler-rt/test/tsan/test.h +++ b/compiler-rt/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");