listout updated this revision to Diff 451459.
listout added a comment.

Fix missing '+'


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131563/new/

https://reviews.llvm.org/D131563

Files:
  clang/lib/Driver/ToolChains/Linux.cpp


Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -46,6 +46,8 @@
   bool IsMipsR6 = TargetTriple.getSubArch() == llvm::Triple::MipsSubArch_r6;
   bool IsMipsN32Abi = TargetTriple.getEnvironment() == llvm::Triple::GNUABIN32;
 
+  std::string EnvName = TargetTriple.isMusl() ? "musl" : "gnu";
+
   // For most architectures, just use whatever we have rather than trying to be
   // clever.
   switch (TargetTriple.getArch()) {
@@ -61,35 +63,35 @@
     if (IsAndroid)
       return "arm-linux-androideabi";
     if (TargetEnvironment == llvm::Triple::GNUEABIHF)
-      return "arm-linux-gnueabihf";
-    return "arm-linux-gnueabi";
+      return "arm-linux-" + EnvName;
+    return "arm-linux-" + EnvName;
   case llvm::Triple::armeb:
   case llvm::Triple::thumbeb:
     if (TargetEnvironment == llvm::Triple::GNUEABIHF)
-      return "armeb-linux-gnueabihf";
-    return "armeb-linux-gnueabi";
+      return "armeb-linux-" + EnvName;
+    return "armeb-linux-" + EnvName;
   case llvm::Triple::x86:
     if (IsAndroid)
       return "i686-linux-android";
-    return "i386-linux-gnu";
+    return "i386-linux" + EnvName;
   case llvm::Triple::x86_64:
     if (IsAndroid)
       return "x86_64-linux-android";
     if (TargetEnvironment == llvm::Triple::GNUX32)
       return "x86_64-linux-gnux32";
-    return "x86_64-linux-gnu";
+    return "x86_64-linux-" + EnvName;
   case llvm::Triple::aarch64:
     if (IsAndroid)
       return "aarch64-linux-android";
-    return "aarch64-linux-gnu";
+    return "aarch64-linux-" + EnvName;
   case llvm::Triple::aarch64_be:
-    return "aarch64_be-linux-gnu";
+    return "aarch64_be-linux-" + EnvName;
 
   case llvm::Triple::m68k:
     return "m68k-linux-gnu";
 
   case llvm::Triple::mips:
-    return IsMipsR6 ? "mipsisa32r6-linux-gnu" : "mips-linux-gnu";
+    return IsMipsR6 ? "mipsisa32r6-linux-gnu" : "mips-linux-" + EnvName;
   case llvm::Triple::mipsel:
     if (IsAndroid)
       return "mipsel-linux-android";
@@ -119,13 +121,13 @@
       return "powerpc-linux-gnuspe";
     return "powerpc-linux-gnu";
   case llvm::Triple::ppcle:
-    return "powerpcle-linux-gnu";
+    return "powerpcle-linux-" + EnvName;
   case llvm::Triple::ppc64:
-    return "powerpc64-linux-gnu";
+    return "powerpc64-linux-" + EnvName;
   case llvm::Triple::ppc64le:
-    return "powerpc64le-linux-gnu";
+    return "powerpc64le-linux-" + EnvName;
   case llvm::Triple::riscv64:
-    return "riscv64-linux-gnu";
+    return "riscv64-linux-" + EnvName;
   case llvm::Triple::sparc:
     return "sparc-linux-gnu";
   case llvm::Triple::sparcv9:


Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -46,6 +46,8 @@
   bool IsMipsR6 = TargetTriple.getSubArch() == llvm::Triple::MipsSubArch_r6;
   bool IsMipsN32Abi = TargetTriple.getEnvironment() == llvm::Triple::GNUABIN32;
 
+  std::string EnvName = TargetTriple.isMusl() ? "musl" : "gnu";
+
   // For most architectures, just use whatever we have rather than trying to be
   // clever.
   switch (TargetTriple.getArch()) {
@@ -61,35 +63,35 @@
     if (IsAndroid)
       return "arm-linux-androideabi";
     if (TargetEnvironment == llvm::Triple::GNUEABIHF)
-      return "arm-linux-gnueabihf";
-    return "arm-linux-gnueabi";
+      return "arm-linux-" + EnvName;
+    return "arm-linux-" + EnvName;
   case llvm::Triple::armeb:
   case llvm::Triple::thumbeb:
     if (TargetEnvironment == llvm::Triple::GNUEABIHF)
-      return "armeb-linux-gnueabihf";
-    return "armeb-linux-gnueabi";
+      return "armeb-linux-" + EnvName;
+    return "armeb-linux-" + EnvName;
   case llvm::Triple::x86:
     if (IsAndroid)
       return "i686-linux-android";
-    return "i386-linux-gnu";
+    return "i386-linux" + EnvName;
   case llvm::Triple::x86_64:
     if (IsAndroid)
       return "x86_64-linux-android";
     if (TargetEnvironment == llvm::Triple::GNUX32)
       return "x86_64-linux-gnux32";
-    return "x86_64-linux-gnu";
+    return "x86_64-linux-" + EnvName;
   case llvm::Triple::aarch64:
     if (IsAndroid)
       return "aarch64-linux-android";
-    return "aarch64-linux-gnu";
+    return "aarch64-linux-" + EnvName;
   case llvm::Triple::aarch64_be:
-    return "aarch64_be-linux-gnu";
+    return "aarch64_be-linux-" + EnvName;
 
   case llvm::Triple::m68k:
     return "m68k-linux-gnu";
 
   case llvm::Triple::mips:
-    return IsMipsR6 ? "mipsisa32r6-linux-gnu" : "mips-linux-gnu";
+    return IsMipsR6 ? "mipsisa32r6-linux-gnu" : "mips-linux-" + EnvName;
   case llvm::Triple::mipsel:
     if (IsAndroid)
       return "mipsel-linux-android";
@@ -119,13 +121,13 @@
       return "powerpc-linux-gnuspe";
     return "powerpc-linux-gnu";
   case llvm::Triple::ppcle:
-    return "powerpcle-linux-gnu";
+    return "powerpcle-linux-" + EnvName;
   case llvm::Triple::ppc64:
-    return "powerpc64-linux-gnu";
+    return "powerpc64-linux-" + EnvName;
   case llvm::Triple::ppc64le:
-    return "powerpc64le-linux-gnu";
+    return "powerpc64le-linux-" + EnvName;
   case llvm::Triple::riscv64:
-    return "riscv64-linux-gnu";
+    return "riscv64-linux-" + EnvName;
   case llvm::Triple::sparc:
     return "sparc-linux-gnu";
   case llvm::Triple::sparcv9:
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to