Closed hyperswine closed 8 months ago
https://github.com/riscv-rust/riscv-rust-quickstart (an example project for HiFive1 board) and other projects use this library without modifications. You may need to fork this library if you need support for a custom target which is not here yet or not yet supported by the stable Rust release.
Oh cool, this works withriscv64gc-unknown-none-elf
right?
Getting this error:
error: linking with `rust-lld` failed: exit status: 1
|
= note: "rust-lld" "-flavor" "gnu" "/var/folders/w_/_7kxdnz529b9t9v2wy2jq1lc0000gn/T/rustcarHvTd/symbols.o" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/x-e8d7fbc0a1b159dc.2m5s5lr22y6ph1s7.rcgu.o" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/x-e8d7fbc0a1b159dc.2oek2cyra1n4zh8x.rcgu.o" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/x-e8d7fbc0a1b159dc.3evta6x8yg15nehd.rcgu.o" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/x-e8d7fbc0a1b159dc.4t4rpb5rx2cjojvv.rcgu.o" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/x-e8d7fbc0a1b159dc.u0cxapaxboc3jt3.rcgu.o" "--as-needed" "-L" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps" "-L" "/Volumes/Usable/Github/riscv-rust-quickstart/target/debug/deps" "-L" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-261dd2fae3f16e7e/out" "-L" "/Users/jasonq/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib" "-Bstatic" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libr0-1a1ac5409ea05dbe.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv-ec7896b762bd1755.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libbare_metal-fbc186466253d1a6.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv-12406eb11d01252f.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libcritical_section-63a25403ffa66cec.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libbit_field-89f641f7382cb7d1.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libembedded_hal-97c85cf7b6e0feec.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libvoid-0da957ea58658e89.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libnb-89b124c07f3953d2.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libnb-76794dec96837829.rlib" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libpanic_halt-95f9e5b5875ed9a2.rlib" "/Users/jasonq/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/librustc_std_workspace_core-0c15b3aa6ac6eb70.rlib" "/Users/jasonq/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore-d889182149692934.rlib" "/Users/jasonq/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcompiler_builtins-40034286794b97d1.rlib" "-Bdynamic" "-znoexecstack" "-L" "/Users/jasonq/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib" "-o" "/Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/x-e8d7fbc0a1b159dc" "--gc-sections"
= note: rust-lld: error: undefined symbol: _setup_interrupts
>>> referenced by lib.rs:413 (src/lib.rs:413)
>>> riscv_rt-ca1035a70e9ebbaf.riscv_rt.22165755-cgu.3.rcgu.o:(_start_rust) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: __pre_init
>>> referenced by lib.rs:413 (src/lib.rs:413)
>>> riscv_rt-ca1035a70e9ebbaf.riscv_rt.22165755-cgu.3.rcgu.o:(_start_rust) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: _sbss
>>> referenced by lib.rs:413 (src/lib.rs:413)
>>> riscv_rt-ca1035a70e9ebbaf.riscv_rt.22165755-cgu.3.rcgu.o:(_start_rust) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: _ebss
>>> referenced by lib.rs:413 (src/lib.rs:413)
>>> riscv_rt-ca1035a70e9ebbaf.riscv_rt.22165755-cgu.3.rcgu.o:(_start_rust) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: _sdata
>>> referenced by lib.rs:422 (src/lib.rs:422)
>>> riscv_rt-ca1035a70e9ebbaf.riscv_rt.22165755-cgu.3.rcgu.o:(_start_rust) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: _sidata
>>> referenced by lib.rs:422 (src/lib.rs:422)
>>> riscv_rt-ca1035a70e9ebbaf.riscv_rt.22165755-cgu.3.rcgu.o:(_start_rust) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: _max_hart_id
>>> referenced by asm.S:58
>>> riscv-rt.o:(.init+0x64) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
>>> referenced by asm.S:58
>>> riscv-rt.o:(.init+0x68) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: _stack_start
>>> referenced by asm.S:58
>>> riscv-rt.o:(.init+0x74) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
rust-lld: error: undefined symbol: _hart_stack_size
>>> referenced by asm.S:59
>>> riscv-rt.o:(.init+0x7C) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
>>> referenced by asm.S:59
>>> riscv-rt.o:(.init+0x80) in archive /Volumes/Usable/Github/riscv-rust-quickstart/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-ca1035a70e9ebbaf.rlib
error: could not compile `x` due to previous error
with a cargo.toml:
[target.riscv64imac-unknown-none-elf]
runner = "riscv64-unknown-elf-gdb -q -x gdb_init"
[build]
target = "riscv64imac-unknown-none-elf"
Sorry if Im missing something really obvious, but any ideas?
Are you passing linker arguments when compiling? The link.x
file defines weak symbols for those symbols that appear missing on your traces.
I'm closing this issue as stale, as I believe the problem was that the linker arguments were not provided. Feel free to re-open it if you consider it necessary.
Is it possible to use this as a "just works" library without extra copying/config or is it meant to be used as a template?