@@ -49,13 +49,18 @@ TOOLCHAIN = "clang"
TOOLCHAIN_NATIVE = "clang"
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')
+ import re
+
+ tune_args = d.getVar('TUNE_CCARGS_MARCH') or ''
+
+ match = re.search(r'-march=(\S+)', tune_args)
+ arch = match.group(1) if match else d.getVar('HOST_ARCH')
+
+ return arch
+
+def get_compiler_rt_target(bb, d):
+ host_sys = d.getVar('HOST_SYS')
+ return get_compiler_rt_arch(bb, d) + '-' + host_sys.split('-', 1)[1]
INSTALL_VER ?= "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}${VER_SUFFIX}"
INSTALL_VER:class-native = "${@oe.utils.trim_version("${PV}", 1)}"
@@ -78,7 +83,6 @@ 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=${@get_compiler_rt_arch(bb, d)} \
-DLLVM_ENABLE_RUNTIMES=${RUNTIMES} \
-DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
-DLLVM_APPEND_VC_REV=OFF \
@@ -86,7 +90,7 @@ EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
- -DCMAKE_C_COMPILER_TARGET=${HOST_SYS} \
+ -DCMAKE_C_COMPILER_TARGET=${@get_compiler_rt_target(bb, d)} \
-DCOMPILER_RT_INSTALL_PATH=${nonarch_libdir}/clang/${INSTALL_VER} \
${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "${LLVMLIBGCCOPTS}", "", d)} \
"
Fixes [YOCTO #16424] The build system of compiler-rt can auto-detect some architectures like 'armv6m' via the `-march` compiler flag. For other targets, the arch type to build for must be set via the target triple `CMAKE_C_COMPILER_TARGET`. Before this commit, the arch type was simply 'arm'. This commit also removes setting the variable `COMPILER_RT_DEFAULT_TARGET_ARCH` because it is overridden anyway. AI-Generated: Uses GitHub Copilot Signed-off-by: Jan Strater-Büddefeld <jst@mbs-solutions.de> Cc: Ross Burton <Ross.Burton@arm.com> --- .../recipes-devtools/clang/compiler-rt_git.bb | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-)