Extra symbols from unused upstream lib

This doesn't fit in the playground, as far as I can tell, so I made a github repo for it:

Basically, I have found that a cdynlib depending on an upstream repo that contains functions with "C" linkage (and #[no_mangle]) causes those symbols to be exported to the cdynlib, even if they are not used.

This seems to happen even with LTO enabled. I can't figure out what it is happening or how to stop it from including unused symbols.

This is not "incorrect" behavior per se, but it could cause trouble down the road if these symbols conflicted because they appeared in two different libs used by a downstream project. Being able to control what is exported is important.

This is not currently possible. See also Allow users to override or filter list of exported symbols passed to the WASM linker · Issue #104130 · rust-lang/rust · GitHub

Is it worth adding onto that issue to identify that this is also an issue for C libs, not just wasm?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.