Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Lots of rust-lld errors #78

Closed
NathanMcMillan54 opened this issue Jul 31, 2021 · 3 comments
Closed

Lots of rust-lld errors #78

NathanMcMillan54 opened this issue Jul 31, 2021 · 3 comments

Comments

@NathanMcMillan54
Copy link

I started writing a Rust application that looked pretty much exactly the same as the "empty" example, but when I compile it lots of rust-lld errors show up. I'm compiling with riscv32imac-unknown-none-elf, my rustc version is 1.56.

Here are the first 5:

          rust-lld: error: undefined symbol: UserTimer
          >>> referenced by riscv_rt.e45bfb96-cgu.4
          >>>               riscv_rt-5f3b7c942d92931d.riscv_rt.e45bfb96-cgu.4.rcgu.o:(__INTERRUPTS) in archive /home/nathan/Desktop/githubProjects/novusk/target/riscv32i-unknown-none-elf/debug/deps/libriscv_rt-5f3b7c942d92931d.rlib
          
          rust-lld: error: undefined symbol: SupervisorTimer
          >>> referenced by riscv_rt.e45bfb96-cgu.4
          >>>               riscv_rt-5f3b7c942d92931d.riscv_rt.e45bfb96-cgu.4.rcgu.o:(__INTERRUPTS) in archive /home/nathan/Desktop/githubProjects/novusk/target/riscv32i-unknown-none-elf/debug/deps/libriscv_rt-5f3b7c942d92931d.rlib
          
          rust-lld: error: undefined symbol: MachineTimer
          >>> referenced by riscv_rt.e45bfb96-cgu.4
          >>>               riscv_rt-5f3b7c942d92931d.riscv_rt.e45bfb96-cgu.4.rcgu.o:(__INTERRUPTS) in archive /home/nathan/Desktop/githubProjects/novusk/target/riscv32i-unknown-none-elf/debug/deps/libriscv_rt-5f3b7c942d92931d.rlib
          
          rust-lld: error: undefined symbol: UserExternal
          >>> referenced by riscv_rt.e45bfb96-cgu.4
          >>>               riscv_rt-5f3b7c942d92931d.riscv_rt.e45bfb96-cgu.4.rcgu.o:(__INTERRUPTS) in archive /home/nathan/Desktop/githubProjects/novusk/target/riscv32i-unknown-none-elf/debug/deps/libriscv_rt-5f3b7c942d92931d.rlib
          
          rust-lld: error: undefined symbol: SupervisorExternal
          >>> referenced by riscv_rt.e45bfb96-cgu.4
          >>>               riscv_rt-5f3b7c942d92931d.riscv_rt.e45bfb96-cgu.4.rcgu.o:(__INTERRUPTS) in archive /home/nathan/Desktop/githubProjects/novusk/target/riscv32i-unknown-none-elf/debug/deps/libriscv_rt-5f3b7c942d92931d.rlib
          
          rust-lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

Is there a linker script that I need? What's causing this?

@almindor
Copy link
Contributor

almindor commented Aug 1, 2021

What board/core are you using?

@Disasm
Copy link
Member

Disasm commented Aug 1, 2021

Is there a linker script that I need? What's causing this?

Yes, you need to pass the linker script name as well as a script with memory definitions in .cargo/config:
https://github.com/riscv-rust/longan-nano/blob/master/.cargo/config
link.x is provided by riscv-rt, but memory.x is usually provided by user or one of the chip support crates.

@NathanMcMillan54
Copy link
Author

Thanks! It worked!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants