[PATCH] D41046: [ELF] Make overlapping output sections an error

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 13:48:09 PST 2018


arichardson added inline comments.


================
Comment at: ELF/Writer.cpp:1936-1940
+  // Skip all zero-size sections when checking for overlap to speed up
+  // the checks a bit since they can never cause overlap.
+  for (OutputSection *Sec : OutputSections)
+    if (Sec->Size > 0)
+      Sections.push_back(Sec);
----------------
ruiu wrote:
> I don't think we need this as well. In general we shouldn't optimize for speed unless it is necessary.
Since I simplified the check to `GetStart(Other) < Start + Sec->Size` it is actually required. I have folded the `Size > 0` check into the `if (ShouldSkip(Sec))`and added a comment instead.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41046





More information about the llvm-commits mailing list