Status Update
Comments
[Deleted User] <[Deleted User]> #2
Hi,
I suppose a workaround for your crash would be to use -mstackrealign.
Can you give it a try and confirm?
I suppose a workaround for your crash would be to use -mstackrealign.
Can you give it a try and confirm?
di...@gmail.com <di...@gmail.com> #3
Hi Xavier,
You are correct. Recompilation with -mstackrealign fixes the problem. Tested with clang and gcc 4.9.
Shouldn't this option be enabled by default for x86 ABI?
You are correct. Recompilation with -mstackrealign fixes the problem. Tested with clang and gcc 4.9.
Shouldn't this option be enabled by default for x86 ABI?
xh...@novetys.com <xh...@novetys.com> #4
[Comment deleted]
[Deleted User] <[Deleted User]> #5
Thanks for the confirmation!
mstackrealign seems to have been removed for performance reasons.
but your report shows that x86 devices (pre-kitkat?) are still calling NDK code with non-16-byte-aligned stack, leading to crashes.
So yes, I agree that when compiling against android-9 (<=14?) platform, it should be the default.
mstackrealign seems to have been removed for performance reasons.
but your report shows that x86 devices (pre-kitkat?) are still calling NDK code with non-16-byte-aligned stack, leading to crashes.
So yes, I agree that when compiling against android-9 (<=14?) platform, it should be the default.
ks...@google.com <ks...@google.com>
da...@google.com <da...@google.com> #8
Actually, this is low risk enough that I'm cherry-picking it into r13.
da...@google.com <da...@google.com> #9
We're seeing this on newer devices too, so this flag is going to be applied to x86 regardless of target API level: https://android-review.googlesource.com/c/297957/
da...@google.com <da...@google.com> #10
da...@google.com <da...@google.com> #12
jomof/chiur: The fix for this only affects ndk-build. I've asked srhines to update the Clang driver to always pass this for Android, but that won't land until r14 at the earliest. Do we want to apply this to gradle/cmake as well?
ta...@gmail.com <ta...@gmail.com> #14
Yes can confirm -mstackrealign fixes the problem (it was in merged issue 36949180 )
da...@google.com <da...@google.com> #15
Glad to hear it. This fix is partially applied in r13 (as long as you're targeting API 19 or lower), and the full thing will be in r14.
Description
signal 11 (SIGSEGV), code 128 (SI_KERNEL), fault addr 00000000
Debugging with gdb shows that the app fails due to a misalignment for instruction MOVAPS:
=> 0x79413b59 <+249>: movaps %xmm2,-0x58(%ebp)
ebp 0x79c676e4 0x79c676e4
The instruction MOVAPS requires 16 byte aligned data. Obviously -0x58(%ebp) is not aligned.
0x79c676e4 – 0x58 = 0x79C6768C
We are using NDK (ndk-build) and clang as compile tool chain. The error also happens with the GCC 4.9 compiler but on a different location.
Build system:
Windows 10 64 bit
NDK r12b
(android-ndk-r12b-windows-x86_64.zip)
Test Device:
Asus Memo Pad FHD 10
CPU Intel Atom Z2560 1.6GHz
Android 4.3
(also failed on a ASUS Fonepad but is working in x86 emulator)
Compiler settings general:
APP_ABI := x86
APP_STL := gnustl_static
APP_PLATFORM := android-9
LOCAL_CFLAGS += -Os –DNDEBUG
LOCAL_CFLAGS += -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32
Compiler Settings CLANG:
NDK_TOOLCHAIN_VERSION := clang
Compiler Settings GCC:
NDK_TOOLCHAIN_VERSION := 4.9
Please find the full gdb logs attached.