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