https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119440

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Trying to work around my stage1 issue with the patch below results in a link
failure of at least gnatlink in stage3:

../../xgcc -B../../ -c -g -O2   -W -Wall  -gnatpg -gnata -I- -I../rts -I.
-I/space/rguenther/src/gcc-14-branch/gcc/ada -gnatws -gnatyN \
    b_gnatl.adb -o b_gnatl.o
../../xg++ -B../../ ... b_gnatl.o ... -pie -ldl
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
b_gnatl.o: relocation R_X86_64_32S against `.rodata' can not be used when
making a PIE object; recompile with -fPIE

and yeah, you can see that b_gnatl.o was not built with -fPIE!?  That's also
true for other objecs referenced.  Note this particular experiment was done
on the gcc-14 branch.

diff --git a/gcc/ada/gcc-interface/Make-lang.in
b/gcc/ada/gcc-interface/Make-lang.in
index f6404c0b1eb..b1db17fc8ce 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -763,12 +763,12 @@ gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS)
$(ADA_BACKEND) $(EXTRA_HOST_OBJ
                $(EXTRA_HOST_OBJS) $(LIBDEPS) $(ada.prev)
        @$(call LINK_PROGRESS,$(INDEX.ada),start)
        +$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) $(EXTRA_HOST_OBJS)
$(CFLAGS) \
-         libcommon-target.a $(LIBS) $(SYSLIBS) $(BACKENDLIBS) $(GNATLIB)
+         libcommon-target.a $(LIBS) $(SYSLIBS) $(BACKENDLIBS) $(GNATLIB)
-no-pie
        $(RM) stamp-gnatlib2-rts stamp-tools
        @$(call LINK_PROGRESS,$(INDEX.ada),end)

 gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS)
$(EXTRA_HOST_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS)
-       +$(GCC_LINK) -o $@ $(CFLAGS) ada/b_gnatb.o $(GNATBIND_OBJS)
$(EXTRA_HOST_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(GNATLIB)
+       +$(GCC_LINK) -o $@ $(CFLAGS) ada/b_gnatb.o $(GNATBIND_OBJS)
$(EXTRA_HOST_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(GNATLIB)
-no-pie

 # use target-gcc target-gnatmake target-gnatbind target-gnatlink
 gnattools: $(GCC_PARTS) $(CONFIG_H) prefix.o force

Reply via email to