x86-64 System V ABI 记录在哪里? [英] Where is the x86-64 System V ABI documented?

查看:58
本文介绍了x86-64 System V ABI 记录在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

x86-64 System V ABI(用于除 Windows 以外的所有设备)过去位于 http://x86-64.org/documentation/abi.pdf,但该网站现已从互联网上撤下.

The x86-64 System V ABI (used on everything except Windows) used to live at http://x86-64.org/documentation/abi.pdf, but that site has now fallen off the internet.

文档有新的权威主页吗?

Is there a new authoritative home for the document?

推荐答案

System V x86-64 psABI 文档作为 LaTeX 源维护 在 GitLab 上.同样,i386 psABI 是一个单独的 GitLab 存储库.(以前在 github 上).这些页面包含讨论修订的位置的信息.

The System V x86-64 psABI document is maintained as LaTeX sources on GitLab. Similarly the i386 psABI is a separate GitLab repo. (Formerly on github). Those pages have info on where revisions are discussed.

(待办事项:查找根据最新修订版构建的 PDF 的链接.本答案其余部分中的链接有一段时间没有更新.)

(TODO: find a link for PDFs built from latest revisions. The links in the rest of this answer haven't been updated for a while.)

另见 标签维基 直接链接到最新版本.

See also the x86 tag wiki for direct links to the latest versions.

截至目前,当前的x86-64 的版本是 1.0(2018 年 1 月). 有一个更新的 2018 年 12 月草案版本(讽刺的是)删除了草案"来自草案 1.0"PDF 本身的版本号.
x32 ABI(长模式下的 32 位指针)是 x86-64 ABI 文档的一部分.请参阅第 10 章:ILP32 编程模型.

As of now, the current version for x86-64 is 1.0 (January 2018). There's a more recent 2018-dec draft version which (ironically) removes the "Draft" from the "Draft 1.0" version number in the PDF itself.
The x32 ABI (32-bit pointers in long mode) is part of the x86-64 ABI doc. See Chapter 10: ILP32 Programming Model.

i386 的当前版本是 1.1.(请注意,某些操作系统使用不需要 16 字节堆栈对齐的旧版本 i386 ABI,只有 4 个.GCC 最终取决于 -mpreferred-stack-boundary=4 16 字节对齐它的 SSE 代码生成(可能是无意的),最终 ABI 更新为 Linux 以将其作为官方要求.我尝试在 评论 GCC 错误 #40838.这打破了与调用其他函数的一些手写 asm 的向后兼容.)

The current version for i386 is 1.1. (Note that some OSes use an older version of the i386 ABI which doesn't require 16-byte stack alignment, only 4. GCC ended up depending on -mpreferred-stack-boundary=4 16-byte alignment for its SSE code-gen (perhaps unintentionally), and eventually the ABI got updated for Linux to enshrine that as an official requirement. I attempted a summary in a comment on GCC bug #40838. This breaks backwards compat with some hand-written asm that calls other functions.)

非正式地,需要将窄参数符号扩展到 32 位(对于 i386 和 amd64),因为 clang 依赖于它.希望未来的 ABI 修订版能够记录这一点.

Unofficially, sign-extending narrow args to 32-bit is required (for both i386 and amd64), because clang depends on it. Hopefully a future ABI revision will document that.

处理器补充 (psABI) 文档被设计为对更新频率较低的系统的补充V gABI(通用),托管在 SCO 网站上.

The Processor Supplement (psABI) docs are designed as a supplement to the less-frequently-updated System V gABI (generic), hosted on SCO's website.

其他链接

此外,https://refspecs.linuxfoundation.org/ 托管了 1997 年的 gABI 副本.

Also https://refspecs.linuxfoundation.org/ hosts a copy of the gABI from 1997.

https://uclibc.org/specs.html 有各种非 x86 的 psABI 链接ISA.(尽管例如 ARM 似乎只记录了 ELF 文件布局,而不是调用约定或进程启动状态.)https://uclibc.org/docs/psABI-x86_64.pdf 是 x86-64 psABI 的过时副本(2014 年为 0.99.7).GitHub 上的版本在一些示例中对一些内容和错误修复有更清晰的措辞.

https://uclibc.org/specs.html has psABI links for various non-x86 ISAs. (Although for example the ARM one only seems to document the ELF file layout, not the calling convention or process startup state.) https://uclibc.org/docs/psABI-x86_64.pdf is an outdated copy of the x86-64 psABI (0.99.7 from 2014). The version on GitHub has clearer wording of a few things and bugfixes in some examples.

相关:UNIX & 的调用约定是什么?i386 和 x86-64 上的 Linux 系统调用(和用户空间函数) 描述了 x86-64 SysV(以及 i386 Linux 与 FreeBSD)的系统调用调用约定.

Related: What are the calling conventions for UNIX & Linux system calls (and user-space functions) on i386 and x86-64 describes the system-call calling convention for x86-64 SysV (as well as i386 Linux vs. FreeBSD).

它还总结了整数参数的函数调用约定.系统调用不采用 FP 或 SSE/AVX 向量参数,也不采用值结构,因此函数调用约定更复杂.

It also summarizes the function calling conventions for integer args. System calls don't take FP or SSE/AVX vector args, or structs by value, so the function-calling convention is more complicated.

Agner Fog 有一个调用约定指南(涵盖 Windows 与 SysV,以及 32 位的各种约定,以及编写可以在任一平台上使用的函数的提示/技巧).这是与他的优化和微架构指南和指令表(如果您关心性能是必不可少的阅读)的单独 PDF.

Agner Fog has a calling conventions guide (covering Windows vs. Sys V, and the various conventions for 32-bit, and tips/tricks for writing functions you can use on either platform). This is a separate PDF from his optimization and microarchitecture guides and instruction tables (which are essential reading if you care about performance.)

维基百科有一篇 x86 调用约定 文章,其中描述了各种约定,但主要是不够详细说明将它们用于除简单整数 args 之外的任何内容.(例如,没有对结构体打包规则的描述).

Wikipedia has an x86 calling conventions article which describes various conventions, but mostly not in enough detail to use them for anything other than simple integer args. (e.g. no description of struct-packing rules).

GCC 和 Clang(在所有架构上)使用最初为 Itanium 开发的 C++ ABI.https://itanium-cxx-abi.github.io/cxx-abi/.例如,这与需要在寄存器中传递 C++ 结构/类的要求有关(例如,根据某些定义是聚合).

GCC and Clang (on all architectures) use the C++ ABI originally developed for Itanium. https://itanium-cxx-abi.github.io/cxx-abi/. This is relevant for example for what requirements a C++ struct/class need to be passed in registers (e.g. being an aggregate according to some definition).

这篇关于x86-64 System V ABI 记录在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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