diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -176,8 +176,10 @@ }; } - if (config->ltoEmitAsm) + if (config->ltoEmitAsm) { c.CGFileType = CGFT_AssemblyFile; + c.Options.MCOptions.AsmVerbose = true; + } if (!config->saveTempsArgs.empty()) checkError(c.addSaveTemps(config->outputFile.str() + ".", diff --git a/lld/test/ELF/lto/emit-asm.ll b/lld/test/ELF/lto/emit-asm.ll --- a/lld/test/ELF/lto/emit-asm.ll +++ b/lld/test/ELF/lto/emit-asm.ll @@ -11,14 +11,18 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" +;; Note: we also check for the presence of comments; lto-emit-asm output should be verbose. + +; CHECK-DAG: # -- Begin function f1 ; CHECK-DAG: f1: -; OPT-DAG: define void @f1() +; OPT: define void @f1() define void @f1() { ret void } +; CHECK-DAG: # -- Begin function f2 ; CHECK-DAG: f2: -; OPT-DAG: define void @f2() +; OPT: define void @f2() define void @f2() { ret void }