This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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) \



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]