summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch
blob: 35e65d345f96f7ffd038532bfef903aaeafbb22e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From dde0be40b3628caa4abbb7ca367bc753f7b7e7a6 Mon Sep 17 00:00:00 2001
From: Alexander Thoma <a.thoma@rational-online.com>
Date: Wed, 22 Sep 2021 07:46:29 +0200
Subject: [PATCH] compiler-rt Fix realpath already defined error

---
 compiler-rt/lib/tsan/dd/dd_interceptors.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
index 35a0beb19196..ed819339f3cb 100644
--- a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
+++ b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
@@ -6,11 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <pthread.h>
 #include "dd_rtl.h"
 #include "interception/interception.h"
 #include "sanitizer_common/sanitizer_procmaps.h"
-#include <pthread.h>
-#include <stdlib.h>
+#include "sanitizer_common/sanitizer_allocator_internal.h"
 
 using namespace __dsan;
 
@@ -163,12 +163,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 +216,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;
 }
-- 
2.25.1