Open mchack-work opened 1 year ago
I was looking into the same functionality recently. embeddedartistry.com provides a comprehensive post on this topic. (Other than this post, I found mostly snippets of information.)
Given the lack of much runtime support, it seems that one must call function that performs the init manually, or include it right before call main
in libcrt0/crt0.S
.
Note that there is one minor consideration: if one includes the init-call in crt0.S
, then main
is no longer called with unmodified program memory.
Implement stack canaries to help against buffer overflows. lld gives:
which hints at what we need to implement.