<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_extra"><br><div class="gmail_quote">2018-01-24 0:23 GMT+08:00 Ben Craig <span dir="ltr"><<a href="mailto:ben.craig@ni.com" target="_blank">ben.craig@ni.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">





<div lang="EN-US">
<div class="gmail-m_-8369027707959737674WordSection1">
<p class="MsoNormal">The high level of what happens is that __builtin_eh_return forces a spill of all the non-volatile registers.  The unwinder then has a starting point for populating and adjusting those non-volatile registers.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This approach usually requires that the function calling __builtin_eh_return be built without optimizations, because the optimizer will then remove the spills.</p></div></div></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​Ben, thanks for your input. However, I don't quite understand what you said.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">​The prototype of ​</font>__builtin_eh_return (offset, handler) [1], I can't see why it forces spilling all non-volatile registers (I assume non-volatile == callee-saved).</div><div class="gmail_quote"><div><br></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif">​Take libgcc as an example, __built_eh_return is called in uw_install_context [1], which is called in the end of _Unwind_RaiseException [2]. Do you mean we should compile libgcc without optimization?</span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif"><br></span></div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​[1] <a href="https://github.com/gcc-mirror/gcc/blob/master/libgcc/unwind-dw2.c">https://github.com/gcc-mirror/gcc/blob/master/libgcc/unwind-dw2.c</a>​</div></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">[2] <a href="https://github.com/gcc-mirror/gcc/blob/master/libgcc/unwind.inc">https://github.com/gcc-mirror/gcc/blob/master/libgcc/unwind.inc</a>​</div></div><div><br></div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/~chenwj</a></div></div></div>
</div></div>