[llvm] [JITLink] fix i668 R_386_32 relocation value (PR #111091)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 20:05:36 PDT 2024


https://github.com/vtjnash created https://github.com/llvm/llvm-project/pull/111091

My i686 builds were segfaulting when trying to enable JITLink, and I traced it back to an incorrect Addend computation here. Most relocations involve adding the value at the location with a value taken from elsewhere. This one was missing the addend taken from the location, but other relocations may be missing this too?

@lhames @llvm/issue-subscribers-julialang 

>From 202a0a1ba432e141c05bfd7e05251c3cc0c93166 Mon Sep 17 00:00:00 2001
From: Jameson Nash <vtjnash at gmail.com>
Date: Thu, 3 Oct 2024 21:24:44 +0000
Subject: [PATCH] [JITLink] fix i668 R_386_32 relocation value

Most relocations involve adding the value at the location with a value
taken from elsewhere. This one was missing the addend taken from the
location. Other relocations may be missing this too?
---
 llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
index 860165365a7e4f..46238445a6b13b 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
@@ -186,6 +186,7 @@ class ELFLinkGraphBuilder_i386 : public ELFLinkGraphBuilder<ELFT> {
     int64_t Addend = 0;
 
     switch (*Kind) {
+    case i386::EdgeKind_i386::Pointer32:
     case i386::EdgeKind_i386::Delta32: {
       const char *FixupContent = BlockToFix.getContent().data() +
                                  (FixupAddress - BlockToFix.getAddress());



More information about the llvm-commits mailing list