Skip to content
Snippets Groups Projects

contrib: rav1e: Extend the patch for providing _Unwind_Resume

Merged Martin Storsjö requested to merge mstorsjo/vlc:rav1e-unwind-hack into master
  1. Nov 25, 2022
    • Martin Storsjö's avatar
      contrib: rav1e: Extend the patch for providing _Unwind_Resume · 23fb14cb
      Martin Storsjö authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      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.
      23fb14cb
Loading