diff --git a/linker/linker.cpp b/linker/linker.cpp index f7dbdf072..77642e7cc 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -163,6 +163,14 @@ static bool is_system_library(const std::string& realpath) { } // TODO(dimitry): This is workaround for http://b/26394120 - it will be removed before the release +#if defined(__LP64__) +static const char* const kSystemLibDir = "/system/lib64"; +#else +static const char* const kSystemLibDir = "/system/lib"; +#endif + +static std::string dirname(const char *path); + static bool is_greylisted(const char* name, const soinfo* needed_by) { static const char* const kLibraryGreyList[] = { "libandroid_runtime.so", @@ -191,6 +199,12 @@ static bool is_greylisted(const char* name, const soinfo* needed_by) { return true; } + // if this is an absolute path - make sure it points to /system/lib(64) + if (name[0] == '/' && dirname(name) == kSystemLibDir) { + // and reduce the path to basename + name = basename(name); + } + for (size_t i = 0; kLibraryGreyList[i] != nullptr; ++i) { if (strcmp(name, kLibraryGreyList[i]) == 0) { return true;