[PATCH] Use correct dylib ID in Darwin loadable modules

Lawrence Velázquez vq at larryv.me
Sun Dec 7 19:23:07 PST 2014


Even though loadable modules are not named using the shared-library
prefix (e.g., "lib"), their dylib IDs currently contain the prefix
anyway. Thus "LLVMPolly.dylib" is installed with an ID of
"@rpath/libLLVMPolly.dylib". After this change, its ID would be
"@rpath/LLVMPolly.dylib", as expected.
---
 Makefile.rules | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Makefile.rules b/Makefile.rules
index c8c971f..5ad7474 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -598,7 +598,12 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
 ifneq ($(HOST_OS),Darwin)
   LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
 else
-  LD.Flags += -Wl,-install_name  -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
+  LD.Flags += -Wl,-install_name
+  ifdef LOADABLE_MODULE
+    LD.Flags += -Wl,"@rpath/$(LIBRARYNAME)$(SHLIBEXT)"
+  else
+    LD.Flags += -Wl,"@rpath/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)"
+  endif
 endif
 endif
 endif
-- 
2.2.0




More information about the llvm-commits mailing list