From 38ebaf7d5d25ef3113a6ab4bf19ed4e1869373ab Mon Sep 17 00:00:00 2001 From: Bob Haarman Date: Thu, 24 Jan 2019 21:41:03 +0000 Subject: allow COFF .def directive in module assembly when using ThinLTO Summary: Using COFF's .def directive in module assembly used to crash ThinLTO with "this directive only supported on COFF targets" when getting symbol information in ModuleSymbolTable. This change allows ModuleSymbolTable to process such code and adds a test to verify that the .def directive has the desired effect on the native object file, with and without ThinLTO. Fixes https://bugs.llvm.org/show_bug.cgi?id=36789 Reviewers: rnk, pcc, vlad.tsyrklevich Subscribers: mehdi_amini, eraman, hiraditya, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D57073 llvm-svn: 352112 --- llvm/lib/Object/RecordStreamer.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Object/RecordStreamer.h') 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; -- cgit v1.2.3