Cannot build 5.2.0 with gold linker

From: Liam Shepherd
Date: Mon Jul 08 2019 - 09:45:51 EST


Hi,

It results in this error:

Invalid absolute R_X86_64_32S relocation: _etext
make[2]: *** [arch/x86/boot/compressed/Makefile:130:
arch/x86/boot/compressed/vmlinux.relocs] Error 1
make[2]: *** Deleting file 'arch/x86/boot/compressed/vmlinux.relocs'
make[2]: *** Waiting for unfinished jobs....
CC arch/x86/boot/compressed/cpuflags.o
make[1]: *** [arch/x86/boot/Makefile:112:
arch/x86/boot/compressed/vmlinux] Error 2
make: *** [arch/x86/Makefile:283: bzImage] Error 2

This was introduced under this commit:

392bef709659abea614abfe53cf228e7a59876a4: x86/build: Move _etext to
actual end of .text

The commit was reverted on 5.18 by Greg...

commit 474ec2dcfbcf268a4124145b5e08847595f67a4c
Author: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Date: Wed Jun 5 20:40:30 2019 +0200

Revert "x86/build: Move _etext to actual end of .text"

This reverts commit 392bef709659abea614abfe53cf228e7a59876a4.

It seems to cause lots of problems when using the gold linker, and no
one really needs this at the moment, so just revert it from the stable
trees.

However it's still present with 5.2.0. Is this intentional?

In case it's helpful:

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/8.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-8.3.0-r1/work/gcc-8.3.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.3.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls
--without-included-gettext --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo
8.3.0-r1 p1.1' --disable-esp --enable-libstdcxx-time --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-multilib --with-multilib-list=m32,m64 --disable-altivec
--disable-fixed-point --enable-targets=all --enable-libgomp
--disable-libmudflap --disable-libssp --enable-libmpx
--disable-systemtap --enable-vtable-verify --enable-lto --with-isl
--disable-isl-version-check --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.3.0 (Gentoo 8.3.0-r1 p1.1)

# ld -v
GNU gold (Gentoo 2.32 p2 2.32.0) 1.16

Thanks,
Liam