Commit graph

17331 commits

Author SHA1 Message Date
Andrew Kelley
d40803284e progress towards compiler building again 2025-10-29 06:20:49 -07:00
Andrew Kelley
066864a0bf std.zig.system: upgrade to std.Io.Reader 2025-10-29 06:20:48 -07:00
Alex Rønne Petersen
b409cdf63f
Elf2: set ELFOSABI_OPENBSD for openbsd 2025-10-29 07:48:42 +01:00
Alex Rønne Petersen
49b5b4b249
Elf2: set ELFOSABI_FREEBSD for ps4 2025-10-29 07:48:29 +01:00
Matthew Lugg
8907dc8a4f Zcu: use shortest reference trace
The logic for computing reference traces was unintentionally finding the
*longest* possible trace (approximately). I think I already tried to fix
this before, but misunderstood how my own code works. Here, we fix it
properly: by slightly reworking the logic to use one ArrayHashMap for
both the result and the traversal queue, we trivially get a proper
breadth-first traversal so that we can find the shortest possible
reference trace for every referenced unit.
2025-10-29 05:34:19 +00:00
Cooksey99
2cbd0d3f08 spirv: fix airWorkGroupSize to use workgroup_size builtin 2025-10-28 10:23:32 +01:00
Alex Rønne Petersen
06d9e3bc06
Merge pull request #25691 from GasInfinity-Forks/x86_16-gcc
feat: init x86_16 arch via CBE
2025-10-28 10:19:21 +01:00
Alex Rønne Petersen
dba1bf9353 remove all Oracle Solaris support
There is no straightforward way for the Zig team to access the Solaris system
headers; to do this, one has to create an Oracle account, accept their EULA to
download the installer ISO, and finally install it on a machine or VM. We do not
have to jump through hoops like this for any other OS that we support, and no
one on the team has expressed willingness to do it.

As a result, we cannot audit any Solaris contributions to std.c or other
similarly sensitive parts of the standard library. The best we would be able to
do is assume that Solaris and illumos are 100% compatible with no way to verify
that assumption. But at that point, the solaris and illumos OS tags would be
functionally identical anyway.

For Solaris especially, any contributions that involve APIs introduced after the
OS was made closed-source would also be inherently more risky than equivalent
contributions for other proprietary OSs due to the case of Google LLC v. Oracle
America, Inc., wherein Oracle clearly demonstrated its willingness to pursue
legal action against entities that merely copy API declarations.

Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in
maintenance mode since, presumably to be retired completely sometime in the 2030s.

For these reasons, this commit removes all Oracle Solaris support.

Anyone who still wishes to use Zig on Solaris can try their luck by simply using
illumos instead of solaris in target triples - chances are it'll work. But there
will be no effort from the Zig team to support this use case; we recommend that
people move to illumos instead.
2025-10-27 07:35:38 -07:00
GasInfinity
104c272ae5
feat: init x86_16 arch via CBE 2025-10-27 11:19:51 +01:00
Alex Rønne Petersen
67c9d57e27
Compilation: define __illumos__ for C/C++ when targeting illumos
Per the illumos GCC fork.
2025-10-26 09:51:35 +01:00
Alex Rønne Petersen
433846100b
Merge pull request #25700 from alexrp/solaris-illumos-stuff
Some Solaris/illumos fixes
2025-10-26 00:59:33 +02:00
Alex Rønne Petersen
e39b82bf4e
compiler: avoid using self-hosted backend on x86_64-solaris/illumos
https://github.com/ziglang/zig/issues/25699
2025-10-25 12:44:13 +02:00
Alex Rønne Petersen
bebfdc3661 llvm: remove some workarounds in loadTruncate()
No longer needed with LLVM 21.
2025-10-25 04:52:46 +02:00
Alex Rønne Petersen
70206af482
Merge pull request #25640 from alexrp/std-target-more-arches
`std.Target`: add tags and info for alpha, hppa, microblaze, sh + some bonus commits
2025-10-23 19:35:54 +02:00
Alex Rønne Petersen
340d6ce1bf
std.builtin: move AddressSpace.Context to std.Target.AddressSpaceContext
This type has nothing to do with the language.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
af1d777b27
std.builtin: add CallingConvention.sh_interrupt
Only supported in CBE.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
4fa453ce20
std.builtin: add CallingConvention.microblaze_interrupt
Only supported in CBE.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
abf40caeb7
std.builtin: add CallingConvention.msp430_interrupt
Supported by LLVM and CBE.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
beb507a1ed
std.builtin: add CallingConvention.x86_64_x32
This was forgotten during the refactoring of std.builtin.CallingConvention. It
mirrors mips64_n32 for MIPS.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
ee72f06f47
std.Target: add tags and info for alpha, hppa, microblaze, sh 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
3e2daa509a
std.Target: add arceb and xtensaeb Cpu.Arch tags 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
cd56b06352
Zcu: simplify atomicPtrAlignment()
The value being computed here is almost always equal to the pointer bit width.
2025-10-23 09:27:16 +02:00
jonascloud
e5fcc8192d spir-v: Fix .storage_buffer pointer indexing
Renames arePointersLogical to shouldBlockPointerOps for clarity
adds capability check to allow pointer ops on .storage_buffer when
variable_pointers capability is enabled.

