[PATCH] D38940: Make x86 __ehhandler comdat if parent function is

Dave Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 20:47:34 PDT 2017


kastiglione added a comment.

> do an IR level check for this

running `clang -target i686-windows-msvc -S -emit-llvm -o - input.cpp` generates IR for the function, but not for the __ehhandler thunk. I think the __ehhandler encapsulated by the `cleanuppad`, and if so are there flags to get the IR through the passes that generate the thunk?

> BTW, I think that this is sufficient to show the behavior in MSVC:

In the code you provided, `f` and its xdata are not comdat. I believe the problem only arises when the xdata is comdat and then dropped by the linker, leaving the __ehhandler with relocations to a discarded section. The code I tested with uses an inline member function to generate a comdat function, and a free function to call and materialize the member function. This also mirrors the real code that I first saw this happen with.


https://reviews.llvm.org/D38940





More information about the llvm-commits mailing list