diff options
author | hlopko <hlopko@google.com> | 2018-05-16 22:45:06 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-16 22:46:49 -0700 |
commit | 2661abb96b1fe51fb726a63eb08698564a82eb20 (patch) | |
tree | 7f7c5ae9a53e1c3c6d3726a2bd71302165a62817 /tools/cpp | |
parent | cc0f41dccc55bb1380b10cc65281632676192a8d (diff) |
Split user_link_flags from legacy_link_flags
The difference between them is that user_link_flags will stay after we remove
legacy fields from the crosstool.
RELNOTES: None.
PiperOrigin-RevId: 196940832
Diffstat (limited to 'tools/cpp')
-rw-r--r-- | tools/cpp/CROSSTOOL.tpl | 24 | ||||
-rw-r--r-- | tools/cpp/crosstool_lib.bzl | 6 | ||||
-rw-r--r-- | tools/cpp/crosstool_utils.bzl | 2 |
3 files changed, 27 insertions, 5 deletions
diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl index b4d9edd713..38df97f323 100644 --- a/tools/cpp/CROSSTOOL.tpl +++ b/tools/cpp/CROSSTOOL.tpl @@ -378,6 +378,7 @@ toolchain { implies: 'linkstamps' implies: 'output_execpath_flags' implies: 'input_param_flags' + implies: 'user_link_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' implies: 'linker_param_file' @@ -397,6 +398,7 @@ toolchain { implies: 'linkstamps' implies: 'output_execpath_flags' implies: 'input_param_flags' + implies: 'user_link_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' implies: 'linker_param_file' @@ -418,6 +420,7 @@ toolchain { implies: 'linkstamps' implies: 'output_execpath_flags' implies: 'input_param_flags' + implies: 'user_link_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' implies: 'linker_param_file' @@ -738,8 +741,8 @@ toolchain { } # Since this feature is declared earlier in the CROSSTOOL than - # "legacy_link_flags", this feature will be applied prior to it anwyhere they - # are both implied. And since "legacy_link_flags" contains the linkopts from + # "user_link_flags", this feature will be applied prior to it anwyhere they + # are both implied. And since "user_link_flags" contains the linkopts from # the build rule, this allows the user to override the /SUBSYSTEM in the BUILD # file. feature { @@ -754,11 +757,24 @@ toolchain { } } - # The "legacy_link_flags" may contain user-defined linkopts (from build rules) + # The "user_link_flags" contains user-defined linkopts (from build rules) # so it should be defined after features that declare user-overridable flags. # For example the "linker_subsystem_flag" defines a default "/SUBSYSTEM" flag # but we want to let the user override it, therefore "link_flag_subsystem" is - # defined earlier in the CROSSTOOL file than "legacy_link_flags". + # defined earlier in the CROSSTOOL file than "user_link_flags". + feature { + name: 'user_link_flags' + flag_set { + expand_if_all_available: 'user_link_flags' + action: 'c++-link-executable' + action: 'c++-link-dynamic-library' + action: "c++-link-nodeps-dynamic-library" + flag_group { + iterate_over: 'user_link_flags' + flag: '%{user_link_flags}' + } + } + } feature { name: 'legacy_link_flags' flag_set { diff --git a/tools/cpp/crosstool_lib.bzl b/tools/cpp/crosstool_lib.bzl index 1ddd838d0a..a6c4916947 100644 --- a/tools/cpp/crosstool_lib.bzl +++ b/tools/cpp/crosstool_lib.bzl @@ -158,6 +158,12 @@ def get_features_to_appear_first(platform): ["-pie"], expand_if_all_available=["force_pic"]), simple_feature( + "user_link_flags", + LINK_ACTIONS, + ["%{user_link_flags}"], + iterate_over="user_link_flags", + expand_if_all_available=["user_link_flags"]), + simple_feature( "legacy_link_flags", LINK_ACTIONS, ["%{legacy_link_flags}"], diff --git a/tools/cpp/crosstool_utils.bzl b/tools/cpp/crosstool_utils.bzl index 06bfc63202..238d0cff6d 100644 --- a/tools/cpp/crosstool_utils.bzl +++ b/tools/cpp/crosstool_utils.bzl @@ -31,9 +31,9 @@ COMPILE_ACTIONS = [ # All possible C++ link actions LINK_ACTIONS = [ + "c++-link-executable", "c++-link-dynamic-library", "c++-link-nodeps-dynamic-library", - "c++-link-executable", ] # All possible C++ archive actions |