-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unused symbols being exported #112533
Comments
Are the exported symbols you don't want all from Lines 74 to 84 in 77dba22
So it would make sense to me if the whole of I tried building this as a |
Most of the symbols I'm getting look something like this:
or like this:
so, I'm guessing most of them are coming from I tried setting Here's the smallest
(anything simpler than this, and the final binary drops drastically in size) As for linking the library to the rest of the program, there isn't much to it. I have a simple file written in assembly:
which is compiled into an elf file with nasm:
and then gets linked with the library as such:
|
Oh, formatting stuff! Enable the standard library feature |
Can you try using |
Ok, both seem to work! I added the When I link the assembly program and the staticlib with Hopefully, I won't have any more link issues, but I'll let you know if anything comes up. Thanks for the help! |
Hi there,
I am writing a small library (
staticlib
) for an OS project. This library only needs to export one function and is linked with a program written in assembly that ends up calling that function. Unfortunately, rustc is exporting way too many functions and the final binary ends up being way larger than it needs to be.I know this is an issue that others have had before, such as #18541 and #37530, but none of the solutions I've found so far have workws for me. I've also tried using version scripts and I've tried stripping the library, but those either didn't work or broke something in the process.
Here is a small reproducible setup:
File
.cargo/config.toml
:File
src/lib.rs
:File
Cargo.toml
:I am also using the nightly version of rust.
Is there a way to get the rust compiler to export only the functions I need?
The text was updated successfully, but these errors were encountered: