summaryrefslogblamecommitdiff
path: root/system/clang/clang-0004-Add-musl-targets.patch
blob: d77294980e877defafc905c77fe018ca8ce4075c (plain) (tree)



















































































































                                                                        
From: Natanael Copa <ncopa@alpinelinux.org>
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Add musl targets

--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1644,7 +1644,8 @@
   case llvm::Triple::arm:
   case llvm::Triple::thumb:
     LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-    if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
+    if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+        TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
       TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
     } else {
       TripleAliases.append(begin(ARMTriples), end(ARMTriples));
@@ -1653,7 +1654,8 @@
   case llvm::Triple::armeb:
   case llvm::Triple::thumbeb:
     LibDirs.append(begin(ARMebLibDirs), end(ARMebLibDirs));
-    if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
+    if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+        TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
       TripleAliases.append(begin(ARMebHFTriples), end(ARMebHFTriples));
     } else {
       TripleAliases.append(begin(ARMebTriples), end(ARMebTriples));
@@ -3956,7 +3958,8 @@
   // regardless of what the actual target triple is.
   case llvm::Triple::arm:
   case llvm::Triple::thumb:
-    if (TargetEnvironment == llvm::Triple::GNUEABIHF) {
+    if (TargetEnvironment == llvm::Triple::GNUEABIHF ||
+        TargetEnvironment == llvm::Triple::MuslEABIHF) {
       if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabihf"))
         return "arm-linux-gnueabihf";
     } else {
@@ -3966,7 +3969,8 @@
     break;
   case llvm::Triple::armeb:
   case llvm::Triple::thumbeb:
-    if (TargetEnvironment == llvm::Triple::GNUEABIHF) {
+    if (TargetEnvironment == llvm::Triple::GNUEABIHF ||
+        TargetEnvironment == llvm::Triple::MuslEABIHF) {
       if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabihf"))
         return "armeb-linux-gnueabihf";
     } else {
@@ -4334,6 +4338,12 @@
       ArchName = "armeb";
       IsArm = true;
       break;
+    case llvm::Triple::ppc:
+      ArchName = "powerpc";
+      break;
+    case llvm::Triple::x86:
+      ArchName = "i386";
+      break;
     default:
       ArchName = Triple.getArchName().str();
     }
@@ -4544,7 +4554,8 @@
     break;
   case llvm::Triple::arm:
   case llvm::Triple::thumb:
-    if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+    if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
+        getTriple().getEnvironment() == llvm::Triple::MuslEABIHF)
       MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs;
     else
       MultiarchIncludeDirs = ARMMultiarchIncludeDirs;

--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -953,6 +953,7 @@
     case llvm::Triple::FreeBSD:
       switch (Triple.getEnvironment()) {
       case llvm::Triple::GNUEABIHF:
+      case llvm::Triple::MuslEABIHF:
         ABI = FloatABI::Hard;
         break;
       default:
@@ -9198,6 +9200,8 @@
     switch (getToolChain().getTriple().getEnvironment()) {
     case llvm::Triple::GNUEABIHF:
     case llvm::Triple::GNUEABI:
+    case llvm::Triple::MuslEABIHF:
+    case llvm::Triple::MuslEABI:
     case llvm::Triple::EABI:
       CmdArgs.push_back("-meabi=5");
       break;
@@ -9541,10 +9545,12 @@
     switch (getToolChain().getTriple().getEnvironment()) {
     case llvm::Triple::EABI:
     case llvm::Triple::GNUEABI:
+    case llvm::Triple::MuslEABI:
       CmdArgs.push_back("armelf_nbsd_eabi");
       break;
     case llvm::Triple::EABIHF:
     case llvm::Triple::GNUEABIHF:
+    case llvm::Triple::MuslEABIHF:
       CmdArgs.push_back("armelf_nbsd_eabihf");
       break;
     default:
@@ -9559,10 +9565,12 @@
     switch (getToolChain().getTriple().getEnvironment()) {
     case llvm::Triple::EABI:
     case llvm::Triple::GNUEABI:
+    case llvm::Triple::MuslEABI:
       CmdArgs.push_back("armelfb_nbsd_eabi");
       break;
     case llvm::Triple::EABIHF:
     case llvm::Triple::GNUEABIHF:
+    case llvm::Triple::MuslEABIHF:
       CmdArgs.push_back("armelfb_nbsd_eabihf");
       break;
     default: