https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119440
Bug ID: 119440
Summary: --enable-host-pie fails to link (stage1) gnatbind
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
CC: dkm at gcc dot gnu.org
Target Milestone: ---
When bootstrapping GCC 15 with Ada enabled and --enable-host-pie using a GCC 14
host compiler that wasn't built with --enable-host-pie I see
[ 189s] g++ -std=c++14 -pie -g ... -static-libstdc++ -static-libgcc -o
gnatbind ... /usr/lib64/gcc/x86_64-suse-linux/14/adalib/libgnat.a ...
[ 190s]
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld:
/usr/lib64/gcc/x86_64-suse-linux/14/adalib/libgnat.a(a-contai.o): relocation
R_X86_64_32 against symbol `ada__containers__capacity_error' can not be used
when making a PIE object; recompile with -fPIE
[ 190s]
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld:
failed to set dynamic section sizes: bad value
[ 190s] collect2: error: ld returned 1 exit status
[ 190s] make[3]: *** [../../gcc/ada/gcc-interface/Make-lang.in:797: gnatbind]
Error 1
...
[ 206s] make[2]: *** [Makefile:5073: all-stage1-gcc] Error 2
[ 206s] make[1]: *** [Makefile:30409: stage1-bubble] Error 2
it seems stage1 gnatbind (and probably other related tools) are linking
statically and when using --enable-host-pie they use -pie without
considering how that host static library is built.
It seems to me that stage1 Ada tools should not be using -pie and I hope
stage2 and on will then use the built libgnat.a instead of the host one.