No support for lto build modes? after 1.67.1
redbaron opened this issue · 17 comments
When I enable lto = "thin"
in the release profile cargo asm
stops showing assembly output for my binary:
warning: ignoring emit path because multiple .s files were produced
Error: Cannot locate the path to the asm file
Is it the most recent version? What platform? Do you have your project available somewhere or can you make a minimal example? Works for me...
I am on latest 1.67.1 stable on ARM64. I'll try to prepare minimal reproducer
Is it the most recent version of cargo-show-asm?
yes, latest released 0.2.14
This is happening to me in linux (well, WSL). Latest rust, latest cargo-show-asm. Minimal reproducible example:
- Make a new empty project with
cargo new
- Add to Cargo.toml:
[profile.release]
lto = "thin"
- Try to do anything with
cargo asm
Edit: I should specify, I got the same error as @redbaron
@reisnera this works for me fine on linux. Can you nuke target
(cargo clean
), run it with cargo asm -vvv
and attach the full output here? Also a list of all the files in target
would be great.
Sure, see attached flies
output.txt
filelist.txt
- Is it working fine for other rust projects?
- Do you have incremental compilation enabled by any chance?
- Can you try clearing
CARGO_INCREMENTAL
env variable if you have one?
This seems to be related rust-lang/cargo#7765
Hey @pacak thanks for the reply. If I don't try to use lto in this new/empty project it works just fine. I tried disabling incremental compilation by setting CARGO_INCREMENTAL=0 and it still doesn't work (I do not have this set to anything normally, which I assume means incremental compilation is enabled by default).
Managed to reproduce it locally by upgrading rustc to 1.67.1, was working fine with 1.66.0. Will poke around.
rust-lang/rust#103610 - caused by this it seems
A workaround is to pass -C lto=no
or -C lto=fat
, need to figure out how to detect if it failed due to lto and try again without it automagically...
need to figure out how to detect if it failed due to lto and try again without it automagically...
Actually cargo-show-asm
only looks at what rustc
generates so lto settings should not affect the results. Always using -Clto=no
works. Released 0.2.15.
Awesome thanks! Great tool btw!
Question for my learning: wouldn't lto affect the generated asm as it would affect inlining and subsequent optimizations?
It might affect the final result in some cases - cross crate inlining perhaps, it should still produce the same results for a single create code because of -Ccodegen-units=1
. Situation can probably be improved but for now I'm just fixing a regression.