passes the -module option on the libtool command line to ensure that the
shared library being built can be dlopened and dlsym can work on that
module. LOADABLE_MODULE should be sent only in conjunction with the
SHARED_LIBRARY directive. It should generally be used for any module that
is intended to be the target of an LLVM -load option. Note that loadable
modules will not have the lib prefix but otherwise look like shared
libraries. This is per the libtool recommendations and prevents these
special shared libraries from being linked in via -l option to the linker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19454
91177308-0d34-0410-b5e6-
96231b3b80d8
# Adjust to user's request
#--------------------------------------------------------------------
# Adjust to user's request
#--------------------------------------------------------------------
-# Adjust LIBTOOL flags for shared libraries, or not.
-ifndef SHARED_LIBRARY
- LibTool.Flags += --tag=disable-shared
-else
+# Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
+# to be built. Note that if LOADABLE_MODULE is specified then the resulting
+# shared library can be opened with dlopen
+ifdef SHARED_LIBRARY
LD.Flags += -rpath $(LibDir)
LD.Flags += -rpath $(LibDir)
+ ifdef LOADABLE_MODULE
+ LD.Flags += -module
+ endif
+else
+ LibTool.Flags += --tag=disable-shared
# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
LIBRARYNAME := $(strip $(LIBRARYNAME))
# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
LIBRARYNAME := $(strip $(LIBRARYNAME))
+ifdef LOADABLE_MODULE
+LibName.LA := $(LibDir)/$(LIBRARYNAME).la
+else
LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
LibName.O := $(LibDir)/$(LIBRARYNAME).o
LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
LibName.O := $(LibDir)/$(LIBRARYNAME).o
LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca