[Orc] Skip sections with duplicate names in DebugObjectManagerPlugin
authorStefan Gränitz <stefan.graenitz@gmail.com>
Fri, 31 Mar 2023 07:56:23 +0000 (09:56 +0200)
committerStefan Gränitz <stefan.graenitz@gmail.com>
Fri, 31 Mar 2023 08:17:19 +0000 (10:17 +0200)
Compiler-generated section names can clash. Examples are group sections or profile counter sections.
We don't need to abort debug registration for the entire LinkGraph in such a case.
Instead, let's skip the relevant sections and add a note to the debug log.

llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp

index 75d3344..922c60b 100644 (file)
@@ -372,11 +372,12 @@ Error ELFDebugObject::recordSection(
   if (Error Err = Section->validateInBounds(this->getBuffer(), Name.data()))
     return Err;
   auto ItInserted = Sections.try_emplace(Name, std::move(Section));
-  if (!ItInserted.second)
-    return make_error<StringError>("In " + Buffer->getBufferIdentifier() +
-                                  ", encountered duplicate section \"" +
-                                  Name + "\" while building debug object",
-                                   inconvertibleErrorCode());
+  LLVM_DEBUG({
+    if (!ItInserted.second)
+      dbgs() << "Skipping debug registration for section '" << Name << "' "
+             << "in object " << Buffer->getBufferIdentifier()
+             << " (duplicate name)\n";
+  });
   return Error::success();
 }