[all-commits] [llvm/llvm-project] da0e5b: [ELF] Refactor -z combreloc
Fangrui Song via All-commits
all-commits at lists.llvm.org
Sat Jan 29 14:46:11 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: da0e5b885b25cf4ded0fa89b965dc6979ac02ca9
https://github.com/llvm/llvm-project/commit/da0e5b885b25cf4ded0fa89b965dc6979ac02ca9
Author: Fangrui Song <i at maskray.me>
Date: 2022-01-29 (Sat, 29 Jan 2022)
Changed paths:
M lld/ELF/SyntheticSections.cpp
M lld/ELF/SyntheticSections.h
M lld/ELF/Writer.cpp
M lld/test/ELF/pack-dyn-relocs.s
Log Message:
-----------
[ELF] Refactor -z combreloc
* `RelocationBaseSection::addReloc` increases `numRelativeRelocs`, which
duplicates the work done by RelocationSection<ELFT>::writeTo.
* --pack-dyn-relocs=android has inappropropriate DT_RELACOUNT.
AndroidPackedRelocationSection does not necessarily place relative relocations
in the front and DT_RELACOUNT might cause semantics error (though our
implementation doesn't and Android bionic doesn't use DT_RELACOUNT anyway.)
Move `llvm::partition` to a new function `partitionRels` and compute
`numRelativeRelocs` there. Now `RelocationBaseSection::addReloc` is trivial and
can be moved to the header to enable inlining.
The rest of DynamicReloc and `-z combreloc` handling is moved to the
non-template `RelocationBaseSection::computeRels` to decrease code size. My
x86-64 lld executable is 44+KiB smaller.
While here, rename `sort` to `combreloc`.
More information about the All-commits
mailing list