Skip to content

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Oct 13, 2025

Reopen of #147157, because apparently bors can't deal with it for some reason.


This PR generalizes the previous hardcoded logic for setting self-contained LLD to be used as the default Linker on Linux GNU targets. The changes made:

  1. rust.lld now only controls whether LLD is built and included in the sysroot. If rust.lld is set to false, it will disable the default opt into LLD on x64 Linux.
  2. The linker override for using rust-lld through cc can now be applied to all Linux targets. It is configured through target.<target>.default-linker-linux-override = "self-contained-lld-cc"/"off"

Here is how it behaves:

  1. If you don't set any options, x64 Linux will default into default-linker-linux-override = "self-contained-lld-cc" and also rust.lld = true.
  2. If you set rust.lld = false, you disable this override
  3. If you set target.x86_64-unknown-linux-gnu.default-linux-linker-override = "off", you disable this override
  4. If you set target.x86_64-unknown-linux-gnu.llvm-config = ..., you disable this override

Note that in contrast to what I described in #146640, I didn't bother moving rust.lld to llvm.lld. We can do that separately later, but I don't think it's worth the churn. I realized that rust is perhaps a better place for this, because it not only controls whether LLD is built, but also if it is included in the compiler sysroot. So to truly distinguish these two, we'd need both llvm.lld and rust.lld, which doesn't seem worth it. Note that rust.codegen-backends = ["llvm"] works in the same way, it tells bootstrap to build LLVM and include it in the sysroot. So it is consistent with rust.lld

Related to: #146640


r? @ghost

@rustbot
Copy link
Collaborator

rustbot commented Oct 13, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added 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 Oct 13, 2025
@Kobzol
Copy link
Member Author

Kobzol commented Oct 13, 2025

@bors r=jieyouxu

@bors
Copy link
Collaborator

bors commented Oct 13, 2025

📌 Commit da86710 has been approved by jieyouxu

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 13, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 13, 2025
Generalize configuring LLD as the default linker in bootstrap

Reopen of rust-lang#147157, because apparently bors can't deal with it for some reason.

r? `@ghost`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 13, 2025
Generalize configuring LLD as the default linker in bootstrap

Reopen of rust-lang#147157, because apparently bors can't deal with it for some reason.

r? ``@ghost``
@Zalathar
Copy link
Contributor

I copy-pasted the description from the old PR, because that sort of thing tends to be handy when looking through history.

@Zalathar
Copy link
Contributor

The old PR was rollup=never; should this one be too?

@Kobzol
Copy link
Member Author

Kobzol commented Oct 13, 2025

Bors still haven't updated the mergeability status even of this PR.. let's just try to roll it up and see what happens. It might be the only way to merge this, lol.

@jieyouxu
Copy link
Member

Do we need to attempt a resync?

@Kobzol
Copy link
Member Author

Kobzol commented Oct 13, 2025

It caught up to this PR now, so I don't think so. #147569 is the only approved one right now that doesn't have the mergeability status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants