[PATCH] D23352: [ELF] - Linkerscript: implemented simple heuristic for placing orphan sections.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 14:49:15 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:282
@@ +281,3 @@
+                                   InputSectionBase<ELFT> *C) {
+  bool IsNew;
+  OutputSectionBase<ELFT> *OutSec;
----------------
ruiu wrote:
> That's what you are doing, but why do you have to do that?
That is just a variant of possible heuristic. 
That works for orphans in freebsd script and probably will work for other scripts.
Attemp to group sections together by attributes seems reasonable.
Do you think about some different algorithm ?


================
Comment at: ELF/LinkerScript.cpp:307
@@ +306,3 @@
+  OutSecCmd->OutputSection = OutSec;
+  ScriptConfig->Commands.emplace(Pos, OutSecCmd);
+}
----------------
ruiu wrote:
> What I meant by "parallel array", I meant `ScriptConfig->Commands` and `OutputSections`. You are inserting new elements as you create new output sections, so you are still maintaining them as a parallel array. Is this intended?
Yes, intended, but approach was changed:
I am creating the elements of ScriptConfig->Commands at first. And then at the end of createSections() construct OutputSections entries from ScriptConfig->Commands. So I do not need to mantain both arrays at the same time during sections creation and processing orphans anymore. Was not that the point ?



https://reviews.llvm.org/D23352





More information about the llvm-commits mailing list