Android NDK SIGILL 在 ARMv6 设备上的 fpu 指令上崩溃
我正在使用 APP_ABI=armeabi 编译 NDK 项目以针对 ARMv5 cpu。我有处理浮点的代码,当在低端 HTC Wildfire ARMv6 设备上运行时,我发现 SIGILL 崩溃。
反汇编二进制文件表明它在这里崩溃了
4397a8: ed9f7b18 vldr d7, [pc, #96]
为什么当我指定 APP_ABI=armeabi 时 NDK 生成 fp 指令,不是应该是 eabi 调用,而不是显式的 neon 代码?为了排除故障,我什至将其添加到 mk 文件中:
LOCAL_CFLAGS := -mfloat-abi=softfp -msoft-float -mfpu=vfp
但它仍然生成上面的二进制代码。我应该指定什么参数来确保我的浮点指令实际上生成软代码?或者,这个设备完全坏了吗?这是CPU信息:
>adb shell getprop | grep abi
[ro.product.cpu.abi]: [armeabi]
>adb shell cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 2 (v6l)
BogoMIPS : 244.94
Features : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 2
Hardware : buzz
Revision : 0081
Serial : 0000000000000000
I am compiling an NDK project using APP_ABI=armeabi to target ARMv5 cpu. I have code that deals with floating points, and when running on a low-end HTC Wildfire ARMv6 device, I see that I get a crash with SIGILL.
Disassembling the binary shows that it crashes exactly here
4397a8: ed9f7b18 vldr d7, [pc, #96]
Why is the NDK generating fp instruction when I specified APP_ABI=armeabi, isn't is supposed to be eabi calls, not explicitly neon code? To troubleshoot I even added this to the mk file:
LOCAL_CFLAGS := -mfloat-abi=softfp -msoft-float -mfpu=vfp
Yet it still generates the binary code above. What parameter should I specify to make sure my float instructions actually generate soft code? Or, is this device just completely broken? Here's the CPU info:
>adb shell getprop | grep abi
[ro.product.cpu.abi]: [armeabi]
>adb shell cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 2 (v6l)
BogoMIPS : 244.94
Features : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 2
Hardware : buzz
Revision : 0081
Serial : 0000000000000000
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请运行 ndk-build -BV=1 命令并发布输出。否则我们无法看到编译过程中使用的真正的编译器标志。
无论如何,
-mfloat-abi=softfp
标志表示硬件浮点。要强制软件模拟,您应该使用-mfloat-abi=soft
选项。Please run
ndk-build -B V=1
command and post the output. Otherwise we can't see real compiler flags used during the compilation.Any way,
-mfloat-abi=softfp
flag means hardware floating point. To force software emulation you should use-mfloat-abi=soft
option.