[PATCH] D24604: [ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 11:30:34 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:988
@@ +987,3 @@
+
+static void selectSortKind(InputSectionDescription *Cmd) {
+  if (Cmd->SortOuter == SortSectionPolicy::IgnoreConfig) {
----------------
ruiu wrote:
> It's hard to figure out the final output of this function. Can you describe it for me? I think it's hard to understand because you update `Cmd` and then fix its members in the second pass using this function. Why don't you set the proper values in the first place in one shot?
In short: you have SORT type specified by  --sort-section in Config->SortSection and types that are specified in script. Depending on if you have Outer/Inner rule set by script for sections it should either ignore either use or even mix with rules from  --sort-section.
So final output is mixing commandline and script.

This SORT applying logic is described at https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html page and it is not just that trivial,
so I think it is much better to split reading of the script and mixing sorting types, like this method do to keep logic simplier.


https://reviews.llvm.org/D24604





More information about the llvm-commits mailing list