[ARM] harden-sls-blr: avoid r12 and lr in indirect calls.
authorKristof Beyls <kristof.beyls@arm.com>
Thu, 26 Nov 2020 13:45:37 +0000 (13:45 +0000)
committerKristof Beyls <kristof.beyls@arm.com>
Sat, 19 Dec 2020 12:39:59 +0000 (12:39 +0000)
commitdf8ed3928377edc6e9241a56680b694ffa9f4d6d
tree32aec468057fd516c29494040ee31f10e4e72bf3
parenta4c1f5160e6d1de9a9959ecbf329c2acf4f3ed31
[ARM] harden-sls-blr: avoid r12 and lr in indirect calls.

As a linker is allowed to clobber r12 on function calls, the code
transformation that hardens indirect calls is not correct in case a
linker does so.  Similarly, the transformation is not correct when
register lr is used.

This patch makes sure that r12 or lr are not used for indirect calls
when harden-sls-blr is enabled.

Differential Revision: https://reviews.llvm.org/D92469
14 files changed:
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/lib/Target/ARM/ARMBaseInstrInfo.h
llvm/lib/Target/ARM/ARMCallLowering.cpp
llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
llvm/lib/Target/ARM/ARMFastISel.cpp
llvm/lib/Target/ARM/ARMFeatures.h
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMInstrInfo.td
llvm/lib/Target/ARM/ARMInstrThumb.td
llvm/lib/Target/ARM/ARMPredicates.td
llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
llvm/lib/Target/ARM/ARMRegisterInfo.td
llvm/lib/Target/ARM/ARMSLSHardening.cpp
llvm/test/CodeGen/ARM/speculation-hardening-sls.ll