summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-26 17:47:49 +0000
committerChris Lattner <sabre@nondot.org>2009-02-26 17:47:49 +0000
commit61863a3d3dc7441b5aec3b8d603a9f43689aa1b5 (patch)
tree91478409a750153efb95776e617c677f1c83e961
parent843daf40b646d1eeeedc6f092d9c1c1d1e991d14 (diff)
downloadllvm-61863a3d3dc7441b5aec3b8d603a9f43689aa1b5.tar.gz
llvm-61863a3d3dc7441b5aec3b8d603a9f43689aa1b5.tar.bz2
llvm-61863a3d3dc7441b5aec3b8d603a9f43689aa1b5.tar.xz
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
-rw-r--r--Makefile.rules18
1 files changed, 18 insertions, 0 deletions
diff --git a/Makefile.rules b/Makefile.rules
index c9251e7e63..388372e0a9 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1067,6 +1067,24 @@ 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
#---------------------------------------------------------
all-local:: $(ToolBuildPath)