[PATCH] D19171: [ELF] - Get rid of SectionOrder array.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 11:55:34 PDT 2016
grimar added inline comments.
================
Comment at: ELF/LinkerScript.cpp:172
@@ -163,5 +171,3 @@
int LinkerScript::compareSections(StringRef A, StringRef B) {
- auto E = SectionOrder.end();
- auto I = std::find(SectionOrder.begin(), E, A);
- auto J = std::find(SectionOrder.begin(), E, B);
- if (I == E || J == E)
+ uint32_t I = getSectionOrder(A);
+ uint32_t J = getSectionOrder(B);
----------------
So compareSections() is used to sort OutputSections.
Later linkerscript uses this order in fixupLocations() to add orphans.
Therefore Locations vector is updated at the very end,
before actual address assignment.
Another variant would be to call fixupLocations() earlier, before compareSections().
Then orpan order would be script driven, but will add some code complexity as will need export of
fixupLocations() method.
I like both approach. First (this patch) for simple code, second for giving
all cards to script to control orphans order.
http://reviews.llvm.org/D19171
More information about the llvm-commits
mailing list