diff options
| author | Khem Raj <raj.khem@gmail.com> | 2025-05-23 00:32:07 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-27 09:01:17 +0100 |
| commit | 2ee99d2ddc9d0dcd03298f042fb25166e832f203 (patch) | |
| tree | 24171a822f2c695cf9d24cfbade20eae99fbe975 /meta | |
| parent | bd46ed87bca0ad053701e4eccda730920e7271cb (diff) | |
| download | poky-2ee99d2ddc9d0dcd03298f042fb25166e832f203.tar.gz | |
compiler-rt-sanitizers: Fix build on mips
uintptr_t size is not consistent between compiler-rt and clang
for mips
(From OE-Core rev: 7f2b80c8eaaf226d3c9faed93e9c93879de50b54)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-devtools/clang/clang/0038-compiler-rt-Hardcode-uptr-sptr-typedefs-on-Mips-Linu.patch | 35 | ||||
| -rw-r--r-- | meta/recipes-devtools/clang/common.inc | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/meta/recipes-devtools/clang/clang/0038-compiler-rt-Hardcode-uptr-sptr-typedefs-on-Mips-Linu.patch b/meta/recipes-devtools/clang/clang/0038-compiler-rt-Hardcode-uptr-sptr-typedefs-on-Mips-Linu.patch new file mode 100644 index 0000000000..b54c163857 --- /dev/null +++ b/meta/recipes-devtools/clang/clang/0038-compiler-rt-Hardcode-uptr-sptr-typedefs-on-Mips-Linu.patch | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | From 9f88f2e4efa56e53c78f9b67775c71afa711a69c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 22 May 2025 21:50:45 -0700 | ||
| 4 | Subject: [PATCH] [compiler-rt] Hardcode uptr/sptr typedefs on Mips/Linux | ||
| 5 | |||
| 6 | Sanitizer build on Mips/Linux faills to build due to assertion errors | ||
| 7 | mismatched definitions. This is due to inconsistent definitions of | ||
| 8 | `uptr` of either `unsigned long` or `unsigned int` in compiler-rt. This | ||
| 9 | is caused by clang defining | ||
| 10 | |||
| 11 | __UINTPTR_TYPE__ long unsigned int where as gcc defines it as | ||
| 12 | unsigned int | ||
| 13 | |||
| 14 | As a workaround, this hardcodes `uptr`/`sptr` in compiler-rt to | ||
| 15 | `unsigned int`/`int` on Linux Mips, matching gcc. | ||
| 16 | |||
| 17 | Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/141201] | ||
| 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 19 | --- | ||
| 20 | compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | 2 +- | ||
| 21 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 22 | |||
| 23 | diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | ||
| 24 | index fff60c96f632..511ee8fe49cc 100644 | ||
| 25 | --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | ||
| 26 | +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | ||
| 27 | @@ -139,7 +139,7 @@ | ||
| 28 | namespace __sanitizer { | ||
| 29 | |||
| 30 | #if defined(__UINTPTR_TYPE__) | ||
| 31 | -# if defined(__arm__) && defined(__linux__) | ||
| 32 | +# if (defined(__arm__) || _ABIO32 == 1) && defined(__linux__) | ||
| 33 | // Linux Arm headers redefine __UINTPTR_TYPE__ and disagree with clang/gcc. | ||
| 34 | typedef unsigned int uptr; | ||
| 35 | typedef int sptr; | ||
diff --git a/meta/recipes-devtools/clang/common.inc b/meta/recipes-devtools/clang/common.inc index f661a6283e..24f82f3812 100644 --- a/meta/recipes-devtools/clang/common.inc +++ b/meta/recipes-devtools/clang/common.inc | |||
| @@ -58,6 +58,7 @@ SRC_URI = "\ | |||
| 58 | file://0035-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch \ | 58 | file://0035-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch \ |
| 59 | file://0036-openmp-Do-not-emit-date-and-time-into-generate-files.patch \ | 59 | file://0036-openmp-Do-not-emit-date-and-time-into-generate-files.patch \ |
| 60 | file://0038-compiler-rt-Exclude-sync_fetch_and_-for-any-pre-ARMv.patch \ | 60 | file://0038-compiler-rt-Exclude-sync_fetch_and_-for-any-pre-ARMv.patch \ |
| 61 | file://0038-compiler-rt-Hardcode-uptr-sptr-typedefs-on-Mips-Linu.patch \ | ||
| 61 | " | 62 | " |
| 62 | # Fallback to no-PIE if not set | 63 | # Fallback to no-PIE if not set |
| 63 | GCCPIE ??= "" | 64 | GCCPIE ??= "" |
