[PATCH] D144444: [PowerPC] Use member function to determine PowerPC Secure PLT
Brad Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 21 10:15:19 PST 2023
brad updated this revision to Diff 499222.
brad added a comment.
rename function and clang-format.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144444/new/
https://reviews.llvm.org/D144444
Files:
clang/lib/Driver/ToolChains/Arch/PPC.cpp
llvm/include/llvm/TargetParser/Triple.h
llvm/lib/Target/PowerPC/PPCSubtarget.cpp
Index: llvm/lib/Target/PowerPC/PPCSubtarget.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -106,9 +106,7 @@
if (IsPPC64 && has64BitSupport())
Use64BitRegs = true;
- if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
- TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
- TargetTriple.isMusl())
+ if (TargetTriple.isPPC32SecurePlt())
IsSecurePlt = true;
if (HasSPE && IsPPC64)
Index: llvm/include/llvm/TargetParser/Triple.h
===================================================================
--- llvm/include/llvm/TargetParser/Triple.h
+++ llvm/include/llvm/TargetParser/Triple.h
@@ -890,6 +890,15 @@
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()));
+ }
+
/// Tests whether the target is 32-bit RISC-V.
bool isRISCV32() const { return getArch() == Triple::riscv32; }
Index: clang/lib/Driver/ToolChains/Arch/PPC.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/PPC.cpp
+++ clang/lib/Driver/ToolChains/Arch/PPC.cpp
@@ -119,8 +119,7 @@
const ArgList &Args) {
if (Args.getLastArg(options::OPT_msecure_plt))
return ppc::ReadGOTPtrMode::SecurePlt;
- if ((Triple.isOSFreeBSD() && Triple.getOSMajorVersion() >= 13) ||
- Triple.isOSNetBSD() || Triple.isOSOpenBSD() || Triple.isMusl())
+ if (Triple.isPPC32SecurePlt())
return ppc::ReadGOTPtrMode::SecurePlt;
else
return ppc::ReadGOTPtrMode::Bss;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144444.499222.patch
Type: text/x-patch
Size: 2016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230221/99c232e7/attachment.bin>
More information about the cfe-commits
mailing list