Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock X-Debbugs-Cc: ru...@packages.debian.org, pkg-rust-maintain...@alioth-lists.debian.net Control: affects -1 + src:rustc
Hello release team! This request is for pre-approval of a not-yet-uploaded fixed version of rustc. You can find the git tree for the proposed changes on salsa[0], a debdiff (without changelog finalization) is attached. The current version in experimental contains the same verified fix + an upgrade to 1.64.0 - I'd happy to upload that one to unstable as well, but you probably prefer the more targeted approach of just cherry-picking the armel fixes on top of 1.63.0, as described below. [ Reason ] The current rustc version in bookworm (1.63.0+dfsg1-1) is affected by #1028629 (a broken hacky workaround for intrinsics breaking parts of the atomic module of Rust's std library[1]). [ Impact ] Rust code using the broken parts of the atomic module will fail to link (on armel). [ Tests ] The reproducer in the linked bug report and the rust-portable-atomic autopkgtests reproduce the issue (the latter has other issues with autopkgtests on armel, but the linking issue is separate from those), both are fixed with the patches contained in the -2 release. [ Risks ] The original (broken) patch was just a workaround until the final fix was developed upstream (in the compiler_builtins crate used by rustc). The proposed fix is only cherry-picking upstream improvements in the area of arm(el) intrinsics and reverting the workaround. [ Checklist ] [x] all changes are documented in the d/changelog [x] I reviewed all changes and I approve them [x] attach debdiff against the package in testing [ Other info ] 0: https://salsa.debian.org/fg/rust/-/tree/bookworm-armel-fix 1: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1028629 unblock rustc/1.63.0+dfsg1-2
diff -Nru rustc-1.63.0+dfsg1/debian/changelog rustc-1.63.0+dfsg1/debian/changelog --- rustc-1.63.0+dfsg1/debian/changelog 2022-12-07 17:29:00.000000000 +0100 +++ rustc-1.63.0+dfsg1/debian/changelog 2023-01-14 09:38:46.000000000 +0100 @@ -1,3 +1,11 @@ +rustc (1.63.0+dfsg1-2) UNRELEASED; urgency=medium + + [ Fabian Grünbichler ] + * fix compiler_builtins linkage on arm(el) + * add compiler_builtins sync fallbacks for arm(el) + + -- Fabian Gruenbichler <debian@fabian.gruenbichler.email> Sat, 14 Jan 2023 09:38:46 +0100 + rustc (1.63.0+dfsg1-1) unstable; urgency=medium * Upload to unstable (Closes: #1018859) diff -Nru rustc-1.63.0+dfsg1/debian/patches/series rustc-1.63.0+dfsg1/debian/patches/series --- rustc-1.63.0+dfsg1/debian/patches/series 2022-12-07 17:29:00.000000000 +0100 +++ rustc-1.63.0+dfsg1/debian/patches/series 2023-01-14 09:38:29.000000000 +0100 @@ -5,8 +5,9 @@ u-reproducible-build.patch u-ignore-endian-big-diff.patch -# should be replaced with a proper fix once fixed upstream -u-hack-armel-no-kernel-user-helpers.patch +# can be dropped once upstream updates compiler_builtins +u-arm-compiler-builtins-weak-linkage-arm.patch +u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch # not forwarded, or forwarded but unlikely to be merged u-ignore-ppc-hangs.patch diff -Nru rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch --- rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch 1970-01-01 01:00:00.000000000 +0100 +++ rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch 2023-01-14 09:38:29.000000000 +0100 @@ -0,0 +1,223 @@ +From 56172fcd8bd045e38bbdf76697d1fcca1e965d6d Mon Sep 17 00:00:00 2001 +From: Alex Huszagh <ahusz...@gmail.com> +Date: Fri, 29 Jul 2022 16:58:05 -0500 +Subject: [PATCH] Add compiler-rt fallbacks for sync builtins on armv5te-musl. + +--- +https://github.com/rust-lang/compiler-builtins/pull/484 + + src/arm_linux.rs | 110 +++++++++++++++++++++++++++++++---------------- + 1 file changed, 73 insertions(+), 37 deletions(-) + +diff --git a/vendor/compiler_builtins/src/arm_linux.rs b/vendor/compiler_builtins/src/arm_linux.rs +index 8fe0948..8f22eb6 100644 +--- a/vendor/compiler_builtins/src/arm_linux.rs ++++ b/vendor/compiler_builtins/src/arm_linux.rs +@@ -55,7 +55,7 @@ fn insert_aligned(aligned: u32, val: u32, shift: u32, mask: u32) -> u32 { + } + + // Generic atomic read-modify-write operation +-unsafe fn atomic_rmw<T, F: Fn(u32) -> u32>(ptr: *mut T, f: F) -> u32 { ++unsafe fn atomic_rmw<T, F: Fn(u32) -> u32, G: Fn(u32, u32) -> u32>(ptr: *mut T, f: F, g: G) -> u32 { + let aligned_ptr = align_ptr(ptr); + let (shift, mask) = get_shift_mask(ptr); + +@@ -65,7 +65,7 @@ unsafe fn atomic_rmw<T, F: Fn(u32) -> u32>(ptr: *mut T, f: F) -> u32 { + let newval = f(curval); + let newval_aligned = insert_aligned(curval_aligned, newval, shift, mask); + if __kuser_cmpxchg(curval_aligned, newval_aligned, aligned_ptr) { +- return curval; ++ return g(curval, newval); + } + } + } +@@ -89,13 +89,21 @@ unsafe fn atomic_cmpxchg<T>(ptr: *mut T, oldval: u32, newval: u32) -> u32 { + } + + macro_rules! atomic_rmw { +- ($name:ident, $ty:ty, $op:expr) => { ++ ($name:ident, $ty:ty, $op:expr, $fetch:expr) => { + intrinsics! { + pub unsafe extern "C" fn $name(ptr: *mut $ty, val: $ty) -> $ty { +- atomic_rmw(ptr, |x| $op(x as $ty, val) as u32) as $ty ++ atomic_rmw(ptr, |x| $op(x as $ty, val) as u32, |old, new| $fetch(old, new)) as $ty + } + } + }; ++ ++ (@old $name:ident, $ty:ty, $op:expr) => { ++ atomic_rmw!($name, $ty, $op, |old, _| old); ++ }; ++ ++ (@new $name:ident, $ty:ty, $op:expr) => { ++ atomic_rmw!($name, $ty, $op, |_, new| new); ++ }; + } + macro_rules! atomic_cmpxchg { + ($name:ident, $ty:ty) => { +@@ -107,101 +115,129 @@ macro_rules! atomic_cmpxchg { + }; + } + +-atomic_rmw!(__sync_fetch_and_add_1, u8, |a: u8, b: u8| a.wrapping_add(b)); +-atomic_rmw!(__sync_fetch_and_add_2, u16, |a: u16, b: u16| a ++atomic_rmw!(@old __sync_fetch_and_add_1, u8, |a: u8, b: u8| a.wrapping_add(b)); ++atomic_rmw!(@old __sync_fetch_and_add_2, u16, |a: u16, b: u16| a ++ .wrapping_add(b)); ++atomic_rmw!(@old __sync_fetch_and_add_4, u32, |a: u32, b: u32| a ++ .wrapping_add(b)); ++ ++atomic_rmw!(@new __sync_add_and_fetch_1, u8, |a: u8, b: u8| a.wrapping_add(b)); ++atomic_rmw!(@new __sync_add_and_fetch_2, u16, |a: u16, b: u16| a + .wrapping_add(b)); +-atomic_rmw!(__sync_fetch_and_add_4, u32, |a: u32, b: u32| a ++atomic_rmw!(@new __sync_add_and_fetch_4, u32, |a: u32, b: u32| a + .wrapping_add(b)); + +-atomic_rmw!(__sync_fetch_and_sub_1, u8, |a: u8, b: u8| a.wrapping_sub(b)); +-atomic_rmw!(__sync_fetch_and_sub_2, u16, |a: u16, b: u16| a ++atomic_rmw!(@old __sync_fetch_and_sub_1, u8, |a: u8, b: u8| a.wrapping_sub(b)); ++atomic_rmw!(@old __sync_fetch_and_sub_2, u16, |a: u16, b: u16| a + .wrapping_sub(b)); +-atomic_rmw!(__sync_fetch_and_sub_4, u32, |a: u32, b: u32| a ++atomic_rmw!(@old __sync_fetch_and_sub_4, u32, |a: u32, b: u32| a + .wrapping_sub(b)); + +-atomic_rmw!(__sync_fetch_and_and_1, u8, |a: u8, b: u8| a & b); +-atomic_rmw!(__sync_fetch_and_and_2, u16, |a: u16, b: u16| a & b); +-atomic_rmw!(__sync_fetch_and_and_4, u32, |a: u32, b: u32| a & b); ++atomic_rmw!(@new __sync_sub_and_fetch_1, u8, |a: u8, b: u8| a.wrapping_sub(b)); ++atomic_rmw!(@new __sync_sub_and_fetch_2, u16, |a: u16, b: u16| a ++ .wrapping_sub(b)); ++atomic_rmw!(@new __sync_sub_and_fetch_4, u32, |a: u32, b: u32| a ++ .wrapping_sub(b)); ++ ++atomic_rmw!(@old __sync_fetch_and_and_1, u8, |a: u8, b: u8| a & b); ++atomic_rmw!(@old __sync_fetch_and_and_2, u16, |a: u16, b: u16| a & b); ++atomic_rmw!(@old __sync_fetch_and_and_4, u32, |a: u32, b: u32| a & b); ++ ++atomic_rmw!(@new __sync_and_and_fetch_1, u8, |a: u8, b: u8| a & b); ++atomic_rmw!(@new __sync_and_and_fetch_2, u16, |a: u16, b: u16| a & b); ++atomic_rmw!(@new __sync_and_and_fetch_4, u32, |a: u32, b: u32| a & b); ++ ++atomic_rmw!(@old __sync_fetch_and_or_1, u8, |a: u8, b: u8| a | b); ++atomic_rmw!(@old __sync_fetch_and_or_2, u16, |a: u16, b: u16| a | b); ++atomic_rmw!(@old __sync_fetch_and_or_4, u32, |a: u32, b: u32| a | b); ++ ++atomic_rmw!(@new __sync_or_and_fetch_1, u8, |a: u8, b: u8| a | b); ++atomic_rmw!(@new __sync_or_and_fetch_2, u16, |a: u16, b: u16| a | b); ++atomic_rmw!(@new __sync_or_and_fetch_4, u32, |a: u32, b: u32| a | b); ++ ++atomic_rmw!(@old __sync_fetch_and_xor_1, u8, |a: u8, b: u8| a ^ b); ++atomic_rmw!(@old __sync_fetch_and_xor_2, u16, |a: u16, b: u16| a ^ b); ++atomic_rmw!(@old __sync_fetch_and_xor_4, u32, |a: u32, b: u32| a ^ b); + +-atomic_rmw!(__sync_fetch_and_or_1, u8, |a: u8, b: u8| a | b); +-atomic_rmw!(__sync_fetch_and_or_2, u16, |a: u16, b: u16| a | b); +-atomic_rmw!(__sync_fetch_and_or_4, u32, |a: u32, b: u32| a | b); ++atomic_rmw!(@new __sync_xor_and_fetch_1, u8, |a: u8, b: u8| a ^ b); ++atomic_rmw!(@new __sync_xor_and_fetch_2, u16, |a: u16, b: u16| a ^ b); ++atomic_rmw!(@new __sync_xor_and_fetch_4, u32, |a: u32, b: u32| a ^ b); + +-atomic_rmw!(__sync_fetch_and_xor_1, u8, |a: u8, b: u8| a ^ b); +-atomic_rmw!(__sync_fetch_and_xor_2, u16, |a: u16, b: u16| a ^ b); +-atomic_rmw!(__sync_fetch_and_xor_4, u32, |a: u32, b: u32| a ^ b); ++atomic_rmw!(@old __sync_fetch_and_nand_1, u8, |a: u8, b: u8| !(a & b)); ++atomic_rmw!(@old __sync_fetch_and_nand_2, u16, |a: u16, b: u16| !(a & b)); ++atomic_rmw!(@old __sync_fetch_and_nand_4, u32, |a: u32, b: u32| !(a & b)); + +-atomic_rmw!(__sync_fetch_and_nand_1, u8, |a: u8, b: u8| !(a & b)); +-atomic_rmw!(__sync_fetch_and_nand_2, u16, |a: u16, b: u16| !(a & b)); +-atomic_rmw!(__sync_fetch_and_nand_4, u32, |a: u32, b: u32| !(a & b)); ++atomic_rmw!(@new __sync_nand_and_fetch_1, u8, |a: u8, b: u8| !(a & b)); ++atomic_rmw!(@new __sync_nand_and_fetch_2, u16, |a: u16, b: u16| !(a & b)); ++atomic_rmw!(@new __sync_nand_and_fetch_4, u32, |a: u32, b: u32| !(a & b)); + +-atomic_rmw!(__sync_fetch_and_max_1, i8, |a: i8, b: i8| if a > b { ++atomic_rmw!(@old __sync_fetch_and_max_1, i8, |a: i8, b: i8| if a > b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_max_2, i16, |a: i16, b: i16| if a > b { ++atomic_rmw!(@old __sync_fetch_and_max_2, i16, |a: i16, b: i16| if a > b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_max_4, i32, |a: i32, b: i32| if a > b { ++atomic_rmw!(@old __sync_fetch_and_max_4, i32, |a: i32, b: i32| if a > b { + a + } else { + b + }); + +-atomic_rmw!(__sync_fetch_and_umax_1, u8, |a: u8, b: u8| if a > b { ++atomic_rmw!(@old __sync_fetch_and_umax_1, u8, |a: u8, b: u8| if a > b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_umax_2, u16, |a: u16, b: u16| if a > b { ++atomic_rmw!(@old __sync_fetch_and_umax_2, u16, |a: u16, b: u16| if a > b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_umax_4, u32, |a: u32, b: u32| if a > b { ++atomic_rmw!(@old __sync_fetch_and_umax_4, u32, |a: u32, b: u32| if a > b { + a + } else { + b + }); + +-atomic_rmw!(__sync_fetch_and_min_1, i8, |a: i8, b: i8| if a < b { ++atomic_rmw!(@old __sync_fetch_and_min_1, i8, |a: i8, b: i8| if a < b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_min_2, i16, |a: i16, b: i16| if a < b { ++atomic_rmw!(@old __sync_fetch_and_min_2, i16, |a: i16, b: i16| if a < b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_min_4, i32, |a: i32, b: i32| if a < b { ++atomic_rmw!(@old __sync_fetch_and_min_4, i32, |a: i32, b: i32| if a < b { + a + } else { + b + }); + +-atomic_rmw!(__sync_fetch_and_umin_1, u8, |a: u8, b: u8| if a < b { ++atomic_rmw!(@old __sync_fetch_and_umin_1, u8, |a: u8, b: u8| if a < b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_umin_2, u16, |a: u16, b: u16| if a < b { ++atomic_rmw!(@old __sync_fetch_and_umin_2, u16, |a: u16, b: u16| if a < b { + a + } else { + b + }); +-atomic_rmw!(__sync_fetch_and_umin_4, u32, |a: u32, b: u32| if a < b { ++atomic_rmw!(@old __sync_fetch_and_umin_4, u32, |a: u32, b: u32| if a < b { + a + } else { + b + }); + +-atomic_rmw!(__sync_lock_test_and_set_1, u8, |_: u8, b: u8| b); +-atomic_rmw!(__sync_lock_test_and_set_2, u16, |_: u16, b: u16| b); +-atomic_rmw!(__sync_lock_test_and_set_4, u32, |_: u32, b: u32| b); ++atomic_rmw!(@old __sync_lock_test_and_set_1, u8, |_: u8, b: u8| b); ++atomic_rmw!(@old __sync_lock_test_and_set_2, u16, |_: u16, b: u16| b); ++atomic_rmw!(@old __sync_lock_test_and_set_4, u32, |_: u32, b: u32| b); + + atomic_cmpxchg!(__sync_val_compare_and_swap_1, u8); + atomic_cmpxchg!(__sync_val_compare_and_swap_2, u16); +-- +2.39.0 + diff -Nru rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch --- rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch 1970-01-01 01:00:00.000000000 +0100 +++ rustc-1.63.0+dfsg1/debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch 2023-01-14 09:38:24.000000000 +0100 @@ -0,0 +1,23 @@ +From 72c872147679096c53cbb49ca670662d05d43110 Mon Sep 17 00:00:00 2001 +From: Lokathor <zef...@gmail.com> +Date: Tue, 27 Sep 2022 13:22:45 -0600 +Subject: [PATCH] Update macros.rs + +--- +https://github.com/rust-lang/compiler-builtins/pull/495 + + src/macros.rs | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/vendor/compiler_builtins/src/macros.rs b/vendor/compiler_builtins/src/macros.rs +index 7d90b7aa..477c2568 100644 +--- a/vendor/compiler_builtins/src/macros.rs ++++ b/vendor/compiler_builtins/src/macros.rs +@@ -266,6 +266,7 @@ macro_rules! intrinsics { + #[cfg(target_arch = "arm")] + pub mod $alias { + #[cfg_attr(not(feature = "mangled-names"), no_mangle)] ++ #[cfg_attr(all(not(windows), not(target_vendor="apple")), linkage = "weak")] + pub extern "aapcs" fn $alias( $($argname: $ty),* ) $(-> $ret)? { + super::$name($($argname),*) + } diff -Nru rustc-1.63.0+dfsg1/debian/patches/u-hack-armel-no-kernel-user-helpers.patch rustc-1.63.0+dfsg1/debian/patches/u-hack-armel-no-kernel-user-helpers.patch --- rustc-1.63.0+dfsg1/debian/patches/u-hack-armel-no-kernel-user-helpers.patch 2022-12-07 17:29:00.000000000 +0100 +++ rustc-1.63.0+dfsg1/debian/patches/u-hack-armel-no-kernel-user-helpers.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -Description: HACK: Disable kernel_user_helpers on armel - Workaround to fix the build, should be removed when properly fixed in - https://github.com/rust-lang/compiler-builtins/issues/420 -Author: Adrian Bunk <b...@debian.org> - ---- rustc-1.61.0+dfsg1.orig/vendor/compiler_builtins/src/lib.rs -+++ rustc-1.61.0+dfsg1/vendor/compiler_builtins/src/lib.rs -@@ -54,7 +54,7 @@ pub mod arm; - - #[cfg(all( - kernel_user_helpers, -- any(target_os = "linux", target_os = "android"), -+ any(target_os = "android"), - target_arch = "arm" - ))] - pub mod arm_linux;
signature.asc
Description: PGP signature