Skip to content

Commit 8c634cb

Browse files
committed
Add introductory clauses and reformat to use existing grammar style
1 parent 0544d2b commit 8c634cb

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/abi.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ The behavior of a call that is not valid is undefined.
201201

202202
r[abi.used]
203203

204+
The `#[used]` attribute allows indicating that a `static` item should be considered to be used by the program from outside of Rust and not discarded by the compiler.
205+
204206
> **<sup>Attribute Syntax</sup>**\
205207
> _MetaItemUsed_ :\
206208
> &nbsp;&nbsp; `used`
@@ -268,13 +270,17 @@ $ nm -C foo.o
268270

269271
r[abi.symbol-name]
270272

271-
```abnf
272-
MetaItemNoMangle := "no_mangle"
273-
MetaItemExportName := "export_name" "=" ([STRING_LITERAL] | [RAW_STRING_LITERAL])
274-
```
273+
274+
The `no_mangle` and `export_name` attributes allow you to control which symbols are exported from rust code under provided symbol names.
275+
276+
> **<sup>Attribute Syntax</sup>**\
277+
> _MetaItemNoMangle_ :\
278+
> &nbsp;&nbsp; `no_mangle`
279+
> _MetaItemExportName_ :\
280+
> &nbsp;&nbsp; `export_name` `=` (_STRING_LITERAL | _RAW_STRING_LITERAL_)
275281
276282
r[abi.symbol-name.names]
277-
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].
283+
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].
278284

279285
```rust
280286
#[no_mangle]
@@ -346,9 +352,11 @@ fn main(){
346352

347353
r[abi.link_section]
348354

349-
```abnf
350-
MetaItemLinkSection := "link_section" "=" ([STRING_LITERAL] | [RAW_STRING_LITERAL])
351-
```
355+
The `link_section` attribute allows a program to control the section that certain items are placed into.
356+
357+
> **<sup>Attribute Syntax</sup>**\
358+
> _MetaItemLinkSection_ :\
359+
> &nbsp;&nbsp; `link_section` `=` (_STRING_LITERAL_ | _RAW_STRING_LITERAL_)
352360
353361
r[abi.link_section.syntax]
354362
The *`link_section` attribute* may be specified as a built-in attribute, using the [_MetaNameValueStr_] syntax.

0 commit comments

Comments
 (0)