about summary refs log tree commit diff homepage
path: root/runtime
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2016-02-27 00:04:47 +0100
committerMartin Nowack <martin@se.inf.tu-dresden.de>2016-03-22 08:15:59 +0100
commit5d260aa3b040af22ee248df6d8cbddb275bc080f (patch)
tree6221b0f821f237881e8445e2ff2e2b8a2a149ed2 /runtime
parent007d1ee02dae61bdb0760097a700d21968514b94 (diff)
downloadklee-5d260aa3b040af22ee248df6d8cbddb275bc080f.tar.gz
Add soname for Runtest dynamic library
Based on llvm-shlib/Makefile

SHARED_VERSION reflects the API version of the library itself
Diffstat (limited to 'runtime')
-rw-r--r--runtime/Runtest/Makefile42
1 files changed, 42 insertions, 0 deletions
diff --git a/runtime/Runtest/Makefile b/runtime/Runtest/Makefile
index dd21c4a9..666fe06d 100644
--- a/runtime/Runtest/Makefile
+++ b/runtime/Runtest/Makefile
@@ -15,5 +15,47 @@ SHARED_LIBRARY=1
 LINK_LIBS_IN_SHARED = 1
 DONT_BUILD_RELINKED = 1
 NO_PEDANTIC=1
+# Increment version appropriately if ABI/API changes, more details:
+# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN135
+SHARED_VERSION=1.0
 
 include $(LEVEL)/Makefile.common
+
+#LDFLAGS += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT)
+ifeq ($(HOST_OS),Darwin)
+    # set dylib internal version number to llvmCore submission number
+    ifdef LLVM_SUBMIT_VERSION
+        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
+                        -Wl,$(SHARED_VERSION) \
+                        -Wl,-compatibility_version -Wl,1
+    endif
+    # Include everything from the .a's into the shared library.
+    LLVMLibsOptions    := $(LLVMLibsOptions) -all_load
+    # extra options to override libtool defaults
+    LLVMLibsOptions    := $(LLVMLibsOptions)  \
+                         -Wl,-dead_strip
+
+    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
+    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
+    ifneq ($(DARWIN_VERS),8)
+       LLVMLibsOptions    := $(LLVMLibsOptions)  \
+                            -Wl,-install_name \
+                            -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
+    endif
+endif
+
+ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig))
+    # Include everything from the .a's into the shared library.
+    LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
+                       -Wl,--no-whole-archive
+endif
+
+ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD GNU))
+    # Add soname to the library.
+    LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT).$(SHARED_VERSION)
+endif
+
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
+    # Don't allow unresolved symbols.
+    LLVMLibsOptions += -Wl,--no-undefined
+endif