diff options
| author | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2015-03-13 14:08:55 +0000 |
|---|---|---|
| committer | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2015-03-13 14:08:55 +0000 |
| commit | 281347aa5992f34b8609efe1e162aa9a0260eb4a (patch) | |
| tree | 5a5d0f6b9a3b559a7d5d3ceb4c61fd5e6e824563 | |
| parent | 9ecb0e96b8414ef95d747f659a32d85b68998cec (diff) | |
| download | bcm5719-llvm-281347aa5992f34b8609efe1e162aa9a0260eb4a.tar.gz bcm5719-llvm-281347aa5992f34b8609efe1e162aa9a0260eb4a.zip | |
[Tsan] Fix test.h to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D8303
llvm-svn: 232167
| -rw-r--r-- | compiler-rt/test/tsan/test.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler-rt/test/tsan/test.h b/compiler-rt/test/tsan/test.h index bb861b07745..4e877f6d8df 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"); |

