[PATCH] D15781: [compiler-rt] Add support for ARM EHABI to gcc_personality_v0.

Timon Van Overveldt via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 30 08:18:33 PST 2015

timonvo added a comment.

In http://reviews.llvm.org/D15781#317738, @compnerd wrote:

> I agree that there are multiple points of discussion here.  Focusing solely on __gcc_personality_v0 is probably prudent.
> I don't think that anyone has shown that the current implementation does not work on ARM.  I recall using the current implementation during testing on ARMv7.  I may be mistaken, so we should double check that.

I have actually verified that with my work on Rust. However, I'm working on providing a minimal reproducible example with plain C to show this is broken.

> The reason that I'm unhappy about changing the signature here is because this is not a generic routine, it is a language specific implementation.

Which, depending on the type of exceptions being targeted, *must* have a different signature (Dwarf, SJLJ, EHABI). Note that it is *not* the C spec which defines what the function signature of the C PR must look like. It is the chosen language-independent exception ABI that defines that (see below for more details).

>   The change actually breaks ABI.

Yes, this breaks ABI with previous versions. But I'm arguing that previous versions' ABI was broken on ARM EHABI.

> The reason that you are able to generate references in your example is due to the C specific exception handling.  It is similar to using C++ with exceptions and seeing references to __gxx_personality_v0.


> AFAIR, EHABI has no bearing on the language specific handling which is why it doesn't matter if this routine doesn't match its signature.

Well, while the ARM EHABI spec does leave room for language-specific handling of exceptions, it does actually specify a) how personality routines are called, b) those personality routines' signatures (regardless of target language).

From the ARM EHABI doc, Sec 6.1:

> The language-independent unwinding library described in §7 calls the personality routine to unwind a single stack

>  frame. The arguments passed to the personality routine contain pointers to the function being unwound and its

>  exception-handling table entry (see §7.2).

The language-independent unwinding library would be LLVM's libunwind in this case.

> The personality routine calls back to the language-independent unwinding library for various services, and calls a

>  language-semantics library to maintain the particular language semantics.

This allows the PR to implement its language-specific functionality.

> Conceptually, an exception-handling table entry begins with the address of the personality routine:


>   /* See §7.2 for details of the various _Unwind types */

>   typedef _Unwind_Reason_Code (*PersonalityRoutine)(_Unwind_State,

>            _Unwind_Control_Block *,

>            _Unwind_Context *);

This is the prescribed function signature that *all* PRs must have, since all PRs across all langauges will be called by the same language-independent library. Note that LLVM's libunwind, if built for ARM EHABI, already expects the above signature today for all PRs it will call: https://github.com/llvm-mirror/libunwind/blob/master/src/Unwind-EHABI.cpp#L514

Anyway, stay tuned for an example showing the current routine is broken on EHABI.


More information about the llvm-commits mailing list