Openssl crate and linked code

When using vendored openssl crate, is the whole openssl library linked in the executable or only the relevant functionality ?

How could I have found out myself ?

(Coming from interpreted Python, my mental model of compile and link is very rough.)

Experimenting with using various parts of the openssl crate, I can see that the size of the linked executable changes. I am thus guessing that the vendored crate does dead code elimination.

I have tried to read https://github.com/alexcrichton/openssl-src-rs/blob/master/src/lib.rs but did not convince myself that it asks for dead code elimination.

Any hint would be appreciated.

openssl-src-rs doesn’t need to ask for dead code elimination. The linker just does it.

Compile with debug symbols (in release) and see if any function you expect to be missing is still there objdump -W

Hint, also be sure to run ldd to know what is dynamic.
Compile with RUSTFLAGS="-C linker-plugin-lto" for added optimization.

Thanks

Thanks for the suggestion. AFAICS, objdump is a Linux tool. otool seems to be the MacOS corresponding tool. I went through its man page. I guess I lack some concepts: I did not find how to get to debug symbols.