[llvm] [BOLT] Check if symbol is in data area of function (PR #160143)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 19 07:56:52 PST 2026


================
@@ -0,0 +1,36 @@
+// This test checks that when looking for a function corresponding to a
+// symbol, BOLT is not looking through a data area (constant island).
+
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
+
+// Before adding a check for constant islands, BOLT would exit with an error
+// of the form: "symbol not found" and throw an LLVM UNREACHABLE error.
+# CHECK-NOT: symbol not found
+# CHECK-NOT: UNREACHABLE
+
+// Now BOLT throws a warning and does not crash.
----------------
paschalis-mpeis wrote:

Maybe we should also add the check below to stay consistent with recent (and relevant) changes:

```
# CHECK: BOLT-WARNING: corrupted control flow detected in function main{{.*}}: an external branch/call targets an invalid instruction in function first_block at address {{.*}}; ignoring both functions
```

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


More information about the llvm-commits mailing list