diff options
author | 2019-11-29 22:31:24 +0000 | |
---|---|---|
committer | 2019-11-29 22:31:24 +0000 | |
commit | 636101521a06cac7a5f59d67ea90672a8b2a65ff (patch) | |
tree | 0aa91b333475fe392930708b479f456802281121 | |
parent | Add uvm_objfree function to free all pages in a uvm_obj in one go. (diff) | |
download | wireguard-openbsd-636101521a06cac7a5f59d67ea90672a8b2a65ff.tar.xz wireguard-openbsd-636101521a06cac7a5f59d67ea90672a8b2a65ff.zip |
Sort relative relocations (and relocations against the same symbol) by offset
to optimize the cache and UVM faulting behavior
ok kettenis@
-rw-r--r-- | gnu/llvm/tools/lld/ELF/SyntheticSections.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp index 96ef7cc5cfe..30668787d54 100644 --- a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp +++ b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp @@ -1547,7 +1547,14 @@ static bool compRelocations(const DynamicReloc &A, const DynamicReloc &B) { bool BIsRel = B.Type == Target->RelativeRel; if (AIsRel != BIsRel) return AIsRel; - return A.getSymIndex() < B.getSymIndex(); + + if (!AIsRel) { + auto AIndex = A.getSymIndex(); + auto BIndex = B.getSymIndex(); + if (AIndex != BIndex) + return AIndex < BIndex; + } + return A.getOffset() < B.getOffset(); } template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) { |