[PATCH] D118529: [ELF] Rename adjustSectionsBeforeSorting to adjustOutputSections and make it affect INSERT commands
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 28 22:56:42 PST 2022
MaskRay created this revision.
MaskRay added reviewers: andrewng, ikudrin, peter.smith.
Herald added subscribers: arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
adjustSectionsBeforeSorting updates some output section attributes
(alignment/flags) and removes discardable empty sections. When it is called,
INSERT commands have not been processed. Therefore the flags propagation rule
may not affect output sections defined in an INSERT command properly.
Fix this by moving processInsertCommands before adjustSectionsBeforeSorting.
adjustSectionsBeforeSorting is somewhat misnamed. The order between it and
sortInputSections does not matter. With the pass shuffle, the name of
adjustSectionsBeforeSorting becomes wrong. Therefore rename it.
With this patch, I think the behavior of attribute propagation becomes more
reasonable. In particular, in the absence of non-INSERT SECTIONS,
inserting a section after a SHF_ALLOC one will give us a SHF_ALLOC section,
not a non-SHF_ALLOC one (see linkerscript/insert-after.test).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118529
Files:
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/insert-after.test
lld/test/ELF/linkerscript/insert-before.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118529.404233.patch
Type: text/x-patch
Size: 5733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220129/946c6bfb/attachment.bin>
More information about the llvm-commits
mailing list