enable mdynamic-no-pic bootstrap for x86 Darwin
authorIain Sandoe <iains@gcc.gnu.org>
Thu, 4 Nov 2010 10:43:47 +0000 (10:43 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Thu, 4 Nov 2010 10:43:47 +0000 (10:43 +0000)
* configure.ac (*-*-darwin*): Use mh-darwin for all Darwin variants.
* configure: Regenerate.
* config/mh-ppc-darwin: Rename to mh-darwin.

gcc:

* gcc/configure.ac: Filter -mdynamic-no-pic from CFLAGS when testing for
plugin capabilities.
* gcc/configure: Regenerate.

gcc/testsuite:

* lib/plugin-support.exp (plugin-test-execute): Filter -mdynamic-no-pic from
plugin build flags on Darwin targets.

From-SVN: r166302

ChangeLog
config/mh-darwin [new file with mode: 0644]
config/mh-ppc-darwin [deleted file]
configure
configure.ac
gcc/ChangeLog
gcc/configure
gcc/configure.ac
gcc/testsuite/ChangeLog
gcc/testsuite/lib/plugin-support.exp

index 7e4760a41da8c74f4994765fb0f4c9097d62d009..0812e34054d696260bad44d7b23d64783b92dbf2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-04  Iain Sandoe  <iains@gcc.gnu.org>
+
+       * configure.ac (*-*-darwin*): Use mh-darwin for all Darwin variants.
+       * configure: Regenerate.
+       * config/mh-ppc-darwin: Rename to mh-darwin.
+
 2010-11-03  Ian Lance Taylor  <iant@google.com>
            Dave Korn  <dave.korn.cygwin@gmail.com>
 
diff --git a/config/mh-darwin b/config/mh-darwin
new file mode 100644 (file)
index 0000000..66f68b6
--- /dev/null
@@ -0,0 +1,5 @@
+# The -mdynamic-no-pic ensures that the compiler executable is built without
+# position-independent-code -- the usual default on Darwin. This fix speeds
+# compiles by 3-5%.
+
+BOOT_CFLAGS += -mdynamic-no-pic
diff --git a/config/mh-ppc-darwin b/config/mh-ppc-darwin
deleted file mode 100644 (file)
index 66f68b6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# The -mdynamic-no-pic ensures that the compiler executable is built without
-# position-independent-code -- the usual default on Darwin. This fix speeds
-# compiles by 3-5%.
-
-BOOT_CFLAGS += -mdynamic-no-pic
index f3bfee20897b3426be0abdc6ebb4027be733532f..7c313e28c4c77da6e4752bc8376e95b3f4458c39 100755 (executable)
--- a/configure
+++ b/configure
@@ -3698,8 +3698,8 @@ fi
     tentative_cc="/usr/cygnus/progressive/bin/gcc"
     host_makefile_frag="config/mh-lynxrs6k"
     ;;
-  powerpc-*-darwin*)
-    host_makefile_frag="config/mh-ppc-darwin"
+  *-*-darwin*)
+    host_makefile_frag="config/mh-darwin"
     ;;
   powerpc-*-aix*)
     host_makefile_frag="config/mh-ppc-aix"
index c0e7384fdb6cb3bf4c13c656ba1cf9534794ca0b..9b55f4e296c7146a605a94643bf8526de90a4f18 100644 (file)
@@ -1157,8 +1157,8 @@ case "${host}" in
     tentative_cc="/usr/cygnus/progressive/bin/gcc"
     host_makefile_frag="config/mh-lynxrs6k"
     ;;
-  powerpc-*-darwin*)
-    host_makefile_frag="config/mh-ppc-darwin"
+  *-*-darwin*)
+    host_makefile_frag="config/mh-darwin"
     ;;
   powerpc-*-aix*)
     host_makefile_frag="config/mh-ppc-aix"
index a8d12c411914ffb9f483a0e117c631122912b317..712366c8846d0256feb94c30aba9ec606975454d 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-04  Iain Sandoe  <iains@gcc.gnu.org>
+
+       * gcc/configure.ac: Filter -mdynamic-no-pic from CFLAGS when testing for
+       plugin capabilities.
+       * gcc/configure: Regenerate.
+
 2010-11-03  Xinliang David Li  <davidxl@google.com>
 
        PR target/46200
