[PATCH] D157802: [JITLink][EHFrameSupport] Accept multiple relocations

Jonas Hahnfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 12 14:51:43 PDT 2023


Hahnfeld created this revision.
Hahnfeld added a reviewer: lhames.
Herald added subscribers: luismarques, s.egerton, PkmX, simoncook, hiraditya, arichardson.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

Multiple relocations at one offset are fine, for example RISC-V uses it in FDE's. Just look at the first target.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157802

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


Index: llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
+++ llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
@@ -128,15 +128,8 @@
   // Find the offsets of any existing edges from this block.
   BlockEdgeMap BlockEdges;
   for (auto &E : B.edges())
-    if (E.isRelocation()) {
-      if (BlockEdges.count(E.getOffset()))
-        return make_error<JITLinkError>(
-            "Multiple relocations at offset " +
-            formatv("{0:x16}", E.getOffset()) + " in " + EHFrameSectionName +
-            " block at address " + formatv("{0:x16}", B.getAddress()));
-
-      BlockEdges[E.getOffset()] = EdgeTarget(E);
-    }
+    if (E.isRelocation())
+      BlockEdges.try_emplace(E.getOffset(), E);
 
   CIEInfosMap CIEInfos;
   BinaryStreamReader BlockReader(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157802.549657.patch
Type: text/x-patch
Size: 892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230812/eeddacce/attachment.bin>


More information about the llvm-commits mailing list