Frage

I have created a function that checks the integrity of a portion of binary code.

The function is added with a llvm pass.

It needs the begin and end address plus a check value.

The check value is the result of a computation on a binary code.

Saddly, the IR pass is in the middle-end part of llvm and this part works with IR and not with binaries.

You don't know yet the binary code and how are the addresses.

For now, I create everything I can with my pass and I use pyelftool to go into the binary file and modify the hexa value like a mad man ;-)

My first question is : It is possible to know this address in advance.

I see blockaddress but I need something more flexible (address of instruction).

My second question is : Someone has a better idea for modifing the check value. My solution is not very elegant and I'm plateform dependant -.-

I hope I was understandable.

Thanks,

War es hilfreich?

Lösung

Your question is not clear. It sounds like you're attempting some strange mixup between the LLVM IR level and binary machine code level, and that doesn't make much sense.

LLVM IR is a fairly abstract, target-independent language that serves as the intermediate representation of a compiler. There is no linkage from LLVM IR to the addresses of instructions that end up being emitted from it. blockaddress is used for addresses of basic blocks but it has a LLVM i8* type, not some machine-specific address.

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