From 931878d99f452a7e99898479ce99364eb88afa7f Mon Sep 17 00:00:00 2001 From: Tim Shen Date: Tue, 4 Sep 2018 22:20:11 +0000 Subject: [PATCH] Revert r341373, since it fails on some targets. Differential Revision: https://reviews.llvm.org/D51354 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341418 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/ToolChain.h | 3 --- lib/Driver/Driver.cpp | 15 ++++++++------- lib/Driver/ToolChains/Linux.cpp | 9 +++++---- test/Driver/print-multi-directory.c | 28 ---------------------------- 4 files changed, 13 insertions(+), 42 deletions(-) delete mode 100644 test/Driver/print-multi-directory.c diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h index 36c0e92939..1395134f40 100644 --- a/include/clang/Driver/ToolChain.h +++ b/include/clang/Driver/ToolChain.h @@ -149,7 +149,6 @@ private: protected: MultilibSet Multilibs; - Multilib SelectedMultilib; ToolChain(const Driver &D, const llvm::Triple &T, const llvm::opt::ArgList &Args); @@ -228,8 +227,6 @@ public: const MultilibSet &getMultilibs() const { return Multilibs; } - const Multilib &getMultilib() const { return SelectedMultilib; } - const SanitizerArgs& getSanitizerArgs() const; const XRayArgs& getXRayArgs() const; diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 14cfc48c8f..6527c19b61 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1661,13 +1661,14 @@ bool Driver::HandleImmediateArgs(const Compilation &C) { } if (C.getArgs().hasArg(options::OPT_print_multi_directory)) { - const Multilib &Multilib = TC.getMultilib(); - if (Multilib.gccSuffix().empty()) - llvm::outs() << ".\n"; - else { - StringRef Suffix(Multilib.gccSuffix()); - assert(Suffix.front() == '/'); - llvm::outs() << Suffix.substr(1) << "\n"; + for (const Multilib &Multilib : TC.getMultilibs()) { + if (Multilib.gccSuffix().empty()) + llvm::outs() << ".\n"; + else { + StringRef Suffix(Multilib.gccSuffix()); + assert(Suffix.front() == '/'); + llvm::outs() << Suffix.substr(1) << "\n"; + } } return false; } diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp index d8786817ec..4e4317076f 100644 --- a/lib/Driver/ToolChains/Linux.cpp +++ b/lib/Driver/ToolChains/Linux.cpp @@ -210,7 +210,6 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : Generic_ELF(D, Triple, Args) { GCCInstallation.init(Triple, Args); Multilibs = GCCInstallation.getMultilibs(); - SelectedMultilib = GCCInstallation.getMultilib(); llvm::Triple::ArchType Arch = Triple.getArch(); std::string SysRoot = computeSysRoot(); @@ -300,14 +299,16 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) if (GCCInstallation.isValid()) { const llvm::Triple &GCCTriple = GCCInstallation.getTriple(); const std::string &LibPath = GCCInstallation.getParentLibPath(); + const Multilib &Multilib = GCCInstallation.getMultilib(); + const MultilibSet &Multilibs = GCCInstallation.getMultilibs(); // Add toolchain / multilib specific file paths. - addMultilibsFilePaths(D, Multilibs, SelectedMultilib, + addMultilibsFilePaths(D, Multilibs, Multilib, GCCInstallation.getInstallPath(), Paths); // Sourcery CodeBench MIPS toolchain holds some libraries under // a biarch-like suffix of the GCC installation. - addPathIfExists(D, GCCInstallation.getInstallPath() + SelectedMultilib.gccSuffix(), + addPathIfExists(D, GCCInstallation.getInstallPath() + Multilib.gccSuffix(), Paths); // GCC cross compiling toolchains will install target libraries which ship @@ -329,7 +330,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) // Note that this matches the GCC behavior. See the below comment for where // Clang diverges from GCC's behavior. addPathIfExists(D, LibPath + "/../" + GCCTriple.str() + "/lib/../" + - OSLibDir + SelectedMultilib.osSuffix(), + OSLibDir + Multilib.osSuffix(), Paths); // If the GCC installation we found is inside of the sysroot, we want to diff --git a/test/Driver/print-multi-directory.c b/test/Driver/print-multi-directory.c deleted file mode 100644 index 1d1baf3b9b..0000000000 --- a/test/Driver/print-multi-directory.c +++ /dev/null @@ -1,28 +0,0 @@ -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target i386-none-linux \ -// RUN: -print-multi-directory \ -// RUN: | FileCheck --check-prefix=CHECK-X86-MULTILIBS %s - -// CHECK-X86-MULTILIBS: 32 -// CHECK-X86-MULTILIBS-NOT: x32 -// CHECK-X86-MULTILIBS-NOT: . - -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target i386-none-linux -m64 \ -// RUN: -print-multi-directory \ -// RUN: | FileCheck --check-prefix=CHECK-X86_64-MULTILIBS %s - -// CHECK-X86_64-MULTILIBS: . -// CHECK-X86_64-MULTILIBS-NOT: x32 -// CHECK-X86_64-MULTILIBS-NOT: 32 - -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ -// RUN: -mthumb \ -// RUN: -B%S/Inputs/basic_android_ndk_tree \ -// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ -// RUN: -print-multi-directory \ -// RUN: | FileCheck --check-prefix=CHECK-ARM-MULTILIBS %s - -// CHECK-ARM-MULTILIBS: thumb -// CHECK-ARM-MULTILIBS-NOT: . -- 2.40.0