Reputation: 412
This question has to do with a college assignment, so I'll keep it abstract to not give away any part of the challenge.
Given a compiled C program (x86_64 ELF on Linux), is there a way to know, just from the disassembly, which address a function pointer inside of that program would contain to point to a specific function (also inside of the program, not an external library) in any execution of the program? Is it possible to infer the complete address just from the address of that function in the disassembly?
For example, if the program contains a pointer: void (*ptr) () = &someFunc;
, is the content of ptr inferable from the adress of someFunc in the disassembly?
Upvotes: 1
Views: 462
Reputation: 412
So I managed to solved the problem. As it turned out, the addresses the function pointers were using were the exact addresses in the disassembly. At the end I figured it out stepping through with gdb and looking at the contents of the registers.
Upvotes: 1