From 767bec7f40d5ea99173d9f5da594a70532004b12 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Wed, 21 Jan 2026 17:37:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=A3=80=E6=9F=A5AAB?= =?UTF-8?q?=E4=B8=ADso=E6=96=87=E4=BB=B616KB=E5=AF=B9=E9=BD=90=E7=9A=84?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加一个Python脚本用于检查AAB文件中arm64-v8a架构的.so文件是否满足16KB内存对齐要求 --- check_16kb.py | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 check_16kb.py diff --git a/check_16kb.py b/check_16kb.py new file mode 100644 index 000000000..d039b3e3f --- /dev/null +++ b/check_16kb.py @@ -0,0 +1,86 @@ +import zipfile +import struct +import sys +import os + +def check_so_alignment(aab_path): + print(f"Checking AAB: {aab_path}") + + try: + with zipfile.ZipFile(aab_path, 'r') as z: + so_files = [f for f in z.namelist() if f.endswith('.so') and 'arm64-v8a' in f] + + if not so_files: + print("No arm64-v8a .so files found in the AAB.") + return + + print(f"Found {len(so_files)} arm64-v8a .so files.") + + issues = [] + + for so_name in so_files: + with z.open(so_name) as f: + data = f.read() + + # Check ELF magic + if data[:4] != b'\x7fELF': + print(f"Skipping {so_name}: Not an ELF file") + continue + + # Check class (64-bit) + if data[4] != 2: + print(f"Skipping {so_name}: Not a 64-bit ELF") + continue + + # Parse ELF Header (Elf64_Ehdr) + # e_phoff is at offset 32 (0x20), 64-bit unsigned + e_phoff = struct.unpack('") + sys.exit(1) + + check_so_alignment(sys.argv[1])