现在的位置: 首页 > 综合 > 正文

ARM工具链的eabi规范

2016年07月24日 ⁄ 综合 ⁄ 共 4922字 ⁄ 字号 评论关闭

在移植uboot时出现uboot运行循环打印raise:signal #8 caught的现象。

追踪发现打印来自于arch/arm/lib/eabi_compat.c中的raise函数,何处调用的raise函数还没查到,但是查看Makefile发现

# For EABI conformant tool chains, provide eabi_compat()
ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
extra-y += eabi_compat.o
endif

意思是对于支持eabi的工具链则需要编译eabi_compat.c

百度eabi,百度百科中的解释如下:

应用程序二进制接口(application binary interface,ABI) 描述了应用程序和操作系统之间,一个应用和它的库之间,或者应用的组成部分之间的低层接口。ABI不同于应用程序接口(API),API定义了源代码和库之间的接口,因此同样的代码可以在支持这个API的任何系统中编译,然而ABI允许编译好的目标代码在使用兼容ABI的系统中无需改动就能运行。
  ABI掩盖了各种细节,例如:调用约定(控制着函数的参数如何传送以及如何接受返回值);系统调用的编码和一个应用如何向操作系统进行系统调用;以及在一个完整的操作系统ABI中,对象文件的二进制格式、程序库等等。一个完整的ABI,像Intel二进制兼容标准 (iBCS) ,允许支持它的操作系统上的程序不经修改在其他支持此ABI的操作体统上运行。其他的 ABI 标准化细节包括 C++ name decoration 和同一个平台上的编译器之间的调用约定,但是不包括跨平台的兼容性。

在搜索搜出来的一些说法如下:

EABI(Embedded Application Binary Interface),嵌入式应用程序二进制接口。

 

ABI的定义

ABI描述应用程序与操作系统、应用程序与库、应用程序的组成部分之间的低层接口。ABI允许编译好的目标代码在使用兼容ABI的系统中无需改动就能运行。

 

EABI的具体定义

Codesourcery上有一个这样的QA:

https://support.codesourcery.com/GNUToolchain/kbentry32

Question

What is the ABI for the ARM Architecture? Is it the same as the ARM EABI?

Answer

The ABI for the ARM Architecture is a standard developed by ARM and its partners that explains how compilers, assemblers, linkers, and other similar tools should generate object files and executable files.

Tools that correctly implement the ABI for the ARM Architecture can interoperate; i.e., object files built with one toolchain can be combined with object files built with another toolchain if both compilers use the ABI for the
ARM Architecture and provided that the code compiled observes certain conventions.

CodeSourcery was an active participant in the design of the ABI for the ARM Architecture. (In fact, the C++ ABI used by ARM is derived from the Itanium C++ ABI co-designed by CodeSourcery.) CodeSourcery continues to work with
ARM, Ltd. to validate interoperability between Sourcery G++ and ARM's proprietary tools.

The "ARM EABI" is an informal name for the ABI for the ARM Architecture.

 

The "ARM EABI" is an informal name for the ABI for the ARM Architecture.

这里提到了所谓的ARM EABI就是针对 ARM 体系结构的应用程序二进制接口的非正式名称

 

在arm的infocenter可以找到ABI for the ARM architecture的相关文档:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.swdev.abi/index.html

  

“用于针对ARM体系结构的应用程序二进制接口(ABI)的ARM文档集,这些接口包括ARM 过程调用标准(APCS)、ARM ELF、ARM DWARF、基础平台ABI(BPABI)、C++ ABI、异常处理ABI、运行时ABI和C库ABI。” 

 

在文档的Terms and abbreviations中有:

 

AEABI  (Embedded) ABI for the ARM architecture (this ABI…) 

 

也证实了EABI就是Application Binary Interface for the ARM Architecture

 

EABI的内容 

ABI for the ARM architecture是很多规范的合集:

AADWARF      DWARF for the ARM Architecture

AAELF         ELF for the ARM Architecture

AAPCS         Procedure Call Standard for the ARM Architecture

ADDENDA      Addenda to, and errata in, the ABI for the ARM Architecture

BPABI          Base Platform ABI for the ARM Architecture

BSABI          ABI for the ARM Architecture (Base Standard)

CLIBABI        C Library ABI for the ARM Architecture

CPPABI         C++ ABI for the ARM Architecture

EHABI          Exception Handling ABI for the ARM Architecture

EHEGI          Exception handling component specimen implementations

RTABI            Run-time ABI for the ARM Architecture

 

EABI的作用

EABI的目的是使不同的编译器编译出来的二进制文件可以互相使用(interoperability),比如Codesourcery, RVCT, RVDS这些编译器。符合EABI标准编译器编译出的库可以相互链接,这样软件开发人员就可以混合使用不同厂商提供的符合EABI标准的二进制库。

 

下面内容来自http://www.arm.com/community/software-enablement/linux.php?language=zh

“ARM 有助于 GNU 编译器项目,该项目跟踪 ARM 体系结构的发展,并确保为 ARM 提供高质 GNU 工具链。

该工具链支持目前的所有 ARM 体系结构和处理器(包括 Thumb-2 指令集和 ARM 体系结构第 7 版),并计划支持将来的处理器和体系结构。

该工具链符合最新的 ARM 应用程序二进制接口,因此可与 ARM
RealView Development Suite
 或符合 ABI 的任何其他工具链交互工作。用户可以配合使用 ARM 提供的商用、专业工具链的已优化代码大小与性能以及使用开源工具生成的代码。

可从 CodeSourcery 访问 GNU 编译器的源代码和预置版本,网址为:http://www.codesourcery.com/gnu_toolchains/arm

 

当然,EABI相对于以前的ABI性能也会改善。

 

EABI相对于以前的ABI的改进

Differences between v1 and v2 of the ABI for the ARM Architecture列出了ABI for the ARM Architecture V1和V2两个版本的不同,这里的ABI for the ARM Architecture V2就是EABI,V1也被称作Old ABI 或者Lagacy ABI。EABI是2005年推出的,新是相对于以前的“老”而言,从时间上看其实已经很“老”了——所以很多这些所谓的“改变”,其实现在已经是标准做法了,例如Exception
Handling ABI的改进使浮点数的性能的改善,堆栈的8字节对齐,structure packing的改变等等。

 

GNU EABI 

在很多地方有GNU EABI的说法,这是一个不同的ABI吗?

还是Codesourcery上的QA:

http://www.codesourcery.com/sgpp/lite/arm/portal/kbentry38

Question

Why is the configuration name for GNU/Linux arm-none-linux-gnueabi instead of just arm-none-linux-eabi? Is there a GNU variant of the EABI?

Answer

The Free Software Foundation prefers that configuration names for GNU/Linux contain both the string linux and the string gnu. The configuration arm-none-linux-gnu refers to the legacy ARM ABI for GNU/Linux. Some tools depend on
the fact that configuration names have at most three hyphens, so gnu and eabi were combined into a single word.

The ABI used on GNU/Linux is not a special GNU variant of the EABI; it is just the EABI.

 

GNU EABI就是EABI,ABI for the ARM architecture。

 

相关资料

Debian Wiki: ArmEabiPort

http://wiki.debian.org/ArmEabiPort/

Codesourcery上的ARM架构FAQ

http://www.codesourcery.com/sgpp/lite/arm/portal/target_arch?@action=faq&target_arch=arm

Wikipedia上的ABI

http://en.wikipedia.org/wiki/Application_binary_interface

CSDN hongjiujing的总结:ABI/EABI/OABI

http://blog.csdn.net/hongjiujing/archive/2008/07/21/2686556.aspx

EABI对浮点数性能的改善:Why ARM's EABI Matters

http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Why-ARMs-EABI-matters/

 

大体明白eabi是arm嵌入式系统的二进制程序接口。

抱歉!评论已关闭.