[llvm-branch-commits] [compiler-rt] 673b12e - [tsan] Remove stdlib.h from dd_interceptors.cpp
Vitaly Buka via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 29 14:05:39 PST 2020
Author: Vitaly Buka
Date: 2020-12-29T14:00:54-08:00
New Revision: 673b12e76ff7a6941be35cf41dcb04a015acf51f
URL: https://github.com/llvm/llvm-project/commit/673b12e76ff7a6941be35cf41dcb04a015acf51f
DIFF: https://github.com/llvm/llvm-project/commit/673b12e76ff7a6941be35cf41dcb04a015acf51f.diff
LOG: [tsan] Remove stdlib.h from dd_interceptors.cpp
This fixes "realpath already defined" error.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D93877
Added:
Modified:
compiler-rt/lib/tsan/dd/dd_interceptors.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
index 35a0beb19196..f78ef2d44279 100644
--- a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
+++ b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
@@ -6,11 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include <pthread.h>
+
#include "dd_rtl.h"
#include "interception/interception.h"
+#include "sanitizer_common/sanitizer_allocator_internal.h"
#include "sanitizer_common/sanitizer_procmaps.h"
-#include <pthread.h>
-#include <stdlib.h>
using namespace __dsan;
@@ -163,12 +164,12 @@ static pthread_cond_t *init_cond(pthread_cond_t *c, bool force = false) {
uptr cond = atomic_load(p, memory_order_acquire);
if (!force && cond != 0)
return (pthread_cond_t*)cond;
- void *newcond = malloc(sizeof(pthread_cond_t));
+ void *newcond = InternalAlloc(sizeof(pthread_cond_t));
internal_memset(newcond, 0, sizeof(pthread_cond_t));
if (atomic_compare_exchange_strong(p, &cond, (uptr)newcond,
memory_order_acq_rel))
return (pthread_cond_t*)newcond;
- free(newcond);
+ InternalFree(newcond);
return (pthread_cond_t*)cond;
}
@@ -216,7 +217,7 @@ INTERCEPTOR(int, pthread_cond_destroy, pthread_cond_t *c) {
InitThread();
pthread_cond_t *cond = init_cond(c);
int res = REAL(pthread_cond_destroy)(cond);
- free(cond);
+ InternalFree(cond);
atomic_store((atomic_uintptr_t*)c, 0, memory_order_relaxed);
return res;
}
More information about the llvm-branch-commits
mailing list