#840910 binutils: ld.gold Linux kernel 4.9.0-rc1 fails to build

Package:
binutils
Source:
binutils
Description:
GNU assembler, linker and binary utilities
Submitter:
Arthur Marsh
Date:
2025-08-29 05:33:12 UTC
Severity:
normal
Tags:
#840910#5
Date:
2016-10-16 02:08:12 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

I attempted to build the Linux 4.9.0-rc1 source using ld.gold and make-kpkg
from kernel package, and it failed. Re-running the build with -v in the
KCFLAGS gave the following output:

COMPILER_PATH=/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/6/../../../i386-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/6/../../../../lib/:/lib/i386-linux-gnu/:/lib/../lib/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/i686-linux-gnu/6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-E' '-D' '__GENKSYMS__' '-nostdinc' '-isystem' '/usr/lib/gcc/i686-linux-gnu/6/include' '-I' './arch/x86/include' '-I' './arch/x86/include/generated/uapi' '-I' './arch/x86/include/generated' '-I' './include' '-I' './arch/x86/include/uapi' '-I' './include/uapi' '-I' './include/generated/uapi' '-include' './include/linux/kconfig.h' '-D' '__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration' '-Wno-format-security' '-std=gnu90' '-mno-sse' '-mno-mmx' '-mno-sse2' '-mno-3dnow' '-mno-avx' '-m32' '-msoft-float' '-mregparm=3' '-freg-struct-return' '-fno-pic' '-mpreferred-stack-boundary=2' '-march=k8' '-maccumulate-outgoing-args' '-ffreestanding' '-D' 'CONFIG_AS_CFI=1' '-D' 'CONFIG_AS_CFI_SIGNAL_FRAME=1' '-D' 'CONFIG_AS_CFI_SECTIONS=1' '-D' 'CONFIG_AS_SSSE3=1' '-D' 'CONFIG_AS_CRC32=1' '-D' 'CONFIG_AS_AVX=1' '-D' 'CONFIG_AS_AVX2=1' '-D' 'CONFIG_AS_AVX512=1' '-D' 'CONFIG_AS_SHA1_NI=1' '-D' 'CONFIG_AS_SHA256_NI=1' '-pipe' '-Wno-sign-compare' '-fno-asynchronous-unwind-tables' '-fno-delete-null-pointer-checks' '-Wno-maybe-uninitialized' '-Wno-frame-address' '-O2' '--param' 'allow-store-data-races=0' '-Wframe-larger-than=2048' '-fno-stack-protector' '-Wno-unused-but-set-variable' '-Wunused-const-variable=0' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-fno-var-tracking-assignments' '-g' '-fno-inline-functions-called-once' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes' '-Werror=date-time' '-Werror=incompatible-pointer-types' '-D' 'CC_HAVE_ASM_GOTO' '-v' '-D' 'KBUILD_BASENAME="usercopy"' '-D' 'KBUILD_MODNAME="usercopy"'
COMPILER_PATH=/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/6/../../../i386-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/6/../../../../lib/:/lib/i386-linux-gnu/:/lib/../lib/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/i686-linux-gnu/6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-nostdinc' '-isystem' '/usr/lib/gcc/i686-linux-gnu/6/include' '-I' './arch/x86/include' '-I' './arch/x86/include/generated/uapi' '-I' './arch/x86/include/generated' '-I' './include' '-I' './arch/x86/include/uapi' '-I' './include/uapi' '-I' './include/generated/uapi' '-include' './include/linux/kconfig.h' '-D' '__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration' '-Wno-format-security' '-std=gnu90' '-mno-sse' '-mno-mmx' '-mno-sse2' '-mno-3dnow' '-mno-avx' '-m32' '-msoft-float' '-mregparm=3' '-freg-struct-return' '-fno-pic' '-mpreferred-stack-boundary=2' '-march=k8' '-maccumulate-outgoing-args' '-ffreestanding' '-D' 'CONFIG_AS_CFI=1' '-D' 'CONFIG_AS_CFI_SIGNAL_FRAME=1' '-D' 'CONFIG_AS_CFI_SECTIONS=1' '-D' 'CONFIG_AS_SSSE3=1' '-D' 'CONFIG_AS_CRC32=1' '-D' 'CONFIG_AS_AVX=1' '-D' 'CONFIG_AS_AVX2=1' '-D' 'CONFIG_AS_AVX512=1' '-D' 'CONFIG_AS_SHA1_NI=1' '-D' 'CONFIG_AS_SHA256_NI=1' '-pipe' '-Wno-sign-compare' '-fno-asynchronous-unwind-tables' '-fno-delete-null-pointer-checks' '-Wno-maybe-uninitialized' '-Wno-frame-address' '-O2' '--param' 'allow-store-data-races=0' '-Wframe-larger-than=2048' '-fno-stack-protector' '-Wno-unused-but-set-variable' '-Wunused-const-variable=0' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-fno-var-tracking-assignments' '-g' '-fno-inline-functions-called-once' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes' '-Werror=date-time' '-Werror=incompatible-pointer-types' '-D' 'CC_HAVE_ASM_GOTO' '-v' '-D' 'KBUILD_BASENAME="usercopy_32"' '-D' 'KBUILD_MODNAME="usercopy_32"' '-c' '-o' 'arch/x86/lib/.tmp_usercopy_32.o'
Using built-in specs.
COLLECT_GCC=gcc-6
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.2.0-6' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 6.2.0 20161010 (Debian 6.2.0-6)
COLLECT_GCC_OPTIONS='-E' '-D' '__GENKSYMS__' '-nostdinc' '-isystem' '/usr/lib/gcc/i686-linux-gnu/6/include' '-I' './arch/x86/include' '-I' './arch/x86/include/generated/uapi' '-I' './arch/x86/include/generated' '-I' './include' '-I' './arch/x86/include/uapi' '-I' './include/uapi' '-I' './include/generated/uapi' '-include' './include/linux/kconfig.h' '-D' '__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration' '-Wno-format-security' '-std=gnu90' '-mno-sse' '-mno-mmx' '-mno-sse2' '-mno-3dnow' '-mno-avx' '-m32' '-msoft-float' '-mregparm=3' '-freg-struct-return' '-fno-pic' '-mpreferred-stack-boundary=2' '-march=k8' '-maccumulate-outgoing-args' '-ffreestanding' '-D' 'CONFIG_AS_CFI=1' '-D' 'CONFIG_AS_CFI_SIGNAL_FRAME=1' '-D' 'CONFIG_AS_CFI_SECTIONS=1' '-D' 'CONFIG_AS_SSSE3=1' '-D' 'CONFIG_AS_CRC32=1' '-D' 'CONFIG_AS_AVX=1' '-D' 'CONFIG_AS_AVX2=1' '-D' 'CONFIG_AS_AVX512=1' '-D' 'CONFIG_AS_SHA1_NI=1' '-D' 'CONFIG_AS_SHA256_NI=1' '-pipe' '-Wno-sign-compare' '-fno-asynchronous-unwind-tables' '-fno-delete-null-pointer-checks' '-Wno-maybe-uninitialized' '-Wno-frame-address' '-O2' '--param' 'allow-store-data-races=0' '-Wframe-larger-than=2048' '-fno-stack-protector' '-Wno-unused-but-set-variable' '-Wunused-const-variable=0' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-fno-var-tracking-assignments' '-g' '-fno-inline-functions-called-once' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes' '-Werror=date-time' '-Werror=incompatible-pointer-types' '-D' 'CC_HAVE_ASM_GOTO' '-v' '-D' 'KBUILD_BASENAME="usercopy_32"' '-D' 'KBUILD_MODNAME="usercopy_32"'
 /usr/lib/gcc/i686-linux-gnu/6/cc1 -E -quiet -nostdinc -v -I ./arch/x86/include -I ./arch/x86/include/generated/uapi -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./include/uapi -I ./include/generated/uapi -imultiarch i386-linux-gnu -D __GENKSYMS__ -D __KERNEL__ -D CONFIG_AS_CFI=1 -D CONFIG_AS_CFI_SIGNAL_FRAME=1 -D CONFIG_AS_CFI_SECTIONS=1 -D CONFIG_AS_SSSE3=1 -D CONFIG_AS_CRC32=1 -D CONFIG_AS_AVX=1 -D CONFIG_AS_AVX2=1 -D CONFIG_AS_AVX512=1 -D CONFIG_AS_SHA1_NI=1 -D CONFIG_AS_SHA256_NI=1 -D CC_HAVE_ASM_GOTO -D KBUILD_BASENAME="usercopy_32" -D KBUILD_MODNAME="usercopy_32" -isystem /usr/lib/gcc/i686-linux-gnu/6/include -include ./include/linux/kconfig.h -MD arch/x86/lib/.usercopy_32.o.d arch/x86/lib/usercopy_32.c -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m32 -msoft-float -mregparm=3 -mpreferred-stack-boundary=2 -march=k8 -maccumulate-outgoing-args -std=gnu90 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror=implicit-function-declaration -Wno-format-security -Wno-sign-compare -Wno-maybe-uninitialized -Wno-frame-address -Wframe-larger-than=2048 -Wno-unused-but-set-variable -Wunused-const-variable=0 -Wdeclaration-after-statement -Wno-pointer-sign -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -fno-strict-aliasing -fno-common -freg-struct-return -fno-pic -ffreestanding -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -fno-inline-functions-called-once -fno-strict-overflow -fconserve-stack -g -fworking-directory -O2