Fixes #25638
2025-10-23 03:21:15 +02:00
Alex Rønne Petersen
dbf9c7b548 compiler: add support for arc_interrupt calling convention
Only for use with the C backend at the moment.
2025-10-19 22:27:19 +02:00
Alex Rønne Petersen
031b0d6063 glibc: change library link order to prefer libc.so symbols
Also avoid resolving symbols in libraries that were later removed if possible.

closes #24347
2025-10-19 11:50:32 +02:00
Alex Rønne Petersen
38caa4902f
Merge pull request #25623 from alexrp/or1k
Add `or1k-linux` support (via CBE)
2025-10-19 11:50:06 +02:00
Bingwu Zhang
6de339d5d3 cbe: fix MIPS register names in inline assembly
Zig uses "rN" for MIPS register clobbers which are more
ergonomic and easier to write (.rN vs. .@"$N").
However, GCC and Clang uses "$N".

Bug: #25613
Signed-off-by: Bingwu Zhang <xtex@xtexx.eu.org>
2025-10-19 01:07:51 +02:00
Alex Rønne Petersen
489ce7f44e
Sema: or1k_sysv calling convention supports varargs 2025-10-18 22:26:52 +02:00
Alex Rønne Petersen
f3da54f53c std.Target: move Cpu.supportsAddressSpace() up to here
This allows us to rule out support for certain address spaces based on the OS.
This commit is just a refactor, however, and doesn't actually make use of that
opportunity yet.
2025-10-18 11:13:28 +02:00
xdBronch
f785e4745d detect invalid @bitCast with arrays 2025-10-16 19:36:11 +01:00
bnuuydev
173f497e29 llvm-backend: fix uefi data layout
the old logic caused the uefi case to fall through which caused an
assertion assertion in llvm to fail, as the data layout was wrong.
2025-10-16 13:59:02 +02:00
Jacob Young
958faa7031 windows: workaround kernel race condition the most 2025-10-12 13:55:57 -04:00
Jacob Young
95242cc431 windows: workaround kernel race condition even more 2025-10-11 12:17:39 -04:00
Jacob Young
8efcfeaf1e windows: workaround kernel race condition better
Until I can do more testing, we bump the numbers until morale improves.
2025-10-11 10:01:17 -04:00
Jacob Young
2e31077fe0 Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
Jacob Young
b2bc6073c8 windows: workaround kernel race condition
This was causing flaky CI failures.
2025-10-10 22:47:36 -07:00
Andrew Kelley
c17e18647b
Merge pull request #25495 from kcbanner/fixup_translate_c
Add error bundle support to `translate-c`, unify `cmdTranslateC` and `cImport`
2025-10-10 21:07:20 -07:00
mlugg
45143c6f04 MachO: emit absolute path in N_OSO stabs
This path being relative is unconventional and causes issues for us
if the output artifact is ever used from a different cwd than the one it
was built from. The behavior implemented by this commit of always
emitting these paths as absolute was actually the behavior in 0.14.x,
but it regressed in 0.15.1 due to internal reworks to path handling
which led to relative paths being more common in the compiler internals.

Resolves: #25433
2025-10-10 20:33:30 +01:00
kcbanner
ed6d9e2a9d - Output error messages for fatal translate-c errors 2025-10-09 19:08:16 -04:00
kcbanner
2ce10e0838 - aroDiagnosticsToErrorBundle: fixup not clearing notes after flushing the current error
- Compilation: renameTmpIntoCache doesn't need to be pub after the `translateC` change
2025-10-09 13:34:25 -04:00
kcbanner
8b6cdc3d82 - Rework common translate-c and cImport logic into Compilation.translateC
- Add std.zig.Server.allocErrorBundle, replace duplicates
2025-10-09 01:06:09 -04:00
kcbanner
478cb9ce6a - aro: fixup toErrorBundle not emitting the last error if it was followed by .off or .warning
- translate-c: emit `file_system_inputs` even in the case of failure, if available
- translate-c: fixup emitting zero-length `file_system_inputs`
2025-10-09 01:06:09 -04:00
kcbanner
4aa4d80ec6 - Rework translate-c to integrate with the build system (by outputing error bundles on stdout) via --zig-integration
- Revive some of the removed cache integration logic in `cmdTranslateC` now that `translate-c` can return error bundles
- Fixup inconsistent path separators (on Windows) when building the aro include path
- Move some error bundle logic from resinator into aro.Diagnostics
- Add `ErrorBundle.addRootErrorMessageWithNotes` (extracted from resinator)
2025-10-09 01:06:09 -04:00
Andrew Kelley
889942a8b7 std: fix sendFileReading not accounting for buffer
Related to 1d764c1fdf

Test case provided by:

Co-authored-by: Kendall Condon <goon.pri.low@gmail.com>
2025-10-08 16:45:38 -07:00
xdBronch
60be67d3c0 don't make OPV tuple fields comptime 2025-10-08 18:04:25 +01:00
xdBronch
2c0aa1c6f5 don't make anonymous tuple fields referencing comptime vars comptime 2025-10-07 22:13:10 +01:00
Jacob Young
d28006153e llvm.Builder: allow Metadata to reference metadata strings
Closes #25486
2025-10-07 07:49:54 -04:00
xdBronch
2810e4b173 detect references to comptime var in default values and sentinels 2025-10-07 11:58:12 +01:00
Andrew Kelley
6893e7feee
Merge pull request #25414 from squeek502/mingw-def-implib
Support generating import libraries from mingw .def files without LLVM
2025-10-06 13:38:07 -07:00
xdBronch
851ae9bb43 don't pass zero-length @memset to the backend 2025-10-06 11:28:56 -07:00