cargo-show-asm: Fails when LTO is enabled
./b/Cargo.toml:
[package]
name = "b"
version = "0.1.0"
edition = "2021"
[dependencies]
a = { path = "../a" }
[profile.release]
lto = "thin"
./b/src/main.rs:
fn main() {
a::foo();
}
./a/src/lib.rs:
pub fn foo() {}
./a/Cargo.toml:
[package]
name = "a"
version = "0.1.0"
edition = "2021"
[dependencies]
Enter the b directory. cargo check works. cargo asm fails with a long error that ends with:
… -Wl,-Bdynamic" “-lgcc_s” “-lutil” “-lrt” “-lpthread” “-lm” “-ldl” “-lc” “-Wl,–eh-frame-hdr” “-Wl,-z,noexecstack” “-L” “/home/a/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib” “-o” “/home/a/b/target/release/deps/b-a3de2d2ccfd03dbf” “-Wl,–gc-sections” “-pie” “-Wl,-z,relro,-z,now” “-Wl,-O1” “-nodefaultlibs” = note: /usr/bin/ld: /home/a/b/target/release/deps/liba-ea018d38ebe9b07c.rlib: error adding symbols: file format not recognized collect2: error: ld returned 1 exit status
Succeeds with lto = "off", lto = false. Fails with lto = "thin", lto = "fat". See the Cargo documentation for more information on LTO.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (9 by maintainers)
I guess the best way to deal with LTO is to implement #174 after all. I’ll look into that once I’m done messing with
bpaf.Yup, it’s https://github.com/V0ldek/rsonpath.
The exact command I’m running is
cargo asm -p rsonpath --bin rqin the project root.