Closed as not planned
Description
Hello!
I've been trying to get Rust running on the original Xbox from 2001, however, when trying to compile the core
crate I get an internal compiler error, whose details you can find below. This also happened to me when trying to make an i386 operating system. I have not been able to find a fix anywhere, including previous issues here.
Code
Compile the core
crate with a freestanding binary using the command cargo build -Zbuild-std=core --target xbox.json
with the following xbox.json
:
{
"llvm-target": "i686-pc-win32",
"data-layout": "e-p:32:32-e-m:e-i64:64-f80:64-n8:16:32-S128",
"arch": "i686",
"target-endian": "little",
"target-pointer-width": "32",
"target-c-int-width": "32",
"os": "windows",
"executables": true,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"panic-strategy": "abort",
"is-like-windows": true
}
Meta
rustc --version --verbose
:
rustc 1.58.0-nightly (547a6ffee 2021-10-21)
binary: rustc
commit-hash: 547a6ffee0cf4da9929a9e3d49546dc87d607735
commit-date: 2021-10-21
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0
Error output
error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:889:21: `fn_abi_of_instance(slice::cmp::memcmp, [])` failed: target architecture "i686" does not support `extern "C"` ABI
--> /home/kosmas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs:18:5
|
18 | fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace
Compiling core v0.0.0 (/home/kosmas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling rustc-std-workspace-core v1.99.0 (/home/kosmas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:889:21: `fn_abi_of_instance(slice::cmp::memcmp, [])` failed: target architecture "i686" does not support `extern "C"` ABI
--> /home/kosmas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs:18:5
|
18 | fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/547a6ffee0cf4da9929a9e3d49546dc87d607735/compiler/rustc_errors/src/lib.rs:1093:9
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::span_bug
Compiling compiler_builtins v0.1.49
3: rustc_errors::Handler::span_bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::span_bug_fmt
7: <rustc_codegen_llvm::context::CodegenCx as rustc_middle::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
8: <rustc_codegen_llvm::builder::Builder as rustc_middle::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
9: rustc_middle::ty::layout::FnAbiOf::fn_abi_of_instance::{{closure}}
10: rustc_codegen_ssa::mir::codegen_mir
11: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
13: rustc_codegen_llvm::base::compile_codegen_unit
14: rustc_codegen_ssa::base::codegen_crate
15: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
16: rustc_session::utils::<impl rustc_session::session::Session>::time
17: rustc_interface::queries::Queries::ongoing_codegen
18: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
19: rustc_span::with_source_map
20: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.58.0-nightly (547a6ffee 2021-10-21) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z force-unstable-if-unmarked -C panic=abort -C embed-bitcode=no -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `core`
warning: build failed, waiting for other jobs to finish...
error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:889:21: `fn_abi_of_instance(conv::__floatsisf, [])` failed: target architecture "i686" does not support `extern "C"` ABI
--> /home/kosmas/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.49/src/macros.rs:278:9
|
278 | pub extern $abi fn $name( $($argname: $ty),* ) -> $ret {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: /home/kosmas/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.49/src/float/conv.rs:77:1
|
77 | / intrinsics! {
78 | | #[arm_aeabi_alias = __aeabi_i2f]
79 | | pub extern "C" fn __floatsisf(i: i32) -> f32 {
80 | | int_to_float(i)
... |
152 | | }
153 | | }
| |_- 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 'Box<dyn Any>', /rustc/547a6ffee0cf4da9929a9e3d49546dc87d607735/compiler/rustc_errors/src/lib.rs:1093:9
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::span_bug
3: rustc_errors::Handler::span_bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::span_bug_fmt
7: <rustc_codegen_llvm::context::CodegenCx as rustc_middle::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
8: rustc_middle::ty::layout::FnAbiOf::fn_abi_of_instance::{{closure}}
9: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn
10: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
11: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
12: rustc_codegen_llvm::base::compile_codegen_unit
13: rustc_codegen_ssa::base::codegen_crate
14: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
15: rustc_session::utils::<impl rustc_session::session::Session>::time
16: rustc_interface::queries::Queries::ongoing_codegen
17: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
18: rustc_span::with_source_map
19: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.58.0-nightly (547a6ffee 2021-10-21) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z force-unstable-if-unmarked -C panic=abort -C embed-bitcode=no -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: build failed
All help is welcome and appreciated. Thank you and have a great day!
Metadata
Metadata
Assignees
Labels
Area: Debugging information in compiled programs (DWARF, PDB, etc.)Category: This is a bug.Operating system: WindowsTarget: x86 processors, 32 bit (like i686-*) (IA-32)Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64)Relevant to the compiler team, which will review and decide on the PR/issue.