-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Replace -Z default-hidden-visibility with -Z default-visibility #130005
Conversation
These commits modify compiler targets. Some changes occurred in compiler/rustc_codegen_gcc |
I contemplated if rather than two separate flags, we should merge This PR is partially based on a previous attempt by @bjorn3. The main thing it adds is making it a flag rather than always using protected visibility. It would have been nice if we could have skipped the flag and just always used protected, but unfortunately that's not an option while we still support GNU ld < 2.40, which presumably will be for quite a few years. I wrote up my findings in this area in a blog post: https://davidlattimore.github.io/posts/2024/08/27/rust-dylib-rabbit-holes.html My hope is that we can (in a separate PR) enable this new flag when LLD is being used as the linker. |
IMO we should do this. Having two non-independent flags instead of one risk having discrepancy in the handling, a enum on the other end would force handling at every usage. (For example your current PR doesn't error-out when setting both flags at the same time, while with one flag it wouldn't an issue). Having one option the being (btw, very exited to see experimentation is this area) In anyway, given that this PR adds a new (unstable) flag it should first go through our MCP / Major Change Proposols. It's our is a lightweight form of RFC (it's very lightweight compared to RFC!). See the mini-guide on how to create one. @rustbot labels -S-waiting-on-review +S-waiting-on-MCP |
This might be a bit unexpected, so I'm posting it for your information. |
5060ce8
to
be96620
Compare
MCP 782 has been accepted. I've updated this PR to replace |
@rustbot labels +S-waiting-on-review -S-waiting-on-MCP |
be96620
to
5c68774
Compare
This comment has been minimized.
This comment has been minimized.
5c68774
to
1be7960
Compare
MCP: rust-lang/compiler-team#782 Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
1be7960
to
f48194e
Compare
|
||
This option only affects building of shared objects and should have no effect on executables. | ||
|
||
Visibility an be set to one of three options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visibility an be set to one of three options: | |
Visibility can be set to one of three options: |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#130005 (Replace -Z default-hidden-visibility with -Z default-visibility) - rust-lang#130229 (ptr::add/sub: do not claim equivalence with `offset(c as isize)`) - rust-lang#130773 (Update Unicode escapes in `/library/core/src/char/methods.rs`) - rust-lang#130933 (rustdoc: lists items that contain multiple paragraphs are more clear) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130005 - davidlattimore:protected-vis-flag, r=Urgau Replace -Z default-hidden-visibility with -Z default-visibility Issue rust-lang#105518
…vis, r=Urgau Use Default visibility for rustc-generated C symbol declarations Non-default visibilities should only be used for definitions, not declarations, otherwise linking can fail. This is based on rust-lang#123994. Issue rust-lang#123427 When I changed `default-hidden-visibility` to `default-visibility` in rust-lang#130005, I updated all places in the code that used `default-hidden-visibility`, replicating the hidden-visibility bug to also happen for protected visibility. Without this change, trying to build rustc with `-Z default-visibility=protected` fails with a link error.
Rollup merge of rust-lang#131519 - davidlattimore:intrinsics-default-vis, r=Urgau Use Default visibility for rustc-generated C symbol declarations Non-default visibilities should only be used for definitions, not declarations, otherwise linking can fail. This is based on rust-lang#123994. Issue rust-lang#123427 When I changed `default-hidden-visibility` to `default-visibility` in rust-lang#130005, I updated all places in the code that used `default-hidden-visibility`, replicating the hidden-visibility bug to also happen for protected visibility. Without this change, trying to build rustc with `-Z default-visibility=protected` fails with a link error.
Issue #105518