Re: linux-next: build failure after merge of the kbuild tree

From: Nathan Chancellor
Date: Mon Aug 18 2025 - 00:27:15 EST


On Mon, Aug 18, 2025 at 02:01:43PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the kbuild tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
>
> /usr/bin/ld: /usr/lib/gcc/powerpc64le-linux-gnu/14/../../../powerpc64le-linux-gnu/libgcc_s.so.1: error adding symbols: file in wrong format
> collect2: error: ld returned 1 exit status
> make[5]: *** [scripts/Makefile.userprogs:29: samples/pfsm/pfsm-wakeup] Error 1
> make[5]: Target 'samples/pfsm/' not remade because of errors.
>
> an so on for lots more ...
>
> Caused by commit
>
> 478494044bb4 ("kbuild: userprogs: also inherit byte order and ABI from kernel")
>
> I have reverted that commit for today.
>
> Build was done on ppc64le, POWER9
>
> $ gcc --version
> gcc (Debian 14.2.0-19) 14.2.0
> $ ld --version
> GNU ld (GNU Binutils for Debian) 2.44
>
> CONFIG_VDSO32=y
> CONFIG_CPU_BIG_ENDIAN=y
> # CONFIG_CPU_LITTLE_ENDIAN is not set
> CONFIG_PPC64_ELF_ABI_V2=y
> CONFIG_CC_HAS_ELFV2=y
> CONFIG_CC_HAS_PREFIXED=y
> CONFIG_CC_HAS_PCREL=y
> CONFIG_64BIT=y

Thanks a lot for the report. Now that I am looking at the test for
CONFIG_CC_CAN_LINK, I am not sure that change is fully correct because
those additional flags are not accounted for in that test. We would need
something like this but if I understand correctly, the filtering of the
flags would need to happen much earlier that it currently does. I have
dropped that change from kbuild-next for now. Thomas, please investigate
and send me a new patch.

Cheers,
Nathan

diff --git a/init/Kconfig b/init/Kconfig
index 836320251219..ab8aa6ab8aa4 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -84,8 +84,8 @@ config RUSTC_LLVM_VERSION

config CC_CAN_LINK
bool
- default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag)) if 64BIT
- default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag))
+ default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(KBUILD_USERCFLAGS) $(KBUILD_USERLDFLAGS) $(m64-flag)) if 64BIT
+ default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(KBUILD_USERCFLAGS) $(KBUILD_USERLDFLAGS) $(m32-flag))

# Fixed in GCC 14, 13.3, 12.4 and 11.5
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921