From 8e6bfe30afa4b91a378cfa7e73336a8366ef4a6d Mon Sep 17 00:00:00 2001 From: pcloudy Date: Wed, 31 May 2017 15:04:04 +0200 Subject: Don't add -g0 as host copt when host platform is Windows RELNOTES: None PiperOrigin-RevId: 157578255 --- .../com/google/devtools/build/lib/rules/cpp/CppOptions.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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.builder().add("-g0").addAll(hostCoptList).build(); - host.cxxoptList = ImmutableList.builder().add("-g0").addAll(hostCxxoptList).build(); + ImmutableList.Builder coptListBuilder = ImmutableList.builder(); + ImmutableList.Builder 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; -- cgit v1.2.3