0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
Commit graph

13,903 commits

Author SHA1 Message Date
Andrew Kelley
74168de68b Maker: fix lowering of build module on CLI 2026-06-29 23:50:19 -07:00
Andrew Kelley
20e7cc8d88 std.Build.Cache: bump max number of prefixes 2026-06-29 23:50:19 -07:00
Andrew Kelley
98854a673e Maker: it's compiling again 2026-06-29 23:50:19 -07:00
Andrew Kelley
0c978ba957 WIP: migrate build and fetch commands to Maker process 2026-06-29 23:50:18 -07:00
Andrew Kelley
a04f90c35b introduce std.Build API for making configure script depend on fs 2026-06-29 23:50:18 -07:00
Andrew Kelley
6a052277c3 std.Build: document a handful of functions 2026-06-29 23:50:18 -07:00
Nguyen Gia Huy
1d1193aa7b
std.math: Mark signExtend as pub
Introduced in b636906fb6
2026-06-30 02:24:16 +00:00
Pavel Verigo
ba5420896d Enable std tests for wasm backend again + enable field reordering
Additionally remove some skips, closes #30575
2026-06-29 13:22:20 +02:00
Ali Cheraghi
85b0259307 Target: chain spirv versions 2026-06-28 18:25:43 +02:00
Lukas Lalinsky
e0e145048d Make it possible to implement Io.vtable.netWriteFile
- Fix error set to include the necessary errors
- Wire it into `Io.net.Stream.Writer`
2026-06-28 11:12:34 +02:00
Andrew Kelley
072534bb2a std.hash.crc: restore auto-generated status 2026-06-26 16:13:19 -07:00
Andrew Kelley
c646f0e182 std.hash.crc: embrace standard names 2026-06-26 16:07:53 -07:00
Andrew Kelley
030e7d3567 std.hash.crc: restore auto-generated status 2026-06-26 16:07:53 -07:00
Andrew Kelley
3a11c86837 std.hash.crc: fix namespace issues
in accordance with the style guide in the langref
2026-06-26 16:07:53 -07:00
Robbie Lyman
32b44497e2 fix(Io.Uring): free size must match alloc size 2026-06-26 23:49:16 +02:00
Andrew Kelley
07782d7a46 Merge pull request 'hash: implement fast crc32c' (#30021) from sinon/zig:fast-crc32c into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30021
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-06-26 23:46:46 +02:00
whatisaphone
b636906fb6 std.math: Add signExtend 2026-06-26 23:30:13 +02:00
Alex Rønne Petersen
1999d80d6e Merge pull request 'Elf2: add initial LoongArch support' (#35875) from AstraFall/zig:loongarch/elf2/init into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35875
Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
2026-06-26 02:08:14 +02:00
Andrew Kelley
56e313b288 Merge pull request 'Asserts InternPool keys have unique representations' (#35914) from masonremaley/intern-pool-unique-key-reprs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35914
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-06-25 20:38:05 +02:00
Andrew Kelley
cd3288a3f6 Merge pull request 'Coff linker enhancements, new linker testing framework, and COFF objdump implementation' (#35674) from kcbanner/zig:coff_linker_wip into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35674
Reviewed-by: Jacob Young <jacobly@ziglang.org>
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-06-25 19:20:51 +02:00
xtex
360deedcf1
std.elf: add LoongArch e_flags definition
Link: 44ef5f63e1/laelf.adoc (L74-L93)
2026-06-25 22:12:55 +08:00
xtex
e048c90545
std.elf: add R_LARCH relocations 2026-06-25 22:06:24 +08:00
Ali Cheraghi
e8ccd4fbcd spirv: allow specifying texel type for storage images 2026-06-25 15:47:10 +02:00
Mason Remaley
87860e80b4 Adds unions support to hasUniqueRepresentation 2026-06-24 22:11:49 -07:00
Robbie Lyman
f3544a7079 fix: Allocator contract should allow free on single-pointer-to-array
Currently, when calling `free` a slice created by slicing a pointer with
comptime-known start and end, a compile-time assertion is hit, because
the slicing results in `*[len]T` rather than the expected `[]T`.

This commit allows `Allocator.free` to be called on such pointers as
well.

closes #35712
2026-06-25 02:09:34 +02:00
Andrew Kelley
92505a7de7 std: move fmt.bufPrint to mem.print 2026-06-24 17:01:19 -07:00
Andrew Kelley
243192c60e std.mem.Allocator: add unit tests for print and printSentinel 2026-06-24 14:16:50 -07:00
Andrew Kelley
745a029b9e std: move fmt.allocPrint to Allocator.print 2026-06-24 14:09:30 -07:00
Techatrix
5f78220dbe std.Build.Step.Run: add support specifying preopens 2026-06-24 21:10:43 +02:00
Techatrix
d95dcb2a62 std.Build.Step.Compile: remove setExecCmd
This function can be used to prepend a list of arguments when running a
test step. Instead, the additional arguments should be manually added to
the run step which can handle a broader set of use cases.
2026-06-24 20:57:36 +02:00
Ryan Liptak
d3f7cf7345 Io.Threaded: Fix dirReadLinkWindows not handling its async handle correctly
NtCreateFile is called with `.IO = .ASYNCHRONOUS` but then `NtFsControlFile` is called without any handling of `PENDING`. By switching to the `deviceIoControl` helper function, `PENDING` is handled since we are passing `.nonblocking = true`.

Fixes https://codeberg.org/ziglang/zig/issues/35871
2026-06-24 20:15:50 +02:00
mlugg
39a9a4b2ca Merge pull request 'llvm: only load/store ABI-sized integers to/from memory' (#35711) from mlugg/llvm-weird-int-in-memory into master
Resolves: https://github.com/ziglang/zig/issues/17768
Resolves: https://github.com/ziglang/zig/issues/18936
Resolves: https://github.com/ziglang/zig/issues/19755
Resolves: https://github.com/ziglang/zig/issues/24282
Resolves: https://github.com/ziglang/zig/issues/24883
Resolves: https://github.com/ziglang/zig/issues/25042
Resolves: https://github.com/ziglang/zig/issues/25555
Resolves: https://codeberg.org/ziglang/zig/issues/32036
Resolves: https://codeberg.org/ziglang/zig/issues/35560
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35711
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-06-24 17:28:01 +02:00
Matthew Lugg
664c1d0198
cbe: disable some failing tests 2026-06-24 10:20:56 +01:00
Matthew Lugg
10c97c26d9
std: update for new @bitCast semantics 2026-06-24 10:20:56 +01:00
Matthew Lugg
fa3a9fcdfa
llvm: only load/store ABI-sized integers to/from memory
In theory, for any integer type containing padding bits (e.g. `i3`),
LLVM *does* support storing and loading that type to and from memory,
and the documented semantics for this in the LLVM langref are a valid
implementation of Zig's integer semantics. However, in practice, this
support is frequently buggy, because Clang never emits such operations
and so they are poorly tested in LLVM. The most recent example of such a
bug is https://codeberg.org/ziglang/zig/issues/35560.

In addition, LLVM's semantics here lead to suboptimal codegen, because
loads/stores are only rounded up to the next byte (rather than the next
ABI integer type) and padding bits are unspecified (or, on LLVM master,
padding bits are all zero, even for a negative signed integer).

We can both mitigate LLVM bugs and get better codegen by employing the
strategy used by the self-hosted backends, wherein we zero- or
sign-extend to an integer of bit size `@sizeOf(WeirdInt) * 8`. This type
has the same size in memory but has no padding bits. When loading, we
load the extended type and then use `trunc nuw` or `trunc nsw`
(depending on the signedness) to convert to the correct value type.

The name of the game here is to minimize occurrences of `wip.load` and
`wip.store` in the LLVM backend, with most accesses instead going
through higher-level functions which handle this extension/truncation
for us. Those higher-level functions are `codegen.llvm.FuncGen.load` and
`codegen.llvm.FuncGen.store`. I changed their signatures slightly to
make them consistent and more generally useful, and changed the majority
of calls to `wip.load`/`wip.store` to use them. They are the only
functions which include the integer extension/truncation logic.

The remaining occurrences of `wip.load` and `wip.store` outside of those
two functions are all in ABI handling. These code paths cannot occur for
non-ABI types due to how we lower `CallingConvention.auto`, therefore
they cannot be reached for non-ABI-sized integer types.

This diff was not purely mechanical---I had to make a handful of
non-trivial logic changes and refactors. The biggest logic change is in
lowering a "select" operation to a manual loop: we now use phi nodes to
track the loop iterator and accumulator instead of an `alloca`. (To be
honest, this wasn't really necessary, but I felt dirty migrating the old
logic when this approach is clearly better.) The most significant
refactor is that the logic for extracting function call arguments has
been moved into `FuncGen`: the `codegen.llvm.Object.updateFunc`
implementation will not initialize the three fields which depend on
function arguments, and a new function `FuncGen.genMainBody` will
populate those fields before calling `genBody` on the main AIR body.
This change was made so that I could use member functions on `FuncGen`
in this logic without jumping through hoops.

The reproduction given in https://codeberg.org/ziglang/zig/issues/35560
is apparently quite delicate, so I haven't added a test case because it
realistically would not be very useful. However, I have manually tested
the reproduction, and can confirm that the bug *does* trigger before
this commit (targeting both baseline and native CPU), and does *not*
trigger after this commit (again, for both baseline and native CPU).

Resolves: https://codeberg.org/ziglang/zig/issues/35560
2026-06-24 10:20:52 +01:00
David Rubin
2e1b172850 codegen: fix x86-64 backend crc32 inline asm 2026-06-24 02:12:43 -05:00
David Rubin
874b6e39db hash: implement fast crc32c 2026-06-24 02:12:43 -05:00
CursedByTheVoid
00ea8a9897 std.zig.LibCInstallation: fix parse panic
Swaps `dupeSentinel` for `dupe` in the `parse` function.

Aside from being inconsistent with the other `findNative` functions in
the file, `dupeSentinel` also causes `deinit` to panic because it
attempts to free fewer bytes than were allocated.
2026-06-23 22:56:21 -04:00
CursedByTheVoid
5dc2651cdd std.zig.LibCInstallation: tokenize CR when parsing 2026-06-23 22:41:36 -04:00
Mason Remaley
b40b1178ef Adds support for making run step argument paths absolute
* Adds a new API that takes an options struct instead of having a
  function for each combination of options
* Adds support for prefix and suffix to every argument type
* Adds support for making paths absolute when passed as arguments
* Deprecates the old API
* Fixes mismatch between documentation and behavior of
  `process.currentPath` on WASI
2026-06-24 02:41:05 +02:00
kcbanner
f2a778ca52 Coff: fixes for 32 bit targets 2026-06-23 00:27:17 -04:00
kcbanner
1c6d19b0ff tests: more work on the linker snapshot testing framework
build: add the ability to test the output of a Run step against a snapshot
objdump:  add --redact, --omit-element, --snapshot, and --only-symbol
2026-06-23 00:27:14 -04:00
kcbanner
b2eee06bd6 objdump: coff --tls 2026-06-23 00:26:57 -04:00
kcbanner
97bf880486 objdump: coff --imports 2026-06-23 00:26:57 -04:00
kcbanner
9df2ca0d33 objdump: more coff progress
- Linker member selection
- Dump implib headers
- Dump relocs
- Add more info to table headers for easier grepping
2026-06-23 00:26:56 -04:00
kcbanner
224d7e7999 objdump: more coff progress 2026-06-23 00:26:56 -04:00
kcbanner
601da46f15 objdump: initial COFF implementation 2026-06-23 00:26:56 -04:00
kcbanner
a22ca5d416 Coff: more progress on imports
- Support __imp_ prefixed symbols
- Support data imports
- Support globals symbols pointing directly to IAT entries
- Don't create duplicate IAT entries if multiple globals reference the same import name / ordinal
- Rework storage of Symbol.value
- Add support for `is_dll_import`
- Supply host libc libs to the linker
- Add std.meta.BareUnion (from multi_array_list)
2026-06-23 00:22:42 -04:00
kcbanner
6ff2b9b913 Coff: handle COMDAT sections and weak externals
- Rework object loading to handle COMDAT sections
- Add better error output for multiple definitions
- Track all symbols associated with input sections in a flat array
- Resolve weak externals to their alias if nothing defines the weak symbol
- Fixup incorrect signs of reloc addends in the logic that saves / restores them
2026-06-23 00:22:42 -04:00
kcbanner
c7c1d65372 - Remove the compiler_rt_dyn_lib hack 2026-06-23 00:22:42 -04:00