Commit Graph

512 Commits

Author SHA1 Message Date
Andrew Kelley 58f8dcd15e std.Build: improve documentation for UpdateSourceFiles step 2026-05-25 18:54:35 -07:00
Andrew Kelley 9709efce98 std.Build.Step.Run: introduce Arg.cc_args
provides a way for the build system to append -target and -isystem/-I
flags to a Run step.

needed by translate-c package to avoid doing naughty stuff in the
configure phase.
2026-05-25 18:54:35 -07:00
Andrew Kelley 42be6c0088 configurer: serialize Step.TranslateC 2026-05-25 18:54:35 -07:00
Andrew Kelley 315d6ee59b configurer: serialize Step.ConfigHeader 2026-05-25 18:54:35 -07:00
Andrew Kelley 7e6be7ee6e configurer: serialize Step.ObjCopy 2026-05-25 18:54:35 -07:00
Andrew Kelley f158262b30 configurer: serialize Step.Options 2026-05-25 18:54:35 -07:00
Andrew Kelley d7eab060db configurer: serialize Step.UpdateSourceFiles 2026-05-25 18:54:35 -07:00
Andrew Kelley d45f792c91 configurer: serialize Step.Fmt 2026-05-25 18:54:35 -07:00
Andrew Kelley 1186a10d4e configurer: serialize WriteFile 2026-05-25 18:54:35 -07:00
Andrew Kelley ecba6324bf configurer: update TranslateC step
and get zig's build.zig script fully compiling
2026-05-25 18:54:35 -07:00
Andrew Kelley 8a8bf5ad02 maker: update ObjCopy to new system 2026-05-25 18:54:35 -07:00
Andrew Kelley affe5ed867 std.Build: port UpdateSourceFiles step to new system 2026-05-25 18:54:35 -07:00
Andrew Kelley d3ec255a1f more progress towards zig's build.zig compiling 2026-05-25 18:54:35 -07:00
Andrew Kelley 3d78589765 std.Build: port Fmt step to new system
and integrate properly with LazyPath
2026-05-25 18:54:35 -07:00
Andrew Kelley ddabd57743 progress towards compiling zig's build script 2026-05-25 18:54:35 -07:00
Andrew Kelley fa26566867 configurer: get InstallDir and Options steps compiling 2026-05-25 18:54:35 -07:00
Andrew Kelley 364a1400ff configurer: fix compilation in the presence of dependencies 2026-05-25 18:54:35 -07:00
Andrew Kelley aec708ce25 build system: remove unneeded args from configurer
not needed:
* zig exe path
* zig lib dir
* build root
* local cache root
* global cache root
2026-05-25 18:54:35 -07:00
Andrew Kelley 7819e4dea7 rename addCliExtras to addPassthruArgs
finally, a good name
2026-05-25 18:54:35 -07:00
Andrew Kelley 8f224bc3f0 rename addBuildPositionals to addCliExtras
they don't have to be positionals
2026-05-25 18:54:35 -07:00
Andrew Kelley 0d95b44a1c build system: implement cli positionals 2026-05-25 18:54:35 -07:00
Andrew Kelley c8b583885d maker: port Run step logic up to spawnChildAndCollect 2026-05-25 18:54:34 -07:00
Andrew Kelley 7c718fc72e fix compilation errors from rebase conflicts 2026-05-25 18:54:34 -07:00
Andrew Kelley e436d9c4ad configurer: back out the string interning from prev commit
partial revert of 2d3fbb687fba1ed52b42998ac4dcbf2a042644ea - see its
commit message for reasoning
2026-05-25 18:54:34 -07:00
Andrew Kelley c6d37f3895 configurer: make string duplication also intern
I had this idea to make b.dupe() also intern the strings since they will
be ultimately serialized to Configuration. Unfortunately the idea does
not work, because although a process-lived arena is used for the
string_bytes ArrayList of the Configuration.Wip, when the ArrayList is
resized, Allocator.free() memsets the freed memory to undefined, even
though it still technically lives due to being in a process-scoped
arena. So this commit will need to be partially reverted. However, I
kept it for posterity, and there are some more changes which I will now
note below.

- dupePaths: don't rewrite backslashes to forward slashes. backslashes
  are valid in filenames on non-windows systems.
- always compile configurer in single-threaded mode
- use arena allocator for everything, no gpa for anything
- construct the Configuration.Wip instance earlier, so some stuff can be
  prepopulated as desired.
- don't forget to flush
2026-05-25 18:54:34 -07:00
Andrew Kelley aa0652ff8d maker: implement InstallArtifact and InstallFile 2026-05-25 18:54:34 -07:00
Andrew Kelley dd51fc30f8 maker: finish migrating compile step make logic 2026-05-25 18:54:34 -07:00
Andrew Kelley 71ac3f15b3 build system: implement LazyPath
Number of generated files is recorded in serialized Configuration. Maker
preallocates array of generated files so that loads and stores can be
synchronization-free (protected by the dependency tree ordering).

