Use -single_module to link libgcc on Darwin

Geoffrey Keating gkeating@apple.com
Thu Dec 1 08:41:00 GMT 2005


Using -single_module gives app startup time benefits, because (a) it
works better with prebinding than -flat_namespace and (b) it's nicer
to the dynamic linker.  It does mean that you can't build GCC on Mac
OS 10.1 or earlier (that would be darwin5*) but I believe this doesn't
actually work anyway, and there have been no reports of anying trying
to do it.

Bootstrapped & tested on powerpc-darwin8.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-darwin-libgccsinglemodule.patch=======
2005-12-01  Geoffrey Keating  <geoffk@apple.com>

	* config/t-slibgcc-darwin (SHLIB_LINK): Use -single-module rather
	than -flat_namespace.

Index: gcc/config/t-slibgcc-darwin
===================================================================
--- gcc/config/t-slibgcc-darwin	(revision 107736)
+++ gcc/config/t-slibgcc-darwin	(working copy)
@@ -14,7 +14,7 @@
 # uses the stub versions named by $(LIBGCC).
 SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -dynamiclib -nodefaultlibs \
 	-Wl,-install_name,$(slibdir)/$(SHLIB_SONAME) \
-	-Wl,-flat_namespace -o $(SHLIB_SONAME).tmp \
+	-single_module -o $(SHLIB_SONAME).tmp \
 	-Wl,-exported_symbols_list,$(SHLIB_MAP) \
 	$(SHLIB_VERSTRING) \
 	@multilib_flags@ $(SHLIB_OBJS) -lc && \
============================================================



More information about the Gcc-patches mailing list