[PATCH] D38170: [ELF] - Drop SHF_LINK_ORDER flag from output.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 03:28:37 PDT 2017


grimar added inline comments.


================
Comment at: ELF/InputSection.cpp:97-98
+  if (!isa<InputSection>(Sec)) {
+    error("Merge and .eh_frame sections are not supported with "
+      "SHF_LINK_ORDER " + toString(Sec));
+    return nullptr;
----------------
ruiu wrote:
>   "a section with SHF_LINK_ORDER should not refer a non-regular section: " + toString(Sec)
Changed in r314392 (it was legacy text).


================
Comment at: ELF/InputSection.h:185
 
+  InputSection *LinkOrderSection = nullptr;
+
----------------
ruiu wrote:
> As always, it needs a comment.
Done.


================
Comment at: ELF/OutputSections.cpp:447
 
+static uint32_t getLinkOrder(ArrayRef<InputSection *> V) {
+  for (InputSection *IS : V)
----------------
ruiu wrote:
> This is O(N^2) where N is the number of input sections. Please don't do that.
I believe that is O(Mx) here. Where M is amount of sections in output section, so that M0+M1+....+Mn == N,
where N is total amount of input sections. Overall complexity is O(N).
Because for each output section this function scans over its input sections once.

I think you was confused by incorrect code style in `OutputSection::finalize()`, I fixed it in r314394.



https://reviews.llvm.org/D38170





More information about the llvm-commits mailing list