summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2020-04-04 09:54:04 +0000
committerkettenis <kettenis@openbsd.org>2020-04-04 09:54:04 +0000
commit3159fc8f233e5ccb749cd05b58cf5b93b8f45263 (patch)
tree131142a3b6f2cf2b32a06a8ce1e0355fff9c0107 /gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
parentPrevent shadowing of local variable by the EV_SET() macro. (diff)
downloadwireguard-openbsd-3159fc8f233e5ccb749cd05b58cf5b93b8f45263.tar.xz
wireguard-openbsd-3159fc8f233e5ccb749cd05b58cf5b93b8f45263.zip
Fix "small pic" secure plt support.
ok mortimer@
Diffstat (limited to 'gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp')
-rw-r--r--gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
index e731c0bc0c2..1d860448de5 100644
--- a/gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+++ b/gnu/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
@@ -114,9 +114,9 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
const PPCSubtarget *Subtarget = &(MF->getSubtarget<PPCSubtarget>());
const TargetMachine &TM = Printer.TM;
const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
- // -msecure-plt option works only in PIC mode. If secure plt mode
- // is on add 32768 to symbol.
+ // For -msecure-plt -fPIC, add 32768 to the symbol.
if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+ MF->getFunction().getParent()->getPICLevel() == PICLevel::BigPIC &&
MO.getTargetFlags() == PPCII::MO_PLT)
Expr = MCBinaryExpr::createAdd(Expr,
MCConstantExpr::create(32768, Ctx),