mirror of
https://github.com/rui314/mold.git
synced 2024-12-28 02:44:48 +03:00
temporary
This commit is contained in:
parent
23e9d8c36f
commit
92afbacf44
18
main.cc
18
main.cc
@ -421,11 +421,9 @@ static void fill_symbol_versions() {
|
||||
if (syms.empty())
|
||||
return;
|
||||
|
||||
std::stable_sort(syms.begin(), syms.end(), [](Symbol *a, Symbol *b) {
|
||||
SharedFile *x = (SharedFile *)a->file;
|
||||
SharedFile *y = (SharedFile *)b->file;
|
||||
return std::make_tuple(x->soname, a->ver_idx) <
|
||||
std::make_tuple(y->soname, b->ver_idx);
|
||||
sort(syms, [](Symbol *a, Symbol *b) {
|
||||
return std::make_tuple(((SharedFile *)a->file)->soname, a->ver_idx) <
|
||||
std::make_tuple(((SharedFile *)b->file)->soname, b->ver_idx);
|
||||
});
|
||||
|
||||
// Compute sizes of .gnu.version and .gnu.version_r sections.
|
||||
@ -1014,7 +1012,6 @@ static void show_stats() {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// Main
|
||||
Timer t_all("all");
|
||||
|
||||
// Parse non-positional command line options
|
||||
@ -1168,10 +1165,8 @@ int main(int argc, char **argv) {
|
||||
std::make_tuple(y->name, (u32)y->shdr.sh_type, (u64)y->shdr.sh_flags);
|
||||
};
|
||||
|
||||
std::stable_sort(OutputSection::instances.begin(), OutputSection::instances.end(),
|
||||
section_compare);
|
||||
std::stable_sort(MergedSection::instances.begin(), MergedSection::instances.end(),
|
||||
section_compare);
|
||||
sort(OutputSection::instances, section_compare);
|
||||
sort(MergedSection::instances, section_compare);
|
||||
|
||||
// Add sections to the section lists
|
||||
for (OutputSection *osec : OutputSection::instances)
|
||||
@ -1185,8 +1180,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Sort the sections by section flags so that we'll have to create
|
||||
// as few segments as possible.
|
||||
std::stable_sort(out::chunks.begin(), out::chunks.end(),
|
||||
[](OutputChunk *a, OutputChunk *b) {
|
||||
sort(out::chunks, [](OutputChunk *a, OutputChunk *b) {
|
||||
return get_section_rank(a->shdr) < get_section_rank(b->shdr);
|
||||
});
|
||||
|
||||
|
@ -14,8 +14,7 @@ void print_map() {
|
||||
|
||||
for (auto &pair : map) {
|
||||
std::vector<Symbol *> &vec = pair.second;
|
||||
std::stable_sort(vec.begin(), vec.end(),
|
||||
[](Symbol *a, Symbol *b) { return a->value < b->value; });
|
||||
sort(vec, [](Symbol *a, Symbol *b) { return a->value < b->value; });
|
||||
}
|
||||
|
||||
std::cout << " VMA Size Align Out In Symbol\n";
|
||||
|
5
mold.h
5
mold.h
@ -1009,3 +1009,8 @@ template <typename T, typename U>
|
||||
inline void erase(std::vector<T> &vec, U pred) {
|
||||
vec.erase(std::remove_if(vec.begin(), vec.end(), pred), vec.end());
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
inline void sort(T &vec, U less) {
|
||||
std::stable_sort(vec.begin(), vec.end(), less);
|
||||
}
|
||||
|
@ -713,8 +713,7 @@ void SharedFile::parse() {
|
||||
|
||||
// Sort symbols by value for find_aliases(), as find_aliases() does
|
||||
// binary search on symbols.
|
||||
std::stable_sort(pairs.begin(), pairs.end(),
|
||||
[](const std::pair<const ElfSym *, u16> &a,
|
||||
sort(pairs, [](const std::pair<const ElfSym *, u16> &a,
|
||||
const std::pair<const ElfSym *, u16> &b) {
|
||||
return a.first->st_value < b.first->st_value;
|
||||
});
|
||||
|
4
perf.cc
4
perf.cc
@ -15,9 +15,7 @@ void Counter::print() {
|
||||
return;
|
||||
|
||||
std::vector<Counter *> vec = instances;
|
||||
std::stable_sort(vec.begin(), vec.end(), [](Counter *a, Counter *b) {
|
||||
return a->value > b->value;
|
||||
});
|
||||
sort(vec, [](Counter *a, Counter *b) { return a->value > b->value; });
|
||||
|
||||
for (Counter *c : vec)
|
||||
std::cout << std::setw(20) << std::right << c->name << "=" << c->value << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user