Skip to content

Shorten linker output even more when --verbose is not present - #135707

Merged
bors merged 1 commit into
rust-lang:masterfrom
jyn514:linker-messages-2
Jan 26, 2025
Merged

Shorten linker output even more when --verbose is not present#135707
bors merged 1 commit into
rust-lang:masterfrom
jyn514:linker-messages-2

Conversation

@jyn514

@jyn514jyn514 commented Jan 18, 2025

Copy link
Copy Markdown
Member
  • Don't show environment variables. Seeing PATH is almost never useful, and it can be extremely long.
  • For .rlibs in the sysroot, replace crate hashes with a "-*" string. This will expand to the full crate name when pasted into the shell.
  • Move .rlib to outside the glob.
  • Abbreviate the sysroot path to <sysroot> wherever it appears in the arguments.

This also adds an example of the linker output as a run-make test. Currently it only runs on x86_64-unknown-linux-gnu, because each platform has its own linker arguments. So that it's stable across machines, pass BUILD_ROOT as an argument through compiletest through to run-make tests.

r? @bjorn3

try-job: aarch64-apple

@rustbotrustbot added A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Jan 18, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

This PR modifies tests/run-make/. If this PR is trying to port a Makefile
run-make test to use rmake.rs, please update the
run-make port tracking issue
so we can track our progress. You can either modify the tracking issue
directly, or you can comment on the tracking issue and link this PR.

cc @jieyouxu

Some changes occurred in src/tools/compiletest

cc @jieyouxu

The run-make-support library was changed

cc @jieyouxu

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@jyn514

jyn514 commented Jan 18, 2025

Copy link
Copy Markdown
MemberAuthor

For comparison, this is what the error looked like before
image

and after
image

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbotrustbot added the A-tidy Area: The tidy tool label Jan 18, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

@jyn514

Copy link
Copy Markdown
MemberAuthor

You must ensure that any new dependencies have compatible licenses before merging.

dual-licensed as mit and apache: https://github.com/BurntSushi/bstr/blob/master/Cargo.toml#L11

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jyn514

Copy link
Copy Markdown
MemberAuthor

This is ready for review.

Comment threadcompiler/rustc_codegen_ssa/src/errors.rs Outdated
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
Rollup of 6 pull requests
Successful merges:
- rust-lang#130808 (Fix linking for symbols starting with ? on i686-pc-windows-msvc)
- rust-lang#133154 (Reword resolve errors caused by likely missing crate in dep tree)
- rust-lang#135707 (Shorten linker output even more when `--verbose` is not present)
- rust-lang#135764 (Fix tests on LLVM 20)
- rust-lang#135785 (use `PassMode::Direct` for vector types on `s390x`)
- rust-lang#135818 (tests: Port `translation` to rmake.rs)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: i686-mingw
try-job: x86_64-gnu-llvm-19-3
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 25, 2025
Shorten linker output even more when `--verbose` is not present
- Don't show environment variables. Seeing PATH is almost never useful, and it can be extremely long.
- For .rlibs in the sysroot, replace crate hashes with a `"-*"` string. This will expand to the full crate name when pasted into the shell.
- Move `.rlib` to outside the glob.
- Abbreviate the sysroot path to `<sysroot>` wherever it appears in the arguments.
This also adds an example of the linker output as a run-make test. Currently it only runs on x86_64-unknown-linux-gnu, because each platform has its own linker arguments. So that it's stable across machines, pass BUILD_ROOT as an argument through compiletest through to run-make tests.
r? ```@bjorn3```
try-job: aarch64-apple
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
Rollup of 4 pull requests
Successful merges:
- rust-lang#135707 (Shorten linker output even more when `--verbose` is not present)
- rust-lang#135764 (Fix tests on LLVM 20)
- rust-lang#135785 (use `PassMode::Direct` for vector types on `s390x`)
- rust-lang#135818 (tests: Port `translation` to rmake.rs)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: i686-mingw
try-job: x86_64-gnu-llvm-19-3
@bors

bors commented Jan 25, 2025

