@zigc/lib 0.17.0-dev.704 → 0.17.0-dev.813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/math.zig +10 -0
- package/compiler/Maker/Step/TranslateC.zig +8 -4
- package/compiler_rt/log.zig +230 -3
- package/compiler_rt/log10.zig +228 -3
- package/compiler_rt/log2.zig +221 -3
- package/compiler_rt/log_f128.zig +173 -0
- package/package.json +1 -1
- package/std/Io/Writer.zig +6 -2
- package/std/Thread.zig +22 -2
- package/std/c/darwin.zig +6 -0
- package/std/c.zig +26 -5
- package/std/compress/flate/Compress.zig +4 -2
- package/std/crypto/ff.zig +3 -1
- package/std/crypto/tls/Client.zig +17 -2
- package/std/debug/cpu_context.zig +3 -3
- package/std/heap/BrkAllocator.zig +1 -1
- package/std/json/static.zig +2 -1
- package/std/math/isnan.zig +5 -0
- package/std/math/log1p.zig +13 -19
- package/std/math.zig +5 -0
- package/std/meta.zig +3 -12
- package/std/os/linux/csky.zig +165 -0
- package/std/os/linux/microblaze.zig +170 -0
- package/std/os/linux/sh.zig +239 -0
- package/std/os/linux/sparc.zig +277 -0
- package/std/os/linux/sparc64.zig +44 -30
- package/std/os/linux/syscalls.zig +1718 -12
- package/std/os/linux.zig +37 -8
- package/std/os/uefi/protocol/file.zig +16 -0
- package/std/os.zig +0 -10
- package/std/start.zig +5 -5
- package/std/static_string_map.zig +59 -1
- package/std/zig/LibCInstallation.zig +2 -2
- package/std/zig/Parse.zig +1 -1
- package/std/zig/PkgConfig.zig +5 -0
- package/std/zig/system/darwin/macos.zig +11 -7
- package/std/zig/system.zig +1 -1
- package/zig.h +38 -10
- package/libc/musl/src/math/i386/log1p.s +0 -25
- package/libc/musl/src/math/i386/log1pf.s +0 -26
- package/libc/musl/src/math/log1p.c +0 -122
- package/libc/musl/src/math/log1pf.c +0 -77
package/std/os/linux.zig
CHANGED
|
@@ -35,10 +35,12 @@ const arch_bits = switch (native_arch) {
|
|
|
35
35
|
.alpha => @import("linux/alpha.zig"),
|
|
36
36
|
.arc, .arceb => @import("linux/arc.zig"),
|
|
37
37
|
.arm, .armeb, .thumb, .thumbeb => @import("linux/arm.zig"),
|
|
38
|
+
.csky => @import("linux/csky.zig"),
|
|
38
39
|
.hexagon => @import("linux/hexagon.zig"),
|
|
39
40
|
.loongarch32 => @import("linux/loongarch32.zig"),
|
|
40
41
|
.loongarch64 => @import("linux/loongarch64.zig"),
|
|
41
42
|
.m68k => @import("linux/m68k.zig"),
|
|
43
|
+
.microblaze, .microblazeel => @import("linux/microblaze.zig"),
|
|
42
44
|
.mips, .mipsel => @import("linux/mips.zig"),
|
|
43
45
|
.mips64, .mips64el => switch (builtin.abi) {
|
|
44
46
|
.gnuabin32, .muslabin32 => @import("linux/mipsn32.zig"),
|
|
@@ -50,6 +52,8 @@ const arch_bits = switch (native_arch) {
|
|
|
50
52
|
.riscv32 => @import("linux/riscv32.zig"),
|
|
51
53
|
.riscv64 => @import("linux/riscv64.zig"),
|
|
52
54
|
.s390x => @import("linux/s390x.zig"),
|
|
55
|
+
.sh, .sheb => @import("linux/sh.zig"),
|
|
56
|
+
.sparc => @import("linux/sparc.zig"),
|
|
53
57
|
.sparc64 => @import("linux/sparc64.zig"),
|
|
54
58
|
.x86 => @import("linux/x86.zig"),
|
|
55
59
|
.x86_64 => switch (builtin.abi) {
|
|
@@ -105,7 +109,7 @@ pub const user_desc = arch_bits.user_desc;
|
|
|
105
109
|
|
|
106
110
|
pub const blkcnt_t = u64;
|
|
107
111
|
pub const blksize_t = u32;
|
|
108
|
-
pub const dev_t =
|
|
112
|
+
pub const dev_t = u32;
|
|
109
113
|
pub const ino_t = u64;
|
|
110
114
|
pub const mode_t = u32;
|
|
111
115
|
pub const nlink_t = u32;
|
|
@@ -131,9 +135,12 @@ pub const SYS = switch (native_arch) {
|
|
|
131
135
|
.arm, .armeb, .thumb, .thumbeb => syscalls.Arm,
|
|
132
136
|
.csky => syscalls.CSky,
|
|
133
137
|
.hexagon => syscalls.Hexagon,
|
|
138
|
+
.hppa => syscalls.Hppa,
|
|
139
|
+
.hppa64 => syscalls.Hppa64,
|
|
134
140
|
.loongarch32 => syscalls.LoongArch32,
|
|
135
141
|
.loongarch64 => syscalls.LoongArch64,
|
|
136
142
|
.m68k => syscalls.M68k,
|
|
143
|
+
.microblaze, .microblazeel => syscalls.Microblaze,
|
|
137
144
|
.mips, .mipsel => syscalls.MipsO32,
|
|
138
145
|
.mips64, .mips64el => switch (builtin.abi) {
|
|
139
146
|
.gnuabin32, .muslabin32 => syscalls.MipsN32,
|
|
@@ -145,6 +152,7 @@ pub const SYS = switch (native_arch) {
|
|
|
145
152
|
.riscv32 => syscalls.RiscV32,
|
|
146
153
|
.riscv64 => syscalls.RiscV64,
|
|
147
154
|
.s390x => syscalls.S390x,
|
|
155
|
+
.sh, .sheb => syscalls.Sh,
|
|
148
156
|
.sparc => syscalls.Sparc,
|
|
149
157
|
.sparc64 => syscalls.Sparc64,
|
|
150
158
|
.x86 => syscalls.X86,
|
|
@@ -222,7 +230,7 @@ pub const MAP = switch (native_arch) {
|
|
|
222
230
|
UNINITIALIZED: bool = false,
|
|
223
231
|
_: u5 = 0,
|
|
224
232
|
},
|
|
225
|
-
.sparc64 => packed struct(u32) {
|
|
233
|
+
.sparc, .sparc64 => packed struct(u32) {
|
|
226
234
|
TYPE: MAP_TYPE,
|
|
227
235
|
FIXED: bool = false,
|
|
228
236
|
ANONYMOUS: bool = false,
|
|
@@ -288,10 +296,15 @@ pub const MAP = switch (native_arch) {
|
|
|
288
296
|
},
|
|
289
297
|
.arc,
|
|
290
298
|
.arceb,
|
|
299
|
+
.csky,
|
|
291
300
|
.hexagon,
|
|
292
301
|
.m68k,
|
|
302
|
+
.microblaze,
|
|
303
|
+
.microblazeel,
|
|
293
304
|
.or1k,
|
|
294
305
|
.s390x,
|
|
306
|
+
.sh,
|
|
307
|
+
.sheb,
|
|
295
308
|
=> packed struct(u32) {
|
|
296
309
|
TYPE: MAP_TYPE,
|
|
297
310
|
FIXED: bool = false,
|
|
@@ -442,7 +455,7 @@ pub const O = switch (native_arch) {
|
|
|
442
455
|
TMPFILE: bool = false,
|
|
443
456
|
_23: u9 = 0,
|
|
444
457
|
},
|
|
445
|
-
.sparc64 => packed struct(u32) {
|
|
458
|
+
.sparc, .sparc64 => packed struct(u32) {
|
|
446
459
|
ACCMODE: ACCMODE = .RDONLY,
|
|
447
460
|
_2: u1 = 0,
|
|
448
461
|
APPEND: bool = false,
|
|
@@ -518,9 +531,14 @@ pub const O = switch (native_arch) {
|
|
|
518
531
|
},
|
|
519
532
|
.arc,
|
|
520
533
|
.arceb,
|
|
534
|
+
.csky,
|
|
521
535
|
.hexagon,
|
|
536
|
+
.microblaze,
|
|
537
|
+
.microblazeel,
|
|
522
538
|
.or1k,
|
|
523
539
|
.s390x,
|
|
540
|
+
.sh,
|
|
541
|
+
.sheb,
|
|
524
542
|
.xtensa,
|
|
525
543
|
.xtensaeb,
|
|
526
544
|
=> packed struct(u32) {
|
|
@@ -1991,7 +2009,7 @@ pub const F = struct {
|
|
|
1991
2009
|
const SETLKW = 7;
|
|
1992
2010
|
},
|
|
1993
2011
|
},
|
|
1994
|
-
.alpha, .sparc64 => struct {
|
|
2012
|
+
.alpha, .sparc, .sparc64 => struct {
|
|
1995
2013
|
const GETLK = 7;
|
|
1996
2014
|
const SETLK = 8;
|
|
1997
2015
|
const SETLKW = 9;
|
|
@@ -6582,7 +6600,7 @@ const TFD_TIMER = packed struct(u32) {
|
|
|
6582
6600
|
};
|
|
6583
6601
|
|
|
6584
6602
|
pub const TFD = switch (native_arch) {
|
|
6585
|
-
.sparc64 => packed struct(u32) {
|
|
6603
|
+
.sparc, .sparc64 => packed struct(u32) {
|
|
6586
6604
|
_0: u14 = 0,
|
|
6587
6605
|
NONBLOCK: bool = false,
|
|
6588
6606
|
_15: u7 = 0,
|
|
@@ -6633,7 +6651,7 @@ pub const k_sigaction = switch (native_arch) {
|
|
|
6633
6651
|
handler: k_sigaction_funcs.handler,
|
|
6634
6652
|
mask: sigset_t,
|
|
6635
6653
|
},
|
|
6636
|
-
.hexagon, .loongarch32, .loongarch64, .or1k, .riscv32, .riscv64 => extern struct {
|
|
6654
|
+
.csky, .hexagon, .loongarch32, .loongarch64, .or1k, .riscv32, .riscv64 => extern struct {
|
|
6637
6655
|
handler: k_sigaction_funcs.handler,
|
|
6638
6656
|
flags: c_ulong,
|
|
6639
6657
|
mask: sigset_t,
|
|
@@ -6974,12 +6992,16 @@ pub const MINSIGSTKSZ = switch (native_arch) {
|
|
|
6974
6992
|
.mipsel,
|
|
6975
6993
|
.mips64,
|
|
6976
6994
|
.mips64el,
|
|
6995
|
+
.microblaze,
|
|
6996
|
+
.microblazeel,
|
|
6977
6997
|
.or1k,
|
|
6978
6998
|
.powerpc,
|
|
6979
6999
|
.powerpcle,
|
|
6980
7000
|
.riscv32,
|
|
6981
7001
|
.riscv64,
|
|
6982
7002
|
.s390x,
|
|
7003
|
+
.sh,
|
|
7004
|
+
.sheb,
|
|
6983
7005
|
.thumb,
|
|
6984
7006
|
.thumbeb,
|
|
6985
7007
|
.x86,
|
|
@@ -7012,12 +7034,16 @@ pub const SIGSTKSZ = switch (native_arch) {
|
|
|
7012
7034
|
.mipsel,
|
|
7013
7035
|
.mips64,
|
|
7014
7036
|
.mips64el,
|
|
7037
|
+
.microblaze,
|
|
7038
|
+
.microblazeel,
|
|
7015
7039
|
.or1k,
|
|
7016
7040
|
.powerpc,
|
|
7017
7041
|
.powerpcle,
|
|
7018
7042
|
.riscv32,
|
|
7019
7043
|
.riscv64,
|
|
7020
7044
|
.s390x,
|
|
7045
|
+
.sh,
|
|
7046
|
+
.sheb,
|
|
7021
7047
|
.thumb,
|
|
7022
7048
|
.thumbeb,
|
|
7023
7049
|
.x86,
|
|
@@ -8549,7 +8575,7 @@ pub const V = if (is_mips) enum(u32) {
|
|
|
8549
8575
|
STOP = 14,
|
|
8550
8576
|
LNEXT = 15,
|
|
8551
8577
|
DISCARD = 16,
|
|
8552
|
-
} else if (
|
|
8578
|
+
} else if (native_arch == .alpha) enum(u32) {
|
|
8553
8579
|
EOF = 0,
|
|
8554
8580
|
EOL = 1,
|
|
8555
8581
|
EOL2 = 2,
|
|
@@ -10715,6 +10741,7 @@ pub const AUDIT = struct {
|
|
|
10715
10741
|
.loongarch32 => .LOONGARCH32,
|
|
10716
10742
|
.loongarch64 => .LOONGARCH64,
|
|
10717
10743
|
.m68k => .M68K,
|
|
10744
|
+
.microblaze, .microblazeel => .MICROBLAZE,
|
|
10718
10745
|
.mips => .MIPS,
|
|
10719
10746
|
.mipsel => .MIPSEL,
|
|
10720
10747
|
.mips64 => switch (native_abi) {
|
|
@@ -10731,9 +10758,11 @@ pub const AUDIT = struct {
|
|
|
10731
10758
|
.powerpc64le => .PPC64LE,
|
|
10732
10759
|
.riscv32 => .RISCV32,
|
|
10733
10760
|
.riscv64 => .RISCV64,
|
|
10761
|
+
.s390x => .S390X,
|
|
10762
|
+
.sh => .SHEL,
|
|
10763
|
+
.sheb => .SH,
|
|
10734
10764
|
.sparc => .SPARC,
|
|
10735
10765
|
.sparc64 => .SPARC64,
|
|
10736
|
-
.s390x => .S390X,
|
|
10737
10766
|
.x86 => .I386,
|
|
10738
10767
|
.x86_64 => .X86_64,
|
|
10739
10768
|
.xtensa => .XTENSA,
|
|
@@ -125,6 +125,22 @@ pub const File = extern struct {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
pub fn readSize(self: *File) ReadError!usize {
|
|
129
|
+
const zerobuf: [0]u8 = undefined;
|
|
130
|
+
var size: usize = 0;
|
|
131
|
+
switch (self._read(self, &size, &zerobuf)) {
|
|
132
|
+
.success, .buffer_too_small => return size,
|
|
133
|
+
.no_media => return error.NoMedia,
|
|
134
|
+
.device_error => return error.DeviceError,
|
|
135
|
+
.volume_corrupted => return error.VolumeCorrupted,
|
|
136
|
+
else => |status| return uefi.unexpectedStatus(status),
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// If `self` is a directory entry and `buffer` is too small to contain the
|
|
141
|
+
/// next entry, this function returns `Error.BufferTooSmall`. You can call
|
|
142
|
+
/// `readSize` before or after to determine how big the buffer should be to
|
|
143
|
+
/// call this function.
|
|
128
144
|
pub fn read(self: *File, buffer: []u8) ReadError!usize {
|
|
129
145
|
var size: usize = buffer.len;
|
|
130
146
|
switch (self._read(self, &size, buffer.ptr)) {
|
package/std/os.zig
CHANGED
|
@@ -15,19 +15,9 @@ pub fn targetRequiresLibC(target: *const std.Target) bool {
|
|
|
15
15
|
if (target.requiresLibC()) return true;
|
|
16
16
|
return switch (target.os.tag) {
|
|
17
17
|
.linux => switch (target.cpu.arch) {
|
|
18
|
-
// https://codeberg.org/ziglang/zig/issues/30942
|
|
19
|
-
.csky,
|
|
20
18
|
// https://codeberg.org/ziglang/zig/issues/30943
|
|
21
19
|
.hppa,
|
|
22
20
|
.hppa64,
|
|
23
|
-
// https://codeberg.org/ziglang/zig/issues/30944
|
|
24
|
-
.microblaze,
|
|
25
|
-
.microblazeel,
|
|
26
|
-
// https://codeberg.org/ziglang/zig/issues/30946
|
|
27
|
-
.sh,
|
|
28
|
-
.sheb,
|
|
29
|
-
// https://codeberg.org/ziglang/zig/issues/30945
|
|
30
|
-
.sparc,
|
|
31
21
|
=> true,
|
|
32
22
|
else => false,
|
|
33
23
|
},
|
package/std/start.zig
CHANGED
|
@@ -170,7 +170,7 @@ fn _start() callconv(.naked) noreturn {
|
|
|
170
170
|
.loongarch32, .loongarch64 => ".cfi_undefined 1",
|
|
171
171
|
.m68k => ".cfi_undefined %%pc",
|
|
172
172
|
.m88k => ".cfi_undefined %%r1",
|
|
173
|
-
.microblaze, .microblazeel => "
|
|
173
|
+
.microblaze, .microblazeel => "", // No CFI support.
|
|
174
174
|
.mips, .mipsel, .mips64, .mips64el => ".cfi_undefined $ra",
|
|
175
175
|
.or1k => ".cfi_undefined r9",
|
|
176
176
|
.powerpc, .powerpcle, .powerpc64, .powerpc64le => ".cfi_undefined lr",
|
|
@@ -345,11 +345,11 @@ fn _start() callconv(.naked) noreturn {
|
|
|
345
345
|
,
|
|
346
346
|
.microblaze, .microblazeel =>
|
|
347
347
|
// r1 = SP, r15 = LR, r19 = FP, r20 = GP
|
|
348
|
-
\\ ori r15, r0,
|
|
349
|
-
\\ ori r19, r0,
|
|
348
|
+
\\ ori r15, r0, 0
|
|
349
|
+
\\ ori r19, r0, 0
|
|
350
350
|
\\ mfs r20, rpc
|
|
351
|
-
\\
|
|
352
|
-
\\ ori r5, r1,
|
|
351
|
+
\\ addi r20, r20, _GLOBAL_OFFSET_TABLE_ + 8
|
|
352
|
+
\\ ori r5, r1, 0
|
|
353
353
|
\\ andi r1, r1, -4
|
|
354
354
|
\\ brlid r15, %[posixCallMainAndExit]
|
|
355
355
|
,
|
|
@@ -100,6 +100,52 @@ pub fn StaticStringMapWithEql(
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/// Returns a map backed by static, comptime allocated memory.
|
|
104
|
+
///
|
|
105
|
+
/// `V` must be an enum. The enum's tag names will be used as the keys.
|
|
106
|
+
pub inline fn initEnum() Self {
|
|
107
|
+
comptime {
|
|
108
|
+
var self: Self = .{};
|
|
109
|
+
|
|
110
|
+
const field_names = @typeInfo(V).@"enum".field_names;
|
|
111
|
+
if (field_names.len == 0) return self;
|
|
112
|
+
|
|
113
|
+
// Since the KVs are sorted, a linearly-growing bound will never
|
|
114
|
+
// be sufficient for extreme cases. So we grow proportional to
|
|
115
|
+
// N*log2(N).
|
|
116
|
+
@setEvalBranchQuota(10 * field_names.len * std.math.log2_int_ceil(usize, field_names.len));
|
|
117
|
+
|
|
118
|
+
var sorted_keys: [field_names.len][]const u8 = field_names[0..field_names.len].*;
|
|
119
|
+
var sorted_vals: [field_names.len]V = undefined;
|
|
120
|
+
for (&sorted_vals, @typeInfo(V).@"enum".field_values) |*x, i| x.* = @enumFromInt(i);
|
|
121
|
+
|
|
122
|
+
for (field_names) |field_name| {
|
|
123
|
+
self.min_len = @min(self.min_len, field_name.len);
|
|
124
|
+
self.max_len = @max(self.max_len, field_name.len);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
mem.sortUnstableContext(0, sorted_keys.len, SortContext{
|
|
128
|
+
.keys = &sorted_keys,
|
|
129
|
+
.vals = &sorted_vals,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const final_keys = sorted_keys;
|
|
133
|
+
const final_vals = sorted_vals;
|
|
134
|
+
self.kvs = &.{
|
|
135
|
+
.keys = &final_keys,
|
|
136
|
+
.values = &final_vals,
|
|
137
|
+
.len = @intCast(field_names.len),
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
var len_indexes: [self.max_len + 1]u32 = undefined;
|
|
141
|
+
self.initLenIndexes(&len_indexes);
|
|
142
|
+
const final_len_indexes = len_indexes;
|
|
143
|
+
self.len_indexes = &final_len_indexes;
|
|
144
|
+
self.len_indexes_len = @intCast(len_indexes.len);
|
|
145
|
+
return self;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
103
149
|
/// Returns a map backed by memory allocated with `allocator`.
|
|
104
150
|
///
|
|
105
151
|
/// Handles `kvs_list` the same way as `initComptime()`.
|
|
@@ -195,7 +241,7 @@ pub fn StaticStringMapWithEql(
|
|
|
195
241
|
return self.kvs.values[self.getIndex(str) orelse return null];
|
|
196
242
|
}
|
|
197
243
|
|
|
198
|
-
|
|
244
|
+
fn getIndex(self: Self, str: []const u8) ?usize {
|
|
199
245
|
const kvs = self.kvs.*;
|
|
200
246
|
if (kvs.len == 0)
|
|
201
247
|
return null;
|
|
@@ -536,3 +582,15 @@ test "sorting kvs doesn't exceed eval branch quota" {
|
|
|
536
582
|
});
|
|
537
583
|
try testing.expectEqual(1, TypeToByteSizeLUT.get("t1"));
|
|
538
584
|
}
|
|
585
|
+
|
|
586
|
+
test "initEnum" {
|
|
587
|
+
const UnsortedEnum = enum { BB, A, CCC, DDD };
|
|
588
|
+
const map = StaticStringMap(UnsortedEnum).initEnum();
|
|
589
|
+
try testing.expect(map.has("A"));
|
|
590
|
+
try testing.expect(!map.has("a"));
|
|
591
|
+
try testing.expectEqual(.BB, map.get("BB"));
|
|
592
|
+
try testing.expectEqual(.A, map.get("A"));
|
|
593
|
+
try testing.expectEqual(.CCC, map.get("CCC"));
|
|
594
|
+
try testing.expectEqual(.DDD, map.get("DDD"));
|
|
595
|
+
try testing.expectEqual(null, map.getIndex("F"));
|
|
596
|
+
}
|
|
@@ -421,7 +421,7 @@ fn findNativeCrtDirWindows(
|
|
|
421
421
|
const arch_sub_dir = switch (target.cpu.arch) {
|
|
422
422
|
.x86 => "x86",
|
|
423
423
|
.x86_64 => "x64",
|
|
424
|
-
.
|
|
424
|
+
.thumb => "arm",
|
|
425
425
|
.aarch64 => "arm64",
|
|
426
426
|
else => return error.UnsupportedArchitecture,
|
|
427
427
|
};
|
|
@@ -488,7 +488,7 @@ fn findNativeKernel32LibDir(
|
|
|
488
488
|
const arch_sub_dir = switch (args.target.cpu.arch) {
|
|
489
489
|
.x86 => "x86",
|
|
490
490
|
.x86_64 => "x64",
|
|
491
|
-
.
|
|
491
|
+
.thumb => "arm",
|
|
492
492
|
.aarch64 => "arm64",
|
|
493
493
|
else => return error.UnsupportedArchitecture,
|
|
494
494
|
};
|
package/std/zig/Parse.zig
CHANGED
|
@@ -2947,7 +2947,7 @@ fn parseAddrSpace(p: *Parse) !?Node.Index {
|
|
|
2947
2947
|
/// such as in the case of anytype and `...`. Caller must look for rparen to find
|
|
2948
2948
|
/// out when there are no more param decls left.
|
|
2949
2949
|
///
|
|
2950
|
-
/// ParamDecl <- doc_comment? (KEYWORD_noalias / KEYWORD_comptime / !KEYWORD_comptime) (IDENTIFIER COLON / !(
|
|
2950
|
+
/// ParamDecl <- doc_comment? (KEYWORD_noalias / KEYWORD_comptime / !KEYWORD_comptime) (IDENTIFIER COLON / !(IDENTIFIER COLON)) ParamType
|
|
2951
2951
|
///
|
|
2952
2952
|
/// ParamType
|
|
2953
2953
|
/// <- KEYWORD_anytype
|
package/std/zig/PkgConfig.zig
CHANGED
|
@@ -95,6 +95,7 @@ pub const Parsed = struct {
|
|
|
95
95
|
cflags: []const []const u8,
|
|
96
96
|
libs: []const []const u8,
|
|
97
97
|
unknown_flags: []const []const u8,
|
|
98
|
+
pthread: bool,
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
pub const ParseError = Allocator.Error || error{InvalidPkgConfigOutput};
|
|
@@ -105,6 +106,7 @@ pub fn parse(arena: Allocator, stdout: []const u8) ParseError!Parsed {
|
|
|
105
106
|
var zig_libs: std.ArrayList([]const u8) = .empty;
|
|
106
107
|
var unknown_flags: std.ArrayList([]const u8) = .empty;
|
|
107
108
|
var arg_it = mem.tokenizeAny(u8, stdout, " \r\n\t");
|
|
109
|
+
var pthread = false;
|
|
108
110
|
|
|
109
111
|
while (arg_it.next()) |arg| {
|
|
110
112
|
if (mem.eql(u8, arg, "-I")) {
|
|
@@ -129,6 +131,8 @@ pub fn parse(arena: Allocator, stdout: []const u8) ParseError!Parsed {
|
|
|
129
131
|
try zig_cflags.append(arena, arg);
|
|
130
132
|
} else if (mem.cutPrefix(u8, arg, "-Wl,-rpath,")) |rest| {
|
|
131
133
|
try zig_cflags.appendSlice(arena, &.{ "-rpath", rest });
|
|
134
|
+
} else if (mem.eql(u8, arg, "-pthread")) {
|
|
135
|
+
pthread = true;
|
|
132
136
|
} else {
|
|
133
137
|
try unknown_flags.append(arena, arg);
|
|
134
138
|
}
|
|
@@ -142,5 +146,6 @@ pub fn parse(arena: Allocator, stdout: []const u8) ParseError!Parsed {
|
|
|
142
146
|
.cflags = zig_cflags.toOwnedSliceAssert(),
|
|
143
147
|
.libs = zig_libs.toOwnedSliceAssert(),
|
|
144
148
|
.unknown_flags = unknown_flags.toOwnedSliceAssert(),
|
|
149
|
+
.pthread = pthread,
|
|
145
150
|
};
|
|
146
151
|
}
|
|
@@ -411,7 +411,7 @@ pub fn detectNativeCpuAndFeatures() ?Target.Cpu {
|
|
|
411
411
|
|
|
412
412
|
const current_arch = builtin.cpu.arch;
|
|
413
413
|
switch (current_arch) {
|
|
414
|
-
.aarch64
|
|
414
|
+
.aarch64 => {
|
|
415
415
|
const model = switch (cpu_family) {
|
|
416
416
|
.ARM_CYCLONE => &Target.aarch64.cpu.apple_a7,
|
|
417
417
|
.ARM_TYPHOON => &Target.aarch64.cpu.apple_a8,
|
|
@@ -420,17 +420,21 @@ pub fn detectNativeCpuAndFeatures() ?Target.Cpu {
|
|
|
420
420
|
.ARM_MONSOON_MISTRAL => &Target.aarch64.cpu.apple_a11,
|
|
421
421
|
.ARM_VORTEX_TEMPEST => &Target.aarch64.cpu.apple_a12,
|
|
422
422
|
.ARM_LIGHTNING_THUNDER => &Target.aarch64.cpu.apple_a13,
|
|
423
|
-
.ARM_FIRESTORM_ICESTORM => &Target.aarch64.cpu.
|
|
424
|
-
.ARM_BLIZZARD_AVALANCHE => &Target.aarch64.cpu.
|
|
425
|
-
.ARM_EVEREST_SAWTOOTH => &Target.aarch64.cpu.
|
|
423
|
+
.ARM_FIRESTORM_ICESTORM => &Target.aarch64.cpu.apple_a14,
|
|
424
|
+
.ARM_BLIZZARD_AVALANCHE => &Target.aarch64.cpu.apple_a15,
|
|
425
|
+
.ARM_EVEREST_SAWTOOTH => &Target.aarch64.cpu.apple_a16,
|
|
426
426
|
.ARM_IBIZA => &Target.aarch64.cpu.apple_m3, // base
|
|
427
427
|
.ARM_PALMA => &Target.aarch64.cpu.apple_m3, // max
|
|
428
428
|
.ARM_LOBOS => &Target.aarch64.cpu.apple_m3, // pro
|
|
429
|
-
.ARM_COLL => &Target.aarch64.cpu.apple_a17, //
|
|
429
|
+
.ARM_COLL => &Target.aarch64.cpu.apple_a17, // pro
|
|
430
430
|
.ARM_DONAN => &Target.aarch64.cpu.apple_m4, // base
|
|
431
431
|
.ARM_BRAVA => &Target.aarch64.cpu.apple_m4, // pro/max
|
|
432
|
-
.ARM_TAHITI => &Target.aarch64.cpu.
|
|
433
|
-
.ARM_TUPAI => &Target.aarch64.cpu.
|
|
432
|
+
.ARM_TAHITI => &Target.aarch64.cpu.apple_a18, // pro
|
|
433
|
+
.ARM_TUPAI => &Target.aarch64.cpu.apple_a18, // base
|
|
434
|
+
.ARM_HIDRA => &Target.aarch64.cpu.apple_m5, // base
|
|
435
|
+
.ARM_SOTRA => &Target.aarch64.cpu.apple_m5, // pro/max
|
|
436
|
+
.ARM_THERA => &Target.aarch64.cpu.apple_a19, // pro
|
|
437
|
+
.ARM_TILOS => &Target.aarch64.cpu.apple_a19, // base
|
|
434
438
|
else => return null,
|
|
435
439
|
};
|
|
436
440
|
|
package/std/zig/system.zig
CHANGED
|
@@ -152,7 +152,7 @@ pub fn getExternalExecutor(io: Io, candidate: *const std.Target, options: GetExt
|
|
|
152
152
|
// TODO: Actually check the SuperH version.
|
|
153
153
|
.sh => "qemu-sh4",
|
|
154
154
|
.sheb => "qemu-sh4eb",
|
|
155
|
-
.sparc =>
|
|
155
|
+
.sparc => "qemu-sparc32plus",
|
|
156
156
|
.thumb => "qemu-arm",
|
|
157
157
|
.thumbeb => "qemu-armeb",
|
|
158
158
|
else => "qemu-" ++ @tagName(t),
|
package/zig.h
CHANGED
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
#elif defined(__GNUC__)
|
|
12
12
|
#define zig_gcc
|
|
13
13
|
#define zig_gnuc
|
|
14
|
-
#elif defined(__IBMC__)
|
|
15
|
-
#define zig_xlc
|
|
16
14
|
#elif defined(__TINYC__)
|
|
17
15
|
#define zig_tinyc
|
|
18
16
|
#elif defined(__slimcc__)
|
|
@@ -28,8 +26,18 @@
|
|
|
28
26
|
#define zig_arm
|
|
29
27
|
#elif defined(__arm__)
|
|
30
28
|
#define zig_arm
|
|
29
|
+
#elif defined(__arc__)
|
|
30
|
+
#define zig_arc
|
|
31
|
+
#elif defined(__csky__)
|
|
32
|
+
#define zig_csky
|
|
31
33
|
#elif defined(__hexagon__)
|
|
32
34
|
#define zig_hexagon
|
|
35
|
+
#elif defined(__hppa__) && defined(_LP64)
|
|
36
|
+
#define zig_hppa64
|
|
37
|
+
#define zig_hppa
|
|
38
|
+
#elif defined(__hppa__)
|
|
39
|
+
#define zig_hppa32
|
|
40
|
+
#define zig_hppa
|
|
33
41
|
#elif defined(__kvx__)
|
|
34
42
|
#define zig_kvx
|
|
35
43
|
#elif defined(__loongarch32)
|
|
@@ -42,6 +50,8 @@
|
|
|
42
50
|
#define zig_m68k
|
|
43
51
|
#elif defined(__m88k__)
|
|
44
52
|
#define zig_m88k
|
|
53
|
+
#elif defined(__microblaze__)
|
|
54
|
+
#define zig_microblaze
|
|
45
55
|
#elif defined(__mips64)
|
|
46
56
|
#define zig_mips64
|
|
47
57
|
#define zig_mips
|
|
@@ -64,6 +74,8 @@
|
|
|
64
74
|
#define zig_riscv
|
|
65
75
|
#elif defined(__s390x__)
|
|
66
76
|
#define zig_s390x
|
|
77
|
+
#elif defined(__sh__)
|
|
78
|
+
#define zig_sh
|
|
67
79
|
#elif defined(__sparc__) && defined(__arch64__)
|
|
68
80
|
#define zig_sparc64
|
|
69
81
|
#define zig_sparc
|
|
@@ -100,32 +112,30 @@
|
|
|
100
112
|
#define zig_big_endian 1
|
|
101
113
|
#endif
|
|
102
114
|
|
|
103
|
-
#if defined(
|
|
115
|
+
#if defined(__APPLE__)
|
|
104
116
|
#define zig_darwin
|
|
105
117
|
#elif defined(__DragonFly__)
|
|
106
118
|
#define zig_dragonfly
|
|
107
|
-
#define zig_bsd
|
|
108
119
|
#elif defined(__EMSCRIPTEN__)
|
|
109
120
|
#define zig_emscripten
|
|
110
121
|
#elif defined(__FreeBSD__)
|
|
111
122
|
#define zig_freebsd
|
|
112
|
-
#define zig_bsd
|
|
113
123
|
#elif defined(__Fuchsia__)
|
|
114
124
|
#define zig_fuchsia
|
|
115
125
|
#elif defined(__HAIKU__)
|
|
116
126
|
#define zig_haiku
|
|
117
127
|
#elif defined(__gnu_hurd__)
|
|
118
128
|
#define zig_hurd
|
|
129
|
+
#elif defined(__illumos__)
|
|
130
|
+
#define zig_illumos
|
|
119
131
|
#elif defined(__linux__)
|
|
120
132
|
#define zig_linux
|
|
121
133
|
#elif defined(__NetBSD__)
|
|
122
134
|
#define zig_netbsd
|
|
123
|
-
#define zig_bsd
|
|
124
135
|
#elif defined(__OpenBSD__)
|
|
125
136
|
#define zig_openbsd
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#define zig_solaris
|
|
137
|
+
#elif defined(__serenity__)
|
|
138
|
+
#define zig_serenity
|
|
129
139
|
#elif defined(__wasi__)
|
|
130
140
|
#define zig_wasi
|
|
131
141
|
#elif defined(_WIN32)
|
|
@@ -404,14 +414,22 @@
|
|
|
404
414
|
#define zig_trap() __asm__ volatile("udf #0xfe")
|
|
405
415
|
#elif defined(zig_arm) || defined(zig_aarch64)
|
|
406
416
|
#define zig_trap() __asm__ volatile("udf #0xfdee")
|
|
417
|
+
#elif defined(zig_arc)
|
|
418
|
+
#define zig_trap() __asm__ volatile("unimp_s")
|
|
419
|
+
#elif defined(zig_csky)
|
|
420
|
+
#define zig_trap() __asm__ volatile(".word 0x3fff")
|
|
407
421
|
#elif defined(zig_hexagon)
|
|
408
422
|
#define zig_trap() __asm__ volatile("r27:26 = memd(#0xbadc0fee)")
|
|
423
|
+
#elif defined(zig_hppa)
|
|
424
|
+
#define zig_trap() __asm__ volatile("iitlbp %r0, (%sr0, %r0)")
|
|
409
425
|
#elif defined(zig_kvx) || defined(zig_loongarch) || defined(zig_powerpc)
|
|
410
426
|
#define zig_trap() __asm__ volatile(".word 0x0")
|
|
411
427
|
#elif defined(zig_m68k)
|
|
412
428
|
#define zig_trap() __asm__ volatile("illegal")
|
|
413
429
|
#elif defined(zig_m88k)
|
|
414
430
|
#define zig_trap() __asm__ volatile("tb0 0, %%r0, 511")
|
|
431
|
+
#elif defined(zig_microblaze)
|
|
432
|
+
#define zig_trap() __asm__ volatile("getd r0, r0")
|
|
415
433
|
#elif defined(zig_mips)
|
|
416
434
|
#define zig_trap() __asm__ volatile(".word 0x3d")
|
|
417
435
|
#elif defined(zig_or1k)
|
|
@@ -420,6 +438,8 @@
|
|
|
420
438
|
#define zig_trap() __asm__ volatile("unimp")
|
|
421
439
|
#elif defined(zig_s390x)
|
|
422
440
|
#define zig_trap() __asm__ volatile("j 0x2")
|
|
441
|
+
#elif defined(zig_sh)
|
|
442
|
+
#define zig_trap() __asm__ volatile(".word 0x0001")
|
|
423
443
|
#elif defined(zig_sparc)
|
|
424
444
|
#define zig_trap() __asm__ volatile("illtrap")
|
|
425
445
|
#elif defined(zig_x86_16)
|
|
@@ -446,16 +466,22 @@
|
|
|
446
466
|
|
|
447
467
|
#if defined(zig_alpha)
|
|
448
468
|
#define zig_breakpoint() __asm__ volatile("call_pal 0x000080")
|
|
449
|
-
#elif defined(zig_arm)
|
|
469
|
+
#elif defined(zig_arm) || defined(zig_csky)
|
|
450
470
|
#define zig_breakpoint() __asm__ volatile("bkpt #0x0")
|
|
451
471
|
#elif defined(zig_aarch64)
|
|
452
472
|
#define zig_breakpoint() __asm__ volatile("brk #0xf000")
|
|
473
|
+
#elif defined(zig_arc)
|
|
474
|
+
#define zig_breakpoint() __asm__ volatile("brk_s")
|
|
453
475
|
#elif defined(zig_hexagon)
|
|
454
476
|
#define zig_breakpoint() __asm__ volatile("brkpt")
|
|
477
|
+
#elif defined(zig_hppa)
|
|
478
|
+
#define zig_breakpoint() __asm__ volatile("break 0x04, 0x0008")
|
|
455
479
|
#elif defined(zig_kvx) || defined(zig_loongarch)
|
|
456
480
|
#define zig_breakpoint() __asm__ volatile("break 0x0")
|
|
457
481
|
#elif defined(zig_m88k)
|
|
458
482
|
#define zig_breakpoint() __asm__ volatile("illop1")
|
|
483
|
+
#elif defined(zig_microblaze)
|
|
484
|
+
#define zig_breakpoint() __asm__ volatile("brki r16, 0x0018")
|
|
459
485
|
#elif defined(zig_mips)
|
|
460
486
|
#define zig_breakpoint() __asm__ volatile("break")
|
|
461
487
|
#elif defined(zig_or1k)
|
|
@@ -466,6 +492,8 @@
|
|
|
466
492
|
#define zig_breakpoint() __asm__ volatile("ebreak")
|
|
467
493
|
#elif defined(zig_s390x)
|
|
468
494
|
#define zig_breakpoint() __asm__ volatile("j 0x6")
|
|
495
|
+
#elif defined(zig_sh)
|
|
496
|
+
#define zig_breakpoint() __asm__ volatile("trapa #0xc3")
|
|
469
497
|
#elif defined(zig_sparc)
|
|
470
498
|
#define zig_breakpoint() __asm__ volatile("ta 0x1")
|
|
471
499
|
#elif defined(zig_x86)
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.global log1p
|
|
2
|
-
.type log1p,@function
|
|
3
|
-
log1p:
|
|
4
|
-
mov 8(%esp),%eax
|
|
5
|
-
fldln2
|
|
6
|
-
and $0x7fffffff,%eax
|
|
7
|
-
fldl 4(%esp)
|
|
8
|
-
cmp $0x3fd28f00,%eax
|
|
9
|
-
ja 1f
|
|
10
|
-
cmp $0x00100000,%eax
|
|
11
|
-
jb 2f
|
|
12
|
-
fyl2xp1
|
|
13
|
-
fstpl 4(%esp)
|
|
14
|
-
fldl 4(%esp)
|
|
15
|
-
ret
|
|
16
|
-
1: fld1
|
|
17
|
-
faddp
|
|
18
|
-
fyl2x
|
|
19
|
-
fstpl 4(%esp)
|
|
20
|
-
fldl 4(%esp)
|
|
21
|
-
ret
|
|
22
|
-
# subnormal x, return x with underflow
|
|
23
|
-
2: fsts 4(%esp)
|
|
24
|
-
fstp %st(1)
|
|
25
|
-
ret
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.global log1pf
|
|
2
|
-
.type log1pf,@function
|
|
3
|
-
log1pf:
|
|
4
|
-
mov 4(%esp),%eax
|
|
5
|
-
fldln2
|
|
6
|
-
and $0x7fffffff,%eax
|
|
7
|
-
flds 4(%esp)
|
|
8
|
-
cmp $0x3e940000,%eax
|
|
9
|
-
ja 1f
|
|
10
|
-
cmp $0x00800000,%eax
|
|
11
|
-
jb 2f
|
|
12
|
-
fyl2xp1
|
|
13
|
-
fstps 4(%esp)
|
|
14
|
-
flds 4(%esp)
|
|
15
|
-
ret
|
|
16
|
-
1: fld1
|
|
17
|
-
faddp
|
|
18
|
-
fyl2x
|
|
19
|
-
fstps 4(%esp)
|
|
20
|
-
flds 4(%esp)
|
|
21
|
-
ret
|
|
22
|
-
# subnormal x, return x with underflow
|
|
23
|
-
2: fxch
|
|
24
|
-
fmul %st(1)
|
|
25
|
-
fstps 4(%esp)
|
|
26
|
-
ret
|