Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 687116 - sys-kernel/gentoo-sources-5.1.6 with Invalid absolute R_X86_64_32S relocation: _etext
Summary: sys-kernel/gentoo-sources-5.1.6 with Invalid absolute R_X86_64_32S r...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
: 687330 (view as bug list)
Depends on:
Reported: 2019-06-01 06:21 UTC by Michael Mair-Keimberger (iamnr3)
Modified: 2019-10-10 12:16 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---

kernel.config (kernel.config,110.07 KB, text/plain)
2019-06-01 06:21 UTC, Michael Mair-Keimberger (iamnr3)
emerge --info (emerge-info.txt,6.89 KB, text/plain)
2019-06-01 07:34 UTC, Marien Zwart

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Mair-Keimberger (iamnr3) 2019-06-01 06:21:45 UTC
Created attachment 578240 [details]


I cannot compile the latest kernel because of following error:

  LD      vmlinux.o
  MODPOST vmlinux.o
  KSYM    .tmp_kallsyms1.o
  KSYM    .tmp_kallsyms2.o
  LD      vmlinux
  SORTEX  vmlinux
  CC      arch/x86/boot/a20.o
  AS      arch/x86/boot/bioscall.o
  CC      arch/x86/boot/cmdline.o
  AS      arch/x86/boot/copy.o
  HOSTCC  arch/x86/boot/mkcpustr
  CPUSTR  arch/x86/boot/cpustr.h
  CC      arch/x86/boot/cpu.o
  CC      arch/x86/boot/cpuflags.o
  CC      arch/x86/boot/cpucheck.o
  CC      arch/x86/boot/early_serial_console.o
  CC      arch/x86/boot/edd.o
  LDS     arch/x86/boot/compressed/
  AS      arch/x86/boot/compressed/head_64.o
  VOFFSET arch/x86/boot/compressed/../voffset.h
  CC      arch/x86/boot/compressed/misc.o
  CC      arch/x86/boot/compressed/string.o
  CC      arch/x86/boot/compressed/cmdline.o
  CC      arch/x86/boot/compressed/error.o
  OBJCOPY arch/x86/boot/compressed/vmlinux.bin
  RELOCS  arch/x86/boot/compressed/vmlinux.relocs
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[1]: *** [arch/x86/boot/Makefile:112: arch/x86/boot/compressed/vmlinux] Error 2
make: *** [arch/x86/Makefile:283: bzImage] Error 2

emerge --info:
Portage 2.3.67 (python 3.6.8-final-0, default/linux/amd64/17.1, gcc-9.1.0, glibc-2.29-r2, 5.1.4-gentoo x86_64)
System uname: Linux-5.1.4-gentoo-x86_64-AMD_FX-tm-8350_Eight-Core_Processor-with-gentoo-2.6
KiB Mem:    16410700 total,   9881560 free
KiB Swap:    8388604 total,   7946532 free
Timestamp of repository gentoo: Fri, 31 May 2019 17:04:40 +0000
Head commit of repository gentoo: aaa7486539a341dacd9a3140473aed80681ad7a8

Head commit of repository local: 823c6c1d3092c720717eb377426b1a04b3ab5c32

Timestamp of repository steam-overlay: Fri, 24 May 2019 22:43:51 +0000
Head commit of repository steam-overlay: d1e03db68b34cb28d87ac5595e7eaaa3c77d3bf6

sh bash 5.0_p7
ld GNU gold (Gentoo 2.32 p2 2.32.0) 1.16
app-shells/bash:          5.0_p7::gentoo
dev-lang/perl:            5.30.0::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.8::gentoo
dev-util/cmake:           3.14.4::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.17::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            9.1.0::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.0-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo

    location: /usr/portage
    sync-type: git
    priority: -1000

    location: /var/db/repos/local
    sync-type: git
    sync-uri: git@s2:local
    masters: gentoo

    location: /var/db/repos/steam-overlay
    sync-type: git
    masters: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -pipe -march=bdver2 -mprefer-avx128"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=bdver2 -mprefer-avx128"
EMERGE_DEFAULT_OPTS="--jobs=8 --load-average 8"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="aac acl alsa amd64 berkdb bzip2 cli crypt cxx dbus dri elogind exif flac fortran gdbm gif iconv ipv6 jpeg kde ldap libtirpc lzma mad mp3 mp4 multilib ncurses nls nptl openal opengl openmp opus pam pcre png python readline sdl seccomp ssl svg tcpd threads tiff truetype udev unicode vaapi vdpau vim-syntax vorbis vpx wayland webp x264 xattr xml zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="krita sheets words karbon" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx fma3 fma4 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop" CURL_SSL="gnutls" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="arm x86_64" QEMU_USER_TARGETS="arm x86_64" RUBY_TARGETS="ruby26 ruby25" USERLAND="GNU" VIDEO_CARDS="radeon radeonsi amdgpu" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 1 Marien Zwart 2019-06-01 07:33:43 UTC
Same here. It looks like the problem involves gold: we're both using that as linker, and if I build with LD=/usr/bin/ld.bfd the problem goes away.

