37 lines
1.8 KiB
Diff
37 lines
1.8 KiB
Diff
From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
|
|
From: Samuel Holland <samuel@sholland.org>
|
|
Date: Sun, 3 Nov 2019 10:57:27 -0600
|
|
Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
|
|
|
|
---
|
|
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 2 +-
|
|
llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
|
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
|
index cce21f32..87ca5f9b 100644
|
|
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
|
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
|
@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
|
|
|
|
// Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
|
|
if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
|
|
- M->getPICLevel() == PICLevel::BigPIC)
|
|
+ M->getPICLevel() != PICLevel::SmallPIC)
|
|
TlsRef = MCBinaryExpr::createAdd(
|
|
TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
|
|
const MachineOperand &MO = MI->getOperand(2);
|
|
diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp
|
|
index 5cc180d7..a5b02565 100644
|
|
--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
|
|
+++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
|
|
@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
|
|
const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
|
|
// If -msecure-plt -fPIC, add 32768 to symbol.
|
|
if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
|
|
- M->getPICLevel() == PICLevel::BigPIC &&
|
|
+ M->getPICLevel() != PICLevel::SmallPIC &&
|
|
MO.getTargetFlags() == PPCII::MO_PLT)
|
|
Expr =
|
|
MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
|