[vlc-commits] [Git][videolan/vlc][master] contrib: rav1e: Extend the patch for providing _Unwind_Resume

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Nov 25 19:06:30 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
23fb14cb by Martin Storsjö at 2022-11-25T18:25:33+00:00
contrib: rav1e: Extend the patch for providing _Unwind_Resume

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

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.

- - - - -


1 changed file:

- contrib/src/rav1e/unwind-resume-stub.patch


Changes:

=====================================
contrib/src/rav1e/unwind-resume-stub.patch
=====================================
@@ -1,27 +1,55 @@
-From 30b9e63817bf60c3cab0bc6cebb073ee2344ac34 Mon Sep 17 00:00:00 2001
+From d186b5350e425a82dbd4513b5d629dc892c3c4a5 Mon Sep 17 00:00:00 2001
 From: Tristan Matthews <tmatth at videolan.org>
 Date: Fri, 25 Feb 2022 12:30:01 -0500
-Subject: [PATCH 1/1] lib: workaround for
+Subject: [PATCH] lib: workaround for
  https://github.com/rust-lang/rust/issues/79609
 
 This avoids to broken linking on some mingw32 versions. The function
 will never be called since we set `-C panic=abort`.
 ---
- src/lib.rs | 4 ++++
- 1 file changed, 4 insertions(+)
+ src/lib.rs | 32 ++++++++++++++++++++++++++++++++
+ 1 file changed, 32 insertions(+)
 
 diff --git a/src/lib.rs b/src/lib.rs
-index 63afa2d5..412bb0e0 100644
+index 3425588d..1b645340 100644
 --- a/src/lib.rs
 +++ b/src/lib.rs
-@@ -389,3 +389,7 @@ pub mod bench {
+@@ -486,3 +486,35 @@ pub mod bench {
  
  #[cfg(fuzzing)]
  pub mod fuzzing;
 +
 +#[no_mangle]
 +#[allow(non_snake_case)]
++fn _Unwind_GetDataRelBase() {}
++
++#[no_mangle]
++#[allow(non_snake_case)]
++fn _Unwind_GetIPInfo() {}
++
++#[no_mangle]
++#[allow(non_snake_case)]
++fn _Unwind_GetLanguageSpecificData() {}
++
++#[no_mangle]
++#[allow(non_snake_case)]
++fn _Unwind_GetRegionStart() {}
++
++#[no_mangle]
++#[allow(non_snake_case)]
++fn _Unwind_GetTextRelBase() {}
++
++#[no_mangle]
++#[allow(non_snake_case)]
 +fn _Unwind_Resume() {}
++
++#[no_mangle]
++#[allow(non_snake_case)]
++fn _Unwind_SetGR() {}
++
++#[no_mangle]
++#[allow(non_snake_case)]
++fn _Unwind_SetIP() {}
 -- 
-2.32.0
+2.37.1 (Apple Git-137.1)
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/23fb14cb3cf36b4a2d06a334cb61380dd5308814

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/23fb14cb3cf36b4a2d06a334cb61380dd5308814
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list