-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
armeabi libatomic.a uses ifuncs #31
Comments
Most likely this is a dup of http://b.android.com/181517. I assume this was |
@DanAlbert I cannot open your link. It was Edit: http version of link works for me. |
Oops. Link fixed, but I guess not then... |
Well, the libc++ + clang version crashed with SIGSEGV immediately when calling native method and stack trace was completely wrong. Hopefully I will have time to investigate this further next week and probably prepare some sample. |
E/AndroidRuntime( 5460): FATAL EXCEPTION: main Relocation 160 is an ifunc. After some readelf and some objdump, tracked that down to libatomic. Android doesn't support ifuncs until M, so this is going to require a fix to GCC... |
A little more testing shows that this is specific to GCC, which is why the libc++ test suite didn't catch it (we don't run the tests with GCC yet because our version of libc++ is far too old for the test suite to be very GCC compatible). |
Maybe the title should be updated, this is much worse than the title implies: The failure isn't limited to libc++ runtime, and it affects android up until 5.0 (not just the rather old 2.3). Would it be possible to recompile libatomic with HAVE_IFUNC=false? After a cursory look it appears to support that. |
Yeah, the fix is nearly done. The changes to our GCC were https://android-review.googlesource.com/#/c/210660/ and https://android-review.googlesource.com/#/c/212250/. I just need to actually pull the new prebuilts into the NDK. Updated the title to reflect the issue more clearly. |
Just as an FYI, not clear if this will be in the r12 beta that I'll be kicking out in a couple weeks, but it will definitely be in the r12 release in June. |
@DanAlbert, we didn't experience that crash on Android 4.0, 4.1 and 4.4 - only on 2.3. Are you sure this affects all android versions up until 5.0? EDIT: sorry, I didn't notice that this is solely an armeabi issue (i.e. not present in armeabi-v7a and x86, which we used for testing on 4.0, 4.1 and 4.4). |
Fix is in for r12. |
The version of libatomic we have from GCC uses ifuncs for some functions, which are not supported on anything but the latest versions of Android. GCC ends up using these functions when using libc++, so GCC+libc++ libraries will not be able to load on most devices. Bug: http://b/22699878 Bug: #31 Change-Id: I90ddc472685d016db76690773ab47da44ddc1037
Bug: http://b/26085687 Bug: http://b/22699878 Bug: #31 Change-Id: Iac37f5b8657c12c082838caedacb068b5b2dd7cf
Got fix on r12. android/ndk#31
When compiling our app with libc++ runtime and clang, as soon as first native method is called, we get a SIGSEGV with invalid stack trace (stack trace points to file and line number which can be reached only from completely different JNI method).
When using libc++ + GCC, app crashes when attempting to throw c++ exception.
GNU STL + clang and GNU STL + GCC combinations work correctly. We've tested on Samsung Galaxy Ace: armeabi ABI + Android 2.3 (API level 10).
The text was updated successfully, but these errors were encountered: