aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build
AgeCommit message (Collapse)Author
2025-11-20update deprecated ArrayListUnmanaged usage (#25958)Benjamin Jurk
2025-11-20std.Build: fix crashes running fuzz testsMatthew Lugg
2025-11-20fuzzer: account for runtime address slideMatthew Lugg
This is relevant to PIEs, which are notably enabled by default on macOS. The build system needs to only see virtual addresses, that is, those which do not have the slide applied; but the fuzzer itself naturally sees relocated addresses (i.e. with the slide applied). We just need to subtract the slide when we communicate addresses to the build system.
2025-11-20std.debug.Info: basic Mach-O supportMatthew Lugg
2025-11-20std.debug: split up Mach-O debug info handlingMatthew Lugg
Like ELF, we now have `std.debug.MachOFile` for the host-independent parts, and `std.debug.SelfInfo.MachO` for logic requiring the file to correspond to the running program.
2025-11-19std.Build.Step.Compile: add support for '-z defs' flagHarold
2025-11-19std.Build.Step.CheckObject: make ELF reading endianness-awareAlex Rønne Petersen
2025-11-19std.Build.Step.Run: read/write messages as little endianAlex Rønne Petersen
2025-11-19std.Build.Step: send messages to compiler as little-endianMatthew Lugg
Little-endian is what `std.zig.Server` expects, but the old logic just send the raw bytes of the struct, so sent in native endian (causing a crash on big-endian targets).
2025-11-14std.Build: don't force all children to inherit color optionMatthew Lugg
The build runner was previously forcing child processes to have their stderr colorization match the build runner by setting `CLICOLOR_FORCE` or `NO_COLOR`. This is a nice idea in some cases---for instance a simple `Run` step which we just expect to exit with code 0 and whose stderr is not being programmatically inspected---but is a bad idea in others, for instance if there is a check on stderr or if stderr is captured, in which case forcing color on the child could cause checks to fail. Instead, this commit adds a field to `std.Build.Step.Run` which specifies a behavior for the build runner to employ in terms of assigning the `CLICOLOR_FORCE` and `NO_COLOR` environment variables. The default behavior is to set `CLICOLOR_FORCE` if the build runner's output is colorized and the step's stderr is not captured, and to set `NO_COLOR` otherwise. Alternatively, colors can be always enabled, always disabled, always match the build runner, or the environment variables can be left untouched so they can be manually controlled through `env_map`. Notably, this fixes a failure when running `zig build test-cli` in a TTY (or with colors explicitly enabled). GitHub CI hadn't caught this because it does not request color, but Codeberg CI now does, and we were seeing a failure in the `zig init` test because the actual output had color escape codes in it due to 6d280dc.
2025-11-14represent Mac Catalyst as aarch64-maccatalyst-none rather than ↵Alex Rønne Petersen
aarch64-ios-macabi Apple's own headers and tbd files prefer to think of Mac Catalyst as a distinct OS target. Earlier, when DriverKit support was added to LLVM, it was represented a distinct OS. So why Apple decided to only represent Mac Catalyst as an ABI in the target triple is beyond me. But this isn't the first time they've ignored established target triple norms (see: armv7k and aarch64_32) and it probably won't be the last. While doing this, I also audited all Darwin OS prongs throughout the codebase and made sure they cover all the tags.
2025-11-07Move/coalesce RcIncludes enum to `std.zig.RcIncludes`Ryan Liptak
2025-11-07Move/coalesce CompressDebugSections enum to `std.zig.CompressDebugSections`Ryan Liptak
2025-11-07Merge pull request #25158 from castholm/subsystemRyan Liptak
Misc. Windows subsystem refactorings
2025-11-06Step.Run: Fix for `convertPathArg` when cwd and path args are on different ↵Ryan Liptak
drives Fixes #25805
2025-11-05Move `std.Target.SubSystem` to `std.zig.Subsystem`Carl Åstholm
Also updates the field names to conform with the rest of std.
2025-10-30Merge pull request #25558 from jacobly0/elfv2-load-objJacob Young
Elf2: start implementing input object loading
2025-10-30std.Build: fix '--webui' crashMatthew Lugg
Using '--webui' without '--time-report' when there are Run steps in the graph was regressed by https://github.com/ziglang/zig/pull/25029.
2025-10-30std.debug.lockStderrWriter: also return ttyconfMatthew Lugg
`std.Io.tty.Config.detect` may be an expensive check (e.g. involving syscalls), and doing it every time we need to print isn't really necessary; under normal usage, we can compute the value once and cache it for the whole program's execution. Since anyone outputting to stderr may reasonably want this information (in fact they are very likely to), it makes sense to cache it and return it from `lockStderrWriter`. Call sites who do not need it will experience no significant overhead, and can just ignore the TTY config with a `const w, _` destructure.
2025-10-30Merge pull request #25763 from mrjbq7/cancelledJohn Benediktsson
rename Cancelled to Canceled
2025-10-29Elf2: start implementing dynamic linkingJacob Young
2025-10-29std: back out the StackTrace byval changesAndrew Kelley
Let's keep passing this thing by pointer
2025-10-29std: fix compilation errors on WindowsAndrew Kelley
2025-10-29std.fs: use BadPathName rather than InvalidWtf8 on WindowsAndrew Kelley
2025-10-29std: accessZ -> accessAndrew Kelley
2025-10-29std.Io: implement dirStatPathAndrew Kelley
2025-10-29std.Io: bring back Timestamp but also keep Clock.TimestampAndrew Kelley
this feels better
2025-10-29std: updating to std.Io interfaceAndrew Kelley
got the build runner compiling
2025-10-29std.zig.system: upgrade to std.Io.ReaderAndrew Kelley
2025-10-29WIP: hack at std.Io on a planeAndrew Kelley
2025-10-29WIP land the std.Io interfaceAndrew Kelley
fix std lib compilation errors caused by introducing std.Io
2025-10-18compiler: rename `--test-timeout-ms` to `--test-timeout`Matthew Lugg
The unit can now be specified in the argument.
2025-10-18ci: bump unit test timeoutsmlugg
2025-10-18build runner: remove `--prominent-compile-errors`, introduce `--error-style`mlugg
The new `--error-style` option decides how build failures are printed. The default mode "verbose" prints all context including the step graph fragment and the failed command (if any). The alternative mode "minimal" prints only the failed step itself, and does not print the failed command. There are also "verbose_clear" and "minimal_clear" modes, which have the distinction that the output is cleared (through ANSI escape codes) between updates, preventing different updates from being confused in the output. If `--error-style` is not specified, the environment variable `ZIG_BUILD_ERROR_STYLE` is checked before falling back to the default of "verbose"; this means the value can effectively be chosen system-wide since it is generally a personal preference. Also introduced is a `--multiline-errors` option which decides how to print errors which span multiple lines. By default, non-initial lines are indented to align with the first. Alternatively, a leading newline can be printed to align everyting on the first column, or no special treatment can be applied, resulting in misaligned output. Again, there is an environment variable (`ZIG_BUILD_MULTILINE_ERRORS`) to specify a preferred default if the option is not explicitly provided. Resolves: #23472
2025-10-18std.Build: separate errors from failed commandsmlugg
Recording the command in a separate field will give the build runner more freedom to choose how and when the command should be printed.
2025-10-18std.Build.Step.Run: many enhancementsmlugg
This is a major refactor to `Step.Run` which adds new functionality, primarily to the execution of Zig tests. * All tests are run, even if a test crashes. This happens through the same mechanism as timeouts where the test processes is repeatedly respawned as needed. * The build status output is more precise. For each unit test, it differentiates pass, skip, fail, crash, and timeout. Memory leaks are reported separately, as they do not indicate a test's "status", but are rather an additional property (a test with leaks may still pass!). * The number of memory leaks is tracked and reported, both per-test and for a whole `Run` step. * Reporting is made clearer when a step is failed solely due to error logs (`std.log.err`) where every unit test passed.
2025-10-18std.Build: implement unit test timeoutsmlugg
For now, there is a flag to `zig build` called `--test-timeout-ms` which accepts a value in milliseconds. If the execution time of any individual unit test exceeds that number of milliseconds, the test is terminated and marked as timed out. In the future, we may want to increase the granularity of this feature by allowing timeouts to be specified per-step or even per-test. However, a global option is actually very useful. In particular, it can be used in CI scripts to ensure that no individual unit test exceeds some reasonable limit (e.g. 60 seconds) without having to assign limits to every individual test step in the build script. Also, individual unit test durations are now shown in the time report web interface -- this was fairly trivial to add since we're timing tests (to check for timeouts) anyway. This commit makes progress on #19821, but does not close it, because that proposal includes a more sophisticated mechanism for setting timeouts. Co-Authored-By: David Rubin <david@vortan.dev>
2025-10-09- Rework common translate-c and cImport logic into `Compilation.translateC`kcbanner
- Add std.zig.Server.allocErrorBundle, replace duplicates
2025-09-30std: fixesmlugg
2025-09-30replace usages of old std.debug APIsmlugg
src/crash_handler.zig is still TODO though, i am planning bigger changes there
2025-09-30yet moremlugg
2025-09-26Merge pull request #25342 from ziglang/fuzz-limitAndrew Kelley
fuzzing: implement limited fuzzing
2025-09-25web ui: fix not sending initial context sometimesAndrew Kelley
This would cause the web ui to crash in js or wasm.
2025-09-25implement review suggestionsLoris Cro
2025-09-24std.Build.Cache: clarify parameter is sub path, not basenameAndrew Kelley
2025-09-24fuzzing: implement limited fuzzingLoris Cro
Adds the limit option to `--fuzz=[limit]`. the limit expresses a number of iterations that *each fuzz test* will perform at maximum before exiting. The limit argument supports also 'K', 'M', and 'G' suffixeds (e.g. '10K'). Does not imply `--web-ui` (like unlimited fuzzing does) and prints a fuzzing report at the end. Closes #22900 but does not implement the time based limit, as after internal discussions we concluded to be problematic to both implement and use correctly.
2025-09-21Elf2: create a new linker from scratchJacob Young
This iteration already has significantly better incremental support. Closes #24110
2025-09-19std.Build.Step.Run: Enable passing (generated) file content as argsJustus Klausecker
Adds `addFileContentArg` and `addPrefixedFileContentArg` to pass the content of a file with a lazy path as an argument to a `std.Build.Step.Run`. This enables replicating shell `$()` / cmake `execute_process` with `OUTPUT_VARIABLE` as an input to another `execute_process` in conjuction with `captureStdOut`/`captureStdErr`. To also be able to replicate `$()` automatically trimming trailing newlines and cmake `OUTPUT_STRIP_TRAILING_WHITESPACE`, this patch adds an `options` arg to those functions which allows specifying the desired handling of surrounding whitespace. The `options` arg also allows to specify a custom `basename` for the output. e.g. to add a file extension (concrete use case: Zig `@import()` requires files to have a `.zig`/`.zon` extension to recognize them as valid source files).
2025-09-18greatly improve capabilities of the fuzzerKendall Condon
This PR significantly improves the capabilities of the fuzzer. The changes made to the fuzzer to accomplish this feat mostly include tracking memory reads from .rodata to determine fresh inputs, new mutations (especially the ones that insert const values from .rodata reads and __sanitizer_conv_const_cmp), and minimizing found inputs. Additionally, the runs per second has greatly been increased due to generating smaller inputs and avoiding clearing the 8-bit pc counters. An additional feature added is that the length of the input file is now stored and the old input file is rerun upon start. Other changes made to the fuzzer include more logical initialization, using one shared file `in` for inputs, creating corpus files with proper sizes, and using hexadecimal-numbered corpus files for simplicity. Furthermore, I added several new fuzz tests to gauge the fuzzer's efficiency. I also tried to add a test for zstandard decompression, which it crashed within 60,000 runs (less than a second.) Bug fixes include: * Fixed a race conditions when multiple fuzzer processes needed to use the same coverage file. * Web interface stats now update even when unique runs is not changing. * Fixed tokenizer.testPropertiesUpheld to allow stray carriage returns since they are valid whitespace.
2025-09-04std.elf: change STV enum from u2 to u3Alex Rønne Petersen
In gABI 4.3, st_other was changed such that the lower 3 bits are reserved for the visibility, up from the previous 2 bits.