This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Don't use -prefer-pic if target doesn't support shared libraries
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: Don't use -prefer-pic if target doesn't support shared libraries
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 03 May 2001 17:12:38 -0300
- Organization: GCC Team, Red Hat
Certain targets, such as mn10300-elf, just don't support shared
libraries, so it doesn't make sense to generate PIC code for it. It
even gets GCC to generate code that is rejected by the assembler.
This patch arranges for -prefer-pic not to be used in case shared
libraries are not enabled. Then, libtool will decide whether or not
to generate PIC code based on the --with[out]-pic configure flag,
defaulting to PIC if shared libraries are supported, and non-PIC
otherwise, IIRC.
Tested on alpha-linux-gnu-x-mn10300-elf. Ok to install?
Index: libstdc++-v3/configure.in
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/configure.in,v
retrieving revision 1.59
diff -u -p -r1.59 configure.in
--- libstdc++-v3/configure.in 2001/04/20 08:59:24 1.59
+++ libstdc++-v3/configure.in 2001/05/03 20:10:13
@@ -260,6 +260,14 @@ GLIBCPP_EXPORT_INSTALL_INFO
GLIBCPP_EXPORT_INCLUDES
GLIBCPP_EXPORT_FLAGS
+if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
+ grep "enable shared" > /dev/null; then
+ LIBSUPCXX_PICFLAGS=-prefer-pic
+else
+ LIBSUPCXX_PICFLAGS=
+fi
+AC_SUBST(LIBSUPCXX_PICFLAGS)
+
# This should be done by mkincludedir, but hack around it now.
blddir=`pwd`
echo "checking for $blddir/include"
Index: libstdc++-v3/libsupc++/Makefile.am
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/libsupc++/Makefile.am,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile.am
--- libstdc++-v3/libsupc++/Makefile.am 2001/04/11 18:52:31 1.25
+++ libstdc++-v3/libsupc++/Makefile.am 2001/05/03 20:10:13
@@ -100,7 +100,7 @@ libsupc__convenience_la_SOURCES = $(sour
glibcppinstalldir = @gxx_include_dir@
glibcppinstall_HEADERS = $(headers)
-LIBSUPCXX_CXXFLAGS = -prefer-pic
+LIBSUPCXX_CXXFLAGS = $(LIBSUPCXX_PICFLAGS)
# AM_CXXFLAGS needs to be in each subdirectory so that it can be
# modified in a per-library or per-sub-library way. Need to manually
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me