]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ada/gcc-interface/Makefile.in
ada: Fix build of GNAT tools
[thirdparty/gcc.git] / gcc / ada / gcc-interface / Makefile.in
index dc0e54f8eb638b7dce94ddf5bc73f96c783a6784..b5243a24a8ffe9c4f094a9db67c371778c805586 100644 (file)
@@ -240,10 +240,10 @@ ALL_CPPFLAGS = $(CPPFLAGS)
 ALL_COMPILERFLAGS = $(ALL_CFLAGS)
 
 # This is where we get libiberty.a from.
-ifeq ($(PICFLAG),)
-LIBIBERTY = ../../libiberty/libiberty.a
-else
+ifneq ($(findstring $(PICFLAG),-fPIC -fPIE),)
 LIBIBERTY = ../../libiberty/pic/libiberty.a
+else
+LIBIBERTY = ../../libiberty/libiberty.a
 endif
 
 # We need to link against libbacktrace because diagnostic.c in
@@ -261,6 +261,9 @@ TOOLS_LIBS = ../version.o ../link.o ../targext.o ../../ggc-none.o \
   $(LIBGNAT) $(LIBINTL) $(LIBICONV) ../$(LIBBACKTRACE) ../$(LIBIBERTY) \
   $(SYSLIBS) $(TGT_LIB)
 
+# Add -no-pie to TOOLS_LIBS since some of them are compiled with -fno-PIE.
+TOOLS_LIBS += @LD_PICFLAG@
+
 # Specify the directories to be searched for header files.
 # Both . and srcdir are used, in that order,
 # so that tm.h and config.h will be found in the compilation