From 6ac752edd5eade365663bd14a9847b4e5da6e5cc Mon Sep 17 00:00:00 2001 From: Harvey Tuch Date: Thu, 7 Feb 2019 12:34:36 -0500 Subject: [PATCH 1/2] build: fix ubsan oss-fuzz build. We were still failing ClusterFuzz builds for ubsan, another external_cmake regression. Risk level: Low Testing: oss-fuzz undefined Docker build. Signed-off-by: Harvey Tuch --- bazel/cc_wrapper.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bazel/cc_wrapper.py b/bazel/cc_wrapper.py index 78fa90fbb6e0..491136e4abd4 100755 --- a/bazel/cc_wrapper.py +++ b/bazel/cc_wrapper.py @@ -30,7 +30,8 @@ def sanitize_flagfile(in_path, out_fd): def main(): # Append CXXFLAGS to correctly detect include paths for either libstdc++ or libc++. if sys.argv[1:5] == ["-E", "-xc++", "-", "-v"]: - os.execv(envoy_real_cxx, [envoy_real_cxx] + sys.argv[1:] + shlex.split(envoy_cxxflags)) + os.execv(envoy_real_cxx, + [envoy_real_cxx] + sys.argv[1:] + shlex.split(envoy_cxxflags)) # `g++` and `gcc -lstdc++` have similar behavior and Bazel treats them as # interchangeable, but `gcc` will ignore the `-static-libstdc++` flag. @@ -39,7 +40,8 @@ def main(): # # Similar behavior exists for Clang's `-stdlib=libc++` flag, so we handle # it in the same test. - if "-static-libstdc++" in sys.argv[1:] or "-stdlib=libc++" in sys.argv[1:]: + if ("-static-libstdc++" in sys.argv[1:] or "-stdlib=libc++" in sys.argv[1:] or + "-std=c++0x" in sys.argv[1:]): compiler = envoy_real_cxx else: compiler = envoy_real_cc @@ -62,7 +64,8 @@ def main(): # unless the user has explicitly set environment variables # before starting Bazel. But here in $PWD is the Bazel sandbox, # which will be deleted automatically after the compiler exits. - (flagfile_fd, flagfile_path) = tempfile.mkstemp(dir='./', suffix=".linker-params") + (flagfile_fd, flagfile_path) = tempfile.mkstemp( + dir="./", suffix=".linker-params") with closing_fd(flagfile_fd): sanitize_flagfile(arg[len("-Wl,@"):], flagfile_fd) argv.append("-Wl,@" + flagfile_path) From f90360539589a9a40c3a5a20e393adf23aa2ba73 Mon Sep 17 00:00:00 2001 From: Harvey Tuch Date: Thu, 7 Feb 2019 13:43:25 -0500 Subject: [PATCH 2/2] Fix check_format. Signed-off-by: Harvey Tuch --- bazel/cc_wrapper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bazel/cc_wrapper.py b/bazel/cc_wrapper.py index 491136e4abd4..bd7098950dad 100755 --- a/bazel/cc_wrapper.py +++ b/bazel/cc_wrapper.py @@ -30,8 +30,7 @@ def sanitize_flagfile(in_path, out_fd): def main(): # Append CXXFLAGS to correctly detect include paths for either libstdc++ or libc++. if sys.argv[1:5] == ["-E", "-xc++", "-", "-v"]: - os.execv(envoy_real_cxx, - [envoy_real_cxx] + sys.argv[1:] + shlex.split(envoy_cxxflags)) + os.execv(envoy_real_cxx, [envoy_real_cxx] + sys.argv[1:] + shlex.split(envoy_cxxflags)) # `g++` and `gcc -lstdc++` have similar behavior and Bazel treats them as # interchangeable, but `gcc` will ignore the `-static-libstdc++` flag. @@ -64,8 +63,7 @@ def main(): # unless the user has explicitly set environment variables # before starting Bazel. But here in $PWD is the Bazel sandbox, # which will be deleted automatically after the compiler exits. - (flagfile_fd, flagfile_path) = tempfile.mkstemp( - dir="./", suffix=".linker-params") + (flagfile_fd, flagfile_path) = tempfile.mkstemp(dir="./", suffix=".linker-params") with closing_fd(flagfile_fd): sanitize_flagfile(arg[len("-Wl,@"):], flagfile_fd) argv.append("-Wl,@" + flagfile_path)