-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
arch-wasm32-bit and 64-bit WebAssembly32-bit and 64-bit WebAssemblybugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.
Milestone
Description
There should be a way to emit custom wasm sections from Zig code.
LLVM already has support for this (landed in https://reviews.llvm.org/D45297), using the wasm.custom_sections named metadata:
!0 = !{ !"red", !"foo" }
!1 = !{ !"green", !"bar" }
!2 = !{ !"green", !"qux" }
!wasm.custom_sections = !{ !0, !1, !2 }The code above compiles into:
.section .custom_section.red,"",@
.ascii "foo"
.section .custom_section.green,"",@
.ascii "bar"
.section .custom_section.green,"",@
.ascii "qux"From the code above it seems like this should work, but it does not:
export const foo linksection(".custom_section.red") = [_]u8{ 'f', 'o', 'o' };Should we special-case the linksection(...) syntax on wasm targets to generate the named metadata shown above, or should we use some other syntax for this?
Metadata
Metadata
Assignees
Labels
arch-wasm32-bit and 64-bit WebAssembly32-bit and 64-bit WebAssemblybugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.