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

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 18:46:49 PDT 2020


skan accepted this revision.
skan added a comment.

LGTM



================
Comment at: llvm/lib/MC/MCAssembler.cpp:689
           if (DF.getContents()[i]) {
             if (auto *ELFSec = dyn_cast<const MCSectionELF>(Sec))
+              getContext().reportError(
----------------
rnk wrote:
> 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()
I am aslo wondering if we can avoid the special ELF dyn_cast?


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