summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Object/RecordStreamer.h9
-rw-r--r--llvm/test/MC/COFF/module-asm-coff.ll21
2 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/Object/RecordStreamer.h b/llvm/lib/Object/RecordStreamer.h
index ac501725ecd..5ac9cd6a4f5 100644
--- a/llvm/lib/Object/RecordStreamer.h
+++ b/llvm/lib/Object/RecordStreamer.h
@@ -55,6 +55,15 @@ public:
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;
diff --git a/llvm/test/MC/COFF/module-asm-coff.ll b/llvm/test/MC/COFF/module-asm-coff.ll
new file mode 100644
index 00000000000..38e108031d3
--- /dev/null
+++ b/llvm/test/MC/COFF/module-asm-coff.ll
@@ -0,0 +1,21 @@
+; Tests COFF-specific directives in module level assembly.
+
+; RUN: llc -filetype=obj %s -o %t.obj
+; RUN: llvm-readobj -t %t.obj | FileCheck %s
+; RUN: opt -thinlto-bc %s -o %t.thinlto.bc
+; RUN: llvm-lto2 run %t.thinlto.bc -o %t.thinlto.obj -r=%t.thinlto.bc,foo,plx
+; RUN: llvm-readobj -t %t.thinlto.obj.1 | FileCheck %s
+
+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 3; .type 32; .endef"
+module asm ".global foo"
+module asm "foo:"
+module asm " ret"
+
+; CHECK: Symbol {
+; CHECK: Name: foo
+; CHECK: StorageClass:
+; CHECK-SAME: Static (0x3)
OpenPOWER on IntegriCloud