Message ID | 20250509115800.3929803-1-hongxu.jia@windriver.com |
---|---|
State | New |
Headers | show |
Series | compiler-rt-sanitizers, compiler-rt: skip for armv5 | expand |
On Fri, May 9, 2025 at 4:58 AM hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: > > $ echo 'MACHINE = "qemuarmv5"' >> conf/local.conf > $ bitbake compiler-rt compiler-rt-sanitizers > ... > tmp/work-shared/llvm-project-source-20.1.2-r0/llvm-project-20.1.2.src/compiler-rt/lib/builtins/arm/sync-ops.h:22:2: error: #error DMB is only supported on ARMv6+ > | 22 | #error DMB is only supported on ARMv6+ > | | ^~~~~ > > Due to upstream commit [[compiler-rt][builtins] Move DMB definition > to syn-ops.h][1], compiler-rt cross-compile for ARMv5 fails. > > [1] https://github.com/llvm/llvm-project/commit/1c9415806ba6d0d48a160637eea7d1b70efaae69 > while it might be fine to have it disabled for armv5, I think there is a compilation problem we are seeing here due to misconfiguration. qemuarmv5 is using armv5te for DEFAULTTUNE which also shows up in -march=armv5te in TUNE_CCARGS, compiler-rt build system skips compiling the sync_fetch_and_* routines if its armv5te and those routines are the only one's using DMB macro, now I wonder why compiler-rt cmake thinks it should be compiling for armv7 as it seems to be the case here, perhaps we are missing to feed the right value through configure arguments to cmake. We are passing HOST_ARCH to -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${HOST_ARCH} Perhaps it should be more qualified for qemuarmv5 case, it should be deduced from DEFAULTTUNE can you try building for qemuarmv5 using -DCOMPILER_RT_DEFAULT_TARGET_ARCH="${@bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)}" if this works then we need to define it more comprehensively we will need similar mapping for armv4t and armv6 as well. > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > --- > meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb | 1 + > meta/recipes-devtools/clang/compiler-rt_git.bb | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb > index b3c4bfcffdc..8b591b757e3 100644 > --- a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb > +++ b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb > @@ -129,3 +129,4 @@ COMPATIBLE_HOST:libc-musl:x86-64 = "(.*)" > COMPATIBLE_HOST:libc-musl:riscv64 = "(.*)" > COMPATIBLE_HOST:libc-musl:riscv32 = "(.*)" > COMPATIBLE_HOST:libc-musl = "null" > +COMPATIBLE_HOST:armv5 = "null" > diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb b/meta/recipes-devtools/clang/compiler-rt_git.bb > index 93928541273..d634c148508 100644 > --- a/meta/recipes-devtools/clang/compiler-rt_git.bb > +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb > @@ -119,3 +119,5 @@ BBCLASSEXTEND = "native nativesdk" > ALLOW_EMPTY:${PN} = "1" > > SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}" > + > +COMPATIBLE_HOST:armv5 = "null" > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#216201): https://lists.openembedded.org/g/openembedded-core/message/216201 > Mute This Topic: https://lists.openembedded.org/mt/112897300/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
Hi Khem, I followed your suggestions to apply the following change on compiler-rt recipe and build it for qemuarmv5, the failure remains --- a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb +++ b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb @@ -74,6 +74,7 @@ EXTRA_OECMAKE:append:class-target = "\ -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS} \ + -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ " diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb b/meta/recipes-devtools/clang/compiler-rt_git.bb index 93928541273..8073bc139eb 100644 --- a/meta/recipes-devtools/clang/compiler-rt_git.bb +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb @@ -80,6 +80,7 @@ EXTRA_OECMAKE:append:class-target = "\ -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \ + -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ " $ echo 'MACHINE = "qemuarmv5"' >> conf/local.conf $ bitbake compiler-rt ... /buildarea5/hjia/poky/build/tmp/work-shared/llvm-project-source-20.1.3-r0/llvm-project-20.1.3.src/compiler-rt/lib/builtins/arm/sync-ops.h:22:2: error: #error DMB is only supported on ARMv6+ 22 | #error DMB is only supported on ARMv6+ | ^~~~~ ... //Hongxu
On Sat, May 10, 2025 at 7:52 AM hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: > Hi Khem, > > I followed your suggestions to apply the following change on compiler-rt > recipe and build it for qemuarmv5, the failure remains > Right I think the issue is that it also needs arch value set to armv5te from toolchain triple and we use arm-poky-Linux-gnueabi and that confuses compiler-rt cmake as well I think it needs to be fixed as well along with host arch > --- a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb > +++ b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb > @@ -74,6 +74,7 @@ EXTRA_OECMAKE:append:class-target = "\ > > -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ > > -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ > > -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS} \ > + > -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', > 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ > -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \ > -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ > " > diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb > b/meta/recipes-devtools/clang/compiler-rt_git.bb > index 93928541273..8073bc139eb 100644 > --- a/meta/recipes-devtools/clang/compiler-rt_git.bb > +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb > @@ -80,6 +80,7 @@ EXTRA_OECMAKE:append:class-target = "\ > > -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ > > -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ > > -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \ > + > -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', > 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ > -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ > " > > $ echo 'MACHINE = "qemuarmv5"' >> conf/local.conf > $ bitbake compiler-rt > ... > /buildarea5/hjia/poky/build/tmp/work-shared/llvm-project-source-20.1.3-r0/llvm-project-20.1.3.src/compiler-rt/lib/builtins/arm/sync-ops.h:22:2: > error: #error DMB is only supported on ARMv6+ > 22 | #error DMB is only supported on ARMv6+ > | ^~~~~ > ... > > //Hongxu > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#216273): > https://lists.openembedded.org/g/openembedded-core/message/216273 > Mute This Topic: https://lists.openembedded.org/mt/112897300/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
I have a couple of patches to fix the compiler-rt builds for < armv6 which are under test, I will send that later today. On Sat, May 10, 2025 at 7:59 AM Khem Raj <raj.khem@gmail.com> wrote: > > > > On Sat, May 10, 2025 at 7:52 AM hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: >> >> Hi Khem, >> >> I followed your suggestions to apply the following change on compiler-rt recipe and build it for qemuarmv5, the failure remains > > > Right I think the issue is that it also needs arch value set to armv5te from toolchain triple and we use arm-poky-Linux-gnueabi and that confuses compiler-rt cmake as well I think it needs to be fixed as well along with host arch > >> >> --- a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb >> +++ b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb >> @@ -74,6 +74,7 @@ EXTRA_OECMAKE:append:class-target = "\ >> -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ >> -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ >> -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS} \ >> + -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ >> -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \ >> -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ >> " >> diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb b/meta/recipes-devtools/clang/compiler-rt_git.bb >> index 93928541273..8073bc139eb 100644 >> --- a/meta/recipes-devtools/clang/compiler-rt_git.bb >> +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb >> @@ -80,6 +80,7 @@ EXTRA_OECMAKE:append:class-target = "\ >> -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ >> -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ >> -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \ >> + -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ >> -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ >> " >> >> $ echo 'MACHINE = "qemuarmv5"' >> conf/local.conf >> $ bitbake compiler-rt >> ... >> /buildarea5/hjia/poky/build/tmp/work-shared/llvm-project-source-20.1.3-r0/llvm-project-20.1.3.src/compiler-rt/lib/builtins/arm/sync-ops.h:22:2: error: #error DMB is only supported on ARMv6+ >> 22 | #error DMB is only supported on ARMv6+ >> | ^~~~~ >> ... >> >> //Hongxu >> >> -=-=-=-=-=-=-=-=-=-=-=- >> Links: You receive all messages sent to this group. >> View/Reply Online (#216273): https://lists.openembedded.org/g/openembedded-core/message/216273 >> Mute This Topic: https://lists.openembedded.org/mt/112897300/1997914 >> Group Owner: openembedded-core+owner@lists.openembedded.org >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] >> -=-=-=-=-=-=-=-=-=-=-=- >>
Please see https://patchwork.yoctoproject.org/project/oe-core/list/?series=34391 Will be good if you can test it in your env. On Sat, May 10, 2025 at 2:29 PM Khem Raj <raj.khem@gmail.com> wrote: > > I have a couple of patches to fix the compiler-rt builds for < armv6 > which are under test, I will send that later today. > > On Sat, May 10, 2025 at 7:59 AM Khem Raj <raj.khem@gmail.com> wrote: > > > > > > > > On Sat, May 10, 2025 at 7:52 AM hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: > >> > >> Hi Khem, > >> > >> I followed your suggestions to apply the following change on compiler-rt recipe and build it for qemuarmv5, the failure remains > > > > > > Right I think the issue is that it also needs arch value set to armv5te from toolchain triple and we use arm-poky-Linux-gnueabi and that confuses compiler-rt cmake as well I think it needs to be fixed as well along with host arch > > > >> > >> --- a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb > >> +++ b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb > >> @@ -74,6 +74,7 @@ EXTRA_OECMAKE:append:class-target = "\ > >> -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ > >> -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ > >> -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS} \ > >> + -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ > >> -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \ > >> -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ > >> " > >> diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb b/meta/recipes-devtools/clang/compiler-rt_git.bb > >> index 93928541273..8073bc139eb 100644 > >> --- a/meta/recipes-devtools/clang/compiler-rt_git.bb > >> +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb > >> @@ -80,6 +80,7 @@ EXTRA_OECMAKE:append:class-target = "\ > >> -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ > >> -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ > >> -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \ > >> + -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', 'armv5te', '${HOST_ARCH}', d)} \ > >> -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ > >> " > >> > >> $ echo 'MACHINE = "qemuarmv5"' >> conf/local.conf > >> $ bitbake compiler-rt > >> ... > >> /buildarea5/hjia/poky/build/tmp/work-shared/llvm-project-source-20.1.3-r0/llvm-project-20.1.3.src/compiler-rt/lib/builtins/arm/sync-ops.h:22:2: error: #error DMB is only supported on ARMv6+ > >> 22 | #error DMB is only supported on ARMv6+ > >> | ^~~~~ > >> ... > >> > >> //Hongxu > >> > >> -=-=-=-=-=-=-=-=-=-=-=- > >> Links: You receive all messages sent to this group. > >> View/Reply Online (#216273): https://lists.openembedded.org/g/openembedded-core/message/216273 > >> Mute This Topic: https://lists.openembedded.org/mt/112897300/1997914 > >> Group Owner: openembedded-core+owner@lists.openembedded.org > >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > >> -=-=-=-=-=-=-=-=-=-=-=- > >>
Confirmed https://patchwork.yoctoproject.org/project/oe-core/list/?series=34391 It works well //Hongxu
diff --git a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb index b3c4bfcffdc..8b591b757e3 100644 --- a/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb +++ b/meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb @@ -129,3 +129,4 @@ COMPATIBLE_HOST:libc-musl:x86-64 = "(.*)" COMPATIBLE_HOST:libc-musl:riscv64 = "(.*)" COMPATIBLE_HOST:libc-musl:riscv32 = "(.*)" COMPATIBLE_HOST:libc-musl = "null" +COMPATIBLE_HOST:armv5 = "null" diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb b/meta/recipes-devtools/clang/compiler-rt_git.bb index 93928541273..d634c148508 100644 --- a/meta/recipes-devtools/clang/compiler-rt_git.bb +++ b/meta/recipes-devtools/clang/compiler-rt_git.bb @@ -119,3 +119,5 @@ BBCLASSEXTEND = "native nativesdk" ALLOW_EMPTY:${PN} = "1" SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}" + +COMPATIBLE_HOST:armv5 = "null"
$ echo 'MACHINE = "qemuarmv5"' >> conf/local.conf $ bitbake compiler-rt compiler-rt-sanitizers ... tmp/work-shared/llvm-project-source-20.1.2-r0/llvm-project-20.1.2.src/compiler-rt/lib/builtins/arm/sync-ops.h:22:2: error: #error DMB is only supported on ARMv6+ | 22 | #error DMB is only supported on ARMv6+ | | ^~~~~ Due to upstream commit [[compiler-rt][builtins] Move DMB definition to syn-ops.h][1], compiler-rt cross-compile for ARMv5 fails. [1] https://github.com/llvm/llvm-project/commit/1c9415806ba6d0d48a160637eea7d1b70efaae69 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb | 1 + meta/recipes-devtools/clang/compiler-rt_git.bb | 2 ++ 2 files changed, 3 insertions(+)