More progress on Compile Step Zig CLI lowering.
2026-05-25 18:54:34 -07:00
Andrew Kelley 8aec13b6ab Configuration: serialize remaining Module information
also handle properly Module circular references and introduce a general
deduplication mechanism.
2026-05-25 18:54:34 -07:00
Andrew Kelley 612560d019 std.Build.Configure: implement FlagOptional serialization 2026-05-25 18:54:34 -07:00
Andrew Kelley 74b018ceb3 zig build: make --error-limit globally configurable
still overridable by individual Compile steps
2026-05-25 18:54:34 -07:00
Andrew Kelley 959103c3fd Maker.Step.Compile: progress towards lowering zig args 2026-05-25 18:54:34 -07:00
Andrew Kelley 6b7ce1fa22 massage Step code into compiling 2026-05-25 18:54:34 -07:00
Andrew Kelley afd7507a19 make runner: prepare steps for execution 2026-05-25 18:54:33 -07:00
Andrew Kelley 648e0e0cc0 configure runner: serialization of compile step 2026-05-25 18:54:33 -07:00
Andrew Kelley 6b040d631f configure runner: add Step.Run serialization 2026-05-25 18:54:33 -07:00
Andrew Kelley 83a3475887 configure runner: implement serialization of InstallArtifact 2026-05-25 18:54:33 -07:00
Andrew Kelley 2e88ac8842 zig build: configure runner basics implemented 2026-05-25 18:54:33 -07:00
GasInfinity 1deb029a66 std: rename bit_set variants and deprecate the managed one.
* aliases and deprecates the previous names.
* also update callsites to use the non-deprecated declarations.
2026-04-27 16:46:26 +02:00
Andrew Kelley e7d74e49b0 declare linker test bankruptcy
The active contributors and maintainers of Zig's linker code have
generally found the current linker test harness to be cumbersome. The
tests require a lot of maintenance, but do not provide a lot of
coverage, and when they fail it is painful to troubleshoot.

Furthermore, as part of working on #31691, I don't want to port over the
CheckObject step, because I don't like the code anyway.

The plan forward is to start enhancing `zig objdump` to assist in
linker development, as well as using it as the basis for snapshot
testing.

We absolutely need linker test coverage, but we need to try to improve
these things about the next attempt:
* less effort to create and maintain tests
* less CPU overhead - we should be able to add a lot of tests without
  adding a lot of CI time.
* more helpful failures. A failed linker test should provide the next
  steps a developer can take to understand why the test failed.
* a goal of porting over all of LLD's test suite, or at least the good
  ones.

I'm not going to open an issue to track the lost linker test coverage,
because there was already so much lack of coverage for linker stuff.

However I will open issues to track this lost coverage:
* the deleted checks from test/standalone/glibc_compat/build.zig
* the deleted checks from test/standalone/compiler_rt_panic/build.zig
* the deleted checks from test/standalone/ios/build.zig
2026-04-26 00:15:07 +02:00
Kendall Condon 332d632ccc collect all stderr on fuzzing crash 2026-04-22 20:54:17 -04:00
Kendall Condon 122e0c26f2 properly scan through inputs when saving fuzzing crash 2026-04-22 20:54:17 -04:00
andrew.kraevskii bbab366b78 Audit usages of toOwnedSlice (#32001)
Followup to #30769

I grepped for `try .*toOwnedSlice` and checked all of them by hand.

Fixes a bunch of memory leaks removes usages or `errdefer` and `vars` in some places. I also switched array_list.Managed to ArrayList where it was convenient.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32001
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-22 19:35:46 +02:00
Ryan Liptak 3252a05531 Prefer <err> => |e| return e over <err> => return <err>
Avoids the potential for a typo on the `return <err>` side of the prong
2026-04-20 18:03:14 -07:00
Andrew Kelley 67a5b6e5e8 delete @cImport from the language
closes #20630
2026-04-15 17:43:53 -07:00
Andrew Kelley 2322d45d80 Merge pull request 'Implement variadic functions for Win64 in the x86_64 backend' (#31672) from kcbanner/zig:win64_varargs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31672
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-12 01:34:16 +02:00
Carl Åstholm 3d48264365 Fix -fwasmtime not inheriting environment variables 2026-04-11 12:23:49 -07:00
Alex Rønne Petersen d6f43caadf Merge pull request 'audit: handle process.Child.Term exhaustively and give useful exit information on process exit' (#31018) from murtaza/zig:child.term-audit into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31018
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-04-11 00:59:11 +02:00
Andrew Kelley c3a862522b std: remove managed array hash map variants
And deprecate all the API names except for:
* `std.array_hash_map.Auto`
* `std.array_hash_map.String`
* `std.array_hash_map.Custom`
2026-04-10 17:39:45 +02:00
Andrew Kelley 0606af509f translate-c build step: remove use_clang field
This no longer does anything.
2026-04-09 14:05:45 -07:00