25109 Commits

Author SHA1 Message Date
Jakub Konka
546212ff7b
Merge pull request #16398 from ziglang/check-object-elf
std: add ELF parse'n'dump functionality to std.Build.Step.CheckObject
2023-07-14 06:38:33 +02:00
kcbanner
3ec337484b linker tests: add missing dependOn calls for CheckObject steps 2023-07-13 22:26:19 +02:00
Jakub Konka
77026c67a4 check-object: dump info on PHDRs 2023-07-13 21:27:18 +02:00
Jakub Konka
33154b511c check-object: dump more info on SHDRs 2023-07-13 20:31:19 +02:00
Andrew Kelley
f2d433a193
Merge pull request #15708 from xxxbxxx/build-link
build: avoid repeating objects when linking a static library
2023-07-13 09:48:39 -07:00
Jakub Konka
76dc0d5160 check-object: dump some info on SHDRs 2023-07-13 17:01:26 +02:00
Jakub Konka
0627ca527a elf: add ELF and GNU-specific missing defs 2023-07-13 15:08:01 +02:00
Jakub Konka
4c3625d745 check-object: dump ELF header 2023-07-13 14:33:33 +02:00
Ryan Liptak
2896266a03 docs: Fix outdated doc comments about allocating 'at least' the requested size
The 'at least' behavior of the Allocator interface was removed in #13666, so anything that used reallocAtLeast or the .at_least Exact behavior could still have doc comments that reference no-longer-true behavior.

Funnily enough, ArrayList is the only place that used this functionality (outside of allocator test cases), so its doc comments are the only things that need to be fixed. This was checked by resetting to deda6b514691c3a7ffc7931469886d0e7be2f67e and searching for all instances of `reallocAtLeast` and `.at_least` (one of which would need to be used to get the `.at_least` behavior)
2023-07-12 21:54:30 -07:00
Andrew Kelley
e05c242cd8
Merge pull request #16346 from antlilja/splat-rls
Apply RLS to @splat builtin, eliminating its length parameter
2023-07-12 19:13:26 -07:00
Andrew Kelley
47d5bf2616 update zig1.wasm
Needed due to the breaking changes to `@splat` which are used by the
self-hosted compiler.

