[lld] [lld][ELF] Resolve Symbols with same comdat index as Defined Symbols (PR #115140)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 8 23:06:04 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;
----------------
MaskRay wrote:
`referenced` is not needed for a Defined symbol.
I've refactored exportDynamic setting in c6508809585505ffb88f5f724da04bbc058eabf8 . Can you rebase and use `ltoCanOmit` instead?
https://github.com/llvm/llvm-project/pull/115140
More information about the llvm-commits
mailing list