Symbols and Symbol Tables
- All Relocatable Object Files has a symbol table that contains info about symbols that are defined and referenced by it.
- In the context of linker, there are three different types of symbols:
- Global symbols defined by this module that CAN BE referenced by other modules.
- Global symbols referenced by this module that's defined in some other modules.
- they are called externals.
- Local symbols that are defined and referenced exclusively by this module BUT ARE STATIC, i.e all static global and local vars and they are only visible withing this modules.
-The following is the format for each entry in the .symbtab:

Fig: ELF symbol table entry. The type and binding fields are 4 bits each.
Explanations:
-int name: the symbol's actual string name's offset in .strtab section
- char type/binding: 4 bits each for type of symbol (function or data) and local or global classification.
- char reserved: unused??
- short section: index of symbol's section withing section header table
- long value: offset of the symbol location if in Relocatable Object Files or absolute address if it's in Executable Object Files
- long size: the object's size in byte
NOTE for short section: There are three special pseudo section with no - entries in section header table:
- ABS: for symbols that need not be relocated.
- UNDEF: for undefined symbols referenced here for defined elsewhere.
- COMMON: for unitialized data objects that's not yet allocated.
- GNU determines if a symbol belongs to COMMON or .bss section with following distinctions (Reasons for this distinction is discussed in Symbol Resolution):
-
COMMON: if it's uninitialized global vars
-
.bss: For unitialized static vars and global or static vars that are initialized to zero.
-