Just got some hints from blogs saying that using
-Wl,--gc-sections can even further reduce binary target file size.
Is that true? And how to use these link options?
rustflags settings, but got
unknown link options...
I think those are GCC specific options?
I'm not sure these are GCC specific, you mean LLVM backend doesn't support these options?
I don't know whether LLVM supports them.
Rustc already tells LLVM to use what amounts to
-ffunction-sections -fdata-sections and passes
-Wl,--gc-sections to the linker. You don't need to pass them yourself.
You may want to follow some of the suggestions in https://github.com/johnthagen/min-sized-rust to reduce the binary size.
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.