Skip to content

New unresolved question section: Rust standard library #1

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

Open
wants to merge 2 commits into
base: export-visibility
Choose a base branch
from

Conversation

anforowicz
Copy link
Owner

/cc @bjorn3 - thank you for pointing out the questions related to Rust standard library in rust-lang#3834 (comment)

PS. I still need to cover the SymbolExportLevel::Rust-based alternative solution that you suggested in rust-lang#3834 (comment) (thanks!). I need to find more time to do it, sorry. I feel that I should prototype this solution to double-check that it does indeed offer an alternative fix for https://crbug.com/418073233. Hopefully I'll find time to get to it in the next 1-2 weeks... :-/

The following options have been identified so far as a potential way for
hiding symbols coming from Rust standard library:

* Do nothing.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option is to use partial linking or object file rewriting when building a staticlib to make the symbol visibility match cdylib.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for thinking about and pointing out this alternative. I've tried to cover it in the text of the RFC. Please shout if I misunderstood or misrepresented anything. (In particular, I am not sure if I have a good grasp on how/if this alternative would affect handling of rlibs.)

[equivalent `BUILD.gn` rules](https://source.chromium.org/chromium/chromium/src/+/main:build/rust/std/rules/BUILD.gn;drc=35fb76c686b55acc25b53f7e5c9b58e56dca7f4a)),
which is one reason why this RFC is a viable UB fix for
https://crbug.com/418073233.
* Alternative: change the semantics of `#[rustc_std_internal_symbol]`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change in what way?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't thought that through - let me remove this.

I've initially wondered whether #[rustc_std_internal_symbol] could imply #[export_visibility = "inherit"], but this doesn't do anything unless the standard library is rebuilt. And we can't imply #[export_visibility = "hidden"], because this would break linking standard library into cdylibs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants