[llvm] "[bolt][aarch64] Fixed indirect call instrumentation snippet" (PR #141918)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 08:27:01 PST 2025


https://github.com/paschalis-mpeis commented:

Hey Alexei,

Sorry, for the delay. I've only just come back to this due to your recent comment. I think the logic checks out, but I'd wait for more eyes.

Shall we add a test to cover the assembly sequences (callsite and entry / exit stubs) based on your example? eg:

```armasm
_start:
  adrp x8, someTarget
  add  x8, x8, :lo12:someTarget
  blr  x8
  ret
```


Clarification: In the [description](https://github.com/llvm/llvm-project/pull/141918#issue-3099687536), on your first code snippet of `__bolt_instr_ind_call_handler_func`, you mean `__bolt_instr_ind_call_handler`, right?


---


TMU, the original flow was:
- callsite code calls entry handler
- entry-handler
	- if the hook is set up: it runs, preserving LR
	- then it calls exit-handler, which:
	   - restores condition flags and x0/x1
	   - clobbers x16 to branch to the original function

The new code preserves the original callsite, and updates the hook to preserve both original x0/x1 and the ind.tgt+callsite id?

The new flow is:
- callsite code calls the entry handler
- entry handler
	- if the hook is set up: it runs, preserving LR
	- then it calls the exit handler, which:
	   - restores condition flags and x0/x1
	   - returns to the original callsite to do the (preserved) call

https://github.com/llvm/llvm-project/pull/141918


More information about the llvm-commits mailing list