summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-01-11 04:31:07 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-01-11 04:31:07 +0000
commit87e645c5bd3086c4efab0562e196a13eac732557 (patch)
tree1c0b2c17e32268b0aa256fcfda28eece4f317204
parenta86fa4455b22e4633118a6e4b5b0aa4c3dc9f24c (diff)
downloadbcm5719-llvm-87e645c5bd3086c4efab0562e196a13eac732557.tar.gz
bcm5719-llvm-87e645c5bd3086c4efab0562e196a13eac732557.zip
Implement the LOADABLE_MODULE option when building a shared library. This
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. llvm-svn: 19454
-rw-r--r--llvm/Makefile.rules17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/Makefile.rules b/llvm/Makefile.rules
index d6ed2d53161..7badbddd762 100644
--- a/llvm/Makefile.rules
+++ b/llvm/Makefile.rules
@@ -264,11 +264,16 @@ LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
# 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)
+ ifdef LOADABLE_MODULE
+ LD.Flags += -module
+ endif
+else
+ LibTool.Flags += --tag=disable-shared
endif
ifdef TOOL_VERBOSE
@@ -571,7 +576,11 @@ ifdef 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
+endif
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
LibName.O := $(LibDir)/$(LIBRARYNAME).o
LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
OpenPOWER on IntegriCloud