[llvm] 3fabda5 - [JITLink] Use Section + Offset format for anon symbols in out-of-range errors.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 23:09:16 PST 2022


Author: Lang Hames
Date: 2022-01-12T18:03:57+11:00
New Revision: 3fabda51a6d7b099295b8ef297b24b32d6a37ac1

URL: https://github.com/llvm/llvm-project/commit/3fabda51a6d7b099295b8ef297b24b32d6a37ac1
DIFF: https://github.com/llvm/llvm-project/commit/3fabda51a6d7b099295b8ef297b24b32d6a37ac1.diff

LOG: [JITLink] Use Section + Offset format for anon symbols in out-of-range errors.

The previous error message only provided the address of the anonymous symbol.
Knowing the containing section makes the error easier to diagnose at a glance.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
index 8c920c5fe2dd5..78a603cfed17b 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
@@ -365,10 +365,13 @@ Error makeTargetOutOfRangeError(const LinkGraph &G, const Block &B,
     Section &Sec = B.getSection();
     ErrStream << "In graph " << G.getName() << ", section " << Sec.getName()
               << ": relocation target ";
-    if (E.getTarget().hasName())
-      ErrStream << "\"" << E.getTarget().getName() << "\" ";
-    ErrStream << "at address " << formatv("{0:x}", E.getTarget().getAddress());
-    ErrStream << " is out of range of " << G.getEdgeKindName(E.getKind())
+    if (E.getTarget().hasName()) {
+      ErrStream << "\"" << E.getTarget().getName() << "\"";
+    } else
+      ErrStream << E.getTarget().getBlock().getSection().getName() << " + "
+                << formatv("{0:x}", E.getOffset());
+    ErrStream << " at address " << formatv("{0:x}", E.getTarget().getAddress())
+              << " is out of range of " << G.getEdgeKindName(E.getKind())
               << " fixup at " << formatv("{0:x}", B.getFixupAddress(E)) << " (";
 
     Symbol *BestSymbolForBlock = nullptr;


        


More information about the llvm-commits mailing list