From e4399d169acc4da249b152cd0315f39531e816ea Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Fri, 27 Dec 2019 04:00:04 +0000 Subject: [PowerPC64] Starting from FreeBSD 13.0, default to ELFv2 ABI This changes the LLVM default powerpc64 ABI to ELFv2, if target OS is FreeBSD >= 13.0 This will also be sent upstream. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: dim, luporl Relnotes: YES Differential Revision: https://reviews.freebsd.org/D20383 --- contrib/llvm-project/clang/lib/Basic/Targets/PPC.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'contrib/llvm-project/clang/lib/Basic') diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h index 6c6421c28e23..72a82f0ed7c7 100644 --- a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h +++ b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h @@ -375,12 +375,29 @@ public: IntMaxType = SignedLong; Int64Type = SignedLong; + if (Triple.getEnvironment() != llvm::Triple::UnknownEnvironment) { + switch (Triple.getEnvironment()){ + case llvm::Triple::ELFv1: + ABI = "elfv1"; + break; + default: + ABI = "elfv2"; + break; + } + } else { + if ((Triple.getOS() == llvm::Triple::FreeBSD) && + (Triple.getOSMajorVersion() < 13)) { + ABI = "elfv1"; + } else { + ABI = "elfv2"; + } + } + + if ((Triple.getArch() == llvm::Triple::ppc64le)) { resetDataLayout("e-m:e-i64:64-n32:64"); - ABI = "elfv2"; } else { resetDataLayout("E-m:e-i64:64-n32:64"); - ABI = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1"; } if (Triple.getOS() == llvm::Triple::AIX) -- cgit v1.2.3