Thursday, January 17, 2008

Article on Symbol table

Symbol Table:

In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and sometimes its location.

The symbol table of a small program is listed below. The table itself was generated using the GNU binutils' nm utility. There is one data symbol,
holaamigosh (noted by the "D" type), and many functions (self defined as well as from the standard library). The first column is where the symbol is located in the memory, the second is "The symbol type" and the third is the name of the symbol. By passing suitable parameters, the symbol table was made to sort on basis of address

Example table

Address Type Name
00000020 a T_BIT
00000040 a F_BIT
00000080 a I_BIT

20000004 t irqvec
20000008 t fiqvec
2000000c t InitReset
20000018 T _main

20000024 t End
20000030 T AT91F_US3_CfgPIO_useB
2000005c t AT91F_PIO_CfgPeriph
200000b0 T main
20000120 T AT91F_DBGU_Printk
20000190 t AT91F_US_TxReady
200001c0 t AT91F_US_PutChar
200001f8 T AT91F_SpuriousHandler
20000214 T AT91F_DataAbort
20000230 t AT91F_PDC_SetNextRx


An object code file will contain a symbol table of the identifiers it contains that are externally visible. During the linking of different object files, a linker will use these symbol tables to resolve any unresolved references.
A symbol table may only exist during the translation process, or it may be embedded in the output of that process for later exploitation, for example, during an interactive
debugging session, or as a resource for formatting a diagnostic report during or after execution of a program.


For more details ,
Other link:http://www.sco.com/developers/gabi/2001-04-24/ch4.symtab.html

By Vinod Mahalle

mahalle.v@gmail.com

No comments: