HexHive / retrowrite

RetroWrite -- Retrofitting compiler passes through binary rewriting
Other
655 stars 78 forks source link

[BUG] Unable to get helloworld.s from retrowrite #47

Closed ZWUGA closed 11 months ago

ZWUGA commented 1 year ago

Dear developers,

Could someone tell me if I misuse the retro-write to cause this issue or any other problem? Thank you for your help!

Platform: Ubuntu 20.04, x86_64. gcc version: 9.4.0

source code:

include

void main(){ printf("hello\n"); }

I write them into case.c, and compile with cammand: gcc case.c -g -pie -o case

Here is the execute file info: :~/retrowrite$ file case case: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b912de4ace5d75a39fec09e0d6a7c9e917510d0f, for GNU/Linux 3.2.0, with debug_info, not stripped

Output from retrowrite: ~/retrowrite$ ./retrowrite --asan case case.s Rewriting case into case.s IDENTIFIED IMPORTS {'name': 'frame_dummy', 'cache': [], 'start': 4416, 'sz': 0, 'bytes': b'', 'bbstarts': {4416}, 'bind': 'STB_LOCAL', 'except_table': None, 'cfi_map': None, 'nexts': defaultdict(<class 'list'>, {}), 'analysis': defaultdict(<function Function.init.. at 0x7ffff5ec3c10>, {}), 'instrumented': False, 'is_mangled': False, '_true_name': None} .init_array frame_dummy pointer removed. Traceback (most recent call last): File "./retrowrite", line 307, in loader.load_relocations(reloc_list) File "/home/wen/retrowrite/librw_x64/loader.py", line 147, in load_relocations debug("[*] Relocations for a section that's not loaded:" + str(reloc_section)) NameError: name 'debug' is not defined

gannimo commented 11 months ago

Thanks for opening this issue. This was a rogue commit from the aarch64/x64 merge. Fixed in d722ec5114de0d93b018f5876132946abf3f0ad5