2860 Commits

Author SHA1 Message Date
daurnimator
b42ffbe9e8
std: use PR enum as only location of opcode numbers 2020-11-04 22:39:35 +11:00
daurnimator
b90fb1e96b
std: add PR enum for the prctl opcode 2020-11-04 22:32:57 +11:00
daurnimator
02252f3f07
std: workaround #280 in prctl 2020-11-04 22:23:59 +11:00
Frank Denis
342ba960f7 sparc64 has a 8Kb page size 2020-11-03 17:29:20 -05:00
Andrew Kelley
ede41759be std.fs.File.writeFileAll: support unseekable files
With this commit, the function tries to use more efficient syscalls, and
then falls back to non-positional reads.

The motivating use case for this change is to support something like the
following:

try io.getStdOut().writeFileAll(dest_file, .{});
2020-11-03 15:25:43 -07:00
Frank Denis
37bc6ee54a std.meta: test that const and mut variables have different addresses
We are checking that two identical, constant values, are stored at
different addresses.

But sharing a unique location doesn't look like something the compiler
wouldn't do.

It may make more sense to check that a const variable and a mutable
variable set to the same value have different addresses.
2020-11-03 16:52:51 -05:00
Andrew Kelley
f2cb63c2e1
Merge pull request #6956 from jedisct1/more-gimli-be-fixes
Another big-endian fix for Gimli
2020-11-03 11:22:54 -05:00
Jakub Konka
5060497174
Merge pull request #6921 from xackus/gimmeMoreOfThoseSweetSweetFileDescriptors
stage2: ask for more file descriptors
2020-11-03 10:07:39 +01:00
Frank Denis
8d7c160fb4 Make Gimli test vector look like the python implementation 2020-11-03 09:13:14 +01:00
Frank Denis
d764636d21 Another big-endian fix for Gimli
We read and write bytes directly from the state, but in the init
function, we potentially endian-swap them.

Initialize bytes in native format since we will be reading them
in native format as well later.

Also use the public interface in the "permute" test rather than an
internal interface. The state itself is not meant to be accessed directly,
even in tests.
2020-11-03 02:01:48 +01:00
Jakub Konka
8dda64fa3e
Fix Darwin codepath
On Darwin, according to the man pages for setrlimit(), when adjusting
max number of open fds, the reported hard max by getrlimit() is only
theoretical, while the actual maximum, set in the kernel, is hardcoded
in the header file. Therefore, the reported max has to be adjusted
as `min(OPEN_MAX, lim.max)`.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-11-03 00:38:43 +01:00
LemonBoy
35a8d90e55 std: Make parseInt/parseUnsigned detect the radix 2020-11-02 14:13:06 -05:00
Andrew Kelley
00ceb592ef
Merge pull request #6932 from kubkon/fix-6318
macOS: fix linking issues on BigSur
2020-11-02 13:41:32 -05:00
Frank Denis
ad9655db3a Fix Gimli for big-endian targets 2020-11-02 13:38:20 -05:00
Andrew Kelley
061ff11b2b
Merge pull request #6927 from LemonBoy/mipsbe-std
Fixes for stdlib for mips BE targets
2020-11-02 13:37:24 -05:00
Alex Cameron
ecdd636605 Fix file descriptor leak in fs.openFileZ. 2020-11-02 13:28:29 -05:00
Isaac Freund
50ba018223 std/ascii: add spaces array
This may be combined with std.mem.trim to form a proper replacement for
the now deprecated std.fmt.trimWhitespace().
2020-11-02 13:20:58 -05:00
Jakub Konka
7f5c96378d Refactor the code according to Andrew's suggestions 2020-11-02 18:38:09 +01:00
Jakub Konka
317c555a5c Fix linking issues on BigSur
This commit fixes linking issue on macOS 11 BigSur by appending
a prefix path to all lib and framework search paths known as
`-syslibroot`.

The reason this is needed is that in macOS 11, the system libraries
and frameworks are no longer readily available in the filesystem.
Instead, the new macOS ships with a built-in dynamic linker cache
of all system-provided libraries, and hence, when linking with either
`lld.ld64` or `ld64`, it is required to pass in `-syslibroot [dir]`.
The latter can usually be obtained by invoking `xcrun --show-sdk-path`.
With this commit, Zig will do this automatically when compiling natively
on macOS. However, it also provides a flag `-syslibroot` which can be
used to overwrite the automtically populated value.

To summarise, with this change, the user of Zig is not required to
generate and append their own syslibroot path. Standard invocations
such as `zig build-exe hello.zig` or `zig build` for projects will
work out of the box. The only missing bit is `zig cc` and `zig c++`
since the addition of the `-syslibroot` option would be a mismatch
between the values provided by `clang` itself and Zig's wrapper.
2020-11-02 17:06:09 +01:00
LemonBoy
dc872a221d std: Fix syscall stubs passing 64bit offsets for BE targets 2020-11-02 12:11:07 +01:00
LemonBoy
76e9a4ae83 std: Fix std.unicode test cases for BE targets 2020-11-02 11:48:06 +01:00
LemonBoy
02efc2236a std: Fix json utf{8,16} decoding on BE targets
Byteswap some values when LE ordering is required.
2020-11-02 11:46:50 +01:00
LemonBoy
307496fcd7 std: Re-enable ArrayHashMap test for mips targets 2020-11-02 11:46:07 +01:00
Andrew Kelley
909aae8153
Merge pull request #6792 from koachan/sparc64-linux
Initial sparc64-linux bringup
2020-11-01 22:14:56 -05:00
Andrew Kelley
af60931a48
Merge pull request #6888 from jcmoyer/issues/6874
Update std.fmt docs and add test for null terminated slices with embedded null bytes
2020-11-01 18:30:09 -05:00
LemonBoy
445d808bae std: Fix early overflow in time calculation
Closes #6867
2020-11-01 17:06:14 -05:00
LemonBoy
0d6a7088dc stage1: Implement Add/Mul reduction operators 2020-11-01 14:30:31 -07:00
LemonBoy
6f3d6c1f45 std: Fix expectWithinEpsilon with negative values 2020-11-01 14:30:31 -07:00
Jakub Konka
d530e7f9c7 Make std.fmt.bufPrintIntToSlice public
Deprecate `std.fmt.trim` and `std.fmt.isWhiteSpace` in favour of
`std.mem` alternatives.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-11-01 15:48:50 -05:00
xackus
6418284680 std: add {set,get}rlimit bits and improve test 2020-11-01 15:47:46 -05:00
frmdstryr
36f1788762 Add missing arg 2020-11-01 15:40:42 -05:00
Frank Denis
c387f1340f std/crypto: make Hkdf functions public 2020-11-01 18:27:11 +02:00
J.C. Moyer
788900c35c Add test for null terminated slices with embedded null bytes 2020-10-30 23:58:23 -04:00
J.C. Moyer
b38dea37c7 Update doc comments to reflect current behavior 2020-10-30 23:58:23 -04:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
Andrew Kelley
e59f44712d
Merge pull request #6875 from jorangreef/mips_syscalls
Add more mips syscall numbers
2020-10-30 13:31:12 -04:00
Veikka Tuominen
80dd432137
Merge pull request #6858 from travv0/no-star-after-dot-star
don't allow a token starting with an asterisk directly following .*
2020-10-30 16:08:04 +02:00
Joran Dirk Greef
ab1ed93ad9 Add close_range, faccessat2 and process_madvise 2020-10-30 12:39:01 +02:00
Joran Dirk Greef
9423ed1671 Add more mips syscall numbers
As per: lib/libc/musl/arch/mips/bits/syscall.h.in

...and as promised: https://github.com/ziglang/zig/pull/6356#issuecomment-696023349

Thanks @daurnimator again for the help with #6356.
2020-10-30 11:53:45 +02:00
Koakuma
891c6ddd5f Select stat struct type based on whether we are linking with libc 2020-10-30 11:46:33 +07:00
Andrew Kelley
aaff66b8ed
Merge pull request #6866 from LemonBoy/fix-zlib
Fix zlib EOB condition
2020-10-29 18:23:36 -04:00
Andrew Kelley
a41c0b63bb
Merge pull request #6356 from jorangreef/io_uring
std: add io_uring library
2020-10-29 18:20:38 -04:00
Travis
f51ccf0d1f panic when empty string passed as dest_rel_path to addInstallFileWithDir
causes the creation of a file instead of the directory that's meant to
be created
2020-10-29 15:22:39 -04:00
Frank Denis
26793453a7 std/crypto/blake2b: allow the initial output length to be set
BLAKE2 includes the expected output length in the initial state.

This length is actually distinct from the actual output length
used at finalization.

BLAKE2b-256/128 is thus not the same as BLAKE2b-128.

This behavior can be a little bit surprising, and has been "fixed"
in BLAKE3.

In order to support this, we may want to provide an option to set the
length used for domain separation.

In Zig, there is another reason to allow this: we assume that the
output length is defined at comptime.

But BLAKE2 doesn't have a fixed output length. For an output length that
is not known at comptime, we can't take the full block size and
truncate it due to the reason above.

What we can do now is set that length as an option to get the correct
initial state, and truncate the output if necessary.
2020-10-29 15:18:37 -04:00
wozeparrot
32e65c3f96
make addBuildOption append type (#6801)
* add addBuildOption test
2020-10-29 15:16:47 -04:00
Andrew Kelley
3a0e8c2b45
Merge pull request #6838 from LemonBoy/netstuff
std: Add basic smoke test for net functionality
2020-10-29 15:10:29 -04:00
Andrew Kelley
844eb932f4
Merge pull request #6841 from ifreund/fix-event-loop
std/event: fix poll error set handling
2020-10-29 14:41:18 -04:00
Frank Denis
e59dd7eecf std/crypto/x25519: return encoded points directly + ed->mont map
Leverage result location semantics for X25519 like we do everywhere
else in 25519/*

Also add the edwards25519->curve25519 map by the way since many
applications seem to use this to share the same key pair for encryption
and signature.
2020-10-29 14:39:58 -04:00
Frank Denis
5764c550ed std/crypto: vectorize Salsa20
20% faster on x86_64, slower on aarch64 as usual :/
2020-10-29 14:34:58 -04:00
Jakub Konka
17575019a0 Set page size to 16KB for aarch64 macos
With this tweak, `test-std` pass on Apple Silicon + BigSur.
2020-10-29 14:21:43 -04:00