[llvm-branch-commits] [lld] ELF: CFI jump table relaxation. (PR #147424)
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue May 26 17:07:59 PDT 2026
================
@@ -0,0 +1,286 @@
+// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+// RUN: ld.lld --branch-to-branch %t.o -shared -o %t
+// RUN: llvm-objdump -d --show-all-symbols %t | FileCheck %s
+// RUN: ld.lld -O2 %t.o -shared -o %t
+// RUN: llvm-objdump -d --show-all-symbols %t | FileCheck %s
+// RUN: ld.lld %t.o -shared -o %t
+// RUN: llvm-objdump -d --show-all-symbols %t | FileCheck --check-prefix=O0 %s
+
+// Mostly positive cases, except for f2.
+.section .text.jt1,"ax", at llvm_cfi_jump_table,8
+// Function fits.
+f1:
+jmp f1.cfi
+.balign 8, 0xcc
+
+// Function too large.
+f2:
+jmp f2.cfi
+.balign 8, 0xcc
+
+// Function too large, but may be placed at the end.
+// Because this causes the jump table to move, it is tested below.
+f3:
+jmp f3.cfi
+.balign 8, 0xcc
+
+// Mostly negative cases, except for f4.
+.section .text.jt2,"ax", at llvm_cfi_jump_table,16
+// Function already moved into jt1.
+// CHECK: <f1a>:
----------------
MaskRay wrote:
In newer tests we prefer this style (instructions are indented by 2 relative to the label)
```
# CHECK: <f1a>:
# CHECK-NEXT: jmp ...
```
https://github.com/llvm/llvm-project/pull/147424
More information about the llvm-branch-commits
mailing list