[PATCH] Generate SEH unwinding info on Win64

Reid Kleckner rnk at google.com
Mon Jun 30 18:20:57 PDT 2014


On Tue, Jun 24, 2014 at 6:44 AM, Aleksei <kulalexey at gmail.com> wrote:

> 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)
> I think, solution is to create one .pdata (and maybe .xdata) for each
> exception info as MS VC compiler do
>

Yeah, this implementation of .pdata emission completely doesn't work for
inline functions.  My minimal C++-level test case is:

$ cat t.cpp
int bar();
inline int foo() {
  return bar();
}
#ifdef CONFIG_1
int bar() {
  return 42;
}
int baz() {
  return foo();
}
#else
int main() {
  return foo();
}
#endif

$ 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
Microsoft (R) Incremental Linker Version 12.00.30501.0
Copyright (C) Microsoft Corporation.  All rights reserved.

t2.obj : fatal error LNK1223: invalid or corrupt file: file contains
invalid .pdata contributions

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.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140630/9af6199c/attachment.html>


More information about the llvm-commits mailing list