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
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,17 +90,18 @@ r[abi.link_section]
90
90
## The `link_section` attribute
91
91
92
92
r[abi.link_section.intro]
93
+
The *`link_section`[attribute]* specifies the section of the object file that a [function] or [static]'s content will be placed into.
94
+
95
+
> [!EXAMPLE]
96
+
> <!-- no_run: don't link. The format of the section name is platform-specific. -->
97
+
> ```rust,no_run
98
+
> #[unsafe(no_mangle)]
99
+
> #[unsafe(link_section = ".example_section")]
100
+
> pub static VAR1: u32 = 1;
101
+
> ```
93
102
94
103
r[abi.link_section.syntax]
95
104
The `link_section` attribute uses the [MetaNameValueStr] syntax to specify the section name.
96
-
The *`link_section`[attribute]* specifies the section of the object file that a [function] or [static]'s content will be placed into.
97
-
98
-
<!-- no_run: don't link. The format of the section name is platform-specific. -->
99
-
```rust,no_run
100
-
#[unsafe(no_mangle)]
101
-
#[unsafe(link_section = ".example_section")]
102
-
pub static VAR1: u32 = 1;
103
-
```
104
105
105
106
r[abi.link_section.unsafe]
106
107
This attribute is unsafe as it allows users to place data and code into sections of memory not expecting them, such as mutable data into read-only areas.
0 commit comments