STABS: Stab Section Transformations |
---|
Previous: Transformations On Global Variables, Up: Transformations On Symbol Tables [Contents][Index]
For object file formats using stabs in separate sections (see Stab Sections), use objdump --stabs
instead of nm
to show the
stabs in an object or executable file. objdump
is a GNU utility;
Sun does not provide any equivalent.
The following example is for a stab whose value is an address is relative to the compilation unit (see ELF Linker Relocation). For example, if the source line
static int ld = 5;
appears within a function, then the assembly language output from the compiler contains:
.Ddata.data:
…
.stabs "ld:V(0,3)",0x26,0,4,.L18-Ddata.data # 0x26 is N_STSYM
…
.L18:
.align 4
.word 0x5
Because the value is formed by subtracting one symbol from another, the value is absolute, not relocatable, and so the object file contains
Symnum n_type n_othr n_desc n_value n_strx String 31 STSYM 0 4 00000004 680 ld:V(0,3)
without any relocations, and the executable file also contains
Symnum n_type n_othr n_desc n_value n_strx String 31 STSYM 0 4 00000004 680 ld:V(0,3)