-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Support for excluding rust compiler_builtin from staticlib #431
Comments
Could you please provide more information? which are the targets? is there a rustc and cargo issue for the problem? Staticlibs are produced by rustc using its provided information. |
Hi, the target is x86_64-pc-windows-gnullvm. I noticed when building libdovi with -Zbuild-std and -Clinker-plugin-lto -Ccodegen-units=1 that there is still a non-LTO bitcode object compiler_builtins-e758a9b796fd24a6.compiler_builtins.45bebbe1a3522e0e-cgu.0.rcgu.o inside libdovi.a that defines some of the same symbols as libclang-rt.builtins.a. Some old issues mentioned that this would cause symbol conflicts, but I did not encounter such a phenomenon. After searching, I found that for my platform, rustc has defined all compiler_builtins symbols as weak symbols to avoid conflicts, but if I use llvm-ar to remove compiler_builtins from libdovi.a, I can still link it and the final exe/dll becomes smaller. |
you can tell the final linker invocation to gc what's redundant, but this is an issue for rustc to solve. |
Some targets use llvm's compiler-rt by default, in which case cargo-c should exclude rust's compiler-rt from staticlib in order to use what the C toolchain provides. Otherwise it will increase the size or cause symbol conflicts.
Here's one way to hack it, but it's ugly.
The text was updated successfully, but these errors were encountered: