[lld] [llvm] [AArch64][COFF] Fix HI12 SECREL miscompile in adjustFixupValue (PR #199602)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed May 27 14:06:07 PDT 2026


================
@@ -0,0 +1,29 @@
+; RUN: llc -mtriple=aarch64-unknown-windows-gnu -filetype=obj %s -o %t.obj
+; RUN: llvm-objdump --no-print-imm-hex -d --disassemble-symbols=foo %t.obj | FileCheck %s
+
+; Regression test for https://github.com/llvm/llvm-project/issues/199581 and
+; https://codeberg.org/ziglang/zig/issues/31865.
+;
+; When a 'private' thread_local global sits at a non-zero offset within the
+; .tls$ section (because a non-'private' thread_local precedes it), the COFF
+; backend emits an IMAGE_REL_ARM64_SECREL_HIGH12A relocation. The HI12+LO12
+; pair encodes a single secrel value across two instructions; the assembler
+; must leave both imm12 fields empty so the linker can resolve the full
----------------
mstorsjo wrote:

Incorrect comment, the assembler can encode small immediates just fine.

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


More information about the llvm-commits mailing list