aports/testing/llvm3.7/llvm-0002-musl-triple.patch
2016-07-25 20:29:38 +02:00

91 lines
3.3 KiB
Diff

From 58be6f7fb164dbf42fdd28ce6474dbe4bc5ca401 Mon Sep 17 00:00:00 2001
From: Andrea Brancaleoni <miwaxe@gmail.com>
Date: Tue, 8 Sep 2015 21:53:42 +0200
Subject: [PATCH 2/3] musl triple
---
include/llvm/ADT/Triple.h | 4 ++++
lib/Support/Triple.cpp | 6 ++++++
lib/Target/ARM/ARMSubtarget.h | 3 +++
lib/Target/ARM/ARMTargetMachine.cpp | 2 ++
4 files changed, 15 insertions(+)
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 947812d..d2a6bbe 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -167,6 +167,10 @@ public:
EABIHF,
Android,
+ Musl,
+ MuslEABI,
+ MuslEABIHF,
+
MSVC,
Itanium,
Cygnus,
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
index c6646fb..8d47ad9 100644
--- a/lib/Support/Triple.cpp
+++ b/lib/Support/Triple.cpp
@@ -192,6 +192,9 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
case CODE16: return "code16";
case EABI: return "eabi";
case EABIHF: return "eabihf";
+ case Musl: return "musl";
+ case MuslEABIHF: return "musleabihf";
+ case MuslEABI: return "musleabi";
case Android: return "android";
case MSVC: return "msvc";
case Itanium: return "itanium";
@@ -427,6 +430,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
.StartsWith("code16", Triple::CODE16)
.StartsWith("gnu", Triple::GNU)
.StartsWith("android", Triple::Android)
+ .StartsWith("musleabihf", Triple::MuslEABIHF)
+ .StartsWith("musleabi", Triple::MuslEABI)
+ .StartsWith("musl", Triple::Musl)
.StartsWith("msvc", Triple::MSVC)
.StartsWith("itanium", Triple::Itanium)
.StartsWith("cygnus", Triple::Cygnus)
diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h
index dd101df..c5bdcca 100644
--- a/lib/Target/ARM/ARMSubtarget.h
+++ b/lib/Target/ARM/ARMSubtarget.h
@@ -381,8 +381,10 @@ public:
bool isTargetEHABICompatible() const {
return (TargetTriple.getEnvironment() == Triple::EABI ||
TargetTriple.getEnvironment() == Triple::GNUEABI ||
+ TargetTriple.getEnvironment() == Triple::MuslEABI ||
TargetTriple.getEnvironment() == Triple::EABIHF ||
TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
+ TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
TargetTriple.getEnvironment() == Triple::Android) &&
!isTargetDarwin() && !isTargetWindows();
}
@@ -391,6 +393,7 @@ public:
// FIXME: this is invalid for WindowsCE
return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
TargetTriple.getEnvironment() == Triple::EABIHF ||
+ TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
isTargetWindows();
}
bool isTargetAndroid() const {
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
index 93495d6..56e6b7f 100644
--- a/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/lib/Target/ARM/ARMTargetMachine.cpp
@@ -97,6 +97,8 @@ computeTargetABI(const Triple &TT, StringRef CPU,
case llvm::Triple::GNUEABIHF:
case llvm::Triple::EABIHF:
case llvm::Triple::EABI:
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::MuslEABIHF:
TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS;
break;
case llvm::Triple::GNU:
--
2.5.1