#include "..." search starts here:
#include <...> search starts here:
 ./arch/x86/include
 ./arch/x86/include/generated/uapi
 ./arch/x86/include/generated
 ./include
 ./arch/x86/include/uapi
 ./include/uapi
 ./include/generated/uapi
 /usr/lib/gcc/i686-linux-gnu/6/include
End of search list.
COMPILER_PATH=/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i686-linux-gnu/6/:/usr/lib/gcc/i686-linux-gnu/6/../../../i386-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/6/../../../../lib/:/lib/i386-linux-gnu/:/lib/../lib/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/i686-linux-gnu/6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-E' '-D' '__GENKSYMS__' '-nostdinc' '-isystem' '/usr/lib/gcc/i686-linux-gnu/6/include' '-I' './arch/x86/include' '-I' './arch/x86/include/generated/uapi' '-I' './arch/x86/include/generated' '-I' './include' '-I' './arch/x86/include/uapi' '-I' './include/uapi' '-I' './include/generated/uapi' '-include' './include/linux/kconfig.h' '-D' '__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration' '-Wno-format-security' '-std=gnu90' '-mno-sse' '-mno-mmx' '-mno-sse2' '-mno-3dnow' '-mno-avx' '-m32' '-msoft-float' '-mregparm=3' '-freg-struct-return' '-fno-pic' '-mpreferred-stack-boundary=2' '-march=k8' '-maccumulate-outgoing-args' '-ffreestanding' '-D' 'CONFIG_AS_CFI=1' '-D' 'CONFIG_AS_CFI_SIGNAL_FRAME=1' '-D' 'CONFIG_AS_CFI_SECTIONS=1' '-D' 'CONFIG_AS_SSSE3=1' '-D' 'CONFIG_AS_CRC32=1' '-D' 'CONFIG_AS_AVX=1' '-D' 'CONFIG_AS_AVX2=1' '-D' 'CONFIG_AS_AVX512=1' '-D' 'CONFIG_AS_SHA1_NI=1' '-D' 'CONFIG_AS_SHA256_NI=1' '-pipe' '-Wno-sign-compare' '-fno-asynchronous-unwind-tables' '-fno-delete-null-pointer-checks' '-Wno-maybe-uninitialized' '-Wno-frame-address' '-O2' '--param' 'allow-store-data-races=0' '-Wframe-larger-than=2048' '-fno-stack-protector' '-Wno-unused-but-set-variable' '-Wunused-const-variable=0' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-fno-var-tracking-assignments' '-g' '-fno-inline-functions-called-once' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes' '-Werror=date-time' '-Werror=incompatible-pointer-types' '-D' 'CC_HAVE_ASM_GOTO' '-v' '-D' 'KBUILD_BASENAME="usercopy_32"' '-D' 'KBUILD_MODNAME="usercopy_32"'
  AR      arch/x86/lib/lib.a
  EXPORTS arch/x86/lib/lib-ksyms.o
