Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cbc0e3c

Browse files
committedMay 26, 2022
rust: Update to 1.61.0
Fixes a number of issues in compiler/rustc_llvm regarding lib handling. This is a moving part in current rust releases... - Disabled llvm-static-stdcpp Fixes CLANG64 build error: thread 'main' panicked at 'assertion failed: !cxxflags.contains(\"stdlib=libc++\")', compiler\rustc_llvm\build.rs:351:13 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - Removed `pthread` from forced libs in compiler/rustc_llvm/build.rs `pthread` is also provided by llvm-config and having both now triggers an error about mixed link modifiers. See rust-lang/rust#97299 $ llvm-config --system-libs --link-static -lpsapi -lshell32 -lole32 -luuid -ladvapi32 -lpthread -lz -lxml2 Note that `ffi` is still forced by the patch as llvm-config does not provide it. See 0001-rustc-llvm-fix-libs.patch (replaces 0001-add-missing-libs.patch). - Rebased 0007-clang-subsystem.patch quick and dirty test
1 parent cb23dc0 commit cbc0e3c

4 files changed

+66
-55
lines changed
 

‎mingw-w64-rust/0001-add-missing-libs.patch

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- rustc-1.61.0-src/compiler/rustc_llvm/build.rs.orig 2022-05-18 03:29:36.000000000 +0200
2+
+++ rustc-1.61.0-src/compiler/rustc_llvm/build.rs 2022-05-26 16:30:44.493262300 +0200
3+
@@ -366,6 +366,6 @@
4+
// Libstdc++ depends on pthread which Rust doesn't link on MinGW
5+
// since nothing else requires it.
6+
if target.contains("windows-gnu") {
7+
- println!("cargo:rustc-link-lib=static:-bundle=pthread");
8+
+ println!("cargo:rustc-link-lib=static:-bundle=ffi");
9+
}
10+
}
+32-33
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
diff -urN rustc-1.52.1-src.orig/compiler/rustc_target/src/spec/windows_gnu_base.rs rustc-1.52.1-src/compiler/rustc_target/src/spec/windows_gnu_base.rs
2-
--- rustc-1.52.1-src.orig/compiler/rustc_target/src/spec/windows_gnu_base.rs 2021-05-09 04:52:39.000000000 +0200
3-
+++ rustc-1.52.1-src/compiler/rustc_target/src/spec/windows_gnu_base.rs 2021-06-06 22:12:33.367953300 +0200
4-
@@ -18,34 +18,13 @@
1+
--- rustc-1.61.0-src/compiler/rustc_target/src/spec/windows_gnu_base.rs.orig 2022-05-18 03:29:36.000000000 +0200
2+
+++ rustc-1.61.0-src/compiler/rustc_target/src/spec/windows_gnu_base.rs 2022-05-22 15:53:32.596861100 +0200
3+
@@ -16,34 +16,13 @@
54
],
65
);
76

