mirror of
https://github.com/rui314/mold.git
synced 2024-12-28 02:44:48 +03:00
wip
This commit is contained in:
parent
0f46de23d2
commit
3e454c2175
12
icf.cc
12
icf.cc
@ -264,8 +264,11 @@ void icf_sections() {
|
||||
break;
|
||||
num_classes = n;
|
||||
}
|
||||
t2.stop();
|
||||
|
||||
|
||||
// Group sections by SHA1 digest.
|
||||
Timer t3("merge");
|
||||
std::vector<std::pair<InputSection *, Digest>> entries;
|
||||
entries.resize(sections.size());
|
||||
|
||||
@ -273,8 +276,13 @@ void icf_sections() {
|
||||
entries[i] = {sections[i], digests[slot][i]};
|
||||
});
|
||||
|
||||
tbb::parallel_sort(entries.begin(), entries.end(),
|
||||
[](auto &a, auto &b) { return a.second < b.second; });
|
||||
tbb::parallel_sort(entries.begin(), entries.end(), [](auto &a, auto &b) {
|
||||
if (a.second != b.second)
|
||||
return a.second < b.second;
|
||||
if (a.first->file->priority != b.first->file->priority)
|
||||
return a.first->file->priority < b.first->file->priority;
|
||||
return a.first->get_section_idx() < b.first->get_section_idx();
|
||||
});
|
||||
|
||||
tbb::enumerable_thread_specific<i64> counter;
|
||||
tbb::parallel_for((i64)0, (i64)entries.size() - 1, [&](i64 i) {
|
||||
|
@ -11,6 +11,12 @@ std::string_view InputChunk::get_contents() const {
|
||||
return file->get_string(shdr);
|
||||
}
|
||||
|
||||
i64 InputChunk::get_section_idx() const {
|
||||
assert(&file->elf_sections.front() <= &shdr &&
|
||||
&shdr < &file->elf_sections.back());
|
||||
return &shdr - &file->elf_sections.front();
|
||||
}
|
||||
|
||||
static std::string rel_to_string(u64 r_type) {
|
||||
switch (r_type) {
|
||||
case R_X86_64_NONE: return "R_X86_64_NONE";
|
||||
|
Loading…
Reference in New Issue
Block a user