Skip to content

Commit b34f3c3

Browse files
committed
[PowerPC] Handle CALL_RM like CALL for 32-bit ELF
If a function call has the strictfp attribute, its opcode changes from CALL to CALL_RM. If the call uses the secure PLT for 32-bit ELF, then it must getGlobalBaseReg() to set r30.
1 parent b00e2f2 commit b34f3c3

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5475,7 +5475,8 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
54755475
// generate secure plt code for TLS symbols.
54765476
getGlobalBaseReg();
54775477
} break;
5478-
case PPCISD::CALL: {
5478+
case PPCISD::CALL:
5479+
case PPCISD::CALL_RM: {
54795480
if (PPCLowering->getPointerTy(CurDAG->getDataLayout()) != MVT::i32 ||
54805481
!TM.isPositionIndependent() || !Subtarget->isSecurePlt() ||
54815482
!Subtarget->isTargetELF())
@@ -5491,8 +5492,7 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
54915492
if (ES->getTargetFlags() == PPCII::MO_PLT)
54925493
getGlobalBaseReg();
54935494
}
5494-
}
5495-
break;
5495+
} break;
54965496

54975497
case PPCISD::GlobalBaseReg:
54985498
ReplaceNode(N, getGlobalBaseReg());
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck %s
2+
3+
; This variant of ppc32-pic-large.ll checks that a strictfp call sets
4+
; r30 for the secure PLT.
5+
6+
declare void @call_foo()
7+
8+
define void @foo() {
9+
entry:
10+
call void @call_foo() #0
11+
ret void
12+
}
13+
14+
attributes #0 = { strictfp }
15+
16+
!llvm.module.flags = !{!0}
17+
!0 = !{i32 1, !"PIC Level", i32 2}
18+
19+
; CHECK: addis 30, 30, .LTOC-.L0$pb@ha
20+
; CHECK: addi 30, 30, .LTOC-.L0$pb@l
21+
; CHECK: bl call_foo@PLT+32768

0 commit comments

Comments
 (0)