Someone reported the same failure to lkml (see, but for them it went away after a distclean. That doesn't help for me: I still see it after "make clean" + manually removing everything other than my .config, and I also see it on a fresh build from "make defconfig".

Reverting the commit referenced on that thread or building with LD=/usr/bin/ld.bfd fixes things for me (and "make clean" + building without LD set breaks again).

I'm on ~amd64, same toolchain versions you have (will attach emerge --info).

I'm not familiar with linkers/relocations, so I probably won't make much headway actually debugging this.
Comment 2 Marien Zwart 2019-06-01 07:34:54 UTC
Created attachment 578304 [details]
emerge --info
Comment 3 Perfect Gentleman 2019-06-01 10:24:11 UTC
confirm. the same problem on all my 3 PCs
Comment 4 Andy Pettinger 2019-06-01 10:30:39 UTC

Alas adding gentoo-sources to my no-gold.config  does not solve the problem.
Comment 5 Marien Zwart 2019-06-01 14:56:46 UTC
(In reply to Andy Pettinger from comment #4)
> Alas adding gentoo-sources to my no-gold.config  does not solve the problem.

Can you clarify what that config is / how you're building the kernel? Using something like /etc/portage/package.env to change LD when installing gentoo-sources won't help: the ebuild is only installing the source, not building it (nor saving the preferred linker into the source tree).

I normally build the kernel by running "make", I changed that to "make LD=/usr/bin/ld.bfd" to get the kernel to link without gold.
Comment 6 Andy Pettinger 2019-06-01 16:19:11 UTC
(In reply to Marien Zwart from comment #5)
> (In reply to Andy Pettinger from comment #4)
> > Alas adding gentoo-sources to my no-gold.config  does not solve the problem.
> Can you clarify what that config is / how you're building the kernel? Using
> something like /etc/portage/package.env to change LD when installing
> gentoo-sources won't help: the ebuild is only installing the source, not
> building it (nor saving the preferred linker into the source tree).
> I normally build the kernel by running "make", I changed that to "make
> LD=/usr/bin/ld.bfd" to get the kernel to link without gold.

Yes you’re right of course ! I did as you said after make distclean I managed to build the kernel. Pity that gold doesn’t work any more :(
Comment 7 Maxim Britov 2019-06-02 07:52:19 UTC
With KASRL OFF 5.1.6 builds fine for me
CONFIG_RANDOMIZE_BASE=n (Randomize the address of the kernel image (KASLR)
Comment 8 Marien Zwart 2019-06-02 14:47:23 UTC is interesting: not just does it fix the same error for a different symbol, it involves a list of symbols that confuse the linker that are "typically defined outside any section in the linker script", and the change that triggered this build failure moved _etext out of the .text section in the linker script.

I've confirmed that adding _etext to that list in arch/x86/tools/relocs.c makes it build, but as I really have no idea what I'm doing I haven't tried to boot the resulting kernel.
Comment 9 Raymond Jennings 2019-06-04 19:14:49 UTC
*** Bug 687330 has been marked as a duplicate of this bug. ***
Comment 10 Raymond Jennings 2019-06-04 19:16:37 UTC
I just filed another bug on this at 687330, should I go ahead and respond to the upstream lkml thread referred to by chithanh in comment 4 of that bug?
Comment 11 Chí-Thanh Christopher Nguyễn gentoo-dev 2019-06-04 20:17:15 UTC
Reverting this makes the problem go away:

Upstream discussion:
Comment 12 Luigi 'Comio' Mantellini 2019-06-05 16:20:45 UTC
Same issue with 5.1.7.
The only way to make is to add _etext to arch/x86/tools/relocs.c as already said by Marien Zwart.


Comment 13 Marien Zwart 2019-06-06 10:46:19 UTC
Reverting the commit from comment #11 (same one mentioned in comment #2) or falling back to ld.bfd is the safest fix here (assuming you're not building with Clang LTO + CFI).

I've confirmed the change from comment #8 boots for me, and it might be the right fix. But I really don't know what I'm doing with linkers, so I wouldn't recommend others to apply it. Glad to hear it worked for someone else, though :)
Comment 14 Luigi 'Comio' Mantellini 2019-06-10 10:32:11 UTC
Fixed on mainline 5.1.8:

commit 474ec2dcfbcf268a4124145b5e08847595f67a4c
Author: Greg Kroah-Hartman <>
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
    Cc: Sami Tolvanen <>
    Reported-by: Kees Cook <>
    Cc: Borislav Petkov <>
    Cc: Linus Torvalds <>
    Cc: Peter Zijlstra <>
    Cc: Thomas Gleixner <>
    Reported-by: Alec Ari <>
    Cc: Ingo Molnar <>
    Signed-off-by: Greg Kroah-Hartman <>
Comment 15 Mike Pagano gentoo-dev 2019-06-10 19:24:48 UTC
Thanks for reporting the fix in 5.1.8.
Comment 16 Bernd 2019-07-12 12:11:32 UTC
I have a regression on this bug for gentoo-sources-5.2.0. Passing LD=/usr/bin/ld.bfd to make lets build the kernel again. The patch included in comment #14 worked until 5.1.16, the latest kernel I had installed.
Comment 17 Michael Mair-Keimberger (iamnr3) 2019-07-12 14:35:46 UTC
I'm reopening this bug. I've also hit this problem again when trying to build gentoo-sources-5.2
Comment 18 Marien Zwart 2019-07-15 10:45:51 UTC
5.2.0 broke it again, 5.2.1 fixes it again (commit 7ce6dfc897ac018c6370370dff1cd03c330c4815 in gentoo-sources-5.2.1 builds ok with here.

Looks like the 5.1.x revert only went to the stable tree, the 5.2.x revert is a backport of a revert in Linus' tree, so it'll probably stay fixed this time.
Comment 19 Bernd 2019-07-15 18:25:05 UTC
5.2.1 worked again for me too.
Comment 20 Liam Shepherd 2019-08-06 13:40:05 UTC
A commit has been added to the linux-build tree that will fail the build if gold is detected:

Full conversation here:

So if you use the mainline kernel, you should probably expect this to stop working again in the future.
Comment 21 Mike Pagano gentoo-dev 2019-10-10 12:16:49 UTC
As someone else noted, the gold linker is not supported by upstream and will now explicitly fail when discovered.