diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-05-29 13:51:19 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-06-08 11:37:54 -0700 |
commit | e9a764eac78f6099d34dd9ce8faae906b3fa6b4c (patch) | |
tree | 629f4a3116761b6c8931f3ef8e04a87f9c0b2ac0 | |
parent | a3604860941ffa9c5ef9a254717651fe9f8c586e (diff) | |
download | meta-clang-e9a764eac78f6099d34dd9ce8faae906b3fa6b4c.tar.gz |
compiler-rt-sanitizers: Fix hwsan builds with llvm libunwind
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | recipes-devtools/clang/clang/0034-compiler-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch | 35 | ||||
-rw-r--r-- | recipes-devtools/clang/common.inc | 1 |
2 files changed, 36 insertions, 0 deletions
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 @@ | |||
1 | From fbc9b98b9f668bb6729c7f4c6cc9de9d40c674ce Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 29 May 2021 13:42:25 -0700 | ||
4 | Subject: [PATCH] compiler-rt: Use uintptr_t instead of _Unwind_Word | ||
5 | |||
6 | _Unwind_Word is defined in compiler specific unwind.h but not in | ||
7 | libunwind provided unwind.h header, it works in most cases because | ||
8 | compilers search compiler headers ahead of system headers but for some | ||
9 | systems e.g. musl bases systems the compiler provided versions are not | ||
10 | preferred over system headers and therefore relying on _Unwind_Word | ||
11 | means its expecting this define in all unwind.h headers which is not the | ||
12 | case, using uintptr_t means we don't need this from unwind.h | ||
13 | |||
14 | See https://reviews.llvm.org/D65699 | ||
15 | |||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | --- | ||
18 | compiler-rt/lib/hwasan/hwasan_exceptions.cpp | 4 ++-- | ||
19 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/compiler-rt/lib/hwasan/hwasan_exceptions.cpp b/compiler-rt/lib/hwasan/hwasan_exceptions.cpp | ||
22 | index 169e7876cb58..6ed1da335428 100644 | ||
23 | --- a/compiler-rt/lib/hwasan/hwasan_exceptions.cpp | ||
24 | +++ b/compiler-rt/lib/hwasan/hwasan_exceptions.cpp | ||
25 | @@ -29,8 +29,8 @@ typedef _Unwind_Reason_Code PersonalityFn(int version, _Unwind_Action actions, | ||
26 | // is statically linked and the sanitizer runtime and the program are linked | ||
27 | // against different unwinders. The _Unwind_Context data structure is opaque so | ||
28 | // it may be incompatible between unwinders. | ||
29 | -typedef _Unwind_Word GetGRFn(_Unwind_Context* context, int index); | ||
30 | -typedef _Unwind_Word GetCFAFn(_Unwind_Context* context); | ||
31 | +typedef uintptr_t GetGRFn(_Unwind_Context* context, int index); | ||
32 | +typedef uintptr_t GetCFAFn(_Unwind_Context* context); | ||
33 | |||
34 | extern "C" SANITIZER_INTERFACE_ATTRIBUTE _Unwind_Reason_Code | ||
35 | __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 = "\ | |||
43 | file://0031-compiler-rt-Link-scudo-with-SANITIZER_CXX_ABI_LIBRAR.patch \ | 43 | file://0031-compiler-rt-Link-scudo-with-SANITIZER_CXX_ABI_LIBRAR.patch \ |
44 | file://0032-compiler-rt-Link-scudo-standalone-with-libatomic-on-.patch \ | 44 | file://0032-compiler-rt-Link-scudo-standalone-with-libatomic-on-.patch \ |
45 | file://0033-libunwind-Added-unw_backtrace-method.patch \ | 45 | file://0033-libunwind-Added-unw_backtrace-method.patch \ |
46 | file://0034-compiler-rt-Use-uintptr_t-instead-of-_Unwind_Word.patch \ | ||
46 | " | 47 | " |
47 | # Fallback to no-PIE if not set | 48 | # Fallback to no-PIE if not set |
48 | GCCPIE ??= "" | 49 | GCCPIE ??= "" |