16k: core: Add defaults for TARGET_MAX_PAGE_SIZE_SUPPORTED

This refactors existing validation logic to do the following:
- Default ELF alignment to 4096 for non-(arm64/x86_64) targets.
- Default ELF alignment to 4096 if VSR_VENDOR_API_LEVEL < 34.

Test: lunch <target> && get_build_var TARGET_MAX_PAGE_SIZE_SUPPORTED
Bug: 310232825
Change-Id: Ia1548d74c9f92b70a80cb65cc6ed35d4c77edcd2
This commit is contained in:
Vilas Bhat
2024-03-21 23:50:34 +00:00
parent 8c85199efe
commit d4e6add5b0

View File

@@ -407,25 +407,18 @@ ifdef PRODUCT_MAX_PAGE_SIZE_SUPPORTED
else ifeq ($(strip $(call is-low-mem-device)),true)
# Low memory device will have 4096 binary alignment.
TARGET_MAX_PAGE_SIZE_SUPPORTED := 4096
else
# The default binary alignment for userspace is 4096.
else ifeq ($(call math_lt,$(VSR_VENDOR_API_LEVEL),34),true)
TARGET_MAX_PAGE_SIZE_SUPPORTED := 4096
# When VSR vendor API level >= 34, binary alignment will be 65536.
ifeq ($(call math_gt_or_eq,$(VSR_VENDOR_API_LEVEL),34),true)
ifeq ($(TARGET_ARCH),arm64)
TARGET_MAX_PAGE_SIZE_SUPPORTED := 16384
endif
endif
else ifeq (,$(filter arm64 x86_64,$(TARGET_ARCH)))
# TARGET_MAX_PAGE_SIZE_SUPPORTED > 4096 is only supported in arm64 and
# x86_64 targets.
TARGET_MAX_PAGE_SIZE_SUPPORTED := 4096
else
# The default binary alignment for userspace is 16384.
TARGET_MAX_PAGE_SIZE_SUPPORTED := 16384
endif
.KATI_READONLY := TARGET_MAX_PAGE_SIZE_SUPPORTED
# Only arm64 and x86_64 archs supports TARGET_MAX_PAGE_SIZE_SUPPORTED greater than 4096.
ifneq ($(TARGET_MAX_PAGE_SIZE_SUPPORTED),4096)
ifeq (,$(filter arm64 x86_64,$(TARGET_ARCH)))
$(error TARGET_MAX_PAGE_SIZE_SUPPORTED=$(TARGET_MAX_PAGE_SIZE_SUPPORTED) is greater than 4096. Only supported in arm64 and x86_64 archs)
endif
endif
# Boolean variable determining if AOSP is page size agnostic. This means
# that AOSP can use a kernel configured with 4k/16k/64k PAGE SIZES.
TARGET_NO_BIONIC_PAGE_SIZE_MACRO := false