Index: llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp =================================================================== --- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -248,9 +248,9 @@ return; // Emit a .note.gnu.property section with the flags. - if (auto *TS = static_cast( - OutStreamer->getTargetStreamer())) - TS->emitNoteSection(Flags); + auto *TS = + static_cast(OutStreamer->getTargetStreamer()); + TS->emitNoteSection(Flags); } void AArch64AsmPrinter::emitFunctionHeaderComment() { Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp =================================================================== --- llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp +++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp @@ -495,6 +495,10 @@ // Register the asm streamer. TargetRegistry::RegisterAsmTargetStreamer(*T, createAArch64AsmTargetStreamer); + // Register the null streamer. + TargetRegistry::RegisterNullTargetStreamer(*T, + createAArch64NullTargetStreamer); + // Register the MCInstPrinter. TargetRegistry::RegisterMCInstPrinter(*T, createAArch64MCInstPrinter); } Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h =================================================================== --- llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h +++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h @@ -154,6 +154,8 @@ MCTargetStreamer * createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI); +MCTargetStreamer *createAArch64NullTargetStreamer(MCStreamer &S); + } // end namespace llvm #endif Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp =================================================================== --- llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp +++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp @@ -119,3 +119,7 @@ return new AArch64TargetWinCOFFStreamer(S); return nullptr; } + +MCTargetStreamer *llvm::createAArch64NullTargetStreamer(MCStreamer &S) { + return new AArch64TargetStreamer(S); +} Index: llvm/test/CodeGen/AArch64/null-mctargetstreamer.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/AArch64/null-mctargetstreamer.ll @@ -0,0 +1,6 @@ +; RUN: llc -mtriple=aarch64-unknown-unknown -filetype=null < %s + +define dso_local aarch64_vector_pcs void @foo() { + ret void +} +