Skip to content

Update to the latest zig master #2

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ pub fn build(b: *std.Build) void {
const include_wf = b.addNamedWriteFiles("include");

const hdrgen_step = b.addRunArtifact(hdrgen);
hdrgen_step.addDirectorySourceArg(.{ .generated = .{
hdrgen_step.addDirectoryArg(.{ .generated = .{
.file = &include_wf.generated_directory,
} });

hdrgen_step.addDirectorySourceArg(b.path("include"));
hdrgen_step.addDirectoryArg(b.path("include"));

const libdir_wf = b.addWriteFiles();

Expand All @@ -74,11 +74,11 @@ pub fn build(b: *std.Build) void {
.minor = 0,
.patch = 0,
} else null,
.root_module = .{
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.root_source_file = b.path("lib/nulibc.zig"),
},
}),
});

lib.no_builtin = true;
Expand Down
34 changes: 34 additions & 0 deletions build/Options.zig
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,40 @@ pub fn make(options: Options, b: *std.Build) *std.Build.Step.Options {

linux.android,
}) catch @panic("OOM"),
.hurd => |hurd| step.contents.writer().print(
\\ .hurd = .{{
\\ .range = .{{
\\ .min = .{{
\\ .major = {},
\\ .minor = {},
\\ .patch = {},
\\ }},
\\ .max = .{{
\\ .major = {},
\\ .minor = {},
\\ .patch = {},
\\ }},
\\ }},
\\ .glibc = .{{
\\ .major = {},
\\ .minor = {},
\\ .patch = {},
\\ }},
\\ }}}},
\\
, .{
hurd.range.min.major,
hurd.range.min.minor,
hurd.range.min.patch,

hurd.range.max.major,
hurd.range.max.minor,
hurd.range.max.patch,

hurd.glibc.major,
hurd.glibc.minor,
hurd.glibc.patch,
}) catch @panic("OOM"),
.windows => |windows| step.contents.writer().print(
\\ .windows = .{{
\\ .min = {c},
Expand Down
23 changes: 11 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
systems.url = "github:nix-systems/default-linux";
systems.url = "github:nix-systems/default";
flake-utils.url = "github:numtide/flake-utils";
zig = {
url = "github:ziglang/zig?ref=pull/20511/head";
url = "github:ziglang/zig";
flake = false;
};
zon2nix = {
Expand Down
4 changes: 2 additions & 2 deletions lib/nulibc/start.zig
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn startMain(argc: usize, argv: [*][*:0]u8, envp: [*][*:0]u8, envp_count: us
// ARMv6 targets (and earlier) have no support for TLS in hardware.
// FIXME: Elide the check for targets >= ARMv7 when the target feature API
// becomes less verbose (and more usable).
if (comptime native_arch.isARM()) {
if (comptime native_arch.isArm()) {
if (at_hwcap & std.os.linux.HWCAP.TLS == 0) {
// FIXME: Make __aeabi_read_tp call the kernel helper kuser_get_tls
// For the time being use a simple trap instead of a @panic call to
Expand Down Expand Up @@ -106,7 +106,7 @@ fn expandStackSize(phdrs: []std.elf.Phdr) void {
switch (phdr.p_type) {
std.elf.PT_GNU_STACK => {
if (phdr.p_memsz == 0) break;
assert(phdr.p_memsz % std.heap.pageSize() == 0);
assert(phdr.p_memsz % std.heap.page_size_min == 0);

// Silently fail if we are unable to get limits.
const limits = std.posix.getrlimit(.STACK) catch break;
Expand Down