-
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
Fix reachable_set
for non-function items in non-library crates
#88032
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(rust-highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Aug 14, 2021
ghost
mentioned this pull request
Aug 14, 2021
r? @petrochenkov @bors r+ |
📌 Commit 29b73ee has been approved by |
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
Aug 15, 2021
camsteffen
added a commit
to camsteffen/rust
that referenced
this pull request
Aug 15, 2021
…enkov Fix `reachable_set` for non-function items in non-library crates I unintentionally changed `reachable_set` to ignore non-function items when `!self.any_library` in rust-lang#86492, which can lead to "undefined reference" errors in non-library (`cdylib`/`staticlib`/`bin`) crates, for example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=6bb2c5065a9be7e40943d0541e161b5a This PR restores the behavior of `reachable_set` for non-function items. Fixes rust-lang#88016. <details> <summary>The modified test will fail with this output without the `reachable_set` change</summary> ``` ---- [codegen] codegen/external-no-mangle-statics.rs#staticlib stdout ---- error in revision `staticlib`: verification with 'FileCheck' failed status: exit status: 1 command: "/checkout/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll" "/checkout/src/test/codegen/external-no-mangle-statics.rs" "--check-prefixes" "CHECK,NONMSVC,staticlib" stdout: ------------------------------------------ ------------------------------------------ stderr: ------------------------------------------ /checkout/src/test/codegen/external-no-mangle-statics.rs:10:11: error: CHECK: expected string not found in input // CHECK: `@A` = local_unnamed_addr constant ^ /checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll:1:1: note: scanning from here ; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0' ^ /checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll:1:6: note: possible intended match here ; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0' ^ Input file: /checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll Check file: /checkout/src/test/codegen/external-no-mangle-statics.rs -dump-input=help explains the following input dump. Input was: <<<<<< 1: ; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0' check:10'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found check:10'1 ? possible intended match 2: source_filename = "external_no_mangle_statics.b50529d3-cgu.0" check:10'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" check:10'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4: target triple = "x86_64-unknown-linux-gnu" check:10'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5: check:10'0 ~ 6: !llvm.module.flags = !{!0, !1} check:10'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ . . . >>>>>> ------------------------------------------ failures: [codegen] codegen/external-no-mangle-statics.rs#staticlib ``` </details>
Needed to fix Miri. |
☀️ Test successful - checks-actions |
rust-highfive
added a commit
to rust-lang-nursery/rust-toolstate
that referenced
this pull request
Aug 16, 2021
Tested on commit rust-lang/rust@73d96b0. Direct link to PR: <rust-lang/rust#88032> 🎉 miri on windows: test-fail → test-pass (cc @RalfJung @eddyb @oli-obk). 🎉 miri on linux: test-fail → test-pass (cc @RalfJung @eddyb @oli-obk).
ghost
deleted the
no-mangle-method
branch
September 6, 2021 15:33
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
merged-by-bors
This PR was explicitly merged by bors.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I unintentionally changed
reachable_set
to ignore non-function items when!self.any_library
in #86492, which can lead to "undefined reference" errors to symbols in non-library (cdylib
/staticlib
/bin
) crates, for example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=6bb2c5065a9be7e40943d0541e161b5aThis PR restores the behavior of
reachable_set
for non-function items.Fixes #88016.
The modified test will fail with this output without the
reachable_set
change