Fix building with -c dbg

Just create separate lists of flags (and corresponding features) for
each compilation mode, instead of trying to be cute with a default that
gets overriden.

Change-Id: Ib9741681030f5b88dcf200f0144156a626bc16aa
Signed-off-by: Brian Silverman <bsilver16384@gmail.com>
diff --git a/third_party/bazel-toolchain/toolchain/cc_toolchain_config.bzl b/third_party/bazel-toolchain/toolchain/cc_toolchain_config.bzl
index ccadb7c..e429c40 100644
--- a/third_party/bazel-toolchain/toolchain/cc_toolchain_config.bzl
+++ b/third_party/bazel-toolchain/toolchain/cc_toolchain_config.bzl
@@ -46,6 +46,7 @@
         copts,
         opt_copts,
         dbg_copts,
+        fastbuild_copts,
         linkopts,
         host_tools_info = {}):
     host_os_arch_key = _os_arch_pair(host_os, host_arch)
@@ -157,6 +158,9 @@
         "-fdata-sections",
     ]
 
+    fastbuild_compile_flags = [
+    ]
+
     link_flags = [
         "--target=" + target_system_name,
         "-lm",
@@ -396,6 +400,7 @@
     compile_flags.extend(copts)
     dbg_compile_flags.extend(dbg_copts)
     opt_compile_flags.extend(opt_copts)
+    fastbuild_compile_flags.extend(fastbuild_copts)
     link_flags.extend(linkopts)
 
     # Source: https://cs.opensource.google/bazel/bazel/+/master:tools/cpp/unix_cc_toolchain_config.bzl
@@ -414,6 +419,7 @@
         compile_flags = compile_flags,
         dbg_compile_flags = dbg_compile_flags,
         opt_compile_flags = opt_compile_flags,
+        fastbuild_compile_flags = fastbuild_compile_flags,
         cxx_flags = cxx_flags,
         c_flags = conlyopts,
         compile_not_cxx_flags = compile_not_cxx_flags,
diff --git a/third_party/bazel-toolchain/toolchain/internal/configure.bzl b/third_party/bazel-toolchain/toolchain/internal/configure.bzl
index 6a183fc..2d8124d 100644
--- a/third_party/bazel-toolchain/toolchain/internal/configure.bzl
+++ b/third_party/bazel-toolchain/toolchain/internal/configure.bzl
@@ -131,6 +131,7 @@
         copts_dict = rctx.attr.copts,
         opt_copts_dict = rctx.attr.opt_copts,
         dbg_copts_dict = rctx.attr.dbg_copts,
+        fastbuild_copts_dict = rctx.attr.fastbuild_copts,
         linkopts_dict = rctx.attr.linkopts,
     )
     host_tools_info = dict([
@@ -282,6 +283,7 @@
     copts = toolchain_info.copts_dict.get(key, [])
     opt_copts = toolchain_info.opt_copts_dict.get(key, [])
     dbg_copts = toolchain_info.dbg_copts_dict.get(key, [])
+    fastbuild_copts = toolchain_info.fastbuild_copts_dict.get(key, [])
     linkopts = toolchain_info.linkopts_dict.get(key, [])
     target_toolchain_root = toolchain_info.toolchain_root
     if key in toolchain_info.target_toolchain_roots_dict:
@@ -319,6 +321,7 @@
     copts = {copts},
     opt_copts = {opt_copts},
     dbg_copts = {dbg_copts},
+    fastbuild_copts = {fastbuild_copts},
     linkopts = {linkopts},
 )
 
@@ -437,5 +440,6 @@
         copts = copts,
         opt_copts = opt_copts,
         dbg_copts = dbg_copts,
+        fastbuild_copts = fastbuild_copts,
         linkopts = linkopts,
     )
diff --git a/third_party/bazel-toolchain/toolchain/rules.bzl b/third_party/bazel-toolchain/toolchain/rules.bzl
index f27e387..aad2d37 100644
--- a/third_party/bazel-toolchain/toolchain/rules.bzl
+++ b/third_party/bazel-toolchain/toolchain/rules.bzl
@@ -175,6 +175,13 @@
                "({}), ".format(", ".join(_supported_os_arch_keys())) +
                "used only with -c dbg."),
     ),
+    "fastbuild_copts": attr.string_list_dict(
+        mandatory = False,
+        doc = ("Extra flags for compiling C, C++, and assembly files, " +
+               "for each target OS and arch pair you want to support " +
+               "({}), ".format(", ".join(_supported_os_arch_keys())) +
+               "used only with -c fastbuild."),
+    ),
     "linkopts": attr.string_list_dict(
         mandatory = False,
         doc = ("Extra flags to pass to the linker, " +