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

temporary

This commit is contained in:
Rui Ueyama 2020-10-28 00:26:31 +09:00
parent 47c2fe9235
commit c580758b65
4 changed files with 15 additions and 12 deletions

View File

@ -380,7 +380,7 @@ ObjectFile::write_local_symtab(uint8_t *buf, uint64_t symtab_off, uint64_t strta
ent->st_value = get_symbol_value(i);
symtab_off += sizeof(ELF64LE::Sym);
memcpy(strtab + strtab_off, name.data(), name.size());
memcpy_nontemporal(strtab + strtab_off, name.data(), name.size());
strtab_off += name.size() + 1;
}
}
@ -404,7 +404,7 @@ ObjectFile::write_global_symtab(uint8_t *buf, uint64_t symtab_off, uint64_t strt
ent->st_value = sym.value;
symtab_off += sizeof(ELF64LE::Sym);
memcpy(strtab + strtab_off, sym.name.data(), sym.name.size());
memcpy_nontemporal(strtab + strtab_off, sym.name.data(), sym.name.size());
strtab_off += sym.name.size() + 1;
}
}

View File

@ -23,15 +23,7 @@ void InputSection::copy_to(uint8_t *buf) {
ArrayRef<uint8_t> data = check(file->obj.getSectionContents(shdr));
buf = buf + output_section->shdr.sh_offset + offset;
#if 0
for (int i = 0; i < data.size(); i++) {
uint8_t val = __builtin_nontemporal_load(&data[0] + i);
__builtin_nontemporal_store(val, buf + i);
}
#else
memcpy(buf, &data[0], data.size());
#endif
memcpy_nontemporal(buf, &data[0], data.size());
}
void InputSection::scan_relocations() {

View File

@ -383,7 +383,7 @@ private:
};
int main(int argc, char **argv) {
tbb::global_control tbb_cont(tbb::global_control::max_allowed_parallelism, 16);
tbb::global_control tbb_cont(tbb::global_control::max_allowed_parallelism, 64);
// Parse command line options
MyOptTable opt_table;

11
mold.h
View File

@ -540,3 +540,14 @@ extern std::atomic_int num_files;
extern std::atomic_int num_relocs;
extern std::atomic_int num_relocs_alloc;
extern std::atomic_int num_string_pieces;
//
// Other
//
inline void memcpy_nontemporal(void *dest, const void *src, size_t n) {
for (size_t i = 0; i < n; i++) {
uint8_t val = __builtin_nontemporal_load((char *)src + i);
__builtin_nontemporal_store(val, (char *)dest + i);
}
}