Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update specification to 1.71 #431

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/attributes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Built-in Attributes
| LinkContent
| LinkNameContent
| LinkSectionContent
| LinkOrdinalContent
| MacroExportContent
| MacroUseContent
| NoBinutilsContent
Expand Down Expand Up @@ -1031,6 +1032,7 @@ Attribute ``link``

NativeLibrayKindType ::=
$$dylib$$
| $$raw-dylib$$
| $$framework$$
| $$static$$

Expand All @@ -1054,6 +1056,9 @@ The following native library kinds are available:
* - :dp:`fls_wpqawdpevkj6`
- dylib
- Dynamic library
* - :dp:`fls_HPl6poXGiAqV`
- raw-dylib
- Dynamic library
* - :dp:`fls_h9dfs6kzmobp`
- framework
- macOS framework
Expand All @@ -1070,6 +1075,15 @@ on macOS targets.
If :t:`attribute` :c:`link` appears without a WebAssembly module name, then the
WebAssembly module name defaults to ``env``.

:dp:`fls_iDjcQczFQknm`
When :t:`attribute` :c:`link` appears with ``raw-dylib`` as the native library
kind, the supplied name must include the file extension.

:dp:`fls_rcERq1PfKPJI`
When :t:`attribute` :c:`link` appears with ``raw-dylib`` as the native library
kind, the :t:`[external function]s` and :t:`[external static]s` of the related
:t:`external block` shall not be subject to :t:`attribute` :c:`no_mangle`.

.. rubric:: Examples

.. code-block:: rust
Expand Down Expand Up @@ -1099,6 +1113,11 @@ Attribute ``link_name``
:t:`Attribute` :dc:`link_name` shall specify the linking symbol of the related
:t:`external function` or :t:`external static`.

:dp:`fls_0Athv8KFA5FO`
:t:`Attribute` :c:`link_name` shall not be applied to :t:`[external function]s`
and :t:`[external static]s` that are annotated with :t:`Attribute`
:c:`link_ordinal`.

.. rubric:: Examples

.. code-block:: rust
Expand Down Expand Up @@ -1137,6 +1156,43 @@ symbol of the related :t:`function` or :t:`static` will be placed.
#[link_section = ".example_section"]
pub static THE_ANSWER: u32 = 42;

.. _fls_Obik2w9gvhLN:

Attribute ``link_ordinal``
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. rubric:: Syntax

.. syntax::

LinkOrdinalContent ::=
$$link_ordinal$$ $$($$ DecimalLiteral $$)$$

.. rubric:: Legality Rules

:dp:`fls_fuv29BIqcawW`
:t:`Attribute` :c:`link_ordinal` shall apply to :t:`[external function]s` and
:t:`[external static]s`.

:dp:`fls_qh5sXG4znAXa`
The related :t:`extern block` of the :t:`[external function]` or
:t:`[external static]` shall be subject to :t:`attribute` :c:`link` with
``raw-dylib`` as the native library kind.

:dp:`fls_ASnJJiXWGlKI`
:t:`Attribute` :dc:`link_ordinal` shall specify the linking symbol of the
related :t:`external function` or :t:`external static` by ordinal number.

.. rubric:: Examples

.. code-block:: rust

#[link(name = "lib.dll", kind = "raw-dylib")]
extern "system" {
#[link_ordinal(16)]
fn function();
}

.. _fls_ch9nkxkloozv:

Attribute ``no_link``
Expand Down
6 changes: 5 additions & 1 deletion src/ffi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ The following :t:`[ABI]s` are supported:
``extern "C"`` - The default :t:`ABI` of :t:`C` code, referred to as
:dt:`extern C ABI`.

* :dp:`fls_LfjvLXvI6TFL`
``extern "C-unwind"`` - The same as ``extern "C"`` with the addition that
unwinding across FFI is expected.

* :dp:`fls_a2d8ltpgtvn6`
``extern "Rust"`` - The default :t:`ABI` of a Rust program, referred to as
:dt:`Rust ABI`.
Expand Down Expand Up @@ -183,7 +187,7 @@ An :t:`external function` shall be invoked from an :t:`unsafe context`.
An :t:`external function` shall not specify a :s:`FunctionQualifierList`.

:dp:`fls_w00qi1gx204e`
An :t:`external function` inherits the :t:`ABI` of its enclosing
An :t:`external function` inherits the :t:`ABI` of its enclosing
:t:`external block`.

:dp:`fls_m7tu4w4lk8v`
Expand Down