Skip to content

Commit 62c0887

Browse files
committed
Add glossary entry for ABI and use it
Rather than using an `abbr` tag when mentioning ABI, let's add a glossary entry for ABI and link to that.
1 parent ff2df88 commit 62c0887

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/glossary.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ The alignment of a value specifies what addresses values are preferred to
1111
start at. Always a power of two. References to a value must be aligned.
1212
[More][alignment].
1313

14+
r[glossary.abi]
15+
### Application binary interface (ABI)
16+
17+
An *application binary interface* (ABI) defines how compiled code interacts with other compiled code. With [`extern` blocks] and [`extern fn`], *ABI strings* affect:
18+
19+
- **Calling convention**: How function arguments are passed and values are returned (e.g., in registers or on the stack).
20+
- **Unwinding**: Whether stack unwinding is allowed. For example, the `"C-unwind"` ABI allows unwinding across the FFI boundary, while the `"C"` ABI does not.
21+
1422
### Arity
1523

1624
Arity refers to the number of arguments a function or operator takes.
@@ -287,6 +295,8 @@ uninhabited type is "empty" in the sense that there are no values of the type. T
287295
example of an uninhabited type is the [never type] `!`, or an enum with no variants
288296
`enum Never { }`. Opposite of [Inhabited](#inhabited).
289297

298+
[`extern` blocks]: items.extern
299+
[`extern fn`]: items.fn.extern
290300
[alignment]: type-layout.md#size-and-alignment
291301
[associated item]: #associated-item
292302
[attributes]: attributes.md

src/items/external-blocks.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ r[items.extern.abi]
9898
## ABI
9999

100100
r[items.extern.abi.intro]
101-
The `extern` keyword can be followed by an optional <abbr title="application binary interface">ABI</abbr> string. The ABI specifies the calling convention of the functions in the block. The calling convention defines a low-level interface for functions, such as how arguments are placed in registers or on the stack, how return values are passed, and who is responsible for cleaning up the stack.
101+
The `extern` keyword can be followed by an optional [ABI] string. The ABI specifies the calling convention of the functions in the block. The calling convention defines a low-level interface for functions, such as how arguments are placed in registers or on the stack, how return values are passed, and who is responsible for cleaning up the stack.
102102

103103
> [!EXAMPLE]
104104
> ```rust
@@ -469,6 +469,7 @@ r[items.extern.attributes.fn-parameters]
469469
Attributes on extern function parameters follow the same rules and
470470
restrictions as [regular function parameters].
471471

472+
[ABI]: glossary.abi
472473
[PE Format]: https://learn.microsoft.com/windows/win32/debug/pe-format#import-name-type
473474
[UEFI]: https://uefi.org/specifications
474475
[WebAssembly module]: https://webassembly.github.io/spec/core/syntax/modules.html

0 commit comments

Comments
 (0)