[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
This commit is contained in:
Justin Hibbits 2019-12-27 04:00:04 +00:00
parent 678da4a274
commit e4399d169a
2 changed files with 33 additions and 2 deletions

View File

@ -375,12 +375,29 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public PPCTargetInfo {
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)

View File

@ -209,6 +209,20 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
if (TT.isMacOSX())
return PPCTargetMachine::PPC_ABI_UNKNOWN;
if (TT.isOSFreeBSD()) {
switch (TT.getArch()) {
case Triple::ppc64le:
case Triple::ppc64:
if (TT.getOSMajorVersion() >= 13)
return PPCTargetMachine::PPC_ABI_ELFv2;
else
return PPCTargetMachine::PPC_ABI_ELFv1;
case Triple::ppc:
default:
return PPCTargetMachine::PPC_ABI_UNKNOWN;
}
}
switch (TT.getArch()) {
case Triple::ppc64le:
return PPCTargetMachine::PPC_ABI_ELFv2;