[PATCH] D94560: [ELF] report section sizes when output file too large

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 00:44:26 PST 2021


grimar added a comment.

An alternative to this could probably be changing the `Writer<ELFT>::assignFileOffsets()`
It has the following loop:

  for (OutputSection *sec : outputSections) {
    if (sec->type == SHT_NOBITS)
      continue;
    if ((sec->offset > fileSize) || (sec->offset + sec->size > fileSize))
      error("unable to place section " + sec->name + " at file offset " +
            rangeToString(sec->offset, sec->size) +
            "; check your linker script for overflows");
  }

Perhaps it is possible to check for overflowing `maxSize` too right there?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94560/new/

https://reviews.llvm.org/D94560



More information about the llvm-commits mailing list