[lld] Fix lld crash wrt generated thunks growing away from the patched code (PR #170495)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 08:56:23 PST 2025


================
@@ -0,0 +1,68 @@
+// REQUIRES: aarch64
+// RUN: llvm-mc -mattr=+bti -filetype=obj -triple=aarch64 %s -o %t.o
+// RUN: echo "SECTIONS { .text 0x10000 : { *(.text.01); . += 0x8000000; *(.text.far); } }" > %t.script
+// RUN: ld.lld -z force-bti --script %t.script -fix-cortex-a53-843419 -verbose %t.o -o %t2 \
+// RUN:   2>&1 | FileCheck -check-prefix=CHECK-PRINT %s
+// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn --triple=aarch64-linux-gnu -d %t2 | FileCheck %s
+
+/// Test case for specific crash wrt interaction between thunks where
----------------
smithp35 wrote:

Suggest:

> Test case for specific crash wrt interaction between thunks and errata patches where the size of the added thunks meant that a range-extension thunk to the patch was required. We need to check that a BTI Thunk is generated for the patch, and that the patch's direct branch return is also range extended, possibly needing another BTI Thunk.

The chrome part may be worth putting in the description, with a link to the Chrome bug tracker issue.

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


More information about the llvm-commits mailing list