On Fri, Sep 25, 2026 at 7:29 AM Jan Strater-Büddefeld via lists.openembedded.org <[email protected]> wrote:
> 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 <[email protected]> > Cc: Ross Burton <[email protected]> > --- > .../recipes-devtools/clang/compiler-rt_git.bb | 22 +++++++++++-------- > 1 file changed, 13 insertions(+), 9 deletions(-) > > diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb > b/meta/recipes-devtools/clang/compiler-rt_git.bb > index a265c2aa93..d6c06302c2 100644 > --- a/meta/recipes-devtools/clang/compiler-rt_git.bb > +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb > @@ -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 '' > new dependency on TUNE_CCARGS_MARCH causes the do_configure basehash mismatch for native variant. > + > + 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] > It does target the right bug, but it causes a build regression and a native/nativesdk sstate signature regression Pre-Thumb-2 ARM tunes (armv4t, armv5te, armv6) fail to build compiler-rt. because CMAKE_C_COMPILER_TARGET=arm.. makes compiler-rt pick the Thumb-2 optimized FP assembly which needs armv6t2 at minimum, problem is diagnosed rightly, but the fix is too broad. also check if -march values are valid triple arch components and regex also doesn't limit itself to 32-bit ARM I think the this will cause library name to change and has to match what the clang driver looks up. The TC_CXX_RUNTIME=llvm crtbegin/crtend symlinks use get_compiler_rt_arch(), which now returns names like armv7-a or armv8-a that compiler-rt never produces. > 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)} \ > " > -- > 2.55.0 > > > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#246626): https://lists.openembedded.org/g/openembedded-core/message/246626 Mute This Topic: https://lists.openembedded.org/mt/121427261/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
