aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/cpp
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-04-13 10:53:52 +0000
committerGravatar Klaus Aehlig <aehlig@google.com>2017-04-13 16:52:38 +0200
commit045104899738594d85f9ab9b0b9ccbde320b8055 (patch)
treea13037d9bade6bc128da6aff5b2d6338cc1b6f13 /tools/cpp
parentd90737372d370d920e390aff6138dbc2aec2f3b1 (diff)
Make C++ archiving use action_configs instead of hardcoded flags
RELNOTES: Use action_config in crosstool for static library archiving, remove ar_flag. PiperOrigin-RevId: 153046587
Diffstat (limited to 'tools/cpp')
-rw-r--r--tools/cpp/CROSSTOOL3
-rw-r--r--tools/cpp/CROSSTOOL.tpl27
-rw-r--r--tools/cpp/cc_configure.bzl1
3 files changed, 19 insertions, 12 deletions
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index 8bcf94cfe7..d649b9617f 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -220,9 +220,6 @@ toolchain {
tool_path { name: "dwp" path: "/usr/bin/dwp" }
tool_path { name: "gcc" path: "osx_cc_wrapper.sh" }
cxx_flag: "-std=c++0x"
- ar_flag: "-static"
- ar_flag: "-s"
- ar_flag: "-o"
linker_flag: "-lstdc++"
linker_flag: "-undefined"
linker_flag: "dynamic_lookup"
diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl
index 60fb955e95..b01819a2eb 100644
--- a/tools/cpp/CROSSTOOL.tpl
+++ b/tools/cpp/CROSSTOOL.tpl
@@ -411,6 +411,7 @@ toolchain {
tool {
tool_path: 'wrapper/bin/msvc_link.bat'
}
+ implies: 'cc_archiver_flags'
implies: 'input_param_flags'
implies: 'linker_param_file'
implies: 'msvc_env'
@@ -422,6 +423,7 @@ toolchain {
tool {
tool_path: 'wrapper/bin/msvc_link.bat'
}
+ implies: 'cc_archiver_flags'
implies: 'input_param_flags'
implies: 'linker_param_file'
implies: 'msvc_env'
@@ -435,6 +437,7 @@ toolchain {
tool {
tool_path: 'wrapper/bin/msvc_link.bat'
}
+ implies: 'cc_archiver_flags'
implies: 'input_param_flags'
implies: 'linker_param_file'
implies: 'msvc_env'
@@ -446,6 +449,7 @@ toolchain {
tool {
tool_path: 'wrapper/bin/msvc_link.bat'
}
+ implies: 'cc_archiver_flags'
implies: 'input_param_flags'
implies: 'linker_param_file'
implies: 'msvc_env'
@@ -514,16 +518,27 @@ toolchain {
}
feature {
- name: 'input_param_flags'
+ name: 'cc_archiver_flags'
flag_set {
- expand_if_all_available: 'library_search_directories'
- action: 'c++-link-executable'
- action: 'c++-link-dynamic-library'
+ expand_if_all_available: 'output_execpath'
action: 'c++-link-static-library'
action: 'c++-link-alwayslink-static-library'
action: 'c++-link-pic-static-library'
action: 'c++-link-alwayslink-pic-static-library'
flag_group {
+ flag: 'rcsD'
+ flag: '%{output_execpath}'
+ }
+ }
+ }
+
+ feature {
+ name: 'input_param_flags'
+ flag_set {
+ expand_if_all_available: 'library_search_directories'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ flag_group {
iterate_over: 'library_search_directories'
flag: "-L%{library_search_directories}"
}
@@ -532,10 +547,6 @@ toolchain {
expand_if_all_available: 'libopts'
action: 'c++-link-executable'
action: 'c++-link-dynamic-library'
- action: 'c++-link-static-library'
- action: 'c++-link-alwayslink-static-library'
- action: 'c++-link-pic-static-library'
- action: 'c++-link-alwayslink-pic-static-library'
flag_group {
flag: '%{libopts}'
}
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl
index 4e77db5e6b..6ccdd77b0c 100644
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -269,7 +269,6 @@ def _crosstool_content(repository_ctx, cc, cpu_value, darwin):
repository_ctx, cc, "-pass-exit-codes"
)
),
- "ar_flag": ["-static", "-s", "-o"] if darwin else [],
"cxx_builtin_include_directory": _get_cxx_inc_directories(repository_ctx, cc),
"objcopy_embed_flag": ["-I", "binary"],
"unfiltered_cxx_flag":