Page size alignment - ignore 32-bit.
For devices with PRODUCT_SHIPPING_API_LEVEL >= 36,
if they are 32-bit + 64-bit, this test will create
a build error.
Instead, we're only enforcing the page alignment at
build time for 64-bit libraries.
We could track 32-bit page size or enforce them to be
4096. I would expect such a change to catch no issues,
but it may also tag a large number of 32-bit firmware
and other prebuilts. We also don't care about these
binaries for the 16 KB page size project.
So ignore 32-bit page sizes here.
Bug: 383003132
Test: build
Change-Id: I577fb78e3a968ceda4c071c5a12baaf8318ca479
diff --git a/tools/check_elf_file.py b/tools/check_elf_file.py
index 1fd7950..0640041 100755
--- a/tools/check_elf_file.py
+++ b/tools/check_elf_file.py
@@ -42,8 +42,9 @@
_EM_X86_64 = 62
_EM_AARCH64 = 183
-_KNOWN_MACHINES = {_EM_386, _EM_ARM, _EM_X86_64, _EM_AARCH64}
-
+_32_BIT_MACHINES = {_EM_386, _EM_ARM}
+_64_BIT_MACHINES = {_EM_X86_64, _EM_AARCH64}
+_KNOWN_MACHINES = _32_BIT_MACHINES | _64_BIT_MACHINES
# ELF header struct
_ELF_HEADER_STRUCT = (
@@ -483,6 +484,11 @@
sys.exit(2)
def check_max_page_size(self, max_page_size):
+ if self._file_under_test.header.e_machine in _32_BIT_MACHINES:
+ # Skip test on 32-bit machines. 16 KB pages is an arm64 feature
+ # and no 32-bit systems in Android use it.
+ return
+
for alignment in self._file_under_test.alignments:
if alignment % max_page_size != 0:
self._error(f'Load segment has alignment {alignment} but '