[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:53 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.
+# CHECK: BOLT-WARNING: ignoring entry point at address 0x{{[0-9a-f]+}} in constant island of function first_block
+
+.text
+.global main
+main:
----------------
paschalis-mpeis wrote:
Can you mark `main` as a function?
```suggestion
.type main, %function
main:
```
Similarly, for the function below.
eg, name it `foo`, add a dummy block with one instruction, while keeping the call originating from the constant island.
https://github.com/llvm/llvm-project/pull/160143
More information about the llvm-commits
mailing list