llvm.org GIT mirror llvm / 2373c99
Add --enable-llvmc-dynamic configure option. Controls whether libCompilerDriver should be loaded dynamically. By default this is needed only on Win32, to make dynamic plugins work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74759 91177308-0d34-0410-b5e6-96231b3b80d8 Mikhail Glushenkov 10 years ago
4 changed file(s) with 52 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
296296
297297 # Location of the plugin header file for gold.
298298 BINUTILS_INCDIR := @BINUTILS_INCDIR@
299
300 # When ENABLE_LLVMC_DYNAMIC is enabled, LLVMC will link libCompilerDriver
301 # dynamically. This is needed to make dynamic plugins work on some targets
302 # (Windows).
303 ENABLE_LLVMC_DYNAMIC = 0
304 #@ENABLE_LLVMC_DYNAMIC@
199199 LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN))
200200 CPP.Flags += -DLLVMC_PLUGIN_NAME=$(LLVMC_PLUGIN)
201201 REQUIRES_EH := 1
202 LD.Flags += -lCompilerDriver
202
203 ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
204 LD.Flags += -lCompilerDriver
205 endif
203206
204207 # Build a dynamic library if the user runs `make` directly from the plugin
205208 # directory.
206209 ifndef LLVMC_BUILTIN_PLUGIN
207 LOADABLE_MODULE = 1
210 LOADABLE_MODULE = 1
208211 endif
209212
210213 # TableGen stuff...
211214 ifneq ($(BUILT_SOURCES),)
212 LLVMC_BUILD_AUTOGENERATED_INC=1
215 LLVMC_BUILD_AUTOGENERATED_INC=1
213216 endif
214217
215218 endif # LLVMC_PLUGIN
217220 ifdef LLVMC_BASED_DRIVER
218221
219222 TOOLNAME = $(LLVMC_BASED_DRIVER)
223
220224 REQUIRES_EH := 1
221 LD.Flags += -lCompilerDriver
225
226 ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
227 LD.Flags += -lCompilerDriver
228 else
229 LLVMLIBS = CompilerDriver.a
230 LINK_COMPONENTS = support system
231 endif
222232
223233 # Preprocessor magic that generates references to static variables in built-in
224234 # plugins.
501511 else
502512 ifeq ($(OS),Cygwin)
503513 SharedLinkOptions=-shared -nostdlib -Wl,--export-all-symbols \
504 -Wl,--enable-auto-import -Wl,--enable-auto-image-base \
505 -Wl,--enable-runtime-pseudo-relocs
514 -Wl,--enable-auto-import -Wl,--enable-auto-image-base
506515 else
507516 SharedLinkOptions=-shared
508517 endif
592592 *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;;
593593 esac
594594
595 dnl Only Windows needs dynamic libCompilerDriver to support plugins.
596 if test "$llvm_cv_os_type" = "Win32" ; then
597 llvmc_dynamic="yes"
598 else
599 llvmc_dynamic="no"
600 fi
601
602 dnl --enable-llvmc-dynamic : should LLVMC link libCompilerDriver dynamically?
603 AC_ARG_ENABLE(llvmc-dynamic,AS_HELP_STRING(
604 --enable-llvmc-dynamic,
605 [Link LLVMC dynamically (default is NO, unless on Win32)]),,
606 enableval=$llvmc_dynamic)
607 if test ${enableval} = "no"; then
608 AC_SUBST(ENABLE_LLVMC_DYNAMIC,[[]])
609 else
610 AC_SUBST(ENABLE_LLVMC_DYNAMIC,[[ENABLE_LLVMC_DYNAMIC=1]])
611 fi
612
595613 dnl===-----------------------------------------------------------------------===
596614 dnl===
597615 dnl=== SECTION 4: Check for programs we need and that they are the right version
1111 # We don't want this library to appear in `llvm-config --libs` output, so its
1212 # name doesn't start with "LLVM".
1313
14 LIBRARYNAME = libCompilerDriver
15 LLVMLIBS = LLVMSupport.a LLVMSystem.a
16 LOADABLE_MODULE := 1
14 ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
15 LIBRARYNAME = libCompilerDriver
16 LLVMLIBS = LLVMSupport.a LLVMSystem.a
17 LOADABLE_MODULE := 1
18 else
19 LIBRARYNAME = CompilerDriver
20 LINK_COMPONENTS = support system
21 endif
22
1723 REQUIRES_EH := 1
1824
1925 include $(LEVEL)/Makefile.common
26
27 # Copy libCompilerDriver to the bin dir so that llvmc can find it.
28 ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
2029
2130 FullLibName = $(LIBRARYNAME)$(SHLIBEXT)
2231
2332 all-local:: $(ToolDir)/$(FullLibName)
2433
25 # Copy the library to the bin dir so that llvmc can find it.
2634 $(ToolDir)/$(FullLibName): $(LibDir)/$(FullLibName) $(ToolDir)/.dir
2735 $(Echo) Copying $(BuildMode) Shared Library $(FullLibName) to $@
2836 -$(Verb) $(CP) $< $@
3139 $(Echo) Removing $(BuildMode) Shared Library $(FullLibName) \
3240 from $(ToolDir)
3341 -$(Verb) $(RM) -f $(ToolDir)/$(FullLibName)
42 endif