junxzm1990 / x86-sok

124 stars 20 forks source link

Matching func start virtual address to binary bytes #2

Closed jupiterepoch closed 3 years ago

jupiterepoch commented 3 years ago

Hi, thank you for this wonderful toolchain you developed. I wonder if there is a way I can match the function start virtual addresses to the binary bytes? I am trying to feed it as ground truth to another model. Thank you!

junxzm1990 commented 3 years ago

Hi,

Just want to clarify a bit: by "start virtual address", you mean the starting address when the function is loaded into memory, right? If that's the case, you can run "readelf" to get a match between the virtual address of the text segment and the offset of the text segment in the binary file. Then: [offset of the function in the binary file] = [start address of the function] - [virtual address of the text segment] + [offset of the text segment in the binary file].

Hope it helps -:)

jupiterepoch commented 3 years ago

Thanks!