Frage

I am currently using LLVM's ObjectFile (documented here) to represent an executable. I have successfully read in an executable to the ObjectFile and would like to determine which call destination addresses in my executable correspond to symbol names contained in the symbol_iterator obtained by a call to the begin_dynamic_symbols() function. Iterating over each of the symbols in the symbol_iterator gives me the name of each symbol and its address, but since the symbols are dynamic, the address of each symbol is -1; this indicates that the ObjectFile does not associate symbol names directly with their corresponding call destination addresses.

Is there any way to determine which call destination addresses map to which dynamic symbols in an ObjectFile? I would rather not manually calculate all the jumps through the PLT and GOT if I can avoid doing so.

War es hilfreich?

Lösung

Dynamic symbols' addresses are only calculated when the object files gets loaded into memory and linked into the program's symbol table. In general, it's impossible to determine their final address before linking.

You may be able to get the data you want using LLVM's Link-Time Optimization module instead of ObjectFile, as that does perform address linking when loading a module, if I recall correctly.

Good luck!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top