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

show linker output even if the linker succeeds #119286

Closed
wants to merge 5 commits into from

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Dec 24, 2023

  • show stderr by default
  • show stdout if --verbose is passed
  • remove both from RUSTC_LOG
  • hide the linker cli args unless --verbose is passed

fixes #83436. fixes #38206. fixes #109979. helps with #46998. cc https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408986134

this is based on #119129 for convenience so i didn't have to duplicate the changes around saving --verbose in cb6d033#diff-7a49efa20548d6806dbe1c66dd4dc445fda18fcbbf1709520cadecc4841aae12

r? @bjorn3

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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 Dec 24, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 24, 2023

rustc_macros::diagnostics was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

@jyn514 jyn514 force-pushed the linker-output branch 2 times, most recently from 060a457 to a34d7ae Compare December 24, 2023 23:47
@jyn514
Copy link
Member Author

jyn514 commented Dec 24, 2023

hmm actually this is a slight expansion of scope but @bjorn3 how would you feel about not printing the giant list of linker arguments unless someone passes --verbose (#109979)

@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member Author

jyn514 commented Dec 25, 2023

also i know we settled on not showing stdout by default but it's useful for debugging search paths - maybe we should show it after all? it seems silly to have to pass both -Wl,--verbose and --verbose. #46998 (comment)

@rust-log-analyzer

This comment has been minimized.

@@ -714,7 +714,7 @@ fn test_unstable_options_tracking_hash() {
untracked!(unpretty, Some("expanded".to_string()));
untracked!(unstable_options, true);
untracked!(validate_mir, true);
untracked!(verbose, true);
untracked!(verbose_internals, true);
Copy link
Member

Choose a reason for hiding this comment

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

Don't diagnostics influenced by this flag end up in the incr cache? It should actually be tracked I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, do we cache diagnostic output? even on errors? that seems very strange to me.

i don't mind changing it to tracked, i'm just confused why it's necessary.

Copy link
Member

Choose a reason for hiding this comment

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

On errors we don't finalize the incr comp cache, but non-fatal diagnostics are cached afaik. Otherwise we would have to replay the query in question, which we may not be able to do if the query key is not reconstructible from the dep node fingerprint.

@bors
Copy link
Contributor

bors commented Jan 6, 2024

☔ The latest upstream changes (presumably #119662) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member Author

jyn514 commented Jan 20, 2024

hmm. that test has the following comment:

// Between revisions 1 and 2, we are changing the debuginfo-level, which should
// invalidate the cache. Between revisions 2 and 3, we are adding `--verbose`
// which should have no effect on the cache. Between revisions, we are adding
// `--remap-path-prefix` which should invalidate the cache:
//[rpass1] compile-flags: -C debuginfo=0
//[rpass2] compile-flags: -C debuginfo=2
//[rpass3] compile-flags: -C debuginfo=2 --verbose
//[rpass4] compile-flags: -C debuginfo=2 --verbose --remap-path-prefix=/home/bors/rust=src

i suppose those lines are all invalid now, it should be testing that the CGU is not reused? i'm not sure why it's testing --verbose specifically, maybe it's enough to test any untracked CLI arg. i'll change it to --diagnostic-width.

i'm realizing your comments are all about #119129. i feel slightly uncomfortable making unrelated changes in this PR ... how do you feel about splitting them into a separate PR so i can assign michaelwoerister?

@bjorn3
Copy link
Member

bjorn3 commented Jan 20, 2024

how do you feel about splitting them into a separate PR so i can assign michaelwoerister?

Sure

@bjorn3
Copy link
Member

bjorn3 commented Jan 20, 2024

hide the linker cli args unless --verbose is passed

I prefer not doing this. It is helpful whenever a linkage issue is opened to not have to ask to rerun with RUSTFLAGS="--verbose". If you revert this change r=me. If you still want to keep it, let me thing about it for a bit.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 28, 2024
@jyn514 jyn514 reopened this Jan 28, 2024
@bors
Copy link
Contributor

bors commented Jan 29, 2024

☔ The latest upstream changes (presumably #119972) made this pull request unmergeable. Please resolve the merge conflicts.

jyn514 and others added 5 commits January 29, 2024 21:47
the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them.
this avoids warnings from macOS ld
@bjorn3
Copy link
Member

bjorn3 commented Jan 30, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jan 30, 2024

📌 Commit fde9966 has been approved by bjorn3

It is now in the queue for this repository.

@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 Jan 30, 2024
@bjorn3
Copy link
Member

bjorn3 commented Jan 30, 2024

@bors rollup=iffy

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 30, 2024
show linker output even if the linker succeeds

- show stderr by default
- show stdout if `--verbose` is passed
- remove both from RUSTC_LOG
- hide the linker cli args unless `--verbose` is passed

fixes rust-lang#83436. fixes rust-lang#38206. fixes rust-lang#109979. helps with rust-lang#46998. cc https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408986134

this is based on rust-lang#119129 for convenience so i didn't have to duplicate the changes around saving `--verbose` in rust-lang@cb6d033#diff-7a49efa20548d6806dbe1c66dd4dc445fda18fcbbf1709520cadecc4841aae12

r? `@bjorn3`
@bors
Copy link
Contributor

bors commented Jan 30, 2024

⌛ Testing commit fde9966 with merge 6f77ebe...

@bors
Copy link
Contributor

bors commented Jan 30, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 30, 2024
@jyn514
Copy link
Member Author

jyn514 commented Feb 1, 2024

lol what on earth
AFAICT there are two types of warnings:
1.

warning: linker stderr: Warning: .drectve `-exclude-symbols:_ZN17compiler_builtins3mem6memcpy17h33c7778f71cce9faE ' unrecognized
           Warning: .drectve `-exclude-symbols:_ZN17compiler_builtins3mem7memmove17ha30886041cd704b7E ' unrecognized
2024-01-30T23:15:45.4590600Z ---- [ui] tests\ui\array-slice-vec\nested-vec-1.rs stdout ----
2024-01-30T23:15:45.4591032Z normalized stderr:
2024-01-30T23:15:45.4591439Z warning: linker stderr: Warning: corrupt .drectve at end of def file

the first one looks like #112368, probably? that's related to an old linker version, i'm not sure what version we're using in CI.
the second one is what's actually causing tests to fail and i don't have ideas for fixing it. maybe @mati865 knows.

anyway i'm probably not going to put much more time into this pr

@mati865
Copy link
Contributor

mati865 commented Feb 1, 2024

the first one looks like #112368, probably? that's related to an old linker version, i'm not sure what version we're using in CI.

Because getting a newer one is not a trivial task ;)
#119229

the second one is what's actually causing tests to fail and i don't have ideas for fixing it

Oh, that's strange. In the past, Rust used .def files only to let the linker know which symbols to export. Maybe something has changed (likely accidentally), but we'd need to dump that file and see its contents.

@nikic
Copy link
Contributor

nikic commented Feb 13, 2024

@bors r-

Probably someone clicked the synchronize button.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2024
@jyn514
Copy link
Member Author

jyn514 commented Feb 17, 2024

i am not planning to work on this more, someone else can pick it up if they care

@jyn514 jyn514 closed this Feb 17, 2024
@Nilstrieb Nilstrieb added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
9 participants