551 Commits
Author SHA1 Message Date
Matthew Lugg f6751410e9 build: run some tests with -flegalize-all
It's useful to run both a little-endian and a big-endian target here,
because some legalizations are susceptible to endianness bugs, e.g. any
related to bitwise operations or to `packed` (aka `bitpack`) types.

When modifying legalizations or adding new ones, they can be tested by
running `zig build test-modules -Donly-legalize` to limit to the targets
which pass `-flegalize-all`.

This makes it much easier to facilitate external contributions towards
https://codeberg.org/ziglang/zig/issues/36719, and will prevent
legalization passes from bit-rotting in the future.
2026-10-26 14:17:03 +00:00
Alex Rønne Petersen 9092424fc3 make -ffunction-sections and -fdata-sections resolved config options
In preparation for giving them defaults that depend on the target and backend.
2026-10-26 11:02:42 +01:00
Jacob Young 4e4e8902e5 Build: fix UAF of step names 2026-09-26 19:08:50 -04:00
Jacob Young 11958a306f test: implement new runner 2026-09-26 19:08:50 -04:00
Andrew Kelley b844605c52 build system: translate-c supports arbitrary c flags
closes #35568
2026-09-22 08:57:25 +02:00
Andrew Kelley c106e27595 std.Build.Step.Options: add addOptionPathDirectory
Now, when adding an option that is a file path, one must explicitly
choose between:
* `addOptionPath` (must be a file)
* `addOptionPathDirectory` (must be a directory)
* `addOptionPathUntracked` (opt out of dependency tracking)

closes #35766
2026-09-17 21:04:22 -07:00
Andrew Kelley 9d0fb12a8f std.Build.Step.Option: clarify addOptionPathUntracked
in particular, that it may be a file or directory
2026-09-17 20:19:18 -07:00
Brandon Black 5ede6a167e Build.Step.Options: addOptionPathUntracked
This interface is like `addOptionPath`, but does not assume that
the provided `LazyPath` represents a generated file, and does not
set up any further dependencies on whatever the path represents.

This supports use-cases like setting an `.install_prefix` -based
default directory path option for the application to use as a
fallback when the user does not provide an override.  Example:

    options.addOptionPathUntracked(
        "DefaultConfigDir",
        b.graph.path(
            .install_prefix,
            b.pathJoin(&.{ "etc", "myapp" }),
        ),
    );
