diff options
| author | Khem Raj <raj.khem@gmail.com> | 2025-05-10 15:05:43 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-15 10:55:26 +0100 |
| commit | fa724e8745d4bcdc2ee98f0c9a831b23bc9e30f9 (patch) | |
| tree | 23343f54f10f86dfe43c789a0f32c3513a71b222 | |
| parent | a104d73d7a3ff56448432d9beab895aaaba8ed8b (diff) | |
| download | poky-fa724e8745d4bcdc2ee98f0c9a831b23bc9e30f9.tar.gz | |
compiler-rt: Exclude sync builtins from build when arm < v6
arm architecture < v6 does not have the dmb support, therefore do
not add the sync primitives to compiler-rt builtins build
(From OE-Core rev: e1b143860b221600f7dab5c08e5b187aefb851dd)
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>
| -rw-r--r-- | meta/recipes-devtools/clang/clang/0038-compiler-rt-Exclude-sync_fetch_and_-for-any-pre-ARMv.patch | 61 | ||||
| -rw-r--r-- | meta/recipes-devtools/clang/common.inc | 1 |
2 files changed, 62 insertions, 0 deletions
diff --git a/meta/recipes-devtools/clang/clang/0038-compiler-rt-Exclude-sync_fetch_and_-for-any-pre-ARMv.patch b/meta/recipes-devtools/clang/clang/0038-compiler-rt-Exclude-sync_fetch_and_-for-any-pre-ARMv.patch new file mode 100644 index 0000000000..4639a73fe6 --- /dev/null +++ b/meta/recipes-devtools/clang/clang/0038-compiler-rt-Exclude-sync_fetch_and_-for-any-pre-ARMv.patch | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | From 5a0daa2dcc2bb39d87c4fcae7036cd8ab7ee6f6d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 10 May 2025 14:03:12 -0700 | ||
| 4 | Subject: [PATCH] compiler-rt: Exclude sync_fetch_and_* for any pre-ARMv6 targets | ||
| 5 | |||
| 6 | Sometimes builds may happen where ABI is not indidated by host_triple | ||
| 7 | e.g. on Yocto the compiler used is called arm-poky-linux-gnueabi-clang | ||
| 8 | for all arm32 cross compilers, it passed the ABI flags on cmdline in | ||
| 9 | addition. e.g. | ||
| 10 | |||
| 11 | -march=armv5te -mfloat-abi=soft | ||
| 12 | or | ||
| 13 | -march=armv7-a -mfloat-abi=hard | ||
| 14 | |||
| 15 | compiler-rt's makery tries to add arm to COMPILER_RT_SUPPORTED_ARCH | ||
| 16 | deducing it from triple name. | ||
| 17 | |||
| 18 | which ends up choosing `arm` as one of compiler-rt arch to build for. | ||
| 19 | This arch is however using armv7+ defaults and then tried to build sync | ||
| 20 | builtins using | ||
| 21 | |||
| 22 | arm-poky-linux-gnueabi-clang -march=armv5te -mfloat-abi=soft ... | ||
| 23 | |||
| 24 | Which does not compile correctly, in such cases it should simply | ||
| 25 | remove the sync builtins from list of things to build similar to what | ||
| 26 | is done when we use armv4t or armv5t | ||
| 27 | |||
| 28 | set(armv4t_SOURCES ${arm_min_SOURCES}) | ||
| 29 | set(armv5te_SOURCES ${arm_min_SOURCES}) | ||
| 30 | |||
| 31 | This lets compiler-rt build for arm architectures without depending | ||
| 32 | upong compiler triple, but instead of poking the compiler for what | ||
| 33 | it is building for | ||
| 34 | |||
| 35 | Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/139411] | ||
| 36 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 37 | --- | ||
| 38 | compiler-rt/lib/builtins/CMakeLists.txt | 12 ++++++++++++ | ||
| 39 | 1 file changed, 12 insertions(+) | ||
| 40 | |||
| 41 | --- a/compiler-rt/lib/builtins/CMakeLists.txt | ||
| 42 | +++ b/compiler-rt/lib/builtins/CMakeLists.txt | ||
| 43 | @@ -864,6 +864,18 @@ else () | ||
| 44 | list(JOIN BUILTIN_CFLAGS " " CMAKE_REQUIRED_FLAGS) | ||
| 45 | set(CMAKE_REQUIRED_FLAGS "${TARGET_${arch}_CFLAGS} ${BUILTIN_CFLAGS_${arch}}") | ||
| 46 | message(STATUS "Performing additional configure checks with target flags: ${CMAKE_REQUIRED_FLAGS}") | ||
| 47 | + # For ARM archs, exclude any sync builtins if dmb or mcr p15, #0, r0, c7, c10, #5 | ||
| 48 | + # is not supported | ||
| 49 | + if (${arch} MATCHES "^(arm|armhf)$") | ||
| 50 | + try_compile_only(COMPILER_RT_HAS_${arch}_SYNC | ||
| 51 | + SOURCE "#if __ARM_ARCH < 6 | ||
| 52 | + #error DMB is only supported on ARMv6+ ! | ||
| 53 | + #endif | ||
| 54 | + int main(void) { return 0; }") | ||
| 55 | + if(NOT COMPILER_RT_HAS_${arch}_SYNC) | ||
| 56 | + list(REMOVE_ITEM ${arch}_SOURCES ${arm_sync_SOURCES}) | ||
| 57 | + endif() | ||
| 58 | + endif() | ||
| 59 | # For ARM archs, exclude any VFP builtins if VFP is not supported | ||
| 60 | if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$") | ||
| 61 | string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}") | ||
diff --git a/meta/recipes-devtools/clang/common.inc b/meta/recipes-devtools/clang/common.inc index 07315f17e4..f661a6283e 100644 --- a/meta/recipes-devtools/clang/common.inc +++ b/meta/recipes-devtools/clang/common.inc | |||
| @@ -57,6 +57,7 @@ SRC_URI = "\ | |||
| 57 | file://0034-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ | 57 | file://0034-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ |
| 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 | " | 61 | " |
| 61 | # Fallback to no-PIE if not set | 62 | # Fallback to no-PIE if not set |
| 62 | GCCPIE ??= "" | 63 | GCCPIE ??= "" |
