endif
ifeq ($(OS),Darwin)
- SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle
+ DARWIN_VERSION := `sw_vers -productVersion`
+ SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle \
+ -mmacosx-version-min=$(DARWIN_VERSION)
+ CompileCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
else
SharedLinkOptions=-shared
endif
# Options To Invoke Tools
#----------------------------------------------------------
-CompileCommonOpts := -pedantic -Wall -W -Wwrite-strings -Wno-long-long \
+CompileCommonOpts += -pedantic -Wall -W -Wwrite-strings -Wno-long-long \
-Wunused -Wno-unused-parameter $(EXTRA_OPTIONS)
ifeq ($(OS),HP-UX)
endif
UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
- Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS:%=-XCClinker %)
+ Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS)
ifdef UNIVERSAL_SDK_PATH
CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
- Relink.Flags += -XCClinker -isysroot -XCClinker $(UNIVERSAL_SDK_PATH)
+ Relink.Flags += -isysroot $(UNIVERSAL_SDK_PATH)
endif
# Building universal cannot compute dependencies automatically.
$(LibName.O): $(ObjectsO) $(LibDir)/.dir
$(Echo) Linking $(BuildMode) Object Library $(notdir $@)
- $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlibs -nostartfiles -o $@ $(ObjectsO)
+ $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlib -nostartfiles -o $@ $(ObjectsO)
clean-local::
ifneq ($(strip $(LibName.O)),)
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=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
+endif
+endif
+
+
#---------------------------------------------------------
# Provide targets for building the tools
#---------------------------------------------------------