Repository navigation
Add a Developer Resources section with links to ABI documentation #3047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| # Additional Resources | ||
|
|
||
| ## ABIs and Platform Specifics | ||
|
|
||
| ### System V | ||
|
|
||
| The System V ABIs are defined by a General ABI (gABI), which cross-platform things like linking | ||
| behavior and the ELF format, and by processor-speciic ABIs (psABI) that define data layout and | ||
| calling convention. The gABI can be found at <https://www.sco.com/developers/gabi/>. | ||
|
|
||
| #### ARM (Arm32 and AArch64) | ||
|
|
||
| ABIs are located at <https://github.com/ARM-software/abi-aa>. The aapcs32 and aapcs64 directories | ||
| are likely the most interesting. These ABIs are actively developed and discussed at that repository. | ||
|
|
||
| #### AMDGPU | ||
|
|
||
| The LLVM guide at <https://llvm.org/docs/AMDGPUUsage.html> is likely the best collection of | ||
| resources for this architecture. | ||
|
|
||
| #### AVR | ||
|
|
||
| The AVR calling convention is detailed at the GCC Wiki, <https://gcc.gnu.org/wiki/avr-gcc>. The | ||
| wiki is actively updated as needed. | ||
|
|
||
| #### BPF | ||
|
|
||
| A minimal ABI is defined at <https://docs.kernel.org/bpf/standardization/abi.html>. | ||
|
|
||
| #### CSky | ||
|
|
||
| The LLVM documentation links to <https://github.com/c-sky/csky-doc/tree/master>, which contains | ||
| a document `C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf`. | ||
|
|
||
| #### Hexagon | ||
|
|
||
| The Hexagon ABI can be found at <https://docs.qualcomm.com/doc/80-N2040-23/topic/>. | ||
|
|
||
| #### Loongarch | ||
|
|
||
| ABIs are located at <https://github.com/loongson/la-abi-specs>, with a rendered version at | ||
| <https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html>. This ABI is actively | ||
| developed and discussed at that repository. | ||
|
|
||
| #### m68k | ||
|
|
||
| An ABI is described at <https://m680x0.github.io/doc/abi.html>. | ||
|
|
||
| #### MIPS | ||
|
|
||
| The o32 ("old 32") ABI is described in [_System V Application Binary Interface: MIPS | ||
| RISC Processor Supplement_](https://refspecs.linuxfoundation.org/elf/mipsabi.pdf). | ||
| The n32 and n64 ("new 32" and "new 64") ABIs are described in the [_MIPSproTM N32 ABI | ||
| Handbook_](https://irix7.com/techpubs/007-2816-005.pdf). There is also a porting guide for n64 that | ||
| may be helpful <https://irix7.com/techpubs/007-2391-006.pdf>. | ||
|
|
||
| #### MSP430 | ||
|
|
||
| The document _MSP430 Embedded Application Binary Interface_ is available at | ||
| <https://www.ti.com/lit/an/slaa534a/slaa534a.pdf>. | ||
|
|
||
| #### NVPTX | ||
|
|
||
| LLVM documentation directs to <https://docs.nvidia.com/cuda/index.html>. | ||
|
|
||
| #### PowerPC | ||
|
|
||
| There are a few relevant documents for PowerPC ABI: | ||
|
|
||
| * [_System V Application Binary Interface: PowerPC Processor | ||
| Supplement_](https://refspecs.linuxfoundation.org/elf/elfspec_ppc.pdf) is the original 32-bit | ||
| PowerPC ABI specification. | ||
| * [_Power Architecture™ 32-bit Application Binary Interface Supplement 1.0 - Linux® & | ||
| Embedded_](https://web.archive.org/web/20120608163804/https://www.power.org/resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Unified.pdf) | ||
| (web archive) is the latest version of the 32-bit ABI. Its source is hosted at | ||
| <https://github.com/ryanarn/powerabi> but effectively unmaintained. | ||
| * [_64-bit PowerPC ELF Application Binary Interface Supplement | ||
| 1.9_](https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html) is the original 64-bit | ||
| ABI, last updated in 2004. This is known as ELFv1, and still used by default on some big endian | ||
| PowerPC64 targets. | ||
| * [_64-bit ELF V2 ABI Specification: Power | ||
| Architecture_](https://openpower.foundation/specifications/64bitelfabi/) is the replacement ABI | ||
| and used by default on most PowerPC64 targets. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the links look OK. It's always a pain to dredge up these documents. |
||
|
|
||
| #### RISC-V | ||
|
|
||
| Ratified RISC-V ABIs are located at <https://docs.riscv.org/reference/abi/v1.0/index.html>. More | ||
| recent snapshots can be viewed at <https://riscv-non-isa.github.io/riscv-elf-psabi-doc/>, with | ||
| development happening at <https://github.com/riscv-non-isa/riscv-elf-psabi-doc>. | ||
|
|
||
| #### s390x | ||
|
|
||
| The ABI is located at <https://github.com/IBM/s390x-abi> with a published PDF available at | ||
| <https://ibm.github.io/s390x-abi/lzsabi_s390x.pdf>. This ABI is actively developed and discussed | ||
| at that repository. | ||
|
|
||
| Historical ISAs can be found at <https://linux.mainframe.blog/zarchitecture-principles-of-operation/>. | ||
| <https://maskray.me/blog/toolchain-notes-on-z-architecture> has a great overview of other ABI | ||
| components such as linking and TLS. | ||
|
|
||
| #### SPARC | ||
|
|
||
| _SCD 2.4.1_ available at <https://sparc.org/technical-documents/specifications/> describes both the | ||
| 32-bit and 64-bit ABIs. _SPARC psABI 3.0_, available at that same link, is an older description of | ||
| the 32-bit ABI. | ||
|
|
||
| #### x86 | ||
|
|
||
| The 32-bit ABI (i386) is located at <https://gitlab.com/x86-psABIs/i386-ABI>. The 64-bit ABI (amd64) | ||
| is located at <https://gitlab.com/x86-psABIs/x86-64-ABI/#elf-x86-64-abi-psabi>. Both of these are | ||
| actively developed and discussed on mailing lists at <https://groups.google.com/g/ia32-abi> and | ||
| <https://groups.google.com/g/x86-64-abi>. | ||
|
|
||
| #### Xtensa | ||
|
|
||
| TODO | ||
|
|
||
| ### Apple | ||
|
|
||
| Apple largely follows the System V ABIs but documents a few exceptions at the following links: | ||
|
|
||
| * Arm64: <https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms> | ||
| * x86: <https://developer.apple.com/documentation/xcode/writing-64-bit-intel-code-for-apple-platforms> | ||
|
|
||
| ### Microsoft | ||
|
|
||
| Microsoft's x86-64 ABI is defined at <https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions>. | ||
| There are a few different x86-32 conventions: | ||
|
|
||
| * Cdecl (default): <https://learn.microsoft.com/en-us/cpp/cpp/cdecl> | ||
| * Stdcall: <https://learn.microsoft.com/en-us/cpp/cpp/stdcall> | ||
| * Fastcall: <https://learn.microsoft.com/en-us/cpp/cpp/fastcall> | ||
| * Thiscall: <https://en.wikipedia.org/wiki/X86_calling_conventions#thiscall> | ||
|
|
||
| As well as a few that aren't supported by Rust (`__clrcall`, `__vectorcall`, `__preserve_none`). | ||
|
|
||
| Aarch64 targets generally use the AAPCS64 calling convention. There are some exceptions listed at | ||
| <https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170>. | ||
|
|
||
| Register mappings for arm64ec are documented at | ||
| <https://learn.microsoft.com/en-us/cpp/build/arm64ec-windows-abi-conventions?view=msvc-170>. | ||
| <http://www.emulators.com/docs/abc_arm64ec_explained.htm> does a great job of explaining more about | ||
| how this works. | ||
|
|
||
| #### Wasm | ||
|
|
||
| The way that C types are broken down into Wasm types is described at | ||
| <https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md>. | ||
|
|
||
| ### Additional Resources for Platform Specifics | ||
|
|
||
| The following links aggregate more resources | ||
|
|
||
| * Links to other resources such as ELF and DWARF: <https://refspecs.linuxfoundation.org/> | ||
| * Links to a number of standards including ISAs <https://llvm.org/docs/CompilerWriterInfo.html> | ||
| * More about System V ABIs, especially x86: <https://wiki.osdev.org/System_V_ABI> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe name the page platform-specifics.md, though am thinking maybe this info should live in rustc book, which has platform-specific details
View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured this can hold more than only platform specifics (even though that's all this PR adds), since we didn't really have a home for other things like that currently. Also considered the rustc book but I think this may be a bit niche for something user-facing, though I don't know what's best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Developer Resources feels too general as a title, like for example, some of the other appendices could fit in that title
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, since the whole thing is really a developer resource. Renamed to "additional resources" which I think is a bit better, though it still could match other appendix entries.