From a104d73d7a3ff56448432d9beab895aaaba8ed8b Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 10 May 2025 15:05:42 -0700 Subject: [PATCH] compiler-rt: Map the COMPILER_RT_DEFAULT_TARGET_ARCH COMPILER_RT_DEFAULT_TARGET_ARCH is not 1 to 1 match with HOST_ARCH especially for armv5/arm4 (From OE-Core rev: 71f7db2e5d264bc6ed50fae48567ae674af9a700) Signed-off-by: Khem Raj Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/recipes-devtools/clang/compiler-rt_git.bb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb b/meta/recipes-devtools/clang/compiler-rt_git.bb index 0a0ef6be80..5044db6249 100644 --- a/meta/recipes-devtools/clang/compiler-rt_git.bb +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb @@ -58,6 +58,15 @@ BUILD_CXX = "${CCACHE}clang++ ${BUILD_CC_ARCH}" LDFLAGS += "${COMPILER_RT} ${UNWINDLIB}" CXXFLAGS += "${LIBCPLUSPLUS}" +def get_compiler_rt_arch(bb, d): + if bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', True, False, d): + return 'armv5te' + elif bb.utils.contains('TUNE_FEATURES', 'armv4 thumb', True, False, d): + return 'armv4t' + elif bb.utils.contains('TUNE_FEATURES', 'arm vfp callconvention-hard', True, False, d): + return 'armhf' + return d.getVar('HOST_ARCH') + OECMAKE_TARGET_COMPILE = "compiler-rt" OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers" OECMAKE_SOURCEPATH = "${S}/llvm" @@ -70,7 +79,7 @@ EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCOMPILER_RT_BUILD_SANITIZERS=OFF \ -DCOMPILER_RT_BUILD_MEMPROF=OFF \ -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \ - -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${HOST_ARCH} \ + -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@get_compiler_rt_arch(bb, d)} \ -DLLVM_ENABLE_RUNTIMES='compiler-rt' \ -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \ -DLLVM_APPEND_VC_REV=OFF \