[libcxx-commits] [PATCH] D73838: [libcxxabi] Fix layout of __cxa_exception for win64, fixing static assert failures
John McCall via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 2 09:32:36 PST 2020
rjmccall added a comment.
In D73838#1853482 <https://reviews.llvm.org/D73838#1853482>, @mstorsjo wrote:
> In D73838#1853443 <https://reviews.llvm.org/D73838#1853443>, @steven_wu wrote:
>
> > Looks like this is an ABI change for WIN64. If that is intended then LGTM
>
>
> I think that's ok - I don't think it's worth complicating this further to preserve compatibility with a previous binary layout which was accidental (using !LP64 layout on a platform with 64 bit pointers).
Yeah, I think it's okay to consider this a bug.
> I presume this is a break for cases where an exception is thrown across libraries that have statically linked different versions of libcxxabi?
You really aren't supposed to redundantly statically link libcxxabi like that; there are things in there that need to be unique.
> For cases where libcxxabi is linked in dynamically, all modules would be using the same copy of libcxxabi (either old or new) and it'd be consistent? I presume the `__cxa_exception` offsets don't end up in the calling application's binary anywhere, unless statically linked?
It's supposed to have a stable layout (modulo the ability to extend it with prefixes). However, I'm not aware of any direct use of its fields by the compiler.
> Is the layout of `__cxa_exception` supposed to match that of libgcc/libstdc++/libsupc++? Because they don't have e.g. the reference count stuck in a padding hole for 32 bit architectures.
That's interesting. Most details of the layout are indeed supposed to be portable across compilers and runtimes.
> In D73838#1853450 <https://reviews.llvm.org/D73838#1853450>, @rjmccall wrote:
>
>> There's a Windows-based target that uses libUnwind-based exceptions?
>
>
> MinGW toolchains normally use libgcc/libstdc++, but one can build a toolchain that uses libunwind/libcxxabi/libcxx instead; I distribute such a toolchain at https://github.com/mstorsjo/llvm-mingw. But I don't really give any ABI guarantees; I've e.g. switched unwinding mechanisms (between dwarf, sjlj and SEH) before, to avoid bugs until they're fixed properly.
Okay.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73838/new/
https://reviews.llvm.org/D73838
More information about the libcxx-commits
mailing list