index a4d8a2177058e788ab42fe8cc8251ea36ce014f3..e39b946811d72691c9539a8c64c4b40772464a0a 100755 (executable)
 
   # Check that we can build shared objects with -fPIC -shared
   saved_LDFLAGS="$LDFLAGS"
+  saved_CFLAGS="$CFLAGS"
   case "${host}" in
     *-*-darwin*)
-      LDFLAGS="$LDFLAGS -fPIC -shared -undefined dynamic_lookup"
+      CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
+      CFLAGS="$CFLAGS -fPIC"
+      LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
     ;;
     *)
+      CFLAGS="$CFLAGS -fPIC"
       LDFLAGS="$LDFLAGS -fPIC -shared"
     ;;
   esac
@@ -25991,6 +25995,7 @@ rm -f core conftest.err conftest.$ac_objext \
     enable_plugin=no
   fi
   LDFLAGS="$saved_LDFLAGS"
+  CFLAGS="$saved_CFLAGS"
 
   # If plugin support had been requested but not available, fail.
   if test x"$enable_plugin" = x"no" ; then
index f62500dc9aa12b300870eccea17c116c7a81c770..cc400425c273915357e6d4f3d3255fe82ef21c54 100644 (file)
@@ -4694,11 +4694,15 @@ if test x"$enable_plugin" = x"yes"; then
 
   # Check that we can build shared objects with -fPIC -shared
   saved_LDFLAGS="$LDFLAGS"
+  saved_CFLAGS="$CFLAGS"
   case "${host}" in
     *-*-darwin*)
-      LDFLAGS="$LDFLAGS -fPIC -shared -undefined dynamic_lookup"
+      CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
+      CFLAGS="$CFLAGS -fPIC"
+      LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
     ;;
     *)
+      CFLAGS="$CFLAGS -fPIC"
       LDFLAGS="$LDFLAGS -fPIC -shared"
     ;;
   esac
@@ -4712,6 +4716,7 @@ if test x"$enable_plugin" = x"yes"; then
     enable_plugin=no
   fi
   LDFLAGS="$saved_LDFLAGS"
+  CFLAGS="$saved_CFLAGS"
 
   # If plugin support had been requested but not available, fail.
   if test x"$enable_plugin" = x"no" ; then
index 1e27cd660c6b90c1d1d8cd6c16d18589734f7d8c..bbcf32deb2885b4fba37c654b4cdca201503db1e 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-04  Iain Sandoe  <iains@gcc.gnu.org>
+
+       * lib/plugin-support.exp (plugin-test-execute): Filter -mdynamic-no-pic from
+       plugin build flags on Darwin targets.
+
 2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gcc.target/i386/pr46285.c: Require split_stack target.
index 9444f52662b0b6d3f4346272b5db2f79a1c63034..2e689a68921c921d53b57b758780402e7c7f2c7b 100644 (file)
@@ -86,15 +86,29 @@ proc plugin-test-execute { plugin_src plugin_tests } {
                   -I${gcc_srcdir}/include -I${gcc_srcdir}/libcpp/include \
                   $GMPINC -I${gcc_objdir}/intl"
 
-    set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared"
-
     if { [ ishost *-*-darwin* ] } {
-        set optstr [concat $optstr "-undefined dynamic_lookup"]
+       # -mdynamic-no-pic is incompatible with -fPIC.
+       set plug_cflags "" 
+       foreach op $PLUGINCFLAGS {
+           if { [string compare "-mdynamic-no-pic" $op] } {
+               set plug_cflags [concat $plug_cflags " $op"]
+           }
+       }
+       set optstr "$includes"
+       foreach op $extra_flags {
+           if { [string compare "-mdynamic-no-pic" $op] } {
+               set optstr [concat $optstr " $op"]
+           }
+       }
+       set optstr [concat $optstr "-DIN_GCC -fPIC -shared -undefined dynamic_lookup"]
+    } else {
+       set plug_cflags $PLUGINCFLAGS 
+       set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared"
     }
 
     # Temporarily switch to the environment for the plugin compiler.
     restore_ld_library_path_env_vars
-    set status [remote_exec build "$PLUGINCC $PLUGINCFLAGS $plugin_src $optstr -o $plugin_lib"]
+    set status [remote_exec build "$PLUGINCC $plug_cflags $plugin_src $optstr -o $plugin_lib"]
     set status [lindex $status 0]
     set_ld_library_path_env_vars