How to call a assembly function (included in library crate) from a binary crate ?
boot.S
.globl __boot_; /* To be visible to linker for entry */
__boot_:
csrw mie, zero;
lib.rs
#![no_std]
#![no_main]
use core::arch::global_asm;
global_asm!(include_str!("boot.S"));
nm output
riscv64-unknown-elf-nm target/riscv32imac-unknown-none-elf/debug/liblibs.rlib
lib.rmeta:
riscv64-unknown-elf-nm: lib.rmeta: no symbols
libs-49cd470ca24674d0.17nxpthld8fimcwx.rcgu.o:
00000000 N __boot_
U __stack_start_
binary crate Cargo.toml
[package]
name = "execs"
version = "0.1.0"
edition = "2021"
[dependencies]
libs = {path = "../libs" }
calling __boot_
from main.rs (binary crate)
fn test1 () {
unsafe {
libs::__boot_();
}
}
Cargo build throws **error**.
libs::__boot_() => Here I tried calling libs::__boot_; & libs::__boot_() as well.
| ^^^^^^^ not found in `libs`
libs::__boot_();
| ^^^^^^^ not found in `libs`
what am I missing? Clearly the rlib has the _boot from the nm command. Anything to be done to export the symbol from library crate?