ld.gold: internal error in target, at ../../gold/parameters.h:105
scripts/Makefile.build:432: recipe for target 'arch/x86/lib/lib-ksyms.o' failed
make[2]: *** [arch/x86/lib/lib-ksyms.o] Error 1
Makefile:978: recipe for target 'arch/x86/lib' failed
make[1]: *** [arch/x86/lib] Error 2
make[1]: Leaving directory '/usr/src/linux'
debian/ruleset/targets/common.mk:295: recipe for target 'debian/stamp/build/kernel' failed
make: *** [debian/stamp/build/kernel] Error 2

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

The kernel built with ld.bfd but I have not yet tested whether that kernel
runs successfully.

   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

#840910#10
Date:
2016-10-16 05:33:20 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

Further data points:

on amd64 architecture, ld.gold failure is linked to the commit:

7f2084fa55e6cb61f61b4224d4a8bafaeee55f9f is the first bad commit
commit 7f2084fa55e6cb61f61b4224d4a8bafaeee55f9f
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri Jan 15 14:01:22 2016 -0500

[kbuild] handle exports in lib-y objects reliably

on i386 architecture, I can build 4.9.0-rc1 with ld.bfd and run the kernel
without problems.

I'm currently building the kernel on amd64 with ld.gold and the above commit
reverted.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

