Table of Contents

Symbol table (ivss)

A symbol table records names, bindings, sections, and values used during linking. For the reference example in Object files, the assembler's dump includes these entries:

Num  Value   Size Type  Bind Ndx Name
  3: 00000000   0 NOTYP GLOB UND target
  5: 00000000   0 NOTYP  LOC   3 slot

target is global but undefined: its zero value does not mean its address is zero. The linker must find a definition. slot is local and belongs to section three, my_data, at byte offset zero.

Each entry is stored as an Elf_Sym. Its st_name field is a byte offset into the string table, while st_shndx identifies a section or a special value such as SHN_UNDEF or SHN_ABS. st_info packs binding and type.

A section-defined symbol's value becomes meaningful together with its section placement. An absolute symbol, such as one created by .equ, does not need a section base added. Relocations refer to symbol-table entry numbers, so preserving those relationships matters when objects are combined.

Source: elf.h, elf.c.