[llvm] 2040f50 - [JITLink][i386] Improve unsupported relocation error message.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 16:25:28 PDT 2025


Author: Lang Hames
Date: 2025-05-08T09:25:21+10:00
New Revision: 2040f50a566e19b9bb30baf75f15199d1aba18b2

URL: https://github.com/llvm/llvm-project/commit/2040f50a566e19b9bb30baf75f15199d1aba18b2
DIFF: https://github.com/llvm/llvm-project/commit/2040f50a566e19b9bb30baf75f15199d1aba18b2.diff

LOG: [JITLink][i386] Improve unsupported relocation error message.

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
index a703b77e7c50b..1273dc1481c35 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
@@ -114,7 +114,7 @@ class ELFLinkGraphBuilder_i386 : public ELFLinkGraphBuilder<object::ELF32LE> {
 private:
   using ELFT = object::ELF32LE;
 
-  static Expected<i386::EdgeKind_i386> getRelocationKind(const uint32_t Type) {
+  Expected<i386::EdgeKind_i386> getRelocationKind(const uint32_t Type) {
     using namespace i386;
     switch (Type) {
     case ELF::R_386_NONE:
@@ -137,8 +137,9 @@ class ELFLinkGraphBuilder_i386 : public ELFLinkGraphBuilder<object::ELF32LE> {
       return EdgeKind_i386::BranchPCRel32;
     }
 
-    return make_error<JITLinkError>("Unsupported i386 relocation:" +
-                                    formatv("{0:d}", Type));
+    return make_error<JITLinkError>(
+        "In " + G->getName() + ": Unsupported i386 relocation type " +
+        object::getELFRelocationTypeName(ELF::EM_386, Type));
   }
 
   Error addRelocations() override {


        


More information about the llvm-commits mailing list