Skip to content
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

Use Default visibility for rustc-generated C symbol declarations #131519

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

davidlattimore
Copy link
Contributor

Non-default visibilities should only be used for definitions, not declarations, otherwise linking can fail.

This is based on #123994.

Issue #123427

When I changed default-hidden-visibility to default-visibility in #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.

@rustbot
Copy link
Collaborator

rustbot commented Oct 10, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 10, 2024
Non-default visibilities should only be used for definitions, not
declarations, otherwise linking can fail.

Co-authored-by: Collin Baker <collinbaker@chromium.org>
@Nadrieril
Copy link
Member

r? compiler

@rustbot rustbot assigned estebank and unassigned Nadrieril Oct 11, 2024
Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

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

I'm no expert but this makes sense to me.

It's also what clang is doing, godbolt.

@Urgau
Copy link
Member

Urgau commented Oct 11, 2024

r? @Urgau
@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2024

📌 Commit 42c0494 has been approved by Urgau

It is now in the queue for this repository.

@rustbot rustbot assigned Urgau and unassigned estebank Oct 11, 2024
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 11, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#129079 (Create `_imp__` symbols also when doing ThinLTO)
 - rust-lang#131208 (ABI: Pass aggregates by value on AIX)
 - rust-lang#131394 (fix(rustdoc): add space between struct fields and their descriptions)
 - rust-lang#131519 (Use Default visibility for rustc-generated C symbol declarations)
 - rust-lang#131541 (compiletest: Extract auxiliary-crate properties to their own module/struct)
 - rust-lang#131542 (next-solver: remove outdated FIXMEs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 33b1264 into rust-lang:master Oct 11, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 11, 2024
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.
github-actions bot pushed a commit to kaidokert/chrome_base_mirror that referenced this pull request Oct 30, 2024
This depended on rust-lang/rust#131519
rolling into the Rust compiler to fix builtins/intrinisics,
which was merged in 33b1264540b.

Remove ASAN ODR exceptions for Rust globals as they are no longer
walked twice incorrectly when they are hidden.

Disable the rust logging test in component builds for all platforms
not just for Windows, now that symbol visibility is the same for
all platforms. See https://crbug.com/374023535#comment13

Bug: 41484256, 40274892, 374023535
Fixed: 40278279
Cq-Include-Trybots: luci.chromium.try:linux-official,mac-official,win-official,win32-official
Cq-Include-Trybots: luci.chromium.try:linux-asan-rel,mac-asan-rel,win-asan-rel
Cq-Include-Trybots: luci.chromium.try:linux_chromium_dbg_ng
Change-Id: I976ef679961e9db5a91bcc74f559ebbcc0bf058b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5966273
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Arthur Eubanks <aeubanks@google.com>
Cr-Commit-Position: refs/heads/main@{#1375460}
NOKEYCHECK=True
GitOrigin-RevId: ee3900fd57b3c580aefff15c64052904d81b7760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants