Skip to content

Tracking issue for the #[wasm_custom_section] attribute #51088

Closed
@kennytm

Description

@kennytm

This issue tracks the wasm_custom_section attribute which is used to define the contents of a custom section in the wasm executable.

cc rustwasm/team#82.

The attribute is used like so:

#[wasm_custom_section = "foo"]
const CUSTOM_SECTION_CONTENT: [u8; 5] = [1, 2, 3, 4, 5];

The attribute in its current form can only be applied to const values and must be of the form [u8; N]. The attribute also must be of the form #[wasm_custom_section = "name"].

Custom sections are a feature of the WebAssembly binary encoding. They are intended to allow wasm files to encode arbitrary information useful for tools like debuggers, profilers, or transformations like wasm-bindgen. Each custom section must have a UTF-8 name and a payload of bytes. There is no restricton on the name or payload otherwise.

The linker, LLD, for the wasm target will concatenate custom sections of the same name in the order the objects appear on the comand line. For example if both crate a and crate b define a custom section with the name foo the final output will contain only one custom section with the name of foo where the contents of a and b are concatenated (byte-wise).

Helpful links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCO-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions