How to check the variable AGE
is in .data.static
segment after building?
#[link_section = ".data.static"]
static AGE: u8 = 5;
fn main() {
println!("{}", AGE);
}
How to check the variable AGE
is in .data.static
segment after building?
#[link_section = ".data.static"]
static AGE: u8 = 5;
fn main() {
println!("{}", AGE);
}
Binary dumping tools like objdump
or MSVCs dumpbin
can pretty easily show the section details of a binary (library, shared object/dll, or executable), that will at least show that the section was created.
You'd need debugging tools to figure out if the variable actually got created in that section of it's not a library though, either running under a debugger and figuring out if the RVA of the section equals the loaded virtual address minus the module virtual address, or looking up the symbol RVA in the debug symbols. I would think that's pretty uneccesary if you can see the custom section though.
I'll also note that on Windows, there's an 8 character limit on image (exe/dll) section names.
Got it, thanks!