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

查看:28
本文介绍了使用 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:在函数‘__bswap_32’中:/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h:45:1:抱歉,未实现:Thumb-1 hard-floatVFP 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: 错误:prog 使用 VFP 寄存器参数,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: 无法合并文件 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天全站免登陆