llvm.org GIT mirror llvm / ea6c39d
Roll r96559 forward again, adding libLLVM-2.7svn.so to LLVM. This links 3 of the examples shared to make sure the shared library keeps working. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96959 91177308-0d34-0410-b5e6-96231b3b80d8 Jeffrey Yasskin 9 years ago
13 changed file(s) with 169 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
2929 DIRS := lib/System lib/Support utils
3030 OPTIONAL_DIRS :=
3131 else
32 DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
33 tools runtime docs unittests
32 DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-shlib \
33 tools/llvm-config tools runtime docs unittests
3434 OPTIONAL_DIRS := projects bindings
3535 endif
3636
261261 # Do we want to build with position independent code?
262262 ENABLE_PIC := @ENABLE_PIC@
263263
264 # Do we want to link the tools shared?
265 ifndef ENABLE_SHARED
266 ENABLE_SHARED := @ENABLE_SHARED@
267 endif
268
264269 # Use -fvisibility-inlines-hidden?
265270 ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
266271
270275
271276 # Enable JIT for this platform
272277 TARGET_HAS_JIT = @TARGET_HAS_JIT@
278
279 # Environment variable to set to change the runtime shared library search path.
280 SHLIBPATH_VAR = @SHLIBPATH_VAR@
273281
274282 # Shared library extension for host platform.
275283 SHLIBEXT = @SHLIBEXT@
622622 ifneq ($(HOST_OS),Darwin)
623623 ifneq ($(DARWIN_MAJVERS),4)
624624 ifdef TOOLNAME
625 ifdef EXAMPLE_TOOL
626 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
627 else
628 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
629 endif
625 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
626 ifdef EXAMPLE_TOOL
627 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
628 else
629 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
630 endif
630631 endif
631632 endif
632633 endif
959960
960961 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
961962
963 ifeq ($(ENABLE_SHARED), 1)
964 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
965 LLVMLibsPaths += $(LibDir)/libLLVM-$(LLVMVersion)$(SHLIBEXT)
966 else
962967 LLVMLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS))
963968 LLVMLibsPaths += $(LLVM_CONFIG) \
964969 $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
970 endif
965971 endif
966972 endif
967973
11681174 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
11691175 # building an archive.
11701176 #---------------------------------------------------------
1177 ifndef NO_BUILD_ARCHIVE
11711178 ifndef BUILD_ARCHIVE
11721179 ifndef LOADABLE_MODULE
11731180 BUILD_ARCHIVE = 1
1181 endif
11741182 endif
11751183 endif
11761184
469469 AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
470470 [Define if position independent code is enabled])
471471
472 dnl Allow linking tools against the shared library.
473 AC_ARG_ENABLE(shared,
474 AS_HELP_STRING([--enable-shared],
475 [Link LLVM tools shared (default is NO)]),,
476 enableval=default)
477 case "$enableval" in
478 yes) AC_SUBST(ENABLE_SHARED,[1]) ;;
479 no) AC_SUBST(ENABLE_SHARED,[0]) ;;
480 default) AC_SUBST(ENABLE_SHARED,[0]) ;;
481 *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
482 esac
483
472484 dnl Allow specific targets to be specified for building (or not)
473485 TARGETS_TO_BUILD=""
474486 AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
13311343 dnl the Makefiles so we can use it there too
13321344 AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
13331345
1346 dnl Propagate the run-time library path variable that the libltdl
1347 dnl checks found to the Makefiles so we can use it there too
1348 AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var)
1349
13341350 # Translate the various configuration directories and other basic
13351351 # information into substitutions that will end up in Makefile.config.in
13361352 # that these configured values can be used by the makefiles
688688 ENABLE_DOXYGEN
689689 ENABLE_THREADS
690690 ENABLE_PIC
691 ENABLE_SHARED
691692 TARGETS_TO_BUILD
692693 LLVM_ENUM_TARGETS
693694 LLVM_ENUM_ASM_PRINTERS
769770 LLVMGCCDIR
770771 LLVMGCC_LANGS
771772 SHLIBEXT
773 SHLIBPATH_VAR
772774 LLVM_PREFIX
773775 LLVM_BINDIR
774776 LLVM_LIBDIR
14011403 --enable-threads Use threads if available (default is YES)
14021404 --enable-pic Build LLVM with Position Independent Code (default
14031405 is YES)
1406 --enable-shared Link LLVM tools shared (default is NO)
14041407 --enable-targets Build specific host targets: all or
14051408 target1,target2,... Valid targets are: host, x86,
14061409 x86_64, sparc, powerpc, alpha, arm, mips, spu,
48634866 _ACEOF
48644867
48654868
4869 # Check whether --enable-shared was given.
4870 if test "${enable_shared+set}" = set; then
4871 enableval=$enable_shared;
4872 else
4873 enableval=default
4874 fi
4875
4876 case "$enableval" in
4877 yes) ENABLE_SHARED=1
4878 ;;
4879 no) ENABLE_SHARED=0
4880 ;;
4881 default) ENABLE_SHARED=0
4882 ;;
4883 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&5
4884 echo "$as_me: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&2;}
4885 { (exit 1); exit 1; }; } ;;
4886 esac
4887
48664888 TARGETS_TO_BUILD=""
48674889 # Check whether --enable-targets was given.
48684890 if test "${enable_targets+set}" = set; then
1110411126 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1110511127 lt_status=$lt_dlunknown
1110611128 cat > conftest.$ac_ext <
11107 #line 11108 "configure"
11129 #line 11130 "configure"
1110811130 #include "confdefs.h"
1110911131
1111011132 #if HAVE_DLFCN_H
1968319705 fi
1968419706
1968519707 SHLIBEXT=$libltdl_cv_shlibext
19708
19709
19710 SHLIBPATH_VAR=$libltdl_cv_shlibpath_var
1968619711
1968719712
1968819713 # Translate the various configuration directories and other basic
2074220767 ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim
2074320768 ENABLE_THREADS!$ENABLE_THREADS$ac_delim
2074420769 ENABLE_PIC!$ENABLE_PIC$ac_delim
20770 ENABLE_SHARED!$ENABLE_SHARED$ac_delim
2074520771 TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
2074620772 LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim
2074720773 LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim
2075120777 CLANGPATH!$CLANGPATH$ac_delim
2075220778 CLANGXXPATH!$CLANGXXPATH$ac_delim
2075320779 ENABLE_BUILT_CLANG!$ENABLE_BUILT_CLANG$ac_delim
20754 OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
2075520780 _ACEOF
2075620781
2075720782 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
2079320818 ac_delim='%!_!# '
2079420819 for ac_last_try in false false false false false :; do
2079520820 cat >conf$$subs.sed <<_ACEOF
20821 OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
2079620822 EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
2079720823 BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
2079820824 ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
2086420890 LLVMGCCDIR!$LLVMGCCDIR$ac_delim
2086520891 LLVMGCC_LANGS!$LLVMGCC_LANGS$ac_delim
2086620892 SHLIBEXT!$SHLIBEXT$ac_delim
20893 SHLIBPATH_VAR!$SHLIBPATH_VAR$ac_delim
2086720894 LLVM_PREFIX!$LLVM_PREFIX$ac_delim
2086820895 LLVM_BINDIR!$LLVM_BINDIR$ac_delim
2086920896 LLVM_LIBDIR!$LLVM_LIBDIR$ac_delim
2088420911 LTLIBOBJS!$LTLIBOBJS$ac_delim
2088520912 _ACEOF
2088620913
20887 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then
20914 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then
2088820915 break
2088920916 elif $ac_last_try; then
2089020917 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
88 LEVEL = ../..
99 TOOLNAME = BrainF
1010 EXAMPLE_TOOL = 1
11 # To keep the shared library working, we link a few of the examples
12 # against it unconditionally.
13 ENABLE_SHARED = 1
1114
1215 LINK_COMPONENTS := jit bitwriter nativecodegen interpreter
1316
99 LEVEL = ../..
1010 TOOLNAME = Fibonacci
1111 EXAMPLE_TOOL = 1
12 # To keep the shared library working, we link a few of the examples
13 # against it unconditionally.
14 ENABLE_SHARED = 1
1215
1316 # Link in JIT support
1417 LINK_COMPONENTS := jit interpreter nativecodegen
88 LEVEL = ../..
99 TOOLNAME = HowToUseJIT
1010 EXAMPLE_TOOL = 1
11 # To keep the shared library working, we link a few of the examples
12 # against it unconditionally.
13 ENABLE_SHARED = 1
1114
1215 LINK_COMPONENTS := jit interpreter nativecodegen
1316
197197 -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
198198 -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
199199 -e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
200 -e "s#@ENABLE_SHARED@#$(ENABLE_SHARED)#g" \
201 -e "s#@SHLIBPATH_VAR@#$(SHLIBPATH_VAR)#g" \
200202 $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
2222
2323 ###
2424
25 import os
25 # If necessary, point the dynamic loader at libLLVM.so.
26 if config.enable_shared:
27 libdir = os.path.join(config.llvm_obj_root, config.llvm_build_mode, 'lib')
28 shlibpath = config.environment.get(config.shlibpath_var,'')
29 if shlibpath:
30 shlibpath = ':' + shlibpath
31 shlibpath = libdir + shlibpath
32 config.environment[config.shlibpath_var] = shlibpath
2633
2734 # Check that the object root is known.
2835 if config.test_exec_root is None:
44 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
55 config.llvmgcc_dir = "@LLVMGCCDIR@"
66 config.llvm_build_mode = "@LLVM_BUILD_MODE@"
7 config.enable_shared = @ENABLE_SHARED@
8 config.shlibpath_var = "@SHLIBPATH_VAR@"
79
810 # Let the main config do the real work.
911 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")
0 ##===- tools/shlib/Makefile --------------------------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8
9 LEVEL = ../..
10 LIBRARYNAME = LLVM-$(LLVMVersion)
11
12 NO_BUILD_ARCHIVE = 1
13 LINK_LIBS_IN_SHARED = 1
14 SHARED_LIBRARY = 1
15
16 include $(LEVEL)/Makefile.common
17
18 # Include all archives in libLLVM.(so|dylib) except the ones that have
19 # their own dynamic libraries.
20 Archives := $(wildcard $(LibDir)/libLLVM*.a)
21 SharedLibraries := $(wildcard $(LibDir)/libLLVM*$(SHLIBEXT))
22 IncludeInLibLlvm := $(filter-out $(basename $(SharedLibraries)).a, $(Archives))
23 LLVMLibsOptions := $(IncludeInLibLlvm:$(LibDir)/lib%.a=-l%)
24 LLVMLibsPaths := $(IncludeInLibLlvm)
25
26 $(LibName.SO): $(LLVMLibsPaths)
27
28 ifeq ($(HOST_OS),Darwin)
29 # set dylib internal version number to llvmCore submission number
30 ifdef LLVM_SUBMIT_VERSION
31 LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
32 -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
33 -Wl,-compatibility_version -Wl,1
34 endif
35 # Include everything from the .a's into the shared library.
36 LLVMLibsOptions := $(LLVMLibsOptions) -all_load
37 # extra options to override libtool defaults
38 LLVMLibsOptions := $(LLVMLibsOptions) \
39 -avoid-version \
40 -Wl,-dead_strip \
41 -Wl,-seg1addr -Wl,0xE0000000
42
43 # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
44 DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
45 ifneq ($(DARWIN_VERS),8)
46 LLVMLibsOptions := $(LLVMLibsOptions) \
47 -Wl,-install_name \
48 -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
49 endif
50 endif
51
52 ifeq ($(HOST_OS), Linux)
53 # Include everything from the .a's into the shared library.
54 LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
55 -Wl,--no-whole-archive
56 # Warn if we'll need to modify the text segment when loading libLLVM.so.
57 LLVMLibsOptions += -Wl,--warn-shared-textrel
58 # Don't allow unresolved symbols.
59 LLVMLibsOptions += -Wl,--no-undefined
60 ifneq ($(ARCH), ARM)
61 # ARM's shared libgcc omits several of the __sync functions that are
62 # present in the static libgcc, so we also link in the static gcc. This
63 # is described at http://gcc.gnu.org/PR40133.
64 LLVMLibsOptions += -lgcc
65 endif
66 endif
2727 CPP.Flags += $(NO_VARIADIC_MACROS)
2828 TESTLIBS = -lGoogleTest -lUnitTestMain
2929
30 ifeq ($(ENABLE_SHARED), 1)
31 # Add the absolute path to the dynamic library. This is ok because
32 # we'll never install unittests.
33 LD.Flags += $(RPATH) -Wl,$(LibDir)
34 endif
35 ifeq ($(ENABLE_SHARED), 1)
36 # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
37 # of the time.
38 Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
39 endif
40
3041 $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
3142 $(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
3243 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
3748 all:: $(LLVMUnitTestExe)
3849
3950 unitcheck:: $(LLVMUnitTestExe)
40 $(LLVMUnitTestExe)
51 $(Run.Shared) $(LLVMUnitTestExe)
4152
4253 endif