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

Merged
merged 9 commits into from
Jan 25, 2025

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Dec 24, 2023

@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 jyn514 force-pushed the linker-output branch 2 times, most recently from 64cb47a to ab6fb2b Compare December 25, 2023 00:55
@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.

@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.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 25, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
show linker output even if the linker succeeds

Show stderr and stderr by default, controlled by a new `linker_messages` lint.

fixes rust-lang#83436. fixes rust-lang#38206. 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

<!-- try-job: dist-x86_64-msvc -->
try-job: aarch64-apple

r? `@bjorn3`
@bors
Copy link
Contributor

bors commented Jan 25, 2025

⌛ Testing commit 8b92619 with merge 2524b21...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-mingw-1 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_std_workspace_core test:false 0.175
error: could not compile `rustc-std-workspace-core` (lib)

Caused by:
  process didn't exit successfully: `D:\a\rust\rust\build\bootstrap\debug\rustc 'D:\a\rust\rust\build\bootstrap\debug\rustc' --crate-name rustc_std_workspace_core --edition=2021 'library\rustc-std-workspace-core\lib.rs' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debug-assertions=on --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=9582fd8c2723cb5a -C extra-filename=-6ff60ea8d941e302 --out-dir 'D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage1-std\x86_64-pc-windows-gnu\release\deps' --target x86_64-pc-windows-gnu -L 'dependency=D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage1-std\x86_64-pc-windows-gnu\release\deps' -L 'dependency=D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage1-std\release\deps' --extern 'core=D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage1-std\x86_64-pc-windows-gnu\release\deps\libcore-d39d7221210743d5.rmeta' -Csymbol-mangling-version=legacy '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=packed -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)
[RUSTC-TIMING] libc test:false 0.183
[RUSTC-TIMING] compiler_builtins test:false 5.147
[RUSTC-TIMING] core test:false 37.219
Build completed unsuccessfully in 0:41:00
Build completed unsuccessfully in 0:41:00
make: *** [Makefile:120: ci-mingw-x] Error 1
  network time: Sat, 25 Jan 2025 15:10:06 GMT
##[error]Process completed with exit code 2.
Post job cleanup.
[command]"C:\Program Files\Git\bin\git.exe" version

@bors
Copy link
Contributor

bors commented Jan 25, 2025

💔 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 25, 2025
@jyn514
Copy link
Member Author

jyn514 commented Jan 25, 2025

probably spurious?

     Compiling rustc-std-workspace-core v1.99.0 (D:\a\rust\rust\library\rustc-std-workspace-core)
  
  thread 'main' has overflowed its stack

@bors retry

@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 25, 2025
@bors
Copy link
Contributor

bors commented Jan 25, 2025

⌛ Testing commit 8b92619 with merge f7cc13a...

@ChrisDenton
Copy link
Member

probably spurious?

     Compiling rustc-std-workspace-core v1.99.0 (D:\a\rust\rust\library\rustc-std-workspace-core)
  
  thread 'main' has overflowed its stack

A stack overflow is probably not spurious. Or if it is then it's a new one.

@bors
Copy link
Contributor

bors commented Jan 25, 2025

☀️ Test successful - checks-actions
Approved by: bjorn3
Pushing f7cc13a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 25, 2025
@bors bors merged commit f7cc13a into rust-lang:master Jan 25, 2025
7 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 25, 2025
@jyn514 jyn514 deleted the linker-output branch January 25, 2025 20:30
@madsmtm
Copy link
Contributor

madsmtm commented Jan 25, 2025

Wow, thanks for getting this in Jyn, this is a really good idea, and a massive amount of work!

@nicholasbishop
Copy link
Contributor

apparently lld unconditionally warns when compiling any program with debuginfo for UEFI

Thanks for the heads up on this. Fortunately it looks like this is only an issue with the less common target i686-unknown-uefi. x86_64-unknown-uefi and aarch64-unknown-uefi do not produce any unwanted linker output. I'll take a look at i686.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f7cc13a): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.1%, 0.4%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.7%, secondary -1.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.5% [0.5%, 2.6%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 1
All ❌✅ (primary) 0.7% [-1.0%, 2.6%] 3

Cycles

Results (primary -2.2%, secondary 2.6%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.6% [2.6%, 2.6%] 1
Improvements ✅
(primary)
-2.2% [-2.2%, -2.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.2% [-2.2%, -2.2%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 770.579s -> 771.158s (0.08%)
Artifact size: 325.79 MiB -> 325.82 MiB (0.01%)

github-merge-queue bot pushed a commit to rust-lang/cargo that referenced this pull request Jan 28, 2025
There were some changes in the latest nightly which is breaking some
tests:

* rust-lang/rust#133154 updated the wording of a
message. I adjusted the test to be less sensitive to the exact wording.
* rust-lang/rust#119286 added the
`linker-messages` lint which shows the output from the linker. Some of
our tests were passing dummy flags to the linker, which it was
complaining about. This updates it so that it uses real directories.
* This also fixes an incidental issue, where
`build_script_needed_for_host_and_target` was not testing for the
correct command-line flags. These got lost in
#14132.
ranger-ross pushed a commit to ranger-ross/cargo that referenced this pull request Feb 1, 2025
That's a gcc flag. lld is a linker, not a C compiler, and doesn't accept
a `use-ld` flag. `-C linker` (which is already present in the test) is
enough.

This fixes the following warning found in rust-lang/rust#119286:
```
---- expected: tests\testsuite\freshness.rs:2822:27
++++ actual:   stderr
   1    1 | [FRESH] foo v0.1.0 ([ROOT]/foo)
        2 + [WARNING] linker stderr: rust-lld: ignoring unknown argument '-fuse-ld=lld'␍
        3 +   |
        4 +   = [NOTE] `#[warn(linker_messages)]` on by default
        5 +
        6 + [WARNING] `foo` (lib) generated 1 warning
   2    7 | [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic CI-spurious-fail-msvc CI spurious failure: target env msvc merged-by-bors This PR was explicitly merged by bors. O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustc hides linker warnings rustc -v should print out linker output