Closed
Description
Code
#![no_main] // disable all Rust-level entry points
#![no_std]
use core::panic::PanicInfo;
pub struct BootLoader {}
const ALIGN: u32 = 1 << 0;
const MEMINFO: u32 = 1 << 1;
const MB1_MAGIC: u32 = 0x1BADB002;
const FLAGS: u32 = ALIGN | MEMINFO;
#[repr(C)]
#[derive(Clone, Copy)]
struct MultibootHeader {
magic: u32,
flags: u32,
checksum: u32,
}
#[link_section = ".multiboot"]
#[no_mangle]
static MULTIBOOT: MultibootHeader = MultibootHeader {
magic: MB1_MAGIC,
flags: FLAGS,
checksum: (-(MB1_MAGIC as i64 + FLAGS as i64) & 0xFFFFFFFF) as u32,
};
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
// this function is the entry point, since the linker looks for a function
// named `_start` by default
loop {}
}
/// This function is called on panic.
#[no_mangle]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
Meta
rustc --version --verbose
:
rustc 1.82.0-nightly (730d5d409 2024-08-10)
binary: rustc
commit-hash: 730d5d4095a264ef5f7c0a0781eea68c15431d45
commit-date: 2024-08-10
host: x86_64-pc-windows-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
Error output
error: internal compiler error: compiler\rustc_codegen_llvm\src\context.rs:1138:21: `fn_abi_of_instance(__ltsf2::__ltsf2, [])` failed: AdjustForForeignAbi(Unsupported { arch: "x86_64-unknown-none", abi: C { unwind: false } })
--> C:\Users\user\scoop\persist\rustup\.cargo\registry\src\index.crates.io-6f17d22bba15001f\compiler_builtins-0.1.118\src\macros.rs:471:35
|
471 | $(unsafe $($empty)?)? extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: C:\Users\user\scoop\persist\rustup\.cargo\registry\src\index.crates.io-6f17d22bba15001f\compiler_builtins-0.1.118\src\float\cmp.rs:101:1
|
101 | / intrinsics! {
102 | | #[avr_skip]
103 | | pub extern "C" fn __lesf2(a: f32, b: f32) -> i32 {
104 | | cmp(a, b).to_le_abi()
... |
172 | | }
173 | | }
| |_- in this macro invocation
|
= note: this error: internal compiler error originates in the macro `intrinsics` (in Nightly builds, run with -Z macro-backtrace for more info)
thread 'rustc' panicked at compiler\rustc_codegen_llvm\src\context.rs:1138:21:
Box<dyn Any>
stack backtrace:
0: 0x7fffe0c051b0 - std::backtrace_rs::backtrace::dbghelp64::trace::h0891390128512157
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/std\src\..\..\backtrace\src\backtrace/dbghelp64.rs:91:5
1: 0x7fffe0c051b0 - std::backtrace_rs::backtrace::trace_unsynchronized::hd55d9264ef67a50a
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/std\src\..\..\backtrace\src\backtrace/mod.rs:66:5
2: 0x7fffe0c051b0 - std::backtrace::Backtrace::create::h998072490b6ecdaa
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/std\src/backtrace.rs:331:13
3: 0x7fffe0c0510a - std::backtrace::Backtrace::force_capture::ha4187a9d3155ae9a
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/std\src/backtrace.rs:312:9
4: 0x7fffb1e9942e - <alloc[634035f5148dadfe]::boxed::Box<rustc_driver_impl[26ca7f734f0e7e1d]::install_ice_hook::{closure#0}> as core[65543c08ff064a40]::ops::function::Fn<(&dyn for<'a, 'b> core[65543c08ff064a40]::ops::function::Fn<(&'a std[cc5a7edb46e5d43d]::panic::PanicHookInfo<'b>,), Output = ()> + core[65543c08ff064a40]::marker::Send + core[65543c08ff064a40]::marker::Sync, &std[cc5a7edb46e5d43d]::panic::PanicHookInfo)>>::call
5: 0x7fffe0c1e5ad - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h06bf90988e8e1a97
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/alloc\src/boxed.rs:2164:9
6: 0x7fffe0c1e5ad - std::panicking::rust_panic_with_hook::h219892aeb93a6f25
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/std\src/panicking.rs:805:13
7: 0x7fffb51f5dd5 - std[cc5a7edb46e5d43d]::panicking::begin_panic::<rustc_errors[c40ea251d739b5ae]::ExplicitBug>::{closure#0}
8: 0x7fffb51f59c9 - std[cc5a7edb46e5d43d]::sys::backtrace::__rust_end_short_backtrace::<std[cc5a7edb46e5d43d]::panicking::begin_panic<rustc_errors[c40ea251d739b5ae]::ExplicitBug>::{closure#0}, !>
9: 0x7fffb51b6d09 - std[cc5a7edb46e5d43d]::panicking::begin_panic::<rustc_errors[c40ea251d739b5ae]::ExplicitBug>
10: 0x7fffb51e9b65 - <rustc_errors[c40ea251d739b5ae]::diagnostic::BugAbort as rustc_errors[c40ea251d739b5ae]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7fffb22e276f - <rustc_errors[c40ea251d739b5ae]::DiagCtxtHandle>::span_bug::<rustc_span[b016b44763db93a8]::span_encoding::Span, alloc[634035f5148dadfe]::string::String>
12: 0x7fffb22e9dde - rustc_middle[c67740f5c5f02f0c]::util::bug::opt_span_bug_fmt::<rustc_span[b016b44763db93a8]::span_encoding::Span>::{closure#0}
13: 0x7fffb22e9e2f - rustc_middle[c67740f5c5f02f0c]::ty::context::tls::with_opt::<rustc_middle[c67740f5c5f02f0c]::util::bug::opt_span_bug_fmt<rustc_span[b016b44763db93a8]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7fffb22e6db6 - rustc_middle[c67740f5c5f02f0c]::ty::context::tls::with_context_opt::<rustc_middle[c67740f5c5f02f0c]::ty::context::tls::with_opt<rustc_middle[c67740f5c5f02f0c]::util::bug::opt_span_bug_fmt<rustc_span[b016b44763db93a8]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7fffb22e61fd - rustc_middle[c67740f5c5f02f0c]::util::bug::span_bug_fmt::<rustc_span[b016b44763db93a8]::span_encoding::Span>
16: 0x7fffb2325382 - <rustc_codegen_llvm[42bfc7aca3b3212e]::context::CodegenCx as rustc_middle[c67740f5c5f02f0c]::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
17: 0x7fffb2325079 - <rustc_codegen_llvm[42bfc7aca3b3212e]::builder::Builder as rustc_middle[c67740f5c5f02f0c]::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
18: 0x7fffb230ee82 - <rustc_codegen_llvm[42bfc7aca3b3212e]::builder::Builder as rustc_middle[c67740f5c5f02f0c]::ty::layout::FnAbiOf>::fn_abi_of_instance::{closure#0}
19: 0x7fffb231bf9e - <rustc_codegen_ssa[f64aba77bf7afde8]::mir::FunctionCx<rustc_codegen_llvm[42bfc7aca3b3212e]::builder::Builder>>::codegen_terminator
20: 0x7fffb230c001 - rustc_codegen_ssa[f64aba77bf7afde8]::mir::codegen_mir::<rustc_codegen_llvm[42bfc7aca3b3212e]::builder::Builder>
21: 0x7fffb234f961 - rustc_codegen_ssa[f64aba77bf7afde8]::base::codegen_instance::<rustc_codegen_llvm[42bfc7aca3b3212e]::builder::Builder>
22: 0x7fffb225f143 - <rustc_middle[c67740f5c5f02f0c]::mir::mono::MonoItem as rustc_codegen_ssa[f64aba77bf7afde8]::mono_item::MonoItemExt>::define::<rustc_codegen_llvm[42bfc7aca3b3212e]::builder::Builder>
23: 0x7fffb2347bc7 - rustc_codegen_llvm[42bfc7aca3b3212e]::base::compile_codegen_unit::module_codegen
24: 0x7fffb23470b0 - rustc_codegen_llvm[42bfc7aca3b3212e]::base::compile_codegen_unit
25: 0x7fffb234ea12 - rustc_codegen_ssa[f64aba77bf7afde8]::base::codegen_crate::<rustc_codegen_llvm[42bfc7aca3b3212e]::LlvmCodegenBackend>
26: 0x7fffb22df4ba - <rustc_codegen_llvm[42bfc7aca3b3212e]::LlvmCodegenBackend as rustc_codegen_ssa[f64aba77bf7afde8]::traits::backend::CodegenBackend>::codegen_crate
27: 0x7fffb208b342 - <rustc_session[4c0d15dacd878bfb]::session::Session>::time::<alloc[634035f5148dadfe]::boxed::Box<dyn core[65543c08ff064a40]::any::Any>, rustc_interface[773e200dce750870]::passes::start_codegen::{closure#0}>
28: 0x7fffb2147a82 - rustc_interface[773e200dce750870]::passes::start_codegen
29: 0x7fffb20b599c - <rustc_interface[773e200dce750870]::queries::Linker>::codegen_and_build_linker
30: 0x7fffb1e31eb3 - <rustc_middle[c67740f5c5f02f0c]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[26ca7f734f0e7e1d]::run_compiler::{closure#0}::{closure#1}::{closure#6}, core[65543c08ff064a40]::result::Result<core[65543c08ff064a40]::option::Option<rustc_interface[773e200dce750870]::queries::Linker>, rustc_span[b016b44763db93a8]::ErrorGuaranteed>>
31: 0x7fffb1ebe3c9 - <rustc_interface[773e200dce750870]::queries::QueryResult<&rustc_middle[c67740f5c5f02f0c]::ty::context::GlobalCtxt>>::enter::<core[65543c08ff064a40]::result::Result<core[65543c08ff064a40]::option::Option<rustc_interface[773e200dce750870]::queries::Linker>, rustc_span[b016b44763db93a8]::ErrorGuaranteed>, rustc_driver_impl[26ca7f734f0e7e1d]::run_compiler::{closure#0}::{closure#1}::{closure#6}>
32: 0x7fffb1e3c056 - <rustc_interface[773e200dce750870]::interface::Compiler>::enter::<rustc_driver_impl[26ca7f734f0e7e1d]::run_compiler::{closure#0}::{closure#1}, core[65543c08ff064a40]::result::Result<core[65543c08ff064a40]::option::Option<rustc_interface[773e200dce750870]::queries::Linker>, rustc_span[b016b44763db93a8]::ErrorGuaranteed>>
33: 0x7fffb1e79d3f - rustc_span[b016b44763db93a8]::create_session_globals_then::<core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>, rustc_interface[773e200dce750870]::util::run_in_thread_with_globals<rustc_interface[773e200dce750870]::util::run_in_thread_pool_with_globals<rustc_interface[773e200dce750870]::interface::run_compiler<core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>, rustc_driver_impl[26ca7f734f0e7e1d]::run_compiler::{closure#0}>::{closure#1}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>::{closure#0}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
34: 0x7fffb1e73f9b - std[cc5a7edb46e5d43d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[773e200dce750870]::util::run_in_thread_with_globals<rustc_interface[773e200dce750870]::util::run_in_thread_pool_with_globals<rustc_interface[773e200dce750870]::interface::run_compiler<core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>, rustc_driver_impl[26ca7f734f0e7e1d]::run_compiler::{closure#0}>::{closure#1}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>::{closure#0}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>
35: 0x7fffb1e76abe - <<std[cc5a7edb46e5d43d]::thread::Builder>::spawn_unchecked_<rustc_interface[773e200dce750870]::util::run_in_thread_with_globals<rustc_interface[773e200dce750870]::util::run_in_thread_pool_with_globals<rustc_interface[773e200dce750870]::interface::run_compiler<core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>, rustc_driver_impl[26ca7f734f0e7e1d]::run_compiler::{closure#0}>::{closure#1}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>::{closure#0}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[65543c08ff064a40]::result::Result<(), rustc_span[b016b44763db93a8]::ErrorGuaranteed>>::{closure#1} as core[65543c08ff064a40]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
36: 0x7fffe0c2d99d - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb6cffdf165f316c3
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/alloc\src/boxed.rs:2150:9
37: 0x7fffe0c2d99d - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8a43edabbe288821
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/alloc\src/boxed.rs:2150:9
38: 0x7fffe0c2d99d - std::sys::pal::windows::thread::Thread::new::thread_start::hca2051deb825b5c8
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45\library/std\src\sys\pal\windows/thread.rs:55:22
39: 0x7ff8477c7344 - <unknown>
40: 0x7ff8484426b1 - <unknown>
rustc version: 1.82.0-nightly (730d5d409 2024-08-10)
platform: x86_64-pc-windows-gnu
query stack during panic:
end of query stack
Backtrace
Config.toml
[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins", "alloc"]
[build]
target = "x86_64-rustos.json"
rustflags = ["-C", "link-arg=-Tlinker.ld"]
[target.x86_64-unknown-none]
runner = "qemu-system-x86_64 -kernel target/x86_64-rustos/debug/rust-os -d int,cpu_reset"
x86_64-rustos.json
{
"llvm-target": "x86_64-unknown-none",
"data-layout":"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"arch": "x86_64-unknown-none",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "none",
"executables": true,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float"
}
Linker file
ENTRY(_start)
SECTIONS {
. = 1M;
.text : ALIGN(4K) {
KEEP(*(.multiboot))
*(.text)
}
.rodata : ALIGN(4K) {
*(.rodata)
}
.data : ALIGN(4K) {
*(.data)
}
}