Build libc_nonshared with -fPIE not -fpie

Bug #1987438 reported by Richard Henderson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
New
Undecided
Unassigned

Bug Description

Upstream bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=29514

$ lsb_release -rd
Description: Ubuntu 22.04.1 LTS
Release: 22.04

In Makeconfig, similar to "pic-ccflag = -fPIC", the default
for pie-ccflag should be '-fPIE' not '-fpie'.

Otherwise, large projects using -static-pie may see, e.g.

/usr/lib/gcc/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/lib/../lib/libc.a(init-first.o): in function `__libc_init_first':
(.text+0x10): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__environ' defined in .bss section in /usr/lib/gcc/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/lib/../lib/libc.a(environ.o)
/usr/bin/ld: (.text+0x10): warning: too many GOT entries for -fpic, please recompile with -fPIC

Revision history for this message
Richard Henderson (rth) wrote :

Also seen in an Ubuntu 20.04 LTS docker container.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Is this something you would hope to see changed in an update to 22.04 and 20.04? I see you've proposed a patch upstream which should filter its way into future Ubuntu in the usual ways.

Revision history for this message
Richard Henderson (rth) wrote :

Yes. Given that Ubuntu enables -pie by default in the compiler,
having system libraries that are prepared for -fPIE is crucial.

I guess static-pie is still rare, because I'm surprised that
QEMU is the first such project to report problems with this.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.