Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang ias: fatal error: error in backend: Unknown Arch: xscale #1276

Closed
arndb opened this issue Jan 27, 2021 · 9 comments
Closed

clang ias: fatal error: error in backend: Unknown Arch: xscale #1276

arndb opened this issue Jan 27, 2021 · 9 comments
Assignees
Labels
[ARCH] arm32 This bug impacts ARCH=arm [FIXED][LLVM] 13 This bug was fixed in LLVM 13.x [TOOL] integrated-as The issue is relevant to LLVM integrated assembler

Comments

@arndb
Copy link

arndb commented Jan 27, 2021

I hit this bug when building arch/arm/mm/copypage-xscale.c with the integrated assembler:

fatal error: error in backend: Unknown Arch: xscale
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/clang-12 -mlittle-endian -fmacro-prefix-map=/git/arm-soc/= -Wall -Wundef -Werror=strict-prototypes -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -std=gnu89 --target=arm-linux-gnueabi --prefix=/home/arnd/cross/x86_64/gcc-10.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- --gcc-toolchain=/home/arnd/cross/x86_64/gcc-10.1.0-nolibc/arm-linux-gnueabi -Werror=unknown-warning-option -msoft-float -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mabi=aapcs-linux -mfpu=vfp -meabi gnu -marm -march=armv5te -mtune=xscale -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fstack-protector -mno-global-merge -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-omit-leaf-frame-pointer -ftrivial-auto-var-init=pattern -pg -Wdeclaration-after-statement -Wvla -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wa,-W -Wa,-mcpu=xscale -Werror -nostdinc -isystem /usr/lib/llvm-12/lib/clang/12.0.0/include -I/git/arm-soc/arch/arm/include -I./arch/arm/include/generated -I/git/arm-soc/include -I./include -I/git/arm-soc/arch/arm/include/uapi -I./arch/arm/include/generated/uapi -I/git/arm-soc/include/uapi -I./include/generated/uapi -include /git/arm-soc/include/linux/kconfig.h -include /git/arm-soc/include/linux/compiler_types.h -D__KERNEL__ -I/git/arm-soc/arch/arm/mach-ixp4xx/include -DKBUILD_ERR0 -D__LINUX_ARM_ARCH__=5 -Uarm -I /git/arm-soc/arch/arm/mm -I ./arch/arm/mm -DKBUILD_MODFILE="arch/arm/mm/copypage-xscale" -DKBUILD_BASENAME="copypage_xscale" -DKBUILD_MODNAME="copypage_xscale" -D__KBUILD_MODNAME=kmod_copypage_xscale -c -o arch/arm/mm/copypage-xscale.o /git/arm-soc/arch/arm/mm/copypage-xscale.c

@nickdesaulniers
Copy link
Member

CONFIG_CPU_XSCALE?

@nickdesaulniers nickdesaulniers added [ARCH] arm32 This bug impacts ARCH=arm [TOOL] integrated-as The issue is relevant to LLVM integrated assembler labels Jan 27, 2021
@arndb
Copy link
Author

arndb commented Mar 2, 2021

This is the patch I have applied locally:

index 8fc8f3b91197..3cc74a4862c5 100644
--- a/arch/arm/mm/copypage-xsc3.c
+++ b/arch/arm/mm/copypage-xsc3.c
@@ -29,7 +29,7 @@ static void xsc3_mc_copy_user_page(void *kto, const void *kfrom)
        int tmp;
 
        asm volatile ("\
-.arch  xscale                                  \n\
+.arch  armv5te                                 \n\
        pld     [%1, #0]                        \n\
        pld     [%1, #32]                       \n\
 1:     pld     [%1, #64]                       \n\
@@ -81,7 +81,7 @@ void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
 {
        void *ptr, *kaddr = kmap_atomic(page);
        asm volatile ("\
-.arch  xscale                                  \n\
+.arch  armv5te                                 \n\
        mov     r1, %2                          \n\
        mov     r2, #0                          \n\
        mov     r3, #0                          \n\
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c
index eb5d338657d1..c7461755082b 100644
--- a/arch/arm/mm/copypage-xscale.c
+++ b/arch/arm/mm/copypage-xscale.c
@@ -41,7 +41,7 @@ static void mc_copy_user_page(void *from, void *to)
         * when prefetching destination as well.  (NP)
         */
        asm volatile ("\
-.arch xscale                                   \n\
+.arch armv5te                                  \n\
        pld     [%0, #0]                        \n\
        pld     [%0, #32]                       \n\
        pld     [%1, #0]                        \n\
@@ -107,7 +107,7 @@ xscale_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
 {
        void *ptr, *kaddr = kmap_atomic(page);
        asm volatile("\
-.arch xscale                                   \n\
+.arch armv5te                                  \n\
        mov     r1, %2                          \n\
        mov     r2, #0                          \n\
        mov     r3, #0                          \n\

@jcai19
Copy link
Member

jcai19 commented Apr 23, 2021

Shall we remove the integrated-as label since IAS probably won't support XScale any time soon (#975)?

@arndb
Copy link
Author

arndb commented Apr 23, 2021

It should be a trivial fix to either change the kernel with the patch I suggested above, or to have IAS treat XScale as an alias for armv5te.

I don't think there is anything the kernel cares about in what gas considers xscale as opposed to standard armv5te. The iwmmxt support mentioned in #975 is an optional feature of both xscale and pj4, but most xscale processors don't actually support it if I remember correctly.

@jcai19
Copy link
Member

jcai19 commented Apr 23, 2021

Thanks for the clarification. I could help patch IAS if that's preferred, but it seems fixing them in kernel might be easier if what we see in #1276 (comment) are the only uses?

@DavidSpickett
Copy link

Fixing llvm would be quite easy, assuming you know what "xscale"'s features should be.

In llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp ARMTargetELFStreamer::emitArchDefaultAttributes there is a switch case and the xscale case is missing.

@DavidSpickett
Copy link

Posted for review: https://reviews.llvm.org/D104776

@nickdesaulniers
Copy link
Member

$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make LLVM=1 LLVM_IAS=1 -j72 iop32x_defconfig arch/arm/mm/copypage-xscale.o

@nickdesaulniers nickdesaulniers added the [PATCH] Accepted A submitted patch has been accepted upstream label Jun 25, 2021
@DavidSpickett
Copy link

Landed https://reviews.llvm.org/rG558d9e82283e6b053b18091de6e56a5e208b7036

@nickdesaulniers nickdesaulniers added [FIXED][LLVM] 13 This bug was fixed in LLVM 13.x and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] arm32 This bug impacts ARCH=arm [FIXED][LLVM] 13 This bug was fixed in LLVM 13.x [TOOL] integrated-as The issue is relevant to LLVM integrated assembler
Projects
None yet
Development

No branches or pull requests

4 participants