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

The illumos linker does not support --strip-debug #102418

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

citrus-it
Copy link
Contributor

When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with:

   = note: ld: fatal: unrecognized option '--strip-debug'
           ld: fatal: use the -z help option for usage information
           collect2: error: ld returned 1 exit status

The illumos linker does not support the --strip-debug option (although it does support --strip-all).

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 28, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 28, 2022
Comment on lines +621 to +626
if self.sess.target.os != "illumos" {
self.linker_arg("--strip-debug");
}
Copy link
Member

Choose a reason for hiding this comment

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

I believe the intended solution here would be to invoke an external tool after linking that could do this, similar to the handling for macOS as introduced in #82037.

You probably could just reuse the code path there, for the time being. That way when somebody gets to fixing the way we represent linkers in rustc, illumos will get automatically handled the mostly “right” way alongside with macOS (though you should still keep the comment to the effect that illumos does support --strip-all and could be improved to use that too)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for taking a look at this. I've pushed a new commit which uses the linker's --strip-all but invokes an external strip utility for the --strip-debug case. After talking to people who know more about linkers than I do, they advised that it is best to let the linker do this when possible, hence the hybrid approach.
It may be that the illumos linker can be extended in the future to support --strip-debug but until then this seems like the best approach, and I'd like people to be able to successfully run the tests on illumos again.

@citrus-it citrus-it force-pushed the illumos-strip-debug branch from 709ea1b to f8a3dc4 Compare October 5, 2022 16:03
@nagisa
Copy link
Member

nagisa commented Oct 9, 2022

@bors r+ Seems OK.

@bors
Copy link
Contributor

bors commented Oct 9, 2022

📌 Commit f8a3dc4 has been approved by nagisa

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 Oct 9, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Oct 10, 2022
…agisa

The illumos linker does not support --strip-debug

When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with:

```
   = note: ld: fatal: unrecognized option '--strip-debug'
           ld: fatal: use the -z help option for usage information
           collect2: error: ld returned 1 exit status
```

The illumos linker does not support the `--strip-debug` option (although it does support `--strip-all`).
@JohnTitor
Copy link
Member

This needs to run rustfmt (somehow CI didn't run on this PR): #102865 (comment)
@bors r-

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 10, 2022
@citrus-it citrus-it force-pushed the illumos-strip-debug branch from f8a3dc4 to bb244df Compare October 15, 2022 08:17
@citrus-it citrus-it force-pushed the illumos-strip-debug branch from bb244df to f3deac2 Compare October 15, 2022 08:21
@citrus-it
Copy link
Contributor Author

I've run nightly rustfmt on compiler/rustc_codegen_ssa/src/back/link.rs and pushed the branch. It fails to run on linker.rs, the first error is:

build% ~/.rustup/toolchains/nightly-x86_64-unknown-illumos/bin/rustfmt compiler/rustc_codegen_ssa/src/back/linker.rs
error: expected identifier, found keyword `let`
   --> /data/omnios-build/omniosorg/rust/compiler/rustc_codegen_ssa/src/back/linker.rs:676:17
    |
675 |             let res: io::Result<()> = try {
    |                                       --- while parsing this struct
676 |                 let mut f = BufWriter::new(File::create(&path)?);
    |                 ^^^ expected identifier, found keyword

@lqd
Copy link
Member

lqd commented Oct 15, 2022

Don't run your local rustfmt manually, it won't be the correct version and you'll miss parameters (e.g. the edition), causing the errors above.

Use ./x.py fmt instead. There's more info in the dev guide here.

@citrus-it
Copy link
Contributor Author

Don't run your local rustfmt manually, it won't be the correct version and you'll miss parameters (e.g. the edition), causing the errors above.

Use ./x.py fmt instead. There's more info in the dev guide here.

Thanks, I've run that, it exited cleanly and made no changes.

build:rust:illumos-strip-debug% ./x.py fmt
Building rustbuild
    Finished dev [unoptimized] target(s) in 0.09s
Build completed successfully in 0:00:03
build:rust:illumos-strip-debug% git diff
build:rust:illumos-strip-debug%

@lqd
Copy link
Member

lqd commented Oct 15, 2022

That means the formatting changes you pushed earlier fixed all the formatting issues (and linker.rs was already correctly formatted: the failures you were seeing there were solely due to the missing edition parameter, not actual errors preventing this PR from landing).

So the branch is now correctly formatted. Tidy passes, CI is green.

@nagisa
Copy link
Member

nagisa commented Oct 18, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Oct 18, 2022

📌 Commit f3deac2 has been approved by nagisa

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 18, 2022
@bors
Copy link
Contributor

bors commented Oct 18, 2022

⌛ Testing commit f3deac2 with merge a24a020...

@bors
Copy link
Contributor

bors commented Oct 18, 2022

☀️ Test successful - checks-actions
Approved by: nagisa
Pushing a24a020 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 18, 2022
@bors bors merged commit a24a020 into rust-lang:master Oct 18, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 18, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a24a020): 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)

Results

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.3% [-4.3%, -2.2%] 5
All ❌✅ (primary) - - 0

Cycles

Results

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.6% [2.6%, 2.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
The illumos linker does not support --strip-debug

When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with:

```
   = note: ld: fatal: unrecognized option '--strip-debug'
           ld: fatal: use the -z help option for usage information
           collect2: error: ld returned 1 exit status
```

The illumos linker does not support the `--strip-debug` option (although it does support `--strip-all`).
taiki-e referenced this pull request in nextest-rs/nextest Mar 28, 2024
Restore behavior changed in 4e259a7, because
it turns out that `strip = "debuginfo"` still strips too much.

This was observed with the cargo-nextest 0.9.68-rc.1 binary on illumos, where
`pstack` showed lots of ??? marks.

Part of #1345.
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. 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.

8 participants