[DARWIN]: Add -mdynamic-no-pic to Darwin-specific options

Robert Bowdidge bowdidge@apple.com
Thu Aug 19 19:41:00 GMT 2004


Second try:

This change adds the flag "-mdynamic-no-pic" when compiling gcc itself 
on Darwin, improving the efficiency of gcc's code and thus improving 
compile times.  On our compiler timing test projects, this change 
improved compile times by 3-5%.  gcc still bootstraps after this 
change, and the flag was correctly applied to gcc but not to libraries.

My previous version of the change passed the flag for all compiles of 
gcc.  If gcc was being built with a compiler that didn't support the 
option, the compile would fail.  This problem was noticed when the 
regression tester fell over, as it was using an older compiler that 
didn't support the flag.  The previous change has been reverted.

This version of the change modifies the top level Makefile and 
configure to allow the BOOT_CFLAGS variable to be changed in a 
host-specific config file.  (Previously, BOOT_CFLAGS was defined after 
host-specific makefile fragments were included, so the stock version 
always won.)  I also had to create a host-specific config file for 
PowerPC Darwin systems, and set the -mdynamic-no-pic flag only when 
that config file is included in the top-level Makefile.

Ok to submit to mainline?

Robert

In addition to these changes, configure was regenerated with autoconf 
version 2.13.  I also added the file config/mh-ppc-darwin with the 
following contents:

# 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=-g -O2 -mdynamic-no-pic


===================================================================
RCS file: /cvs/gcc/gcc/ChangeLog,v
retrieving revision 1.967
diff -u -b -d -r1.967 ChangeLog
--- ChangeLog   17 Aug 2004 22:06:42 -0000      1.967
+++ ChangeLog   19 Aug 2004 19:30:14 -0000
@@ -1,3 +1,11 @@
+2004-08-19  Robert Bowdidge <bowdidge@apple.com>
+
+        * Makefile.in: Move BOOT_CFLAGS above host makefile fragment 
include
+        * configure.in: add test for powerpc-apple-* host to specify 
makefile frag
+        * configure: regenerate
+        * config/mh-ppc-darwin: create file, override BOOT_CFLAGS for
+        -mdynamic-no-pic
+
  2004-08-17  Robert Millan  <robertmh@gnu.org>

         * configure.in: In noconfigdirs check, match GNU/k*BSD with 
GNU/Linux

===================================================================
RCS file: /cvs/gcc/gcc/Makefile.in,v
retrieving revision 1.235
diff -u -b -d -r1.235 Makefile.in
--- Makefile.in 17 Aug 2004 07:26:38 -0000      1.235
+++ Makefile.in 19 Aug 2004 02:44:35 -0000
@@ -486,6 +486,10 @@
         @echo Please reconfigure without --enable-bootstrap
  @endif gcc-bootstrap

+# Flags to pass to stage2 and later makes. -- define here so fragments 
can
+# override them.
+BOOT_CFLAGS= -g -O2
+
  # The first rule in the file had better be this one.  Don't put any 
above it.
  # This lives here to allow makefile fragments to contain dependencies.
  @default_target@:
@@ -28137,7 +28141,6 @@
  objext = .o

  # Flags to pass to stage2 and later makes.
-BOOT_CFLAGS= -g -O2
  POSTSTAGE1_FLAGS_TO_PASS = \
         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
         STAGE_PREFIX=$$r/stage-gcc/ \


===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.310
diff -u -b -d -r1.310 configure.in
--- configure.in        17 Aug 2004 22:06:44 -0000      1.310
+++ configure.in        19 Aug 2004 02:44:36 -0000
@@ -945,6 +945,9 @@
      tentative_cc="/usr/cygnus/progressive/bin/gcc"
      host_makefile_frag="config/mh-lynxrs6k"
      ;;
+  powerpc-apple-*)
+    host_makefile_frag="config/mh-ppc-darwin"
+    ;;
    *-*-lynxos*)
      # /bin/cc is less than useful for our purposes.  Always use GCC
      tentative_cc="/bin/gcc"



More information about the Gcc-patches mailing list