Skip to content

Commit

Permalink
rust: backport fixes
Browse files Browse the repository at this point in the history
* fix issue-21763.rs test failure when vendor is enabled

the issue is fixed upstream in 1.79.0
see rust-lang/rust#123652

* 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 fix for windows aarch64 backtrace
  • Loading branch information
filnet authored and jeremyd2019 committed Jun 3, 2024
1 parent 507491a commit aaca395
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions mingw-w64-rust/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.gz"{,.asc}
"${embed_manifest_url}"
"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/f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63.patch"
"https://github.com/rust-lang/rust/commit/eac0b3a1d1b8d1db8fa95c50e118de5b9471e5af.patch"
"https://github.com/rust-lang/backtrace-rs/commit/adc9f5ca6205a7bde95b5f1a3f029e590ce6c694.patch"
"https://github.com/rust-lang/backtrace-rs/commit/e15130618237eb3e2d4b622549f9647b4c1d9ca3.patch"
"0001-rustc-llvm-fix-libs.patch"
"0005-win32-config.patch"
"0007-clang-subsystem.patch"
Expand All @@ -60,6 +64,10 @@ sha256sums=('ff544823a5cb27f2738128577f1e7e00ee8f4c83f2a348781ae4fc355e91d5a9'
'24ef6d949c0b5b1940c1d6a7aad78d86012152fb8845a1644bc939350d7b75e2'
'0426bc2a82f56ddabc0646100891bc61b9a57f4b7aec9f45aff40d7ba081db4f'
'b888615732b1c9b0d4e8459cc9bd7ffb8afbf13bab840c2d345dc1492a63c9c3'
'05a5bbd1c5ec5fdb66a712a3939b75fae1285309d2ea570d1b14c641927bad8d'
'd9a1ac6343c3d5428691701aba2489858cca069510da319ceca9c7bf7ed0ca0d'
'8b6a5f1ede0a73f4aa5cf9c4b0e48f4db9885717dfc2c953d190a17e13ae5bbb'
'084e950c0441dd649624692250ee6e771d796467e85feac5b6cd6aee2a862ce2'
'7cb1773c288ffb1c1e751edc49b1890c84bf9c362742bc5225d19d474edb73a0'
'7d1c4e49524b835a8eadc961b39f5594b12a522a1e24368999be2c7e85399e4e'
'46b63be79e4f2d5da2b183ed963429bce22966227bf24a73b158d23875841b11'
Expand Down Expand Up @@ -92,6 +100,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() {
Expand Down Expand Up @@ -127,6 +143,22 @@ prepare() {
# 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 \
f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63.patch

if [[ $MSYSTEM == MINGW* ]]; then
apply_patch_with_msg \
eac0b3a1d1b8d1db8fa95c50e118de5b9471e5af.patch
fi
if [[ $MINGW_PACKAGE_PREFIX == *-aarch64 ]]; then
(cd library/backtrace && \
apply_patch_with_msg \
adc9f5ca6205a7bde95b5f1a3f029e590ce6c694.patch \
e15130618237eb3e2d4b622549f9647b4c1d9ca3.patch)
fi
}

build() {
Expand Down

0 comments on commit aaca395

Please sign in to comment.