You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/abi.md
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ r[abi.compatibility.integer]
22
22
Two [integer types] are *abi compatible* if they have the same size and the same signednes
23
23
24
24
> [!NOTE]
25
-
> In particular, `usize` is *abi compatible* with `uN`, and `isize` is *abi compatible* with `iN` where `N` is the target_pointer_width.
25
+
> In particular, `usize` is *abi compatible* with `uN`, and `isize` is *abi compatible* with `iN` where `N` is the target_pointer_width.
26
26
> Two integer types with different signedness, such as `u8` and `i8` are not *abi compatible*.
27
27
28
28
```rust
@@ -44,7 +44,7 @@ fn main(){
44
44
```
45
45
46
46
r[abi.compatibility.char]
47
-
The type [`char`] is *abi compatible* with the type [`u32`][integer types].
47
+
The type [`char`] is *abi compatible* with the type [`u32`][integer types].
48
48
49
49
```rust
50
50
fnfoo(x:char) ->u32{
@@ -60,17 +60,17 @@ fn main(){
60
60
```
61
61
62
62
r[abi.compatibility.pointer]
63
-
Two [pointer types], `*mut T` and `*const U`, are *abi compatible* if the *metadata type*s of `T` and `U` are the same type.
63
+
Two [pointer types], `*mut T` and `*const U`, are *abi compatible* if the *metadata type*s of `T` and `U` are the same type.
64
64
65
65
> [!NOTE]
66
-
> [`core::marker::Sized`] types have a *metadata type* of `()`.
66
+
> [`core::marker::Sized`] types have a *metadata type* of `()`.
67
67
68
68
> [!NOTE]
69
69
> With transitivity, this applies regardless of the mutability of either pointer type
70
70
71
71
```rust
72
72
unsafefnfoo(x:*muti32){
73
-
unsafe{x.write(5);}
73
+
unsafe{x.write(5);}
74
74
}
75
75
76
76
fnmain(){
@@ -90,7 +90,7 @@ The types [`&T`], [`&mut T`], [`alloc::boxed::Box<T>`], and [`core::ptr::NonNull
90
90
91
91
```rust
92
92
fnfoo(x:&muti32){
93
-
*x=5;
93
+
*x=5;
94
94
}
95
95
96
96
fnmain(){
@@ -198,12 +198,12 @@ static FOO: u32 = 0;
198
198
```
199
199
200
200
r[abi.used.application]
201
-
A `static` item with the `used` attribute is an *exported item*.
201
+
A `static` item with the `used` attribute is an *exported item*.
202
202
203
203
> [!NOTE]
204
204
> *exported items* will generally appear in the output when linking a library crate, and will generally be available when linking a binary crate as a global symbol.
205
205
> The `used` attribute does not give the `static` item a *linkage name*, and thus does not disable name mangling. It may be used to place data into a given section that is referenced by the linker via the input section, without regard to the name of the symbol.
206
-
> Due to toolchain limitations, it is not guaranteed that a `#[used]` static will appear in the final output when linking a binary, or when linking an rlib/staticlib crate into a `dylib` or `cdylib`.
206
+
> Due to toolchain limitations, it is not guaranteed that a `#[used]` static will appear in the final output when linking a binary, or when linking an rlib/staticlib crate into a `dylib` or `cdylib`.
The *`no_mangle` attribute* and the *`export_name` attribute* shall only be applied to a `static` or `fn` item. The *`export_name` attribute* shall not be applied to an item declared within an [`extern` block].
258
+
The *`no_mangle` attribute* and the *`export_name` attribute* shall only be applied to a `static` or `fn` item. The *`export_name` attribute* shall not be applied to an item declared within an [`extern` block].
259
259
260
260
```rust
261
261
#[no_mangle]
@@ -304,7 +304,7 @@ fn main() {
304
304
```
305
305
306
306
r[abi.symbol-name.export_name]
307
-
The *`export_name` attribute* may be specified as a built-in attribute, using the [_MetaNameValueStr_] syntax. The *export name* of an item with the *`no_mangle` attribute* is the content of `STRING_LITERAL`.
307
+
The *`export_name` attribute* may be specified as a built-in attribute, using the [_MetaNameValueStr_] syntax. The *export name* of an item with the *`no_mangle` attribute* is the content of `STRING_LITERAL`.
The *`link_section` attribute* may be specified as a built-in attribute, using the [_MetaNameValueStr_] syntax.
335
+
The *`link_section` attribute* may be specified as a built-in attribute, using the [_MetaNameValueStr_] syntax.
336
336
337
337
r[abi.link_section.restriction]
338
338
The *`link_section` attribute* shall be aplied to a `static` or `fn` item.
@@ -362,7 +362,7 @@ An item with the *`link_section` attribute* is placed in the specified section w
362
362
> *`.bss`: Readable and Writable - Uninitialized data,
363
363
> *`.tdata`: Readable and Writable - Thread-local,
364
364
> *`.tbss`: Readable and Writable - Uninitialized and Thread-local.
365
-
>
365
+
>
366
366
> This is not an exhaustive list, and generally extended versions of these section names such as `.text.foo`, are also defined with the same properties as the base section.
0 commit comments