Where is the x86-64 System V ABI documented?

2019-01-01 03:59发布

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?

1条回答
不流泪的眼
2楼-- · 2019-01-01 04:41

The System V x86-64 psABI is maintained on GitHub. H.J. Lu's github page has a wiki with links to the current versions of the x86-64 and i386 SystemV psABI documents, and to the forums where updates are discussed.

See the tag wiki for direct links to the latest versions. (This answer may be out of date).

As of now, the current version for x86-64 is r252 (Draft 0.99.8 April 2016), and the current version for i386 is 1.1 (includes AVX512). Unofficially, sign-extending narrow args to 32-bit is required, because clang depends on it. Hopefully a future ABI revision will document that.

The x32 ABI (32-bit pointers in long mode) is part of the x86-64 ABI doc. See Chapter 10: ILP32 Programming Model.


Note that the Processor-Specific psABI docs are designed as a supplement to the less-frequently-updated System V gABI, hosted on SCO's website.


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

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 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.)

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).

查看更多
登录 后发表回答