Open wade901 opened 3 years ago
No, AArch64 BOLT doesn't support all possible indirect branch fragments. Our AArch64 port is experimental, but I see in your log this message:
BOLT-WARNING: non-relocation mode for AArch64 is not fully supported
Did you try a binary with relocations?
That said, the AArch64 port is far less mature than the X86 one and is also more challenging to support. Because of the RISC nature of it, there is less semantic encoded in each instruction and the compiler will frequently need to use multiple instructions to perform the same action that, in X86, would be a single instruction. This requires BOLT to match and recognize patterns spanning multiple instructions. That's tricky because the pattern may be spread in different basic blocks, which requires a dataflow analysis to track the relationship of the instructions across the entire CFG. But we can't build the complete CFG without understanding the indirect branches in the function. That's why it's a bit more involved to properly disassemble and reconstruct the CFG of a RISC binary. What we currently have implemented for AArch64 is a best effort strategy that worked well for gcc-generated binaries, but we can't guarantee will always work.
Yet, relocations for AArch64 are mandatory to properly recognize ADRP /ADR pairs. If you lack relocations, we won't understand that an ADRP instruction is trying to build the address of, say, ObjectX. We will have a partial view that ADRP is accessing the page of ObjectX and will create references against Page(ObjectX) instead of ObjectX. This will cause us to potentially link incorrectly depending on where Page(ObjectX) lands (in a different, unrelated section, for example).
Hello,
When I'm trying to use BOLT to optimize an AArch64 application, BOLT aborted when analyze indirect branch fragments. The indirect branch code as follows. Has BOLT support all the patterns of AArch64 indirect branch already?
Log: