mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 19:06:44 +00:00
tsan: fix linking of tsan runtime into dynamic libraries
versioned symbols can not be linked into dynamic library w/o linker script also simplifies code as side effect llvm-svn: 191056
This commit is contained in:
parent
ac30f9e8da
commit
b523b9c8d4
@ -35,9 +35,8 @@ void *GetFuncAddrVer(const char *func_name, const char *ver);
|
||||
(::__interception::uptr)&WRAP(func))
|
||||
|
||||
#if !defined(__ANDROID__) // android does not have dlvsym
|
||||
#define INTERCEPT_FUNCTION_VER(func, funcver, symver) \
|
||||
__asm__(".symver "#funcver","#func"@@"#symver); \
|
||||
::__interception::real_##funcver = (funcver##_f)(unsigned long) \
|
||||
#define INTERCEPT_FUNCTION_VER(func, symver) \
|
||||
::__interception::real_##func = (func##_f)(unsigned long) \
|
||||
::__interception::GetFuncAddrVer(#func, #symver)
|
||||
#endif // !defined(__ANDROID__)
|
||||
|
||||
|
@ -1057,49 +1057,49 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_unlock, void *m) {
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_init_2_3_2, void *c, void *a) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_init_2_3_2, c, a);
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_init, void *c, void *a) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_init, c, a);
|
||||
MemoryWrite(thr, pc, (uptr)c, kSizeLog1);
|
||||
int res = REAL(pthread_cond_init_2_3_2)(c, a);
|
||||
int res = REAL(pthread_cond_init)(c, a);
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_destroy_2_3_2, void *c) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_destroy_2_3_2, c);
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_destroy, void *c) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_destroy, c);
|
||||
MemoryWrite(thr, pc, (uptr)c, kSizeLog1);
|
||||
int res = REAL(pthread_cond_destroy_2_3_2)(c);
|
||||
int res = REAL(pthread_cond_destroy)(c);
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_signal_2_3_2, void *c) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_signal_2_3_2, c);
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_signal, void *c) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_signal, c);
|
||||
MemoryRead(thr, pc, (uptr)c, kSizeLog1);
|
||||
int res = REAL(pthread_cond_signal_2_3_2)(c);
|
||||
int res = REAL(pthread_cond_signal)(c);
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_broadcast_2_3_2, void *c) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_broadcast_2_3_2, c);
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_broadcast, void *c) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_broadcast, c);
|
||||
MemoryRead(thr, pc, (uptr)c, kSizeLog1);
|
||||
int res = REAL(pthread_cond_broadcast_2_3_2)(c);
|
||||
int res = REAL(pthread_cond_broadcast)(c);
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_wait_2_3_2, void *c, void *m) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_wait_2_3_2, c, m);
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_wait, void *c, void *m) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_wait, c, m);
|
||||
MutexUnlock(thr, pc, (uptr)m);
|
||||
MemoryRead(thr, pc, (uptr)c, kSizeLog1);
|
||||
int res = REAL(pthread_cond_wait_2_3_2)(c, m);
|
||||
int res = REAL(pthread_cond_wait)(c, m);
|
||||
MutexLock(thr, pc, (uptr)m);
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_timedwait_2_3_2, void *c, void *m,
|
||||
TSAN_INTERCEPTOR(int, pthread_cond_timedwait, void *c, void *m,
|
||||
void *abstime) {
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_timedwait_2_3_2, c, m, abstime);
|
||||
SCOPED_TSAN_INTERCEPTOR(pthread_cond_timedwait, c, m, abstime);
|
||||
MutexUnlock(thr, pc, (uptr)m);
|
||||
MemoryRead(thr, pc, (uptr)c, kSizeLog1);
|
||||
int res = REAL(pthread_cond_timedwait_2_3_2)(c, m, abstime);
|
||||
int res = REAL(pthread_cond_timedwait)(c, m, abstime);
|
||||
MutexLock(thr, pc, (uptr)m);
|
||||
return res;
|
||||
}
|
||||
@ -1995,18 +1995,12 @@ void InitializeInterceptors() {
|
||||
TSAN_INTERCEPT(pthread_rwlock_timedwrlock);
|
||||
TSAN_INTERCEPT(pthread_rwlock_unlock);
|
||||
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_init, pthread_cond_init_2_3_2,
|
||||
GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_destroy, pthread_cond_destroy_2_3_2,
|
||||
GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_signal, pthread_cond_signal_2_3_2,
|
||||
GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_broadcast, pthread_cond_broadcast_2_3_2,
|
||||
GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_wait, pthread_cond_wait_2_3_2,
|
||||
GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_timedwait, pthread_cond_timedwait_2_3_2,
|
||||
GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_init, GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_destroy, GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_signal, GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_broadcast, GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_wait, GLIBC_2.3.2);
|
||||
INTERCEPT_FUNCTION_VER(pthread_cond_timedwait, GLIBC_2.3.2);
|
||||
|
||||
TSAN_INTERCEPT(pthread_barrier_init);
|
||||
TSAN_INTERCEPT(pthread_barrier_destroy);
|
||||
|
@ -169,15 +169,12 @@ void StatOutput(u64 *stat) {
|
||||
name[StatInt_pthread_rwlock_timedwrlock]
|
||||
= " pthread_rwlock_timedwrlock ";
|
||||
name[StatInt_pthread_rwlock_unlock] = " pthread_rwlock_unlock ";
|
||||
name[StatInt_pthread_cond_init_2_3_2] = " pthread_cond_init ";
|
||||
name[StatInt_pthread_cond_destroy_2_3_2]
|
||||
= " pthread_cond_destroy ";
|
||||
name[StatInt_pthread_cond_signal_2_3_2]= " pthread_cond_signal ";
|
||||
name[StatInt_pthread_cond_broadcast_2_3_2]
|
||||
= " pthread_cond_broadcast ";
|
||||
name[StatInt_pthread_cond_wait_2_3_2] = " pthread_cond_wait ";
|
||||
name[StatInt_pthread_cond_timedwait_2_3_2]
|
||||
= " pthread_cond_timedwait ";
|
||||
name[StatInt_pthread_cond_init] = " pthread_cond_init ";
|
||||
name[StatInt_pthread_cond_destroy] = " pthread_cond_destroy ";
|
||||
name[StatInt_pthread_cond_signal] = " pthread_cond_signal ";
|
||||
name[StatInt_pthread_cond_broadcast] = " pthread_cond_broadcast ";
|
||||
name[StatInt_pthread_cond_wait] = " pthread_cond_wait ";
|
||||
name[StatInt_pthread_cond_timedwait] = " pthread_cond_timedwait ";
|
||||
name[StatInt_pthread_barrier_init] = " pthread_barrier_init ";
|
||||
name[StatInt_pthread_barrier_destroy] = " pthread_barrier_destroy ";
|
||||
name[StatInt_pthread_barrier_wait] = " pthread_barrier_wait ";
|
||||
|
@ -164,12 +164,12 @@ enum StatType {
|
||||
StatInt_pthread_rwlock_trywrlock,
|
||||
StatInt_pthread_rwlock_timedwrlock,
|
||||
StatInt_pthread_rwlock_unlock,
|
||||
StatInt_pthread_cond_init_2_3_2,
|
||||
StatInt_pthread_cond_destroy_2_3_2,
|
||||
StatInt_pthread_cond_signal_2_3_2,
|
||||
StatInt_pthread_cond_broadcast_2_3_2,
|
||||
StatInt_pthread_cond_wait_2_3_2,
|
||||
StatInt_pthread_cond_timedwait_2_3_2,
|
||||
StatInt_pthread_cond_init,
|
||||
StatInt_pthread_cond_destroy,
|
||||
StatInt_pthread_cond_signal,
|
||||
StatInt_pthread_cond_broadcast,
|
||||
StatInt_pthread_cond_wait,
|
||||
StatInt_pthread_cond_timedwait,
|
||||
StatInt_pthread_barrier_init,
|
||||
StatInt_pthread_barrier_destroy,
|
||||
StatInt_pthread_barrier_wait,
|
||||
|
Loading…
x
Reference in New Issue
Block a user