History

scripts/decodecode: fix decoding for AArch64 (arm64) instructions

There are a couple of problems with the decodecode script and arm64: 1. AArch64 objdump refuses to disassemble .4byte directives as instructions, insisting that they are data values and displaying them as: a94153f3 .word 0xa94153f3 <-- trapping instruction This is resolved by using the .inst directive instead. 2. Disassembly of branch instructions attempts to provide the target as an offset from a symbol, e.g.: 0: 34000082 cbz w2, 10 <.text+0x10> however this falls foul of the grep -v, which matches lines containing ".text" and ends up removing all branch instructions from the dump. This patch resolves both issues by using the .inst directive for 4-byte quantities on arm64 and stripping the resulting binaries (as is done on arm already) to remove the mapping symbols.

Will Deacon committed 8 years ago

Commit be9fa661 parent 6bec6ad1 file · +8 −0Browse files

Unified · Split

scripts/decodecode+8−0
@@ -59,6 +59,14 @@ disas() { · 58 unmodified lines
59 ${CROSS_COMPILE}strip $1.o59 ${CROSS_COMPILE}strip $1.o
60 fi60 fi
61 61
62 if [ "$ARCH" = "arm64" ]; then
63 if [ $width -eq 4 ]; then
64 type=inst
65 fi
66
67 ${CROSS_COMPILE}strip $1.o
68 fi
69
62 ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \70 ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \
63 grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&171 grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&1
64}72}