r269412 - Simplify getLinuxDynamicLinker() by using a common variable for the triple. NFC.
Vasileios Kalintiris via cfe-commits
cfe-commits at lists.llvm.org
Fri May 13 05:34:14 PDT 2016
Author: vkalintiris
Date: Fri May 13 07:34:14 2016
New Revision: 269412
URL: http://llvm.org/viewvc/llvm-project?rev=269412&view=rev
Log:
Simplify getLinuxDynamicLinker() by using a common variable for the triple. NFC.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=269412&r1=269411&r2=269412&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 13 07:34:14 2016
@@ -8957,9 +8957,10 @@ static void AddLibgcc(const llvm::Triple
static std::string getLinuxDynamicLinker(const ArgList &Args,
const toolchains::Linux &ToolChain) {
const llvm::Triple::ArchType Arch = ToolChain.getArch();
+ const llvm::Triple &Triple = ToolChain.getTriple();
- if (ToolChain.getTriple().isAndroid()) {
- if (ToolChain.getTriple().isArch64Bit())
+ if (Triple.isAndroid()) {
+ if (Triple.isArch64Bit())
return "/system/bin/linker64";
else
return "/system/bin/linker";
@@ -8971,31 +8972,29 @@ static std::string getLinuxDynamicLinker
else if (Arch == llvm::Triple::aarch64_be)
return "/lib/ld-linux-aarch64_be.so.1";
else if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
- if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
+ if (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
arm::getARMFloatABI(ToolChain, Args) == arm::FloatABI::Hard)
return "/lib/ld-linux-armhf.so.3";
else
return "/lib/ld-linux.so.3";
} else if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb) {
// TODO: check which dynamic linker name.
- if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
+ if (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
arm::getARMFloatABI(ToolChain, Args) == arm::FloatABI::Hard)
return "/lib/ld-linux-armhf.so.3";
else
return "/lib/ld-linux.so.3";
} else if (Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel ||
Arch == llvm::Triple::mips64 || Arch == llvm::Triple::mips64el) {
- std::string LibDir =
- "/lib" + mips::getMipsABILibSuffix(Args, ToolChain.getTriple());
+ std::string LibDir = "/lib" + mips::getMipsABILibSuffix(Args, Triple);
StringRef LibName;
- bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple());
+ bool IsNaN2008 = mips::isNaN2008(Args, Triple);
if (mips::isUCLibc(Args))
LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0";
- else if (!ToolChain.getTriple().hasEnvironment() &&
- ToolChain.getTriple().getVendor() ==
- llvm::Triple::VendorType::MipsTechnologies) {
- bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) ||
- (ToolChain.getTriple().getArch() == llvm::Triple::mips64el);
+ else if (!Triple.hasEnvironment() &&
+ Triple.getVendor() == llvm::Triple::VendorType::MipsTechnologies) {
+ bool LE = (Triple.getArch() == llvm::Triple::mipsel) ||
+ (Triple.getArch() == llvm::Triple::mips64el);
LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1";
} else
LibName = IsNaN2008 ? "ld-linux-mipsn8.so.1" : "ld.so.1";
@@ -9016,7 +9015,7 @@ static std::string getLinuxDynamicLinker
else if (Arch == llvm::Triple::sparcv9)
return "/lib64/ld-linux.so.2";
else if (Arch == llvm::Triple::x86_64 &&
- ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32)
+ Triple.getEnvironment() == llvm::Triple::GNUX32)
return "/libx32/ld-linux-x32.so.2";
else
return "/lib64/ld-linux-x86-64.so.2";
More information about the cfe-commits
mailing list