@@ -11,53 +10,53 @@ diff -urN rustc-1.52.1-src.orig/compiler/rustc_target/src/spec/windows_gnu_base.
1110
- // Order of `late_link_args*` was found through trial and error to work with various
1211
- // mingw-w64 versions (not tested on the CI). It's expected to change from time to time.
1312
- let mingw_libs = vec![
14-
- "-lmsvcrt".to_string(),
15-
- "-lmingwex".to_string(),
16-
- "-lmingw32".to_string(),
17-
- "-lgcc".to_string(), // alas, mingw* libraries above depend on libgcc
13+
- "-lmsvcrt".into(),
14+
- "-lmingwex".into(),
15+
- "-lmingw32".into(),
16+
- "-lgcc".into(), // alas, mingw* libraries above depend on libgcc
1817
- // mingw's msvcrt is a weird hybrid import library and static library.
1918
- // And it seems that the linker fails to use import symbols from msvcrt
2019
- // that are required from functions in msvcrt in certain cases. For example
2120
- // `_fmode` that is used by an implementation of `__p__fmode` in x86_64.
2221
- // The library is purposely listed twice to fix that.
2322
- //
2423
- // See https://github.com/rust-lang/rust/pull/47483 for some more details.
25-
- "-lmsvcrt".to_string(),
26-
- "-luser32".to_string(),
27-
- "-lkernel32".to_string(),
24+
- "-lmsvcrt".into(),
25+
- "-luser32".into(),
26+
- "-lkernel32".into(),
2827
- ];
2928
- late_link_args.insert(LinkerFlavor::Gcc, mingw_libs.clone());
3029
- late_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), mingw_libs);
3130
let dynamic_unwind_libs = vec![
3231
// If any of our crates are dynamically linked then we need to use
3332
// the shared libgcc_s-dw2-1.dll. This is required to support
3433
// unwinding across DLL boundaries.
35-
- "-lgcc_s".to_string(),
36-
+ "-l:libunwind.dll.a".to_string(),
34+
- "-lgcc_s".into(),
35+
+ "-l:libunwind.dll.a".into(),
3736
];
3837
late_link_args_dynamic.insert(LinkerFlavor::Gcc, dynamic_unwind_libs.clone());
3938
late_link_args_dynamic.insert(LinkerFlavor::Lld(LldFlavor::Ld), dynamic_unwind_libs);
40-
@@ -55,8 +34,7 @@
39+
@@ -53,8 +32,7 @@
4140
// binaries to be redistributed without the libgcc_s-dw2-1.dll
4241
// dependency, but unfortunately break unwinding across DLL
4342
// boundaries when unwinding across FFI boundaries.
44-
- "-lgcc_eh".to_string(),
45-
- "-l:libpthread.a".to_string(),
46-
+ "-l:libunwind.a".to_string(),
43+
- "-lgcc_eh".into(),
44+
- "-l:libpthread.a".into(),
45+
+ "-l:libunwind.a".into(),
4746
];
4847
late_link_args_static.insert(LinkerFlavor::Gcc, static_unwind_libs.clone());
4948
late_link_args_static.insert(LinkerFlavor::Lld(LldFlavor::Ld), static_unwind_libs);
50-
@@ -66,7 +44,8 @@
51-
env: "gnu".to_string(),
52-
vendor: "pc".to_string(),
49+
@@ -64,7 +42,8 @@
50+
env: "gnu".into(),
51+
vendor: "pc".into(),
5352
// FIXME(#13846) this should be enabled for windows
5453
- function_sections: false,
5554
+ function_sections: true,
5655
+ no_default_libraries: false,
57-
linker: Some("gcc".to_string()),
56+
linker: Some("gcc".into()),
5857
dynamic_linking: true,
5958
executables: true,
60-
@@ -84,7 +63,6 @@
59+
@@ -80,7 +59,6 @@
6160
pre_link_objects_fallback: crt_objects::pre_mingw_fallback(),
6261
post_link_objects_fallback: crt_objects::post_mingw_fallback(),
6362
crt_objects_fallback: Some(CrtObjectsFallback::Mingw),
@@ -81,25 +80,25 @@ diff -urN rustc-1.53.0-src/src/bootstrap/bootstrap.py.orig rustc-1.53.0-src/src/
8180
if self.rustfmt() and self.rustfmt().startswith(bin_root) and (
8281
not os.path.exists(self.rustfmt())
8382
or self.program_out_of_date(self.rustfmt_stamp(), self.rustfmt_channel)
84-
--- rustc-1.57.0-src/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs.orig 2022-02-18 14:41:41.509000000 +0100
85-
+++ rustc-1.57.0-src/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs 2022-02-18 14:41:49.361435000 +0100
83+
--- rustc-1.61.0-src/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs.orig 2022-05-22 16:08:33.258876100 +0200
84+
+++ rustc-1.61.0-src/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs 2022-05-22 16:13:31.577741200 +0200
8685
@@ -7,7 +7,7 @@
8786
.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".to_string(), "i386pe".to_string()]);
8887
base.max_atomic_width = Some(64);
8988
base.frame_pointer = FramePointer::Always; // Required for backtraces
90-
- base.linker = Some("i686-w64-mingw32-gcc".to_string());
91-
+ base.linker = Some("i686-w64-mingw32-clang".to_string());
92-
89+
- base.linker = Some("i686-w64-mingw32-gcc".into());
90+
+ base.linker = Some("i686-w64-mingw32-clang".into());
91+
9392
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
9493
// space available to x86 Windows binaries on x86_64.
95-
--- rustc-1.57.0-src/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs.orig 2022-02-18 14:41:21.116000000 +0100
96-
+++ rustc-1.57.0-src/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs 2022-02-18 14:41:24.641880900 +0100
94+
--- rustc-1.61.0-src/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs.orig 2022-05-22 16:08:33.258876100 +0200
95+
+++ rustc-1.61.0-src/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs 2022-05-22 16:13:31.577741200 +0200
9796
@@ -10,7 +10,7 @@
9897
base.pre_link_args
99-
.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".to_string(), "i386pep".to_string()]);
98+
.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".into(), "i386pep".into()]);
10099
base.max_atomic_width = Some(64);
101-
- base.linker = Some("x86_64-w64-mingw32-gcc".to_string());
102-
+ base.linker = Some("x86_64-w64-mingw32-clang".to_string());
100+
- base.linker = Some("x86_64-w64-mingw32-gcc".into());
101+
+ base.linker = Some("x86_64-w64-mingw32-clang".into());
103102

104103
Target {
105-
llvm_target: "x86_64-pc-windows-gnu".to_string(),
104+
llvm_target: "x86_64-pc-windows-gnu".into(),

‎mingw-w64-rust/PKGBUILD

+24-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ _bootstrapping=yes
77
pkgbase=mingw-w64-${_realname}
88
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
99
"${MINGW_PACKAGE_PREFIX}-rust-docs")
10-
pkgver=1.60.0
10+
pkgver=1.61.0
1111
pkgrel=1
1212
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
1313
arch=('any')
@@ -31,34 +31,47 @@ options=('staticlibs' 'strip')
3131
#install=rust.install
3232
noextract=(${_realname}c-${pkgver}-src.tar.gz)
3333
source=("https://static.rust-lang.org/dist/${_realname}c-${pkgver}-src.tar.gz"{,.asc}
34-
"0001-add-missing-libs.patch"
34+
"0001-rustc-llvm-fix-libs.patch"
3535
"0004-unbundle-gcc.patch"
3636
"0005-win32-config.patch"
3737
"0007-clang-subsystem.patch"
3838
"0008-disable-self-contained.patch")
39-
sha256sums=('20ca826d1cf674daf8e22c4f8c4b9743af07973211c839b85839742314c838b7'
39+
sha256sums=('ad0b4351675aa9abdf4c7e066613bd274c4391c5506db152983426376101daed'
4040
'SKIP'
41-
'8c9c37f2ff3bee7d9ac520c66d3f37fd7f002012ddca4ddeeab2b009f520e4ce'
41+
'a069c402609589aa312937550d1ca7cd5985c790eaaeb0a0a735e8eb1f28557c'
4242
'6cc3234644768e24824e455d6304585c717ae25aa53ebf9cf1f1dea87bf869b7'
4343
'c4e5ffeef84296d39c3e3e8f807fc8b33ce786b1e4edb21eef26b053586aca27'
44-
'c79d91a7419e8b0da76295c3d64aa5e984851c7e03b778f6230a660a010c9a66'
44+
'4a5801c7d5169a68541d5af9accb311624764ef29c853a31c48909179ab208de'
4545
'29f84cb8e05ce304e102e28912a3b4464add406a8ec37a6c6d717b9b7d81b67b')
4646
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE' # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
4747
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <tstellar@redhat.com>
4848
'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
4949

50+
# =========================================== #
51+
# Helper macros to help make tasks easier #
52+
apply_patch_with_msg() {
53+
for _patch in "$@"
54+
do
55+
msg2 "Applying ${_patch}"
56+
patch -Nbp1 -i "${srcdir}/${_patch}"
57+
done
58+
}
59+
# =========================================== #
60+
5061
prepare() {
5162
[[ -d ${srcdir}/${_realname}c-${pkgver}-src ]] && rm -rf ${srcdir}/${_realname}c-${pkgver}-src
5263
tar -xzf ${srcdir}/${_realname}c-${pkgver}-src.tar.gz -C ${srcdir} || true
5364

5465
cd ${srcdir}/${_realname}c-${pkgver}-src
55-
patch -p1 -i "${srcdir}/0001-add-missing-libs.patch"
56-
patch -p1 -i "${srcdir}/0004-unbundle-gcc.patch"
57-
patch -p1 -i "${srcdir}/0005-win32-config.patch"
58-
patch -p1 -i "${srcdir}/0008-disable-self-contained.patch"
66+
apply_patch_with_msg \
67+
0001-rustc-llvm-fix-libs.patch \
68+
0004-unbundle-gcc.patch \
69+
0005-win32-config.patch \
70+
0008-disable-self-contained.patch
5971

6072
if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; then
61-
patch -p1 -i "${srcdir}/0007-clang-subsystem.patch"
73+
apply_patch_with_msg \
74+
0007-clang-subsystem.patch
6275
fi
6376
}
6477

@@ -103,6 +116,7 @@ build() {
103116
--release-channel=stable \
104117
--enable-ninja \
105118
--enable-extended \
119+
--disable-llvm-static-stdcpp \
106120
--disable-codegen-tests \
107121
--llvm-root=${MINGW_PREFIX} \
108122
--python=${MINGW_PREFIX}/bin/python \

0 commit comments

Comments
 (0)
Please sign in to comment.