aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-shlib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
commitd39c594d39df7f283c2fb8a704a3f31c501180d9 (patch)
tree36453626c792cccd91f783a38a169d610a6b9db9 /tools/llvm-shlib
parent6144c1de6a7674dad94290650e4e14f24d42e421 (diff)
downloadsrc-d39c594d39df7f283c2fb8a704a3f31c501180d9.tar.gz
src-d39c594d39df7f283c2fb8a704a3f31c501180d9.zip
Vendor import of llvm r114020 (from the release_28 branch):vendor/llvm/llvm-r114020
Notes
Notes: svn path=/vendor/llvm/dist/; revision=212793 svn path=/vendor/llvm/llvm-r114020/; revision=212794; tag=vendor/llvm/llvm-r114020
Diffstat (limited to 'tools/llvm-shlib')
-rw-r--r--tools/llvm-shlib/Makefile53
1 files changed, 52 insertions, 1 deletions
diff --git a/tools/llvm-shlib/Makefile b/tools/llvm-shlib/Makefile
index ce29bf809e63..52381304bb93 100644
--- a/tools/llvm-shlib/Makefile
+++ b/tools/llvm-shlib/Makefile
@@ -15,6 +15,17 @@ NO_BUILD_ARCHIVE = 1
LINK_LIBS_IN_SHARED = 1
SHARED_LIBRARY = 1
+include $(LEVEL)/Makefile.config
+
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ EXPORTED_SYMBOL_FILE = $(ObjDir)/$(LIBRARYNAME).exports
+
+ # It is needed to force static-stdc++.a linked.
+ # FIXME: It should be omitted when configure detects system's stdc++.dll.
+ SHLIB_FRAG_NAMES += stdc++.a.o
+
+endif
+
include $(LEVEL)/Makefile.common
# Include all archives in libLLVM.(so|dylib) except the ones that have
@@ -38,7 +49,6 @@ ifeq ($(HOST_OS),Darwin)
LLVMLibsOptions := $(LLVMLibsOptions) -all_load
# extra options to override libtool defaults
LLVMLibsOptions := $(LLVMLibsOptions) \
- -avoid-version \
-Wl,-dead_strip \
-Wl,-seg1addr -Wl,0xE0000000
@@ -58,3 +68,44 @@ ifeq ($(HOST_OS), Linux)
# Don't allow unresolved symbols.
LLVMLibsOptions += -Wl,--no-undefined
endif
+
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+
+SHLIB_STUBS := $(addprefix $(ObjDir)/, $(SHLIB_FRAG_NAMES))
+SHLIB_FRAGS := $(patsubst %.a.o, $(ObjDir)/%.syms.txt, $(LIBRARYNAME).a.o $(SHLIB_FRAG_NAMES))
+LLVMLibsOptions := $(SHLIB_STUBS) $(LLVMLibsOptions)
+
+$(LibName.SO): $(SHLIB_STUBS)
+
+%.syms.txt: %.a.o
+ $(Echo) Collecting global symbols of $(notdir $*)
+ $(Verb) $(NM_PATH) -g $< > $@
+
+$(ObjDir)/$(LIBRARYNAME).exports: $(SHLIB_FRAGS) $(ObjDir)/.dir
+ $(Echo) Generating exports for $(LIBRARYNAME)
+ $(Verb) ($(SED) -n \
+ -e "s/^.* T _\([^.][^.]*\)$$/\1/p" \
+ -e "s/^.* [BDR] _\([^.][^.]*\)$$/\1 DATA/p" \
+ $(SHLIB_FRAGS) \
+ | sort -u) > $@
+
+$(ObjDir)/$(LIBRARYNAME).a.o: $(LLVMLibsPaths) $(ObjDir)/.dir
+ $(Echo) Linking all LLVMLibs together for $(LIBRARYNAME)
+ $(Verb) $(Link) -nostartfiles -Wl,-r -nodefaultlibs -o $@ \
+ -Wl,--whole-archive $(LLVMLibsPaths) \
+ -Wl,--no-whole-archive
+
+$(ObjDir)/stdc++.a.o: $(ObjDir)/.dir
+ $(Echo) Linking all libs together for static libstdc++.a
+ $(Verb) $(Link) -nostartfiles -Wl,-r -nodefaultlibs -o $@ \
+ -Wl,--whole-archive -lstdc++ \
+ -Wl,--no-whole-archive
+# FIXME: workaround to invalidate -lstdc++
+ $(Echo) Making dummy -lstdc++ to lib
+ $(Verb) $(AR) rc $(ToolDir)/libstdc++.dll.a
+# FIXME: Is install-local needed?
+
+clean-local::
+ $(Verb) $(RM) -f $(ToolDir)/libstdc++.dll.a
+
+endif