Skip to content

arm64 big endian broken in vDSO after LLVM commit d81ce04587c00 #1859

@nathanchance

Description

@nathanchance

After LLVM commit llvm/llvm-project@d81ce04, arm64 big endian fails to build:

# Turn on CONFIG_CPU_BIG_ENDIAN in menuconfig
$ make -skj"$(nproc)" ARCH=arm LLVM=1 O=build mrproper virtconfig menuconfig arch/arm64/kernel/vdso/
...
clang: error: unsupported option '-mbig-endian' for target 'x86_64-pc-linux-gnu'
make[3]: *** [.../scripts/Makefile.build:387: arch/arm64/kernel/vdso/vdso.lds] Error 1
...

arm64 adds -mbig-endian and -mlittle-endian to KBUILD_CPPFLAGS but --target is only added to KBUILD_CFLAGS and KBUILD_AFLAGS, so -mbig-endian is present when preprocessing arch/arm64/kernel/vdso/vdso.lds.S but --target is not.

A quick fix would be something like:

diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index fe7a53c6781f..cceff7ea30a9 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -56,7 +56,7 @@ endif
 GCOV_PROFILE := n

 targets += vdso.lds
-CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
+CPPFLAGS_vdso.lds += $(CLANG_FLAGS) -P -C -U$(ARCH)

 # Link rule for the .so file, .lds has to be first
 $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE

The proper fix is to move --target to KBUILD_CPPFLAGS as well so that this is fixed everywhere, which Masahiro did send a patch to do but there was a new build failure with it applied that it does not look like ever got commented on or resolved. I will see if I can look into that soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [BUG] linuxA bug that should be fixed in the mainline kernel.[BUG] llvm (main)A bug in an unreleased version of LLVM (this label is appropriate for regressions)[FIXED][LINUX] 6.5This bug was fixed in Linux 6.5

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions