558 Commits

Author SHA1 Message Date
Alex Rønne Petersen
9352f379e8
Merge pull request #23529 from alexrp/2879-groundwork
Introduce libzigc for libc function implementations in Zig
2025-04-12 18:14:17 +02:00
Andrew Kelley
4e700fdf8e
Merge pull request #22516 from Jan200101/PR/build_id_option
std.Build: add build-id option
2025-04-11 16:37:46 -04:00
Alex Rønne Petersen
1f896c1bf8
Introduce libzigc for libc function implementations in Zig.
This lays the groundwork for #2879. This library will be built and linked when a
static libc is going to be linked into the compilation. Currently, that means
musl, wasi-libc, and MinGW-w64. As a demonstration, this commit removes the musl
C code for a few string functions and implements them in libzigc. This means
that those libzigc functions are now load-bearing for musl and wasi-libc.

Note that if a function has an implementation in compiler-rt already, libzigc
should not implement it. Instead, as we recently did for memcpy/memmove, we
should delete the libc copy and rely on the compiler-rt implementation.

I repurposed the existing "universal libc" code to do this. That code hadn't
seen development beyond basic string functions in years, and was only usable-ish
on freestanding. I think that if we want to seriously pursue the idea of Zig
providing a freestanding libc, we should do so only after defining clear goals
(and non-goals) for it. See also #22240 for a similar case.
2025-04-11 17:12:31 +02:00
Alex Rønne Petersen
1bfc71d4da build: Set LLVM_BUILD_STATIC/CLANG_BUILD_STATIC when linking statically.
This is needed since LLVM 20, particularly for Windows.
2025-04-09 10:11:52 +02:00
Alex Rønne Petersen
f2f36c49c8 compiler: Switch default code model for loongarch64 to medium.
LLVM 21 will change the default, but we're making the change now to make
building Zig for loongarch64 less painful.

https://github.com/llvm/llvm-project/pull/132173
2025-04-07 21:36:56 +02:00
Alex Rønne Petersen
7c5412c7a4
build: Rename -Dtest-slow-targets to -Dtest-extra-targets.
This can be used more broadly for targets that aren't quite ready to be tested
by default yet.
2025-04-04 06:08:10 +02:00
Alex Rønne Petersen
c712f18d74
build: Update to LLVM/Clang 20. 2025-04-04 06:08:08 +02:00
Alex Rønne Petersen
2b57f6b717
Merge pull request #23378 from alexrp/build-zig-cleanup 2025-03-27 17:12:17 +01:00
Alex Rønne Petersen
dc66f4384f
build: increase test-std max rss 2025-03-27 04:36:27 +00:00
Alex Rønne Petersen
f71590d4c4
build.zig: Statically link LLVM libraries for experimental targets if requested. 2025-03-27 00:31:11 +01:00
Alex Rønne Petersen
2489b5fd74
build.zig: Stop setting _WIN32_WINNT=0x601 (Windows 7) when targeting MinGW.
Our default minimum version for Windows has been Windows 10 for a while.
2025-03-26 23:12:55 +01:00
Alex Rønne Petersen
ccffc7f108
build.zig: Don't disable LTO when targeting MinGW.
We stopped building mingw32.lib with LTO recently, so this is no longer needed.
2025-03-26 22:46:27 +01:00
Andrew Kelley
1eb729b9b9 Reapply "build: Don't check parent directories for git tag"
This reverts commit 7e0c25eccd8d9bc5b77953dbc9a39a26e383c550.

The `--git-dir` argument is relative to the `-C` argument, making this
patch OK after all.

I added a comment to go along with this since I found it confusing.

Apologies for the revert.
2025-03-08 12:34:13 -08:00
Andrew Kelley
7e0c25eccd Revert "build: Don't check parent directories for git tag"
This reverts commit 21620f3c652bc874776acc7251f05b25d2838019.

This breaks running `zig build` from subdirectories.
2025-03-08 11:15:44 -08:00
LN Liberda
21620f3c65 build: Don't check parent directories for git tag
Sometimes Zig is built not from a git repository (e.g. from tarball), but inside another git repository (e.g. distro package repository). Make sure that the version check tries to parse a tag of Zig, and not of a parent directory.
2025-03-08 17:54:50 +00:00
Jan200101
013a228960 std.Build: add build-id option 2025-03-07 10:59:02 +01:00
Andrew Kelley
05937b362a start the 0.15.0 release cycle 2025-03-04 14:31:32 -08:00
Alex Rønne Petersen
481b7bf3f0
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:

* It's not immediately obvious to a reader whether target.isDarwin() means the
  same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
  functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
  this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
  Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.
2025-02-17 19:18:19 +01:00
Andrew Kelley
ea1ce2df9b
Merge pull request #22808 from ziglang/fast-gpa
introduce std.heap.SmpAllocator
2025-02-08 04:54:38 -08:00
Andrew Kelley
8453fb09a2 build: bump max_rss of std lib tests to 5G 2025-02-07 23:35:31 -08:00
Andrew Kelley
7360be19a4 compiler: use std.heap.smp_allocator
In main, now this allocator is chosen by default when compiling without
libc in ReleaseFast or ReleaseSmall, and not targeting WebAssembly.
2025-02-07 14:41:49 -08:00
Jacob Young
fa9b0fa6d3 x86_64: rewrite most of the remaining float ops 2025-02-06 16:14:53 -05:00
Matthew Lugg
317722b37b
Merge pull request #20271 from MasonRemaley/zon
ZON
2025-02-03 16:38:35 +00:00
Alex Rønne Petersen
e61acd8eb5
Merge pull request #22713 from mikdusan/openbsd
openbsd: fix stage3 link
2025-02-03 17:34:55 +01:00
Mason Remaley
13c6eb0d71
compiler,std: implement ZON support
This commit allows using ZON (Zig Object Notation) in a few ways.

