summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-10-21 17:45:04 -0700
committerDan Willemsen <dwillemsen@google.com>2018-10-22 15:55:56 -0700
commit5038ef6748d6ef70537e616201bb68b287a55a76 (patch)
tree8507e8070ad5c28aa259fd8b1faa1e0b98319c3c /linker/linker.cpp
parenta8a716e42a8e6b8f28abf2b2f8f93b1e8579423d (diff)
Workaround host bionic libs that are missing DT_RUNPATH
We don't have a host bionic version of libclang_rt.asan-x86_64-android.so, so I'm using the android version, which can't load liblog.so, since it's missing DT_RUNPATH that would normally load liblog.so from a relative path to the .so. Bug: 118058804 Test: run ASAN host_bionic Change-Id: I58badcd5ed35bd1c7b786b4f1e2367a1011ff08d
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index b605ed9ff..f085863ad 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1318,6 +1318,15 @@ static bool load_library(android_namespace_t* ns,
}
}
+#if !defined(__ANDROID__)
+ // Bionic on the host currently uses some Android prebuilts, which don't set
+ // DT_RUNPATH with any relative paths, so they can't find their dependencies.
+ // b/118058804
+ if (si->get_dt_runpath().empty()) {
+ si->set_dt_runpath("$ORIGIN/../lib64:$ORIGIN/lib64");
+ }
+#endif
+
for_each_dt_needed(task->get_elf_reader(), [&](const char* name) {
load_tasks->push_back(LoadTask::create(name, si, ns, task->get_readers_map()));
});