}
template <class ELFT>
-std::map<std::string, SymbolBody *> SymbolTable<ELFT>::getDemangledSyms() {
- std::map<std::string, SymbolBody *> Result;
+std::map<std::string, std::vector<SymbolBody *>>
+SymbolTable<ELFT>::getDemangledSyms() {
+ std::map<std::string, std::vector<SymbolBody *>> Result;
for (Symbol *Sym : SymVector) {
SymbolBody *B = Sym->body();
- Result[demangle(B->getName())] = B;
+ Result[demangle(B->getName())].push_back(B);
}
return Result;
}
return false;
}
-static SymbolBody *findDemangled(const std::map<std::string, SymbolBody *> &D,
- StringRef Name) {
+static ArrayRef<SymbolBody *>
+findDemangled(std::map<std::string, std::vector<SymbolBody *>> &D,
+ StringRef Name) {
auto I = D.find(Name);
if (I != D.end())
return I->second;
- return nullptr;
+ return {};
}
static std::vector<SymbolBody *>
-findAllDemangled(const std::map<std::string, SymbolBody *> &D,
+findAllDemangled(const std::map<std::string, std::vector<SymbolBody *>> &D,
const Regex &Re) {
std::vector<SymbolBody *> Res;
for (auto &P : D) {
- SymbolBody *Body = P.second;
- if (!Body->isUndefined() && const_cast<Regex &>(Re).match(P.first))
- Res.push_back(Body);
+ if (const_cast<Regex &>(Re).match(P.first))
+ for (SymbolBody *Body : P.second)
+ if (!Body->isUndefined())
+ Res.push_back(Body);
}
return Res;
}
// "llvm::*::foo(int, ?)". Obviously, there's no way to handle this
// other than trying to match a regexp against all demangled symbols.
// So, if "extern C++" feature is used, we demangle all known symbols.
- std::map<std::string, SymbolBody *> Demangled;
+ std::map<std::string, std::vector<SymbolBody *>> Demangled;
if (hasExternCpp())
Demangled = getDemangledSyms();
for (SymbolVersion Sym : V.Globals) {
if (Sym.HasWildcards)
continue;
+
StringRef N = Sym.Name;
- SymbolBody *B = Sym.IsExternCpp ? findDemangled(Demangled, N) : find(N);
- setVersionId(B, V.Name, N, V.Id);
+ ArrayRef<SymbolBody *> Arr = Sym.IsExternCpp
+ ? findDemangled(Demangled, N)
+ : ArrayRef<SymbolBody *>(find(N));
+ for (SymbolBody *B : Arr)
+ setVersionId(B, V.Name, N, V.Id);
}
}
# DSO-NEXT: Other: 0
# DSO-NEXT: Section: .text (0x6)
# DSO-NEXT: }
+# DSO-NEXT: Symbol {
+# DSO-NEXT: Name: _ZN3abcC2Ev@@LIBSAMPLE_1.0
+# DSO-NEXT: Value: 0x1004
+# DSO-NEXT: Size: 0
+# DSO-NEXT: Binding: Global (0x1)
+# DSO-NEXT: Type: Function (0x2)
+# DSO-NEXT: Other: 0
+# DSO-NEXT: Section: .text (0x6)
+# DSO-NEXT: }
# DSO-NEXT: ]
# DSO-NEXT: Version symbols {
# DSO-NEXT: Section Name: .gnu.version
-# DSO-NEXT: Address: 0x240
-# DSO-NEXT: Offset: 0x240
+# DSO-NEXT: Address: 0x258
+# DSO-NEXT: Offset: 0x258
# DSO-NEXT: Link: 1
# DSO-NEXT: Symbols [
# DSO-NEXT: Symbol {
# DSO-NEXT: Version: 2
# DSO-NEXT: Name: _ZN3abcC1Ev@@LIBSAMPLE_1.0
# DSO-NEXT: }
+# DSO-NEXT: Symbol {
+# DSO-NEXT: Version: 2
+# DSO-NEXT: Name: _ZN3abcC2Ev@@LIBSAMPLE_1.0
+# DSO-NEXT: }
# DSO-NEXT: ]
# DSO-NEXT: }
.type _ZN3abcC1Ev,@function
_ZN3abcC1Ev:
retq
+
+.globl _ZN3abcC2Ev
+.type _ZN3abcC2Ev,@function
+_ZN3abcC2Ev:
+retq