mirror of
https://github.com/rui314/mold.git
synced 2024-10-05 09:07:10 +03:00
refactor
This commit is contained in:
parent
af592f303c
commit
c1c20aa427
13
elf/dwarf.cc
13
elf/dwarf.cc
@ -96,19 +96,18 @@ std::vector<GdbIndexName> read_pubnames(Context<E> &ctx, ObjectFile<E> &file) {
|
||||
|
||||
// Uniquify elements because GCC 11 seems to emit one record for each
|
||||
// comdat group which results in having a lot of duplicate records.
|
||||
std::sort(vec.begin(), vec.end(),
|
||||
[](const GdbIndexName &a, const GdbIndexName &b) {
|
||||
auto less = [](const GdbIndexName &a, const GdbIndexName &b) {
|
||||
return std::tuple{a.hash, a.attr, a.name} <
|
||||
std::tuple{b.hash, b.attr, b.name};
|
||||
});
|
||||
};
|
||||
|
||||
auto last = std::unique(vec.begin(), vec.end(),
|
||||
[](const GdbIndexName &a, const GdbIndexName &b) {
|
||||
auto equal = [](const GdbIndexName &a, const GdbIndexName &b) {
|
||||
return std::tuple{a.hash, a.attr, a.name} ==
|
||||
std::tuple{b.hash, b.attr, b.name};
|
||||
});
|
||||
};
|
||||
|
||||
vec.erase(last, vec.end());
|
||||
std::sort(vec.begin(), vec.end(), less);
|
||||
vec.erase(std::unique(vec.begin(), vec.end(), equal), vec.end());
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ void ObjectFile<E>::sort_relocations(Context<E> &ctx) {
|
||||
sorted_rels.resize(sections.size());
|
||||
|
||||
for (i64 i = 1; i < sections.size(); i++) {
|
||||
std::unique_ptr<InputSection<E>> &isec = sections[i];;
|
||||
std::unique_ptr<InputSection<E>> &isec = sections[i];
|
||||
if (!isec || !isec->is_alive || !(isec->shdr().sh_flags & SHF_ALLOC))
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user