Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc SIGSEGV compiling for thumbv7em with bad asm #53065

Closed
mqudsi opened this issue Aug 4, 2018 · 2 comments
Closed

rustc SIGSEGV compiling for thumbv7em with bad asm #53065

mqudsi opened this issue Aug 4, 2018 · 2 comments
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state requires-nightly This issue requires a nightly compiler in some way.

Comments

@mqudsi
Copy link
Contributor

mqudsi commented Aug 4, 2018

mqudsi@Blitzkrieg /m/d/G/r/fullbuild> rustc --version
rustc 1.30.0-nightly (7e8ca9f8b 2018-08-03)
mqudsi@Blitzkrieg /m/d/G/r/fullbuild> rustc --target thumbv7em-none-eabi ./test.rs
fish: Job 2, “rustc --target thumbv7em-none-e…” terminated by signal SIGSEGV (Address boundary error)

test.rs:

#![feature(lang_items, start, asm)]
#![feature(panic_implementation)]
#![no_std]

use core::panic::PanicInfo;

fn rotr32(value: u32, mut shift: u8) -> u32 {
    shift = shift & 31;
    let result: u32;
    unsafe {
    asm!("ror $0, $1"
         : "=r"(result)
         : "r,0"(value), "r"(shift)
         );
    }

    return result;
}

#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
    return rotr32(14, 1) as isize;
}

#[panic_implementation]
fn panic(_: &PanicInfo) -> ! {
    loop {}
}
@mqudsi mqudsi changed the title rustc SIGSEGV compiling for thumbv7em rustc SIGSEGV compiling for thumbv7em with bad asm Aug 4, 2018
@nagisa
Copy link
Member

nagisa commented Aug 5, 2018

That most likely is just a LLVM assertion.

@jonas-schievink jonas-schievink added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state A-inline-assembly Area: Inline assembly (`asm!(…)`) labels Jan 27, 2019
@Centril Centril added the requires-nightly This issue requires a nightly compiler in some way. label Oct 25, 2019
@Amanieu
Copy link
Member

Amanieu commented May 22, 2020

This issue does not apply to the new asm! (RFC 2850) which properly validates operands.

The legacy llvm_asm! is deprecated and is no longer maintained.

@Amanieu Amanieu closed this as completed May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

No branches or pull requests

5 participants