summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Triple.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-05-22 07:29:59 +0000
committerFangrui Song <maskray@google.com>2019-05-22 07:29:59 +0000
commit1c61471ab1cba735f57824ec8a38db845e60ab84 (patch)
treee20c5ed4a82942e285d42327d8fd88239a505c4d /llvm/lib/Support/Triple.cpp
parenteec021658b8f1a4db0d170f03f98d694e900dc8c (diff)
downloadbcm5719-llvm-1c61471ab1cba735f57824ec8a38db845e60ab84.tar.gz
bcm5719-llvm-1c61471ab1cba735f57824ec8a38db845e60ab84.zip
[PPC64] Parse -elfv1 -elfv2 when specified on target triple
Summary: For big-endian powerpc64, the default ABI is ELFv1. OpenPower ABI ELFv2 is supported when -mabi=elfv2 is specified. FreeBSD support for PowerPC64 ELFv2 ABI with LLVM is in progress[1]. This patch adds an alternative way to specify ELFv2 ABI on target triple [2]. The following results are expected: ELFv1 when using: -target powerpc64-unknown-freebsd12.0 -target powerpc64-unknown-freebsd12.0 -mabi=elfv1 -target powerpc64-unknown-freebsd12.0-elfv1 ELFv2 when using: -target powerpc64-unknown-freebsd12.0 -mabi=elfv2 -target powerpc64-unknown-freebsd12.0-elfv2 [1] https://wiki.freebsd.org/powerpc/llvm-elfv2 [2] https://clang.llvm.org/docs/CrossCompilation.html Patch by Alfredo Dal'Ava JĂșnior! Differential Revision: https://reviews.llvm.org/D61950 llvm-svn: 361355
Diffstat (limited to 'llvm/lib/Support/Triple.cpp')
-rw-r--r--llvm/lib/Support/Triple.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 639519ce6ec..caf39a761d7 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -228,6 +228,8 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
case CODE16: return "code16";
case EABI: return "eabi";
case EABIHF: return "eabihf";
+ case ELFv1: return "elfv1";
+ case ELFv2: return "elfv2";
case Android: return "android";
case Musl: return "musl";
case MuslEABI: return "musleabi";
@@ -521,6 +523,8 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
return StringSwitch<Triple::EnvironmentType>(EnvironmentName)
.StartsWith("eabihf", Triple::EABIHF)
.StartsWith("eabi", Triple::EABI)
+ .StartsWith("elfv1", Triple::ELFv1)
+ .StartsWith("elfv2", Triple::ELFv2)
.StartsWith("gnuabin32", Triple::GNUABIN32)
.StartsWith("gnuabi64", Triple::GNUABI64)
.StartsWith("gnueabihf", Triple::GNUEABIHF)
OpenPOWER on IntegriCloud