[lld] [lld][COFF][LTO] Implement /lldemit:asm option (PR #67079)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 01:43:32 PDT 2023


================
@@ -235,20 +245,21 @@ std::vector<InputFile *> BitcodeCompiler::compile() {
     if (bitcodeFilePath == "ld-temp.o") {
       ltoObjName =
           saver().save(Twine(ctx.config.outputFile) + ".lto" +
-                       (i == 0 ? Twine("") : Twine('.') + Twine(i)) + ".obj");
+                       (i == 0 ? Twine("") : Twine('.') + Twine(i)) + Ext);
     } else {
       StringRef directory = sys::path::parent_path(bitcodeFilePath);
-      StringRef baseName = sys::path::filename(bitcodeFilePath);
+      StringRef baseName = sys::path::stem(bitcodeFilePath);
       StringRef outputFileBaseName = sys::path::filename(ctx.config.outputFile);
       SmallString<64> path;
       sys::path::append(path, directory,
-                        outputFileBaseName + ".lto." + baseName);
+                        outputFileBaseName + ".lto." + baseName + Ext);
       sys::path::remove_dots(path, true);
       ltoObjName = saver().save(path.str());
     }
-    if (ctx.config.saveTemps)
+    if (ctx.config.saveTemps || emitASM)
----------------
mstorsjo wrote:

Hmm, so `/lldemit:asm` generates asm files and links the final executable, while `/lldemit:llvm` only generates IR and exits? Does the ELF linker work in the same way? If it does, I guess this is fine.

https://github.com/llvm/llvm-project/pull/67079


More information about the llvm-commits mailing list