HexHive / retrowrite

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

[BUG] Cannot disassemble hello world aarch64 binary #48

Open zyedidia opened 1 year ago

zyedidia commented 1 year ago

Example program:

#include <stdio.h>
int main() {
    printf("hello world\n");
    return 0;
}

Compiled with the following command (GCC 11.3.0)

$ aarch64-linux-gnu-gcc test.c -o a.out -static

Running retrowrite on the binary to disassemble produces an error:

$ retrowrite a.out out.s
Rewriting a.out into out.s
[*] Relocations for a section that's not loaded: .rela.plt
[INFO] Disassembling...
[INFO] Symbolizing...
[INFO] Recovering .eh_frame information
[CRITICAL] [x] Unhandled DWARF instruction: 7
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 8
[CRITICAL] [x] Unhandled DWARF instruction: 11
[CRITICAL] [x] Unhandled DWARF instruction: 13
[CRITICAL] {'name': None, 'st_value': None, 'offset': 4788224, 'addend': 4284560, 'type': 1032}
[CRITICAL] [*] Unhandled relocation R_AARCH64_TLS_DTPMOD32
[CRITICAL] {'name': None, 'st_value': None, 'offset': 4788232, 'addend': 4285600, 'type': 1032}
[CRITICAL] [*] Unhandled relocation R_AARCH64_TLS_DTPMOD32
[CRITICAL] {'name': None, 'st_value': None, 'offset': 4788240, 'addend': 4427520, 'type': 1032}
[CRITICAL] [*] Unhandled relocation R_AARCH64_TLS_DTPMOD32
[CRITICAL] {'name': None, 'st_value': None, 'offset': 4788248, 'addend': 4284880, 'type': 1032}
[CRITICAL] [*] Unhandled relocation R_AARCH64_TLS_DTPMOD32
[CRITICAL] {'name': None, 'st_value': None, 'offset': 4788256, 'addend': 4281616, 'type': 1032}
[CRITICAL] [*] Unhandled relocation R_AARCH64_TLS_DTPMOD32
[CRITICAL] {'name': None, 'st_value': None, 'offset': 4788264, 'addend': 4427520, 'type': 1032}
[CRITICAL] [*] Unhandled relocation R_AARCH64_TLS_DTPMOD32
[CRITICAL] {'name': None, 'st_value': None, 'offset': 4788272, 'addend': 4281616, 'type': 1032}
[CRITICAL] [*] Unhandled relocation R_AARCH64_TLS_DTPMOD32
[CRITICAL] 40393c: bl #0x4002b0 - target outside code section!

Please let me know if I am doing something incorrect. Thanks!