[PATCH] D47233: [CodeGen] Emit MSVC RTTI for Obj-C EH types

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 12 10:48:40 PDT 2018


smeenai added a comment.

In https://reviews.llvm.org/D47233#1129810, @DHowett-MSFT wrote:

> In https://reviews.llvm.org/D47233#1129207, @rjmccall wrote:
>
> > In https://reviews.llvm.org/D47233#1129110, @smeenai wrote:
> >
> > > WinObjC does this wrapping, for example.
> >
> >
> > I see.  The idea of creating the type descriptors and mangled names ad-hoc for the catchable-types array is clever, and it's nice that the ABI is defined in a way that makes that work.  (Expensive, but hey, it's the exceptions path.)
>
>
> We ran into some critical issues with this approach on x64. The pointers in the exception record are supposed to be image-relative instead of absolute, so I tried to make them absolute to libobjc2's load address, but I never quite solved it.
>
> A slightly better-documented and cleaner version of the code you linked is here <https://github.com/Microsoft/libobjc2/blob/upstream-staging/eh_win32_msvc.cc>.


We solved the x64 issue by just calling RaiseException directly and supplying a fake ImageBase. It's a bit kludgy, but it works well. (_CxxThrowException's source is included with MSVC, so we just looked at how that was calling RaiseException and altered it accordingly.)


Repository:
  rC Clang

https://reviews.llvm.org/D47233





More information about the cfe-commits mailing list