aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2018-05-16 22:45:06 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-16 22:46:49 -0700
commit2661abb96b1fe51fb726a63eb08698564a82eb20 (patch)
tree7f7c5ae9a53e1c3c6d3726a2bd71302165a62817 /tools
parentcc0f41dccc55bb1380b10cc65281632676192a8d (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')
-rw-r--r--tools/cpp/CROSSTOOL.tpl24
-rw-r--r--tools/cpp/crosstool_lib.bzl6
-rw-r--r--tools/cpp/crosstool_utils.bzl2
-rw-r--r--tools/osx/crosstool/CROSSTOOL.tpl210
4 files changed, 187 insertions, 55 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
diff --git a/tools/osx/crosstool/CROSSTOOL.tpl b/tools/osx/crosstool/CROSSTOOL.tpl
index 63d1cad81f..36b30aa215 100644
--- a/tools/osx/crosstool/CROSSTOOL.tpl
+++ b/tools/osx/crosstool/CROSSTOOL.tpl
@@ -192,7 +192,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -659,7 +658,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -721,7 +719,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -987,6 +984,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -1079,7 +1092,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -1101,7 +1113,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -1820,7 +1831,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -2296,7 +2306,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -2358,7 +2367,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -2624,6 +2632,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -2721,7 +2745,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -2743,7 +2766,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -3464,7 +3486,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -3940,7 +3961,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -4002,7 +4022,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -4270,6 +4289,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -4367,7 +4402,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -4389,7 +4423,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -5111,7 +5144,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -5587,7 +5619,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -5649,7 +5680,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -5915,6 +5945,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -6033,7 +6079,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -6055,7 +6100,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -6786,7 +6830,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -7262,7 +7305,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -7324,7 +7366,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -7590,6 +7631,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -7687,7 +7744,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -7709,7 +7765,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -8430,7 +8485,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -8906,7 +8960,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -8968,7 +9021,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -9234,6 +9286,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -9321,7 +9389,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -9343,7 +9410,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -10062,7 +10128,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -10538,7 +10603,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -10600,7 +10664,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -10868,6 +10931,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -10955,7 +11034,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -10977,7 +11055,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -11697,7 +11774,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -12173,7 +12249,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -12235,7 +12310,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -12501,6 +12575,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -12609,7 +12699,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -12631,7 +12720,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -13360,7 +13448,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -13836,7 +13923,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -13898,7 +13984,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -14164,6 +14249,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -14251,7 +14352,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -14273,7 +14373,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -14993,7 +15092,6 @@ toolchain {
action: "c++-header-preprocessing"
action: "c++-module-compile"
action: "c++-module-codegen"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -15469,7 +15567,6 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
action: "linkstamp-compile"
- action: "lto-backend"
action: "clif-match"
flag_group {
flag: "--sysroot=%{sysroot}"
@@ -15531,7 +15628,6 @@ toolchain {
action: "c++-module-codegen"
action: "assemble"
action: "preprocess-assemble"
- action: "lto-backend"
flag_group {
flag: "-gsplit-dwarf"
}
@@ -15797,6 +15893,22 @@ toolchain {
}
}
feature {
+ name: "user_link_flags"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "objc-executable"
+ action: "objc++-executable"
+ flag_group {
+ flag: "%{user_link_flags}"
+ iterate_over: "user_link_flags"
+ }
+ expand_if_all_available: "user_link_flags"
+ }
+ enabled: true
+ }
+ feature {
name: "legacy_link_flags"
flag_set {
action: "c++-link-executable"
@@ -15884,7 +15996,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {
@@ -15906,7 +16017,6 @@ toolchain {
action: "c++-module-compile"
action: "c++-module-codegen"
action: "linkstamp-compile"
- action: "lto-backend"
action: "objc-compile"
action: "objc++-compile"
flag_group {