aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Targets/PPC.h21
-rw-r--r--contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp14
2 files changed, 33 insertions, 2 deletions
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)
diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index ce00f848dd72..356a08929682 100644
--- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -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;