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

Ensure lld is supported with download-ci-llvm #104748

Merged
merged 6 commits into from
Jan 4, 2023
Merged

Conversation

lqd
Copy link
Member

@lqd lqd commented Nov 22, 2022

This PR:

  • ensures LLD's step in bootstrap's dist, but it's not strictly necessary since dist will already package it when it's present.
  • makes bootstrap's native::LLD step support using the packaged ci-llvm/bin/lld, instead of building it from source (which would most likely not be available today, nor in the future where download-ci-llvm = if-available is the default).

If I understand correctly, --enable-full-tools will also enable rust.lld, and this is why LLD is already packaged today in the rust-dev component on the main targets (and why -Zgcc-ld=lld does work there).

That means it's likely that this PR will not be able to land before I've reworked and landed #101792: if LLD is available in download-ci-llvm, the needs-rust-lld tests should start being executed on the x64 macOS test builders, and CI would fail today.

I've tested locally that building with download-ci-llvm = true and lld = true with the LLVM submodule unregistered was successful, and that rust-lld and the various lld-wrappers are present and -Zgcc-ld=lld works as well, on a few different platforms:

  • x86_64-unknown-linux-gnu
  • aarch64-apple-darwin
  • x86_64-pc-windows-msvc (with -Clinker=rust-lld rather than -Zgcc-ld=lld)
  • x86_64-apple-darwin, with the MACOSX_DEPLOYMENT_TARGET workaround for -Z gcc-ld=lld fails again #101653

I don't think we really need to bump the download-ci-llvm-stamp in this case, since ./build/$triple/ci-llvm/bin/lld is present on all the above targets already, but have added it mechanically, and it should probably be removed to avoid unnecessary downloads/churn.

Fixes #98340
Supersedes #100010

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Nov 22, 2022
@lqd
Copy link
Member Author

lqd commented Nov 22, 2022

@bors try

@bors
Copy link
Contributor

bors commented Nov 22, 2022

⌛ Trying commit fdf2238424e42ef67cd1826723a792c86735ded7 with merge 2b02e73d38e5508c9eeda99c5c321b11cd0667f6...

@bors
Copy link
Contributor

bors commented Nov 23, 2022

☀️ Try build successful - checks-actions
Build commit: 2b02e73d38e5508c9eeda99c5c321b11cd0667f6 (2b02e73d38e5508c9eeda99c5c321b11cd0667f6)

@lqd lqd force-pushed the download_lld branch 2 times, most recently from cba3d17 to 573b2ba Compare November 23, 2022 18:21
@lqd lqd changed the title Ensure lld is packaged in download-ci-llvm Ensure lld is supported with download-ci-llvm Nov 23, 2022
@jyn514 jyn514 added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 28, 2022
@jyn514 jyn514 self-assigned this Nov 28, 2022
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

If I understand correctly, --enable-full-tools will also enable rust.lld, and this is why LLD is already packaged today in the rust-dev component on the main targets (and why -Zgcc-ld=lld does work there).

Can you expand on "main targets"? Is it available on all tier 1 targets, or only targets where we build LLVM from source? and if it's on all tier 1 targets, what is this change doing?

src/bootstrap/dist.rs Outdated Show resolved Hide resolved
src/bootstrap/native.rs Show resolved Hide resolved
@lqd
Copy link
Member Author

lqd commented Nov 30, 2022

Can you expand on "main targets"? Is it available on all tier 1 targets, or only targets where we build LLVM from source?

Ah I only meant the targets listed in the OP (minus aarch64 darwin which is tier 2) where I manually tested that lld was already available. Looking at dist::RustDev's code, I'd expect it to be available where we build LLVM from source and full tools are enabled (or rust.lld of course). I wouldn't know the full target list but this PR doesn't change anything there as it's not about packaging lld.

what is this change doing?

