I've been doing some experiments with LTO across the FFI and it seems like
linker-plugin-lto option is not needed in certain conditions (maybe all conditions).
I have a sys crate and a separate benchmark crate that uses the sys crate. I build both with the build flags:
[target.x86_64-unknown-linux-gnu] rustflags = [ "-Ctarget-cpu=native", "-Clink-arg=-fuse-ld=lld", "-Clinker=clang-11", "-Clink-arg=-flto", "-Cprefer-dynamic=no", ]
I also have the following enabled in my bench crate's
[profile.bench] opt-level = 3 codegen-units = 1 lto = true
This appears to be enough to get LTO across the FFI. I noticed LLD says it will automatically enable LTO by default
Anyone else knowledgeable in this area and have some insight into whether or not this checks out?
I'm on nightly 1.52