summaryrefslogtreecommitdiffstats
path: root/core/combo/HOST_darwin-x86.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2012-02-01 13:18:20 -0800
committerYing Wang <wangying@google.com>2012-02-01 13:20:30 -0800
commit5dea692715dfe992432037c6005f91875a725841 (patch)
tree178ff3ff29f5dd9336c44e628c46f14119eb045d /core/combo/HOST_darwin-x86.mk
parent80469e4d6c9d14a8e5942260f44e1dd83a51df74 (diff)
downloadbuild-5dea692715dfe992432037c6005f91875a725841.zip
build-5dea692715dfe992432037c6005f91875a725841.tar.gz
build-5dea692715dfe992432037c6005f91875a725841.tar.bz2
Use @rpath and @loader_path to avoid absolute path
With "-Wl,-rpath,@loader_path/../lib" the linker embeds @loader_path/../lib as the target binary's rpath. Here @loader_path means the path of the binary that initiates the loading. With "-install_name @rpath/libfoo.dylib " the linker runtime searches libfoo.dylib in the binary's embeded rpath. With this change you can call dlopen() without specifying the full path of the shared library. Change-Id: If9beb3f6f4642a377bff603bab5ba3fdb96211bf
Diffstat (limited to 'core/combo/HOST_darwin-x86.mk')
-rw-r--r--core/combo/HOST_darwin-x86.mk10
1 files changed, 3 insertions, 7 deletions
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index d0fc291..3a0a9ee 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -80,12 +80,6 @@ $(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
$(call _darwin-extract-and-include-single-whole-static-lib, $(lib)))
endef
-ifeq (,$(filter /%,$(HOST_OUT_SHARED_LIBRARIES)))
-ABP_HOST_OUT_SHARED_LIBRARIES := $(shell pwd)/$(HOST_OUT_SHARED_LIBRARIES)
-else
-ABP_HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT_SHARED_LIBRARIES)
-endif
-
define transform-host-o-to-shared-lib-inner
$(call darwin-extract-and-include-whole-static-libs)
$(hide) $(PRIVATE_CXX) \
@@ -100,13 +94,15 @@ $(hide) $(PRIVATE_CXX) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_LDLIBS) \
-o $@ \
- -install_name $(ABP_HOST_OUT_SHARED_LIBRARIES)/$(notdir $@) \
+ -install_name @rpath/$(notdir $@) \
+ -Wl,-rpath,@loader_path/../lib \
$(PRIVATE_LDFLAGS) \
$(HOST_LIBGCC)
endef
define transform-host-o-to-executable-inner
$(hide) $(PRIVATE_CXX) \
+ -Wl,-rpath,@loader_path/../lib \
-o $@ \
$(PRE_LION_DYNAMIC_LINKER_OPTIONS) -headerpad_max_install_names \
$(HOST_GLOBAL_LD_DIRS) \