Skip to content

Commit

Permalink
[bazel] Remove hardcoded link option "-B/usr/bin"
Browse files Browse the repository at this point in the history
- having this option breaks use of custom C/C++ toolchain since support binaries
  such as ld, as, etc., will incorrectly "leak" to the build machine.
- fixes issue bazelbuild#5634

Testing Done: local build of envoy. Checked that the build fails without the fix
and succeeds with the fix.
Review URL: https://reviewboard.eng.vmware.com/r/1390677/
  • Loading branch information
gdimitrov-vmware authored and mzeren-vmw committed Oct 11, 2018
1 parent 18194fa commit 0fd2a12
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ toolchain {
tool_path { name: "gcc" path: "/usr/bin/gcc" }
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
linker_flag: "-B/usr/bin/"
# linker_flag: "-B/usr/bin/"

# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ toolchain {
compiler_flag: "-fstack-protector"
compiler_flag: "-Wall"
compiler_flag: "-Wl,-z,-relro,-z,now"
compiler_flag: "-B/usr/bin"
compiler_flag: "-B/usr/bin"
# compiler_flag: "-B/usr/bin"
# compiler_flag: "-B/usr/bin"
compiler_flag: "-Wunused-but-set-parameter"
compiler_flag: "-Wno-free-nonheap-object"
compiler_flag: "-fno-omit-frame-pointer"
Expand All @@ -173,8 +173,8 @@ toolchain {
linker_flag: "-lstdc++"
linker_flag: "-lm"
linker_flag: "-Wl,-no-as-needed"
linker_flag: "-B/usr/bin"
linker_flag: "-B/usr/bin"
# linker_flag: "-B/usr/bin"
# linker_flag: "-B/usr/bin"
linker_flag: "-pass-exit-codes"
needsPic: true
objcopy_embed_flag: "-I"
Expand Down
4 changes: 2 additions & 2 deletions tools/cpp/CROSSTOOL
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ toolchain {
tool_path { name: "gcc" path: "/usr/bin/gcc" }
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
linker_flag: "-B/usr/bin/"
# linker_flag: "-B/usr/bin/"

# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
Expand Down Expand Up @@ -271,7 +271,7 @@ toolchain {
tool_path { name: "gcc" path: "/usr/bin/clang" }
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
linker_flag: "-B/usr/bin/"
# linker_flag: "-B/usr/bin/"

# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
Expand Down
4 changes: 2 additions & 2 deletions tools/cpp/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def _crosstool_content(repository_ctx, cc, cpu_value, darwin):
"-headerpad_max_install_names",
] if darwin else bin_search_flag + [
# Always have -B/usr/bin, see https://github.com/bazelbuild/bazel/issues/760.
"-B/usr/bin",
# "-B/usr/bin",
# Gold linker only? Can we enable this by default?
# "-Wl,--warn-execstack",
# "-Wl,--detect-odr-violations"
Expand Down Expand Up @@ -320,7 +320,7 @@ def _crosstool_content(repository_ctx, cc, cpu_value, darwin):
_add_compiler_option_if_supported(repository_ctx, cc, "-Wself-assign")
) if darwin else bin_search_flag + [
# Always have -B/usr/bin, see https://github.com/bazelbuild/bazel/issues/760.
"-B/usr/bin",
# "-B/usr/bin",
]) + (
# Disable problematic warnings.
_add_compiler_option_if_supported(repository_ctx, cc, "-Wunused-but-set-parameter") +
Expand Down

0 comments on commit 0fd2a12

Please sign in to comment.