[llvm] [BOLT][AArch64] Add a failing test to demonstrate bug (PR #194896)

Alexandros Lamprineas via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 08:54:45 PDT 2026


https://github.com/labrinea created https://github.com/llvm/llvm-project/pull/194896

When not in compact-code-model the longjump pass may consider certain branches in range, but later at JITLink hugify forces them out of range probably because it aligns hot code at runtime.

>From 3be2dfb84cd13823bbcff0dc779bc86538584d43 Mon Sep 17 00:00:00 2001
From: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
Date: Wed, 29 Apr 2026 16:42:53 +0100
Subject: [PATCH] [BOLT][AArch64] Add a failing test to demonstrate bug

When not in compact-code-model the longjump pass may consider
certain branches in range, but later at JITLink hugify forces
them out of range probably because it aligns hot code at runtime.
---
 .../long-jmp-hugify-fixup-out-of-range.s      | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 bolt/test/AArch64/long-jmp-hugify-fixup-out-of-range.s

diff --git a/bolt/test/AArch64/long-jmp-hugify-fixup-out-of-range.s b/bolt/test/AArch64/long-jmp-hugify-fixup-out-of-range.s
new file mode 100644
index 0000000000000..3763583887bd4
--- /dev/null
+++ b/bolt/test/AArch64/long-jmp-hugify-fixup-out-of-range.s
@@ -0,0 +1,37 @@
+# Check that branches considered in-range during longjump
+# may go out of range at JITLink if hugify moves hot code.
+
+# REQUIRES: system-linux, asserts
+
+# RUN: %clang %cflags -Wl,-q %s -o %t
+# RUN: link_fdata --no-lbr %s %t %t.fdata
+# RUN: llvm-strip --strip-unneeded %t
+# RUN: not llvm-bolt %t -o %t.bolt --data %t.fdata -split-functions --hugify 2>&1 \
+# RUN:   | FileCheck %s
+
+  .globl foo
+  .type foo, %function
+foo:
+.entry_foo:
+# FDATA: 1 foo #.entry_foo# 10
+    cbz x0, .Lcold_foo
+    mov x0, #1
+.Lcold_foo:
+    ret
+
+  .globl main
+  .type main, %function
+main:
+    mov w0, wzr
+    ret
+
+  .globl _start
+  .type _start, %function
+_start:
+    bl main
+    b .
+
+## Force relocation mode.
+.reloc 0, R_AARCH64_NONE
+
+# CHECK: BOLT-ERROR: JITLink failed: In graph in-memory object file, section .text: relocation target {{0x[0-9a-f]+}} {{.*}} is out of range of CondBranch19PCRel fixup at address {{0x[0-9a-f]+}} {{.*}}



More information about the llvm-commits mailing list