diff options
author | Florian Wühr <f.wuehr@rational-online.com> | 2021-09-22 08:00:54 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-09-22 18:40:19 -0700 |
commit | 52c7b51ab9ebe426a77559802333d8479864912e (patch) | |
tree | 360676de105b69f77e753832915992588740a653 | |
parent | 76c6751d721a4265e01bb71d8dc4fb46dca6602f (diff) | |
download | meta-clang-52c7b51ab9ebe426a77559802333d8479864912e.tar.gz |
Compiler-rt: Backport clang 12 implementation to be able to build libtsan
3 files changed, 55 insertions, 41 deletions
diff --git a/recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch b/recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch new file mode 100755 index 0000000..35e65d3 --- /dev/null +++ b/recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From dde0be40b3628caa4abbb7ca367bc753f7b7e7a6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Thoma <a.thoma@rational-online.com> | ||
3 | Date: Wed, 22 Sep 2021 07:46:29 +0200 | ||
4 | Subject: [PATCH] compiler-rt Fix realpath already defined error | ||
5 | |||
6 | --- | ||
7 | compiler-rt/lib/tsan/dd/dd_interceptors.cpp | 10 +++++----- | ||
8 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
9 | |||
10 | diff --git a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp | ||
11 | index 35a0beb19196..ed819339f3cb 100644 | ||
12 | --- a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp | ||
13 | +++ b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp | ||
14 | @@ -6,11 +6,11 @@ | ||
15 | // | ||
16 | //===----------------------------------------------------------------------===// | ||
17 | |||
18 | +#include <pthread.h> | ||
19 | #include "dd_rtl.h" | ||
20 | #include "interception/interception.h" | ||
21 | #include "sanitizer_common/sanitizer_procmaps.h" | ||
22 | -#include <pthread.h> | ||
23 | -#include <stdlib.h> | ||
24 | +#include "sanitizer_common/sanitizer_allocator_internal.h" | ||
25 | |||
26 | using namespace __dsan; | ||
27 | |||
28 | @@ -163,12 +163,12 @@ static pthread_cond_t *init_cond(pthread_cond_t *c, bool force = false) { | ||
29 | uptr cond = atomic_load(p, memory_order_acquire); | ||
30 | if (!force && cond != 0) | ||
31 | return (pthread_cond_t*)cond; | ||
32 | - void *newcond = malloc(sizeof(pthread_cond_t)); | ||
33 | + void *newcond = InternalAlloc(sizeof(pthread_cond_t)); | ||
34 | internal_memset(newcond, 0, sizeof(pthread_cond_t)); | ||
35 | if (atomic_compare_exchange_strong(p, &cond, (uptr)newcond, | ||
36 | memory_order_acq_rel)) | ||
37 | return (pthread_cond_t*)newcond; | ||
38 | - free(newcond); | ||
39 | + InternalFree(newcond); | ||
40 | return (pthread_cond_t*)cond; | ||
41 | } | ||
42 | |||
43 | @@ -216,7 +216,7 @@ INTERCEPTOR(int, pthread_cond_destroy, pthread_cond_t *c) { | ||
44 | InitThread(); | ||
45 | pthread_cond_t *cond = init_cond(c); | ||
46 | int res = REAL(pthread_cond_destroy)(cond); | ||
47 | - free(cond); | ||
48 | + InternalFree(cond); | ||
49 | atomic_store((atomic_uintptr_t*)c, 0, memory_order_relaxed); | ||
50 | return res; | ||
51 | } | ||
52 | -- | ||
53 | 2.25.1 | ||
54 | |||
diff --git a/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch b/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch deleted file mode 100644 index 59d774c..0000000 --- a/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | From 7730422bbca50431386391ed341c5d5ed649d14e Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 18 Jul 2016 08:05:02 +0000 | ||
4 | Subject: [PATCH] compiler-rt: Disable tsan on OE/glibc | ||
5 | |||
6 | It does not build see | ||
7 | http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | compiler-rt/cmake/config-ix.cmake | 2 +- | ||
12 | compiler-rt/test/sanitizer_common/CMakeLists.txt | 2 +- | ||
13 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake | ||
16 | index 3aad08e8896..a979d38c7a6 100644 | ||
17 | --- a/compiler-rt/cmake/config-ix.cmake | ||
18 | +++ b/compiler-rt/cmake/config-ix.cmake | ||
19 | @@ -653,7 +653,7 @@ else() | ||
20 | endif() | ||
21 | |||
22 | if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND | ||
23 | - OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD") | ||
24 | + OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD") | ||
25 | set(COMPILER_RT_HAS_TSAN TRUE) | ||
26 | else() | ||
27 | set(COMPILER_RT_HAS_TSAN FALSE) | ||
28 | diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt | ||
29 | index fcd651ebe42..821de915be8 100644 | ||
30 | --- a/compiler-rt/test/sanitizer_common/CMakeLists.txt | ||
31 | +++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt | ||
32 | @@ -11,7 +11,7 @@ set(SANITIZER_COMMON_TESTSUITES) | ||
33 | # FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of | ||
34 | # the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other | ||
35 | # sanitizers work. | ||
36 | -set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan) | ||
37 | +set(SUPPORTED_TOOLS_INIT asan lsan msan ubsan) | ||
38 | set(SUPPORTED_TOOLS) | ||
39 | foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT}) | ||
40 | string(TOUPPER ${SANITIZER_TOOL} SANITIZER_TOOL_UPPER) | ||
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index d257f4b..a72d12e 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc | |||
@@ -12,7 +12,7 @@ SRC_URI = "\ | |||
12 | file://0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ | 12 | file://0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ |
13 | file://0003-compiler-rt-support-a-new-embedded-linux-target.patch \ | 13 | file://0003-compiler-rt-support-a-new-embedded-linux-target.patch \ |
14 | file://0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ | 14 | file://0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ |
15 | file://0005-compiler-rt-Disable-tsan-on-OE-glibc.patch \ | 15 | file://0001-compiler-rt-Fix-realpath-already-defined-error.patch \ |
16 | file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ | 16 | file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ |
17 | file://0007-llvm-allow-env-override-of-exe-path.patch \ | 17 | file://0007-llvm-allow-env-override-of-exe-path.patch \ |
18 | file://0008-clang-driver-Check-sysroot-for-ldso-path.patch \ | 18 | file://0008-clang-driver-Check-sysroot-for-ldso-path.patch \ |