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

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 19:35:50 PDT 2020


skan added inline comments.


================
Comment at: llvm/lib/MC/MCELFStreamer.cpp:514-519
+  MCSection &Sec = *getCurrentSectionOnly();
+  if (Sec.isVirtualSection()) {
+    getContext().reportError(Inst.getLoc(),
+                             "SHT_NOBITS section cannot have instructions");
+    return;
+  }
----------------
Do you think `MCObjectStreamer::emitInstruction` is a better place to check `Sec.isVirtualSection()`?


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