The current situation is a bit subtle and I think in #100010 it was expected that we don't package lld in download-ci-llvm today: we do, but never use it even if it's available. So this change makes bootstrap's lld step check whether we can use the possibly already present $llvm/bin/lld (where dist packages it; this is not where the lld executable is when we build it from source), instead of unconditionally building it from source.

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

Thanks for explaining. This looks good to me if you change LLD to be included in RustDev unconditionally.

src/bootstrap/dist.rs Outdated Show resolved Hide resolved
src/bootstrap/native.rs Show resolved Hide resolved
@jyn514
Copy link
Member

jyn514 commented Nov 30, 2022

That means it's likely that this PR will not be able to land before I've reworked and landed #101792: if LLD is available in download-ci-llvm, the needs-rust-lld tests should start being executed on the x64 macOS test builders, and CI would fail today.

I am not quite sure what the relation is here, but FWIW I don't have any problem with speculatively approving this and seeing if CI fails or not.

@lqd
Copy link
Member Author

lqd commented Nov 30, 2022

To summarize the intent I described on zulip: our rust-lld support (e.g. -Zgcc-ld=lld) has been broken during refactoring a couple times and CI didn't catch it: my understanding is that no test builders are running the existing needs-rust-lld tests (they don't build llvm/lld from source), and lld is only enabled on the dist builders.

This PR is ultimately to fix CI so that this doesn't regress anymore: the test builders will have access to lld with download-ci-llvm. But since things are still currently broken on x64 apple, I'll have to fix that before this PR lands fixing CI: the needs-rust-lld tests would automatically be enabled, and fail because of the breakage.

@bors
Copy link
Contributor

bors commented Dec 22, 2022

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

@lqd lqd removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Jan 3, 2023
@lqd lqd marked this pull request as ready for review January 3, 2023 20:33
@lqd
Copy link
Member Author

lqd commented Jan 3, 2023

@jyn514 #101792 has just landed, so #101653 is fixed: that means the various run-make tests depending on rust-lld's availability should now pass on the mac builders.

I've pushed a commit making the LLD step ensure unconditional for the RustDev component as you requested. I don't know if all our dist builders already enable rust.lld— I'd think/hope they do, via enabling full tools — but this will be a fun way to find out 😅 .

I'm not sure we really need to bump the download-ci-llvm-stamp here (since the lld binary should already be in RustDev if lld is enabled on the builder), let me know if you want me to remove that ?

@rustbot ready

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 3, 2023
@jyn514
Copy link
Member

jyn514 commented Jan 4, 2023

Thanks, this looks great!

I'm not sure we really need to bump the download-ci-llvm-stamp here (since the lld binary should already be in RustDev if lld is enabled on the builder), let me know if you want me to remove that ?

I think it's not strictly necessary, but there's no harm bumping it, the download isn't too big.

@bors r+

@bors
Copy link
Contributor

bors commented Jan 4, 2023

📌 Commit e0f5c6d has been approved by jyn514

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 4, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 4, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#104748 (Ensure `lld` is supported with `download-ci-llvm`)
 - rust-lang#105541 (Simplify some iterator combinators)
 - rust-lang#106045 (default OOM handler: use non-unwinding panic, to match std handler)
 - rust-lang#106157 (Don't trim path for `unsafe_op_in_unsafe_fn` lints)
 - rust-lang#106353 (Reduce spans for `unsafe impl` errors)
 - rust-lang#106381 (Jsondoclint: Add `--verbose` and `--json-output` options)
 - rust-lang#106411 (rustdoc: remove legacy font-feature-settings CSS)
 - rust-lang#106414 (Add cuviper to the review rotation for libs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 752c0f5 into rust-lang:master Jan 4, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 4, 2023
@lqd lqd deleted the download_lld branch January 4, 2023 07:57
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 12, 2023
… r=jyn514

Use CI LLVM in `test-various` builder

It was disabled because it needs `lld`, but since rust-lang#104748 was merged it is no longer needed.

This will speed this test, since it no longer needs to build LLVM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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-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.

Building with lld and download-ci-llvm
4 participants