diff --git a/README.md b/README.md index 9868fa2b22..8d495f3e8b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ to find and inspect the patch diffs. * LLVM, LLD, Clang 19.1.0 * zlib 1.3.1 * zstd 1.5.2 - * zig 0.14.0-dev.2246+bfcf18c5a + * zig 0.14.0-dev.2253+3a6a8b8aa For other versions, check the git tags of this repository. diff --git a/build b/build index 4923b5c740..3dd468cad0 100755 --- a/build +++ b/build @@ -7,7 +7,7 @@ TARGET="$1" # Example: riscv64-linux-gnu MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s` ROOTDIR="$(pwd)" -ZIG_VERSION="0.14.0-dev.2246+bfcf18c5a" +ZIG_VERSION="0.14.0-dev.2253+3a6a8b8aa" TARGET_OS_AND_ABI=${TARGET#*-} # Example: linux-gnu diff --git a/build.bat b/build.bat index 28daafd711..df6895df69 100644 --- a/build.bat +++ b/build.bat @@ -35,7 +35,7 @@ if "%VSCMD_ARG_HOST_ARCH%"=="x86" set OUTDIR=out-win-x86 set ROOTDIR=%~dp0 set "ROOTDIR_CMAKE=%ROOTDIR:\=/%" -set ZIG_VERSION="0.14.0-dev.2246+bfcf18c5a" +set ZIG_VERSION="0.14.0-dev.2253+3a6a8b8aa" set JOBS_ARG= pushd %ROOTDIR% diff --git a/zig/bootstrap.c b/zig/bootstrap.c index cbbc65cf9b..37e4837672 100644 --- a/zig/bootstrap.c +++ b/zig/bootstrap.c @@ -123,7 +123,7 @@ int main(int argc, char **argv) { if (f == NULL) panic("unable to open config.zig for writing"); - const char *zig_version = "0.14.0-dev.2246+bfcf18c5a"; + const char *zig_version = "0.14.0-dev.2253+3a6a8b8aa"; int written = fprintf(f, "pub const have_llvm = false;\n" diff --git a/zig/lib/std/c.zig b/zig/lib/std/c.zig index 94d2a3405a..e9961556fb 100644 --- a/zig/lib/std/c.zig +++ b/zig/lib/std/c.zig @@ -7028,6 +7028,7 @@ pub const pthread_attr_t = switch (native_os) { pub const pthread_key_t = switch (native_os) { .linux, .emscripten => c_uint, + .macos, .ios, .tvos, .watchos, .visionos => c_ulong, .openbsd, .solaris, .illumos => c_int, else => void, }; diff --git a/zig/lib/std/os/linux.zig b/zig/lib/std/os/linux.zig index bf0c3e6371..7bd727e79f 100644 --- a/zig/lib/std/os/linux.zig +++ b/zig/lib/std/os/linux.zig @@ -2065,6 +2065,84 @@ pub fn fremovexattr(fd: usize, name: [*:0]const u8) usize { return syscall2(.fremovexattr, fd, @intFromPtr(name)); } +pub const sched_param = extern struct { + priority: i32, +}; + +pub const SCHED = packed struct(i32) { + pub const Mode = enum(u3) { + /// normal multi-user scheduling + NORMAL = 0, + /// FIFO realtime scheduling + FIFO = 1, + /// Round-robin realtime scheduling + RR = 2, + /// For "batch" style execution of processes + BATCH = 3, + /// Low latency scheduling + IDLE = 5, + /// Sporadic task model deadline scheduling + DEADLINE = 6, + }; + mode: Mode, //bits [0, 2] + _3: u27 = 0, //bits [3, 29] + /// set to true to stop children from inheriting policies + RESET_ON_FORK: bool = false, //bit 30 + _31: u1 = 0, //bit 31 +}; + +pub fn sched_setparam(pid: pid_t, param: *const sched_param) usize { + return syscall2(.sched_setparam, @as(usize, @bitCast(@as(isize, pid))), @intFromPtr(param)); +} + +pub fn sched_getparam(pid: pid_t, param: *sched_param) usize { + return syscall2(.sched_getparam, @as(usize, @bitCast(@as(isize, pid))), @intFromPtr(param)); +} + +pub fn sched_setscheduler(pid: pid_t, policy: SCHED, param: *const sched_param) usize { + return syscall3(.sched_setscheduler, @as(usize, @bitCast(@as(isize, pid))), @intCast(@as(u32, @bitCast(policy))), @intFromPtr(param)); +} + +pub fn sched_getscheduler(pid: pid_t) usize { + return syscall1(.sched_getscheduler, @as(usize, @bitCast(@as(isize, pid)))); +} + +pub fn sched_get_priority_max(policy: SCHED) usize { + return syscall1(.sched_get_priority_max, @intCast(@as(u32, @bitCast(policy)))); +} + +pub fn sched_get_priority_min(policy: SCHED) usize { + return syscall1(.sched_get_priority_min, @intCast(@as(u32, @bitCast(policy)))); +} + +pub fn getcpu(cpu: ?*usize, node: ?*usize) usize { + return syscall2(.getcpu, @intFromPtr(cpu), @intFromPtr(node)); +} + +pub const sched_attr = extern struct { + size: u32 = 48, // Size of this structure + policy: u32 = 0, // Policy (SCHED_*) + flags: u64 = 0, // Flags + nice: u32 = 0, // Nice value (SCHED_OTHER, SCHED_BATCH) + priority: u32 = 0, // Static priority (SCHED_FIFO, SCHED_RR) + // Remaining fields are for SCHED_DEADLINE + runtime: u64 = 0, + deadline: u64 = 0, + period: u64 = 0, +}; + +pub fn sched_setattr(pid: pid_t, attr: *const sched_attr, flags: usize) usize { + return syscall3(.sched_setattr, @as(usize, @bitCast(@as(isize, pid))), @intFromPtr(attr), flags); +} + +pub fn sched_getattr(pid: pid_t, attr: *sched_attr, size: usize, flags: usize) usize { + return syscall4(.sched_getattr, @as(usize, @bitCast(@as(isize, pid))), @intFromPtr(attr), size, flags); +} + +pub fn sched_rr_get_interval(pid: pid_t, tp: *timespec) usize { + return syscall2(.sched_rr_get_interval, @as(usize, @bitCast(@as(isize, pid))), @intFromPtr(tp)); +} + pub fn sched_yield() usize { return syscall0(.sched_yield); } diff --git a/zig/src/Compilation/Config.zig b/zig/src/Compilation/Config.zig index b18cd4dd08..a397cf521d 100644 --- a/zig/src/Compilation/Config.zig +++ b/zig/src/Compilation/Config.zig @@ -294,6 +294,12 @@ pub fn resolve(options: Options) ResolveError!Config { if (options.lto) |x| break :b x; if (!options.any_c_source_files) break :b false; + // https://github.com/llvm/llvm-project/pull/116537 + if (target.cpu.arch.isMIPS64()) switch (target.abi) { + .gnuabin32, .muslabin32 => break :b false, + else => {}, + }; + if (target.cpu.arch.isRISCV()) { // Clang and LLVM currently don't support RISC-V target-abi for LTO. // Compiling with LTO may fail or produce undesired results. @@ -433,6 +439,7 @@ pub fn resolve(options: Options) ResolveError!Config { const debug_format: DebugFormat = b: { if (root_strip and !options.any_non_stripped) break :b .strip; + if (options.debug_format) |x| break :b x; break :b switch (target.ofmt) { .elf, .goff, .macho, .wasm, .xcoff => .{ .dwarf = .@"32" }, .coff => .code_view, diff --git a/zig/src/dev.zig b/zig/src/dev.zig index 9746b307af..0d365c3e19 100644 --- a/zig/src/dev.zig +++ b/zig/src/dev.zig @@ -23,7 +23,7 @@ pub const Env = enum { sema, /// - sema - /// - `zig build-* -fno-llvm -fno-lld -target x86_64-linux` + /// - `zig build-* -fincremental -fno-llvm -fno-lld -target x86_64-linux --listen=-` @"x86_64-linux", /// - sema @@ -130,6 +130,8 @@ pub const Env = enum { else => Env.ast_gen.supports(feature), }, .@"x86_64-linux" => switch (feature) { + .stdio_listen, + .incremental, .x86_64_backend, .elf_linker, => true, diff --git a/zig/src/link/Elf/ZigObject.zig b/zig/src/link/Elf/ZigObject.zig index 84b54aabcd..1e29ab8bf6 100644 --- a/zig/src/link/Elf/ZigObject.zig +++ b/zig/src/link/Elf/ZigObject.zig @@ -1496,7 +1496,7 @@ pub fn updateFunc( }); defer gpa.free(name); const osec = if (self.text_index) |sect_sym_index| - self.atom(self.symbol(sect_sym_index).ref.index).?.output_section_index + self.symbol(sect_sym_index).output_section_index else osec: { const osec = try elf_file.addSection(.{ .name = try elf_file.insertShString(".text"), @@ -1896,12 +1896,13 @@ pub fn deleteExport( } orelse return; const zcu = elf_file.base.comp.zcu.?; const exp_name = name.toSlice(&zcu.intern_pool); - const esym_index = metadata.@"export"(self, exp_name) orelse return; + const sym_index = metadata.@"export"(self, exp_name) orelse return; log.debug("deleting export '{s}'", .{exp_name}); - const esym = &self.symtab.items(.elf_sym)[esym_index.*]; + const esym_index = self.symbol(sym_index.*).esym_index; + const esym = &self.symtab.items(.elf_sym)[esym_index]; _ = self.globals_lookup.remove(esym.st_name); esym.* = Elf.null_sym; - self.symtab.items(.shndx)[esym_index.*] = elf.SHN_UNDEF; + self.symtab.items(.shndx)[esym_index] = elf.SHN_UNDEF; } pub fn getGlobalSymbol(self: *ZigObject, elf_file: *Elf, name: []const u8, lib_name: ?[]const u8) !u32 { diff --git a/zig/test/incremental/add_decl b/zig/test/incremental/add_decl index a2863d6bde..6b3a0dad84 100644 --- a/zig/test/incremental/add_decl +++ b/zig/test/incremental/add_decl @@ -1,5 +1,4 @@ -// Disabled on self-hosted due to linker crash -// #target=x86_64-linux-selfhosted +#target=x86_64-linux-selfhosted #target=x86_64-linux-cbe #target=x86_64-windows-cbe #update=initial version diff --git a/zig/test/incremental/fix_astgen_failure b/zig/test/incremental/fix_astgen_failure index b94c9c77ee..2298bc5248 100644 --- a/zig/test/incremental/fix_astgen_failure +++ b/zig/test/incremental/fix_astgen_failure @@ -1,5 +1,4 @@ -// Disabled on self-hosted due to linker crash -// #target=x86_64-linux-selfhosted +#target=x86_64-linux-selfhosted #target=x86_64-linux-cbe #target=x86_64-windows-cbe #update=initial version with error diff --git a/zig/test/incremental/function_becomes_inline b/zig/test/incremental/function_becomes_inline index b7e604bfac..607cd6805e 100644 --- a/zig/test/incremental/function_becomes_inline +++ b/zig/test/incremental/function_becomes_inline @@ -1,4 +1,4 @@ -//#target=x86_64-linux-selfhosted +#target=x86_64-linux-selfhosted #target=x86_64-linux-cbe #target=x86_64-windows-cbe #update=non-inline version diff --git a/zig/test/incremental/recursive_function_becomes_non_recursive b/zig/test/incremental/recursive_function_becomes_non_recursive index 7a9eb5d26f..e6f27bf2b4 100644 --- a/zig/test/incremental/recursive_function_becomes_non_recursive +++ b/zig/test/incremental/recursive_function_becomes_non_recursive @@ -1,4 +1,4 @@ -//#target=x86_64-linux-selfhosted +#target=x86_64-linux-selfhosted #target=x86_64-linux-cbe #target=x86_64-windows-cbe #update=initial version