Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[android] Workaround ARMv5 ABI errors - #5254

Merged
tmpsantos merged 3 commits into
masterfrom
tmpsantos-armv5_clang
Jun 6, 2016
Merged

tmpsantos merged 3 commits into
masterfrom
tmpsantos-armv5_clang

Conversation

@tmpsantos

Copy link
Copy Markdown
Contributor

Added polyfills for classes and functions that are buggy on ARMv5 binaries running on ARMv7+ phones.

Fixes #3985

@tmpsantos

Copy link
Copy Markdown
Contributor Author

👀 @tobrun @bleege @jfirebaugh

@tobrun

tobrun commented Jun 6, 2016

Copy link
Copy Markdown
Member

@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.
At this point I'm thinking it's related to shape annotations.

@jfirebaugh

Copy link
Copy Markdown
Contributor

😢

Is there somewhere to report these bugs upstream, so that we can maybe eventually phase out these workarounds?

@tmpsantos

Copy link
Copy Markdown
Contributor Author

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.

tmpsantos added 3 commits June 6, 2016 22:19
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.
@tmpsantos
tmpsantos force-pushed the tmpsantos-armv5_clang branch from 48e0e0d to 313d9ce Compare June 6, 2016 19:19
@tmpsantos
tmpsantos merged commit 313d9ce into master Jun 6, 2016
@tmpsantos
tmpsantos deleted the tmpsantos-armv5_clang branch June 6, 2016 19:22
@tmpsantos

tmpsantos commented Jun 6, 2016 •

Copy link
Copy Markdown
Contributor Author

Need to look into if this is also happening on Master.

I checked and it is also happening on the master branch + ARMv7 build. Not related to this one.

@bleege bleege added the Android Mapbox Maps SDK for Android label Jun 6, 2016
tmpsantos added a commit that referenced this pull request Jun 6, 2016
Backported patches fixing ARMv5 support for issue #3985.
@jfirebaugh

Copy link
Copy Markdown
Contributor

@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.

@kkaefer

kkaefer commented Jul 1, 2016

Copy link
Copy Markdown
Member

upstream issue is android/ndk#31

@jfirebaugh

Copy link
Copy Markdown
Contributor

Above bug is fixed in NDK r12. Does that mean we can revert our workarounds after upgrading to r12?

@tmpsantos

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Android Mapbox Maps SDK for Android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants