File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ object file, similar to the [`used` attribute](#the-used-attribute).
6969This attribute is unsafe as an unmangled symbol may collide with another symbol
7070with the same name (or with a well-known symbol), leading to undefined behavior.
7171
72+ ``` rust
73+ #[unsafe (no_mangle)]
74+ extern " C" fn foo () {}
75+ ```
76+
7277## The ` link_section ` attribute
7378
7479The * ` link_section ` attribute* specifies the section of the object file that a
@@ -80,8 +85,8 @@ of memory not expecting them, such as mutable data into read-only areas.
8085
8186<!-- no_run: don't link. The format of the section name is platform-specific. -->
8287``` rust,no_run
83- #[no_mangle]
84- #[link_section = ".example_section"]
88+ #[unsafe( no_mangle) ]
89+ #[unsafe( link_section = ".example_section") ]
8590pub static VAR1: u32 = 1;
8691```
8792
@@ -96,7 +101,7 @@ symbol with the same name (or with a well-known symbol), leading to undefined
96101behavior.
97102
98103``` rust
99- #[export_name = " exported_symbol_name" ]
104+ #[unsafe ( export_name = " exported_symbol_name" ) ]
100105pub fn name_in_rust () { }
101106```
102107
You can’t perform that action at this time.
0 commit comments