[llvm] [BOLT] Check if symbol is in data area of function (PR #160143)
Paschalis Mpeis via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 08:01:58 PDT 2025
================
@@ -0,0 +1,49 @@
+// 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: symbol [[SYM:.*]] is in data region of function 0x{{.*}}.
+
+.text
+.global main
+main:
+ stp x14, x15, [sp, -8]!
+ mov x14, sp
+ adrp x1, .test
+ add x0, x1, :lo12:.test
+ bl first_block
----------------
paschalis-mpeis wrote:
I think we can get rid of the ADRPs, stack usage, and the `.data`?
https://github.com/llvm/llvm-project/pull/160143
More information about the llvm-commits
mailing list