[llvm] [BOLT] Gadget scanner: analyze functions without CFG information (PR #133461)

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 05:32:36 PDT 2025


================
@@ -429,6 +429,261 @@ bad_indirect_call_mem_chain_of_auts_multi_bb:
         ret
         .size bad_indirect_call_mem_chain_of_auts_multi_bb, .-bad_indirect_call_mem_chain_of_auts_multi_bb
 
+// Tests for CFG-unaware analysis.
+
+        .globl  good_direct_call_nocfg
+        .type   good_direct_call_nocfg, at function
+good_direct_call_nocfg:
+// CHECK-NOT: good_direct_call_nocfg
+        paciasp
+        stp     x29, x30, [sp, #-16]!
+        mov     x29, sp
+
+        bl      callee
+
+        adr     x2, 1f
+        br      x2
+1:
----------------
kbeyls wrote:

Maybe it'd be useful to add a comment here that you're using this instruction pattern to make sure BOLT cannot reconstruct the CFG, and this pattern will be used in all test cases for the noCFG analysis?

```
        adr     x2, 1f
        br      x2
1:
```

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


More information about the llvm-commits mailing list