[lld] [LLD][COFF] Implement support for hybrid IAT on ARM64X (PR #124189)

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 05:10:00 PST 2025


================
@@ -1203,8 +1207,23 @@ void Arm64XDynamicRelocEntry::writeTo(uint8_t *buf) const {
     }
     break;
   case IMAGE_DVRT_ARM64X_FIXUP_TYPE_DELTA:
-  case IMAGE_DVRT_ARM64X_FIXUP_TYPE_ZEROFILL:
-    llvm_unreachable("unsupported type");
+    int delta = value.get();
+    // Negative offsets use a sign bit in the header.
+    if (delta < 0) {
+      *out |= 1 << 14;
+      delta = -delta;
+    }
+    // Depending on the value, the delta is encoded with a shift of 2 or 3 bits.
+    if (delta & 7) {
+      assert(!(delta & 3));
----------------
cjacek wrote:

If we encounter this, it's a linker bug; the delta must always be a multiple of 4. If other deltas are ever required, we will need to use `IMAGE_DVRT_ARM64X_FIXUP_TYPE_VALUE` instead.

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


More information about the llvm-commits mailing list