MIPS ELF Symbols

From Dmz-portal

Jump to: navigation, search

See http://www.sco.com/developers/gabi for more details of gABI descriptions


Header Structure

typedef struct {
       Elf32_Word      st_name;
       Elf32_Byte      st_info;
       Elf32_Byte      st_other;
       Elf32_Section   st_shndx;
       Elf32_Addr      st_value;
       Elf32_Word      st_size;
} Elf32_Stdr;
typedef struct {
       Elf64_Word      st_name;
       Elf64_Byte      st_info;
       Elf64_Byte      st_other;
       Elf64_Section   st_shndx;
       Elf64_Addr      st_value;
       Elf64_Xword     st_size;
} Elf64_Ehdr;

st_info: Binding and Type

Symbol Binding (ELF32_ST_BIND)

Symbolic Name Value Description
STB_LOCAL 0x0 Not visible outside object file where defined
STB_GLOBAL 0x1 Visible to all object files. Multiple definitions cause errors. Force extraction of defining object from archive file.
STB_WEAK 0x2 Visible to all object files. Ignored if STB_GLOBAL with same name found. Do not force extraction of defining object from archive file. Value is 0 if undefined.
STB_LOPROC 0x13 First processor-specific binding
STB_SPLIT_COMMON 0x13 Split common symbol binding (IRIX only?)
STB_HIPROC 0x15 Last processor specific binding

Symbol Type (ELF32_ST_TYPE)

Symbolic Name Value Description
STT_NOTYPE 0x0 Not specified
STT_OBJECT 0x1 Data object variable, array, etc.
STT_FUNC 0x2 Function or other executable code
STT_SECTION 0x3 Section. Exists primarily for relocation.
STT_FILE 0x4 Name (pathname?) of the source file associated with object. Binding is STT_LOCAL, section index is SHN_ABS, and it precedes other STB_LOCAL symbols if present.
STT_COMMON 0x5 An uninitialised common block
STT_TLS 0x6 Thread local data object
STT_RELC 0x8 Complex relocation expression
STT_SRELC 0x9 Signed Complex relocation expression
STT_LOOS 0xA Begin OS-specific semantics
STT_GNU_IFUNC 0xA Symbol is a GNU indirect code object
STT_HIOS 0xC End OS-specific semantics
STT_LOPROC 0xd First processor-specific type
STT_HIPROC 0xf Last processor-specific type

st_other: Section Visibility, ISA and Other Flags

Masks For st_other Fields

Symbolic Name Value Description
ELF_ST_VISIBILITY 0x03 Mask for visibility portion of st_other
STO_MIPS_ISA 0xc0 Mask for MIPS isa portion of st_other

The 7th and 8th bit of the st_other byte (0x3 << 6)

STO_MIPS_FLAGS 0x3c Mask for MIPS flags portion of st_other

Neither ISA nor Visibility (~(STO_MIPS_ISA | ELF_ST_VISIBILITY (-1)))

Generic Visibility

Symbolic Name Value Description
STV_DEFAULT 0x0 Visibility is specified by binding type


STV_INTERNAL 0x1 OS specific version of STV_HIDDEN


STV_HIDDEN 0x2 Can only be seen inside currect component


STV_PROTECTED 0x3 Treat as STB_LOCAL inside current component


MIPS Specific ISA

Symbolic Name Value Description
STO_MIPS16 0xf0 Mips16 symbol

For some reason this takes up 4 bits and overuns STO_MICROMIPS and STO_MIPS_PIC

STO_MICROMIPS 0x80 MicroMips symbol

(This is overwritten by STO_MIPS16, so check for STO_MIPS16 first)

MIPS Specific Flags

Symbolic Name Type Value Description
STO_MIPS_PLT 0x08 xxx


STO_MIPS_PIC 0x20 In an object that contains both PIC and non-PIC this marks the function as being PIC

(This is overwritten by STO_MIPS16, so assume non-PIC if STO_MIPS16)

STO_OPTIONAL 0x04 The symbol definition is optional so don't error if not defined

(IRIX only)

Personal tools