Skip to content

Commit 7cbbf89

Browse files
[ARM] CMSE code generation
This patch implements the final bits of CMSE code generation: * emit special linker symbols * restrict parameter passing to not use memory * emit BXNS and BLXNS instructions for returns from non-secure entry functions, and non-secure function calls, respectively * emit code to save/restore secure floating-point state around calls to non-secure functions * emit code to save/restore non-secure floating-pointy state upon entry to non-secure entry function, and return to non-secure state * emit code to clobber registers not used for arguments and returns when switching to no-secure state Patch by Momchil Velikov, Bradley Smith, Javed Absar, David Green, possibly others. Differential Revision: https://reviews.llvm.org/D76518
1 parent e4512b5 commit 7cbbf89

22 files changed

+3919
-18
lines changed

llvm/lib/Target/ARM/ARMAsmPrinter.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ void ARMAsmPrinter::emitFunctionEntryLabel() {
7373
} else {
7474
OutStreamer->emitAssemblerFlag(MCAF_Code32);
7575
}
76+
77+
// Emit symbol for CMSE non-secure entry point
78+
if (AFI->isCmseNSEntryFunction()) {
79+
MCSymbol *S =
80+
OutContext.getOrCreateSymbol("__acle_se_" + CurrentFnSym->getName());
81+
emitLinkage(&MF->getFunction(), S);
82+
OutStreamer->emitSymbolAttribute(S, MCSA_ELF_TypeFunction);
83+
OutStreamer->emitLabel(S);
84+
}
85+
7686
OutStreamer->emitLabel(CurrentFnSym);
7787
}
7888

0 commit comments

Comments
 (0)