Skip to content

Commit 6a19836

Browse files
committed
Default to Secure PLT on PPC for NetBSD and OpenBSD.
This matches the default settings of clang. llvm-svn: 355038
1 parent 2d525d4 commit 6a19836

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

llvm/lib/Target/PowerPC/PPCSubtarget.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
138138
if (isDarwin())
139139
HasLazyResolverStubs = true;
140140

141+
if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD())
142+
SecurePlt = true;
143+
141144
if (HasSPE && IsPPC64)
142145
report_fatal_error( "SPE is only supported for 32-bit targets.\n", false);
143146
if (HasSPE && (HasAltivec || HasQPX || HasVSX || HasFPU))

llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck -check-prefix=LARGE-BSS %s
22
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
3+
; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
4+
; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
5+
; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
6+
; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
37
@bar = common global i32 0, align 4
48

59
declare i32 @call_foo(i32, ...)

0 commit comments

Comments
 (0)