Closed bmourad01 closed 2 years ago
It is applicable to many architectures and the common approach is to delay the choice of the branch kind and perform branch relaxation at the later stages. See this article as an example.
This is (kind of) fixed in #210.
The following patch code:
may be lowered to the following BIR:
and then the following ARM assembly:
However, depending on where this patch is actually situated in the binary, the address
0x1234
may be out of range, and the assembler will reject the program.This can sometimes be fixed by lowering instead to:
which may have the following assembly:
Since unconditional branches in ARM have a wider range of addresses, the assembler may accept this code.
The ARM manual speaks about "veneers" which are inserted by the linker for branch targets that are out of range: https://www.keil.com/support/man/docs/armlink/armlink_pge1406301797482.htm
We should investigate whether this is an option for us, or whether we need to look into other solutions.