Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 817815 - sys-libs/glibc-2.33-r1 +static-pie configure: error: linker support for static PIE needed with sys-devel/binutils-2.37_p1
Summary: sys-libs/glibc-2.33-r1 +static-pie configure: error: linker support for stati...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on: libxcrypt-stable
Blocks:
  Show dependency tree
 
Reported: 2021-10-12 04:33 UTC by Garry Filakhtov
Modified: 2021-11-01 01:11 UTC (History)
3 users (show)

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


Attachments
emerge --info (emerge-info.log,5.60 KB, text/plain)
2021-10-12 04:35 UTC, Garry Filakhtov
Details
config.log (config.log,40.37 KB, text/plain)
2021-10-12 04:35 UTC, Garry Filakhtov
Details
Example weak symbol access (conftest.c,99 bytes, text/x-csrc)
2021-10-23 12:18 UTC, Francisco Blas Izquierdo Riera
Details
Resulting assembly file (conftest.s,296 bytes, text/x-asm)
2021-10-23 12:23 UTC, Francisco Blas Izquierdo Riera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Garry Filakhtov 2021-10-12 04:33:39 UTC
Just upgraded to the sys-devel/gcc-11.2.0 and wanted to rebuild sys-libs/glibc-2.33-r1 with static-pie flag enabled, but hit the problem:

configure: error: linker support for static PIE needed

relevant snippet from the config.log file:

configure:111: checking for linker static PIE support
configure:125: x86_64-pc-linux-gnu-gcc -m64 -pipe -march=native -O2 -Wl,-O1 -Wl,--as-needed -fuse-ld=bfd -pipe -march=native -O2  -Wl,-O1 -Wl,--as-needed -fuse-ld=bfd -nostartfiles -nostdlib -fno-stack-protector -Wl,-pie -o conftest conftest.s 1>&5
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld.bfd: /var/tmp/portage/sys-libs/glibc-2.33-r1/temp/ccWK2rps.o: relocation R_X86_64_PC32 against undefined symbol `foo' can not be used when making a PIE object; recompile with -fPIE
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld.bfd: final link failed: bad value
collect2: error: ld returned 1 exit status
configure:128: $? = 1
configure:136: result: no
configure:139: error: linker support for static PIE needed


Reproducible: Always
Comment 1 Garry Filakhtov 2021-10-12 04:35:05 UTC
Created attachment 744531 [details]
emerge --info
Comment 2 Garry Filakhtov 2021-10-12 04:35:29 UTC
Created attachment 744534 [details]
config.log

Configure log file
Comment 3 Tee KOBAYASHI 2021-10-13 05:32:47 UTC
This reproduces for me when using sys-devel/binutils-2.37_p1. Disappears with sys-devel/binutils-2.36.1-r2.
Comment 4 Thomas Arnett 2021-10-19 03:22:54 UTC
This happens with sys-devel/gcc-10.3.0-r2 as well. This patch fixes it: <https://sourceware.org/pipermail/libc-alpha/2021-July/128802.html>.
Comment 5 Francisco Blas Izquierdo Riera gentoo-dev 2021-10-23 10:04:13 UTC
I have reproduced this bug too. As hinted by Tee and Thomas, it is not related to gcc but to binutils.

sys-devel/gcc-11.2.0 and sys-devel/binutils-2.37_p1: Fails
sys-devel/gcc-10.3.0 and sys-devel/binutils-2.37_p1: Fails
sys-devel/gcc-11.2.0 and sys-devel/binutils-2.36.1: Works
sys-devel/gcc-10.3.0 and sys-devel/binutils-2.37_p1: Works
Comment 6 Francisco Blas Izquierdo Riera gentoo-dev 2021-10-23 12:18:35 UTC
Created attachment 746292 [details]
Example weak symbol access
Comment 7 Francisco Blas Izquierdo Riera gentoo-dev 2021-10-23 12:23:44 UTC
Created attachment 746295 [details]
Resulting assembly file

As we can see when using -static -pie -O2 gcc (both 10.3.0 and 11.2.0) produce the same assembly file which uses gotpcrel as hinted by https://sourceware.org/bugzilla/show_bug.cgi?id=21782#c6

https://sourceware.org/pipermail/libc-alpha/2021-July/128802.html has a patch removing those checks I think that it may be safer to keep the check but make it use gotpcrel as gcc does. I'll provide patches in a bit.
Comment 8 Francisco Blas Izquierdo Riera gentoo-dev 2021-10-23 12:33:16 UTC
Digging deeper it seems that sys-libs/glibc-2.33-r6 has the backported upstream patch.

Toolchain, can you request stabilization of that version (at least for AMD64 where this is an issue)?
Comment 9 Francisco Blas Izquierdo Riera gentoo-dev 2021-10-23 13:31:35 UTC
This will be fixed once sys-libs/glibc-2.33-r7 is stabilized by #809410

If you want to solve this earlier, you can (at your own risk) install it now. To do so:

* Make sure you read and understand the output of the news item:
# eselect news read 2021-10-18-libxcrypt-migration-stable
* Update your system to avoid dependency conflicts
* add the following to your package.accept_keywords:
=sys-libs/glibc-2.33-r7 ~amd64
=virtual/libcrypt-2 ~amd64
=sys-libs/libxcrypt-4.4.25 ~amd64
* if using a multilib profile add the following to your package.use:
sys-libs/libxcrypt abi_x86_32
* finally emerge the new glibc and libxcrypt:
# emerge -v1a =sys-libs/glibc-2.33-r7 =virtual/libcrypt-2 =sys-libs/libxcrypt-4.4.25
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-01 01:11:50 UTC
Thank you for doing the digging! glibc-2.33-r7 is now stable on amd64.