@@ -5,7 +5,7 @@ Contains ad hoc patches for cross building.
5
5
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
6
6
From: Kleis Auke Wolthuizen <
[email protected] >
7
7
Date: Tue, 15 Sep 2020 11:50:00 +0200
8
- Subject: [PATCH 1/4 ] Add `armv7-pc-windows-gnullvm` triple
8
+ Subject: [PATCH 1/5 ] Add `armv7-pc-windows-gnullvm` triple
9
9
10
10
Upstream-Status: Pending
11
11
@@ -48,11 +48,7 @@ index 1111111..2222222 100644
48
48
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
49
49
From: Kleis Auke Wolthuizen <
[email protected] >
50
50
Date: Tue, 22 Sep 2020 10:00:00 +0200
51
- Subject: [PATCH 2/4] Ensure that std/unwind can be successfully built on
52
- llvm-mingw
53
-
54
- Fixes undefined symbol errors while linking these crates on llvm-mingw
55
- (targeting ARMv7).
51
+ Subject: [PATCH 2/5] std/unwind: Fix linker errors on `armv7-pc-windows-gnullvm`
56
52
57
53
Details:
58
54
ld.lld: error: undefined symbol: __gnu_unwind_frame
@@ -105,7 +101,7 @@ index 1111111..2222222 100644
105
101
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
106
102
From: Kleis Auke Wolthuizen <
[email protected] >
107
103
Date: Tue, 30 Aug 2022 23:20:27 +0200
108
- Subject: [PATCH 3/4 ] windows-gnullvm: avoid linking to libunwind statically
104
+ Subject: [PATCH 3/5 ] windows-gnullvm: Avoid linking to libunwind statically
109
105
110
106
Avoid linking against the static variant of libunwind, which is not
111
107
always available. Instead, prefer to use the unwind library from the
@@ -161,7 +157,7 @@ index 1111111..2222222 100644
161
157
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
162
158
From: Kleis Auke Wolthuizen <
[email protected] >
163
159
Date: Mon, 17 Oct 2022 11:50:00 +0200
164
- Subject: [PATCH 4/4 ] Use GCC-style unwinding on MinGW targets other than i686
160
+ Subject: [PATCH 4/5 ] Use GCC-style unwinding on MinGW targets other than i686
165
161
166
162
See: https://github.com/msys2/MINGW-packages/pull/13278
167
163
@@ -206,3 +202,80 @@ index 1111111..2222222 100644
206
202
// We declare these as opaque types. This is fine since you just need to
207
203
// pass them to _GCC_specific_handler and forget about them.
208
204
pub enum EXCEPTION_RECORD {}
205
+
206
+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
207
+ From: Kleis Auke Wolthuizen <
[email protected] >
208
+ Date: Sat, 4 Nov 2023 12:01:36 +0100
209
+ Subject: [PATCH 5/5] backtrace-rs: Fix build errors on `armv7-pc-windows-gnullvm`
210
+
211
+ Resolves: https://github.com/rust-lang/backtrace-rs/issues/572
212
+
213
+ Upstream-Status: Submitted [https://github.com/rust-lang/backtrace-rs/pull/573]
214
+
215
+ diff --git a/library/backtrace/src/backtrace/dbghelp.rs b/library/backtrace/src/backtrace/dbghelp.rs
216
+ index 1111111..2222222 100644
217
+ --- a/library/backtrace/src/backtrace/dbghelp.rs
218
+ +++ b/library/backtrace/src/backtrace/dbghelp.rs
219
+ @@ -167,11 +167,21 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
220
+ Some(StackWalkEx) => {
221
+ let mut stack_frame_ex: STACKFRAME_EX = mem::zeroed();
222
+ stack_frame_ex.StackFrameSize = mem::size_of::<STACKFRAME_EX>() as DWORD;
223
+ - stack_frame_ex.AddrPC.Offset = context.0.Eip as u64;
224
+ +
225
+ + cfg_if::cfg_if! {
226
+ + if #[cfg(target_arch = "x86")] {
227
+ + stack_frame_ex.AddrPC.Offset = context.0.Eip as u64;
228
+ + stack_frame_ex.AddrStack.Offset = context.0.Esp as u64;
229
+ + stack_frame_ex.AddrFrame.Offset = context.0.Ebp as u64;
230
+ + } else {
231
+ + stack_frame_ex.AddrPC.Offset = context.0.Pc as u64;
232
+ + stack_frame_ex.AddrStack.Offset = context.0.Sp as u64;
233
+ + stack_frame_ex.AddrFrame.Offset = context.0.R11 as u64;
234
+ + }
235
+ + }
236
+ +
237
+ stack_frame_ex.AddrPC.Mode = AddrModeFlat;
238
+ - stack_frame_ex.AddrStack.Offset = context.0.Esp as u64;
239
+ stack_frame_ex.AddrStack.Mode = AddrModeFlat;
240
+ - stack_frame_ex.AddrFrame.Offset = context.0.Ebp as u64;
241
+ stack_frame_ex.AddrFrame.Mode = AddrModeFlat;
242
+
243
+ while StackWalkEx(
244
+ @@ -205,11 +215,21 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
245
+ }
246
+ None => {
247
+ let mut stack_frame64: STACKFRAME64 = mem::zeroed();
248
+ - stack_frame64.AddrPC.Offset = context.0.Eip as u64;
249
+ +
250
+ + cfg_if::cfg_if! {
251
+ + if #[cfg(target_arch = "x86")] {
252
+ + stack_frame64.AddrPC.Offset = context.0.Eip as u64;
253
+ + stack_frame64.AddrStack.Offset = context.0.Esp as u64;
254
+ + stack_frame64.AddrFrame.Offset = context.0.Ebp as u64;
255
+ + } else {
256
+ + stack_frame64.AddrPC.Offset = context.0.Pc as u64;
257
+ + stack_frame64.AddrStack.Offset = context.0.Sp as u64;
258
+ + stack_frame64.AddrFrame.Offset = context.0.R11 as u64;
259
+ + }
260
+ + }
261
+ +
262
+ stack_frame64.AddrPC.Mode = AddrModeFlat;
263
+ - stack_frame64.AddrStack.Offset = context.0.Esp as u64;
264
+ stack_frame64.AddrStack.Mode = AddrModeFlat;
265
+ - stack_frame64.AddrFrame.Offset = context.0.Ebp as u64;
266
+ stack_frame64.AddrFrame.Mode = AddrModeFlat;
267
+
268
+ while dbghelp.StackWalk64()(
269
+ diff --git a/library/backtrace/src/lib.rs b/library/backtrace/src/lib.rs
270
+ index 1111111..2222222 100644
271
+ --- a/library/backtrace/src/lib.rs
272
+ +++ b/library/backtrace/src/lib.rs
273
+ @@ -194,7 +194,7 @@ mod lock {
274
+
275
+ #[cfg(all(
276
+ windows,
277
+ - any(target_env = "msvc", all(target_env = "gnu", target_arch = "x86")),
278
+ + any(target_env = "msvc", all(target_env = "gnu", any(target_arch = "x86", target_arch = "arm"))),
279
+ not(target_vendor = "uwp")
280
+ ))]
281
+ mod dbghelp;
0 commit comments