Copy link
Copy Markdown
Collaborator

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

@borsbors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 25, 2025
- Don't show environment variables. Seeing PATH is almost never useful, and it can be extremely long.
- For .rlibs in the sysroot, replace crate hashes with a `"-*"` string. This will expand to the full crate name when pasted into the shell.
- Move `.rlib` to outside the glob.
- Abbreviate the sysroot path to `<sysroot>` wherever it appears in the arguments.
This also adds an example of the linker output as a run-make test. Currently it only runs on x86_64-unknown-linux-gnu, because each platform has its own linker arguments. So that it's stable across machines, pass BUILD_ROOT as an argument through compiletest through to run-make tests.
- Only use linker-flavor=gnu-cc if we're actually going to compare the output. It doesn't exist on MacOS.
@jyn514

Copy link
Copy Markdown
MemberAuthor

@bors r=bjorn3

@bors

bors commented Jan 25, 2025

Copy link
Copy Markdown
Collaborator

@jyn514: 🔑 Insufficient privileges: Not in reviewers

@bjorn3

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Jan 25, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit c1b4ab0 has been approved by bjorn3

It is now in the queue for this repository.

@borsbors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 25, 2025
@bors

bors commented Jan 25, 2025

Copy link
Copy Markdown
Collaborator

⌛ Testing commit c1b4ab0 with merge 6fb0358...

@bors

bors commented Jan 26, 2025

Copy link
Copy Markdown
Collaborator

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

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jan 26, 2025
@bors
bors merged commit 6fb0358 into rust-lang:masterJan 26, 2025
@rustbotrustbot added this to the 1.86.0 milestone Jan 26, 2025
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (6fb0358): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

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

Cycles

Results (primary 2.2%, secondary -2.5%)

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.

meanrangecount
Regressions ❌
(primary)
2.2%[2.2%, 2.2%]1
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.5%[-2.5%, -2.5%]1
All ❌✅ (primary)2.2%[2.2%, 2.2%]1

Binary size

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

Bootstrap: 771.158s -> 771.759s (0.08%)
Artifact size: 325.82 MiB -> 325.83 MiB (0.00%)

