Add a toolchain feature for Full LTO

Thin LTO is not yet supported for CFI, so we need the full LTO
feature for now.

Bug: 261733820
Test: Unit Tests
Change-Id: I2c0c7f710f1698259cd4d4e32c68a58e9569e1ba
diff --git a/cc_toolchain_features.bzl b/cc_toolchain_features.bzl
index df781a7..c7498b9 100644
--- a/cc_toolchain_features.bzl
+++ b/cc_toolchain_features.bzl
@@ -1607,6 +1607,22 @@
                 ),
             ],
         ),
+        # Used for CFI
+        # TODO(b/283951987): Remove after full LTO support is removed in Soong
+        feature(
+            name = "android_full_lto",
+            enabled = False,
+            flag_sets = [
+                flag_set(
+                    actions = _actions.compile + _actions.link + _actions.assemble,
+                    flag_groups = [
+                        flag_group(
+                            flags = ["-flto"],
+                        ),
+                    ],
+                ),
+            ],
+        ),
     ]
     return features
 
@@ -1630,6 +1646,7 @@
 # TODO(b/276756319): Restrict for riscv64 when we have riscv64 in Bazel
 # TODO(b/276932249): Restrict for Fuzzer when we have Fuzzer in Bazel
 # TODO(b/276931992): Restrict for Asan when we have Asan in Bazel
+# TODO(b/283951987): Switch to thin LTO when possible
 def _get_cfi_features(target_arch, target_os):
     if target_os in [_oses.Windows, _oses.Darwin, _oses.LinuxMusl]:
         return []
@@ -1651,7 +1668,7 @@
                     _generated_sanitizer_constants.CfiAsFlags,
                 ),
             ],
-            implies = ["android_thin_lto"] + (
+            implies = ["android_full_lto"] + (
                 ["arm_isa_thumb"] if target_arch == _arches.Arm else []
             ),
         ),
diff --git a/cc_toolchain_features_cfi_test.bzl b/cc_toolchain_features_cfi_test.bzl
index 1118342..ebaeafe 100644
--- a/cc_toolchain_features_cfi_test.bzl
+++ b/cc_toolchain_features_cfi_test.bzl
@@ -265,6 +265,7 @@
 
     return test_name
 
+# TODO(b/283951987): Swtich to thin LTO when possible
 def test_cfi_implies_lto():
     name = "cfi_implies_lto"
     native.cc_binary(
@@ -279,7 +280,7 @@
         name = test_name,
         target_under_test = name,
         mnemonics = [compile_action_mnemonic],
-        expected_flags = ["-flto=thin"],
+        expected_flags = ["-flto"],
     )
 
     return test_name