Skip to content

Commit b68256d

Browse files
committed
discuss (guaranteed) tail calls
1 parent 0a43fea commit b68256d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

text/0000-cmse-calling-conventions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ Currently both ABIs disallow the use of c-variadics. For `cmse-nonsecure-entry`,
109109

110110
For `cmse-nonsecure-call`, we may support and stabilize c-variadics at some point in the future.
111111

112+
## No tail calls
113+
114+
Neither cmse ABI can support (guaranteed) tail calls, per the LLVM source:
115+
116+
> For both the non-secure calls and the returns from a CMSE entry function, the function needs to do some extra work after the call, or before the return, respectively, thus it cannot end with a tail call
117+
118+
For `cmse-nonsecure-entry` we emit an error when `become` is used to call a function with this ABI. For `cmse-nonsecure-call` it is not (currently) possible to construct an example that triggers the error, because rust requires the caller and callee of a guaranteed tail call to have the same ABI, and `cmse-nonsecure-call` cannot be used in function definitions.
112119
### Support for `const fn`
113120

114121
No special support for calling cmse functions is needed.

0 commit comments

Comments
 (0)