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

via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 17:48:32 PDT 2026


================
@@ -56,6 +56,9 @@ ldr x0, [x0, :lo12:foo + 0x12348]
 add x0, x0, :secrel_lo12:foo
 // IMAGE_REL_ARM64_SECREL_HIGH12A
 add x0, x0, :secrel_hi12:foo
+// IMAGE_REL_ARM64_SECREL_HIGH12A with non-zero addend: regression for
+// adjustFixupValue masking 0xfff without first shifting >> 12 for HI12.
+add x0, x0, :secrel_hi12:foo + 0x12345
----------------
hotschmoe wrote:

I had a followup that splits ```fixup_aarch64_add_imm12``` into separate HI12/LO12 which refactored ```adjustFixupValue``` a bit and did a few changes in ```WinCOFFObjectWriter.cpp```

i was afraid that was too big of a contribution for my first PR so I went with this narrow edit that fixed the masking and it work for zig. I was going to follow up with a larger PR afterwards to see how it landed

do you want me to close this PR and submit my other?

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


More information about the llvm-commits mailing list