Skip to content

x86_64: assertion failure assembling out with an immediate port #25547

@NOTMASTER09

Description

@NOTMASTER09

Zig Version

0.15.1

Steps to Reproduce and Observed Behavior

run zig build-exe -ofmt=elf -ODebug -target x86_64-freestanding-none main.zig with following main.zig

fn debug_out(string: []const u8) void {
    for (string) |char| {
        asm volatile (
            \\ outb %[char], $0xe9;
            :
            : [char] "{al}" (char),
        );
    }
}

export fn _start() noreturn {
    debug_out("Hello kernel!\n");
    unreachable;
}

Receive segmentation fault

[user@aphrodite kernel]$ zig build-exe -ofmt=elf -ODebug -target x86_64-freestanding-none main.zig
Segmentation fault         (core dumped) zig build-exe -ofmt=elf -ODebug -target x86_64-freestanding-none main.zig

Expected Behavior

Successful compilation, such as with -fllvm, or -OReleaseFast

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-x86_6464-bit x86backend-self-hostedbugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions