|
objdump -d prog.o |
Example:
int f( int x )
{
return ( x*x );
}
|
|
|
gcc [-o outputFileName] file1.o file2.o .... |
int x;
void f()
{
x = 4;
x = 7;
}
|
Compile: gcc -c reloc.c
Dump the relocation table: objdump -r reloc.o
Disassembler: objdump -d reloc.o
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000000000006 R_X86_64_PC32 x-0x0000000000000008
0000000000000010 R_X86_64_PC32 x-0x0000000000000008
The relocable code contains information on the use of the variable x !!!
How is it use ?
Look at the machine code:
0000000000000000 <f>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: c7 05 00 00 00 00 04 movl $0x4,0x0(%rip) # e
|
How is the relocation info used:
|