[PATCH] D117439: [ELF] Update .relr.dyn once in the absence of SECTIONS commands

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 16 13:32:05 PST 2022


MaskRay created this revision.
MaskRay added reviewers: ikudrin, peter.smith.
Herald added subscribers: mgrang, arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

If an output section does not have internal `. = ALIGN(x);`, the spacing among
its input sections remain unchanged after `script->assignAddresses` is called
for the first time.

r_offset is `inputSec->getOutputSection().addr + inputSec->outSecOff + offsetInSec`
If we delay `inputSec->getOutputSection().addr` addition to `writeTo`,
`updateAllocSize` can be called only once.

Conservatively use `!hasSectionsCommand` to mean .relr.dyn only needs one update.

With this change, the problem described by D67164 <https://reviews.llvm.org/D67164> is very difficult to trigger.
I cannot figure out a case to get the ".relr.dyn needs ... padding word(s)"
diagnostic, but keep it just in case.

My --threads=8 chrome link is 1% faster.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117439

Files:
  lld/ELF/SyntheticSections.cpp
  lld/ELF/SyntheticSections.h
  lld/ELF/Writer.cpp
  lld/test/ELF/pack-dyn-relocs-relr-loop.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117439.400402.patch
Type: text/x-patch
Size: 6746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220116/cdfa6355/attachment.bin>


More information about the llvm-commits mailing list