aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar dslomov <dslomov@google.com>2018-01-19 05:05:06 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-19 05:07:07 -0800
commitf0bec36864f10370cbbda4caa8beac2e0c5ee45b (patch)
treefbbd5c89facc7338ebe5fc44da3c423dea7d475b /tools
parent8896d2e211c57453359566c4520615c1c1f75b66 (diff)
Automated rollback of commit 2aeaeba66857c561dd6d63c79a213f1cabc3650d.
*** Reason for rollback *** Breaks C++ on gcc 4.8.4 (specifically, TensorFlow: https://github.com/bazelbuild/bazel/issues/4474) Fixes #4474 *** Original change description *** When linking mostly-static Linux binaries, link libstdc++.a explicitly. This allows libstdc++ to be statically linked, which is normally only possible when invoking GCC as `g++` with the `-static-libstdc++` flag. Fixes https://github.com/bazelbuild/bazel/issues/2840 See https://github.com/envoyproxy/envoy/issues/415 for additional background and context. cc @htuch (for Envoy) and @calpeyser @hlopko (who I talked to earlier about this)... *** RELNOTES: None. PiperOrigin-RevId: 182519445
Diffstat (limited to 'tools')
-rw-r--r--tools/cpp/CROSSTOOL.tpl1
-rw-r--r--tools/cpp/unix_cc_configure.bzl25
-rw-r--r--tools/cpp/windows_cc_configure.bzl1
3 files changed, 1 insertions, 26 deletions
diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl
index 2f224e626f..67283ad050 100644
--- a/tools/cpp/CROSSTOOL.tpl
+++ b/tools/cpp/CROSSTOOL.tpl
@@ -129,7 +129,6 @@ toolchain {
%{opt_content}
}
linking_mode_flags { mode: DYNAMIC }
-%{link_content}
%{coverage}
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index 1df03d2b02..82cfaa2180 100644
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -65,29 +65,6 @@ def _build_crosstool(d, prefix=" "):
return "\n".join(lines)
-def _build_link_content():
- # `-static-libstdc++` is only supported when invoking GCC as `g++`, and
- # `-lstdc++` forces dynamic linking of libstdc++. To get desired
- # mostly-static behavior, invoke the link by explicitly naming a static
- # library archive.
- #
- # https://github.com/bazelbuild/bazel/issues/2840
- return """
- linking_mode_flags {
- mode: DYNAMIC
- linker_flag: "-lstdc++"
- }
- linking_mode_flags {
- mode: FULLY_STATIC
- linker_flag: "-lstdc++"
- }
- linking_mode_flags {
- mode: MOSTLY_STATIC
- linker_flag: "-l:libstdc++.a"
- }
- """
-
-
def _build_tool_path(d):
"""Build the list of %-escaped tool_path for the CROSSTOOL file."""
lines = []
@@ -242,6 +219,7 @@ def _crosstool_content(repository_ctx, cc, cpu_value, darwin):
"-std=c++0x",
] + _escaped_cplus_include_paths(repository_ctx),
"linker_flag": [
+ "-lstdc++",
"-lm", # Some systems expect -lm in addition to -lstdc++
# Anticipated future default.
] + (
@@ -450,7 +428,6 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
_build_tool_path(tool_paths),
"%{opt_content}": _build_crosstool(opt_content, " "),
"%{dbg_content}": _build_crosstool(dbg_content, " "),
- "%{link_content}": _build_link_content(),
"%{cxx_builtin_include_directory}": "",
"%{coverage}": _coverage_feature(darwin),
"%{msvc_env_tmp}": "",
diff --git a/tools/cpp/windows_cc_configure.bzl b/tools/cpp/windows_cc_configure.bzl
index 23b150c464..7381c11bb4 100644
--- a/tools/cpp/windows_cc_configure.bzl
+++ b/tools/cpp/windows_cc_configure.bzl
@@ -315,7 +315,6 @@ def configure_windows_toolchain(repository_ctx):
"%{msys_x64_mingw_content}": _get_escaped_windows_msys_crosstool_content(repository_ctx, use_mingw = True),
"%{opt_content}": "",
"%{dbg_content}": "",
- "%{link_content}": "",
"%{cxx_builtin_include_directory}": "",
"%{coverage}": "",
})