Previous: Symbol Table Format, Up: Symbol Tables

7.2 Transformations on Symbol Tables

The linker concatenates object files and does fixups of externally defined symbols.

You can see the transformations made on stab data by the assembler and linker by examining the symbol table after each pass of the build. To do this, use ‘nm -ap’, which dumps the symbol table, including debugging information, unsorted. For stab entries the columns are: value, other, desc, type, string. For assembler and linker symbols, the columns are: value, type, string.

The low 5 bits of the stab type tell the linker how to relocate the value of the stab. Thus for stab types like N_RSYM and N_LSYM, where the value is an offset or a register number, the low 5 bits are N_ABS, which tells the linker not to relocate the value.

Where the value of a stab contains an assembly language label, it is transformed by each build step. The assembler turns it into a relocatable address and the linker turns it into an absolute address.