[libunwind] Fix unwind_leaffunction test
authorLeonard Chan <leonardchan@google.com>
Fri, 3 Dec 2021 19:20:06 +0000 (11:20 -0800)
committerLeonard Chan <leonardchan@google.com>
Fri, 3 Dec 2021 19:21:20 +0000 (11:21 -0800)
commitf178a05f220403f2a9d73c7640bfcc7dc2d7be72
treeedb4c077a71ab329d4ed8f0dc4643c1b4fd72c51
parent181c4ba467c4affbea89b4b2ea8a712da3e54900
[libunwind] Fix unwind_leaffunction test

It's possible for this test not to pass if the libc used does not provide
unwind info for raise. We can replace it with __builtin_cast, which can lead
to a SIGTRAP on x86_64 and a SIGILL on aarch64.

Using this alternative, a nop is needed before the __builtin_cast. This is
because libunwind incorrectly decrements pc, which can cause pc to jump into
the previous function and use the incorrect FDE.

Differential Revision: https://reviews.llvm.org/D114818
libunwind/test/unwind_leaffunction.pass.cpp