pub struct Symbol {
pub st_name: u32,
pub st_shndx: u16,
pub st_value: u64,
pub st_size: u64,
/* private fields */
}
Fields§
§st_name: u32
This member holds an index into the symbol table’s string table, which holds the character representations of the symbol names. If the value is non-zero, it represents a string table index that gives the symbol name. Otherwise, the symbol table entry has no name.
st_shndx: u16
Every symbol table entry is defined in relation to some section. This member holds the relevant section header table index. As the sh_link and sh_info interpretation table and the related text describe, some section indexes indicate special meanings.
If this member contains SHN_XINDEX, then the actual section header index is too large to fit in this field. The actual value is contained in the associated section of type SHT_SYMTAB_SHNDX.
st_value: u64
This member gives the value of the associated symbol. Depending on the context, this may be an absolute value, an address, and so on.
- In relocatable files, st_value holds alignment constraints for a symbol whose section index is SHN_COMMON.
- In relocatable files, st_value holds a section offset for a defined symbol. st_value is an offset from the beginning of the section that st_shndx identifies.
- In executable and shared object files, st_value holds a virtual address. To make these files’ symbols more useful for the dynamic linker, the section offset (file interpretation) gives way to a virtual address (memory interpretation) for which the section number is irrelevant.
st_size: u64
This member gives the symbol’s size. For example, a data object’s size is the number of bytes contained in the object. This member holds 0 if the symbol has no size or an unknown size.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Returns true if a symbol is undefined in this ELF object.
When linking and loading, undefined symbols in this object get linked to a defined symbol in another object.