[ELF] Add REVERSE input section description keyword
The `REVERSE` keyword is described here: https://sourceware.org/bugzilla/show_bug.cgi?id=27565 It complements `SORT` by allowing the order of input sections to be reversed. This is particularly useful for order-dependent sections such as .init_array, where `REVERSE` can be used to either detect static initialization order fiasco issues or as a mechanism to maintain .ctors element order while transitioning to the modern .init_array. Such a transition is described here: https://discourse.llvm.org/t/is-it-possible-to-manually-specify-init-array-order/68649 Differential Revision: https://reviews.llvm.org/D145381
This commit is contained in:
@@ -660,6 +660,7 @@ StringMatcher ScriptParser::readFilePatterns() {
|
||||
|
||||
SortSectionPolicy ScriptParser::peekSortKind() {
|
||||
return StringSwitch<SortSectionPolicy>(peek())
|
||||
.Case("REVERSE", SortSectionPolicy::Reverse)
|
||||
.Cases("SORT", "SORT_BY_NAME", SortSectionPolicy::Name)
|
||||
.Case("SORT_BY_ALIGNMENT", SortSectionPolicy::Alignment)
|
||||
.Case("SORT_BY_INIT_PRIORITY", SortSectionPolicy::Priority)
|
||||
|
||||
Reference in New Issue
Block a user