diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 2297b27ffdc0..35578040d951 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -461,13 +461,15 @@ bool AsmPrinter::doInitialization(Module &M) { // alternative is duplicated code in each of the target asm printers that // use the directive, where it would need the same conditionalization // anyway. - const Triple &Target = TM.getTargetTriple(); - if (Target.isOSBinFormatMachO() && Target.isOSDarwin()) { - Triple TVT(M.getDarwinTargetVariantTriple()); - OutStreamer->emitVersionForTarget( + if (MAI->useIntegratedAssembler()) { + const Triple &Target = TM.getTargetTriple(); + if (Target.isOSBinFormatMachO() && Target.isOSDarwin()) { + Triple TVT(M.getDarwinTargetVariantTriple()); + OutStreamer->emitVersionForTarget( Target, M.getSDKVersion(), M.getDarwinTargetVariantTriple().empty() ? nullptr : &TVT, M.getDarwinTargetVariantSDKVersion()); + } } // Allow the target to emit any magic that it wants at the start of the file.