diff options
Diffstat (limited to 'lld/ELF/MapFile.cpp')
-rw-r--r-- | lld/ELF/MapFile.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index cefe8a235b48..275983527538 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -72,10 +72,17 @@ static SymbolMapTy getSectionSyms(ArrayRef<Defined *> syms) { // Sort symbols by address. We want to print out symbols in the // order in the output file rather than the order they appeared // in the input files. - for (auto &it : ret) + SmallPtrSet<Defined *, 4> set; + for (auto &it : ret) { + // Deduplicate symbols which need a canonical PLT entry/copy relocation. + set.clear(); + llvm::erase_if(it.second, + [&](Defined *sym) { return !set.insert(sym).second; }); + llvm::stable_sort(it.second, [](Defined *a, Defined *b) { return a->getVA() < b->getVA(); }); + } return ret; } |