From 52c7b51ab9ebe426a77559802333d8479864912e Mon Sep 17 00:00:00 2001 From: Florian Wühr Date: Wed, 22 Sep 2021 08:00:54 +0200 Subject: Compiler-rt: Backport clang 12 implementation to be able to build libtsan --- ...ler-rt-Fix-realpath-already-defined-error.patch | 54 ++++++++++++++++++++++ ...0005-compiler-rt-Disable-tsan-on-OE-glibc.patch | 40 ---------------- recipes-devtools/clang/common.inc | 2 +- 3 files changed, 55 insertions(+), 41 deletions(-) create mode 100755 recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch delete mode 100644 recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch 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 @@ +From dde0be40b3628caa4abbb7ca367bc753f7b7e7a6 Mon Sep 17 00:00:00 2001 +From: Alexander Thoma +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 + #include "dd_rtl.h" + #include "interception/interception.h" + #include "sanitizer_common/sanitizer_procmaps.h" +-#include +-#include ++#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 + 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 @@ -From 7730422bbca50431386391ed341c5d5ed649d14e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 18 Jul 2016 08:05:02 +0000 -Subject: [PATCH] compiler-rt: Disable tsan on OE/glibc - -It does not build see -http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html - -Signed-off-by: Khem Raj ---- - compiler-rt/cmake/config-ix.cmake | 2 +- - compiler-rt/test/sanitizer_common/CMakeLists.txt | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake -index 3aad08e8896..a979d38c7a6 100644 ---- a/compiler-rt/cmake/config-ix.cmake -+++ b/compiler-rt/cmake/config-ix.cmake -@@ -653,7 +653,7 @@ else() - endif() - - if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND -- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD") -+ OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD") - set(COMPILER_RT_HAS_TSAN TRUE) - else() - set(COMPILER_RT_HAS_TSAN FALSE) -diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt -index fcd651ebe42..821de915be8 100644 ---- a/compiler-rt/test/sanitizer_common/CMakeLists.txt -+++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt -@@ -11,7 +11,7 @@ set(SANITIZER_COMMON_TESTSUITES) - # FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of - # the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other - # sanitizers work. --set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan) -+set(SUPPORTED_TOOLS_INIT asan lsan msan ubsan) - set(SUPPORTED_TOOLS) - foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT}) - 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 = "\ file://0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ file://0003-compiler-rt-support-a-new-embedded-linux-target.patch \ file://0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ - file://0005-compiler-rt-Disable-tsan-on-OE-glibc.patch \ + file://0001-compiler-rt-Fix-realpath-already-defined-error.patch \ file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ file://0007-llvm-allow-env-override-of-exe-path.patch \ file://0008-clang-driver-Check-sysroot-for-ldso-path.patch \ -- cgit v1.2.3-54-g00ecf