Skip to content
Snippets Groups Projects
Commit 23fb14cb authored by Martin Storsjö's avatar Martin Storsjö Committed by Jean-Baptiste Kempf
Browse files

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
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.
parent 28bcf1da
No related branches found
No related tags found
1 merge request!2878contrib: rav1e: Extend the patch for providing _Unwind_Resume
Pipeline #286933 failed with stages
in 34 minutes and 44 seconds
From 30b9e63817bf60c3cab0bc6cebb073ee2344ac34 Mon Sep 17 00:00:00 2001
From d186b5350e425a82dbd4513b5d629dc892c3c4a5 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tmatth@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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment