From d89b89102a47007eafdb014252e30a54b63329d6 Mon Sep 17 00:00:00 2001 From: ro Date: Mon, 22 Aug 2011 16:54:02 +0000 Subject: Centralize PICFLAG configuration config: * picflag.m4: New file. gcc: * configure.ac (GCC_PICFLAG_FOR_TARGET): Call it. (PICFLAG_FOR_TARGET): Substitute. * aclocal.m4: Regenerate. * configure: Regenerate. gcc/ada: * gcc-interface/Makefile.in (PICFLAG_FOR_TARGET): New. (GNATLIBCFLAGS_FOR_C): Replace TARGET_LIBGCC2_CFLAGS by PICFLAG_FOR_TARGET. (gnatlib-shared-default, gnatlib-shared-dual-win32) (gnatlib-shared-win32, gnatlib-shared-darwin, gnatlib-shared) (gnatlib-sjlj, gnatlib-zcx): Likewise. libada: * configure.ac: Include ../config/picflag.m4. (GCC_PICFLAG): Call it. Substitute. * configure: Regenerate. * Makefile.in (TARGET_LIBGCC2_CFLAGS): Replace by PICFLAG. (GNATLIBCFLAGS_FOR_C): Replace TARGET_LIBGCC2_CFLAGS by PICFLAG. (LIBADA_FLAGS_TO_PASS): Pass PICFLAG as PICFLAG_FOR_TARGET. Don't include $(GCC_DIR)/libgcc.mvars. libiberty: * aclocal.m4: Include ../config/picflag.m4. * configure.ac (GCC_PICFLAG): Call it. (enable_shared): Clear PICFLAG unless shared. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177967 138bc75d-0d04-0410-961f-82ee72b054a4 --- libada/ChangeLog | 11 +++++++ libada/Makefile.in | 10 +++---- libada/configure | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ libada/configure.ac | 6 +++- 4 files changed, 102 insertions(+), 7 deletions(-) (limited to 'libada') diff --git a/libada/ChangeLog b/libada/ChangeLog index 321712898be..689e9fb1a32 100644 --- a/libada/ChangeLog +++ b/libada/ChangeLog @@ -1,3 +1,14 @@ +2011-08-22 Rainer Orth + + * configure.ac: Include ../config/picflag.m4. + (GCC_PICFLAG): Call it. + Substitute. + * configure: Regenerate. + * Makefile.in (TARGET_LIBGCC2_CFLAGS): Replace by PICFLAG. + (GNATLIBCFLAGS_FOR_C): Replace TARGET_LIBGCC2_CFLAGS by PICFLAG. + (LIBADA_FLAGS_TO_PASS): Pass PICFLAG as PICFLAG_FOR_TARGET. + Don't include $(GCC_DIR)/libgcc.mvars. + 2010-11-20 Ralf Wildenhues PR other/46202 diff --git a/libada/Makefile.in b/libada/Makefile.in index cd518239b21..6f3df38c322 100644 --- a/libada/Makefile.in +++ b/libada/Makefile.in @@ -1,5 +1,5 @@ # Makefile for libada. -# Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc. +# Copyright 2003, 2004, 2009, 2010, 2011 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -56,15 +56,13 @@ LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes GCC_WARN_CFLAGS = $(LOOSE_WARN) WARN_CFLAGS = @warn_cflags@ -TARGET_LIBGCC2_CFLAGS= +PICFLAG = @PICFLAG@ GNATLIBCFLAGS= -g -O2 -GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \ +GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(PICFLAG) -fexceptions \ -DIN_RTS @have_getipinfo@ -# Get target-specific overrides for TARGET_LIBGCC2_CFLAGS. host_subdir = @host_subdir@ GCC_DIR=$(MULTIBUILDTOP)../../$(host_subdir)/gcc -include $(GCC_DIR)/libgcc.mvars target_noncanonical:=@target_noncanonical@ version := $(shell cat $(srcdir)/../gcc/BASE-VER) @@ -83,7 +81,7 @@ LIBADA_FLAGS_TO_PASS = \ "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \ "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \ "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \ - "TARGET_LIBGCC2_CFLAGS=$(TARGET_LIBGCC2_CFLAGS)" \ + "PICFLAG_FOR_TARGET=$(PICFLAG)" \ "THREAD_KIND=$(THREAD_KIND)" \ "TRACE=$(TRACE)" \ "MULTISUBDIR=$(MULTISUBDIR)" \ diff --git a/libada/configure b/libada/configure index 4137364df21..c0a294fdd0c 100755 --- a/libada/configure +++ b/libada/configure @@ -558,6 +558,7 @@ have_getipinfo default_gnatlib_target LN_S AWK +PICFLAG enable_shared OBJEXT EXEEXT @@ -2817,6 +2818,87 @@ fi + + + + +case "${host}" in + # PIC is the default on some targets or must not be used. + *-*-darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + PICFLAG=-fno-common + ;; + alpha*-dec-osf5*) + # PIC is the default. + ;; + hppa*64*-*-hpux*) + # PIC is the default for 64-bit PA HP-UX. + ;; + i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*) + ;; + i[34567]86-*-interix3*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + i[34567]86-*-nto-qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + PICFLAG='-fPIC -shared' + ;; + i[34567]86-pc-msdosdjgpp*) + # DJGPP does not support shared libraries at all. + ;; + ia64*-*-hpux*) + # On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + PICFLAG=-fPIC + ;; + mips-sgi-irix6*) + # PIC is the default. + ;; + rs6000-ibm-aix* | powerpc-ibm-aix*) + # All AIX code is PIC. + ;; + + # Some targets support both -fPIC and -fpic, but prefer the latter. + # FIXME: Why? + i[34567]86-*-* | x86_64-*-*) + PICFLAG=-fpic + ;; + m68k-*-*) + PICFLAG=-fpic + ;; + s390*-*-*) + PICFLAG=-fpic + ;; + # FIXME: Override -fPIC default in libgcc only? + sh-*-linux* | sh[2346lbe]*-*-linux*) + PICFLAG=-fpic + ;; + # FIXME: Simplify to sh*-*-netbsd*? + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ + sh64-*-netbsd* | sh64l*-*-netbsd*) + PICFLAG=-fpic + ;; + # Default to -fPIC unless specified otherwise. + *) + PICFLAG=-fPIC + ;; +esac + +# If the user explicitly uses -fpic/-fPIC, keep that. +case "${CFLAGS}" in + *-fpic*) + PICFLAG=-fpic + ;; + *-fPIC*) + PICFLAG=-fPIC + ;; +esac + + + # These must be passed down, or are needed by gcc/libgcc.mvars for ac_prog in gawk mawk nawk awk do diff --git a/libada/configure.ac b/libada/configure.ac index 3aa8a62a522..f9b9c5ab3b0 100644 --- a/libada/configure.ac +++ b/libada/configure.ac @@ -1,5 +1,5 @@ # Configure script for libada. -# Copyright 2003, 2004, 2009 Free Software Foundation, Inc. +# Copyright 2003, 2004, 2009, 2011 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ sinclude(../config/acx.m4) sinclude(../config/multi.m4) sinclude(../config/override.m4) +sinclude(../config/picflag.m4) sinclude(../config/unwind_ipinfo.m4) AC_INIT @@ -118,6 +119,9 @@ esac ], [enable_shared=yes]) AC_SUBST([enable_shared]) +GCC_PICFLAG +AC_SUBST([PICFLAG]) + # These must be passed down, or are needed by gcc/libgcc.mvars AC_PROG_AWK AC_PROG_LN_S -- cgit v1.2.3