[llvm-dev] Implementing stack probes

Martin J. O'Riordan via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 30 08:29:22 PDT 2016


I am trying to implement stack probes for our SHAVE target, and I see that
the compiler injects references to '__stack_chk_guard' and
'__stack_chk_fail'.  The code that gets generated is horribly wrong, but in
order to understand how to fix it I was wondering if there is a clear
statement of how the mechanism is supposed to work?

 

The variable '__stack_chk_guard' appears to be a pointer to an unsigned
integer.  Where is this supposed to reside, and what value should it
contain?  And the function '__stack_chk_fail' is called when the test fails
- presumably this just aborts.

 

We have done nothing to support these hooks, so the junk instructions that
come out are unsurprising.  I am presuming that we need to handle their
lowering in a target specific way, but before I can do that I am wondering
if there is a clear definition of the semantics of how the probe is supposed
to work?

 

Thanks,

 

            MartinO

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160630/725e9b60/attachment.html>


More information about the llvm-dev mailing list