From 61863a3d3dc7441b5aec3b8d603a9f43689aa1b5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 26 Feb 2009 17:47:49 +0000 Subject: strip exported symbols from tools that build with TOOL_NO_EXPORTS=1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65543 91177308-0d34-0410-b5e6-96231b3b80d8 --- Makefile.rules | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Makefile.rules b/Makefile.rules index c9251e7e63..388372e0a9 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -1066,6 +1066,24 @@ else ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT) endif +#--------------------------------------------------------- +# Prune Exports +#--------------------------------------------------------- + +# If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by +# not exporting all of the weak symbols from the binary. This reduces dyld +# startup time by 4x on darwin in some cases. +ifdef TOOL_NO_EXPORTS +ifeq ($(OS),Darwin) +LD.Flags += -Wl,-exported_symbol -Wl,_main +endif + +ifeq ($(OS), $(filter $(OS), Linux NetBSD FreeBSD)) +LD.Flags += -Wl,--version-script=Driver.map +endif +endif + + #--------------------------------------------------------- # Provide targets for building the tools #--------------------------------------------------------- -- cgit v1.2.3