summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/SyntheticSections.cpp23
-rw-r--r--lld/ELF/SyntheticSections.h6
2 files changed, 16 insertions, 13 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 6a5527d19b0..9294a9980b2 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1784,8 +1784,8 @@ void GdbIndexSection::fixCuIndex() {
}
}
-std::vector<std::set<uint32_t>> GdbIndexSection::createCuVectors() {
- std::vector<std::set<uint32_t>> Ret;
+std::vector<std::vector<uint32_t>> GdbIndexSection::createCuVectors() {
+ std::vector<std::vector<uint32_t>> Ret;
uint32_t Idx = 0;
uint32_t Off = 0;
@@ -1795,13 +1795,18 @@ std::vector<std::set<uint32_t>> GdbIndexSection::createCuVectors() {
if (!Sym) {
Sym = make<GdbSymbol>(GdbSymbol{Ent.Name.hash(), Off, Ret.size()});
Off += Ent.Name.size() + 1;
- Ret.resize(Ret.size() + 1);
+ Ret.push_back({});
}
- Ret[Sym->CuVectorIndex].insert((Ent.Type << 24) | Idx);
+ Ret[Sym->CuVectorIndex].push_back((Ent.Type << 24) | Idx);
}
Idx += Chunk.CompilationUnits.size();
}
+ for (std::vector<uint32_t> &V : Ret) {
+ std::sort(V.begin(), V.end());
+ V.erase(std::unique(V.begin(), V.end()), V.end());
+ }
+
StringPoolSize = Off;
return Ret;
}
@@ -1870,9 +1875,9 @@ GdbIndexSection::GdbIndexSection(std::vector<GdbIndexChunk> &&C)
ConstantPoolOffset = SymtabOffset + GdbSymtab.size() * 8;
size_t Off = 0;
- for (std::set<uint32_t> &CuVec : CuVectors) {
+ for (ArrayRef<uint32_t> Vec : CuVectors) {
CuVectorOffsets.push_back(Off);
- Off += (CuVec.size() + 1) * 4;
+ Off += (Vec.size() + 1) * 4;
}
StringPoolOffset = ConstantPoolOffset + Off;
}
@@ -1922,10 +1927,10 @@ void GdbIndexSection::writeTo(uint8_t *Buf) {
}
// Write the CU vectors.
- for (std::set<uint32_t> &CuVec : CuVectors) {
- write32le(Buf, CuVec.size());
+ for (ArrayRef<uint32_t> Vec : CuVectors) {
+ write32le(Buf, Vec.size());
Buf += 4;
- for (uint32_t Val : CuVec) {
+ for (uint32_t Val : Vec) {
write32le(Buf, Val);
Buf += 4;
}
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 01994991894..081d086d669 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -27,8 +27,6 @@
#include "llvm/ADT/MapVector.h"
#include "llvm/MC/StringTableBuilder.h"
-#include <set>
-
namespace lld {
namespace elf {
@@ -536,14 +534,14 @@ public:
private:
void fixCuIndex();
- std::vector<std::set<uint32_t>> createCuVectors();
+ std::vector<std::vector<uint32_t>> createCuVectors();
std::vector<GdbSymbol *> createGdbSymtab();
// A symbol table for this .gdb_index section.
std::vector<GdbSymbol *> GdbSymtab;
// CU vector is a part of constant pool area of section.
- std::vector<std::set<uint32_t>> CuVectors;
+ std::vector<std::vector<uint32_t>> CuVectors;
// Symbol table contents.
llvm::DenseMap<llvm::CachedHashStringRef, GdbSymbol *> Symbols;
OpenPOWER on IntegriCloud