Index: lib/MC/MCParser/AsmParser.cpp =================================================================== --- lib/MC/MCParser/AsmParser.cpp +++ lib/MC/MCParser/AsmParser.cpp @@ -836,6 +836,8 @@ AsmCond StartingCondState = TheCondState; SmallVector AsmStrRewrites; + StringRef Filename = getContext().getMainFileName(); + // If we are generating dwarf for assembly source files save the initial text // section and generate a .file directive. if (getContext().getGenDwarfForAssembly()) { @@ -849,9 +851,12 @@ assert(InsertResult && ".text section should not have debug info yet"); (void)InsertResult; getContext().setGenDwarfFileNumber(getStreamer().EmitDwarfFileDirective( - 0, StringRef(), getContext().getMainFileName())); + 0, StringRef(), Filename)); } + if (!Filename.empty() && (Filename.compare(StringRef("-")) != 0)) + Out.EmitFileDirective(Filename); + // While we have input, parse each statement. while (Lexer.isNot(AsmToken::Eof)) { ParseStatementInfo Info(&AsmStrRewrites);