[PATCH] D92301: [LLD][ELF] - Don't keep empty output sections that are explicitly assigned to segment.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 01:23:53 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, psmith.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
grimar requested review of this revision.

This reverts the behavior introduced by D43571 <https://reviews.llvm.org/D43571>.
D43571 <https://reviews.llvm.org/D43571> was a code cleanup patch that introduced early removing of section commands.
It introduced the behavior change: LLD started emitting empty sections that
are explicitly assigned to a segment.

This behavior is not clean and we might produce empty sections in cases when we
could be more aggressive in removing them.

The problem here is that we should somehow preserve the information
about segment assigned to n empty section before we remove it from the list.

This patch adds an early phdrs propagation step, which is similar to one that
we do after sorting orphan sections step.


https://reviews.llvm.org/D92301

Files:
  lld/ELF/LinkerScript.cpp
  lld/test/ELF/linkerscript/empty-relaplt-dyntags.test
  lld/test/ELF/linkerscript/implicit-program-header.test
  lld/test/ELF/linkerscript/orphan-phdrs.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92301.308284.patch
Type: text/x-patch
Size: 5696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201130/8f3c6e7f/attachment.bin>


More information about the llvm-commits mailing list