Next: ELF Notes, Previous: ELF Program Headers, Up: Top [Contents][Index]
ELF symbols are implemented by the Elf32_Sym and
Elf64_Sym struct types.
type Elf32_Sym =
struct
{
offset<Elf_Word,B> st_name;
Elf32_Addr st_value;
offset<Elf_Word,B> st_size;
Elf_Sym_Info st_info;
Elf_Sym_Other_Info st_other;
Elf_Half st_shndx;
};
type Elf64_Sym =
struct
{
offset<Elf_Word,B> st_name;
Elf_Sym_Info st_info;
Elf_Sym_Other_Info st_other;
Elf_Half st_shndx;
Elf64_Addr st_value;
Elf64_Xword st_size;
};
st_nameIndex into the file symbol string table. If this entry is zero it means the symbol has no name.
st_infoThe type and the binding attributes of the symbol.
type Elf_Sym_Info =
struct uint<8>
{
uint<4> st_bind;
uint<4> st_type;
};
Where:
st_bindSpecifies how the symbol binds. This must be one of
ELF_STB_LOCAL, ELF_STB_GLOBAL or ELF_STB_WEAK.
st_typeSpecifies the type of the symbol. This must be one of the
ELF_STT_* values.
The following symbol types are defined by the core specification:
ELF_STT_NOTYPEThe symbol’s type is not specified.
ELF_STT_OBJECTThe symbol is associated with a data object, such as a variable, an array and so on.
ELF_STT_FUNCThe symbol is associated with a function or other executable code.
ELF_STT_SECTIONThe symbol is associated with a section. This is primarily used for relocations.
ELF_STT_FILEBy convention, this symbol’s name gives the name of the source file associated with the object file.
A file symbol has local binding, its section index is
ELF_SHN_ABS and it precedes the other local symbols for the
file. This is currently not checked by the pickles.
ELF_STT_COMMONThe symbol labels an uninitialized common block.
ELF_STT_TLSThe symbol specifies a Thread-Local Storage entity, in the form of an offset.
st_otherThis field specifies the symbol’s visibility. This is one of the
ELF_STV_* values.
The list of symbol visibility defined by the core spec are:
ELF_STV_DEFAULTThe visibility of this symbol is defined by its binding. Global and weak symbols are visible outside of heir defining component. Local symbols are hidden.
ELF_STV_PROTECTEDThis symbol is visible in other components but it is not preemptable.
A symbol with local binding may not have protected visibility. This
is checked by a constraint in Elf_Sym_Info.
ELF_STV_HIDDENThis symbol is not visible to other components.
ELF_STV_INTERNALThe meaning of this attribute, if any, is processor specific.
Some machine types define other values that can be used in
st_other. See ELF Machines.
st_shndxEvery symbol table entry is defined in relation to some section. This holds the index into the section header table of the section related to this symbol.
However, some values for this field indicate special meanings. These
are the ELF_SHN_* values. The core specification defines the
following:
ELF_SHN_UNDEFThe symbol is undefined.
ELF_SHN_ABSThe symbol is absolute, meaning its value will not change because of relocation.
ELF_SHN_COMMONThe symbol refers to a common block that has not yet been allocated.
ELF_SHN_XINDEXThe symbol refers to a specific location within a section, but the
section header index for that section is too large to e represented
directly in this entry. The actual section header index is found in
the associated SHT_SYMTAB_SHNDX section.
Some machine types define additional values with special meanings for
st_shndx. See ELF Machines.
st_valueOffset from the beginning of the section identified by
st_shndx.
st_sizeSize associated with the symbol. For example, the size of a data object. Symbols that have no associated size, or unknown size, have zero in this field.
Next: ELF Notes, Previous: ELF Program Headers, Up: Top [Contents][Index]