Commit Graph

2544 Commits

Author SHA1 Message Date
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
Andrew Kelley 7f7e2d608a Revert "revert adding std.event.Loop.runDetached"
This reverts commit 70f3767903.

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
1d777e9958 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
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
Tadeo Kondrak 183d1d4ba1 Switch TypeInfo.Fn.alignment to comptime_int from u29
All integers in TypeInfo are intentionally comptime_int:
https://github.com/ziglang/zig/issues/1683
2020-10-01 18:01:41 -06:00
Tadeo Kondrak 97ab720d84 stage1: Add alignment to TypeInfo.Fn 2020-10-01 17:59:42 -06:00
Alexandros Naskos 0228887b94 Merge pull request #6428 from tadeokondrak/alignment-typeinfo-struct-union
Add alignment field to TypeInfo.UnionField and TypeInfo.StructField
2020-10-02 02:56:18 +03:00
Nathan 84b6d2a80a Resolved additional formatting issues. 2020-10-01 18:03:34 -04:00
Nathan 5e3ce11b18 Resolve name and format issues. 2020-10-01 17:47:32 -04:00
Alexandros Naskos a4fe438d39 std.fmt.comptimePrint: bufPrint cannot return an error 2020-10-02 00:39:19 +03:00
Tadeo Kondrak 362c87f1aa Update std.meta.ArgsTuple for alignment in StructField/UnionField 2020-10-01 15:06:24 -06:00
Tadeo Kondrak ec8f0777f2 Update std.meta.Tuple for alignment in StructField/UnionField 2020-10-01 15:06:23 -06:00
Nathan Bourgeois 4566b27373 Patch in emit relocs support 2020-10-01 17:04:04 -04:00
Tadeo Kondrak a12203d2be Switch TypeInfo alignment fields from u29 to comptime_int 2020-10-01 15:01:28 -06:00
Tadeo Kondrak d81648ce8c Add alignment field to TypeInfo.UnionField and TypeInfo.StructField
Closes https://github.com/ziglang/zig/issues/6122
2020-10-01 15:01:25 -06:00
Tadeo Kondrak 77df5dae7f Make builtin.TypeInfo.Pointer.alignment u29 instead of comptime_int 2020-10-01 15:01:24 -06:00
Alexandros Naskos 5acf2a5068 Merge pull request #6419 from tadeokondrak/std.fmt.comptimePrint
std.fmt: add comptimePrint
2020-10-01 23:59:00 +03:00
markfirmware 1296e4a857 Update build.zig 2020-10-01 15:27:08 -04:00
markfirmware 8acfcf4e0d Update build.zig
Fixes #6477
2020-10-01 13:15:35 -04:00
Alexandros Naskos bf0afaa876 std.event.Loop.runDetached should be pub 2020-10-01 16:50:05 +03:00
Alexandros Naskos beda6f2299 Merge pull request #6455 from kristoff-it/event-loop-go
add runDetached to event loop
2020-10-01 15:57:02 +03:00
Frank Denis 97fd0974b9 ghash: add pclmul support on x86_64 2020-10-01 02:05:11 +02:00
Frank Denis 8161de7fa4 Implement ghash aggregated reduction
Performance increases from ~400 MiB/s to 450 MiB/s at the expense of
extra code. Thus, aggregation is disabled on ReleaseSmall.

Since the multiplication cost is significant compared to the reduction,
aggregating more than 2 blocks is probably not worth it.
2020-10-01 02:05:07 +02:00
Frank Denis f1ad94437b ghash & poly1305: use pointer to slices for keys and output 2020-10-01 02:04:30 +02:00
Frank Denis 58873ed3f9 std/crypto: add GHASH implementation
GHASH is required to implement AES-GCM.

Optimized implementations for CPUs with instructions for carry-less
multiplication will be added next.
2020-10-01 02:04:30 +02:00
Alexandros Naskos 4eb390b157 Merge pull request #6457 from Snektron/fix-arraylistunmanaged
Fix std.ArrayListUnmanaged + improve test coverage
2020-10-01 00:09:45 +03:00
Andrew Kelley 718a659773 std: skip some tests that stage1 leaks too much memory with
We can restore these when we have self-hosted available.

This is intended to address #6467
2020-09-30 12:37:00 -07:00
Andrew Kelley fe117d9961 Merge pull request #6250 from ziglang/stage2-zig-cc
move `zig cc`, `zig translate-c`, `zig libc`, main(), and linking from stage1 to stage2
2020-09-30 04:28:19 -04:00
Andrew Kelley 2a893efae1 fix incorrect dylib filename pattern in the previous commit 2020-09-30 00:53:55 -07:00
Andrew Kelley 870af49074 std.zig.binNameAlloc: take into account version for macos dylibs 2020-09-30 00:36:20 -07:00
Ryan Liptak bd449b184a Add deleteDir test with exception for not-empty directory on Windows
Re-adds the test that was added and then reverted in https://github.com/ziglang/zig/pull/6397, but with the test for https://github.com/ziglang/zig/issues/5537 skipped for now since that issue is no longer fixed.
2020-09-30 02:35:17 -04:00
Andrew Kelley 14d6d07af2 fix the cli test expected string to support native path separators 2020-09-30 01:31:08 -04:00