Open
Description
Code
#![no_std]
#![no_main]
#![feature(asm_experimental_arch)]
use core::{panic::PanicInfo, arch::asm};
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
#[no_mangle]
pub extern "C" fn main() {
let target: *mut u8 = 0x0025 as *mut u8;
let value: u8 = 0;
unsafe {
asm!(
"st {port}, {value}",
port = in(reg_ptr) target,
value = in(reg) value,
);
}
panic!()
}
Meta
rustc --version --verbose
:
rustc 1.84.0-nightly (a93c1718c 2024-10-24)
binary: rustc
commit-hash: a93c1718c80b9f100056c8eec3fc37fbd6424134
commit-date: 2024-10-24
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1
Error output
error: could not compile `avr-project` (bin "avr-project")
Caused by:
process didn't exit successfully: `/home/ondre/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name avr_project --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=186 --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C codegen-units=1 --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=3c8db77931085eba -C extra-filename=-3c8db77931085eba --out-dir /home/ondre/avrlibstest/target/avr-atmega328p/release/deps --target /home/ondre/avrlibstest/avr-atmega328p.json -C strip=debuginfo -L dependency=/home/ondre/avrlibstest/target/avr-atmega328p/release/deps -L dependency=/home/ondre/avrlibstest/target/release/deps --extern 'noprelude:compiler_builtins=/home/ondre/avrlibstest/target/avr-atmega328p/release/deps/libcompiler_builtins-013c779640681efb.rlib' --extern 'noprelude:core=/home/ondre/avrlibstest/target/avr-atmega328p/release/deps/libcore-1167638d3e17fa03.rlib' -Z unstable-options` (signal: 4, SIGILL: illegal instruction)
Project config
In file rust-toolchain.toml
:
[toolchain]
channel = "nightly"
In file .cargo/config.toml
:
[build]
target = "avr-atmega328p.json"
[unstable]
build-std = ["core"]
In file avr-atmega328p.json
:
{
"arch": "avr",
"atomic-cas": false,
"cpu": "atmega328p",
"crt-objects-fallback": "false",
"data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8",
"eh-frame-header": false,
"env": "gnu",
"exe-suffix": ".elf",
"late-link-args": {
"gnu-cc": [
"-lgcc"
],
"gnu-lld-cc": [
"-lgcc"
]
},
"linker": "avr-gcc",
"linker-flavor": "gnu-cc",
"llvm-target": "avr-unknown-unknown",
"max-atomic-width": 16,
"metadata": {
"description": null,
"host_tools": null,
"std": null,
"tier": null
},
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega328p"
],
"gnu-lld-cc": [
"-mmcu=atmega328p"
]
},
"relocation-model": "static",
"target-c-int-width": "16",
"target-pointer-width": "16"
}
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Category: This is a bug.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Target: AVR processors (ATtiny, ATmega, etc.)Relevant to the compiler team, which will review and decide on the PR/issue.