This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Add REVERSE input section description keyword
ClosedPublic

Authored by justincady on Mar 6 2023, 7:00 AM.

Details

Summary

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

Diff Detail

Event Timeline

justincady created this revision.Mar 6 2023, 7:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 7:00 AM
justincady requested review of this revision.Mar 6 2023, 7:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 7:00 AM
MaskRay accepted this revision.Mar 6 2023, 1:27 PM
MaskRay added inline comments.
lld/ELF/Config.h
82
This revision is now accepted and ready to land.Mar 6 2023, 1:27 PM

Normally I'd like a confirmation from binutils, but the semantics seem pretty clear, so ld.lld adopting the feature first may be fine :)
At any rate I left a comment on https://sourceware.org/bugzilla/show_bug.cgi?id=27565

justincady updated this revision to Diff 502853.Mar 6 2023, 4:20 PM

Add trailing comma to SortSectionPolicy enum as suggested

justincady marked an inline comment as done.Mar 6 2023, 4:23 PM

Fixed the comma in latest revision.

This revision was automatically updated to reflect the committed changes.