[BUG] Cannot disassemble hello world aarch64 binary
- Dominant language
- Python
- Stars
- 750
- Forks
- 87
- PR merge metrics
- No merged PRs in 30d
Description
Example program:
```c
#include
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!
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the reported `retrowrite a.out out.s` run using the shown C program and static aarch64-linux-gnu-gcc build. Start by tracing the DWARF and AArch64 relocation handling implicated by the errors; done means the binary can be disassembled without the unhandled DWARF, relocation, and target-outside-code-section failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- compilers, reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100