[PATCH] D78138: [MC][COFF][ELF] Reject instructions in IMAGE_SCN_CNT_UNINITIALIZED_DATA/SHT_NOBITS sections

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 12:03:41 PDT 2020


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

lgtm with suggestion to improve the diagnostic at the old location



================
Comment at: llvm/lib/MC/MCAssembler.cpp:686
         if (DF.fixup_begin() != DF.fixup_end())
           report_fatal_error("cannot have fixups in virtual section!");
         for (unsigned i = 0, e = DF.getContents().size(); i != e; ++i)
----------------
I wonder if there are other creative ways to trigger this assertion, something like:
```
.section ... # stuff to make it bss-y
.uleb .LtmpN - .LtmpM
```

Might be worth transitioning it to reportError.


================
Comment at: llvm/lib/MC/MCAssembler.cpp:689
           if (DF.getContents()[i]) {
             if (auto *ELFSec = dyn_cast<const MCSectionELF>(Sec))
+              getContext().reportError(
----------------
This can also be unified to use the new method, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78138





More information about the llvm-commits mailing list