If you want to peep into an object file, and see what are the various symbols that are defines in it the command will come handy.
It takes an object file as input and lists out all the symbols, their address and in which section, text,data,uninitialized etc, is the symbol present in as the output.
For example let us assume we have an object file "hello.o" for the simple hello world program hello.c.
#include<stdio.h>
main()
{
printf("Hello world");
}
Running "nm" on the hello.o will yield
$nm hello.o
00000000 T main
U printf
T before "main" signifies it is in the text section and the "U" before printf means it is undefined in this code. The first column gives the value of the symbol.
It takes an object file as input and lists out all the symbols, their address and in which section, text,data,uninitialized etc, is the symbol present in as the output.
For example let us assume we have an object file "hello.o" for the simple hello world program hello.c.
#include<stdio.h>
main()
{
printf("Hello world");
}
Running "nm" on the hello.o will yield
$nm hello.o
00000000 T main
U printf
T before "main" signifies it is in the text section and the "U" before printf means it is undefined in this code. The first column gives the value of the symbol.
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.