Skip to content

Unable to mark ARM32's r14 register as clobbered in asm! #82052

Closed
@jrvanwhy

Description

@jrvanwhy

I attempted to compile a crate containing the following expression:

unsafe { asm!("svc 0", lateout("r14") _); }

I expected it to compile successfully.

Instead, I received this error:

error: couldn't allocate output register for constraint '{r14}'

rustc --version --verbose:

rustc 1.52.0-nightly (3f5aee2d5 2021-02-12)
binary: rustc
commit-hash: 3f5aee2d5241139d808f4fdece0026603489afd1
commit-date: 2021-02-12
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

RUST_BACKTRACE=1 omitted, it did not produce anything else.

@Amanieu diagnosed the cause and offered a solution here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.F-asm`#![feature(asm)]` (not `llvm_asm`)O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions