2572 Commits

Author SHA1 Message Date
mlarouche
57912964af Use regular file for caching stage 1 hash digest instead of symlink, fix zig build caching on Windows
Fix #6500
2020-10-09 16:50:43 -04:00
Andrew Kelley
a4828f6d0f std.c (darwin) update to new opaque syntax
This was an undetected conflict between

76a195473dac059a842fed2a6ba581ca99947d2b and
95a37373e9f576854956c2909cc128b5b6388ec6
2020-10-08 22:45:39 -07:00
Andrew Kelley
76a195473d
Merge pull request #6516 from LemonBoy/fastfilecopy
std: Make file copy ops use zero-copy mechanisms
2020-10-08 20:14:47 -04:00
Andrew Kelley
b02341d6f5
Merge pull request #6614 from jedisct1/aes-arm
std/crypto/aes: add AES hardware acceleration on aarch64
2020-10-08 18:09:40 -04:00
Frank Denis
1bc2b68916 ghash: add pmull support on aarch64 2020-10-08 18:09:23 -04:00
Frank Denis
60d1e675d2 aes/aesni is not based on a Go implementation, only aes/soft is
Don't blame them for our bugs :)
2020-10-08 14:55:11 +02:00
Frank Denis
f39dc00ed4 std/crypto/aes: add AES hardware acceleration on aarch64 2020-10-08 14:55:08 +02:00
xavier
a0a834a2f2 restore ability to do comptime math
until https://github.com/ziglang/zig/issues/6168 is implemented,
partially revert 0bd53dd2033c60d3446abfb83209237c6eb6c9e2
in order to restore the ability to use std.math in comptime functions.
2020-10-07 17:04:48 -04:00
Andrew Kelley
95a37373e9
Merge pull request #6421 from tadeokondrak/opaque-syntax
Add opaque syntax that allows declarations
2020-10-07 16:58:50 -04:00
Andrew Kelley
3c43eeceab
Merge pull request #6595 from tadeokondrak/comptime-print-0
std.fmt.comptimePrint: Return null terminated string
2020-10-07 16:55:03 -04:00
Tadeo Kondrak
e9bca9de3c
std.fmt.comptimePrint: Properly null-terminate result and add test 2020-10-07 11:43:23 -06:00
LemonBoy
03762da2af New review round 2020-10-07 11:13:26 +02:00
Loris Cro
53dee08af9 add WaitGroup to std.event
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-07 04:34:09 -04:00
Tadeo Kondrak
0a6863a267 Remove .Cold calling convention.
This isn't a stable, defined calling convention, so it shouldn't be
grouped in with the others.

Closes https://github.com/ziglang/zig/issues/6556
2020-10-07 04:31:20 -04:00
Andrew Kelley
b2b0bf0506 fixups for the previous commit
* std.fs.File.copyRange and copyRangeAll return u64 instead of usize -
   the returned value is how much of the `len` is transferred, so the
   types should match. This removes the need for an `@intCast`.
 * fix typo that removed a subtraction
 * Fix the size of codegen.AnyMCValue which gave me a compile error when
   I tried to build self-hosted for i386-linux.
 * restore the coercion to u64 of syms_sect.sh_info. We want to make
   sure the multiplication happens with 64 bits and not the smaller type
   used by the ELF format.
 * fix another offset parameter in link/Elf.zig to be u64 instead of usize
 * add a nice little TODO note to help out Jakub
 * FmtError already has FileTooBig in it; we just need to return it.
2020-10-07 00:39:13 -07:00
Timon Kruiper
bd7eab573a Fix building the zig compiler for 32-bit targets 2020-10-06 23:39:58 -07:00
Tadeo Kondrak
49e68bdcf3
std.fmt.comptimePrint: Return null terminated string 2020-10-06 22:21:06 -06:00
Tadeo Kondrak
2b4b03d301
Update zig files for opaque type syntax 2020-10-06 22:08:25 -06:00
Tadeo Kondrak
069fbb3c01
Add opaque type syntax 2020-10-06 22:08:24 -06:00
Frank Denis
fb63a2cfae std/crypto: faster (mod 2^255-19) square root computation
251 squarings, 250 multiplications -> 251 squarings, 11 multiplications
2020-10-06 19:48:26 -04:00
LemonBoy
1f7ec0de70 Address review comments & fix compilation errors 2020-10-06 11:57:23 +02:00
LemonBoy
a419a1aabc Move copy_file to fs namespace
Now it is a private API.
Also handle short writes in copy_file_range fallback implementation.
2020-10-06 09:38:59 +02:00
Noah Altunian
c507c7862e Fix spelling in code comment
Changed **an handle** -> **a handle**.
2020-10-05 22:25:07 -04:00
Andrew Kelley
41aa5edaaf
Merge pull request #6580 from jedisct1/aesgcm
std/crypto: Add support for AES-GCM
2020-10-05 22:20:29 -04:00
Isaac Freund
0741505d6d std/zig: handle underscore in kernel version
On some distros (e.g. Void Linux) the release field of the tsname
struct may contain an underscore followed by a revision number at the
end. (e.g. 5.8.12_2).
2020-10-05 22:17:28 -04:00
LemonBoy
dbc11be038 std: Fix two bugs in bigint pow
* Correctly scan all the exponent bits, this caused the incorrect result
  to be computed for exponents being powers of two.
* Allocate enough limbs to make llmulacc stop whining.
2020-10-05 22:16:26 -04:00
Frank Denis
06c16f44e7 std/crypto: Add support for AES-GCM
Already pretty fast on platforms with AES-NI, even though GHASH
reduction hasn't been optimized yet, and we don't do stitching either.
2020-10-06 00:00:33 +02:00
Frank Denis
d343b75e7f ghash & poly1305: fix handling of partial blocks and add pad()
pad() aligns the next input to the first byte of a block, which is
useful to implement the IETF version of ChaCha20Poly1305 and AES-GCM.
2020-10-05 23:50:38 +02:00
Andrew Kelley
7f7e2d608a Revert "revert adding std.event.Loop.runDetached"
This reverts commit 70f37679035e64bacfc4807709da37bc02fbb346.

After discussion, I can see the value provided here, specifically with
avoiding the footgun of defer { suspend { free(@frame()); } }.

However the doc comments are updated to explain the semantics directly,
rather than basing them on the behavior of another programming language.
2020-10-05 14:41:51 -07:00
LemonBoy
22b5e47839 stage1: Implement @reduce builtin for vector types
The builtin folds a Vector(N,T) into a scalar T using a specified
operator.

Closes #2698
2020-10-05 04:51:45 -04:00
Andrew Kelley
d5d48c6f4e
Merge pull request #6496 from xackus/rlimit
std: implement {get, set}rlimit for linux
2020-10-05 01:54:38 -04:00
Timon Kruiper
e94a06ac29 Build.zig: Skip copying files that are used internally by the compiler
Before this it was trying to copy all the files from the zig-cache dir
to the output dir, but in the current compiler architecture the cache
dir is also used for internal compiler files.
2020-10-05 00:31:21 -04:00
Andrew Kelley
33bc1ebe37 build system: implement computeOutFilenames using std.zig.binNameAlloc
See #6552 #6553 #6483

Also fixes a regression introduced in
1d777e99588be047ec4d7650f048b043d6e52da0 of not converting an integer to
a string for a command line parameter.
2020-10-04 20:10:47 -07:00
Alexandros Naskos
65991092f7 Correctly set uid and gid to void instead of null on wasi 2020-10-04 21:21:25 -04:00
Andrew Kelley
1d777e9958 add --image-base support
Based on #6121 by Jay Petacat.
2020-10-04 17:59:44 -07:00
xackus
1b4296831a simplify api and add smoke test 2020-10-04 23:57:49 +02:00
xackus
4ec26be424 implement {get, set}rlimit for linux 2020-10-04 23:56:10 +02:00
Jakub Konka
ccf9bba61f Write out LC_DYSYMTAB together with dyld_stub_binder undef symbol 2020-10-04 15:31:47 +02:00
Jakub Konka
a927f24201 Generate more MachO exe boilerplate
* Convert draft to generate all relevant segments and sections in right places
* Do not prealloc space in text blocks until we can NOP
* Write out LC_LOAD_DYLINKER command
* Add LC_LOAD_DYLIB command in order to specify to load libSystem
* Redo update decl exports (similar to Elf globals, globals need to be contiguous in
  memory)
2020-10-04 15:31:47 +02:00
Andrew Kelley
8170a3d574
Merge pull request #6463 from jedisct1/ghash
std/crypto: add GHASH implementation
2020-10-04 02:46:36 -04:00
Andrew Kelley
5fda4fe4c8
Merge pull request #6454 from jedisct1/hkdf
std/crypto: implement the HKDF construction
2020-10-04 02:45:54 -04:00
LemonBoy
538d485782 std: Add pow(a,b) for big ints
Implemented following Knuth's "Evaluation of Powers" chapter in TAOCP,
some extra complexity is needed to make sure there's no aliasing and
avoid allocating too many limbs.

A brief example to illustrate why the last point is important:
consider 10^123, since 10 is well within the limits of a single limb we
can safely say that the result will surely fit in:

⌈log2(10)⌉ bit * 123 = 492 bits = 7 limbs

A naive calculation using only the number of limbs yields:

1 limb * 123 = 123 limbs

The space savings are noticeable.
2020-10-04 02:24:40 -04:00
Andrew Kelley
70f3767903 revert adding std.event.Loop.runDetached
I'd like to discuss this before adding it. I think this is the wrong
direction to go with this API.
2020-10-03 17:13:22 -07:00
LemonBoy
8b4f5f039d Alternative strategy to avoid calling stat()
This is an optimization as it avoids an extra syscall, but it's also a
workaround for fstat being not available on Windows.
2020-10-03 19:51:22 +02:00
LemonBoy
0f248e0988 std: Make file copy ops use zero-copy mechanisms
Use copy_file_range on Linux (if available), fcopyfile on Darwin,
sendfile on *BSDs (and on Linux kernels without copy_file_range).
2020-10-03 12:31:17 +02:00
Loris Cro
276598346a provide the full buffer length to _NSGetExecutablePath
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-03 12:03:22 +02:00
Loris Cro
f841ea77e2 make symlink buffer null-terminated
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 19:33:14 +02:00
Loris Cro
a2074c1ec3 fix symlink path not being resolved in darwin
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 17:06:29 +02:00
Alexandros Naskos
55eb7c16c0
Merge pull request #6494 from IridescentRose/emit-reloc-patch
Emit reloc patch
2020-10-02 17:00:47 +03:00
Alexandros Naskos
cd4c1ea790
Merge pull request #6491 from markfirmware/patch-2
Fixes --linker-script unrecognized
2020-10-02 17:00:22 +03:00