Skip to content

Module level, inline assembly for wasm segfaults. #13129

Open
@gcoakes

Description

@gcoakes

Zig Version

0.10.0-dev.4254+7f508480f

Steps to Reproduce

main.zig:

comptime {
    asm (
        \\.globl wasm_nop
        \\wasm_nop:
        \\  .functype wasm_nop () -> ()
        \\  nop
        \\  end_function
    );
}

Compile:

$ zig build-lib -dynamic -target wasm32-freestanding main.zig
LLVM Emit Object... Segmentation fault at address 0x0
???:?:?: 0x7f2d2771d249 in ??? (???)
???:?:?: 0x72732f73656b616e in ??? (???)
fish: Job 1, 'zig build-lib -dynamic -target…' terminated by signal SIGABRT (Abort)

Expected Behavior

A wasm file at least containing:

(module (func $wasm_nop nop))

Actual Behavior

$ zig build-lib -dynamic -target wasm32-freestanding main.zig
LLVM Emit Object... Segmentation fault at address 0x0
???:?:?: 0x7f2d2771d249 in ??? (???)
???:?:?: 0x72732f73656b616e in ??? (???)
fish: Job 1, 'zig build-lib -dynamic -target…' terminated by signal SIGABRT (Abort)

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasm32-bit and 64-bit WebAssemblybackend-llvmThe LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions