Skip to content

linksection allowed on variables with comptime only types #11282

@Hugne

Description

@Hugne

Zig Version

0.10.0-dev.1487+916a65cb7

Steps to Reproduce

main.zig

const s linksection(".bar")= @import("s.zig");
comptime {
    @export(entry, .{ .name = "foo", .linkage = .Strong, .section = ".bar"});
}

fn foo() callconv(.C) c_uint {
    return s.bork();
}

s.zig

pub fn bork()  u32  {
    var p:u32 = 94;
    return p;
}

zig.exe build-lib main.zig -target x86_64-windows -fno-stack-check -fPIC -fno-soname -fno-unwind-tables -dynamic -fsingle-threaded --entry foo

Expected Behavior

The s.zig import (code and data) should be placed in section .bar

Actual Behavior

Only the entrypoint 'foo' is placed in .bar.
The linksection attribute is silently ignored for the @import statement

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions