[all-commits] [llvm/llvm-project] a03187: [ELF] Rename adjustSectionsBeforeSorting to adjust...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue Feb 1 10:16:25 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a0318711c8cfcb0ecdd956eb400916c5c2b08d3c
https://github.com/llvm/llvm-project/commit/a0318711c8cfcb0ecdd956eb400916c5c2b08d3c
Author: Fangrui Song <i at maskray.me>
Date: 2022-02-01 (Tue, 01 Feb 2022)
Changed paths:
M lld/ELF/LinkerScript.cpp
M lld/ELF/LinkerScript.h
M lld/ELF/Writer.cpp
M lld/test/ELF/linkerscript/insert-after.test
M lld/test/ELF/linkerscript/insert-before.test
Log Message:
-----------
[ELF] Rename adjustSectionsBeforeSorting to adjustOutputSections and make it affect INSERT commands
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. The new
name is not set into stone. The function mixes several tasks and the
code may be refactored in a way that we may give them more meaningful
names.
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).
Reviewed By: peter.smith, bluca
Differential Revision: https://reviews.llvm.org/D118529
More information about the All-commits
mailing list