#840910#15
Date:
2016-11-09 13:46:42 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

Still getting the same error with kernel 4.9.0-rc4 and current ld.gold:

ld.gold: internal error in target, at ../../gold/parameters.h:105
scripts/Makefile.build:432: recipe for target 'arch/x86/lib/lib-ksyms.o' failed
make[2]: *** [arch/x86/lib/lib-ksyms.o] Error 1
Makefile:978: recipe for target 'arch/x86/lib' failed
make[1]: *** [arch/x86/lib] Error 2
make[1]: *** Waiting for unfinished jobs....
  LD      drivers/cpuidle/governors/built-in.o
  LD      drivers/cpuidle/built-in.o
  LD      net/bridge/built-in.o
ld.gold: internal error in target, at ../../gold/parameters.h:105
scripts/Makefile.build:432: recipe for target 'lib/lib-ksyms.o' failed
make[2]: *** [lib/lib-ksyms.o] Error 1
Makefile:978: recipe for target 'lib' failed
make[1]: *** [lib] Error 2


   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

#840910#20
Date:
2016-12-03 12:22:52 UTC
From:
To:
please provide the command line flags and object files for the build.
#840910#25
Date:
2016-12-03 12:22:52 UTC
From:
To:
please provide the command line flags and object files for the build.
#840910#30
Date:
2017-06-18 22:29:24 UTC
From:
To:
Control: forwarded -1 https://sourceware.org/bugzilla/show_bug.cgi?id=20693

This appears to be the above bug, the fix for which was first included
in 2.27.51.20161124-1. Arthur, please confirm whether this is now
working? You will need to make sure you use an old enough kernel which
can trigger this, as [1] has since been applied to work around the
issue.

Regards,
James

[1] https://patchwork.kernel.org/patch/9412009/

#840910#35
Date:
2017-06-18 22:29:24 UTC
From:
To:
Control: forwarded -1 https://sourceware.org/bugzilla/show_bug.cgi?id=20693

This appears to be the above bug, the fix for which was first included
in 2.27.51.20161124-1. Arthur, please confirm whether this is now
working? You will need to make sure you use an old enough kernel which
can trigger this, as [1] has since been applied to work around the
issue.

Regards,
James

[1] https://patchwork.kernel.org/patch/9412009/