[llvm] [AArch64] Implement -fno-plt for SelectionDAG/GlobalISel (PR #78890)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 03:41:29 PST 2024
================
@@ -1301,8 +1301,19 @@ bool AArch64CallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
!Subtarget.noBTIAtReturnTwice() &&
MF.getInfo<AArch64FunctionInfo>()->branchTargetEnforcement())
Opc = AArch64::BLR_BTI;
- else
+ else {
+ // For an intrinsic call (e.g. memset), use GOT if "RtLibUseGOT" (-fno-plt)
+ // is set.
+ if (Info.Callee.isSymbol() && F.getParent()->getRtLibUseGOT()) {
+ auto Reg =
+ MRI.createGenericVirtualRegister(getLLTForType(*F.getType(), DL));
+ MIRBuilder.buildInstr(TargetOpcode::G_GLOBAL_VALUE)
+ .addDef(Reg)
+ .addExternalSymbol(Info.Callee.getSymbolName(), AArch64II::MO_GOT);
+ Info.Callee = MachineOperand::CreateReg(Reg, false);
+ }
----------------
arsenm wrote:
Still should fix this API
https://github.com/llvm/llvm-project/pull/78890
More information about the llvm-commits
mailing list