24294 Commits

Author SHA1 Message Date
David Gonzalez Martin
c16d4ab9e4 llvm: stop generating FPU code if there is no FPU
Fixes https://github.com/ziglang/zig/issues/14465

For aarch64, LLVM was crashing because Zig commands it to generate FPU code
even when there is no FPU present. This commit implements the necessary checks
to avoid this undesired situation and aarch64 can be compiled again with
no FPU.
2023-06-06 18:30:56 +00:00
Frank Denis
9ee0a706da
crypto.bcrypt: allow very large passwords to be pre-hashed (#15955)
crypto.bcrypt: allow very large passwords to be pre-hashed

bcrypt has a slightly annoying limitation: passwords are limited
to 72 characters. In the original implementation, additional characters
are silently ignored.

When they care, applications adopt different strategies to work around
this, in incompatible ways.

Ideally, large passwords should be pre-hashed using a hash function that
hinders GPU attackers, and the hashed function should not be deterministic
in order to defeat shucking attacks.

This change improves the developer experience by adding a very explicit
`silently_truncate_password` option, that can be set to `false` in
order to do that automatically, and consistently across Zig applications.

By default, passwords are still truncated, so this is not a breaking
change.

Add some inline documentation for our beloved autodoc by the way.
2023-06-06 09:08:57 +02:00
Jakub Konka
7e0a02ee25 macos+libc: add zlib.h,sys/paths.h,netinet/{ip.h,udp.h} 2023-06-04 16:37:53 +02:00
Andrew Kelley
629f0d23b5
Merge pull request #15579 from squeek502/mem-delimiters
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-06-03 13:51:02 -07:00
dweiller
3add9d8257 std.c: fix return type of recv/recvfrom on windows
Windows defines `recv` and `recvfrom` to return a value of type `int`,
rather than a pointer-sized signed integer, and so should use `c_int`
rather than `isize` for their return types.
2023-06-03 13:45:52 -07:00
xEgoist
ff57a264ad
Build: fix producesPdbFile logic (#15756)
Fixes bug causing ReleaseSmall to fail on Windows.

Due to the change in default behavior of ReleaseSmall, debug info are
stripped by default. However because `Compile.create` still defaults to
null, `producesPdbFile` will report true for
`lib/std/Build/Step/InstallArtifact.zig` causing it to fail on copying a
file that does not exist. This commit change the default of strip
depending on `optimize`.
2023-06-03 16:45:08 -04:00
DraagrenKirneh
105078519a fix missing insertion of module to all_modules on first download 2023-06-03 13:40:28 -07:00
Eric Joldasov
5c6f111379 std.io.reader.Reader: add streamUntilDelimiter
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-03 13:38:23 -07:00
mlugg
1a4b0d9790 AstGen: handle ref_table for errdefer captures
Resolves: #15861
2023-06-03 13:36:44 -07:00
Andrew Kelley
77b40d6ecb
Merge pull request #15927 from truemedian/http-bugs
std.http: fix infinite read loop, deduplicate connection code, add TlsAlert errors
2023-06-03 13:36:07 -07:00
Andrew Kelley
9461ed5037
Merge pull request #15900 from Snektron/spirv-pool
SPIR-V Intern Pool
2023-06-02 12:17:02 -07:00
Frank Denis
879f0b9cee
Fix std.hash benchmarks (#15917) 2023-06-02 20:08:28 +02:00
Nameless
23ccff9cce
std.http.Server: collapse BufferedConnection into Connection 2023-06-01 13:44:00 -05:00
Nameless
0e5e6cb10c
std.http: add TlsAlert descriptions so that they can at least be viewed in err return traces 2023-06-01 13:43:55 -05:00
Nameless
8136123aa7
std.http.Client: collapse BufferedConnection into Connection 2023-06-01 13:43:23 -05:00
Luuk de Gram
3faf376b08
Merge pull request #15919 from Luukdegram/wasm-behavior-tests 2023-06-01 19:42:04 +02:00
Evin Yulo
6c2f374556 Use the word 'base' consistently instead of 'radix' 2023-06-01 00:02:16 +03:00
Evin Yulo
3085e2af41 add missing note "operation is runtime due to this operand" 2023-05-31 19:18:36 +03:00
Luuk de Gram
1042deb86f
enable passing behavior tests 2023-05-31 18:04:33 +02:00
Luuk de Gram
ebfd3450d9
codegen: Write padding bytes for unions
Previously we did not write any missing padding bytes after the smallest
field (either tag or payload, depending on alignment). This resulted in
writing too few bytes and not matching the full abisize of the union.
2023-05-31 18:04:33 +02:00
Luuk de Gram
7e10cf4fbe
wasm: shl_with_overflow ensure rhs is coerced
Both operands must have the same Wasm type before we are allowed
to perform any binary operation on the values.
2023-05-31 18:04:33 +02:00
Luuk de Gram
e36cc0ce8f
wasm: union_init support packed unions 2023-05-31 18:04:33 +02:00
Luuk de Gram
128814f9bf
wasm: aggregate_init store sentinel for arrays 2023-05-31 18:04:32 +02:00
Luuk de Gram
969f921162
wasm: ptr_elem_val use pointer type for local
When storing the address after calculating the element's address,
ensure it's stored in a local with the correct type. Previously it
would incorrectly use the element's type, which could be a float for
example and therefore generate invalid WebAssembly code.

This change also introduces a more robust `store` function.
2023-05-31 18:04:32 +02:00
Luuk de Gram
ffa89d3b83
wasm: UnwrapErrUnionPayloadPtr ensure ptr ret
When the paylaod is zero-sized we must ensure a valid pointer
is still returned for the ptr variation of the instruction. This,
because it's valid to have a pointer to a zero-sized value.
In such a case, we simply return the operand.
2023-05-31 18:04:32 +02:00
Luuk de Gram
3c72b4d25e
wasm: support and optimize for all packed unions
For packed unions where its abi size is less than or equal to 8 bytes
we store it directly and don't pass it by reference. This means that
when retrieving the field, we will perform shifts and bitcasts to ensure
the correct type is returned. For larger packed unions, we either allocate
a new stack value based on the field type when the field type is also passed
by reference, or load it directly into a local if it's not.
2023-05-31 18:04:32 +02:00
Luuk de Gram
7cfc44d86f
wasm: implement struct_field_val for packed unions
We currently have `isRef` return true for any type of union, including
packed unions. This means we can simply load it from the data section
to the exact type we want. In the future we can optimize it so it works
similarly to packed structs below 64 bits which do not get stored in
the data section and are not passed by ref.
2023-05-31 18:04:32 +02:00
Luuk de Gram
49fddbf4c1
wasm: union_init correctly store the tag
Previously we would only store the payload, but not the actual tag
that was set. This meant miscompilations where it would incorrectly
return the tag value.

This also adds a tiny optimization for payloads which are not `byRef`
by directly storing them based on offset, rather than first calculating
a pointer to an offset.
2023-05-31 18:04:32 +02:00
Luuk de Gram
00dedabc41
wasm: memcpy support elem abi-size > 1
Previously it was incorrectly assumed that all memcopy's generated by
the `memcpy` AIR instruction had an element size of 1 byte. However,
this would result in miscompilations for pointer's to arrays where
the element size of the array was larger than 1 byte. We now corectly
calculate this size.
2023-05-31 18:04:31 +02:00
yujiri8
cd1417dbdf
don't crash when can't evaluate comptime expression with inferred type
Closes #15911.
2023-05-31 11:15:52 +00:00
Bogdan Romanyuk
32e719e070
sema: add compile error for incorrect extern type 2023-05-31 04:38:32 +00:00
Robin Voetter
3c4cc1eedb
spirv: eliminate remaining uses of emitConstant 2023-05-30 19:43:37 +02:00
Robin Voetter
0c41945a01
spirv: rename TypeConstantCache -> Cache 2023-05-30 19:43:37 +02:00
Robin Voetter
0552a8b11f
spirv: translate remaining types 2023-05-30 19:43:37 +02:00
Robin Voetter
fcb422585c
spirv: translate remaining types 2023-05-30 19:43:37 +02:00
Robin Voetter
112acb1bda
spirv: cache strings for debug names 2023-05-30 19:43:37 +02:00
Robin Voetter
a72179fed0
spirv: translate structs to cache key 2023-05-30 19:43:37 +02:00
Robin Voetter
05f1392d8b
spirv: translate vectors to cache key 2023-05-30 19:43:37 +02:00
Robin Voetter
f13a6ee19e
spirv: cache pointers 2023-05-30 19:43:36 +02:00
Robin Voetter
e05ace7673
spirv: cache function prototypes 2023-05-30 19:43:36 +02:00
Robin Voetter
8c72ad5320
spirv: cache for ints 2023-05-30 19:43:36 +02:00
Robin Voetter
aade6f1195
spirv: cache for floats 2023-05-30 19:43:36 +02:00
Robin Voetter
b2a984cda6
spirv: basic setup for using new type constant cache 2023-05-30 19:43:36 +02:00
Robin Voetter
96a66d14a1
spirv: TypeConstantCache 2023-05-30 19:43:36 +02:00
Jakub Konka
76aa1fffb7
Merge pull request #15905 from jacobly0/x86_64-hotfix
x86_64: hotfix for crash during in-memory coercion of large type
2023-05-30 13:22:13 +02:00
Frank Denis
1ab008d89d
RSA: remove usage of allocators (#15901)
Individual max buffer sizes are well known, now that arithmetic doesn't
require allocations any more.

Also bump `main_cert_pub_key_buf`, so that e.g. `nodejs.org` public
keys can fit.
2023-05-30 10:06:44 +00:00
kcbanner
9244e4fe2d cache: handle 0-length prefix paths in findPrefixResolved 2023-05-30 01:21:01 -07:00
Andrew Kelley
22b0457dd4
Merge pull request #15891 from mlugg/fix/dont-emit-fn-called-at-comptime
Prevent analysis of functions only referenced at comptime
2023-05-29 23:41:40 -07:00
Motiejus Jakštys
ac9f72d87e zig ld: handle --library :path/to/lib.so
`-l :path/to/lib.so` behavior on gcc/clang is:

- the path is recorded as-is: no paths, exact filename (`libX.so.Y`).
- no rpaths.

The previous version removed the `:` and pretended it's a positional
argument to the linker. That works in almost all cases, except in how
rules_go[1] does things (the Bazel wrapper for Go).

Test case in #15743, output:

    gcc rpath:
     0x0000000000000001 (NEEDED)     Shared library: [libversioned.so.2]
     0x000000000000001d (RUNPATH)    Library runpath: [$ORIGIN/x]
    gcc plain:
     0x0000000000000001 (NEEDED)     Shared library: [libversioned.so.2]
    zig cc rpath:
     0x0000000000000001 (NEEDED)     Shared library: [libversioned.so.2]
     0x000000000000001d (RUNPATH)    Library runpath: [$ORIGIN/x]
    zig cc plain:
     0x0000000000000001 (NEEDED)     Shared library: [libversioned.so.2]

Fixes #15743

[1]: https://github.com/bazelbuild/rules_go
2023-05-30 08:18:10 +02:00
Jacob Young
28df1d09dc Revert "Revert "Windows: Support UNC, rooted, drive relative, and namespaced/device paths""
This reverts commit b5fad3a40a86eb379903d6a803bdbe66dcaa5487.

The latent x86_64 backend bug has been fixed.
2023-05-29 22:09:13 -04:00