This update also includes the improvement that allows casting builtins
to infer the result type through optionals and error unions.
2023-07-12 15:50:57 -07:00
antlilja
299e86598d Update langref to new splat syntax 2023-07-12 15:35:57 -07:00
antlilja
a0ec2266fe Update tests to new splat syntax 2023-07-12 15:35:57 -07:00
antlilja
16d17addcb Update translate-c to new splat syntax 2023-07-12 15:35:57 -07:00
antlilja
b463e429b8 Remove len parameter from splat in standard lib 2023-07-12 15:35:57 -07:00
antlilja
4bce7b1db9 Remove len parameter from splat builtin function
Resolve the result type of the splat builtin instead of requiring a
length parameter.
2023-07-12 15:35:57 -07:00
pseudoc
d78517f4f0 feat(list_invert): SinglyLinkedList inversion. 2023-07-13 00:56:28 +03:00
Anton Lilja
711b4e93e2
Fixes crash when a struct is given as the first parameter to the unionInit builtin (#16385) 2023-07-11 23:37:42 -07:00
Anton Lilja
ff0e2ab398
Fixes wrong error location for unionInit when first parameter is not a type (#16384) 2023-07-11 23:35:50 -07:00
Andrew Kelley
660955c0d6
Merge pull request #15775 from r00ster91/newlines
remove some newlines and other minor cleanups
2023-07-11 23:06:12 -07:00
dweiller
a7707d8279 std.os.sigprocmask: @bitCast flags parameter 2023-07-11 23:03:21 -07:00
Xavier Bouchoux
cea8645423 build: avoid repeating objects when linking a static library
Don't pass the object files from a static library to the linker invocation.
The lib.a file already contains them.

Avoids "duplicate symbol" errors (and useless work by the linker)
2023-07-11 11:46:59 +02:00
Xavier Bouchoux
8142bc20ea test: linking static libraries built from intermediary object files 2023-07-11 11:46:59 +02:00
Michael Buckley
6bc9c4f716 std.Build: Add methods for creating modules from a TranslateC object. 2023-07-11 01:38:04 -07:00
Xavier Bouchoux
7a8002a5cf remove arbitrary stderr size limit when spawning a child process tool 2023-07-11 00:17:08 -07:00
Luuk de Gram
dbc560904a
Merge pull request #16345 from ziglang/15920
Emit check for memory intrinsics for WebAssembly
2023-07-11 09:11:22 +02:00
Niles Salter
e395a08e60
Add more sorting functions to MultiArrayList (#16377) 2023-07-11 06:37:51 +00:00
Meghan
3d5751b579
std.meta: remove isTag (#15584)
This is not used by Zig itself anywhere and not using the function is more idiomatic.
2023-07-10 14:35:36 -04:00
Meghan
cd0594e4a6
std: add mem.SplitIterator.peek() (#15670) 2023-07-10 14:34:39 -04:00
Andrew Kelley
cc56ab8c68
Merge pull request #16100 from squeek502/windows-path-compare
fs.path: Fix Windows path component comparison being ASCII-only
2023-07-10 11:17:07 -07:00
Luuk de Gram
37e2a04da8
add stand alone test to verify bulk-memory features
This adds a standalone test case to ensure the runtime does not trap
when performing a memory.copy or memory.fill instruction while the
destination or source address is out-of-bounds and the length is 0.
2023-07-10 20:05:13 +02:00
xdBronch
d7c6cfa7fd std.mem.zeroes work with allowzero pointers 2023-07-10 10:52:27 -07:00
r00ster91
0b1e8690da AstGen: make sure for range start and end are usizes
Fixes #16311

The actual cause of #16311 is the `start_is_zero` special case:
```zig
                const range_len = if (end_val == .none or start_is_zero)
                    end_val
                else
                    try parent_gz.addPlNode(.sub, input, Zir.Inst.Bin{
                        .lhs = end_val,
                        .rhs = start_val,
                    });
```
It only happens if the range start is 0. In that case we would not perform any type checking.
Only in the other cases coincidentally `.sub` performs type checking in Sema, but the errors are still rather poor:
```
$ zig test x.zig
x.zig:9:15: error: invalid operands to binary expression: 'Pointer' and 'Pointer'
    for ("abc".."def") |val| {
         ~~~~~^~~~~~~
```
Note how it's the same as if I use `-`:
```
x.zig:9:11: error: invalid operands to binary expression: 'Pointer' and 'Pointer'
    "abc" - "def";
    ~~~~~~^~~~~~~
```
Now after this PR, the errors are much clearer for both range start and end:
```
x.zig:9:10: error: expected type 'usize', found '*const [3:0]u8'
    for ("abc".."def") |val| {
         ^~~~~
```
This is why I decided to use `.ty` instead of `.coerced_ty` for both range start and end rather than
just perform type checking in that `end_val == .none or start_is_zero` case.
2023-07-10 10:51:55 -07:00
Techatrix
3bf0b8eada explicitly specify error set of std.json.stringify 2023-07-10 10:50:57 -07:00
Andrew Kelley
2b8c1f0d46
Merge pull request #16339 from r00ster91/ueficc
std.os.uefi: use std.os.uefi.cc instead of .C as calling convention
2023-07-10 10:41:19 -07:00
Ian Johnson
3a30f0fa50 Sema: resolve field type layout for anon struct type info
Closes #16148
2023-07-10 19:17:50 +03:00
kcbanner
82a9d5d78d type: update optionalReprIsPayload to handle inferred error sets 2023-07-10 04:52:23 -04:00
Josh Wolfe
874d2dd9f7
std.json: add generic hash map that parses/stringifies with arbitrary string keys (#16366)
* expose innerParseFromValue
2023-07-09 22:18:59 -04:00
Krzysztof Wolicki
a755310734
Changed Step.Run's stdin to accept FileSource (#16358) 2023-07-09 15:51:41 -04:00
Niles Salter
27a66191c2
Change math.Order order (#16356)
This speeds up algorithms like binary search
2023-07-09 01:22:52 -04:00
Garrett
131bfe2f74
std.json: expose innerParse and add .allocate option (#16312) 2023-07-08 22:49:31 -04:00
r00ster91
026c63d8fe Sema: infrastructure for supporting more than .C callconv for variadic functions
Now you can add new calling conventions that you confirmed to work with
variadic functions simply in a single place and the rest will work
automatically.
2023-07-08 18:05:03 -04:00
r00ster91
9be1a3f7ef std.os.uefi: use std.os.uefi.cc instead of .C as calling convention
I tested this and this definitely compiles and these
changes were done programmatically but if there's still anything wrong
it shouldn't be hard to fix.
With this change it's going to be very easy to make further adjustments
to the calling conventions of all these external UEFI functions.

Closes #16309
2023-07-08 17:32:36 -04:00
Luuk de Gram
d54ebf4356
llvm: add safety-check for Wasm memset
When lowering the `memset` instruction, LLVM will lower it to WebAssembly's
`memory.fill` instruction when the bulk-memory feature is enabled. This
instruction will trap when the destination address is out-of-bounds.
By Zig's semantics, it is valid to have an invalid pointer when the length is 0.
To prevent runtimes from trapping, we add a safety-check for slices to only
lower to a memset instruction when the length is larger than 0.
2023-07-08 17:45:05 +02:00
Luuk de Gram
836f9fceab
llvm: add safety-check for Wasm memcpy
When lowering the `memcpy` instruction, LLVM will lower it to WebAssembly's
`memory.copy` instruction when the bulk-memory feature is enabled. This
instruction will trap when the destination or source pointer is out-of-bounds.
By Zig's semantics, it is valid to have an invalid pointer when the length is 0.
To prevent runtimes from trapping, we add a safety-check for slices to only
lower to a memcpy instruction when the length is larger than 0.
2023-07-08 17:45:04 +02:00
Techatrix
89396ff02b
add jsonParseFromValue to std.json.Value (#16324) 2023-07-07 23:33:47 -04:00
Nameless
b9fc0d2908
std.http: fix leaked connections (#16341)
The early return in pool release was causing leaked connections.
Closes #16282.
2023-07-07 20:08:19 +00:00
xdBronch
80404cc928 implement std.time.sleep for uefi 2023-07-07 11:57:09 -07:00
dec05eba
2e424e019f Client.zig: support rsa_pss_rsae_sha384 and rsa_pss_rsae_sha512
This fixes HTTP GET to https://www.iana.org/domains/reserved
for example
2023-07-06 18:36:15 -07:00
Jakub Konka
44df3a148b std: add prefixed versions of addFileSource and addDirectorySource to Step.Run 2023-07-06 17:03:28 -07:00