[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#986282: unblock: rust-compiler-builtins/0.1.26-3



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package rust-compiler-builtins

rust-compiler-builtins 0.1.26-2 FTBFS on armhf (and presumablly also armel
but I did not test that).

Rust upstream have renamed the old assembler support from asm! to llvm_asm!
in preperation for the introduction of a new assembler syntax. This breaks
the build of rust-compiler-builtins on arm (tested on armhf but presumablly
also affects armel).

rust-compiler-builtins uses inline asm in the arm implementations. There is also
some inline asm in the x86 and x86-64 implementations, but said asm is not
used when building for linux.

Upstream fixed this some time ago,
https://github.com/rust-lang/compiler-builtins/commit/cde22bc180391e75de1c189fe29f442ada86ccde
but unfortunately the new version was never uploaded to Debian and given that
it's a key package, it's too late for new upstream versions now. The upstream
commit also included some unrelated changes.

I therefore took the upstream commit, removed changes unrelated to the asm
change and applied it to the Debian package. I left in the changes to the
non-linux asm blocks figuring it was sensible to treat the asm change
as one unit.

unblock rust-compiler-builtins/0.1.26-3

-- System Information:
Debian Release: 10.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'oldoldstable'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-10-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru rust-compiler-builtins-0.1.26/debian/cargo-checksum.json rust-compiler-builtins-0.1.26/debian/cargo-checksum.json
--- rust-compiler-builtins-0.1.26/debian/cargo-checksum.json	2020-04-12 21:42:44.000000000 +0000
+++ rust-compiler-builtins-0.1.26/debian/cargo-checksum.json	2021-04-01 11:34:12.000000000 +0000
@@ -1 +1 @@
-{"package":"036b035e9ebcd705affece16319223d19f229e2358be6e3b7b094e57193312e6","files":{}}
+{"package":"Could not get crate checksum","files":{}}
diff -Nru rust-compiler-builtins-0.1.26/debian/changelog rust-compiler-builtins-0.1.26/debian/changelog
--- rust-compiler-builtins-0.1.26/debian/changelog	2020-04-12 21:42:44.000000000 +0000
+++ rust-compiler-builtins-0.1.26/debian/changelog	2021-04-01 11:34:12.000000000 +0000
@@ -1,3 +1,12 @@
+rust-compiler-builtins (0.1.26-3) unstable; urgency=medium
+
+  * Team upload.
+  * Package compiler_builtins 0.1.26 from crates.io using debcargo 2.4.2
+  * Apply upstream changes to replace asm with llvm_asm and hence
+    fix FTBFS on arm (Closes: 985810).
+
+ -- Peter Michael Green <plugwash@debian.org>  Thu, 01 Apr 2021 11:34:12 +0000
+
 rust-compiler-builtins (0.1.26-2) unstable; urgency=medium
 
   * Team upload.
diff -Nru rust-compiler-builtins-0.1.26/debian/copyright rust-compiler-builtins-0.1.26/debian/copyright
--- rust-compiler-builtins-0.1.26/debian/copyright	2020-04-12 21:42:44.000000000 +0000
+++ rust-compiler-builtins-0.1.26/debian/copyright	2021-04-01 11:34:12.000000000 +0000
@@ -57,7 +57,7 @@
 
 Files: debian/*
 Copyright:
- 2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+ 2019-2021 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
  2019 kpcyrd <git@rxv.cc>
 License: MIT or Apache-2.0
 
diff -Nru rust-compiler-builtins-0.1.26/debian/copyright.debcargo.hint rust-compiler-builtins-0.1.26/debian/copyright.debcargo.hint
--- rust-compiler-builtins-0.1.26/debian/copyright.debcargo.hint	2020-04-12 21:42:44.000000000 +0000
+++ rust-compiler-builtins-0.1.26/debian/copyright.debcargo.hint	2021-04-01 11:34:12.000000000 +0000
@@ -413,8 +413,8 @@
 
 Files: debian/*
 Copyright:
- 2020 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
- 2020 kpcyrd <git@rxv.cc>
+ 2020-2021 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+ 2020-2021 kpcyrd <git@rxv.cc>
 License: MIT or Apache-2.0
 
 License: Apache-2.0
diff -Nru rust-compiler-builtins-0.1.26/debian/patches/series rust-compiler-builtins-0.1.26/debian/patches/series
--- rust-compiler-builtins-0.1.26/debian/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ rust-compiler-builtins-0.1.26/debian/patches/series	2021-04-01 11:34:12.000000000 +0000
@@ -0,0 +1 @@
+use-llvm_asm.patch
\ No newline at end of file
diff -Nru rust-compiler-builtins-0.1.26/debian/patches/use-llvm_asm.patch rust-compiler-builtins-0.1.26/debian/patches/use-llvm_asm.patch
--- rust-compiler-builtins-0.1.26/debian/patches/use-llvm_asm.patch	1970-01-01 00:00:00.000000000 +0000
+++ rust-compiler-builtins-0.1.26/debian/patches/use-llvm_asm.patch	2021-04-01 11:34:12.000000000 +0000
@@ -0,0 +1,305 @@
+Patch to fix asm related FTBFS by switching from asm! to llvm_asm!
+
+This patch is Based on the upstream commit referenced below with
+non-asm related changes removed.
+
+commit cde22bc180391e75de1c189fe29f442ada86ccde
+Author: Alex Crichton <alex@alexcrichton.com>
+Date:   Wed Apr 29 15:30:10 2020 -0500
+
+diff --git a/examples/intrinsics.rs b/examples/intrinsics.rs
+index 5ceebe1..82762e0 100644
+--- a/examples/intrinsics.rs
++++ b/examples/intrinsics.rs
+@@ -6,7 +6,7 @@
+ #![allow(unused_features)]
+ #![cfg_attr(thumb, no_main)]
+ #![deny(dead_code)]
+-#![feature(asm)]
++#![feature(llvm_asm)]
+ #![feature(lang_items)]
+ #![feature(start)]
+ #![feature(allocator_api)]
+@@ -280,7 +280,7 @@ fn run() {
+ 
+     // A copy of "test::black_box". Used to prevent LLVM from optimizing away the intrinsics during LTO
+     fn bb<T>(dummy: T) -> T {
+-        unsafe { asm!("" : : "r"(&dummy)) }
++        unsafe { llvm_asm!("" : : "r"(&dummy)) }
+         dummy
+     }
+ 
+diff --git a/src/arm.rs b/src/arm.rs
+index 4cf73ef..190bba7 100644
+--- a/src/arm.rs
++++ b/src/arm.rs
+@@ -8,13 +8,15 @@ use core::intrinsics;
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_uidivmod() {
+-    asm!("push {lr}
+-          sub sp, sp, #4
+-          mov r2, sp
+-          bl __udivmodsi4
+-          ldr r1, [sp]
+-          add sp, sp, #4
+-          pop {pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {lr}
++        sub sp, sp, #4
++        mov r2, sp
++        bl __udivmodsi4
++        ldr r1, [sp]
++        add sp, sp, #4
++        pop {pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+@@ -22,13 +24,15 @@ pub unsafe fn __aeabi_uidivmod() {
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_uidivmod() {
+-    asm!("push {lr}
+-          sub sp, sp, #4
+-          mov r2, sp
+-          bl ___udivmodsi4
+-          ldr r1, [sp]
+-          add sp, sp, #4
+-          pop {pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {lr}
++        sub sp, sp, #4
++        mov r2, sp
++        bl ___udivmodsi4
++        ldr r1, [sp]
++        add sp, sp, #4
++        pop {pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+@@ -36,15 +40,17 @@ pub unsafe fn __aeabi_uidivmod() {
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_uldivmod() {
+-    asm!("push {r4, lr}
+-          sub sp, sp, #16
+-          add r4, sp, #8
+-          str r4, [sp]
+-          bl __udivmoddi4
+-          ldr r2, [sp, #8]
+-          ldr r3, [sp, #12]
+-          add sp, sp, #16
+-          pop {r4, pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {r4, lr}
++        sub sp, sp, #16
++        add r4, sp, #8
++        str r4, [sp]
++        bl __udivmoddi4
++        ldr r2, [sp, #8]
++        ldr r3, [sp, #12]
++        add sp, sp, #16
++        pop {r4, pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+@@ -52,15 +58,17 @@ pub unsafe fn __aeabi_uldivmod() {
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_uldivmod() {
+-    asm!("push {r4, lr}
+-          sub sp, sp, #16
+-          add r4, sp, #8
+-          str r4, [sp]
+-          bl ___udivmoddi4
+-          ldr r2, [sp, #8]
+-          ldr r3, [sp, #12]
+-          add sp, sp, #16
+-          pop {r4, pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {r4, lr}
++        sub sp, sp, #16
++        add r4, sp, #8
++        str r4, [sp]
++        bl ___udivmoddi4
++        ldr r2, [sp, #8]
++        ldr r3, [sp, #12]
++        add sp, sp, #16
++        pop {r4, pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+@@ -68,12 +76,14 @@ pub unsafe fn __aeabi_uldivmod() {
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_idivmod() {
+-    asm!("push {r0, r1, r4, lr}
+-          bl __aeabi_idiv
+-          pop {r1, r2}
+-          muls r2, r2, r0
+-          subs r1, r1, r2
+-          pop {r4, pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {r0, r1, r4, lr}
++        bl __aeabi_idiv
++        pop {r1, r2}
++        muls r2, r2, r0
++        subs r1, r1, r2
++        pop {r4, pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+@@ -81,12 +91,14 @@ pub unsafe fn __aeabi_idivmod() {
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_idivmod() {
+-    asm!("push {r0, r1, r4, lr}
+-          bl ___aeabi_idiv
+-          pop {r1, r2}
+-          muls r2, r2, r0
+-          subs r1, r1, r2
+-          pop {r4, pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {r0, r1, r4, lr}
++        bl ___aeabi_idiv
++        pop {r1, r2}
++        muls r2, r2, r0
++        subs r1, r1, r2
++        pop {r4, pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+@@ -94,15 +106,17 @@ pub unsafe fn __aeabi_idivmod() {
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_ldivmod() {
+-    asm!("push {r4, lr}
+-          sub sp, sp, #16
+-          add r4, sp, #8
+-          str r4, [sp]
+-          bl __divmoddi4
+-          ldr r2, [sp, #8]
+-          ldr r3, [sp, #12]
+-          add sp, sp, #16
+-          pop {r4, pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {r4, lr}
++        sub sp, sp, #16
++        add r4, sp, #8
++        str r4, [sp]
++        bl __divmoddi4
++        ldr r2, [sp, #8]
++        ldr r3, [sp, #12]
++        add sp, sp, #16
++        pop {r4, pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+@@ -110,15 +124,17 @@ pub unsafe fn __aeabi_ldivmod() {
+ #[naked]
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ pub unsafe fn __aeabi_ldivmod() {
+-    asm!("push {r4, lr}
+-          sub sp, sp, #16
+-          add r4, sp, #8
+-          str r4, [sp]
+-          bl ___divmoddi4
+-          ldr r2, [sp, #8]
+-          ldr r3, [sp, #12]
+-          add sp, sp, #16
+-          pop {r4, pc}" ::: "memory" : "volatile");
++    llvm_asm!("
++        push {r4, lr}
++        sub sp, sp, #16
++        add r4, sp, #8
++        str r4, [sp]
++        bl ___divmoddi4
++        ldr r2, [sp, #8]
++        ldr r3, [sp, #12]
++        add sp, sp, #16
++        pop {r4, pc}
++    " ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+ 
+diff --git a/src/lib.rs b/src/lib.rs
+index e57a5ef..0ca770b 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -1,6 +1,6 @@
+ #![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
+ #![feature(abi_unadjusted)]
+-#![feature(asm)]
++#![feature(llvm_asm)]
+ #![feature(global_asm)]
+ #![feature(cfg_target_has_atomic)]
+ #![feature(compiler_builtins)]
+diff --git a/src/x86.rs b/src/x86.rs
+index 035c0a3..5511c45 100644
+--- a/src/x86.rs
++++ b/src/x86.rs
+@@ -12,7 +12,7 @@ use core::intrinsics;
+ #[naked]
+ #[no_mangle]
+ pub unsafe fn ___chkstk_ms() {
+-    asm!("
++    llvm_asm!("
+         push   %ecx
+         push   %eax
+         cmp    $$0x1000,%eax
+@@ -38,7 +38,7 @@ pub unsafe fn ___chkstk_ms() {
+ #[naked]
+ #[no_mangle]
+ pub unsafe fn __alloca() {
+-    asm!("jmp ___chkstk   // Jump to ___chkstk since fallthrough may be unreliable"
++    llvm_asm!("jmp ___chkstk   // Jump to ___chkstk since fallthrough may be unreliable"
+          ::: "memory" : "volatile");
+     intrinsics::unreachable();
+ }
+@@ -47,7 +47,7 @@ pub unsafe fn __alloca() {
+ #[naked]
+ #[no_mangle]
+ pub unsafe fn ___chkstk() {
+-    asm!("
++    llvm_asm!("
+         push   %ecx
+         cmp    $$0x1000,%eax
+         lea    8(%esp),%ecx     // esp before calling this routine -> ecx
+diff --git a/src/x86_64.rs b/src/x86_64.rs
+index 6940f8d..6a0cd56 100644
+--- a/src/x86_64.rs
++++ b/src/x86_64.rs
+@@ -12,7 +12,7 @@ use core::intrinsics;
+ #[naked]
+ #[no_mangle]
+ pub unsafe fn ___chkstk_ms() {
+-    asm!("
++    llvm_asm!("
+         push   %rcx
+         push   %rax
+         cmp    $$0x1000,%rax
+@@ -37,7 +37,7 @@ pub unsafe fn ___chkstk_ms() {
+ #[naked]
+ #[no_mangle]
+ pub unsafe fn __alloca() {
+-    asm!("mov    %rcx,%rax  // x64 _alloca is a normal function with parameter in rcx
++    llvm_asm!("mov    %rcx,%rax  // x64 _alloca is a normal function with parameter in rcx
+           jmp    ___chkstk  // Jump to ___chkstk since fallthrough may be unreliable"
+          ::: "memory" : "volatile");
+     intrinsics::unreachable();
+@@ -47,7 +47,7 @@ pub unsafe fn __alloca() {
+ #[naked]
+ #[no_mangle]
+ pub unsafe fn ___chkstk() {
+-    asm!(
++    llvm_asm!(
+         "
+         push   %rcx
+         cmp    $$0x1000,%rax

Reply to: