使用gnueabihf为ARMv6构建 [英] build for ARMv6 with gnueabihf

查看:145
本文介绍了使用gnueabihf为ARMv6构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试为ARMv6构建应用程序,但是失败.

I try to build an app for ARMv6 but, fail.

我想问题出在工具链上,它支持Hard Float,但是ARMv6不支持.

I guess the problem is the Toolchain which supports Hard Float but, ARMv6 does not.

好吧,首先我设置-march = armv6,编译失败.

Well, first i set -march=armv6, where compilation fails.

/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h: In function ‘__bswap_32’: /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h:45:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI

/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h: In function ‘__bswap_32’: /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h:45:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI

此外,我设置了-mfloat-abi = soft,这使链接程序抱怨:

Additionally, i set -mfloat-abi=soft which make the Linker complain:

/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: error: prog uses VFP register arguments, prog.o does not /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: failed to merge target specific data of file prog.o

/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: error: prog uses VFP register arguments, prog.o does not /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: failed to merge target specific data of file prog.o

那么,我实际上如何为ARMv6进行构建? 还是工具链中存在错误?

Well, how do i actually build for ARMv6? Or is there a bug in the Toolchain?

推荐答案

默认情况下,您的工具链配置为发出Thumb代码.这样做的问题在于,浮点指令的唯一Thumb编码是32位Thumb-2编码,就所有目的和目的而言,它们仅存在于ARMv7或更高版本的 * 上,并且肯定不是在普通的ARMv6上可用.

Your toolchain is configured to emit Thumb code by default. The issue with that is that the only Thumb encodings of floating-point instructions are 32-bit Thumb-2 ones, which to all intents and purposes only exist on ARMv7 or later*, and certainly aren't available on plain ARMv6.

要针对v7之前的体系结构,最好不要使用-marm进行编译以生成ARM代码,而不要使用相对有限的16位Thumb指令集.

To target pre-v7 architectures, you're best off compiling with -marm to generate ARM code instead of the relatively limited set of 16-bit Thumb instructions.

*我怀疑大多数人永远不会有意识地遇到ARM1156.

这篇关于使用gnueabihf为ARMv6构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