24 Commits

Author SHA1 Message Date
Andrew Kelley dea6914aaa bootstrap.c: fix zig2 version
This should have been part of the "start the release cycle" commit.
2026-04-19 11:25:59 -07:00
fardragon 4acecad933 bootstrap.c: work around the gcc sra miscomp using preprocessor checks rather than CLI arg (#31589)
Closes #31577
I've also extended the "good" ranges to fit versions >14.3 and >13.4, since both of these branches have the fix merged so if they ever make a dot release it should be good.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31589
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: fardragon <michaldrozd@protonmail.ch>
Co-committed-by: fardragon <michaldrozd@protonmail.ch>
2026-03-20 04:55:51 +01:00
Matthew Lugg 58d33f51ce bootstrap.c: correct comment 2026-03-12 12:22:24 +00:00
Matthew Lugg 79e7b719a3 bootstrap: disable strict aliasing
The C backend has always gleefully violated C's strict aliasing rules,
and I just got bitten by it for the first time when bootstrapping on
macOS. This probably hasn't been helping with some of the weird
bootstrap-related CI failures we've seen. So, update `bootstrap.c` and
`CMakeLists.txt` to tell GCC/Clang to disable type-based alias analysis.

No change is needed to the MSVC flags because MSVC does not, and never
has, implemented TBAA.
2026-03-10 11:28:36 +00:00
Matthew Lugg a5219cd288 bootstrap: work around GCC bug
GCC bug 119085, which affects versions 13.0--15.1, is being triggered by
the C backend, resulting in a (small but critical) miscompilation in
zig2. Unfortunately, we can't really work around that bug without a
command-line flag, because the bug is sensitive to things like the order
in which `struct` types are defined.

Therefore, I have added an option to `bootstrap.c` which causes it to
pass the appropriate flag to `gcc` to disable the optimization pass in
question. This flag can likely be removed in future, once the affected
GCC versions become less common.

At least one of our x86_64-linux CI machines is using an affected GCC
version, so I also updated the relevant CI script to pass this flag when
testing no-LLVM bootstrap.

CMakeLists also has a workaround, but no user intervention is required
there: the GCC version range is automatically detected by CMakeLists.
2026-03-10 10:26:15 +00:00
Jacob Young a28d57292f IoUring: update to new Io APIs 2026-02-09 10:47:21 -05:00
Michael Neumann 19703a5db9 bootstrap: Add support for DragonFly 2025-09-27 10:00:36 +02: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
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 6294e65eeb compiler_rt does not need a build_options module 2024-09-19 18:20:22 -07:00
Andrew Kelley 80269c1f53 remove deprecated --mod CLI now that a zig1.wasm update happened 2024-07-26 05:07:18 -07:00
Andrew Kelley 956ba8f61c bootstrap.c: update version 2024-07-21 18:32:37 -07:00
Jacob Young 4f742c4cfc dev: introduce dev environments that enable compiler feature sets 2024-07-19 22:35:33 -07:00
Jacob Young 2dd74cd312 haiku: debitrot 2024-03-23 18:11:32 +01:00
Jacob Young b60fc16b4f compiler: audit debug mode checks
* Introduce `-Ddebug-extensions` for enabling compiler debug helpers
 * Replace safety mode checks with `std.debug.runtime_safety`
 * Replace debugger helper checks with `!builtin.strip_debug_info`

Sometimes, you just have to debug optimized compilers...
2024-03-01 17:42:54 -08:00
Andrew Kelley 240d0b68f6 make aro-based translate-c lazily built from source
Part of #19063.

Primarily, this moves Aro from deps/ to lib/compiler/ so that it can be
lazily compiled from source. src/aro_translate_c.zig is moved to
lib/compiler/aro_translate_c.zig and some of Zig CLI logic moved to a
main() function there.

aro_translate_c.zig becomes the "common" import for clang-based
translate-c.

Not all of the compiler was able to be detangled from Aro, however, so
it still, for now, remains being compiled with the main compiler
sources due to the clang-based translate-c depending on it. Once
aro-based translate-c achieves feature parity with the clang-based
translate-c implementation, the clang-based one can be removed from Zig.

Aro made it unnecessarily difficult to depend on with these .def files
and all these Zig module requirements. I looked at the .def files and
made these observations:

- The canonical source is llvm .def files.
- Therefore there is an update process to sync with llvm that involves
  regenerating the .def files in Aro.
- Therefore you might as well just regenerate the .zig files directly
  and check those into Aro.
- Also with a small amount of tinkering, the file size on disk of these
  generated .zig files can be made many times smaller, without
  compromising type safety in the usage of the data.

This would make things much easier on Zig as downstream project,
particularly we could remove those pesky stubs when bootstrapping.

I have gone ahead with these changes since they unblock me and I will
have a chat with Vexu to see what he thinks.
2024-02-28 13:21:05 -07:00
Jacob Young 5b803aecfb bootstrap.c: allow overriding the host triple 2024-02-03 22:34:59 -05:00
Andrew Kelley 8cf2cfc52c update bootstrap scripts to new zig CLI
Now they use the new --mod --dep parameters.
2024-01-01 17:51:21 -07:00
Lateef Jackson f36ac227b1 Add FreeBSD to bootstrap.c to make building from source easier in FreeBSD 14 2023-12-19 12:55:52 -08:00
Veikka Tuominen acebf05be9 aro-translate-c: update to upstream changes 2023-11-17 09:01:25 +02:00
Andrew Kelley f8b38a174f adjust building from source without LLVM process
The idea here is that the zig2 executable is perhaps the more useful
deliverable until we implement our own optimization passes. This will
allow system packages to provide Zig, and use it to compile Zig
projects, all without LLVM!
2023-11-14 02:17:51 -05:00
Andrew Kelley 557cb64691 bootstrap.c: add -pthread if the compiler is gnu
otherwise we get undefined symbol errors on pthread stuff
2023-11-12 17:30:24 -07:00
Andrew Kelley 3c921522b5 bootstrap.c: update aro module 2023-11-12 17:30:24 -07:00
Andrew Kelley 621e89a863 add bootstrap.c for building from source without LLVM
When a zig compiler without LLVM extensions is satisfactory, this
greatly simplified build-from-source process can be used.

This could be useful for users who only want to contribute to the
standard library, for example.
2023-11-12 17:30:24 -07:00