soong: Add product variable DevicePageSizeAgnostic
The product variable DevicePageSizeAgnostic will determine
whether AOSP is kernel page size agnostic or not.
Test: source build/envsetup.sh
lunch aosp_cf_arm64_phone_pgagnostic
m
cat out/soong/build.aosp_cf_arm64_phone_pgagnostic.ninja | grep __BIONIC_NO_PAGE_SIZE_MACRO
Bug: 289419664
Change-Id: I33a1a4f1967d7e78432b7b8d90357d16b2002dcc
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index ca2e05f..12722a7 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -100,7 +100,15 @@
return strings.Join(flags, " ")
})
- exportedVars.ExportStringListStaticVariable("Arm64Cflags", arm64Cflags)
+ exportedVars.ExportStringList("Arm64Cflags", arm64Cflags)
+ pctx.VariableFunc("Arm64Cflags", func(ctx android.PackageVarContext) string {
+ flags := arm64Cflags
+ if ctx.Config().PageSizeAgnostic() {
+ flags = append(flags, "-D__BIONIC_NO_PAGE_SIZE_MACRO")
+ }
+ return strings.Join(flags, " ")
+ })
+
exportedVars.ExportStringListStaticVariable("Arm64Cppflags", arm64Cppflags)
exportedVars.ExportVariableReferenceDict("Arm64ArchVariantCflags", arm64ArchVariantCflagsVar)