[PATCH] D130452: [JITLink][COFF][x86_64] Implement remaining IMAGE_REL_AMD64_REL32_*.

Sunho Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 24 19:08:03 PDT 2022


sunho created this revision.
sunho added reviewers: lhames, sgraenitz.
Herald added subscribers: jsji, StephenFan, hiraditya.
Herald added a project: All.
sunho requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Implements remaining IMAGE_REL_AMD64_REL32_*. We only need IMAGE_REL_AMD64_REL32_4 for now but doing all remaining ones for completeness. (clang only uses IMAGE_REL_AMD64_REL32_1 and IMAGE_REL_AMD64_REL32)


https://reviews.llvm.org/D130452

Files:
  llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp


Index: llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp
+++ llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp
@@ -117,6 +117,30 @@
       Addend -= 1;
       break;
     }
+    case COFF::RelocationTypeAMD64::IMAGE_REL_AMD64_REL32_2: {
+      Kind = EdgeKind_coff_x86_64::PCRel32;
+      Addend = *reinterpret_cast<const support::little32_t *>(FixupPtr);
+      Addend -= 2;
+      break;
+    }
+    case COFF::RelocationTypeAMD64::IMAGE_REL_AMD64_REL32_3: {
+      Kind = EdgeKind_coff_x86_64::PCRel32;
+      Addend = *reinterpret_cast<const support::little32_t *>(FixupPtr);
+      Addend -= 3;
+      break;
+    }
+    case COFF::RelocationTypeAMD64::IMAGE_REL_AMD64_REL32_4: {
+      Kind = EdgeKind_coff_x86_64::PCRel32;
+      Addend = *reinterpret_cast<const support::little32_t *>(FixupPtr);
+      Addend -= 4;
+      break;
+    }
+    case COFF::RelocationTypeAMD64::IMAGE_REL_AMD64_REL32_5: {
+      Kind = EdgeKind_coff_x86_64::PCRel32;
+      Addend = *reinterpret_cast<const support::little32_t *>(FixupPtr);
+      Addend -= 5;
+      break;
+    }
     case COFF::RelocationTypeAMD64::IMAGE_REL_AMD64_ADDR64: {
       Kind = EdgeKind_coff_x86_64::Pointer64;
       Addend = *reinterpret_cast<const support::little64_t *>(FixupPtr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130452.447176.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220725/ce9a4229/attachment.bin>


More information about the llvm-commits mailing list