I use cargo to build a dylib type library, but the size is larger than I expected. We find that there is a .rustc section in the dylib, and it takes much space, almost 65 percent of the dylib.(The no.29 section in the picture). But when I use strip to remove this section, the dylib still works correctly. I want to remove this section to reduce the size of dylib. So, what's the usage of .rustc section? Can it be removed by strip?
You probably want to build a cdylib, not a dylib. The
.rustc section contains the metatdata used to link other Rust code to the library (think of it like the header files for a C library).
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.