midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame patches/llvm_host/llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch

Lucio Andrés Illanes Albornoz (arab, vxp) 585426
From 1cec99f6d53d442d8a8c9d2ed9f4a58f8fdc6412 Mon Sep 17 00:00:00 2001
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
From: Natanael Copa <ncopa@alpinelinux.org>
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
Date: Thu, 18 Feb 2016 08:30:07 +0100
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
Subject: [PATCH 1/3] Add Musl, MuslEABI and Musl EABIHF triples
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
---
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
 include/llvm/ADT/Triple.h           | 11 +++++++++++
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
 lib/Support/Triple.cpp              |  7 +++++++
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
 lib/Target/ARM/ARMSubtarget.h       |  3 +++
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
 lib/Target/ARM/ARMTargetMachine.cpp |  2 ++
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
 4 files changed, 23 insertions(+)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
index e01db0a..2fc4fc1 100644
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
--- a/include/llvm/ADT/Triple.h
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+++ b/include/llvm/ADT/Triple.h
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -174,6 +174,10 @@ public:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     EABIHF,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     Android,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
 
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    Musl,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    MuslEABI,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    MuslEABIHF,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     MSVC,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     Itanium,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     Cygnus,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -544,6 +548,13 @@ public:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   /// Tests whether the target is Android
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   bool isAndroid() const { return getEnvironment() == Triple::Android; }
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
 
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+  /// Tests whether the target is musl libc
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+  bool isMusl() const {
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    return getEnvironment() == Triple::Musl ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+           getEnvironment() == Triple::MuslEABI ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+           getEnvironment() == Triple::MuslEABIHF;
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+  }
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   /// @}
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   /// @name Mutators
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   /// @{
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
index 11afcf7..d90a06a 100644
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
--- a/lib/Support/Triple.cpp
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+++ b/lib/Support/Triple.cpp
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -199,6 +199,9 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   case CODE16: return "code16";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   case EABI: return "eabi";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   case EABIHF: return "eabihf";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+  case Musl: return "musl";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+  case MuslEABIHF: return "muslgnueabihf";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+  case MuslEABI: return "muslgnueabi";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   case Android: return "android";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   case MSVC: return "msvc";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   case Itanium: return "itanium";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -454,6 +457,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     .StartsWith("code16", Triple::CODE16)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     .StartsWith("gnu", Triple::GNU)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     .StartsWith("android", Triple::Android)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    .StartsWith("muslgnueabihf", Triple::MuslEABIHF)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    .StartsWith("muslgnueabi", Triple::MuslEABI)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    .StartsWith("musl", Triple::Musl)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     .StartsWith("msvc", Triple::MSVC)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     .StartsWith("itanium", Triple::Itanium)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     .StartsWith("cygnus", Triple::Cygnus)
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -1431,6 +1437,7 @@ StringRef Triple::getARMCPUForArch(StringRef MArch) const {
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     switch (getEnvironment()) {
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     case llvm::Triple::EABIHF:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     case llvm::Triple::GNUEABIHF:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    case llvm::Triple::MuslEABIHF:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
       return "arm1176jzf-s";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     default:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
       return "arm7tdmi";
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
index 4d54e57..7ed7ab7 100644
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
--- a/lib/Target/ARM/ARMSubtarget.h
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+++ b/lib/Target/ARM/ARMSubtarget.h
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -405,8 +405,10 @@ public:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   bool isTargetEHABICompatible() const {
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     return (TargetTriple.getEnvironment() == Triple::EABI ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
             TargetTriple.getEnvironment() == Triple::GNUEABI ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+	    TargetTriple.getEnvironment() == Triple::MuslEABI ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
             TargetTriple.getEnvironment() == Triple::EABIHF ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
             TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+	    TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
             isTargetAndroid()) &&
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
            !isTargetDarwin() && !isTargetWindows();
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   }
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -415,6 +417,7 @@ public:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     // FIXME: this is invalid for WindowsCE
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
            TargetTriple.getEnvironment() == Triple::EABIHF ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+	   TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
            isTargetWindows() || isAAPCS16_ABI();
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   }
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
   bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
index fca1901..25f5cf9 100644
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
--- a/lib/Target/ARM/ARMTargetMachine.cpp
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+++ b/lib/Target/ARM/ARMTargetMachine.cpp
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
@@ -101,6 +101,8 @@ computeTargetABI(const Triple &TT, StringRef CPU,
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     case llvm::Triple::GNUEABIHF:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     case llvm::Triple::EABIHF:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     case llvm::Triple::EABI:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    case llvm::Triple::MuslEABI:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
+    case llvm::Triple::MuslEABIHF:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
       TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS;
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
       break;
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
     case llvm::Triple::GNU:
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
-- 
Lucio Andrés Illanes Albornoz (arab, vxp) 585426
2.7.3
Lucio Andrés Illanes Albornoz (arab, vxp) 585426