Commit Graph

21199 Commits

Author SHA1 Message Date
Andrew Kelley
7717cacacb CLI: resolve zig lib directory before using it
Fixes issues with trailing slashes and things like this.
2022-11-22 20:58:13 -07:00
Andrew Kelley
58d3ee2a08 Compilation: avoid Cache hash dependency on zig lib path
* Update for the breaking changes to std.fs.path.resolve. This had a
   happy side effect of deleting some error handling code which is no
   longer needed.
 * Introduce cache_exempt_flags field to CSourceFile. This is used only
   for include directories when building libc++ and libc++abi which
   depend only on the zig lib path.
 * libc_include_dir_list is only added to the cache hash when it
   contains directories which have been obtained from system probing. It
   is exempt when the directories depend only on the zig lib path.
2022-11-22 20:57:56 -07:00
Andrew Kelley
d24aaf8847 std.fs.path.resolve: eliminate getcwd() syscall
This is a breaking change to the API. Instead of the first path
implicitly being the current working directory, it now asserts that the
number of paths passed is greater than zero.

Importantly, it never calls getcwd(); instead, it can possibly return
".", or a series of "../". This changes the error set to only be
`error{OutOfMemory}`.

closes #13613
2022-11-22 20:57:56 -07:00
Andrew Kelley
21bd13626d Cache: introduce prefixes to manifests
Before, cache manifest files would have absolute file paths. This is
problematic for two reasons:

 * Absolute file paths are not portable. Some operating systems such as
   WASI have trouble with them. The files themselves are less portable;
   they cannot be migrated from one user's home directory to another's.
   And finally they can break due to file paths exceeding maximum path
   component size.
 * They would prevent some advanced use cases of Zig, where the lib dir
   has a different path in a different invocation but is ultimately the
   same Zig version and lib directory as before.

This commit adds a new column that specifies the prefix directory for
each file. 0 is an escape hatch and has the previous behavior. The other
two prefixes introduced are zig lib directory, and the cache directory.
This means files in zig-cache manifests can reference files local to
these directories.

In practice, this means it is possible to use a different file path for
the zig lib directory in a subsequent run of zig and have it still take
advantage of the global cache, provided that the files inside remain
unchanged.

closes #13050
2022-11-22 20:57:56 -07:00
Andrew Kelley
32ce2f91a9 CI: fix wrong path name in x86_64-linux release script
I verified that the script will pass with this change.
2022-11-22 20:54:30 -07:00
Loris Cro
5453ec86eb ci: only run CI on pull requests and master branch pushes
To get the CI to run on branches other than master, create a corresponding PR.
2022-11-23 03:00:39 +01:00
Andrew Kelley
c24c6fe210 CI: disable building docs on x86_64-linux debug
See tracking issue #13546
2022-11-22 15:15:04 -07:00
Veikka Tuominen
fc5209c139 llvm: fix x86_64 sysV ABI of big vectors on avx512 enabled CPUs
Closes #13629
2022-11-23 00:05:07 +02:00
Andrew Kelley
3a616f51c0 Merge branch 'ci-secure' 2022-11-22 14:14:28 -07:00
Andrew Kelley
b3b507ad8f CI: disable building tarballs; x86 self-hosted 2022-11-22 14:13:58 -07:00
Loris Cro
942a104457 ci: use test a job to provide ZIG_VERSION to build-tarball job 2022-11-22 13:40:31 -07:00
Loris Cro
671fb4ac47 ci: move tarball creation and publishing to github-hosted runners 2022-11-22 13:40:31 -07:00
Andrew Kelley
5e42378227 disable failing C ABI test
see tracking issue #13629
2022-11-22 13:06:09 -07:00
Frank Denis
ea05223b63
std.crypto.auth: add AEGIS MAC (#13607)
* Update the AEGIS specification URL to the current draft

* std.crypto.auth: add AEGIS MAC

The Pelican-based authentication function of the AEGIS construction
can be used independently from authenticated encryption, as a faster
and more secure alternative to GHASH/POLYVAL/Poly1305.

We already expose GHASH, POLYVAL and Poly1305 for use outside AES-GCM
and ChaChaPoly, so there are no reasons not to expose the MAC from AEGIS
as well.

Like other 128-bit hash functions, finding a collision only requires
~2^64 attempts or inputs, which may still be acceptable for many
practical applications.

Benchmark (Apple M1):

    siphash128-1-3:       3222 MiB/s
             ghash:       8682 MiB/s
    aegis-128l mac:      12544 MiB/s

Benchmark (Zen 2):

    siphash128-1-3:       4732 MiB/s
             ghash:       5563 MiB/s
    aegis-128l mac:      19270 MiB/s
2022-11-22 18:16:04 +01:00
Jakub Konka
114244f770 value: account for undef value for ptr in slice in hashUncoerced 2022-11-22 14:01:20 +02:00
Cody Tapscott
3fa226a80c AstGen: Pop error trace for continue
PR #12837 handled control flow for break and return, but I forgot
about `continue`. This is effectively another break, so we just
need another `.restore_err_ret_index` ZIR instruction.

Resolves #13618.
2022-11-22 14:00:41 +02:00
Andrew Kelley
283c92e362 CI: add missing backslash 2022-11-22 01:28:08 -08:00
Andrew Kelley
936b44e50a CI: fix wrong directory paths 2022-11-22 01:20:22 -08:00
Andrew Kelley
ab680250e1 CI: fix wrong lib dir path 2022-11-22 01:05:59 -07:00
Andrew Kelley
e18d310afd CI: build from old zig on x86_64-linux debug
This is to work around OOM on the CI server. Once #13560 is complete,
we can avoid having to replace the tarballs so often.
2022-11-22 00:56:44 -07:00
Andrew Kelley
7829c73ccf disable failing arm-linux non-llvm backend tests
See #13623
2022-11-21 22:56:05 -07:00
Andrew Kelley
0912f1d1f9 CI: fix wrong tarball name for aarch64-linux 2022-11-21 20:19:44 -07:00
Andrew Kelley
14d77108b8 CI: switch to GitHub Actions
This is a merge commit.
2022-11-21 20:17:14 -07:00
Andrew Kelley
e21b6a712d CI: switch to GitHub Actions 2022-11-21 20:16:08 -07:00
Andrew Kelley
f3d987dc87 CI: start moving tarball generation to github actions 2022-11-21 20:16:08 -07:00
Andrew Kelley
5ec9be0b03 CMake: choose native CPU instead of baseline by default 2022-11-21 20:16:08 -07:00
Andrew Kelley
69d1ea769b CI: test in the ci branch for now 2022-11-21 20:16:08 -07:00
Andrew Kelley
c822da7121 CI: aarch64-linux: support older cmake 2022-11-21 20:16:08 -07:00
Andrew Kelley
670b4c5c02
Merge pull request #13292 from mitchellh/valgrind-arm64
std: valgrind client request support for aarch64
2022-11-21 19:50:26 -05:00
Andrew Kelley
271cc52a16
Merge pull request #11828 from devins2518/arm-atomics
compiler_rt: aarch64 outline atomics
2022-11-21 19:17:50 -05:00
Andrew Kelley
545c3117ff rename lse_atomics.zig to aarch64_outline_atomics.zig 2022-11-21 17:17:02 -07:00
Andrew Kelley
58430ae6d1 outline atomics: ret instead of jump to ret
After this, the machine code generated by zig matches identically to
gcc's after the differences in loading the have_lse flag.
2022-11-21 17:17:02 -07:00
Andrew Kelley
95ee8ab77d simplify outline atomics
* Rely on libSystem when targeting macOS.
 * Make tools/gen_outline_atomics.zig more idiomatic.
 * Remove the CPU detection / auxval checking from compiler_rt. This
   functionality belongs in a different component. Zig's compiler_rt
   must not rely on constructors. Instead it will export a symbol for
   setting the value, and start code can detect and activate it.
 * Remove the separate logic for inline assembly when the target does or
   does not have lse support. `.inst` works in both cases.
2022-11-21 17:17:02 -07:00
Devin Singh
a8f2d00ec4 compiler_rt: add outlined lse atomics for aarch64 2022-11-21 17:17:02 -07:00
Veikka Tuominen
7c527c6dfe
Merge pull request #13585 from Vexu/stage2-fixes
Stage2 bug fixes
2022-11-21 13:48:23 +02:00
joachimschmidt557
89c374cd2d stage2 ARM: misc fixes
- remove redundant `new` from `binOpRegisterNew` name
- fix mul_with_overflow
2022-11-21 08:23:07 +01:00
Frank Denis
c45c6cd492 Add the POLYVAL universal hash function
POLYVAL is GHASH's little brother, required by the AES-GCM-SIV
construction. It's defined in RFC8452.

The irreducible polynomial is a mirror of GHASH's (which doesn't
change anything in our implementation that didn't reverse the raw
bits to start with).

