[clang] a16c596 - [Triple] Simplify ELFv2 ABI and Secure PLT handling for FreeBSD (#233047)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 21 04:48:31 PDT 2026
Author: Brad Smith
Date: 2026-10-21T07:48:26-04:00
New Revision: a16c59637d67f2815c53b21309e39d7b65826ac1
URL: https://github.com/llvm/llvm-project/commit/a16c59637d67f2815c53b21309e39d7b65826ac1
DIFF: https://github.com/llvm/llvm-project/commit/a16c59637d67f2815c53b21309e39d7b65826ac1.diff
LOG: [Triple] Simplify ELFv2 ABI and Secure PLT handling for FreeBSD (#233047)
FreeBSD 13 is the baseline supported version and it uses the
ELFv2 ABI on big-endian powerpc64 and Secure PLT on 32-bit
powerpc, so drop the OS version checks and treat all FreeBSD
targets as using them.
Added:
Modified:
clang/test/Driver/ppc-abi.c
llvm/include/llvm/TargetParser/Triple.h
llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
Removed:
################################################################################
diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c
index a433f4c0f5d8fc..804fe4cbbc2fa5 100644
--- a/clang/test/Driver/ppc-abi.c
+++ b/clang/test/Driver/ppc-abi.c
@@ -20,10 +20,6 @@
// RUN: %clang --target=ppc64 -mabi=elfv2 %s -### -o %t.o 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-UNKNOWN-ELFv2 %s
-// RUN: %clang -target powerpc64-unknown-freebsd11 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s
-// RUN: %clang -target powerpc64-unknown-freebsd12 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s
-// RUN: %clang -target powerpc64-unknown-freebsd13 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s
-// RUN: %clang -target powerpc64-unknown-freebsd14 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s
// RUN: %clang -target powerpc64-unknown-freebsd %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s
// RUN: %clang -target powerpc64le-unknown-freebsd13 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2 %s
// RUN: %clang -target powerpc64-unknown-openbsd %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE %s
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 6fb2904def2e52..ad1b654dc4076e 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -1155,19 +1155,16 @@ class Triple {
/// Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
bool isPPC64ELFv2ABI() const {
- return (getArch() == Triple::ppc64 &&
- ((getOS() == Triple::FreeBSD &&
- (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
- getOS() == Triple::OpenBSD || isMusl()));
+ return (
+ getArch() == Triple::ppc64 &&
+ (getOS() == Triple::FreeBSD || getOS() == Triple::OpenBSD || isMusl()));
}
/// Tests whether the target 32-bit PowerPC uses Secure PLT.
bool isPPC32SecurePlt() const {
return ((getArch() == Triple::ppc || getArch() == Triple::ppcle) &&
- ((getOS() == Triple::FreeBSD &&
- (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
- getOS() == Triple::NetBSD || getOS() == Triple::OpenBSD ||
- isMusl()));
+ (getOS() == Triple::FreeBSD || getOS() == Triple::NetBSD ||
+ getOS() == Triple::OpenBSD || isMusl()));
}
/// Tests whether the target is 32-bit RISC-V.
diff --git a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
index d418194b338f0f..0c30605d051c39 100644
--- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
@@ -7,7 +7,6 @@
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-freebsd12 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-freebsd < %s | FileCheck %s -check-prefix=CHECK-ELFv2
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-freebsd -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-freebsd -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
More information about the cfe-commits
mailing list