How to find source of link arguments in final binary?

Given that dependencies can have #[link_name="foo"] in their code, or build scripts can add cargo:rustc-link-lib=foo, or crates that use cc-rs can use call APIs that emit those, it can be frustrating to find out where a particular linker argument is coming from in the final step of building a Rust application. Are there any tools to make this process easier? I'm dreaming of something like Ted's cargo build-plan-graph that also include what each dependency contributed to the final linker output.

1 Like