[PATCH] D127753: [lld-macho] Group undefined symbol diagnostics by symbol
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 16:14:45 PDT 2022
thakis added a comment.
This is due to an ODR violation: Both lld/ELF/Relocations.cpp and lld/MachO/SymbolTable.cpp now define a ::UndefinedDiag type, and so they both have the same name for the implicit move ctor etc. Since those are inline, the linker just picks one of the two UndefinedDiag::UndefinedDiag() move ctors at random and uses it to move both types, even though they are distinct.
This fixes it, for example:
diff --git a/lld/MachO/SymbolTable.cpp b/lld/MachO/SymbolTable.cpp
index 7705fbd5f667..5bc622126071 100644
--- a/lld/MachO/SymbolTable.cpp
+++ b/lld/MachO/SymbolTable.cpp
@@ -345,6 +345,7 @@ static bool recoverFromUndefinedSymbol(const Undefined &sym) {
return false;
}
+namespace {
struct UndefinedDiag {
struct SectionAndOffset {
const InputSection *isec;
@@ -355,7 +356,8 @@ struct UndefinedDiag {
std::vector<std::string> otherReferences;
};
-static MapVector<const Undefined *, UndefinedDiag> undefs;
+MapVector<const Undefined *, UndefinedDiag> undefs;
+}
void macho::reportPendingUndefinedSymbols() {
for (const auto &undef : undefs) {
I'll reland with that fix.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127753/new/
https://reviews.llvm.org/D127753
More information about the llvm-commits
mailing list