1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-28 02:44:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-08 09:53:13 +09:00
parent 1e6fbcabfa
commit 70ba99ef27

42
main.cc
View File

@ -182,7 +182,6 @@ static void handle_mergeable_strings(std::vector<ObjectFile *> &files) {
}
static void bin_sections(std::vector<ObjectFile *> &files) {
#if 1
int unit = (files.size() + 127) / 128;
std::vector<ArrayRef<ObjectFile *>> slices = split(files, unit);
@ -217,47 +216,6 @@ static void bin_sections(std::vector<ObjectFile *> &files) {
sections.insert(sections.end(), group[i].begin(), group[i].end());
}
}
#elif 1
int num_osec = OutputSection::instances.size();
std::vector<std::vector<int>> sizes(files.size(), std::vector<int>(num_osec));
tbb::parallel_for(0, (int)files.size(), [&](int i) {
for (InputSection *isec : files[i]->sections) {
if (isec) {
OutputSection *osec = isec->output_section;
sizes[i][osec->idx]++;
}
}
});
std::vector<std::vector<int>> offsets(files.size() + 1, std::vector<int>(num_osec));
for (int i = 1; i < files.size() + 1; i++)
for (int j = 0; j < num_osec; j++)
offsets[i][j] = offsets[i - 1][j] + sizes[i - 1][j];
tbb::parallel_for(0, num_osec, [&](int j) {
OutputSection::instances[j]->sections.resize(offsets[files.size()][j]);
});
tbb::parallel_for(0, (int)files.size(), [&](int i) {
for (InputSection *isec : files[i]->sections) {
if (isec) {
OutputSection *osec = isec->output_section;
osec->sections[offsets[i][osec->idx]++] = isec;
}
}
});
#else
for (ObjectFile *file : files) {
for (InputSection *isec : file->sections) {
if (!isec)
continue;
OutputSection *osec = isec->output_section;
osec->sections.push_back(isec);
}
}
#endif
}
static void set_isec_offsets() {