1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 10:27:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-07 22:54:07 +09:00
parent e326ee5846
commit 805e56033b

20
main.cc
View File

@ -123,7 +123,7 @@ static std::vector<ArrayRef<T>> split(const std::vector<T> &input, int unit) {
} }
static void handle_mergeable_strings(std::vector<ObjectFile *> &files) { static void handle_mergeable_strings(std::vector<ObjectFile *> &files) {
static Counter counter("merged_strings"); static Counter counter("handle_merged_strings");
for (MergedSection *osec : MergedSection::instances) for (MergedSection *osec : MergedSection::instances)
counter.inc(osec->map.size()); counter.inc(osec->map.size());
@ -959,6 +959,24 @@ int main(int argc, char **argv) {
write_got(buf, files); write_got(buf, files);
} }
// Fill mergeable string sections
{
MyTimer t("write_merged_strings");
for_each(files, [&](ObjectFile *file) {
for (InputSection *isec : file->mergeable_sections) {
MergedSection *osec = isec->merged_section;
u8 *base = buf + osec->shdr.sh_offset + isec->merged_offset;
for (StringPieceRef &ref : isec->pieces) {
StringPiece &piece = *ref.piece;
if (piece.isec == isec)
memcpy(base + piece.output_offset, piece.data.data(), piece.data.size());
}
}
});
}
{ {
MyTimer t("commit"); MyTimer t("commit");
if (auto e = output_buffer->commit()) if (auto e = output_buffer->commit())