@jyn514
jyn514 deleted the linker-messages-2 branch January 27, 2025 18:14
@ia0ia0 mentioned this pull request Jul 5, 2025
jieyouxu pushed a commit to jieyouxu/rust that referenced this pull request Jul 7, 2025
This PR does 2 things:
- It removes the braces when there's a single element. This is required since brace expansion (at
least in bash and zsh) only triggers if there's at least 2 elements.
- It removes the extra `.rlib` suffixes of the elements. See
rust-lang#135707 (comment) for context.
Running `cargo +stage1 build` on the following program:
```rust
unsafe extern "C" {
fn foo() -> libc::c_int;
}
fn main() {
let x = unsafe { foo() } as u32;
// println!("{}", data_encoding::BASE64.encode(&x.to_le_bytes()));
}
```
Gives the following diff before and after the PR:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib}.rlib
+/tmp/foo/target/debug/deps/liblibc-faf416f178830595.rlib
```
Running on the same program with the additional dependency, we get the following diff:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib,libdata_encoding-84bb5aadfa9e8839.rlib}.rlib
+/tmp/foo/target/debug/deps/{liblibc-faf416f178830595,libdata_encoding-84bb5aadfa9e8839}.rlib
```
Do we want to add a UI test?
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Jul 7, 2025
Fix short linker error output
This PR does 2 things:
- It removes the braces when there's a single element. This is required since brace expansion (at least in bash and zsh) only triggers if there's at least 2 elements.
- It removes the extra `.rlib` suffixes of the elements. See rust-lang#135707 (comment) for context.
Running `cargo +stage1 build` on the following program:
```rust
unsafe extern "C" {
fn foo() -> libc::c_int;
}
fn main() {
let x = unsafe { foo() } as u32;
// println!("{}", data_encoding::BASE64.encode(&x.to_le_bytes()));
}
```
Gives the following diff before and after the PR:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib}.rlib
+/tmp/foo/target/debug/deps/liblibc-faf416f178830595.rlib
```
Running on the same program with the additional dependency, we get the following diff:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib,libdata_encoding-84bb5aadfa9e8839.rlib}.rlib
+/tmp/foo/target/debug/deps/{liblibc-faf416f178830595,libdata_encoding-84bb5aadfa9e8839}.rlib
```
rust-timer added a commit that referenced this pull request Jul 7, 2025
Rollup merge of #143482 - ia0:fix, r=fee1-dead
Fix short linker error output
This PR does 2 things:
- It removes the braces when there's a single element. This is required since brace expansion (at least in bash and zsh) only triggers if there's at least 2 elements.
- It removes the extra `.rlib` suffixes of the elements. See #135707 (comment) for context.
Running `cargo +stage1 build` on the following program:
```rust
unsafe extern "C" {
fn foo() -> libc::c_int;
}
fn main() {
let x = unsafe { foo() } as u32;
// println!("{}", data_encoding::BASE64.encode(&x.to_le_bytes()));
}
```
Gives the following diff before and after the PR:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib}.rlib
+/tmp/foo/target/debug/deps/liblibc-faf416f178830595.rlib
```
Running on the same program with the additional dependency, we get the following diff:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib,libdata_encoding-84bb5aadfa9e8839.rlib}.rlib
+/tmp/foo/target/debug/deps/{liblibc-faf416f178830595,libdata_encoding-84bb5aadfa9e8839}.rlib
```
github-actionsBot pushed a commit to devnexen/miri that referenced this pull request Jul 8, 2025
Fix short linker error output
This PR does 2 things:
- It removes the braces when there's a single element. This is required since brace expansion (at least in bash and zsh) only triggers if there's at least 2 elements.
- It removes the extra `.rlib` suffixes of the elements. See rust-lang/rust#135707 (comment) for context.
Running `cargo +stage1 build` on the following program:
```rust
unsafe extern "C" {
fn foo() -> libc::c_int;
}
fn main() {
let x = unsafe { foo() } as u32;
// println!("{}", data_encoding::BASE64.encode(&x.to_le_bytes()));
}
```
Gives the following diff before and after the PR:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib}.rlib
+/tmp/foo/target/debug/deps/liblibc-faf416f178830595.rlib
```
Running on the same program with the additional dependency, we get the following diff:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib,libdata_encoding-84bb5aadfa9e8839.rlib}.rlib
+/tmp/foo/target/debug/deps/{liblibc-faf416f178830595,libdata_encoding-84bb5aadfa9e8839}.rlib
```
FractalFir pushed a commit to FractalFir/rust that referenced this pull request Jul 24, 2025
This PR does 2 things:
- It removes the braces when there's a single element. This is required since brace expansion (at
least in bash and zsh) only triggers if there's at least 2 elements.
- It removes the extra `.rlib` suffixes of the elements. See
rust-lang#135707 (comment) for context.
Running `cargo +stage1 build` on the following program:
```rust
unsafe extern "C" {
fn foo() -> libc::c_int;
}
fn main() {
let x = unsafe { foo() } as u32;
// println!("{}", data_encoding::BASE64.encode(&x.to_le_bytes()));
}
```
Gives the following diff before and after the PR:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib}.rlib
+/tmp/foo/target/debug/deps/liblibc-faf416f178830595.rlib
```
Running on the same program with the additional dependency, we get the following diff:
```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib,libdata_encoding-84bb5aadfa9e8839.rlib}.rlib
+/tmp/foo/target/debug/deps/{liblibc-faf416f178830595,libdata_encoding-84bb5aadfa9e8839}.rlib
```
Do we want to add a UI test?
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletestArea: The compiletest test runnerA-run-makeArea: port run-make Makefiles to rmake.rsA-testsuiteArea: The testsuite used to check the correctness of rustcA-tidyArea: The tidy toolmerged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant 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.

9 participants

@jyn514@rustbot@rust-log-analyzer@bjorn3@bors@jieyouxu@ChrisDenton@rust-timer@ia0