Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cbe: linksection not working for function #18023

Closed
clementd64 opened this issue Nov 17, 2023 · 0 comments · Fixed by #19470
Closed

cbe: linksection not working for function #18023

clementd64 opened this issue Nov 17, 2023 · 0 comments · Fixed by #19470
Labels
backend-c The C backend (CBE) outputs C source code. enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@clementd64
Copy link

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);
}
@clementd64 clementd64 added the bug Observed behavior contradicts documented or intended behavior label Nov 17, 2023
@Vexu Vexu added the backend-c The C backend (CBE) outputs C source code. label Nov 17, 2023
@Vexu Vexu added this to the 0.13.0 milestone Nov 17, 2023
@jacobly0 jacobly0 modified the milestones: 0.13.0, 0.12.0 Mar 29, 2024
@jacobly0 jacobly0 added enhancement Solving this issue will likely involve adding new logic or components to the codebase. and removed bug Observed behavior contradicts documented or intended behavior labels Mar 29, 2024
jacobly0 added a commit to jacobly0/zig that referenced this issue Mar 29, 2024
jacobly0 added a commit to jacobly0/zig that referenced this issue Mar 30, 2024
jacobly0 added a commit to jacobly0/zig that referenced this issue Mar 31, 2024
Rexicon226 pushed a commit to Rexicon226/zig that referenced this issue Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-c The C backend (CBE) outputs C source code. enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants