Tweak wasm_base target spec to indicate linker is not GNU and update linker inferring logic for wasm-ld. #85920
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reported via Zulip: we try passing
--as-needed
to the linker if it's GNU ld whichwasm-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 theGccLinker
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:
linker_is_gnu: false
plus a few additions oftarget.is_like_wasm
to handle flagswasm-ld
does in fact support.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.