feat(link): add additional_linker_inputs and link_output_dirs attrs#2
Merged
Conversation
Two new attributes on runnable_attrs (d_binary, d_test):
additional_linker_inputs: label_list of files to make visible to the
link action's sandbox. Matches cc_library.additional_linker_inputs.
Already-supported use case: linker scripts referenced via
$(execpath ...) in linkopts. Now also: linker wrapper scripts
invoked via --ld-path=, and tools the wrapper itself spawns.
link_output_dirs: string_list of TreeArtifact directory names the
link action will produce in addition to the executable. Declared
in link_action via ctx.actions.declare_directory and (on the
cc_common.link path) passed to cc_common.link's additional_outputs,
so a linker wrapper can populate them and downstream rules can
consume them via DefaultInfo.files / a custom provider.
Plumbing:
- link_action now returns a struct(executable, additional_outputs).
binary.bzl and test.bzl unpack and surface additional_outputs via
DefaultInfo.files.
- link_with_d_action takes additional_outputs as a parameter and
declares them on the action; LDC itself doesn't see them, they're
purely for downstream consumption.
- linkopts now go through ctx.expand_location in compilation_action
(against additional_linker_inputs), matching cc_library.linkopts
semantics. The expanded form propagates via DInfo.linker_flags;
link_action no longer adds ctx.attr.linkopts a second time
(was a pre-existing double-add masked by the lack of expansion).
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.
Two new attributes on runnable_attrs (d_binary, d_test):
additional_linker_inputs: label_list of files to make visible to the
link action's sandbox. Matches cc_library.additional_linker_inputs.
Already-supported use case: linker scripts referenced via
$(execpath ...) in linkopts. Now also: linker wrapper scripts
invoked via --ld-path=, and tools the wrapper itself spawns.
link_output_dirs: string_list of TreeArtifact directory names the
link action will produce in addition to the executable. Declared
in link_action via ctx.actions.declare_directory and (on the
cc_common.link path) passed to cc_common.link's additional_outputs,
so a linker wrapper can populate them and downstream rules can
consume them via DefaultInfo.files / a custom provider.
Plumbing: