[PATCH] D57192: simplify COFF module assembly test and move it to Object

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 24 16:03:28 PST 2019


inglorion updated this revision to Diff 183428.
inglorion added a comment.
Herald added a subscriber: hiraditya.

Simpler test. This crashes without D57073 <https://reviews.llvm.org/D57073> and passes with D57073 <https://reviews.llvm.org/D57073>.


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

https://reviews.llvm.org/D57192

Files:
  llvm/lib/Object/RecordStreamer.h
  llvm/test/Object/X86/coff-asm.ll


Index: llvm/test/Object/X86/coff-asm.ll
===================================================================
--- /dev/null
+++ llvm/test/Object/X86/coff-asm.ll
@@ -0,0 +1,13 @@
+; Check that llvm-nm doesn't crash on COFF-specific assembly directives
+; (PR36789).
+
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-nm %t.bc
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.0.24210"
+
+module asm ".text"
+module asm ".def foo; .scl 2; .type 32; .endef"
+module asm "foo:"
+module asm "  ret"
Index: llvm/lib/Object/RecordStreamer.h
===================================================================
--- llvm/lib/Object/RecordStreamer.h
+++ llvm/lib/Object/RecordStreamer.h
@@ -55,6 +55,15 @@
                     unsigned ByteAlignment, SMLoc Loc = SMLoc()) override;
   void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
                         unsigned ByteAlignment) override;
+
+  // Ignore COFF-specific directives; we do not need any information from them,
+  // but the default implementation of these methods crashes, so we override
+  // them with versions that do nothing.
+  void BeginCOFFSymbolDef(const MCSymbol *Symbol) override {}
+  void EmitCOFFSymbolStorageClass(int StorageClass) override {}
+  void EmitCOFFSymbolType(int Type) override {}
+  void EndCOFFSymbolDef() override {}
+
   /// Record .symver aliases for later processing.
   void emitELFSymverDirective(StringRef AliasName,
                               const MCSymbol *Aliasee) override;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57192.183428.patch
Type: text/x-patch
Size: 1525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190125/de091630/attachment.bin>


More information about the llvm-commits mailing list