From e9a764eac78f6099d34dd9ce8faae906b3fa6b4c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 29 May 2021 13:51:19 -0700 Subject: compiler-rt-sanitizers: Fix hwsan builds with llvm libunwind Signed-off-by: Khem Raj --- ...-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch | 35 ++++++++++++++++++++++ recipes-devtools/clang/common.inc | 1 + 2 files changed, 36 insertions(+) create mode 100644 recipes-devtools/clang/clang/0034-compiler-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch (limited to 'recipes-devtools/clang') diff --git a/recipes-devtools/clang/clang/0034-compiler-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch b/recipes-devtools/clang/clang/0034-compiler-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch new file mode 100644 index 0000000..d04e0e8 --- /dev/null +++ b/recipes-devtools/clang/clang/0034-compiler-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch @@ -0,0 +1,35 @@ +From fbc9b98b9f668bb6729c7f4c6cc9de9d40c674ce Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 29 May 2021 13:42:25 -0700 +Subject: [PATCH] compiler-rt: Use uintptr_t instead of _Unwind_Word + +_Unwind_Word is defined in compiler specific unwind.h but not in +libunwind provided unwind.h header, it works in most cases because +compilers search compiler headers ahead of system headers but for some +systems e.g. musl bases systems the compiler provided versions are not +preferred over system headers and therefore relying on _Unwind_Word +means its expecting this define in all unwind.h headers which is not the +case, using uintptr_t means we don't need this from unwind.h + +See https://reviews.llvm.org/D65699 + +Signed-off-by: Khem Raj +--- + compiler-rt/lib/hwasan/hwasan_exceptions.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/compiler-rt/lib/hwasan/hwasan_exceptions.cpp b/compiler-rt/lib/hwasan/hwasan_exceptions.cpp +index 169e7876cb58..6ed1da335428 100644 +--- a/compiler-rt/lib/hwasan/hwasan_exceptions.cpp ++++ b/compiler-rt/lib/hwasan/hwasan_exceptions.cpp +@@ -29,8 +29,8 @@ typedef _Unwind_Reason_Code PersonalityFn(int version, _Unwind_Action actions, + // is statically linked and the sanitizer runtime and the program are linked + // against different unwinders. The _Unwind_Context data structure is opaque so + // it may be incompatible between unwinders. +-typedef _Unwind_Word GetGRFn(_Unwind_Context* context, int index); +-typedef _Unwind_Word GetCFAFn(_Unwind_Context* context); ++typedef uintptr_t GetGRFn(_Unwind_Context* context, int index); ++typedef uintptr_t GetCFAFn(_Unwind_Context* context); + + extern "C" SANITIZER_INTERFACE_ATTRIBUTE _Unwind_Reason_Code + __hwasan_personality_wrapper(int version, _Unwind_Action actions, diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index 62be08a..71017f1 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc @@ -43,6 +43,7 @@ SRC_URI = "\ file://0031-compiler-rt-Link-scudo-with-SANITIZER_CXX_ABI_LIBRAR.patch \ file://0032-compiler-rt-Link-scudo-standalone-with-libatomic-on-.patch \ file://0033-libunwind-Added-unw_backtrace-method.patch \ + file://0034-compiler-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch \ " # Fallback to no-PIE if not set GCCPIE ??= "" -- cgit v1.2.3-54-g00ecf