ports/devel/llvm-devel/files/ppc64-elfv2/patch-lib_Target_PowerPC_PPCTargetMachine.cpp
Brooks Davis 4c892ae16a Update to a new snapshot.
powerpc64: add configure option to select ELFv2 ABI

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

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

Submitted by:	Alfredo Dal'Ava Júnior
Differential Revision:	https://reviews.freebsd.org/D22100
2019-10-21 23:53:09 +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;