But most importantly, POLYVAL encodes byte strings as little-endian
instead of big-endian, which makes it a little bit faster on the
vast majority of modern CPUs.

So, both share the same code, just with comptime magic to use the
correct endianness and only double the key for GHASH.
2022-11-20 18:13:19 -05:00
David Gonzalez Martin
79bba5a9e6 uefi: Delete unneeded alignment and use default 4K
Closes #7484. Right now for UEFI targets an alignment
of 32 is being used for no reason other than support
a rare bytecode. As this is far from the standard case,
removing this alignment and using the default one,
as most toolchains do, should be the desired behavior.
2022-11-20 18:11:43 -05:00
Andrew Kelley
8c7712d8fa fix CPU model detection for neoverse_n1 on aarch64-linux
see #10086
2022-11-20 15:34:39 -07:00
Veikka Tuominen
bbcd959c2b cli: warn about using --debug-compile-errors on a release build 2022-11-20 20:25:12 +02:00
Veikka Tuominen
d968d9d103 llvm: add attributes to the arguments of function pointer calls
Closes #13605
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9e276d32f3 Sema: fix memory management of missing field error
Closes #13590
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9e7293619f llvm: aarch64 C ABI: pass byref params as mutable pointers
Closes  #13597
2022-11-20 20:25:12 +02:00
Veikka Tuominen
08a00f0d1c llvm: use alignment of ABI return type when it differs from raw return type
This would previously cause miscompilations when the ABI type had
bigger alignment than the raw type.
2022-11-20 20:25:12 +02:00
Veikka Tuominen
835a1f7f0c Sema: fix missing error on mismatched array init count
Closes #13582
2022-11-20 20:25:12 +02:00
Veikka Tuominen
034507ef7c Module: fix compile error for non-comptime-known global initializer 2022-11-20 20:25:12 +02:00
Veikka Tuominen
98b3734b67 Sema: prioritize Value.variable over OPV when resolving const value
Closes #12275
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9877a7d36c print_air: print ty_pl type 2022-11-20 20:25:11 +02:00
Veikka Tuominen
bc76873827 Sema: fix type check in zirIntToPtr
Simple fix: don't assume a ptr type before it has been checked.

Closes #13567
2022-11-20 20:25:11 +02:00
Veikka Tuominen
7b131a7cd4 Module: fix fieldSrcLoc for generated types 2022-11-20 20:25:11 +02:00