2026-09-18 04:31:03 +02:00
K4 2c93c6e91b std.lang.OptimizeMode -> std.lang.Optimize migration progress 2026-08-23 14:30:48 +02:00
Pavel Verigo 7051f8e73b wasm: add --growable-table 2026-08-18 17:43:59 +02:00
Andrew Kelley 127e2d8088 ability to forward third party integration arguments to child processes
This provides a way to forward, e.g. the `-fqemu` argument from
`zig build` to a child process during Maker execution without providing
the information to the configuration logic.
2026-08-07 11:19:55 -07:00
Andrew Kelley 3a8984f254 delete standalone test: debug_io_color
This test has a workaround in it (setting has_side_effects=true) which
made it problematic to maintain. Delete the test instead.
2026-08-07 11:19:55 -07:00
Techatrix cbf00af868 std.Build: remove unused libc flag from compile step
Whether libc and libcpp need to be linked is resolved on the maker side
in `Maker/Step/Compile.zig`.
2026-08-06 19:54:20 +02:00
Krzysztof Wolicki ab4028d579 Update usages of most deprecated APIs
In particular renames of `std.mem.indexOf` family to `std.mem.find`
and generic unmanaged containers
2026-08-05 03:40:30 +02:00
Andrew Kelley f8c6193e4c Merge pull request 'elf: remove deprecated elf.ElfXX_Phdr, elf.Phdr and elf.PR_*' (#36353) from kada49/deprecated-phdr-remove into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36353
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-08-05 03:38:32 +02:00
Techatrix 988613be67 std.Build.Configuration: improve storage of preopens in run steps 2026-08-04 19:48:09 +02:00
Bernard Assan 8523ee09ae Implement Meson ConfigHeader support
updated PR for the new build system changes

add standalone tests for meson config_header

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2026-08-02 06:32:19 +02:00
David Senoner ea006188aa elf: remove all deprecated usages and definitions of std.elf.PT_* 2026-07-30 21:23:58 +02:00
Andrew Kelley ae4e835a66 std.lang: rename OptimizeMode to Optimize
and remove "release" from the enum tag names.

no functional change, however, despite the addition of
backwards-compatibile declarations in this patch, it is breaking because
expressions that use `==` or `!=` operators will not able to use the
deprecated names.

I predict these names to survive until the 1.0 tag without any more
breakage.
2026-07-20 17:26:50 -07:00
Ryan Liptak f153140697 Add missed deprecation notice to Compile.Options.win32_manifest
See https://codeberg.org/ziglang/zig/pulls/35999
2026-07-01 19:39:20 -07:00
Ryan Liptak 28e367f446 Build: mark Windows resource compilation stuff as deprecated
In preparation for https://codeberg.org/ziglang/zig/issues/31951
2026-07-01 10:24:02 +02:00
Andrew Kelley 0959167e81 take advantage of std.mem.Allocator.print 2026-06-29 23:50:20 -07: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
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
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 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
Carl Åstholm e636825f01 std.Build.Step.Fmt: dupe lazy path lists 2026-06-11 16:48:13 +02:00
David Senoner 37651eea89 Replace usages of AutoArrayHashMapUnmanaged with array_hash_map.Auto 2026-06-10 16:14:58 +02:00
David Senoner d23e22c416 Replace usages of StringArrayHashMapUnmanaged with array_hash_map.String 2026-06-10 16:14:53 +02:00
Mason Remaley 431092fa61 Adds a compile step option to toggle incremental compilation 2026-06-09 15:35:24 -07:00
Krzysztof Wolicki 9e80795623 all: update to use new std.lang.Type definitions 2026-05-27 10:03:51 +01:00
pentuppup e4512531d5 fix some missed errors from build system rework 2026-05-27 02:18:25 +02:00
Sertonix 8455563ed8 Fix build script compilation when usize is u32
On 32-bit systems usize is not u64 but it was assumed in multiple places
of the build script.

Sometimes using u64 instead of usize since available and used memory can
exceed usize on 32-bit systems (just like totalSystemMemory)

Example errors:

lib/compiler/build_runner.zig:508:26: error: expected type 'usize', found 'u64'
        .available_rss = max_rss,
                         ^~~~~~~
lib/compiler/build_runner.zig:508:26: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
referenced by:
    callMain [inlined]: lib/std/start.zig:699:88
    callMainWithArgs [inlined]: lib/std/start.zig:638:20
    posixCallMainAndExit: lib/std/start.zig:590:38
    2 reference(s) hidden; use '-freference-trace=5' to see all references
lib/std/Build/WebServer.zig:849:38: error: expected type 'usize', found 'u64'
    const buf = gpa.realloc(old_buf, new_len) catch @panic("out of memory");
                                     ^~~~~~~
lib/std/Build/WebServer.zig:849:38: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
lib/std/mem/Allocator.zig:399:58: note: parameter type declared here
pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) Error!@TypeOf(old_mem) {
                                                         ^~~~~
build.zig:548:10: error: type 'usize' cannot represent integer value '9300000000'
        .max_rss = 9_300_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
build.zig:778:10: error: type 'usize' cannot represent integer value '8000000000'
        .max_rss = 8_000_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
2026-05-26 09:43:39 -07:00
Andrew Kelley a9e0eb5340 std.Build.Step.Compile: deprecate out_filename 2026-05-25 19:27:16 -07:00
Andrew Kelley 19c63406d4 LazyPath: store relative paths as actual strings 2026-05-25 18:54:37 -07:00
Andrew Kelley 642d017fea Maker: fix resolveLazyPath accidental mutation 2026-05-25 18:54:36 -07:00
Andrew Kelley 1edc5d7d67 Maker: implement FindProgram (lazy) 2026-05-25 18:54:36 -07:00
Andrew Kelley a874e729df zig build: remove "cc args" from Run steps
Not sure what I was thinking. This is silly, translate-c package simply
needs to pass this data (link_libc and target) to the CLI application,
which can then do the appropriate behavior.
2026-05-25 18:54:36 -07:00
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