Skip to content

x86_64 codegen missing lret{,q} instruction #25608

@Noodlez1232

Description

@Noodlez1232

Zig Version

0.15.1

Steps to Reproduce and Observed Behavior

Create a zig file called reproduce.zig.

// Should not run on OS systems, but should compile
pub fn main() !void {
    const sel: u64 = 0x80;
    // Should load the segment selector 0x80 into CS
    asm volatile (
        \\ push %[sel]
        \\ lea finish(%%rip), %%rax
        \\ push %%rax
        \\ lretq
        \\ finish:
        :
        : [sel] "r" (sel),
        : .{ .rax = true });
}

zig build-exe reproduce.zig

$ zig build-exe reproduce.zig 
reproduce.zig:1:5: error: invalid mnemonic: 'lretq'
pub fn main() !void {
~~~~^~~~~~~~~~~~~~~

Expected Behavior

Inline assembly assembles

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-x86_6464-bit x86backend-self-hostedenhancementSolving this issue will likely involve adding new logic or components to the codebase.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions