-
-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
//go/config:linkmode
flag value not being effective
The value of the flag was always overriden by the `linkmode` `go_binary` attribute, even if that attribute was at its default (`normal`) value. Instead, use a default of `auto` to distinguish this case from the case where no attribute value has been set explicitly. Fixes #3614 Closes #3615
- Loading branch information
Showing
5 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
_LINKMODE_SETTING = "//go/config:linkmode" | ||
|
||
def _linkmode_pie_transition_impl(settings, attr): | ||
return { | ||
_LINKMODE_SETTING: "pie", | ||
} | ||
|
||
_linkmode_pie_transition = transition( | ||
implementation = _linkmode_pie_transition_impl, | ||
inputs = [_LINKMODE_SETTING], | ||
outputs = [_LINKMODE_SETTING], | ||
) | ||
|
||
def _linkmode_pie_wrapper(ctx): | ||
in_binary = ctx.attr.target[0][DefaultInfo].files.to_list()[0] | ||
out_binary = ctx.actions.declare_file(ctx.attr.name) | ||
ctx.actions.symlink(output = out_binary, target_file = in_binary) | ||
return [ | ||
DefaultInfo( | ||
files = depset([out_binary]), | ||
), | ||
] | ||
|
||
linkmode_pie_wrapper = rule( | ||
implementation = _linkmode_pie_wrapper, | ||
doc = """Provides the (only) file produced by target, but after transitioning the linkmode setting to PIE.""", | ||
attrs = { | ||
"target": attr.label( | ||
cfg = _linkmode_pie_transition, | ||
), | ||
"_allowlist_function_transition": attr.label( | ||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist", | ||
), | ||
}, | ||
) |
This file contains 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