1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-12-14 01:40:23 +09:00
parent 90802a014b
commit ba5a1e2194
3 changed files with 16 additions and 20 deletions

19
main.cc
View File

@ -472,22 +472,6 @@ static void fill_symbol_versions() {
}
}
static void write_merged_strings() {
ScopedTimer t("write_merged_strings");
tbb::parallel_for_each(out::objs, [&](ObjectFile *file) {
for (MergeableSection *isec : file->mergeable_sections) {
u8 *base = out::buf + isec->parent.shdr.sh_offset + isec->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());
}
}
});
}
static void clear_padding(u64 filesize) {
ScopedTimer t("clear_padding");
@ -1070,9 +1054,6 @@ int main(int argc, char **argv) {
});
}
// Fill mergeable string sections
write_merged_strings();
// Zero-clear paddings between sections
clear_padding(filesize);

3
mold.h
View File

@ -826,9 +826,10 @@ public:
static MergedSection *get_instance(std::string_view name, u64 flags, u32 type);
static inline std::vector<MergedSection *> instances;
ConcurrentMap<StringPiece> map;
void copy_buf() override;
private:
MergedSection(std::string_view name, u64 flags, u32 type)
: OutputChunk(SYNTHETIC) {

View File

@ -619,6 +619,20 @@ MergedSection::get_instance(std::string_view name, u64 flags, u32 type) {
return osec;
}
void MergedSection::copy_buf() {
tbb::parallel_for_each(out::objs, [&](ObjectFile *file) {
for (MergeableSection *isec : file->mergeable_sections) {
u8 *base = out::buf + isec->parent.shdr.sh_offset + isec->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());
}
}
});
}
void CopyrelSection::add_symbol(Symbol *sym) {
assert(sym->is_imported);
if (sym->copyrel_offset != -1)