Skip to content

Commit bcbfdf7

Browse files
committed
Add introductory clauses and reformat to use existing grammar style
1 parent 2477068 commit bcbfdf7

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]
@@ -355,9 +361,11 @@ extern "C" fn foo() {}
355361

356362
r[abi.link_section]
357363

358-
```abnf
359-
MetaItemLinkSection := "link_section" "=" ([STRING_LITERAL] | [RAW_STRING_LITERAL])
360-
```
364+
The `link_section` attribute allows a program to control the section that certain items are placed into.
365+
366+
> **<sup>Attribute Syntax</sup>**\
367+
> _MetaItemLinkSection_ :\
368+
> &nbsp;&nbsp; `link_section` `=` (_STRING_LITERAL_ | _RAW_STRING_LITERAL_)
361369
362370
r[abi.link_section.syntax]
363371
The *`link_section` attribute* may be specified as a built-in attribute, using the [_MetaNameValueStr_] syntax.

0 commit comments

Comments
 (0)