Skip to content

cbe: linksection not working for function #18023

Closed
@clementd64

Description

@clementd64

Zig Version

0.12.0-dev.1637+673a1efa2

Steps to Reproduce and Observed Behavior

export const _foo linksection("foo") = "";

export fn bar() linksection("baz") u32 {
    return 0;
}
zig build-obj source.zig -ofmt=c

Produce

// ...
zig_linksection("foo", uint8_t const (*const _foo)[1], read) = &__anon_1365;

uint32_t bar(void) {
 /* file:2:5 */
 return UINT32_C(0);
}

Expected Behavior

Something like

// ...
zig_linksection("foo", uint8_t const (*const _foo)[1], read) = &__anon_1365;

zig_linksection("baz", uint32_t) bar(void) {
 /* file:2:5 */
 return UINT32_C(0);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend-cThe C backend (CBE) outputs C source code.enhancementSolving this issue will likely involve adding new logic or components to the codebase.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions