[llvm] [BOLT][AArch64] Do not crash on authenticated branch instructions (PR #129898)
Alexey Moksyakov via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 10 07:27:45 PDT 2025
yavtuk wrote:
> Could you please provide an example of such JT lowering - using "branch with link" looks quite counter-intuitive at first.
@atrosinenko the simplified version with array of functions pointers,
pattern can be different but blr the latest instruction
clang -fjump-tables
gcc --param=case-values-threshold=4
`
int __attribute__ ((noinline)) option0() {
printf("Function 1 called\n");
return 1;
}
int (*jumpTable[6])(void) = { option0, option1, option2, option3, option4, option5 };
void __attribute__ ((noinline)) handleOptionJumpTable(int option) {
const int result = jumpTable[option]();
printf("result %d\n", result);
}
`
`
objdump --disassemble=handleOptionJumpTable --no-addresses --no-show-raw-insn ./jt
./jt: file format elf64-littleaarch64
Disassembly of section .text:
<main>
ldur w0, [x29, #-8]
bl <handleOptionJumpTable>
<handleOptionJumpTable>:
prologue
adrp x8, jumpTable
ldr x8, [x8, #3656]
ldr x8, [x8, x0, lsl #3]
blr x8
epilogue
ret
`
https://github.com/llvm/llvm-project/pull/129898
More information about the llvm-commits
mailing list