Commit 4353488
authored
fix: remove redundant -Wl,-z,relro,-z,now to fix UnsatisfiedLinkError on 16k-page-size builds (#563)
* fix: remove -Wl,-z,relro,-z,now to fix UnsatisfiedLinkError on 16k-page-size builds
Fixes #562 — crash on Samsung S21 Plus (Android 14) with 3.1.1-16k-min:
dlopen failed: can't enable GNU RELRO protection for libCGEExt.so: Out of memory
Root cause:
target_link_options(CGE PUBLIC ... -Wl,-z,relro,-z,now) propagated these
flags to CGEExt via PUBLIC linkage. With 16KB page alignment enabled, the
linker pads PT_GNU_RELRO to 16KB boundaries, making MemSiz (~10KB) far
exceed the actual RW LOAD segment size (~1.5KB). The Android dynamic linker
then calls mprotect() over a region larger than what was mapped, which fails
with ENOMEM on devices under memory pressure.
Android (API 23+) enforces full RELRO by default; these flags are redundant.
Changes:
- CMakeLists.txt: remove -Wl,-z,relro,-z,now; change scope to PRIVATE so
the remaining -fPIE -fPIC -pie flags do not propagate unnecessarily.
The -Wl,-z,max-page-size=16384 block retains PUBLIC scope so CGEExt
inherits 16KB alignment automatically via CMake interface propagation.
- cgeDemo/build.gradle: add disableVideoModule() helper and make the
testDemoWithGradleLibs dependency string dynamic (supports all four
AAR variants: default, -16k, -min, -16k-min)."
* fix: address review comments in CMakeLists.txt
- Remove redundant Chinese comment '# 非 Debug 模式下添加 -O3' (keep English only)
- Fix full-width comma (U+FF0C) to ASCII comma in RELRO note comment
- Remove target_link_options(CGE PRIVATE -fPIE -fPIC -pie): these flags are
inappropriate/redundant for a SHARED library; CMake handles -fPIC automatically
* chore: bump version to 3.1.21 parent c494765 commit 4353488
File tree
4 files changed
+19
-4
lines changed- cgeDemo
- library/src/main/jni
4 files changed
+19
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
58 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
59 | 69 | | |
60 | 70 | | |
61 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
0 commit comments