aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar pcloudy <pcloudy@google.com>2017-05-31 15:04:04 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-05-31 15:41:53 +0200
commit8e6bfe30afa4b91a378cfa7e73336a8366ef4a6d (patch)
tree6a94dcd90cb0e2a84086317a2a348a0d10605a9c /src
parente355e77ca9979baa4fb816c32494c5268f32eae7 (diff)
Don't add -g0 as host copt when host platform is Windows
RELNOTES: None PiperOrigin-RevId: 157578255
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index 8d6ec58a5f..5361b53f09 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -27,6 +27,7 @@ import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.DynamicMode;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.StripMode;
+import com.google.devtools.build.lib.util.OS;
import com.google.devtools.build.lib.util.OptionsUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.LipoMode;
@@ -753,8 +754,16 @@ public class CppOptions extends FragmentOptions {
// -g0 is the default, but allowMultiple options cannot have default values so we just pass
// -g0 first and let the user options override it.
- host.coptList = ImmutableList.<String>builder().add("-g0").addAll(hostCoptList).build();
- host.cxxoptList = ImmutableList.<String>builder().add("-g0").addAll(hostCxxoptList).build();
+ ImmutableList.Builder<String> coptListBuilder = ImmutableList.builder();
+ ImmutableList.Builder<String> cxxoptListBuilder = ImmutableList.builder();
+ // Don't add -g0 if the host platform is Windows.
+ // Note that host platform is not necessarily the platform bazel is running on (foundry)
+ if (OS.getCurrent() != OS.WINDOWS) {
+ coptListBuilder.add("-g0");
+ cxxoptListBuilder.add("-g0");
+ }
+ host.coptList = coptListBuilder.addAll(hostCoptList).build();
+ host.cxxoptList = cxxoptListBuilder.addAll(hostCxxoptList).build();
host.useStartEndLib = useStartEndLib;
host.stripBinaries = StripMode.ALWAYS;