This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[DARWIN]: Add -mdynamic-no-pic to Darwin-specific options
- From: Robert Bowdidge <bowdidge at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Robert Bowdidge <bowdidge at apple dot com>
- Date: Mon, 16 Aug 2004 16:25:58 -0700
- Subject: [DARWIN]: Add -mdynamic-no-pic to Darwin-specific options
- References: <1092692880.7083.ezmlm@gcc.gnu.org>
By default, the gcc on Darwin generates position-independent code for
accesses to static and global data on the assumption that an object
file will be linked into a dynamic library where their absolute
addresses will not be known til load time. The code generated is less
efficient because of the need for calculating the current pc in the
function prologue. This option is unneeded for object files linked
into executables because executables always load at an address known at
static link time.
This change adds the flag "-mdynamic-no-pic" when compiling gcc itself,
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.
Specifically, the change adds the flag to the XCFLAGS variable;
gcc/Makefile.in states this variable holds options needed for "most
compilations but not when using the gcc just built". It correctly adds
the option to the compiler when bootstrapping, but does not use the
flag for any of the libraries (libstdc++, libgcc, etc.)
Ok to submit?
Index: gcc/config/rs6000/x-darwin
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/x-darwin,v
retrieving revision 1.5
diff -u -b -d -r1.5 x-darwin
--- gcc/config/rs6000/x-darwin 30 Apr 2003 01:52:06 -0000 1.5
+++ gcc/config/rs6000/x-darwin 16 Aug 2004 23:13:07 -0000
@@ -1,3 +1,4 @@
+XCFLAGS = -mdynamic-no-pic
host-darwin.o : $(srcdir)/config/rs6000/host-darwin.c $(CONFIG_H)
$(SYSTEM_H) \
coretypes.h hosthooks.h hosthooks-def.h toplev.h diagnostic.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \