Date: Tue, 21 Feb 2023 13:38:59 GMT From: Piotr Kubaj <pkubaj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 50796dea719a - releng/13.2 - llvm: make sure to use ELFv2 ABI on powerpc64 Message-ID: <202302211338.31LDcxPF079498@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch releng/13.2 has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=50796dea719a4ca2e26376eaab67eafd94532fee commit 50796dea719a4ca2e26376eaab67eafd94532fee Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2023-02-16 23:49:43 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2023-02-21 13:38:43 +0000 llvm: make sure to use ELFv2 ABI on powerpc64 Currently LLVM is more or less set up to use ELFv2, but it still defaults to ELFv1 in some places. This causes lld to generate broken binaries when used with LTO. PR: 269455 Approved by: dim, re (cpercival) MFC after: 3 days (cherry picked from commit a1ffc2fe9ce54a498c410dcab86495569dbaa7cc) (cherry picked from commit 8f39cbf4f30c9a8cd3f593dc2b373a289785d4b6) --- contrib/llvm-project/clang/lib/Basic/Targets/PPC.h | 3 +++ contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h index ac52eb219f54..cd9bf0d8e359 100644 --- a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h +++ b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h @@ -425,6 +425,9 @@ public: } else if ((Triple.getArch() == llvm::Triple::ppc64le)) { DataLayout = "e-m:e-i64:64-n32:64"; ABI = "elfv2"; + } else if (Triple.isOSFreeBSD() && (Triple.getOSMajorVersion() == 0 || Triple.getOSMajorVersion() >= 13)) { + DataLayout = "E-m:e-i64:64-n32:64"; + ABI = "elfv2"; } else { DataLayout = "E-m:e-i64:64-n32:64"; ABI = "elfv1"; diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 3eff00fc3c05..9b7145aafead 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -221,8 +221,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, assert(Options.MCOptions.getABIName().empty() && "Unknown target-abi option!"); - if (TT.isMacOSX()) + if (TT.isMacOSX()) { return PPCTargetMachine::PPC_ABI_UNKNOWN; + } else if (TT.isOSFreeBSD() && TT.getArch() == Triple::ppc64 && (TT.getOSMajorVersion() == 0 || TT.getOSMajorVersion() >= 13)) { + return PPCTargetMachine::PPC_ABI_ELFv2; + } switch (TT.getArch()) { case Triple::ppc64le:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302211338.31LDcxPF079498>