From a9127817f4ceb0f19e99c89c08ffb1d9d256d1a2 Mon Sep 17 00:00:00 2001 From: Oleksandr Ocheretnyi Date: Wed, 15 Apr 2020 00:08:39 +0300 Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso path * the dyld-prefix shall be taken into account when the default path for the dynamic linker has to be checked. * this patch shall be used as annex to the next patch: 'clang: driver: Check sysroot for ldso path' which includes the usrmerge scenario. Upstream-Status: Pending Signed-off-by: Oleksandr Ocheretnyi Signed-off-by: Khem Raj --- clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index c68a842b45e0..ca9f5f2e4f74 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -518,8 +518,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { LibDir = "lib64"; Loader = (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; - if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && - getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { + if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && + getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { LibDir = "lib"; } break; @@ -527,8 +527,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { LibDir = "lib64"; Loader = (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; - if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && - getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { + if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && + getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { LibDir = "lib"; } break; @@ -552,8 +552,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { case llvm::Triple::sparcv9: LibDir = "lib64"; Loader = "ld-linux.so.2"; - if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && - getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { + if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && + getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { LibDir = "lib"; } break; @@ -570,8 +570,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { LibDir = X32 ? "libx32" : "lib64"; Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; - if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && - getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { + if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && + getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { LibDir = "lib"; } break;