[lld] [lld][ELF] Resolve Symbols with same comdat index as Defined Symbols (PR #115140)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 05:22:45 PST 2024


================
@@ -1769,13 +1769,22 @@ static void createBitcodeSymbol(Ctx &ctx, Symbol *&sym,
     sym = ctx.symtab->insert(objSym.getName());
   }
 
-  int c = objSym.getComdatIndex();
-  if (objSym.isUndefined() || (c != -1 && !keptComdats[c])) {
+  if (objSym.isUndefined()) {
     Undefined newSym(&f, StringRef(), binding, visibility, type);
     sym->resolve(ctx, newSym);
     sym->referenced = true;
     return;
   }
+  int c = objSym.getComdatIndex();
+  if (c != -1 && !keptComdats[c]) {
+    Defined newSym(ctx, &f, StringRef(), binding, visibility, type, 0, 0,
+                   nullptr);
+    if (objSym.canBeOmittedFromSymbolTable())
+      newSym.exportDynamic = false;
+    sym->resolve(ctx, newSym);
+    sym->referenced = true;
----------------
pranav-159 wrote:

Done

https://github.com/llvm/llvm-project/pull/115140


More information about the llvm-commits mailing list