ARM ABI 和 EABI 的用途是什么? [英] What are the purposes of the ARM ABI and EABI?

查看:23
本文介绍了ARM ABI 和 EABI 的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我越看这个 PDF (应用程序二进制接口ARM 架构:基本标准)我越不理解它的含义.我还想对 ARM 架构的过程调用标准用于 ARM 架构的 ELF.

The more I look at this PDF (Application Binary Interface for the ARM Architecture: The Base Standard) the less I understand what it means. Also I'd like some comments on Procedure Call Standard for the ARM Architecture and ELF for the ARM Architecture.

推荐答案

ABI(Application Binary Interface)是定义低级概念之间映射的标准高级语言和特定硬件/操作系统平台机器代码的能力.这包括:

An ABI (Application Binary Interface) is a standard that defines a mapping between low-level concepts in high-level languages and the abilities of a specific hardware/OS platform's machine code. That includes things like:

  • C/C++/Fortran/...数据类型在内存中的布局方式(数据大小/对齐方式)
  • 嵌套函数调用的工作原理(关于如何返回函数调用者的信息的存储位置和方式,CPU 寄存器和/或内存函数参数的传递位置)
  • 程序启动/初始化是如何工作的(可执行文件"有什么数据格式,如何从那里加载代码/数据,DLL 如何工作......)
  • how C/C++/Fortran/... data types are laid out in memory (data sizes / alignments)
  • how nested function calls work (where and how the information on how to return to a function's caller is stored, where in the CPU registers and/or in memory function arguments are passed)
  • how program startup / initialization works (what data format an "executable" has, how the code / data is loaded from there, how DLLs work ...)

这些问题的答案是:

  • 特定于语言的(因此你有一个 C ABI、C++ ABI、Fortran ABI、Pascal ABI,......甚至是 Java 字节码规范,尽管目标是虚拟"处理器而不是真正的硬件,是 ABI),
  • 操作系统特定(同一硬件上的 MS Windows 和 Linux 使用不同的 ABI),
  • 硬件/CPU 特定(ARM 和 x86 ABI 不同).
  • 随着时间的推移不断发展(现有的 ABI 经常被更新/修订,以便可以使用新的 CPU 功能,例如,指定 x86 SSE 寄存器如何当然,只有在 CPU 拥有这些 regs 时,才可能被应用程序使用,因此需要澄清现有的 ABI).
  • language-specific (hence you've got a C ABI, C++ ABI, Fortran ABI, Pascal ABI, ... even the Java bytecode spec, although targeting a "virtual" processor instead of real hardware, is an ABI),
  • operating-system specific (MS Windows and Linux on the same hardware use a different ABI),
  • hardware/CPU-specific (the ARM and x86 ABIs are different).
  • evolving over (long) time (existing ABIs have often been updated / rev'ed so that new CPU features could be made use of, like, say, specifying how the x86 SSE registers are to be used by apps was of course only possible once CPUs had these regs, therefore existing ABIs needed to be clarified).

如果没有某种标准化,由不同编译器创建的(机器)代码无法使用相同类型的库(您怎么知道库代码期望以何种方式传递函数参数或数据结构?).

Without some kind of this standardization, (machine) code created by different compilers couldn't use the same kind of libraries (how would you know in which way the library code expects function arguments or data structures to be passed ?).

每个平台(特定硬件、操作系统软件和以特定编程语言编写/使用特定编译器编译的代码的组合)定义一整套 ABI可互操作的东西.这方面的术语不清楚,有时人们只是谈论ABI",有时它被称为平台补充",或者提到编程语言并说例如C++ ABI".请记住,没有这样的事情.

Every platform (a combination of specific hardware, operating system software and code written in specific programming languages / compiled with specific compilers) defines a whole set of ABIs to make things interoperable. The terminology in this area isn't clear, sometimes people just talk about "the ABI", other times it's called the "platform supplement", or one mentions the programming language and says e.g. "the C++ ABI". Keep in mind, there is not one such thing.

您在问题中链接到的文档都是这方面的具体示例(语言/操作系统/硬件特定的 ABI).

The documents that you linked to in your question are all specific examples of this (language- / operating-system / hardware-specific ABIs).

即使在特定平台上,也没有必要只有一个 ABI(设置),因为不同的此类约定可能具有不同的优势(因此提供更好的性能/更小的代码/更好的内存使用/... - 取决于程序)和系统设计人员通常会尝试灵活/允许.
例如,在 32 位 Microsoft Windows 上,函数调用约定部分有大量 ABI(fastcall、stdcall、pascal...).

Even on a specific platform, there's no necessity to have one and only one ABI (set) because different such conventions might have different advantages (and therefore provide better performance / smaller code / better memory usage / ... - depending on the program) and system designers usually try to be flexible / permissible.
On 32bit Microsoft Windows, for example, there's a multitude of ABIs (fastcall, stdcall, pascal, ...) for the function calling convention parts.

无论如何,对ABI"的通用 stackoverflow 搜索(包括相关"侧边栏下的链接)提供了很多研究这个问题的线索,所以我现在关闭我的答案.

Anyway, a generic stackoverflow search for "ABI" (included the links under the "Related" sidebar) gives so many leads to researching this question that I close my answer at this point.

这篇关于ARM ABI 和 EABI 的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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