Hi John, internal reviewer asked for tests, could you add some to src/test/shell/bazel/apple/bazel_objc_test.sh please? Test added, to `cpp_darwin_integration_test.sh` -- this isn't Objective-C, it's just regular C++.

I'm some trouble running the test (with changes or at HEAD) because Bazel gets into an infinite loop and consumes all my disk. I'll keep trying.
Ah I missed this one, can you pls use ifMac there? Can you pls move the fail onto the next line. `ifMac` is the opposite of what we want. These lines should only be added on non-MacOS platforms. This matches the existing style. Note that I think there might be something wrong with the current test code -- https://github.com/bazelbuild/bazel/issues/4085 -- would you like me to update both as part of this change? Then use ifLinux pls, windows crosstool is not patched by this code. I believe this should also be applied to FreeBSD. Does it? Line 80 in this file is the desired formatting. Let me investigate #4085 first, we run this test on the CI and I don't think we have this issue there. I'll take a look. Hmm you know what, just fix it pls, the fail shouldn't be there twice even if it worked. I didn't know assert_build also fails. That is covered by 'linux' cppPlatform :) https://github.com/bazelbuild/bazel/blob/275ae45b1228bdd0f912c4fbd634b29ba4180383/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java#L353 I know, this is not very robust :)  OK, changed to use `ifLinux`. I also added a comment that FreeBSD counts as `LINUX`. Done.
MacOS crosstool configures /usr/bin/strip with invalid flags
This report is against Bazel release 0.7.0.

