summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorJustin Hibbits <chmeeedalf@gmail.com>2019-11-21 16:33:24 -0600
committerJustin Hibbits <chmeeedalf@gmail.com>2019-12-19 09:27:13 -0600
commitd3aeac8e20fb3714eb69d6ed5838d57c7ddcd8e8 (patch)
tree3f35681e2c780634c94d2f3d600e6ad6b82fbd28 /llvm/lib/Target
parentdcb48f50bdfa0fa47b62d089b6ed999d857fc9f8 (diff)
downloadbcm5719-llvm-d3aeac8e20fb3714eb69d6ed5838d57c7ddcd8e8.tar.gz
bcm5719-llvm-d3aeac8e20fb3714eb69d6ed5838d57c7ddcd8e8.zip
[PowerPC] Only use PLT annotations if using PIC relocation model
Summary: The default static (non-PIC, non-PIE) model for 32-bit powerpc does not use @PLT annotations and relocations in GCC. LLVM shouldn't use @PLT annotations either, because it breaks secure-PLT linking with (some versions of?) GNU LD. Update the available-externally.ll test to reflect that default mode should be the same as the static relocation, by using the same check prefix. Reviewed by: sfertile Differential Revision: https://reviews.llvm.org/D70570
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelLowering.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 899a4f6f846..3062dbb655f 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -5107,7 +5107,13 @@ static SDValue transformCallee(const SDValue &Callee, SelectionDAG &DAG,
G ? G->getGlobal() : nullptr);
};
- bool UsePlt = Subtarget.is32BitELFABI() && !isLocalCallee();
+ // The PLT is only used in 32-bit ELF PIC mode. Attempting to use the PLT in
+ // a static relocation model causes some versions of GNU LD (2.17.50, at
+ // least) to force BSS-PLT, instead of secure-PLT, even if all objects are
+ // built with secure-PLT.
+ bool UsePlt =
+ Subtarget.is32BitELFABI() && !isLocalCallee() &&
+ Subtarget.getTargetMachine().getRelocationModel() == Reloc::PIC_;
if (isFunctionGlobalAddress(Callee)) {
const GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Callee);
OpenPOWER on IntegriCloud