1 |
commit: c55af828a1fb64a8937a939d3e84e80ada990ed6 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 26 16:02:38 2022 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 26 16:36:02 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c55af828 |
7 |
|
8 |
dev-lang/rust: add miri patch to 1.61.0-r1 |
9 |
|
10 |
PR: https://github.com/gentoo/gentoo/pull/25638 |
11 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
12 |
|
13 |
dev-lang/rust/files/1.61.0-miri-cow.patch | 98 +++++++++++++++++++++++++++++++ |
14 |
dev-lang/rust/rust-1.61.0-r1.ebuild | 1 + |
15 |
2 files changed, 99 insertions(+) |
16 |
|
17 |
diff --git a/dev-lang/rust/files/1.61.0-miri-cow.patch b/dev-lang/rust/files/1.61.0-miri-cow.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..fc469731e4f7 |
20 |
--- /dev/null |
21 |
+++ b/dev-lang/rust/files/1.61.0-miri-cow.patch |
22 |
@@ -0,0 +1,98 @@ |
23 |
+From 830cc58f8a10598f4caa337ca97be51741945499 Mon Sep 17 00:00:00 2001 |
24 |
+From: Ralf Jung <post@×××××.de> |
25 |
+Date: Sun, 3 Apr 2022 20:00:03 -0400 |
26 |
+Subject: [PATCH] rustup |
27 |
+ |
28 |
+gyakovlev: changed paths and removed irrelevant bits |
29 |
+--- |
30 |
+ rust-version | 2 +- |
31 |
+ src/helpers.rs | 4 ++-- |
32 |
+ src/machine.rs | 2 +- |
33 |
+ src/shims/env.rs | 2 +- |
34 |
+ src/shims/foreign_items.rs | 4 ++-- |
35 |
+ src/shims/posix/foreign_items.rs | 2 +- |
36 |
+ 6 files changed, 8 insertions(+), 8 deletions(-) |
37 |
+ |
38 |
+diff --git a/src/helpers.rs b/src/helpers.rs |
39 |
+index 3ffb983aa..7a63bb03d 100644 |
40 |
+--- a/src/tools/miri/src/helpers.rs |
41 |
++++ b/src/tools/miri/src/helpers.rs |
42 |
+@@ -510,7 +510,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx |
43 |
+ let this = self.eval_context_mut(); |
44 |
+ let target = &this.tcx.sess.target; |
45 |
+ let target_os = &target.os; |
46 |
+- let last_error = if target.families.contains(&"unix".to_owned()) { |
47 |
++ let last_error = if target.families.iter().any(|f| f == "unix") { |
48 |
+ this.eval_libc(match err_kind { |
49 |
+ ConnectionRefused => "ECONNREFUSED", |
50 |
+ ConnectionReset => "ECONNRESET", |
51 |
+@@ -534,7 +534,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx |
52 |
+ ) |
53 |
+ } |
54 |
+ })? |
55 |
+- } else if target.families.contains(&"windows".to_owned()) { |
56 |
++ } else if target.families.iter().any(|f| f == "windows") { |
57 |
+ // FIXME: we have to finish implementing the Windows equivalent of this. |
58 |
+ this.eval_windows( |
59 |
+ "c", |
60 |
+diff --git a/src/machine.rs b/src/machine.rs |
61 |
+index e9ed50724..b4b07a61a 100644 |
62 |
+--- a/src/tools/miri/src/machine.rs |
63 |
++++ b/src/tools/miri/src/machine.rs |
64 |
+@@ -227,7 +227,7 @@ impl MemoryExtra { |
65 |
+ pub fn init_extern_statics<'tcx, 'mir>( |
66 |
+ this: &mut MiriEvalContext<'mir, 'tcx>, |
67 |
+ ) -> InterpResult<'tcx> { |
68 |
+- match this.tcx.sess.target.os.as_str() { |
69 |
++ match this.tcx.sess.target.os.as_ref() { |
70 |
+ "linux" => { |
71 |
+ // "environ" |
72 |
+ Self::add_extern_static( |
73 |
+diff --git a/src/shims/env.rs b/src/shims/env.rs |
74 |
+index c2050647a..822bef56c 100644 |
75 |
+--- a/src/tools/miri/src/shims/env.rs |
76 |
++++ b/src/src/tools/miri/shims/env.rs |
77 |
+@@ -41,7 +41,7 @@ impl<'tcx> EnvVars<'tcx> { |
78 |
+ mut excluded_env_vars: Vec<String>, |
79 |
+ forwarded_env_vars: Vec<String>, |
80 |
+ ) -> InterpResult<'tcx> { |
81 |
+- let target_os = ecx.tcx.sess.target.os.as_str(); |
82 |
++ let target_os = ecx.tcx.sess.target.os.as_ref(); |
83 |
+ // HACK: Exclude `TERM` var to avoid terminfo trying to open the termcap file. |
84 |
+ // This is (a) very slow and (b) does not work on Windows. |
85 |
+ excluded_env_vars.push("TERM".to_owned()); |
86 |
+diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs |
87 |
+index ecffd310d..d9e4d9382 100644 |
88 |
+--- a/src/tools/miri/src/shims/foreign_items.rs |
89 |
++++ b/src/tools/miri/src/shims/foreign_items.rs |
90 |
+@@ -46,7 +46,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx |
91 |
+ fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align { |
92 |
+ let this = self.eval_context_ref(); |
93 |
+ // List taken from `libstd/sys_common/alloc.rs`. |
94 |
+- let min_align = match this.tcx.sess.target.arch.as_str() { |
95 |
++ let min_align = match this.tcx.sess.target.arch.as_ref() { |
96 |
+ "x86" | "arm" | "mips" | "powerpc" | "powerpc64" | "asmjs" | "wasm32" => 8, |
97 |
+ "x86_64" | "aarch64" | "mips64" | "s390x" | "sparc64" => 16, |
98 |
+ arch => bug!("Unsupported target architecture: {}", arch), |
99 |
+@@ -695,7 +695,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx |
100 |
+ } |
101 |
+ |
102 |
+ // Platform-specific shims |
103 |
+- _ => match this.tcx.sess.target.os.as_str() { |
104 |
++ _ => match this.tcx.sess.target.os.as_ref() { |
105 |
+ "linux" | "macos" => return shims::posix::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret), |
106 |
+ "windows" => return shims::windows::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret), |
107 |
+ target => throw_unsup_format!("the target `{}` is not supported", target), |
108 |
+diff --git a/src/shims/posix/foreign_items.rs b/src/shims/posix/foreign_items.rs |
109 |
+index 02fb7089c..36bf53059 100644 |
110 |
+--- a/src/tools/miri/src/shims/posix/foreign_items.rs |
111 |
++++ b/src/tools/miri/src/shims/posix/foreign_items.rs |
112 |
+@@ -462,7 +462,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx |
113 |
+ |
114 |
+ // Platform-specific shims |
115 |
+ _ => { |
116 |
+- match this.tcx.sess.target.os.as_str() { |
117 |
++ match this.tcx.sess.target.os.as_ref() { |
118 |
+ "linux" => return shims::posix::linux::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret), |
119 |
+ "macos" => return shims::posix::macos::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret), |
120 |
+ _ => unreachable!(), |
121 |
|
122 |
diff --git a/dev-lang/rust/rust-1.61.0-r1.ebuild b/dev-lang/rust/rust-1.61.0-r1.ebuild |
123 |
index f8852b27e97e..2e877f2f2bdd 100644 |
124 |
--- a/dev-lang/rust/rust-1.61.0-r1.ebuild |
125 |
+++ b/dev-lang/rust/rust-1.61.0-r1.ebuild |
126 |
@@ -158,6 +158,7 @@ PATCHES=( |
127 |
"${FILESDIR}"/1.61.0-gentoo-musl-target-specs.patch |
128 |
"${FILESDIR}"/1.61.0-llvm_selectInterleaveCount.patch |
129 |
"${FILESDIR}"/1.61.0-llvm_addrspacecast.patch |
130 |
+ "${FILESDIR}"/1.61.0-miri-cow.patch |
131 |
) |
132 |
|
133 |
S="${WORKDIR}/${MY_P}-src" |