-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[android] Workaround ARMv5 ABI errors #5254
Conversation
69f0f80
to
48e0e0d
Compare
@tmpsantos first tests are looking promising but I was able to run into a crash with the Polygon activity: 06-06 17:57:12.343 20676-20676/com.mapbox.mapboxsdk.testapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 20676 (pboxsdk.testapp)id=10217 gid=10217 tid=20676
06-06 17:57:12.441 21820-21820/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-06 17:57:12.449 21820-21820/? A/DEBUG: Build fingerprint: 'google/angler/angler:N/NPD35K/2864170:user/release-keys'
06-06 17:57:12.449 21820-21820/? A/DEBUG: Revision: '0'
06-06 17:57:12.449 21820-21820/? A/DEBUG: ABI: 'arm'
06-06 17:57:12.449 21820-21820/? A/DEBUG: pid: 20676, tid: 20676, name: pboxsdk.testapp >>> com.mapbox.mapboxsdk.testapp <<<
06-06 17:57:12.449 21820-21820/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
06-06 17:57:12.449 21820-21820/? A/DEBUG: r0 00000000 r1 fffffff0 r2 00000000 r3 00000000
06-06 17:57:12.449 21820-21820/? A/DEBUG: r4 ffdde590 r5 ffdde58c r6 ffdde588 r7 00000000
06-06 17:57:12.449 21820-21820/? A/DEBUG: r8 ffdde57c r9 c5b06761 sl 00000031 fp ffdde3b0
06-06 17:57:12.449 21820-21820/? A/DEBUG: ip c9f50e14 sp ffdde390 lr c9996e98 pc c9997408 cpsr 600f0010
06-06 17:57:12.472 21820-21820/? A/DEBUG: backtrace:
06-06 17:57:12.473 21820-21820/? A/DEBUG: #00 pc 00467408 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN6mapbox8geometryneIdEEbRKNS0_5pointIT_EES6_+24)
06-06 17:57:12.473 21820-21820/? A/DEBUG: #01 pc 00466e94 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZNK4mbgl11ToGeoJSONVT13convertPointsEN6mapbox9geojsonvt20ProjectedFeatureTypeERKNSt3__16vectorINS1_8geometry5pointIdEENS4_9allocatorIS8_EEEE+944)
06-06 17:57:12.473 21820-21820/? A/DEBUG: #02 pc 00465c88 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZNK4mbgl11ToGeoJSONVTclERKN6mapbox8geometry7polygonIdNSt3__16vectorEEE+444)
06-06 17:57:12.473 21820-21820/? A/DEBUG: #03 pc 00465a78 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN6mapbox4util6detail10dispatcherIN4mbgl11ToGeoJSONVTENS0_7variantIJNS_8geometry11line_stringIdNSt3__16vectorEEENS6_7polygonIdS9_EENS6_17multi_line_stringIdS9_EENS6_13multi_polygonIdS9_EEEEENS_9geojsonvt16ProjectedFeatureEJSC_SE_SG_EE11apply_constERKSH_OS4_+84)
06-06 17:57:12.473 21820-21820/? A/DEBUG: #04 pc 00465660 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN6mapbox4util6detail10dispatcherIN4mbgl11ToGeoJSONVTENS0_7variantIJNS_8geometry11line_stringIdNSt3__16vectorEEENS6_7polygonIdS9_EENS6_17multi_line_stringIdS9_EENS6_13multi_polygonIdS9_EEEEENS_9geojsonvt16ProjectedFeatureEJSA_SC_SE_SG_EE11apply_constERKSH_OS4_+112)
06-06 17:57:12.473 21820-21820/? A/DEBUG: #05 pc 0045b07c /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN6mapbox4util7variantIJNS_8geometry11line_stringIdNSt3__16vectorEEENS2_7polygonIdS5_EENS2_17multi_line_stringIdS5_EENS2_13multi_polygonIdS5_EEEE5visitIN4mbgl11ToGeoJSONVTESD_NS_9geojsonvt16ProjectedFeatureEEEDTclsr6detail10dispatcherIT_T0_T1_S6_S8_SA_SC_EE11apply_constfp_clsr3stdE7forwardISJ_Efp0_EEERKSK_OSJ_+36)
06-06 17:57:12.473 21820-21820/? A/DEBUG: #06 pc 00459ca8 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN4mbgl19ShapeAnnotationImpl10updateTileERKNS_15CanonicalTileIDERNS_14AnnotationTileE+272)
06-06 17:57:12.473 21820-21820/? A/DEBUG: #07 pc 00407334 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN4mbgl17AnnotationManager7getTileERKNS_15CanonicalTileIDE+1524)
06-06 17:57:12.474 21820-21820/? A/DEBUG: #08 pc 00409308 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN4mbgl17AnnotationManager11updateStyleERNS_5style5StyleE+5592)
06-06 17:57:12.474 21820-21820/? A/DEBUG: #09 pc 004a2a04 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN4mbgl3Map4Impl6updateEv+348)
06-06 17:57:12.474 21820-21820/? A/DEBUG: #10 pc 004ad25c /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
06-06 17:57:12.474 21820-21820/? A/DEBUG: #11 pc 004ad184 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
06-06 17:57:12.474 21820-21820/? A/DEBUG: #12 pc 004b5460 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZNKSt3__18functionIFvvEEclEv+148)
06-06 17:57:12.474 21820-21820/? A/DEBUG: #13 pc 00708920 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN4mbgl4util9AsyncTask4Impl7runTaskEv+124)
06-06 17:57:12.474 21820-21820/? A/DEBUG: #14 pc 0070a408 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN4mbgl4util7RunLoop4Impl16processRunnablesEv+788)
06-06 17:57:12.474 21820-21820/? A/DEBUG: #15 pc 0070b9f4 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so (_ZN4mbgl4util7RunLoop7runOnceEv+288)
06-06 17:57:12.474 21820-21820/? A/DEBUG: #16 pc 00709174 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
06-06 17:57:12.475 21820-21820/? A/DEBUG: #17 pc 00011d4b /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+610)
06-06 17:57:12.475 21820-21820/? A/DEBUG: #18 pc 00011a5b /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
06-06 17:57:12.475 21820-21820/? A/DEBUG: #19 pc 0008de71 /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
06-06 17:57:12.475 21820-21820/? A/DEBUG: #20 pc 01df69f5 /system/framework/arm/boot-framework.oat (offset 0x164f000) Need to look into if this is also happening on Master. update also happening with Polyline/Directions activity. |
😢 Is there somewhere to report these bugs upstream, so that we can maybe eventually phase out these workarounds? |
Yes, android toolchain bugtracker. Will do it as soon as it is 100% fixed and tested. |
They are not supported by ARMv5 and the compiler is generating bogus code. std::atomic might be implemented lock-free for some types, but we are going to introduce a naive polyfill to make sure that doesn't happen on ARMv5 (only).
std::atomic<bool> is implemented lock free which doesn't work on ARMv5 and seems like the compiler is generating bogus code. This workaround is a naive implementation using regular mutexes.
ARMv5 doesn't have a FPU and apparently the soft code for log2() is wrong and giving weird results. log() works, so we use a log() based log2() implementation for ARMv5.
48e0e0d
to
313d9ce
Compare
I checked and it is also happening on the master branch + ARMv7 build. Not related to this one. |
Backported patches fixing ARMv5 support for issue #3985.
Android upstream issues for the record: |
@tmpsantos Since these are NDK issues, you might get a more timely response if you post them to https://github.com/android-ndk/ndk/issues. |
upstream issue is android/ndk#31 |
Above bug is fixed in NDK r12. Does that mean we can revert our workarounds after upgrading to r12? |
Yes, just tested here. Revert on #5675. |
Added polyfills for classes and functions that are buggy on ARMv5 binaries running on ARMv7+ phones.
Fixes #3985