1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-11 16:58:12 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-12 16:09:17 +09:00
parent 1a295f073f
commit 871e51d5aa

View File

@ -981,7 +981,8 @@ int main(int argc, char **argv) {
// Create a list of output sections.
std::vector<OutputChunk *> chunks;
// Sort sections to make the output deterministic.
// Sections are added to the section lists in an arbitrary order because
// they are created in parallel. Sor them to to make the output deterministic.
auto section_compare = [](OutputChunk *x, OutputChunk *y) {
return std::make_tuple(x->name, (u32)x->shdr.sh_type, (u64)x->shdr.sh_flags) <
std::make_tuple(y->name, (u32)y->shdr.sh_type, (u64)y->shdr.sh_flags);
@ -992,6 +993,7 @@ int main(int argc, char **argv) {
std::stable_sort(MergedSection::instances.begin(), MergedSection::instances.end(),
section_compare);
// Add sections to the section lists
for (OutputSection *osec : OutputSection::instances)
if (osec->shdr.sh_size)
chunks.push_back(osec);