ungoogled-software / ungoogled-chromium-android

Android build for ungoogled-chromium
GNU General Public License v3.0
495 stars 42 forks source link

is_cfi=true cause Dex error #107

Closed wchen342 closed 3 years ago

wchen342 commented 3 years ago

Was investigating enabling is_cfi on release builds. However the build will crash with

AppCompatDelegate: java.lang.ClassNotFoundException: Didn't find class "com.google.android.material.theme.MaterialComponentsViewInflater" on path: DexPathList[[zip file "/data/app/org.ungoogled.chromium.stable-1/base.apk", zip file "/data/app/org.ungoogled.chromium.stable-1/split_config.en.apk", zip file "/data/app/org.ungoogled.chromium.stable-1/split_extra_icu.apk"],nativeLibraryDirectories=[/data/app/org.ungoogled.chromium.stable-1/lib/arm64, /data/app/org.ungoogled.chromium.stable-1/base.apk!/lib/arm64-v8a, /data/app/org.ungoogled.chromium.stable-1/split_config.en.apk!/lib/arm64-v8a, /data/app/org.ungoogled.chromium.stable-1/split_extra_icu.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]

The error seems to have something to do with proguard. Not sure why C++ linkage time change will cause Java failure.

wchen342 commented 3 years ago

is_cfi only seems to run fine. It was one of use_cfi_cast or use_cfi_icall that caused the problem.

Misc: use_cfi_diag doesn't seem to work. libclang_rt.ubsan_standalone-aarch64-android.so coming with NDK's clang 12 toolchain failed with wrong ELF magic number.

wchen342 commented 3 years ago

use_cfi_icall seems to be the cause. Without use_cfi_diag it is impossible to diagnose further unfortunately, but is_cfi can be experimentally enabled from now on.

There is also https://github.com/bromite/bromite/issues/357 but ThinLTO is now enabled by default and video playback is fixed with AImageReader patch so there shouldn't be crashes anymore. Video playback arm64 tested on Sony L2/XZ1 and worked fine.