diff --git a/src/abi.md b/src/abi.md index 47116f5ee..09ff20b16 100644 --- a/src/abi.md +++ b/src/abi.md @@ -69,6 +69,11 @@ object file, similar to the [`used` attribute](#the-used-attribute). This attribute is unsafe as an unmangled symbol may collide with another symbol with the same name (or with a well-known symbol), leading to undefined behavior. +```rust +#[unsafe(no_mangle)] +extern "C" fn foo() {} +``` + ## The `link_section` attribute The *`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. ```rust,no_run -#[no_mangle] -#[link_section = ".example_section"] +#[unsafe(no_mangle)] +#[unsafe(link_section = ".example_section")] pub static VAR1: u32 = 1; ``` @@ -96,7 +101,7 @@ symbol with the same name (or with a well-known symbol), leading to undefined behavior. ```rust -#[export_name = "exported_symbol_name"] +#[unsafe(export_name = "exported_symbol_name")] pub fn name_in_rust() { } ```