Update backward-compatibility.md
Add info on disabling late bound option defaults
Closes #6070.
PiperOrigin-RevId: 211430181
diff --git a/site/docs/skylark/backward-compatibility.md b/site/docs/skylark/backward-compatibility.md
index fa68f7b..6b31bd4 100644
--- a/site/docs/skylark/backward-compatibility.md
+++ b/site/docs/skylark/backward-compatibility.md
@@ -48,6 +48,7 @@
* [Expand directories in Args](#expand-directories-in-args)
* [Static Name Resolution](#static-name-resolution)
* [Disable InMemory Tools Defaults Package](#disable-inmemory-tools-defaults-package)
+* [Disable late bound option defaults](#disable-late-bound-option-defaults)
### Dictionary concatenation
@@ -480,4 +481,40 @@
* `//tools/defaults:coverage_report_generator`
* `//tools/defaults:coverage_support`
+### Disable late bound option defaults
+
+If true, Bazel will stop retrieving the value of `compiler` from the cpp configuration when
+`--compiler` is not specified. This will cause a `config_setting` that have
+`values = {"compiler": "x"}` to not work properly when `--compiler` is not specified at command
+line.
+
+The former behavior can be achieved by changing the `config_setting` to use
+`flag_values = {"@bazel_tools/tools/cpp:compiler": "x"}` instead:
+
+```python
+# Before
+config_setting(
+ name = "cpu_x_compiler_y",
+ values = {
+ "cpu": "x",
+ "compiler": "y",
+ },
+)
+
+# After
+config_setting(
+ name = "cpu_x_compiler_y",
+ values = {
+ "cpu": "x",
+ },
+ flag_values = {
+ "@bazel_tools/tools/cpp:compiler": "y",
+ },
+)
+```
+
+* Flag: `--incompatible_disable_late_bound_option_defaults`
+* Default: `false`
+* Introduced in: `0.18.0`
+
<!-- Add new options here -->