#symbol-table #symbol #table #generation #kernel #ksymtab

no-std rsymtab

generation of an exported symbol table like ksymtab for rust crates

1 unstable release

0.1.0 Oct 13, 2023

#29 in #symbol-table

23 downloads per month

MIT license

6KB
67 lines

rsymtab

bla


lib.rs:

this is a crate for generating a list of exported symbols, similar to how the ksymtab works in the linux kernel, but for rust crates.

the basic idea is that you can export items by adding an #[export] attribute on them, and then you can access all the exported symbols by calling the symbols function.

Example

fn main() {
    println!("{:?}", rsymtab::symbols());
}

#[rsymtab::export]
fn foo() {}

#[rsymtab::export]
fn bar() {}

#[rsymtab::export]
static mut FOO: u32 = 5;

Portability

NOTE: this crate currently only works on linux.

that is because it uses a linker script to achieve some of the magic of creating the symbol table. additionally, only linkers which support specification of multiple linker scripts are supported, because otherwise this crate will overwrite the default linker script.

Dependencies

~285–740KB
~18K SLoC