-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
-Zexport-executable-symbols
alone does not export symbols
#101610
Comments
the test should have at least used |
seems like an additional |
An easy solution would be to just emit A more precise solution would be to use |
We do already generate a version script for dynamic libraries to restrict the set of exported symbols. We just omit it for executables. |
Thanks for the clarification. Looking at the relevant code, it looks like version script does get generated for executables if rust/compiler/rustc_codegen_ssa/src/back/linker.rs Lines 722 to 730 in a91f7d7
I’ll look into this code some more. I’m not sure version script is enough to get a symbol dynamically exported, I think |
Have you verified that the input object files export the symbols in the first place? I wouldn't be surprised if the mono collector skips them or internalizes them. |
Calling
gives me an object file with a global
similar to a C function with external linkage:
|
I tried:
building with:
rustc -Zexport-executable-symbols --crate-type bin
I expected to see this happen:
Instead, this happened:
in addition, this test case here:
rust/src/test/run-make/export-executable-symbols/Makefile
Line 10 in 98f3001
is insufficient, as
nm
prints out every symbol, not only the exported ones.Meta
Tested on:
rustc 1.65.0-nightly (c07a8b4e0 2022-08-26)
rustc 1.65.0-nightly (c2804e6ec 2022-09-07)
The text was updated successfully, but these errors were encountered: