r341373 - Fix the -print-multi-directory flag to print the selected multilib.

Christian BRUEL via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 4 23:12:53 PDT 2018


Oh, yes,  sure

Best Regards

Christian


On 09/05/2018 12:05 AM, Richard Smith wrote:
This is breaking buildbots:

http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/19509

Can you take a look? Thanks!

On Tue, 4 Sep 2018 at 08:36, Christian Bruel via cfe-commits <cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>> wrote:
Author: chrib
Date: Tue Sep  4 08:22:13 2018
New Revision: 341373

URL: http://llvm.org/viewvc/llvm-project?rev=341373&view=rev
Log:
Fix the -print-multi-directory flag to print the selected multilib.

Summary: Fix -print-multi-directory to print the selected multilib

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: srhines, cfe-commits

Differential Revision: https://reviews.llvm.org/D51354

Added:
    cfe/trunk/test/Driver/print-multi-directory.c
Modified:
    cfe/trunk/include/clang/Driver/ToolChain.h
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/ToolChains/Linux.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=341373&r1=341372&r2=341373&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Sep  4 08:22:13 2018
@@ -149,6 +149,7 @@ private:

 protected:
   MultilibSet Multilibs;
+  Multilib SelectedMultilib;

   ToolChain(const Driver &D, const llvm::Triple &T,
             const llvm::opt::ArgList &Args);
@@ -227,6 +228,8 @@ public:

   const MultilibSet &getMultilibs() const { return Multilibs; }

+  const Multilib &getMultilib() const { return SelectedMultilib; }
+
   const SanitizerArgs& getSanitizerArgs() const;

   const XRayArgs& getXRayArgs() const;

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=341373&r1=341372&r2=341373&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Sep  4 08:22:13 2018
@@ -1661,14 +1661,13 @@ bool Driver::HandleImmediateArgs(const C
   }

   if (C.getArgs().hasArg(options::OPT_print_multi_directory)) {
-    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";
-      }
+    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";
     }
     return false;
   }

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=341373&r1=341372&r2=341373&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Tue Sep  4 08:22:13 2018
@@ -210,6 +210,7 @@ Linux::Linux(const Driver &D, const llvm
     : 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();

@@ -299,16 +300,14 @@ Linux::Linux(const Driver &D, const llvm
   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, Multilib,
+    addMultilibsFilePaths(D, Multilibs, SelectedMultilib,
                           GCCInstallation.getInstallPath(), Paths);

     // Sourcery CodeBench MIPS toolchain holds some libraries under
     // a biarch-like suffix of the GCC installation.
-    addPathIfExists(D, GCCInstallation.getInstallPath() + Multilib.gccSuffix(),
+    addPathIfExists(D, GCCInstallation.getInstallPath() + SelectedMultilib.gccSuffix(),
                     Paths);

     // GCC cross compiling toolchains will install target libraries which ship
@@ -330,7 +329,7 @@ Linux::Linux(const Driver &D, const llvm
     // 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 + Multilib.osSuffix(),
+                           OSLibDir + SelectedMultilib.osSuffix(),
                     Paths);

     // If the GCC installation we found is inside of the sysroot, we want to

Added: cfe/trunk/test/Driver/print-multi-directory.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-multi-directory.c?rev=341373&view=auto
==============================================================================
--- cfe/trunk/test/Driver/print-multi-directory.c (added)
+++ cfe/trunk/test/Driver/print-multi-directory.c Tue Sep  4 08:22:13 2018
@@ -0,0 +1,28 @@
+// 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:  .


_______________________________________________
cfe-commits mailing list
cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180905/3ab3f621/attachment-0001.html>


More information about the cfe-commits mailing list