ports/devel/llvm90/files/ppc64-elfv2/patch-lib_Target_PowerPC_PPCTargetMachine.cpp
Brooks Davis 54435b5150 Fix build without CLANG enabled. [0]
Fix LLD build where PREFIX != LOCALBASE. [1]

powerpc64: add configure option to select ELFv2 ABI [2]

In preparation for compiler+ABI change in PowerPC64, this change adds a
configure option to select ELFv2 as default powerpc64 ABI when compiling
llvm90.

The new option automatically set when ELFv2 environment is detected
(when PPC_ABI=ELFv2)

PR:		241400 [1], 241410 [0]
Submitted by:	Alfredo Dal'Ava Júnior [2]
Differential Revision:	https://reviews.freebsd.org/D22100 [2]
2019-10-22 19:07:22 +00:00

23 lines
720 B
C++

--- lib/Target/PowerPC/PPCTargetMachine.cpp.orig 2019-07-04 07:43:51 UTC
+++ lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -209,6 +209,20 @@ static PPCTargetMachine::PPCABI computeTargetABI(const
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;