[llvm] [JITLink] Add x86_64::Delta8 edge kind, ELF::R_X86_64_PC8 support (PR #95869)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 18:24:56 PDT 2024


================
@@ -473,6 +486,15 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
     break;
   }
 
+  case Delta8: {
+    int64_t Value = E.getTarget().getAddress() - FixupAddress + E.getAddend();
+    if (LLVM_LIKELY(isInt<8>(Value)))
+      *(little32_t *)FixupPtr = Value;
----------------
lhames wrote:

I think `little32_t` will lead to overflow here. You can just write to `FixupPtr` without casting (it's already a `char*`), or make it explicit:
```c++
*(char*)FixupPtr = Value;
```


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


More information about the llvm-commits mailing list