Skip to content

libLiteRtOpenClAccelerator.so in litert:2.1.0/2.1.1 has misaligned LOAD segment — fails Android 16KB page size compatibility check #6299

@Shivani3192

Description

@Shivani3192

Library Version
com.google.ai.edge.litert:litert:2.1.0 and 2.1.1

Platform

Android (arm64-v8a)
Affected file: jni/arm64-v8a/libLiteRtOpenClAccelerator.so

Description
The libLiteRtOpenClAccelerator.so bundled in litert:2.1.0/2.1.1 fails Android's 16KB page size compatibility check. While libLiteRt.so in the same release is correctly aligned, libLiteRtOpenClAccelerator.so has a LOAD segment whose offset is not a multiple of its required alignment (0x4000 = 16KB).
This is critical because Google Play Store mandates 16KB alignment for all .so files from August 2025. Apps using litert:2.1.0/2.1.1 with GPU/OpenCL acceleration will be rejected by Play Store.

Steps to Reproduce

Add com.google.ai.edge.litert:litert:2.1.0/2.1.1 to your Android project
Build the APK
Extract libLiteRtOpenClAccelerator.so from the APK
Run the following command:

llvm-readelf -l path/to/libLiteRtOpenClAccelerator.so


---

**Actual Output**

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x0001f8 0x0001f8 R 0x8
LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x27e6a0 0x27e6a0 R E 0x4000
LOAD 0x280000 0x0000000000280000 0x0000000000280000 0x00b008 0x00c000 RW 0x4000
LOAD 0x28b008 0x000000000028f008 0x000000000028f008 0x001730 0x0318f8 RW 0x4000 ← ❌
DYNAMIC 0x288d30 0x0000000000288d30 0x0000000000288d30 0x000210 0x000210 RW 0x8
GNU_RELRO 0x280000 0x0000000000280000 0x0000000000280000 0x00b008 0x00c000 R 0x1
GNU_EH_FRAME 0x07a344 0x000000000007a344 0x000000000007a344 0x01b32c 0x01b32c R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x0
NOTE 0x000238 0x0000000000000238 0x0000000000000238 0x0000b8 0x0000b8 R 0x4


---

**Root Cause**

The 3rd `LOAD` segment has `Offset=0x28b008` which is **not a multiple of `0x4000`** (16KB):

0x28b008 % 0x4000 = 8 ← should be 0 for 16KB alignment ❌


Compared to correctly aligned segments:

0x000000 % 0x4000 = 0 ✅
0x280000 % 0x4000 = 0 ✅
0x28b008 % 0x4000 = 8 ❌


---

**Expected Output**

All `LOAD` segment offsets should be multiples of `0x4000`:

0x28b008 → should be 0x28c000 or next valid 16KB boundary

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions