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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 08:44:31 PDT 2020


rnk added a comment.

Sounds good. Do you mind implementing this for COFF? I don't think "virtual section" is standard terminology. It seems like something someone invented here in MC. The COFF impl of isVirtualSection is straightforward:

  bool MCSectionCOFF::isVirtualSection() const {
    return getCharacteristics() & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
  }

This suggests we can return "IMAGE_SCN_CNT_UNINITIALIZED_DATA" instead of "virtual".

The .section flag for this seems to be `b` for the test.



================
Comment at: llvm/include/llvm/MC/MCSection.h:189
 
+  virtual StringRef getVirtualSectionKind() const { return "virtual"; }
+
----------------
This appears to be the first non-pure virtual method, i.e. the key method. Please define it out of line to avoid duplicate debug info & vtables.


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