Author :
Martin Storsjö
Date :
2023-11-29 00:38:13
Hash :5b1944b4 Message :aarch64: Write the BTI instructions as "hint" instructions (#810)
GNU binutils refuses to assemble the direct BTI instructions unless
the target architecture explicitly supports BTI, ending up with errors
such as
../src/aarch64/sysv.S: Assembler messages:
../src/aarch64/sysv.S:87: Error: selected processor does not support `bti c'
../src/aarch64/sysv.S:156: Error: selected processor does not support `bti j'
Building with -march=armv8.5-a fixes building this.
However, the BTI instructions assemble into hint instructions, that
are ignored by processors that don't implement them. Therefore it is
possible to assemble them for the baseline armv8.0-a target as well,
by replacing "bti j" with "hint #36", "bti c" with "hint #34" and
"bti jc" with "hint #38"; this assembles into the same instruction
bits.