[llvm-commits] [patch] Use $ORIGIN it the rpath of libraries on non-darwin hosts

Rafael Espindola espindola at google.com
Sat May 15 19:50:10 PDT 2010


Right now we use $ORIGIN on the rpath when linking tools, but not when
linking libraries. This affects the gold plugin that links with
libLTO.so. With this path we use $ORIGIN for both. This makes it
possible to move plugin and libLTO.so to any directory and it will
work. Right now one has to use LD_LIBRARY_PATH.

Cheers,
-- 
Rafael Ávila de Espíndola
-------------- next part --------------
diff --git a/Makefile.rules b/Makefile.rules
index d77fe27..2fc5eeb 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -589,10 +589,14 @@ ifeq ($(TARGET_OS),Darwin)
 endif
 
 ifdef SHARED_LIBRARY
+ifneq ($(HOST_OS),Darwin)
+  LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
+else
 ifneq ($(DARWIN_MAJVERS),4)
   LD.Flags += $(RPATH) -Wl,$(LibDir)
 endif
 endif
+endif
 
 ifdef TOOL_VERBOSE
   C.Flags += -v


More information about the llvm-commits mailing list