Is there a way to get the full address in objdump?
Command being used is: objdump -d progname
The leading zeros are the incorrect. The addresses should be as follows:
The last three values in the address are correct; but, I'd much like the full address to be shown in objdump.
Before your application gets loaded, you cannot tell where it will end in the memory.
Try the following code:
#include <stdio.h>
int main()
{
printf("%p\n", main);
}
Compile it with gcc test.c
and run several times.
My results show:
0x55f71f8936b0
0x5630ed7ff6b0
0x558a18eea6b0
...
So you can't know for sure where it will end in the memory. I believe it was not always the case, and this behaviour is intended as a security "thingy". I wouldn't be surprised if older kernel/loaders gave the same address on each run. I do not know that for sure, though.
Of course objdump
will give you relative addresses:
00000000000006b0 <main>:
Keep in mind that the output of this program does not give you physical addresses, they are still virtual.
The point is that addresses dumped by objdump
are a responsibility of the linker and actual virtual addresses from each execution are there because of the loader.