`tools/osx/crosstool/CROSSTOOL.tpl` configures `/usr/bin/strip` with multiple `-R` flags. In the GNU toolchain this flag removes a named section, but Clang (installed by Apple's dev tools) has a different definition of the `-R` flag.

```
       -R filename
              Remove the symbol table entries for the global symbols listed in
              filename.  This file has the same  format  as  the  -s  filename
              option  above.   This option is usually used in combination with
              other options that save some symbols, -S, -x, etc.
```

This causes builds of stripped binaries to fail on MacOS:

```
$ ~/bin/bazel build -s //:hello.stripped
# [...]
>>>>> # //:hello [action 'Stripping hello.stripped for //:hello']
(cd /private/var/tmp/_bazel_jmillikin/6469710131e6db2fa36d059d1b1c2547/execroot/__main__ && \
  exec env - \
    PATH=/usr/local/bin:/usr/bin:/bin \
    TMPDIR=/var/folders/bd/0cbzdsgs2lq1dtg56xn8c07c0000gn/T/ \
  /usr/bin/strip -S -o bazel-out/local-fastbuild/bin/hello.stripped -R .gnu.switches.text.quote_paths -R .gnu.switches.text.bracket_paths -R .gnu.switches.text.system_paths -R .gnu.switches.text.cpp_defines -R .gnu.switches.text.cpp_includes -R .gnu.switches.text.cl_args -R .gnu.switches.text.lipo_info -R .gnu.switches.text.annotation bazel-out/local-fastbuild/bin/hello)
ERROR: /Users/jmillikin/src/hello_cc/BUILD:1:1: Stripping hello.stripped for //:hello failed (Exit 1).
fatal error: /Library/Developer/CommandLineTools/usr/bin/strip: only one -R option allowed
Target //:hello.stripped failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.491s, Critical Path: 0.19s
```

Here's the workspace content to reproduce:
```
$ cat BUILD 
cc_binary(
    name = "hello",
    srcs = ["hello.cc"],
)
$ cat hello.cc 
#include <cstdio>

int main() {
  printf("Hello world!\n");
  return 0;
}
```

src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java tools/osx/crosstool/CROSSTOOL.tpl
src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java tools/osx/crosstool/CROSSTOOL.tpl
src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL src/test/shell/bazel/cpp_darwin_integration_test.sh
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java
index caf3e36efefc7c..b093aec1992af4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java
@@ -938,24 +938,25 @@ public static String getCppActionConfigs(
                 "      flag: '-o'",
                 "      flag: '%{output_file}'",
                 "    }",
-                "    flag_group {",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.quote_paths'",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.bracket_paths'",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.system_paths'",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.cpp_defines'",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.cpp_includes'",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.cl_args'",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.lipo_info'",
-                "      flag: '-R'",
-                "      flag: '.gnu.switches.text.annotation'",
-                "    }",
+                ifLinux(platform,
+                    "    flag_group {",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.quote_paths'",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.bracket_paths'",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.system_paths'",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.cpp_defines'",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.cpp_includes'",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.cl_args'",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.lipo_info'",
+                    "      flag: '-R'",
+                    "      flag: '.gnu.switches.text.annotation'",
+                    "    }"),
                 "    flag_group {",
                 "      iterate_over: 'stripopts'",
                 "      flag: '%{stripopts}'",
@@ -1073,6 +1074,7 @@ public static String getFeaturesToAppearLastInToolchain(
   }
 
   private static String ifLinux(CppPlatform platform, String... lines) {
+    // Platform `LINUX` also includes FreeBSD.
     return ifTrue(platform == CppPlatform.LINUX, lines);
   }
 
diff --git a/tools/osx/crosstool/CROSSTOOL.tpl b/tools/osx/crosstool/CROSSTOOL.tpl
index 8cd191b5329e04..d86f47c82cbfe1 100644
--- a/tools/osx/crosstool/CROSSTOOL.tpl
+++ b/tools/osx/crosstool/CROSSTOOL.tpl
@@ -1180,22 +1180,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -2841,22 +2825,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -4506,22 +4474,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -6191,22 +6143,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -7863,22 +7799,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -9516,22 +9436,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -11169,22 +11073,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -12842,22 +12730,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -14502,22 +14374,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -16156,22 +16012,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"

diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL b/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL
index f653c9f220f64c..ea448ad9463bed 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL
+++ b/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL
@@ -1299,22 +1299,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -3073,22 +3057,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -4842,22 +4810,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -6611,22 +6563,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -8388,22 +8324,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -10169,22 +10089,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -11973,22 +11877,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -13759,22 +13647,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -15560,22 +15432,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -17361,22 +17217,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -19185,22 +19025,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
@@ -20991,22 +20815,6 @@ toolchain {
         flag: "-S"
         flag: "-o"
         flag: "%{output_file}"
-        flag: "-R"
-        flag: ".gnu.switches.text.quote_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.bracket_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.system_paths"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_defines"
-        flag: "-R"
-        flag: ".gnu.switches.text.cpp_includes"
-        flag: "-R"
-        flag: ".gnu.switches.text.cl_args"
-        flag: "-R"
-        flag: ".gnu.switches.text.lipo_info"
-        flag: "-R"
-        flag: ".gnu.switches.text.annotation"
       }
       flag_group {
         flag: "%{stripopts}"
diff --git a/src/test/shell/bazel/cpp_darwin_integration_test.sh b/src/test/shell/bazel/cpp_darwin_integration_test.sh
index d191ef83b8a045..2c23566fe39230 100755
--- a/src/test/shell/bazel/cpp_darwin_integration_test.sh
+++ b/src/test/shell/bazel/cpp_darwin_integration_test.sh
@@ -71,14 +71,28 @@ EOF
     }
   }
 EOF
-  assert_build //cpp/rpaths:test >& $TEST_log || fail "//cpp/rpaths:test didn't build"
+  assert_build //cpp/rpaths:test
   # Paths originally hardcoded in the binary assume workspace directory. Let's change the
   # directory and execute the binary to test whether the paths in the binary have been
   # updated to use @loader_path.
   cd bazel-bin
-  ./cpp/rpaths/test >& $TEST_log || \
+  ./cpp/rpaths/test || \
       fail "//cpp/rpaths:test execution failed, expected to return 0, but got $?"
 }
 
+function test_osx_binary_strip() {
+  mkdir -p cpp/osx_binary_strip
+  cat >cpp/osx_binary_strip/BUILD <<EOF
+cc_binary(
+  name = "main",
+  srcs = ["main.cc"],
+)
+EOF
+  cat >cpp/osx_binary_strip/main.cc <<EOF
+int main() { return 0; }
+EOF
+  assert_build //cpp/osx_binary_strip:main.stripped
+}
+
 run_suite "Tests for Bazel's C++ rules on Darwin"
 
