Skip to content

Malformed Wasm binaries with @extern's std.builtin.GlobalLinkage #11505

@ghost

Description

Version is 0.10.0-dev.4176+6d7b0690a (stage2).

pub fn main() void {
    const a = @extern(*const fn ([*]const u8) void, .{
        .name = "a",
        .library_name = "b",
        .linkage = .Strong, // or `.Weak`
        .is_thread_local = false,
    });
    a("hello");
}
zig build-exe -target wasm32-freestanding-none -O ReleaseSmall x.zig

This seems to generate malformed Wasm?

$ wasm2wat x.wasm
x.wasm:0000048: error: type mismatch at end of function, expected [] but got [i32]

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasm32-bit and 64-bit WebAssemblybugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions