diff options
-rw-r--r-- | .cargo/config | 10 | ||||
-rw-r--r-- | rust-toolchain.toml | 4 | ||||
-rw-r--r-- | src/main.rs | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/.cargo/config b/.cargo/config index 6588394..a6f4904 100644 --- a/.cargo/config +++ b/.cargo/config @@ -7,3 +7,13 @@ rustflags = ["-C", "target-feature=-m,-a,-c"] runner = "qemu-riscv64" #runner = "qemu-riscv64 -d in_asm" #runner = "qemu-riscv64 -strace" + +[unstable] +# Shipped core library is build with `imac` extensions, since we disable `mac` +# we have to rebuild `core`. +# Unstable features are only enabled with a nightly toolchain: +# > cargo +nightly build +# +# Validate the resulting binary by checking the instructions & encodings: +# > llvm-objdump -C -d <bin> +build-std = ["core"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..9684b6f --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +# Required to build with nightly to enable `build-std`, see .cargo/config for +# more details why. +channel = "nightly" diff --git a/src/main.rs b/src/main.rs index f1ea8b0..9b48fd7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,3 +18,10 @@ fn panic_handler(info: &core::panic::PanicInfo) -> ! { eprintln!("{}", info); sys::exit(42); } + +// Since we disable the atomic isa extension, the compiler emits calls to software emulation. We +// provide the stub to make the linker happy for now. +#[no_mangle] +pub fn __atomic_load_8() { + panic!("__atomic_load_8 not implemented!"); +} |