-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrust-1-fixes.patch
111 lines (101 loc) · 4.18 KB
/
rust-1-fixes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <mati865@gmail.com>
Date: Sat, 28 Sep 2024 11:05:03 +0200
Subject: [PATCH 1/2] control libunwind linkage mode via `crt-static` on gnullvm
targets
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/122003]
diff --git a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs
index 1111111..2222222 100644
--- a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs
+++ b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs
@@ -42,6 +42,9 @@ pub(crate) fn opts() -> TargetOptions {
eh_frame_header: false,
no_default_libraries: false,
has_thread_local: true,
+ crt_static_allows_dylibs: true,
+ crt_static_default: true,
+ crt_static_respected: true,
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
// output DWO, despite using DWARF, doesn't use ELF..
debuginfo_kind: DebuginfoKind::Pdb,
diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs
index 1111111..2222222 100644
--- a/library/unwind/src/lib.rs
+++ b/library/unwind/src/lib.rs
@@ -180,3 +180,8 @@ cfg_if::cfg_if! {
#[cfg(target_os = "hurd")]
#[link(name = "gcc_s")]
extern "C" {}
+
+#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
+#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
+#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
+extern "C" {}
diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs
index 1111111..2222222 100644
--- a/library/unwind/src/libunwind.rs
+++ b/library/unwind/src/libunwind.rs
@@ -102,12 +102,9 @@ pub type _Unwind_Exception_Cleanup_Fn =
// rustc_codegen_ssa::src::back::symbol_export, rustc_middle::middle::exported_symbols
// and RFC 2841
#[cfg_attr(
- any(
- all(
- feature = "llvm-libunwind",
- any(target_os = "fuchsia", target_os = "linux", target_os = "xous")
- ),
- all(target_os = "windows", target_env = "gnu", target_abi = "llvm")
+ all(
+ feature = "llvm-libunwind",
+ any(target_os = "fuchsia", target_os = "linux", target_os = "xous")
),
link(name = "unwind", kind = "static", modifiers = "-bundle")
)]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <github@kleisauke.nl>
Date: Tue, 16 Apr 2024 15:51:34 +0000
Subject: [PATCH 2/2] std: revert use of `raw-dylib`
See:
https://github.com/msys2/MINGW-packages/issues/21017
https://github.com/rust-lang/rust/issues/129020
diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs
index 1111111..2222222 100644
--- a/library/std/src/sys/pal/windows/c.rs
+++ b/library/std/src/sys/pal/windows/c.rs
@@ -108,13 +108,8 @@ if #[cfg(not(target_vendor = "uwp"))] {
}
}
-// Use raw-dylib to import ProcessPrng as we can't rely on there being an import library.
#[cfg(not(target_vendor = "win7"))]
-#[cfg_attr(
- target_arch = "x86",
- link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")
-)]
-#[cfg_attr(not(target_arch = "x86"), link(name = "bcryptprimitives", kind = "raw-dylib"))]
+#[link(name = "bcryptprimitives")]
extern "system" {
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
}
@@ -151,19 +146,7 @@ compat_fn_with_fallback! {
}
#[cfg(not(target_vendor = "win7"))]
-// Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library.
-#[cfg_attr(
- target_arch = "x86",
- link(
- name = "api-ms-win-core-synch-l1-2-0",
- kind = "raw-dylib",
- import_name_type = "undecorated"
- )
-)]
-#[cfg_attr(
- not(target_arch = "x86"),
- link(name = "api-ms-win-core-synch-l1-2-0", kind = "raw-dylib")
-)]
+#[link(name = "synchronization")]
extern "system" {
pub fn WaitOnAddress(
address: *const c_void,