rust-embedded / riscv

Low level access to RISC-V processors
818 stars 160 forks source link

`riscv-rt`: Duplicate symbol when linking with Newlib #197

Closed gmmyung closed 5 months ago

gmmyung commented 5 months ago

Hi, I am trying to use a C library that depends on Newlib with rust. This code block seems to generate the abort symbol, but this collides with the libc abort() symbol. Is it possible for the riscv-rt crate to change the name of the symbol to something else?

https://github.com/rust-embedded/riscv/blob/27c4faf40da4b1c47244b9504442a5fe12827f39/riscv-rt/src/asm.rs#L337-L343

romancardenas commented 5 months ago

Right now that is not possible. But it could be easily fixed by defining the abort symbol as weak in the assembly. In this way, the symbol would get overwritten by your C lib.