forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix issue-21763.rs test failure when vendor is enabled the issue is fixed upstream in 1.79.0 see rust-lang/rust#123652 that fix requires a prior and massive commit see cuviper/rust@ec2cc76 so a tailored patch was made * fix externally linking some math functions The tests\ui\issues\issue-2214.rs test fails with undefined reference to `__sinl_internal' and other math functions. Mateusz Mikuła analyzed the issue and found that the root cause is this change in mingw-w64: mingw-w64/mingw-w64@a64c1f4 The error happens because Rust pulls in lgamma from libmingwex.a, which pulls in sin from libmsvcrt.a, which in turn tries to pull in __sinl_internal from libmingwex.a and fails because of how Rust links MinGW libs. The proposed fix was to add an extra "-lmingwex" after the second "-lmsvcrt" in https://github.com/rust-lang/rust/blob/aa6a697a1c75b0aa06954136f7641706edadc2be/compiler/rustc_target/src/spec/base/windows_gnu.rs#L30. * backport upstream compiler builtins fixes * backport update data layouts in custom target tests for LLVM 18 * backport fix for windows aarch64 backtrace * patch coverage-dump
- Loading branch information
Showing
6 changed files
with
187 additions
and
7 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
From f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63 Mon Sep 17 00:00:00 2001 | ||
From: Josh Stone <[email protected]> | ||
Date: Mon, 8 Apr 2024 15:04:44 -0700 | ||
Subject: [PATCH] Fix UI tests with dist-vendored dependencies | ||
|
||
There is already a workaround in `compiletest` to deal with custom | ||
`CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`. | ||
A similar need exists when dependencies come from the local `vendor` | ||
directory, which distro builds often use, so now we ignore that too. | ||
|
||
Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably | ||
expecting a version suffix, but the vendored path doesn't include the | ||
version. Now that matches `[\\/]hashbrown` instead. | ||
--- | ||
src/tools/compiletest/src/runtest.rs | 5 +++++ | ||
tests/ui/issues/issue-21763.rs | 2 +- | ||
2 files changed, 6 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs | ||
index bb8509fe41377..770496289e2e7 100644 | ||
--- a/src/tools/compiletest/src/runtest.rs | ||
+++ b/src/tools/compiletest/src/runtest.rs | ||
@@ -2354,6 +2354,11 @@ impl<'test> TestCx<'test> { | ||
"ignore-directory-in-diagnostics-source-blocks={}", | ||
home::cargo_home().expect("failed to find cargo home").to_str().unwrap() | ||
)); | ||
+ // Similarly, vendored sources shouldn't be shown when running from a dist tarball. | ||
+ rustc.arg("-Z").arg(format!( | ||
+ "ignore-directory-in-diagnostics-source-blocks={}", | ||
+ self.config.find_rust_src_root().unwrap().join("vendor").display(), | ||
+ )); | ||
|
||
// Optionally prevent default --sysroot if specified in test compile-flags. | ||
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) | ||
diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs | ||
index a349253063c02..1d0a0705cbbd9 100644 | ||
--- a/tests/ui/issues/issue-21763.rs | ||
+++ b/tests/ui/issues/issue-21763.rs | ||
@@ -1,6 +1,6 @@ | ||
// Regression test for HashMap only impl'ing Send/Sync if its contents do | ||
|
||
-// normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION" | ||
+// normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION" | ||
|
||
use std::collections::HashMap; | ||
use std::rc::Rc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- rustc-1.77.2-src/compiler/rustc_target/src/spec/base/windows_gnu.rs.orig 2024-04-13 12:55:59.933083700 +0200 | ||
+++ rustc-1.77.2-src/compiler/rustc_target/src/spec/base/windows_gnu.rs 2024-04-13 12:56:15.789241300 +0200 | ||
@@ -40,6 +40,7 @@ | ||
// | ||
// See https://github.com/rust-lang/rust/pull/47483 for some more details. | ||
"-lmsvcrt", | ||
+ "-lmingwex", | ||
"-luser32", | ||
"-lkernel32", | ||
]; |
75 changes: 75 additions & 0 deletions
75
mingw-w64-rust/0016-backport-backtrace-fix-windows-aarch64.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- rustc-1.77.2-src/library/backtrace/src/backtrace/dbghelp.rs.orig 2024-04-19 14:12:20.763735300 -0700 | ||
+++ rustc-1.77.2-src/library/backtrace/src/backtrace/dbghelp.rs 2024-04-19 14:17:14.861312400 -0700 | ||
@@ -127,45 +127,67 @@ | ||
pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) { | ||
use core::ptr; | ||
|
||
+ // Capture the initial context to start walking from. | ||
let mut context = core::mem::zeroed::<MyContext>(); | ||
RtlCaptureContext(&mut context.0); | ||
|
||
- // Call `RtlVirtualUnwind` to find the previous stack frame, walking until we hit ip = 0. | ||
- while context.ip() != 0 { | ||
+ loop { | ||
+ let ip = context.ip(); | ||
+ | ||
let mut base = 0; | ||
|
||
- let fn_entry = RtlLookupFunctionEntry(context.ip(), &mut base, ptr::null_mut()); | ||
+ let fn_entry = RtlLookupFunctionEntry(ip, &mut base, ptr::null_mut()); | ||
if fn_entry.is_null() { | ||
+ // No function entry could be found - this may indicate a corrupt | ||
+ // stack or that a binary was unloaded (amongst other issues). Stop | ||
+ // walking and don't call the callback as we can't be confident in | ||
+ // this frame or the rest of the stack. | ||
break; | ||
} | ||
|
||
let frame = super::Frame { | ||
inner: Frame { | ||
base_address: fn_entry as *mut c_void, | ||
- ip: context.ip() as *mut c_void, | ||
+ ip: ip as *mut c_void, | ||
sp: context.sp() as *mut c_void, | ||
#[cfg(not(target_env = "gnu"))] | ||
inline_context: None, | ||
}, | ||
}; | ||
|
||
+ // We've loaded all the info about the current frame, so now call the | ||
+ // callback. | ||
if !cb(&frame) { | ||
+ // Callback told us to stop, so we're done. | ||
break; | ||
} | ||
|
||
+ // Unwind to the next frame. | ||
+ let previous_ip = ip; | ||
+ let previous_sp = context.sp(); | ||
let mut handler_data = 0usize; | ||
let mut establisher_frame = 0; | ||
|
||
RtlVirtualUnwind( | ||
0, | ||
base, | ||
- context.ip(), | ||
+ ip, | ||
fn_entry, | ||
&mut context.0, | ||
&mut handler_data as *mut usize as *mut PVOID, | ||
&mut establisher_frame, | ||
ptr::null_mut(), | ||
); | ||
+ | ||
+ // RtlVirtualUnwind indicates the end of the stack in two different ways: | ||
+ // * On x64, it sets the instruction pointer to 0. | ||
+ // * On ARM64, it leaves the context unchanged (easiest way to check is | ||
+ // to see if the instruction and stack pointers are the same). | ||
+ // If we detect either of these, then unwinding is completed. | ||
+ let ip = context.ip(); | ||
+ if ip == 0 || (ip == previous_ip && context.sp() == previous_sp) { | ||
+ break; | ||
+ } | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- rustc-1.77.2-src/src/tools/coverage-dump/src/covfun.rs~ 2024-04-09 10:20:09.000000000 -0700 | ||
+++ rustc-1.77.2-src/src/tools/coverage-dump/src/covfun.rs 2024-04-18 17:51:35.150559300 -0700 | ||
@@ -219,7 +219,7 @@ | ||
enum MappingKind { | ||
Code(CovTerm), | ||
Gap(CovTerm), | ||
- Expansion(u32), | ||
+ Expansion(#[allow(dead_code)] u32), | ||
Skip, | ||
// Using raw identifiers here makes the dump output a little bit nicer | ||
// (via the derived Debug), at the expense of making this tool's source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ pkgbase=mingw-w64-${_realname} | |
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}" | ||
$([[ ${CARCH} == i686 ]] || echo "${MINGW_PACKAGE_PREFIX}-rust-docs")) | ||
pkgver=1.77.2 | ||
pkgrel=1 | ||
pkgrel=2 | ||
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)" | ||
arch=('any') | ||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32') | ||
|
@@ -45,26 +45,38 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc" | |
"${MINGW_PACKAGE_PREFIX}-zlib") | ||
source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.gz"{,.asc} | ||
"${embed_manifest_url}" | ||
"https://github.com/rust-lang/compiler-builtins/commit/67c1c0a71a204c089ddae4aec21ec75aa778c11b.patch" | ||
"https://github.com/rust-lang/compiler-builtins/commit/d8ab794ed61e2c7c0750f57332a680d5aa8db48c.patch" | ||
"https://github.com/rust-lang/compiler-builtins/commit/3f47913bc6414bab4254d49f9f6e7238fecace69.patch" | ||
"https://github.com/rust-lang/rust/commit/8eb48b4f4c6e3d48f2600159a75184ec4d74b249.patch" | ||
"0001-rustc-llvm-fix-libs.patch" | ||
"0005-win32-config.patch" | ||
"0007-clang-subsystem.patch" | ||
"0008-disable-self-contained.patch" | ||
"0011-disable-uac-for-installer.patch" | ||
"0012-vendor-embed-manifest.patch" | ||
"0013-backport-compiler-builtins.patch") | ||
"0013-backport-compiler-builtins.patch" | ||
"0014-fix-vendored-test.patch" | ||
"0015-gcc-subsystem.patch" | ||
"0016-backport-backtrace-fix-windows-aarch64.patch" | ||
"0017-coverage-dump-allow-dead-code.patch") | ||
noextract=(${_realname}c-${pkgver}-src.tar.gz) | ||
sha256sums=('c61457ef8f596638fddbc7716778b2f6b99ff12513a3b0f13994c3bc521638c3' | ||
'SKIP' | ||
'f1c65919a5f182376ecbfed69f72935abbebad5dc62bd32b2038905258c49453' | ||
'1c7be19d408a98fcb94ee77085d34901a30f1fcc1b79bc59d02bc48f655df6eb' | ||
'0426bc2a82f56ddabc0646100891bc61b9a57f4b7aec9f45aff40d7ba081db4f' | ||
'b888615732b1c9b0d4e8459cc9bd7ffb8afbf13bab840c2d345dc1492a63c9c3' | ||
'fc620675257642bb923cb23650aab49dea877e4635dcbf2c33eaf79c9ec8db63' | ||
'7cb1773c288ffb1c1e751edc49b1890c84bf9c362742bc5225d19d474edb73a0' | ||
'7d1c4e49524b835a8eadc961b39f5594b12a522a1e24368999be2c7e85399e4e' | ||
'1f668f4aed56060ec74fd53a39da1fbaef69b84de510d955baf349db672a8d15' | ||
'7a3b5722ff576b0661f36796f088dee4ce318b5dbc3fdcd65b48972de68a0edf' | ||
'761d73328d9695a7a2bd2a10be8225f4a56801fee54cbb51c0841b7f16e2bde6' | ||
'358de2f3e54afbe4aefd401725227becf2468763b7686c5d4fed3b71d1e95ce9' | ||
'56e3433e37ecebe4e5eba1be8debb3e34451be22a00e345ee738bbeb37803092') | ||
'5c60c8b81fe6537e952d25553e92ef5bb2b1368c10cdadfe8c9809d6bc7f4ffa' | ||
'435b69f896f97b45108c92e748ef64edbc21566fe61188b643707aa51522d295' | ||
'5e19556f6cfed0485b84c32de1a2a3f8fe330cb73bc16e2596be4aba3bcb3cd5' | ||
'6b383fafc4012624ce3f2e1bbd567d8961ea65c244064d585bf031a78276fe72' | ||
'31c10de3ad78a47b3abc1082c669c379f1e681974cee8ce2a4bfa0149a86be06') | ||
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE' # Rust Language (Tag and Release Signing Key) <[email protected]> | ||
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <[email protected]> | ||
'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <[email protected]> | ||
|
@@ -90,6 +102,14 @@ apply_patch_with_msg() { | |
patch -Nbp1 -i "${srcdir}/${_patch}" | ||
done | ||
} | ||
|
||
apply_patch_with_msg_no_backup() { | ||
for _patch in "$@" | ||
do | ||
msg2 "Applying ${_patch}" | ||
patch -Np1 -i "${srcdir}/${_patch}" | ||
done | ||
} | ||
# =========================================== # | ||
|
||
prepare() { | ||
|
@@ -120,10 +140,28 @@ prepare() { | |
# backport required for CLANG32 to build with compiler-rt 18.1.0 | ||
(cd vendor/compiler_builtins && \ | ||
apply_patch_with_msg \ | ||
67c1c0a71a204c089ddae4aec21ec75aa778c11b.patch) | ||
d8ab794ed61e2c7c0750f57332a680d5aa8db48c.patch \ | ||
3f47913bc6414bab4254d49f9f6e7238fecace69.patch) | ||
# still needs to patch .cargo-checksums.json | ||
apply_patch_with_msg \ | ||
0013-backport-compiler-builtins.patch | ||
|
||
# patch tests | ||
# tidy complains about *.orig files so do not generate backups | ||
apply_patch_with_msg_no_backup \ | ||
0014-fix-vendored-test.patch \ | ||
8eb48b4f4c6e3d48f2600159a75184ec4d74b249.patch | ||
|
||
if [[ $MSYSTEM == MINGW* ]]; then | ||
apply_patch_with_msg \ | ||
0015-gcc-subsystem.patch | ||
fi | ||
if [[ $MINGW_PACKAGE_PREFIX == *-aarch64 ]]; then | ||
apply_patch_with_msg \ | ||
0016-backport-backtrace-fix-windows-aarch64.patch | ||
fi | ||
apply_patch_with_msg \ | ||
0017-coverage-dump-allow-dead-code.patch | ||
} | ||
|
||
build() { | ||
|