Skip to content

Commit 9115d75

Browse files
committed
[ELF] Use parallelSort for .rela.dyn
An unstable sort suffices. In a large link (11.06s), this decreases .rela.dyn writeTo time from 1.52s to 0.81s, resulting in 6% total time speedup (the benefit will greatly dilute if --pack-dyn-relocs=relr becomes prevailing). Encoding the dynamic relocations then sorting raw Elf_Rel/Elf_Rela doesn't seem to improve much (doing that would require code duplicate because of Elf_Rel/Elf_Rela plus unfortunate mips64le), so don't do that.
1 parent 1eaa9b4 commit 9115d75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lld/ELF/SyntheticSections.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *buf) {
16781678
// place R_*_RELATIVE first. SymIndex is to improve locality, while r_offset
16791679
// is to make results easier to read.
16801680
if (sort)
1681-
llvm::stable_sort(
1681+
parallelSort(
16821682
relocs, [&](const DynamicReloc &a, const DynamicReloc &b) {
16831683
return std::make_tuple(a.type != target->relativeRel,
16841684
a.getSymIndex(symTab), a.getOffset()) <

0 commit comments

Comments
 (0)