* `@import` can be used to load ZON at comptime and convert it to a
  normal Zig value. In this case, `@import` must have a result type.
* `std.zon.parse` can be used to parse ZON at runtime, akin to the
  parsing logic in `std.json`.
* `std.zon.stringify` can be used to convert arbitrary data structures
  to ZON at runtime, again akin to `std.json`.
2025-02-03 09:14:37 +00:00
Michael Dusan
127b0921ba
openbsd: fix stage3 link
- llvm requires libexecinfo which has conflicting symbols with libc++abi
- workaround is to link c++abi dynamically
2025-02-01 12:16:21 -05:00
Jacob Young
4c5abe5ac6 x86_64: rewrite vector @intCast 2025-01-31 23:09:58 -05:00
Alex Rønne Petersen
015a5e1982 std.Build: Make ofmt part of standardTargetOptions(). 2025-01-25 20:39:10 +01:00
Alex Rønne Petersen
35e804bfb8
wasm2c: Implement nontrapping_fptoint support. 2025-01-22 20:56:30 +01:00
Alex Rønne Petersen
ea1502974d
wasm: Add a nontrapping_bulk_memory_len0 feature.
This will mainly be used when targeting our wasm2c implementation which has no
problem with zero-length bulk memory operations, as a non-standard extension.
2025-01-22 20:56:28 +01:00
Alex Rønne Petersen
280ced66eb
std.Target: Define and use lime1 as the baseline CPU model for WebAssembly.
See: https://github.com/WebAssembly/tool-conventions/pull/235

This is not *quite* using the same features as the spec'd lime1 model because
LLVM 19 doesn't have the level of feature granularity that we need for that.
This will be fixed once we upgrade to LLVM 20.

Part of #21818.
2025-01-22 03:01:05 +01:00
mlugg
b6abe1dbf7
compiler: make it easier to apply breaking changes to std.builtin
Documentation for this will be on the wiki shortly.

Resolves: #21842
2025-01-16 12:49:48 +00:00
Andrew Kelley
1afa6e260e build: respect -Duse-llvm option when doing behavior tests 2025-01-15 15:11:36 -08:00
Andrew Kelley
b36ea592b8 build.zig: make unit tests not use the full matrix 2025-01-10 06:03:57 -05:00
mlugg
6a837e64cf
compiler: bump stack size 32 MiB -> 46 MiB
Before the prior commit, the maximum comptime recursion depth on my
system was 4062. After the prior commit, it decreased to 2854. This
commit increases the compiler's stack size enough so that the recursion
depth limit is no less than it was before the `Sema.analyzeCall`
rewrite, preventing this from being a breaking change. Specifically,
this stack size increases my observed maximum comptime recursion depth
to 4105.
2025-01-10 05:41:21 +00:00
mlugg
93af1de050
build.zig: migrate from deprecated std.Build APIs 2024-12-18 01:48:55 +05:00
Carl Åstholm
b352595aa2 Add compiler internals tests
There are several test decls inside `/src` that are not currently being
tested and have bitrotted as a result. This commit revives those tests
and adds the `test-compiler-internals` set of tests which tests
everything reachable from `/src/main.zig`.
2024-12-13 08:49:02 -05:00
Alex Rønne Petersen
1f95e3d9cd build.zig: Also set code model for loongarch32.
This issue applies to both loongarch32 and loongarch64.
2024-12-07 22:21:35 +01:00
Justin Braben
07cd488d42
Add build option to set tracy-callstack-depth in build.zig (#21990) 2024-11-29 12:13:06 -08:00
Alex Rønne Petersen
9d10246a80
test: Enable -Dtest-target-filter=... to work for test-debugger. 2024-11-24 22:11:17 +01:00
Alex Rønne Petersen
2a29381117
test: Enable -Dtest-target-filter=... to work for test-cases and test-translate-c. 2024-11-24 22:11:17 +01:00
Alex Rønne Petersen
9c7776a938
test: Enable -Dtest-target-filter=... to work for test-c-abi. 2024-11-24 22:11:17 +01:00
Jacob Young
41282e7fb2 build.zig: fix libc++ being a linker script 2024-11-17 00:55:36 -05:00
kcbanner
f2b81f57f4 build: increase max_rss to 7.8G 2024-11-05 10:03:04 -08:00
Krzysztof Wolicki
008acd0547
Replace tidy with superhtml as HTML validator (#21664)
Also add `$HOME/local/bin` to `PATH` in linux CI
2024-10-11 21:27:30 -07:00
mlugg
f60c045cef
tests: add test-incremental step
This is contained in the `test` step, so is tested by CI.

This commit also includes some enhancements to the `incr-check` tool to
make this work correctly.
2024-10-05 20:52:25 +01:00
Andrew Kelley
a3a8a266ef add missing clang and llvm library listings 2024-09-19 18:20:21 -07:00
YANG Xudong
c34cfe486d
loongarch: use medium code model for zig loongarch64 binary (#21153) 2024-08-31 20:59:24 -07:00
Jacob Young
ef11bc9899 Dwarf: rework self-hosted debug info from scratch
This is in preparation for incremental and actually being able to debug
executables built by the x86_64 backend.
2024-08-16 15:22:55 -04:00
Alex Rønne Petersen
927bc55629
build/test: Add a test-modules step for running all the per-target tests.
This is useful during porting work where you're mainly concerned with tests that
e.g. run under QEMU. Combine with the new -Dtest-target-filter for an even more
streamlined workflow.
2024-08-14 07:03:23 +02:00