From 1c61471ab1cba735f57824ec8a38db845e60ab84 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 22 May 2019 07:29:59 +0000 Subject: [PPC64] Parse -elfv1 -elfv2 when specified on target triple MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- llvm/lib/Support/Triple.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Support/Triple.cpp') 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(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) -- cgit v1.2.3