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

regression after usingnamespace changes #9705

Closed
semarie opened this issue Sep 8, 2021 · 1 comment
Closed

regression after usingnamespace changes #9705

semarie opened this issue Sep 8, 2021 · 1 comment
Labels
arch-x86 bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. os-openbsd regression It worked in a previous version of Zig, but stopped working. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@semarie
Copy link
Contributor

semarie commented Sep 8, 2021

I am not able to building to OpenBSD i386 anymore. I am suspecting that FreeBSD is also impacted for all archs except x86_64.

$ ZIG_LIBC=path/to/i386/libc.conf zig build-exe -target i386-openbsd hello.zig
/home/semarie/repos/ziglang/zig/lib/std/c/openbsd.zig:869:33: error: container 'std.c.openbsd.arch_bits' has no member called 'ucontext_t'
pub const ucontext_t = arch_bits.ucontext_t;
                                ^
/home/semarie/repos/ziglang/zig/lib/std/os.zig:162:30: note: referenced here
pub const ucontext_t = system.ucontext_t;
                             ^
/home/semarie/repos/ziglang/zig/lib/std/debug.zig:1554:43: note: referenced here
            const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
                                          ^

i386 architecture doesn't have ucontext_t definition in std/c/openbsd.zig. Previously, it wasn't a problem as the segfault handler is installed only if the struct was defined.

pub const have_segfault_handling_support = switch (native_os) {
    .linux, .netbsd => true,
    .windows => true,
    .freebsd, .openbsd => @hasDecl(os.system, "ucontext_t"),
    else => false,
};

Currently, it seems that @hasDecl(os.system, "ucontext_t") is true even if ucontext_t doesn't exist in std.c.openbsd.arch_bits. It might be because of os.zig is defining pub const ucontext_t = system.ucontext_t (so it lazily exists).

I could provide a script to create libc.conf environment for i386-openbsd if it helps to reproduce the problem.

@andrewrk andrewrk added arch-x86 bug Observed behavior contradicts documented or intended behavior os-openbsd labels Nov 20, 2021
@andrewrk andrewrk added this to the 0.9.0 milestone Nov 20, 2021
@andrewrk andrewrk added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. labels Dec 1, 2021
@andrewrk andrewrk modified the milestones: 0.9.0, 0.9.1 Dec 1, 2021
@andrewrk andrewrk added the regression It worked in a previous version of Zig, but stopped working. label Feb 3, 2022
@andrewrk
Copy link
Member

andrewrk commented Feb 7, 2022

Thanks for the report!

andrewrk added a commit that referenced this issue Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86 bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. os-openbsd regression It worked in a previous version of Zig, but stopped working. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

2 participants