Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

12.2 Examining the symbol table

As described earlier in the discussion of debugging, executables and object files can contain a symbol table (see section 5 Compiling for debugging). This table stores the location of functions and variables by name, and can be displayed with the nm command:

$ nm a.out
08048334 t Letext
08049498 ? _DYNAMIC
08049570 ? _GLOBAL_OFFSET_TABLE_
........
080483f0 T main
08049590 b object.11
0804948c d p.3
         U printf@GLIBC_2.0

Among the contents of the symbol table, the output shows that the start of the main function has the hexadecimal offset 080483f0. Most of the symbols are for internal use by the compiler and operating system. A 'T' in the second column indicates a function that is defined in the object file, while a 'U' indicates a function which is undefined (and should be resolved by linking against another object file). A complete explanation of the output of nm can be found in the GNU Binutils manual.

The most common use of the nm command is to check whether a library contains the definition of a specific function, by looking for a 'T' entry in the second column against the function name.


 
 
  Published under the terms of the GNU General Public License Design by Interspire