Commit Graph

17875 Commits

Author SHA1 Message Date
Matthew Lugg a76ce77108 llvm: fix lowering of x86 fastcall and vectorcall
LLVM requires these calling conventions to specify `inreg` attributes on
all parameters which are passed via register.
2026-05-09 09:35:44 +02:00
Justus Klausecker 6d0b887972 Sema: disallow pointer cast from pointer to opaque type to slice
Fixes a regression where this conversion crashes. When the conversion was
still possible it would produce a slice with a length of zero, which doesn't
really make a lot of sense either. There's no way to determine the length
of the destination slice from a pointer to an opaque type, so it's a compile
error now. Users should just cast to a many-item pointer and slice to the
desired length manually instead.
2026-05-07 06:25:43 +02:00
Matthew Lugg fecd28371d Sema: fix crash bitcasting undefined to bitpack type
Resolves: https://codeberg.org/ziglang/zig/issues/31944
2026-05-07 06:22:47 +02:00
Matthew Lugg fc1c83a363 Air: fix legalization of packed struct init with OPV field
I have verified that this fixes *both* of the reproductions given in
https://codeberg.org/ziglang/zig/issues/31837 (they were the same bug).

Resolves: https://codeberg.org/ziglang/zig/issues/31837
2026-05-07 06:21:59 +02:00
Matthew Lugg 0bcf29aff6 compiler: correct ABI size of comptime-only optional type
Resolves: https://codeberg.org/ziglang/zig/issues/31603
2026-05-07 06:21:30 +02:00
Alex Rønne Petersen e445c0d63e zig cc: always enforce -mabi=ieeelongdouble for powerpc
closes https://codeberg.org/ziglang/zig/issues/30976
2026-05-07 05:32:04 +02:00
Andrew Kelley cd23f7a814 Merge pull request 'std.meta: Remove Int/Tuple in favor of @Int/@Tuple' (#35188) from linus/zig:deprecated-std-meta into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35188
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-06 19:35:40 +02:00
Andrew Kelley 3d56df1716 Merge pull request 'std.fmt, std.mem.Allocator: Remove bufPrintZ()/dupeZ() in favor of bufPrintSentinel()/dupeSentinel()' (#35190) from linus/zig:deprecated-std-fmt-mem into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35190
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-06 19:34:52 +02:00
mlugg 7eb79daffb Merge pull request 'std.builtin -> std.lang migration progress' (#32182) from compiler-std-lang into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32182
2026-05-06 10:10:44 +02:00
johan0A 6a37df00ec Config.resolve: don't error on explicit dynamic linker for Lib/Obj outputs 2026-05-05 17:17:15 +02:00
Linus Groh fcc0a5a913 std.mem.Allocator: Remove dupeZ() in favor of dupeSentinel() 2026-05-03 21:42:16 +01:00
Linus Groh 991f56fd6b std.meta: Remove Int in favor of @Int 2026-05-03 21:42:06 +01:00
linus a794287573 Merge pull request 'std.zig.LibCInstallation: Add support for serenity' (#32172) from linus/zig:more-serenity into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32172
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-05-03 21:04:54 +02:00
Matthew Lugg 4c330e053b compiler: use 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:30 +01:00
Matthew Lugg e133f793ee compiler: depend on 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:29 +01:00
Justus Klausecker 1f22b2cbb2 LowerZon: fix packed containers
Since `packed` containers are now internally represented by a `bitpack`,
they need special handling on initialization: they need to be either
bitpacked or bitcasted to their backing integer. `Sema` already did this,
but `LowerZon` didn't yet.
2026-05-02 20:05:33 +02:00
Linus Groh 89b0c634c1 compiler: Enable PIE by default for serenity
See:
- https://github.com/SerenityOS/serenity/blob/727c4a3d1a6748221b383207dac354e564b6150d/Meta/CMake/serenity_compile_options.cmake#L15
- https://github.com/llvm/llvm-project/blob/62418bee5b9679c5b3bd536fb1101913b1c4e4d5/clang/lib/Driver/ToolChains/Serenity.h#L65
2026-05-02 01:28:22 +01:00
Saurabh Mishra d02d0b879c std:ArrayList: Merge getLastOrNull into getLast (#32008)
This PR merges the functionality of the `getLastOrNull` method into `getLast`, which improves consistency as its
based on methods like `front`, `back`, and `peek` in the `Deque` and `PriorityQueue` containers.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32008
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-02 02:26:15 +02:00
pentuppup 845b6a8efe Zcu: remove optimizeMode(), fix usages 2026-05-01 10:39:43 +02:00
Matthew Lugg 72d954e7d3 compiler: remove array multiplication from the language
Resolves: https://github.com/ziglang/zig/issues/24738
2026-04-30 09:03:58 +01:00
Matthew Lugg fdac89d6cd remove uses of array multiplication
In preparation for its removal as accepted in
https://github.com/ziglang/zig/issues/24738.
2026-04-30 08:57:51 +01:00
Matthew Lugg 57634b7809 compiler: remove i0 from the language
Resolves: https://github.com/ziglang/zig/issues/1593
2026-04-30 08:57:51 +01:00
Matthew Lugg d764716cb5 compiler: remove capturing errdefer from the language
Resolves: https://github.com/ziglang/zig/issues/23734
2026-04-30 08:57:50 +01:00
Matthew Lugg e67c344fc0 compiler,tests,tools: remove uses of capturing errdefer
In preparation for its removal, as accepted in
https://github.com/ziglang/zig/issues/23734.
2026-04-29 23:27:58 +01:00
Matthew Lugg 7b44e8986f Sema: remove void{} from the language
Because this syntax is not heavily used, and the migration can be done
with a simple text substitution, I do not believe a `zig fmt` fixup is
necessary for this change.

Resolves: https://github.com/ziglang/zig/issues/15213
2026-04-29 23:27:58 +01:00
Alex Rønne Petersen 0227253677 compiler: link libtsan with -whole-archive
libtsan contains a .preinit_array entry that must run for correctness.
2026-04-29 13:01:33 +02:00
Alex Rønne Petersen 3906434746 link.Elf: implement .preinit_array support 2026-04-28 16:42:06 +02:00
Alex Rønne Petersen 89ed51bf53 link.Elf, link.Lld: executables should not have an image base on Haiku
Executables are always ET_DYN on Haiku, so like shared libraries, they should
not have an image base set. Elf2 already got this right, but Elf and Lld didn't.

closes https://codeberg.org/ziglang/zig/issues/32100
2026-04-28 09:56:53 +02:00
mihael 764760df62 libzigc/math: Implement rintl, lrintl (#31791)
It's a fairly straightforward port of `musl`'s `rintl`, like `rint` and `rintf` were. `libc-test` tests for `rintl` are uncommented since they're now passing.

I've also covered special cases for `rint` with tests, and broke down the current `rint` and `modf` test declarations into multiple -- so each libc function get its own test declaration at the very least.

Contributes to #30978

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31791
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-27 16:48:55 +02:00
GasInfinity 1deb029a66 std: rename bit_set variants and deprecate the managed one.
* aliases and deprecates the previous names.
* also update callsites to use the non-deprecated declarations.
2026-04-27 16:46:26 +02:00
Alex Rønne Petersen 669c066801 llvm: fix sign extension of 32-bit integers in callconv(.c) on mips 2026-04-27 09:42:08 +02:00
Alex Rønne Petersen 9f2f6aaef5 drop support for powerpc64-linux-gnu
glibc has never officially supported ELFv2 on big-endian PowerPC, and we do not
(and likely never will) support linking ELFv1. So just drop this target instead
of pretending we actually have anything resembling usable support for it. This
is a dying target anyway; IBM have been pushing people to powerpc64le for years
now, and most distros have dropped big endian.

glibc headers and abilists are not updated as part of this; I'll just let that
happen automatically on the next glibc update. Size savings are expected to be
very minimal anyway since there's large overlap between powerpc64 and
powerpc64le.

This commit also fixes a couple of bad assumptions in std.Target:

* The dynamic linker path should be /lib64/ld64.so.1. We should get this right
  even if the Zig compiler doesn't support the target.
* cCallingConvention() was picking powerpc64_elf_v2 only for musl targets. In
  reality, for the targets we support in std.Target, it should pick v2 for all
  except powerpc64-linux-gnu.

Finally, this switches LLVM codegen to use ELFv2 data layout for all targets
except ps3.
2026-04-26 19:24:46 +02:00
Alex Rønne Petersen a83aad152b Merge pull request 'LLVM 22' (#32013) from llvm22 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32013
2026-04-26 07:03:38 +02:00
Alex Rønne Petersen 1be84a39b8 compiler: fix and simplify DllMainCRTStartup handling
See: https://github.com/llvm/llvm-project/pull/171680
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen a8e624d7f1 compiler: let LLVM set the 64bit feature from the target triple on powerpc targets 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen bb7a43490f compiler: let LLVM set the x32 feature from the target triple on x86 targets 2026-04-25 21:54:47 +02:00
Alex Rønne Petersen 4c50c4b6e5 llvm: wire up the xtensa backend
As of LLVM 22, it can produce assembly and object files. No LLD support,
however, so using it is still a bit of a pain.
2026-04-25 21:54:47 +02:00
Alex Rønne Petersen 473df0c106 llvm: switch to wasip<n> for preview wasi versions in triples 2026-04-25 21:54:47 +02:00
Alex Rønne Petersen 593f45ee02 llvm: switch most targets to using half and fp128 IR types
As of LLVM 22, most backends can (finally) handle legalization of these types as
necessary, so we don't need to do it ourselves anymore.

closes https://github.com/ziglang/zig/issues/23674
2026-04-25 21:54:47 +02:00
Alex Rønne Petersen 421d997938 llvm: update data layout strings to LLVM 22 2026-04-25 21:54:47 +02:00
Alex Rønne Petersen 9aaebf67d2 zig cc: update options data to LLVM 22 2026-04-25 21:54:47 +02:00
Alex Rønne Petersen ca0b3318a0 std.Target: update CPU and feature data to LLVM 22 2026-04-25 21:54:47 +02:00
Alex Rønne Petersen dfabf1586f libcxx: update to LLVM 22 2026-04-25 21:49:39 +02:00
Alex Rønne Petersen 1180711035 zig cc: update driver files to LLVM 22 2026-04-25 21:49:39 +02:00
Alex Rønne Petersen 54573e3542 compiler: fix LLVM ABI selection for loongarch32-linux-musl* 2026-04-25 21:49:39 +02:00
Alex Rønne Petersen 47848ba3d6 zig cc: define __CRT__NO_INLINE for MinGW-w64 targets
See added comment for why.
2026-04-25 21:49:38 +02:00
Matthew Lugg 0a9c4008fd Compilation: fix writeDepFile with no file system inputs 2026-04-25 21:49:38 +02:00
Matthew Lugg a8c74e0565 Compilation: add link objects to file system inputs 2026-04-25 21:49:38 +02:00
Matthew Lugg 9ba89394df compiler: raise FD limit before opening link inputs 2026-04-25 21:49:38 +02:00
Jacob Young 2040f9bfd0 x86_64: fix c abi of f32 struct field followed by padding
Closes #31864
2026-04-25 12:10:35 -04:00