diff options
author | Vinh Tran <vinhdaitran@google.com> | 2023-09-21 05:31:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-21 10:31:14 +0100 |
commit | de2f707827207ad5ce138decb6ec496b33c21965 (patch) | |
tree | c06d8831a437b31f0b43a571baf62ace70cdf267 | |
parent | 3e35d104ee97a6bf881161efa460c630183848dc (diff) | |
download | bazelbuild-rules_rust-de2f707827207ad5ce138decb6ec496b33c21965.tar.gz |
Use cc_toolchain.linker_files() for files required at linking steps (#2165)
[cc_toolchain.linker_files()](https://github.com/bazelbuild/bazel/blob/69d3eccf8d75af80586fcb8249db66ba2e5476cb/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcToolchainProviderApi.java#L198-L199)
returns the linker files [used by
cc](https://github.com/bazelbuild/bazel/blob/69d3eccf8d75af80586fcb8249db66ba2e5476cb/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java#L881-L885)
when building cc link action.
Using the same files in rust ensure it has the correct files to resolve
the link args returned from cc toolchain. This also allows custom
specification on [cc_toolchain.linker_files
attribute](https://bazel.build/versions/6.2.0/reference/be/c-cpp#cc_toolchain)
is correctly resolved.
-rw-r--r-- | rust/private/rustc.bzl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index f02c0beb..e76c20bd 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -670,7 +670,7 @@ def collect_inputs( """ linker_script = getattr(file, "linker_script") if hasattr(file, "linker_script") else None - linker_depset = cc_toolchain.all_files + linker_depset = cc_toolchain.linker_files() compilation_mode = ctx.var["COMPILATION_MODE"] use_pic = _should_use_pic(cc_toolchain, feature_configuration, crate_info.type, compilation_mode) |