[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 13:13:44 PDT 2020


rnk added inline comments.


================
Comment at: llvm/lib/MC/MCAssembler.cpp:689
           if (DF.getContents()[i]) {
             if (auto *ELFSec = dyn_cast<const MCSectionELF>(Sec))
+              getContext().reportError(
----------------
MaskRay wrote:
> rnk wrote:
> > This can also be unified to use the new method, right?
> This would be really difficult... so difficult that I have to mention it in the description
> 
> ```
> It'd be nice to report the location but so many directives can call emitIntValue()
> and it is difficult to track every location.
> ```
I didn't mean to ask about the source location, I was wondering if we could avoid the special ELF dyn_cast. The message could be:
  "non-zero initializer found in " + Sec->getVirtualSectionKind() + " section " + Sec->getSectionName()


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