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

Tweak wasm_base target spec to indicate linker is not GNU and update linker inferring logic for wasm-ld. #85920

Merged
merged 1 commit into from
Jun 6, 2021

Conversation

luqmana
Copy link
Member

@luqmana luqmana commented Jun 2, 2021

Reported via Zulip: we try passing --as-needed to the linker if it's GNU ld which wasm-ld is not. Usually this isn't an issue for wasm as we would use the WasmLd linker driver but because the linker in question (wasm32-unknown-wasi-wasm-ld) ended with -ld our linker inferring logic used the GccLinker implementations. (UPD: The linker inferring logic actually didn't apply in this case because the linker is actually invoked through gcc in the reported issue. But it's still worth updating the logic I think.)

This change then has 2 parts:

  1. Update wasm_base target spec to indicate linker_is_gnu: false plus a few additions of target.is_like_wasm to handle flags wasm-ld does in fact support.
  2. Improve the linker detection logic to properly determine the correct flavor of wasm linker we're using when we can.

We need to add the new target.is_like_wasm branches to handle the case where the "linker" used could be something like clang which would then under the hood call wasm-ld.

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(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 Jun 2, 2021
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jun 5, 2021

📌 Commit f667aca has been approved by petrochenkov

@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 Jun 5, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#85436 (Avoid cloning cache key)
 - rust-lang#85772 (Preserve metadata w/ Solaris-like linkers.)
 - rust-lang#85920 (Tweak wasm_base target spec to indicate linker is not GNU and update linker inferring logic for wasm-ld.)
 - rust-lang#85930 (Update standard library for IntoIterator implementation of arrays )
 - rust-lang#85972 (Rustdoc html fixes)
 - rust-lang#86028 (Drop an `if let` that will always succeed)
 - rust-lang#86043 (don't clone attrs)
 - rust-lang#86047 (Don't fire `invalid_doc_attributes` on `extern crate` items)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 679a1d1 into rust-lang:master Jun 6, 2021
@rustbot rustbot added this to the 1.54.0 milestone Jun 6, 2021
@luqmana luqmana deleted the wasm-linker-tweaks branch June 6, 2021 18:39
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants