2592 Commits

Author SHA1 Message Date
Loris Cro
7fec5b3def pwritev
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
7a07c62a07 pwrite
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:21 +02:00
Loris Cro
18f6629bd8 writev
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:03 +02:00
Loris Cro
9075f8e5a1 write
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:05:41 +02:00
Loris Cro
59ecdaea12 preadv
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:04:43 +02:00
Loris Cro
bd9f2369d5 pread
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:04:05 +02:00
Loris Cro
bc35435ca6 readv
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:03:12 +02:00
Loris Cro
08364ac773 read
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:00:55 +02:00
Loris Cro
730428bfd6 connect
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Loris Cro
e85c89630e accept
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Frank Denis
bd89bd6fdb Revamp crypto/aes
* Reorganize crypto/aes in order to separate parameters, implementations and
modes.
* Add a zero-cost abstraction over the internal representation of a block,
so that blocks can be kept in vector registers in optimized implementations.
* Add architecture-independent aesenc/aesdec/aesenclast/aesdeclast operations,
so that any AES-based primitive can be implemented, including these that don't
use the original key schedule (AES-PRF, AEGIS, MeowHash...)
* Add support for parallelization/wide blocks to take advantage of hardware
implementations.
* Align T-tables to cache lines in the software implementations to slightly
reduce side channels.
* Add an optimized implementation for modern Intel CPUs with AES-NI.
* Add new tests (AES256 key expansion).
* Reimplement the counter mode to work with any block cipher, any endianness
and to take advantage of wide blocks.
* Add benchmarks for AES.
2020-09-24 13:16:00 -04:00
Frank Denis
c8cd6145ac Move PBKDF2 to a pwhash category, clarify what that category is
Password hashing functions are not general-purpose KDFs, and KDFs
don't have to satisfy the same properties as a PHF.

This will allow fast KDFs such as the HKDF construction to be in a
category of their own, while clarifying what functions are suitable
for using passwords as inputs.
2020-09-24 00:02:31 -04:00
Andrew Kelley
7bbd152dcc nobody likes my std.process.cleanExit idea
it's appropriate for the self-hosted compiler though, so this commit
moves it from std lib to stage2 src code.
2020-09-23 20:52:33 -07:00
Andrew Kelley
b08fd0e8fc stage2: building musl libc from source 2020-09-23 20:48:47 -07:00
Andrew Kelley
f4dde4d109 test_runner: fix missing newline in log 2020-09-23 11:15:10 -07:00
Andrew Kelley
c0b774fbc6 stage2: support passing extra C flags to C source files
closes #3508
2020-09-23 10:22:44 -07:00
Timon Kruiper
bbff6bd675 Eventloop: Enable basic event loop test, fixed by previous commit
Closes #4922
2020-09-23 18:38:28 +02:00
Timon Kruiper
0eed7ec9d5 Eventloop: Fix deadlock in linux event loop implementation
A simple empty main with evented-io would not quit, because some
threads were still waiting to be resumed (by the os). The os.write to
the eventfd only wakes up one thread and thus there are multiple writes
needed to wake up all the other threads.
2020-09-23 11:41:31 +02:00
Andrew Kelley
800a4a6ceb eliminate dependency of libzigcpp.a on libzigstage1.a
This allows us to create a build of self-hosted with LLVM extensions
enabled but without the stage1 backend.
2020-09-23 00:00:24 -07:00
Andrew Kelley
0638a020cf stage2: implement --pkg-begin and --pkg-end CLI args 2020-09-22 23:00:33 -07:00
Andrew Kelley
c2b1cd7c45 stage2: implement zig build
As part of this:

 * add std.process.cleanExit. closes #6395
   - use it in several places
 * adjust the alignment of text in `zig build --help` menu
 * Cache: support the concept of "unhit" so that we properly keep track
   of the cache when we find out using the secondary hash that the cache
   "hit" was actually a miss. Use this to fix false negatives of caching
   of stage1 build artifacts.
 * fix not deleting the symlink hash for stage1 build artifacts causing
   false positives.
 * implement support for Package arguments in stage1 build artifacts
 * update and add missing usage text
 * add --override-lib-dir and --enable-cache CLI options
   - `--enable-cache` takes the place of `--cache on`
 * CLI supports -femit-bin=foo combined with --enable-cache to do an
   "update file" operation. --enable-cache without that argument
   will build the output into a cache directory and then print the path
   to stdout (matching master branch behavior).
 * errors surfacing from main() now print "error: Foo" instead of
   "error: error.Foo".
2020-09-22 22:18:19 -07:00
Andrew Kelley
250664bea4 build runner: allow for a bit longer -D options
so they can display in the --help menu without getting squished.
2020-09-22 14:56:52 -07:00
Andrew Kelley
0c70bb4fce Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-21 21:16:46 -07:00
LemonBoy
58ee5f4e61 std: Fix metadata corruption in HeapAllocator
HeapAllocator stores the pointer returned by HeapAlloc right after the
data block and, after the recent allocator refactoring, the space for
this pointer was not taken into account in the calculation of the final
block size.

Fixes #5830
2020-09-20 01:21:29 -04:00
zenith391
4fbf9f7f79 Add "emit_docs" field to LibExeObjStep. 2020-09-19 00:39:43 +03:00
Lachlan Easton
4496a6c9cc zig fmt: Special case un-indent comma after multiline string in param list 2020-09-18 20:34:00 +10:00
Lachlan Easton
1aacedf6e1 zig fmt: Fix regression in ArrayInitializers 2020-09-18 20:34:00 +10:00
Lachlan Easton
40b6e86a99 zig fmt: fix #6171 2020-09-18 20:34:00 +10:00
Lachlan Easton
c06674e701 zig fmt: Small cleanup 2020-09-18 20:34:00 +10:00
Lachlan Easton
206a8cf670 zig fmt: fix comments and multiline literals in function args 2020-09-18 20:34:00 +10:00
Lachlan Easton
291482a031 zig fmt: Don't consider width of expressions containing multiline string literals when calculating padding for array initializers. fixes #3739
Changes some of the special casing for multiline string literals.
2020-09-18 20:34:00 +10:00
Lachlan Easton
e1bd271192 zig fmt: Allow trailing comments to do manual array formatting. close #5948 2020-09-18 20:34:00 +10:00
Lachlan Easton
9f0821e688 zig fmt: Fix erroneously commented out code, add passing test case to close #5722 2020-09-18 20:34:00 +10:00
Lachlan Easton
ea6181aaf6 zig fmt: Add test for nesting if expressions 2020-09-18 20:34:00 +10:00
Andrew Kelley
333b12a8f9 std: start: use std.log instead of stderr
When main returns an error code.
2020-09-18 01:58:16 -07:00
Ryan Liptak
fbde15fdf4 Fix compile error in os.renameatW
Introduced in 5e3fa0e94f947c632aa584b9e13bfa2fe241fae1

Whoops!
2020-09-17 18:49:06 -04:00
Andrew Kelley
f125288c9b
Merge pull request #6336 from Rocknest/pbkdf2
Some changes to #6326 (pbkdf2)
2020-09-17 17:31:58 -04:00
Ryan Liptak
5e3fa0e94f Add rename to std.fs API
- Moves fs.rename functions to fs.renameAbsolute to match other functions outside of fs.Dir
- Adds fs.Dir.rename that takes two paths relative to the given Dir
- Adds fs.rename that takes two separate Dir's that the given paths are relative to (for renaming across directories without having to make the second path relative to a single directory)
- Fixes FileNotFound error return in std.os.windows.MoveFileExW
- Returns error.RenameAcrossMountPoints from renameatW
  + Matches the RenameAcrossMountPoints error return in renameatWasi/renameatZ
2020-09-17 17:22:26 -04:00
LemonBoy
27adb82fda std: Respect user-specified alignment when formatting ints
This implementation tries to do the right thing (TM) by treating the
sign as part of the number itself, therefore the alignment parameter
applies to both the sign and the digits.

In other words the format string `{:>4}` with -1 as input will not
output `-  1` but `  -1`.

And let's default to right alignment for everything as that's what users
want, especially when printing numbers. Many implementations use
different defaults for numeric vs non-numeric types, let's strive for a
consistent behaviour here.
2020-09-17 00:53:08 +02:00
LemonBoy
bb9a4ad6e9 std: Fix {*} printing of non-pointer types
Fixes a regression introduced in #6246.
Adds a test to make sure this won't happen again.
2020-09-16 13:45:54 +02:00
Andrew Kelley
281fc10ec5 std.crypto siphash: fix assertion on the size of output buffer
the logic was backwards
2020-09-16 02:24:36 -07:00
Andrew Kelley
16bd0c63b4 Merge remote-tracking branch 'origin/master' into stage2-zig-cc
Pulling in the changes to libc_installation.zig
2020-09-15 18:04:37 -07:00
Rocknest
c35703825f Add an error set 2020-09-16 01:58:48 +03:00
Andrew Kelley
f82b1831f7 std: handle sharing violation when deleting a file on windows 2020-09-15 15:24:13 -07:00
Andrew Kelley
b3cc36857e
Merge pull request #6340 from Vexu/fix
Fixes
2020-09-15 14:28:16 -04:00
LemonBoy
c1c3212500 std: Fix typo in ELF section header iterator
The code accidentally used the phdr offset instead of the shdr one while
iterating over the section headers.

Fixes #6338
2020-09-15 18:14:06 +03:00
Andrew Kelley
5d8fec3d4c Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-14 21:57:01 -07:00
Andrew Kelley
dffdb2844e track all TODO comments in BRANCH_TODO file
Before merging, do this for every item in the file:
 * solve the issue, or
 * convert the task to a github issue and update the comment
   to link to the issue (and remove "TODO" text from the comment).
Then delete the file.

Related: #363
2020-09-14 18:06:19 -07:00
Vexu
a3624e94f8
translate-c: determine sizeof using std.meta.sizeof 2020-09-14 23:53:38 +03:00
Vexu
29fd0c6d61
fix meta.cast behavior; add exhaustive tests 2020-09-14 23:21:26 +03:00