I was able to build binutils-2.36.1 before, but now trying to recompile it, it fails during link. Even adding "-fPIC" to CFLAGS, as suggested by the error, doesn't help: >>> Install sys-devel/binutils-2.36.1 into /tmp-ram/portage/sys-devel/binutils-2.36.1/image make -j33 DESTDIR=/tmp-ram/portage/sys-devel/binutils-2.36.1/image tooldir=/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1 install [...] /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libiberty.a(sha1.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC # emerge --nodeps -pv =sys-devel/binutils-2.36.1 These are the packages that would be merged, in order: [ebuild R *] sys-devel/binutils-2.36.1:2.36::gentoo USE="gold multitarget nls plugins vanilla (-cet) -default-gold -doc -static-libs* -test" 0 KiB # emerge --info Portage 3.0.14 (python 3.9.2-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-10.2.0, glibc-2.33, 5.10.17 x86_64) ================================================================= System uname: Linux-5.10.17-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-glibc2.33 KiB Mem: 65849936 total, 60564688 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Sat, 20 Feb 2021 08:37:25 +0000 Head commit of repository gentoo: e3cdc22e5ba3b13d1644695e9716a84793c7c657 sh bash 5.1_p4 ld GNU ld (Gentoo 2.36.1 p1) 2.36.1 app-shells/bash: 5.1_p4::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.32.1::gentoo dev-lang/python: 3.8.8::gentoo, 3.9.2::gentoo dev-util/cmake: 3.19.5::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.7-r1::gentoo sys-apps/openrc: 0.42.1-r1::gentoo sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r5::gentoo sys-devel/automake: 1.11.6-r3::gentoo, 1.12.6-r2::gentoo, 1.13.4-r2::gentoo, 1.14.1-r2::gentoo, 1.15.1-r2::gentoo, 1.16.3-r1::gentoo sys-devel/binutils: 2.36.1::gentoo sys-devel/gcc: 9.3.0-r2::gentoo, 10.2.0-r5::gentoo sys-devel/gcc-config: 2.3.3::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.11::gentoo (virtual/os-headers) sys-libs/glibc: 2.33::gentoo Repositories: mano location: /etc/portage/overlay masters: gentoo priority: 0 steam-overlay location: /var/lib/layman/steam-overlay masters: gentoo priority: 50 gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: git://moya/gentoo.git priority: 1000 Installed sets: @vulkan ACCEPT_KEYWORDS="amd64 ~amd64 ~amd64-linux" ACCEPT_LICENSE="@FREE GPL-3 LGPL-3 Oracle-BCLA-JavaSE NVIDIA-CUDA PUEL NVIDIA-CODEC-SDK google-chrome bluez-firmware MSttfEULA XMAME BitstreamCyberbit ValveSteamLicense NVIDIA-r1 MPEG-4 freedist unRAR NVIDIA-r2 no-source-code linux-firmware linux-fw-redistributable free-noncomm all-rights-reserved NPSL" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=znver2 -mtune=znver2 -fexpensive-optimizations -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt" 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/terminfo" CXXFLAGS="-O2 -march=znver2 -mtune=znver2 -fexpensive-optimizations -pipe" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--quiet-build=n" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch preserve-libs protect-owned qa-unresolved-soname-deps sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://mirror.netcologne.de/gentoo/" LANG="C" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="en" MAKEOPTS="-j33" PKGDIR="/var/cache/binpkgs" PORTAGE_BZIP2_COMMAND="/bin/bzip2" PORTAGE_CONFIGROOT="/" 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" PORTAGE_TMPDIR="/tmp-ram" USE="X acl amd64 bash-completion bluetooth bzip2 crypt dbus gstreamer iconv inotify ipv6 jpeg libglvnd lzma nls nptl opengl pam png policykit pulseaudio qml readline split-usr ssl systemd threads tiff udev udisks unicode upower usb xcb zlib zstd" ABI_X86="64" CALLIGRA_FEATURES="karbon sheets words plan" CAMERAS="*" CPU_FLAGS_X86="mmx mmxext sse3 ssse3 sse sse2 sse4_1 sse4_2 avx avx2 fma3 aes f16c pclmul sha" CURL_SSL="gnutls" ELIBC="glibc" GPSD_PROTOCOLS="*" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LLVM_TARGETS="AArch64 AMDGPU ARM BPF Mips NVPTX AVR RISCV" LUA_SINGLE_TARGET="luajit" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8 python3_9" RUBY_TARGETS="ruby27 ruby30" SANE_BACKENDS="abaton agfafocus apple artec artec_eplus48u as6e avision bh canon canon630u canon_dr cardscan coolscan coolscan2 coolscan3 dc210 dc240 dc25 dell1600n_net dmc epjitsu epson epson2 fujitsu genesys gt68xx hp hp3500 hp3900 hp4200 hp5400 hp5590 hpljm1005 hs2p ibm kodak kodakaio kvs1025 kvs20xx kvs40xx leo lexmark ma1509 magicolor matsushita microtek microtek2 mustek mustek_usb mustek_usb2 nec net niash p5 pie pixma plustek plustek_pp pnm qcam ricoh rts8891 s9036 sceptre sharp sm3600 sm3840 snapscan sp15c st400 stv680 tamarack teco1 teco2 teco3 u12 umax umax1220u umax_pp xerox_mfp" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="*" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
I worked around it by simply deleting the offending file /usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libiberty.a
After adding -fPIC to CFLAGS, and deleting libiberty.a of the active binutils install, I can no longer reproduce it.
Please note that 2.36.1 is unkeyworded.