Crate rsymtab

source ·
Expand description

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.

Structs

Functions

  • returns a list of all the exported symbols

Attribute Macros

  • a macro which is used to export items to the list of exported symbols. this can only be used on functions and static variables.