BinaryAnalysisPlatform / bap

Binary Analysis Platform
MIT License
2.05k stars 271 forks source link

adds `--arm-features` and downgrades the maximum ARM v8.Xa version to 3 #1473

Closed ivg closed 2 years ago

ivg commented 2 years ago

The lowest version of LLVM that we still support is 6.0 and it doesn't support ARMv8.4a and above and spurs a warning, when we try to enable it. Therefore, we reduce the upper bound to 3 and, to compensate it, introduce a new command-line option to control the set of attributes passed to the backend disassembler. It is now possible to enable/disable features with --arm-features=+FEATURE,-FEATURE. The + is optional, so FEATURE defaults to enabling the FEATURE. For example, to enable newer versions of ARMv8 use the following command-line, --arm-features=v8.4a,v8.5a,v8.6a. It is also possible to enable it permanently using a configuration file. For that create a file in the ~/.config/bap/ folder (name doesn't matter) with the following content,

arm-features=v8.4a,v8.5a,v8.6a

Note, that you can override features, so for example you can disable v8.2a with --arm-features=-v8.2a or disable thumb2 with --arm-features=-thumb2, e.g.,

$ bap mc --arch=thumb --show-insn=asm --arm-features=-thumb2 -- 2d e9 f8 43
4 bytes were left non disassembled
$ bap mc --arch=thumb --show-insn=asm -- 2d e9 f8 43
push.w {r3, r4, r5, r6, r7, r8, r9, lr}