rust: try to avoid hardcoding gcc as linker

See #10784
This commit is contained in:
Christoph Reiter
2022-02-18 08:31:29 +01:00
parent dff18defb0
commit 3f5c8a52d4
2 changed files with 27 additions and 2 deletions

View File

@@ -81,3 +81,25 @@ diff -urN rustc-1.53.0-src/src/bootstrap/bootstrap.py.orig rustc-1.53.0-src/src/
if self.rustfmt() and self.rustfmt().startswith(bin_root) and (
not os.path.exists(self.rustfmt())
or self.program_out_of_date(self.rustfmt_stamp(), self.rustfmt_channel)
--- rustc-1.57.0-src/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs.orig 2022-02-18 14:41:41.509000000 +0100
+++ rustc-1.57.0-src/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs 2022-02-18 14:41:49.361435000 +0100
@@ -7,7 +7,7 @@
.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".to_string(), "i386pe".to_string()]);
base.max_atomic_width = Some(64);
base.frame_pointer = FramePointer::Always; // Required for backtraces
- base.linker = Some("i686-w64-mingw32-gcc".to_string());
+ base.linker = Some("i686-w64-mingw32-clang".to_string());
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
// space available to x86 Windows binaries on x86_64.
--- 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
+++ rustc-1.57.0-src/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs 2022-02-18 14:41:24.641880900 +0100
@@ -10,7 +10,7 @@
base.pre_link_args
.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".to_string(), "i386pep".to_string()]);
base.max_atomic_width = Some(64);
- base.linker = Some("x86_64-w64-mingw32-gcc".to_string());
+ base.linker = Some("x86_64-w64-mingw32-clang".to_string());
Target {
llvm_target: "x86_64-pc-windows-gnu".to_string(),

View File

@@ -8,7 +8,7 @@ pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-rust-docs")
pkgver=1.57.0
pkgrel=2
pkgrel=3
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
@@ -42,7 +42,7 @@ sha256sums=('3546f9c3b91b1f8b8efd26c94d6b50312c08210397b4072ed2748e2bd4445c1a'
'c706841ace2ef76fd1004b9c0486ea9ef7d99073c5ce2884e4c97fa4a7beab25'
'6cc3234644768e24824e455d6304585c717ae25aa53ebf9cf1f1dea87bf869b7'
'c4e5ffeef84296d39c3e3e8f807fc8b33ce786b1e4edb21eef26b053586aca27'
'9e2e2eb9c0684f329b1ce6598fcb66727abf84121087b24670a9cfc44a514888'
'c79d91a7419e8b0da76295c3d64aa5e984851c7e03b778f6230a660a010c9a66'
'29f84cb8e05ce304e102e28912a3b4464add406a8ec37a6c6d717b9b7d81b67b')
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE' # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <tstellar@redhat.com>
@@ -80,6 +80,9 @@ build() {
#We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple
OSTYPE="$CARCH-pc-windows-gnu"
# Otherwise it uses gcc during bootstrap, even when we build for clang
export CARGO_TARGET_${CARCH^^}_PC_WINDOWS_GNU_LINKER="${CC}"
local -a _rust_conf=()
if [ "${_bootstrapping}" = "no" ]; then
_rust_conf+=("--local-rust-root=$(cygpath -m ${MINGW_PREFIX})")