Conversation
Omit redundant automatic runtime selections only for known Clang Linux/macOS links with default linker libraries disabled. Preserve explicit opt-ins and opaque configurations, and cover both platforms with link-action regression tests. Assisted-by: OpenAI Codex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rust links inherit
--unwindlib=noneand-rtlib=compiler-rtfrom LLVM Cc toolchains. With rustc's default linker libraries disabled (-nodefaultlibs), Clang does not consume these automatic runtime-selection options and rustc reportslinker_messageswarnings for each binary, including host tools.Omit these exact options (including their single/double-dash aliases) from known Clang Linux/macOS rustc links when default libraries are disabled. Honor flag precedence and preserve the options when defaults are enabled, build-script/response-file/opaque flags are present, or a custom target or driver makes the configuration uncertain. Explicit runtime libraries and search paths remain intact. Filtering stays inside the existing path-mapped argument expansion; ordinary C/C++ links are unaffected.
Validation on macOS arm64 with Bazel 9.2.0:
//test/unit/runtime_linker_flags:all,//test/unit/rustc_flag_ordering:all, and//test/unit/extra_rustc_flags:all. The new tests inspect real LLVM link actions for both Linux and macOS, covering defaults disabled, enabled, and disabled by the final override.--extra_toolchains=@llvm//toolchain:all; neither unused-option warning was emitted, including during the process-wrapper host build.libgcc_sin this checkout. The same link fails on unchanged main; the baseline emits both unused-option diagnostics, while the patched link removes them. Linux action-level regressions pass.git diff --checkpassed.Assisted-by: OpenAI Codex