Skip to content

Commit a1735ef

Browse files
committed
- added x32 patch, librustc* libs now build (but build then fails when trying to use unsupported x32-hosted compiler)
1 parent 4f433f7 commit a1735ef

File tree

2 files changed

+156
-1
lines changed

2 files changed

+156
-1
lines changed

rust-x32.patch

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
--- rustc-1.44.1-src/src/librustc_errors/lib.rs.orig 2020-06-17 22:17:05.000000000 +0200
2+
+++ rustc-1.44.1-src/src/librustc_errors/lib.rs 2020-09-19 16:51:37.200375178 +0200
3+
@@ -42,7 +42,7 @@
4+
5+
// `PResult` is used a lot. Make sure it doesn't unintentionally get bigger.
6+
// (See also the comment on `DiagnosticBuilderInner`.)
7+
-#[cfg(target_arch = "x86_64")]
8+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
9+
rustc_data_structures::static_assert_size!(PResult<'_, bool>, 16);
10+
11+
/// Indicates the confidence in the correctness of a suggestion.
12+
--- rustc-1.44.1-src/src/librustc_ast/ast.rs.orig 2020-06-17 22:17:05.000000000 +0200
13+
+++ rustc-1.44.1-src/src/librustc_ast/ast.rs 2020-09-19 20:00:01.696079898 +0200
14+
@@ -1011,7 +1011,7 @@
15+
}
16+
17+
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
18+
-#[cfg(target_arch = "x86_64")]
19+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
20+
rustc_data_structures::static_assert_size!(Expr, 96);
21+
22+
impl Expr {
23+
--- rustc-1.44.1-src/src/librustc_ast/token.rs.orig 2020-06-17 22:17:05.000000000 +0200
24+
+++ rustc-1.44.1-src/src/librustc_ast/token.rs 2020-09-19 20:00:34.444494028 +0200
25+
@@ -757,7 +757,7 @@
26+
}
27+
28+
// `Nonterminal` is used a lot. Make sure it doesn't unintentionally get bigger.
29+
-#[cfg(target_arch = "x86_64")]
30+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
31+
rustc_data_structures::static_assert_size!(Nonterminal, 40);
32+
33+
impl Nonterminal {
34+
--- rustc-1.44.1-src/src/librustc_ast/tokenstream.rs.orig 2020-06-17 22:17:05.000000000 +0200
35+
+++ rustc-1.44.1-src/src/librustc_ast/tokenstream.rs 2020-09-19 20:01:08.269632279 +0200
36+
@@ -147,7 +147,7 @@
37+
pub type TreeAndJoint = (TokenTree, IsJoint);
38+
39+
// `TokenStream` is used a lot. Make sure it doesn't unintentionally get bigger.
40+
-#[cfg(target_arch = "x86_64")]
41+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
42+
rustc_data_structures::static_assert_size!(TokenStream, 8);
43+
44+
#[derive(Clone, Copy, Debug, PartialEq, RustcEncodable, RustcDecodable)]
45+
--- rustc-1.44.1-src/src/librustc_middle/mir/mod.rs.orig 2020-06-17 22:17:05.000000000 +0200
46+
+++ rustc-1.44.1-src/src/librustc_middle/mir/mod.rs 2020-09-19 21:14:39.635242732 +0200
47+
@@ -1557,7 +1557,7 @@
48+
}
49+
50+
// `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
51+
-#[cfg(target_arch = "x86_64")]
52+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
53+
static_assert_size!(Statement<'_>, 32);
54+
55+
impl Statement<'_> {
56+
@@ -1810,7 +1810,7 @@
57+
impl<'tcx> Copy for PlaceElem<'tcx> {}
58+
59+
// At least on 64 bit systems, `PlaceElem` should not be larger than two pointers.
60+
-#[cfg(target_arch = "x86_64")]
61+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
62+
static_assert_size!(PlaceElem<'_>, 16);
63+
64+
/// Alias for projections as they appear in `UserTypeProjection`, where we
65+
--- rustc-1.44.1-src/src/librustc_middle/mir/tcx.rs.orig 2020-06-17 22:17:05.000000000 +0200
66+
+++ rustc-1.44.1-src/src/librustc_middle/mir/tcx.rs 2020-09-19 21:15:10.600202818 +0200
67+
@@ -18,7 +18,7 @@
68+
}
69+
70+
// At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers.
71+
-#[cfg(target_arch = "x86_64")]
72+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
73+
static_assert_size!(PlaceTy<'_>, 16);
74+
75+
impl<'tcx> PlaceTy<'tcx> {
76+
--- rustc-1.44.1-src/src/librustc_middle/traits/mod.rs.orig 2020-06-17 22:17:05.000000000 +0200
77+
+++ rustc-1.44.1-src/src/librustc_middle/traits/mod.rs 2020-09-19 21:15:40.648448077 +0200
78+
@@ -276,7 +276,7 @@
79+
}
80+
81+
// `ObligationCauseCode` is used a lot. Make sure it doesn't unintentionally get bigger.
82+
-#[cfg(target_arch = "x86_64")]
83+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
84+
static_assert_size!(ObligationCauseCode<'_>, 32);
85+
86+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
87+
--- rustc-1.44.1-src/src/librustc_middle/ty/mod.rs.orig 2020-06-17 22:17:05.000000000 +0200
88+
+++ rustc-1.44.1-src/src/librustc_middle/ty/mod.rs 2020-09-19 21:16:08.469909685 +0200
89+
@@ -614,7 +614,7 @@
90+
}
91+
92+
// `TyS` is used a lot. Make sure it doesn't unintentionally get bigger.
93+
-#[cfg(target_arch = "x86_64")]
94+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
95+
static_assert_size!(TyS<'_>, 32);
96+
97+
impl<'tcx> Ord for TyS<'tcx> {
98+
--- rustc-1.44.1-src/src/librustc_middle/ty/sty.rs.orig 2020-06-17 22:17:05.000000000 +0200
99+
+++ rustc-1.44.1-src/src/librustc_middle/ty/sty.rs 2020-09-19 21:16:35.264650688 +0200
100+
@@ -212,7 +212,7 @@
101+
}
102+
103+
// `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger.
104+
-#[cfg(target_arch = "x86_64")]
105+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
106+
static_assert_size!(TyKind<'_>, 24);
107+
108+
/// A closure can be modeled as a struct that looks like:
109+
--- rustc-1.44.1-src/src/librustc_infer/traits/mod.rs.orig 2020-06-17 22:17:05.000000000 +0200
110+
+++ rustc-1.44.1-src/src/librustc_infer/traits/mod.rs 2020-09-19 22:11:38.115874035 +0200
111+
@@ -57,7 +57,7 @@
112+
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
113+
114+
// `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
115+
-#[cfg(target_arch = "x86_64")]
116+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
117+
static_assert_size!(PredicateObligation<'_>, 112);
118+
119+
pub type Obligations<'tcx, O> = Vec<Obligation<'tcx, O>>;
120+
--- rustc-1.44.1-src/src/librustc_trait_selection/traits/fulfill.rs.orig 2020-06-17 22:17:05.000000000 +0200
121+
+++ rustc-1.44.1-src/src/librustc_trait_selection/traits/fulfill.rs 2020-09-20 07:47:50.724260889 +0200
122+
@@ -80,7 +80,7 @@
123+
}
124+
125+
// `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
126+
-#[cfg(target_arch = "x86_64")]
127+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
128+
static_assert_size!(PendingPredicateObligation<'_>, 136);
129+
130+
impl<'a, 'tcx> FulfillmentContext<'tcx> {
131+
--- rustc-1.44.1-src/src/librustc_trait_selection/lib.rs.orig 2020-06-17 22:17:05.000000000 +0200
132+
+++ rustc-1.44.1-src/src/librustc_trait_selection/lib.rs 2020-09-20 09:46:06.127051487 +0200
133+
@@ -22,7 +22,7 @@
134+
135+
#[macro_use]
136+
extern crate rustc_macros;
137+
-#[cfg(target_arch = "x86_64")]
138+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
139+
#[macro_use]
140+
extern crate rustc_data_structures;
141+
#[macro_use]
142+
--- rustc-1.44.1-src/src/librustc_mir_build/hair/mod.rs.orig 2020-06-17 22:17:05.000000000 +0200
143+
+++ rustc-1.44.1-src/src/librustc_mir_build/hair/mod.rs 2020-09-20 11:22:53.936804032 +0200
144+
@@ -94,7 +94,7 @@
145+
}
146+
147+
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
148+
-#[cfg(target_arch = "x86_64")]
149+
+#[cfg(all(target_arch = "x86_64", target_pointer_size = "64"))]
150+
rustc_data_structures::static_assert_size!(Expr<'_>, 168);
151+
152+
/// The Hair trait implementor lowers their expressions (`&'tcx H::Expr`)

rust.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-std-%{bootstra
4949
# Source3-md5: 4b07c6922a0965791cf8eb28fee9e89d
5050
Source4: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-aarch64-unknown-linux-gnu.tar.xz
5151
# Source4-md5: 3a9d54ab96f96664b2f6077cccb4e70b
52+
Patch0: %{name}-x32.patch
5253
URL: https://www.rust-lang.org/
5354
# for src/compiler-rt
5455
BuildRequires: cmake >= 3.4.3
@@ -225,9 +226,10 @@ Dopełnianie parametrów polecenia cargo w powłoce Zsh.
225226

226227
%prep
227228
%setup -q -n %{rustc_package}
229+
%patch0 -p1
228230

229231
%if %{with bootstrap}
230-
%ifarch %{x8664}
232+
%ifarch %{x8664} x32
231233
tar xf %{SOURCE1}
232234
%endif
233235
%ifarch %{ix86}
@@ -278,6 +280,7 @@ find vendor -name .cargo-checksum.json \
278280
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
279281

280282
%build
283+
export PKG_CONFIG_ALLOW_CROSS=1
281284
%configure \
282285
--build=%{rust_triple} \
283286
--host=%{rust_triple} \

0 commit comments

Comments
 (0)