<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 24, 2014 at 6:44 AM, Aleksei <span dir="ltr"><<a href="mailto:kulalexey@gmail.com" target="_blank">kulalexey@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I was wrong with example above. Looks like the only problem is sorting and sometimes overlapping ranges of Function start & end. For example, in cases when exist two or more .text sections there is no way at all to sort function starts  (in one .pdata section)<br>

I think, solution is to create one .pdata (and maybe .xdata) for each exception info as MS VC compiler do<br></blockquote><div><br></div><div>Yeah, this implementation of .pdata emission completely doesn't work for inline functions.  My minimal C++-level test case is:</div>
<div><br></div><div>$ cat t.cpp</div><div>int bar();</div><div>inline int foo() {</div><div>  return bar();</div><div>}</div><div>#ifdef CONFIG_1</div><div>int bar() {</div><div>  return 42;</div><div>}</div><div>int baz() {</div>
<div>  return foo();</div><div>}</div><div>#else</div><div>int main() {</div><div>  return foo();</div><div>}</div><div>#endif</div><div><br></div><div>$ clang-cl -m64 -c t.cpp -Fot1.obj && clang-cl -m64 -c t.cpp -DCONFIG_1 -Fot2.obj && link t1.obj t2.obj -out:t.exe</div>
<div>Microsoft (R) Incremental Linker Version 12.00.30501.0</div><div>Copyright (C) Microsoft Corporation.  All rights reserved.</div><div><br></div><div>t2.obj : fatal error LNK1223: invalid or corrupt file: file contains invalid .pdata contributions</div>
<div><br></div><div>I think this is equivalent to bfd's famous "relocation refers to discarded section" error message.  One of the inline function definitions was discarded, and we still have .pdata referring to it.</div>
<div><br></div><div>At the MC level, we need to create individual .pdata sections associated with each .text section created for an inline function, instead of one giant .pdata section.</div><div><br></div><div><br></div>
</div></div></div>