https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/233047
>From 3ee98a75861817615a545bc1ea81be8a1898b2fa Mon Sep 17 00:00:00 2001 From: Brad Smith <[email protected]> Date: Wed, 21 Oct 2026 06:42:29 -0400 Subject: [PATCH] [Triple] Simplify ELFv2 ABI and Secure PLT handling for FreeBSD 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. --- clang/test/Driver/ppc-abi.c | 4 ---- llvm/include/llvm/TargetParser/Triple.h | 13 +++++-------- llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll | 1 - 3 files changed, 5 insertions(+), 13 deletions(-) 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 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
