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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 13:55:09 PST 2018


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with these changes. Thanks!



================
Comment at: ELF/Writer.cpp:1915-1916
+    uint64_t Start = GetStart(Sec);
+    for (OutputSection *Other :
+         ArrayRef<OutputSection *>(Sections).slice(i + 1)) {
+      // Since the sections are storted by start address we only need to check
----------------
Since it's obvious, you may use `auto *` here if you want.


================
Comment at: ELF/Writer.cpp:1921
+      // will also start after the end of Sec.
+      if (GetStart(Other) < Start + Sec->Size)
+        errorOrWarn("section " + Sec->Name + " " + Kind +
----------------
nit: `else break` seems a bit tricky. I'd prefer this style because of less indentation.

  if (Start + Sec->Size <= GetStart(Other))
    break;
  errorOrWarn(...);


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41046





More information about the llvm-commits mailing list