Merge "Rework the linker_wrapper to work with lld"
diff --git a/libc/arch-common/bionic/crtbrand.S b/libc/arch-common/bionic/crtbrand.S
index 4b4f99c..34d6480 100644
--- a/libc/arch-common/bionic/crtbrand.S
+++ b/libc/arch-common/bionic/crtbrand.S
@@ -33,7 +33,12 @@
.long 2f-1f // int32_t namesz
.long 3f-2f // int32_t descsz
.long 1 // int32_t type
+#ifdef __ANDROID__
1:.ascii "Android\0" // char name[]
2:.long PLATFORM_SDK_VERSION // int32_t android_api
+#else
+1:.ascii "LinuxBionic\0" // char name[]
+2:
+#endif
3:
.size abitag, .-abitag
diff --git a/linker/linker.cpp b/linker/linker.cpp
index b605ed9..f085863 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1318,6 +1318,15 @@
}
}
+#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()));
});