cc_baremetal_defaults: Disable SVE
Prevent Clang from generating SVE instructions for compiler targets that
default to enabling the feature (such as ARMv9.2-A; see [1]) as the
baremetal environment might not have SVE available (either due to the HW
not supporting it or the SW not having enabled it).
[1]: https://reviews.llvm.org/D109517
Bug: 364383722
Test: lunch <...> # Set TARGET_ARCH_VARIANT=armv9-2a
Test: m pvmfw # Decompile & check for SVE instructions
Change-Id: Ic50d9dc45beb1d04d81e3accaf7fc4fc953ea703
diff --git a/Android.bp b/Android.bp
index 34f9bf0..6db4963 100644
--- a/Android.bp
+++ b/Android.bp
@@ -147,6 +147,16 @@
// Framework guests.
cc_defaults {
name: "cc_baremetal_defaults",
+ arch: {
+ arm64: {
+ cflags: [
+ // Prevent the compiler from optimizing code using SVE, as the
+ // baremetal environment might not have configured the hardware.
+ "-Xclang -target-feature",
+ "-Xclang -sve",
+ ],
+ },
+ },
defaults_visibility: ["//visibility:public"],
}