Allow the feature configuration to support structured build variables of nested
list type.

RELNOTES: None.
PiperOrigin-RevId: 100024899
diff --git a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
index 7b87658..f59caaf 100644
--- a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
+++ b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
@@ -64,9 +64,27 @@
   // ... will get expanded to -I /to/path1 -I /to/path2 ... for each
   // include_path /to/pathN.
   //
+  // Flag groups can be nested; if they are, the flag group must only contain
+  // other flag groups (no flags) so the order is unambiguously specified.
+  // Nested flag groups require build variables of nested list types, and
+  // will be expanded recursively.
+  //
+  // For example:
+  // flag_group {
+  //   flag_group { flag: '--start-lib' }
+  //   flag_group { flag: '%{object_files}' }
+  //   flag_group { flag: '--end-lib' }
+  // }
+  // ... will get expanded to
+  //   --start-lib a1.o a2.o ... --end-lib --start-lib b1.o b2.o .. --end-lib
+  //   with %{object_files} being a variable of nested list type
+  //   [['a1.o', 'a2.o', ...], ['b1.o', 'b2.o', ...], ...].
+  //
   // TODO(bazel-team): Write more elaborate documentation and add a link to it.
   message FlagGroup {
     repeated string flag = 1;
+
+    repeated FlagGroup flag_group = 2;
   }
 
   // A set of features; used to support logical 'and' when specifying feature