Skip to content

contrib: rav1e: Extend the patch for providing _Unwind_Resume

Martin Storsjö requested to merge mstorsjo/vlc:rav1e-unwind-hack into master

This fixes building with llvm-mingw for i686 (which uses dwarf for unwinding on i686) after updating to Rust 1.65.0 in cb4464dd.

The problematic patch was needed for fixing build breaks with mingw toolchains that use SjLj exception handling (which is what is used in VLC's current CI builds for mingw/i686) - which is https://github.com/rust-lang/rust/issues/79609.

Rust's stdlib contains references to the _Unwind_Resume symbol (which is what the symbol is called in dwarf unwinding cases), but it's not meant to actually be called (since rav1e is built with "-C panic=abort"). If the mingw toolchain itself uses dwarf (or SEH) unwinding, then the _Unwind_Resume symbol is provided from that unwinder. But in the case of SjLj toolchains, the toolchain only provides a symbol named __Unwind_SjLj_Resume.

The patch provided a dummy _Unwind_Resume symbol as part of the rav1e build, which fixed the undefined references with SjLj toolchains.

However, since updating to Rust 1.65.0, other object files in the Rust stdlib seems to pull in more unwinding symbols (there are undefined references to e.g. _Unwind_GetRegionStart). These other symbols are named the same both in dwarf, SjLj and SEH toolchains. In the case of SjLj toolchains, they ended up pulled in from libunwind/libgcc, but in the case of dwarf or SEH toolchains, the locally defined _Unwind_Resume caused a conflict with the real one which ended up included from libunwind/libgcc.

To avoid the issue, provide all referenced symbols as similar stubs; this makes sure that the build doesn't end up pulling in anything unwinding related from libunwind/libgcc, either in SjLj or dwarf toolchains.

CC @robUx4 @tmatth. I've tested this with llvm-mingw/i686 and with the current docker image used for CI for mingw/i686 (which uses SjLj). I would expect that it should fix building with the next CI images for mingw/i686 too (which AFAIK were blocked by this issue).

Merge request reports

Loading