Skip to content

linker: Use --as-needed by default when linker supports it #83587

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 28, 2021

Conversation

petrochenkov
Copy link
Contributor

Do it in a centralized way in link.rs instead of individual target specs.
Majority of relevant target specs were already passing it.

@rust-highfive
Copy link
Contributor

r? @lcnr

(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 Mar 27, 2021
@rust-log-analyzer

This comment has been minimized.

@nagisa
Copy link
Member

nagisa commented Mar 27, 2021

This makes sense to me. r=me after tests pass.

(Side note: I find it curious is_linker_gnu is a target property. It seems very plausible to me that one could easily have a toolchain for some target that uses a different, non-gnu linker)

@petrochenkov
Copy link
Contributor Author

@bors r=nagisa

@bors
Copy link
Collaborator

bors commented Mar 27, 2021

📌 Commit 6615ee8 has been approved by nagisa

@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 Mar 27, 2021
@bors
Copy link
Collaborator

bors commented Mar 28, 2021

⌛ Testing commit 6615ee8 with merge 3bfc851...

@bors
Copy link
Collaborator

bors commented Mar 28, 2021

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 28, 2021
@bors bors merged commit 3bfc851 into rust-lang:master Mar 28, 2021
@rustbot rustbot added this to the 1.53.0 milestone Mar 28, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 28, 2021
rustc_target: Avoid unwraps when adding linker flags

These `unwrap`s assume that some linker flags were already added by `*_base::opts()` methods, but that's doesn't necessarily remain the case when we are reducing the number of flags hardcoded in targets, as rust-lang#83587 shows.

r? `@nagisa`
@petrochenkov petrochenkov deleted the asneeded branch February 22, 2025 18:31
# for free to join this conversation on GitHub. Already have an account? # 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants