0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
Commit graph

16,129 commits

Author SHA1 Message Date
mlugg
7b02ab7588 Merge pull request 'Elf2: many enhancements' (#36528) from mlugg/elf2-again into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36528
2026-08-17 10:23:45 +02:00
Alex Rønne Petersen
99e540dc39 Merge pull request 'std.zig.system.x86: deal with lying hypervisors' (#36527) from alexrp/zig:x86-cpu-detect-nonsense into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36527
2026-08-16 12:14:17 +02:00
Alex Rønne Petersen
77bb7adc5c std.Target: require libc for emscripten
closes https://codeberg.org/ziglang/zig/issues/36498
2026-08-16 12:11:36 +02:00
Matthew Lugg
29bcd2d543
std.posix.test: fix dl_iterate_phdr test
The old test was relying on the following properties:

* There is a segment containing the ehdr, i.e. whose file offset is 0

* That segment is the first phdr with type `PT_LOAD`; because `PT_LOAD`
  segments are sorted on `p_vaddr`, this means its virtual address is
  the lowest of all loadable segments

The first assumption, although not standard, is somewhat reasonable, and
the commit prior to this one makes `Elf2` obey it. However, the second
assumption is not based on anything, and to my knowledge the linker is
entirely welcome to lay out the virtual address space as it sees fit.
Therefore, refactor this test to eliminate that bad assumption.
2026-08-16 10:37:20 +01:00
Alex Rønne Petersen
4f15073e4f
std.elf: update hash structures for the 64-bit variant 2026-08-16 10:37:20 +01:00
Alex Rønne Petersen
45ad4aab95
std.os.linux: Elf_Symndx is u64 on alpha like s390x 2026-08-16 10:37:20 +01:00
Matthew Lugg
c7a169280d
std.elf: add definitions for SHT_HASH header and hash function 2026-08-16 09:30:30 +01:00
Alex Rønne Petersen
5ee0c64223
std.zig.system.x86: deal with lying hypervisors
closes https://codeberg.org/ziglang/zig/issues/36515
2026-08-16 07:25:03 +02:00
Alex Rønne Petersen
18c87599b1
std.zig.system.x86: simplify detectIntelProcessor() code a bit
mutable state begone
2026-08-16 07:15:19 +02:00
Richalsu
f506a49142 std.Io: add error.ConnectionTimedOut for net read/write/send/receive 2026-08-15 10:46:35 +02:00
Lukas Lalinsky
4987b62a90 Fix two bugs in RwLock
Bug 1: `tryLock` can acquire a lock while another reader still holds
shared access to the lock. This one if fairly easy to reproduce, so the
test always catches it.

Bug 2: Cancelled writer can leave a stale semaphore permit, essentially
leaving the lock in an unusable state. This one is hard to reproduce
deterministically, the test catches it most of the time, but not always.

Let me know if you are OK with probabilistic tests like this, or I
should remove them.

Fixes https://codeberg.org/ziglang/zig/issues/36217
Fixes https://codeberg.org/ziglang/zig/issues/36178
2026-08-15 10:34:54 +02:00
Ben Burkert
434c9fe4d7 asn1: replace use of deprecated lang.Type.Enum API
The API for std.lang.Type changed in PR #35234, but the ASN.1 tag
encoder is using the old API. Update the check for an exhaustive enum
for the new API, and add a test that exercises this prong of the
encoder.
2026-08-15 06:19:09 +02:00
Matthew Lugg
ff24d73096
Maker: fix hidden merge conflict
There was a silent merge conflict in
https://codeberg.org/ziglang/zig/pulls/36454 leading to build failures
in Maker.

Fixes: 5d7cf3f34d
2026-08-14 12:09:38 +01:00
pentuppup
e78dfccb56 Maker: restore error message when combining --watch and --webui 2026-08-14 12:46:38 +02:00
Andrew Kelley
5d7cf3f34d zig build: revert package related changes to Configuration
partial revert of 8e48a5c524
partial revert of 8380531aec

fixes regression in the build system causing crash when trying to build
ffmpeg project from the ecosystem.

upon closer inspection, I don't think this is the right direction for
adding this data to Configuration. Let's try again and be a little more
careful about it.
2026-08-14 12:40:19 +02:00
Ryan Liptak
e61d804142 flate.Decompress: Fix potential infinite loop when using limits
Previously, the code relied on being able to write an entire match at once. When combined with limited streaming, this could result in an infinite loop with e.g. streamExact.

The fix here is to support writing partial matches up to the limit, and then continue writing the rest of the match on the next stream.

Fixes https://github.com/ziglang/zig/issues/25032
2026-08-14 12:26:14 +02:00
Andrew Kelley
e0f7e43a54 build system: rework user input options
followups from 8e48a5c524 along with
other related changes.

- user input options should not be serialized into Configuration.
- more helpful log messages when invalid -D arguments are provided
- use array hash maps in various places, simplifying iteration and
  sorting.
- when creating a package instance, sort the user input options once,
  before the lookup, rather than creating a fresh hash map and sorting
  it on every call to hash (wtf!)
  - when sorting, don't use ascii case insensitivity (wtf!!)
- simplify the detection of invalid arguments passed to zig build
- use package hash rather than file system path in package instance key
2026-08-13 23:40:03 -07:00
Andrew Kelley
896945d8dd std.Build.Serialize: better array awareness 2026-08-13 23:40:03 -07:00
Andrew Kelley
396ddd4443 std.Build.Serialize: use block to limit var scope 2026-08-13 23:40:03 -07:00
Andrew Kelley
e82505d5dc std.Build.Configuration: rename PackageInstance to Package.Instance 2026-08-13 23:40:03 -07:00
Andrew Kelley
bc1f280a77 Maker: fix watching on macos and bsds 2026-08-13 16:34:30 -07:00
Andrew Kelley
99bfd07854 Maker: deinit Watch when exiting scope
this wasn't really needed before but now it's pretty important since
configuration needs to be rerun sometimes
2026-08-13 11:32:46 +02:00
Andrew Kelley
470f77600d Maker: detect modifications to configurer and recompile it
including when using `--watch`.

This is done by adding an extra auto-generated placeholder Step at the
end of `Maker.steps` that contains the file system inputs for the
configurer. It is done this way so that the hot path of file system
watching does not need to make any special cases, and to avoid more
OS-specific logic in file system watching implementation.

closes #20602
closes #35460
2026-08-13 11:32:46 +02:00
Andrew Kelley
a68b5ee372 std.Build.Cache: introduce API for taking the files
ability to take ownership of the set of input files prior to
deinitializing a Manifest
2026-08-13 11:32:46 +02:00
Andrew Kelley
8e48a5c524 Merge pull request 'std.Build.Configuration: serialize public modules of packages' (#36461) from hemisputnik/zig:work/36388-configuration-package-modules into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36461
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-08-13 00:34:22 +02:00
C19
2aae46494a in init main.zig, clarify the fuzz command to avoid confusion 2026-08-13 00:23:00 +02:00
Nurul Huda (Apon)
013492ecb8 std.zon serialize: make escaping non-ascii optional, defaulting to false (#30710)
Currently std.zon.stringify.serialize always escapes Unicode characters, while std.json.stringify by default does not. This change adds an escape_non_ascii option that matches the JSON serializer's behavior.

`escape_non_ascii` is false by default, and will only escape unicode once set to true.

Closes [#23535](https://github.com/ziglang/zig/issues/23535)

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30710
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>
2026-08-12 23:43:31 +02:00
Andrew Kelley
89e0881f11 remove bad advice from @import("builtin")
also update doc comments on `std.lang.CompilerBackend`.
2026-08-11 20:51:12 -07:00
Lukas Lalinsky
9d92d2ce93 Migrate netWrite to std.Io.Operation
Preparation for adding timeouts:
https://codeberg.org/ziglang/zig/issues/32166
2026-08-11 11:57:57 +02:00
Lukáš Lalinský
254c23b038 Fix std.Io.Condition.wait cancelation race / error swallowing (#35564)
When `std.Io.Condition` is signaled and almost immediately after
that canceled, it will swallow the `error.Canceled` error and
leave the task in an uncancelable state.

Co-authored-by: Lukas Lalinsky <lukas@lalinsky.com>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35564
Reviewed-by: mlugg <mlugg@mlugg.co.uk>
2026-08-11 10:43:13 +02:00
mlugg
b38d176bba Merge pull request 'Migrate netSend to Operation' (#35300) from blblack/zig:net-send into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35300
Reviewed-by: mlugg <mlugg@mlugg.co.uk>
2026-08-11 09:55:02 +02:00
Alex Rønne Petersen
91c8116b23
std.pie: fix calculation of _DYNAMIC's offset 2026-08-11 01:02:54 +02:00
Alex Rønne Petersen
6217b02f25 Merge pull request 'std: inline assembly cleanup and fixes' (#36459) from alexrp/zig:asm-cleanup into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36459
2026-08-10 22:18:25 +02:00
Linus Groh
f6e32d1b3a std.c: Fix tc_lflag_t definition for serenity 2026-08-10 20:34:35 +01:00
Brandon Black
d4f3881bdb std.Io.Threaded.lookupDns: use sendTimeout
Mostly I did this to test sendTimeout with something other than my
own code.

Now that send is Operation-based, it can also honor the timeout
deadlines lookupDns is already enforcing on the receive side
(which may matter if the socket output buffer gets filled - sends
are not always immediately-successful!).
2026-08-10 20:33:08 +02:00
Brandon Black
a6c2839505 Move std.Io netSend to an Operation
Also adds sendTimeout() and sendManyTimeout() functions to
Io.net.Socket, and updates the UDP tests to exercise all of the
combined interfaces.

Deprecates `sendMany` in favor of `sendManyTimeout` with a
`Timeout` of `.none`.  The existing `sendMany` interface is not
capable of reporting partial success, and eventually removing it
will align with the current interfaces on the receive side.

Seems to work for Posix + Threaded?  Beyond very basic "avoid
compile errors maybe", I have not tried to address non-Posix or
non-Threaded parts.
2026-08-10 20:33:08 +02:00
Brandon Black
b9adc659b3 Io.net: add basic UDP tests 2026-08-10 20:33:08 +02:00
hemisputnik
e98205bd17
std.Build.Configuration: serialize package instance public modules 2026-08-10 11:20:46 +03:00
hemisputnik
3d50222f9b
std.Build.Configuration: reintroduce serialization of std.Build instances 2026-08-10 11:20:19 +03:00
hemisputnik
27bf90f12b
std.Build.Configuration: use IndexType where appropriate 2026-08-10 11:17:07 +03:00
RadsammyT
5ceec001b5 std.os.linux: pad CLOSE_RANGE by one bit
On include/uapi/linux/close_range.h of the linux src tree,
The C equivalents for the CLOSE_RANGE members are defined like this:
-
/* Unshare the file descriptor table before closing file descriptors. */
#define CLOSE_RANGE_UNSHARE(1U << 1)

/* Set the FD_CLOEXEC bit instead of closing the file descriptor. */
#define CLOSE_RANGE_CLOEXEC(1U << 2)
-
Originally, the zig fields of CLOSE_RANGE were offset by one bit-shift
to the right.
This adds one bit of padding which pushes the Zig members by one
bit-shift to the left, making the Zig struct be aligned with
the linux definitions.
2026-08-10 07:55:15 +02:00
Alex Rønne Petersen
8217f26ef8
std.os.linux.tls: fix a typo and a mistake in hppa setThreadPointer assembly
* addr is an input, not an output.
* ble clobbers r31, not r29.
2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
52b8d3421e
std.os.linux.tls: fix alpha setThreadPointer assembly not indicating its r16 clobber 2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
01cadcae1c
std.os.linux.tls: always inline set_thread_area syscall in m68k setThreadPointer
As for the rest.
2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
0873d786b6
std.os.linux.tls: fix m68k getThreadPointer to use syscall0 instead of syscall1 2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
bc5cd40221
std.os.linux.tls: fix operand order for sh setThreadPointer/getThreadPointer assembly 2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
b29a6e3925
std.atomic: fix conditions for using yield on arm/thumb in spinLoopHint 2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
0125c27363
std.atomic: use rd %ccr, %g0 on sparc v9 in spinLoopHint 2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
fb578f3d17
std.atomic: use pause on mips r2+ in spinLoopHint 2026-08-09 17:53:04 +02:00
Alex Rønne Petersen
9e9047b7e8
std.debug.cpu_context.X86_16: fix register number for ip to match eip on X86 2026-08-09 17:53:04 +02:00