[lld] [lld][COFF][LTO] Implement /lldemit:asm option (PR #67079)
Matheus Izvekov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 03:35:54 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);
----------------
mizvekov wrote:
This is just for the emitASM / saveTemps case, so we don't end up appending `.asm` to whatever is the full output name.
Ie when generating temporaries, we would previously generate complicated and confusing file names here, for example:
`lld-link a.obj b.obj /output app.exe`
Would generate:
`app.exe.lto.a.obj`
`app.exe.lto.b.obj`
But if your inputs had a different, possibly even more accurate extension, you could end up with this example:
`lld-link a.bc b.bc /output app.exe`
Would generate:
`app.exe.lto.a.bc`
`app.exe.lto.b.bc`
Even though these saved temps are object files, not bitcode files.
If I hadn't used stem, we would get names like this:
`lld-link /lldemit:asm a.obj b.obj /output app.exe`
Would generate:
`app.exe.lto.a.obj.asm`
`app.exe.lto.b.obj.asm`
With `stem`, we get this instead:
`app.exe.lto.a.asm`
`app.exe.lto.bj.asm`
https://github.com/llvm/llvm-project/pull/67079
More information about the llvm-commits
mailing list