From b828a021acc78c485dc10b0bbda385c5d29a55b2 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 28 Jun 2019 19:48:31 +0000 Subject: [PATCH] Default to Secure PLT on PPC for musl libc. This matches the default settings of clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364675 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCSubtarget.cpp | 3 ++- test/CodeGen/PowerPC/ppc32-pic-large.ll | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp index 82f71806e5d..6aa7528634d 100644 --- a/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/lib/Target/PowerPC/PPCSubtarget.cpp @@ -145,7 +145,8 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { if (isDarwin()) HasLazyResolverStubs = true; - if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD()) + if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || + TargetTriple.isMusl()) SecurePlt = true; if (HasSPE && IsPPC64) diff --git a/test/CodeGen/PowerPC/ppc32-pic-large.ll b/test/CodeGen/PowerPC/ppc32-pic-large.ll index 272138e5121..266d539024e 100644 --- a/test/CodeGen/PowerPC/ppc32-pic-large.ll +++ b/test/CodeGen/PowerPC/ppc32-pic-large.ll @@ -4,6 +4,8 @@ ; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s ; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s ; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s +; RUN: llc < %s -mtriple=powerpc-linux-musl -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s +; RUN: llc < %s -mtriple=powerpc-linux-musl -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s @bar = common global i32 0, align 4 declare i32 @call_foo(i32, ...) -- 2.40.0