aboutsummaryrefslogtreecommitdiff
path: root/src/libs
AgeCommit message (Collapse)Author
2025-10-30std.debug.lockStderrWriter: also return ttyconfMatthew Lugg
`std.Io.tty.Config.detect` may be an expensive check (e.g. involving syscalls), and doing it every time we need to print isn't really necessary; under normal usage, we can compute the value once and cache it for the whole program's execution. Since anyone outputting to stderr may reasonably want this information (in fact they are very likely to), it makes sense to cache it and return it from `lockStderrWriter`. Call sites who do not need it will experience no significant overhead, and can just ignore the TTY config with a `const w, _` destructure.
2025-10-29Merge pull request #25592 from ziglang/init-std.IoAndrew Kelley
std: Introduce `Io` Interface
2025-10-29remove all IBM AIX and z/OS supportAlex Rønne Petersen
As with Solaris (dba1bf935390ddb0184a4dc72245454de6c06fd2), we have no way to actually audit contributions for these OSs. IBM also makes it even harder than Oracle to actually obtain these OSs. closes #23695 closes #23694 closes #3655 closes #23693
2025-10-29compiler: update for introduction of std.IoAndrew Kelley
only thing remaining is using libc dns resolution when linking libc
2025-10-19glibc: change library link order to prefer libc.so symbolsAlex Rønne Petersen
Also avoid resolving symbols in libraries that were later removed if possible. closes #24347
2025-10-06Merge pull request #25414 from squeek502/mingw-def-implibAndrew Kelley
Support generating import libraries from mingw .def files without LLVM
2025-10-03Support generating import libraries from mingw .def files without LLVMRyan Liptak
For the supported COFF machine types of X64 (x86_64), I386 (x86), ARMNT (thumb), and ARM64 (aarch64), this new Zig implementation results in byte-for-byte identical .lib files when compared to the previous LLVM-backed implementation.
2025-10-04libcxx: don't impose _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS on usersAlex Rønne Petersen
closes https://github.com/ziglang/zig/issues/25455
2025-10-04libcxxabi: define _LIBCPP_BUILDING_LIBRARY in addition to ↵Alex Rønne Petersen
_LIBCXXABI_BUILDING_LIBRARY
2025-10-04libcxxabi: don't build cxa_noexception.cpp if exceptions are enabledAlex Rønne Petersen
2025-10-04libcxxabi: sort file list according to upstream CMakeLists.txtAlex Rønne Petersen
2025-09-28musl: delete dead __restore and __restore_rt functions for hexagon, ↵Alex Rønne Petersen
loongarch64, riscv32, riscv64 https://www.openwall.com/lists/musl/2025/09/28/2
2025-09-28libcxx: respond to some feature macro changes in LLVM 20Alex Rønne Petersen
https://github.com/llvm/llvm-project/commit/ba87515fea90b5d55836a8e3be63a7e683ce299d closes #25376
2025-09-27musl: add missing fenv C dummy functions for loongarch64-linux-muslsfAlex Rønne Petersen
https://www.openwall.com/lists/musl/2025/09/27/1 closes #25367
2025-09-24update aro and translate-c sourcesVeikka Tuominen
2025-09-24compiler: update aro and translate-c to latest; delete clang translate-cAndrew Kelley
2025-08-30Merge pull request #25077 from ziglang/GenericReaderAndrew Kelley
std.Io: delete GenericReader, AnyReader, FixedBufferStream; and related API breakage
2025-08-30libtsan: update to LLVM 21Alex Rønne Petersen
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-28fix not discarding delimiterAndrew Kelley
perhaps these APIs have the defaults backwards, eh?
2025-08-28compiler: update not to use GenericWriterAndrew Kelley
2025-08-28aro: update to not use GenericWriterAndrew Kelley
2025-08-28more updates to not use GenericWriterAndrew Kelley
2025-08-28compiler: update to not use GenericWriterAndrew Kelley
2025-08-28libc: delete superfluous c and assembly trunc implementationsDavid Senoner
2025-08-28libc: delete superfluous c and assembly ceil implementationDavid Senoner
2025-08-27libc: use zig isnan and derivates for mingwDavid Senoner
2025-08-27Remove memcmp and memset from bundled musl and wasiYefeng Li
2025-08-20wasi-libc: update to c89896107d7b57aef69dcadede47409ee4f702eeAlex Rønne Petersen
2025-08-14Merge pull request #24825 from alexrp/freebsd-fixesAlex Rønne Petersen
2025-08-13freebsd: correctly define __FreeBSD_version to the first stable releaseAlex Rønne Petersen
See: https://docs.freebsd.org/en/books/porters-handbook/versions Closes #24819.
2025-08-13freebsd: fix PIC macro not being defined for crt1_s.SAlex Rønne Petersen
Closes #24818.
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-08compiler: improve error reportingmlugg
The functions `Compilation.create` and `Compilation.update` previously returned inferred error sets, which had built up a lot of crap over time. This meant that certain error conditions -- particularly certain filesystem errors -- were not being reported properly (at best the CLI would just print the error name). This was also a problem in sub-compilations, where at times only the error name -- which might just be something like `LinkFailed` -- would be visible. This commit makes the error handling here more disciplined by introducing concrete error sets to these functions (and a few more as a consequence). These error sets are small: errors in `update` are almost all reported via compile errors, and errors in `create` are reported through a new `Compilation.CreateDiagnostic` type, a tagged union of possible error cases. This allows for better error reporting. Sub-compilations also report errors more correctly in several cases, leading to more informative errors in the case of compiler bugs. Also fixes some race conditions in library building by replacing calls to `setMiscFailure` with calls to `lockAndSetMiscFailure`. Compilation of libraries such as libc happens on the thread pool, so the logic must synchronize its access to shared `Compilation` state.
2025-08-06link: prevent deadlock when prelink tasks failmlugg
If an error occured which prevented a prelink task from being queued, then `pending_prelink_tasks` would never be decremented, which could cause deadlocks in some cases. So, instead of calculating ahead of time the number of prelink tasks to expect, we use a simpler strategy which is much like a wait group: we add 1 to a value when we spawn a worker, and in the worker function, `defer` decrementing the value. The initial value is 1, and there's a decrement after all of the workers are spawned, so once it hits 0, prelink is done (be it with a failure or a success).
2025-08-06Revert "Sema: Stop adding Windows implib link inputs for `extern "..."` syntax."Alex Rønne Petersen
This reverts commit b461d07a5464aec86c533434dab0b58edfffb331. After some discussion in the team, we've decided that this is too disruptive, especially because the linker errors are less than helpful. That's a fixable problem, so we might reconsider this in the future, but revert it for now.
2025-07-14libcxx: fix building for wasm32-wasi by disabling exceptionsAlex Rønne Petersen
I accidentally regressed this in the LLVM 20 upgrade. Closes #24437.
2025-07-07compiler: fix remaining build failuresAndrew Kelley
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-07-07std.io: move getStdIn, getStdOut, getStdErr functions to fs.FileAndrew Kelley
preparing to rearrange std.io namespace into an interface how to upgrade: std.io.getStdIn() -> std.fs.File.stdin() std.io.getStdOut() -> std.fs.File.stdout() std.io.getStdErr() -> std.fs.File.stderr()
2025-07-07zig fmtAndrew Kelley
2025-07-06wasi: Fix libwasi-emulated-process-clocks buildAlex Rønne Petersen
Might have been broken in 05d8b565ad1a1d6c0c1e93dc47f1d828043fcafc.
2025-07-06wasi: Build emulated libraries into libc.aAlex Rønne Petersen
This matches what we do for small helper libraries like this in MinGW-w64. It simplifies the compiler a bit, and also means the build system doesn't have to treat these library names specially. Closes #24325.
2025-07-06Sema: Stop adding Windows implib link inputs for `extern "..."` syntax.Alex Rønne Petersen
Closes #23971.
2025-07-04delete superfluous assembly libc floor implementationsDavid Senoner
2025-07-04delete superfluous libc floor implementationsDavid Senoner
2025-06-19Target: pass and use locals by pointer instead of by valueJacob Young
This struct is larger than 256 bytes and code that copies it consistently shows up in profiles of the compiler.
2025-06-12libs: fix caching behaviormlugg
glibc, freebsd, and netbsd all do caching manually, because of the fact that they emit multiple files which they want to cache as a block. Therefore, the individual sub-compilation on a cache miss should be using `CacheMode.none` so that we can specify the output paths for each sub-compilation as being in the shared output directory.
2025-06-12compiler: rework emit paths and cache modesmlugg
Previously, various doc comments heavily disagreed with the implementation on both what lives where on the filesystem at what time, and how that was represented in code. Notably, the combination of emit paths outside the cache and `disable_lld_caching` created a kind of ad-hoc "cache disable" mechanism -- which didn't actually *work* very well, 'most everything still ended up in this cache. There was also a long-standing issue where building using the LLVM backend would put a random object file in your cwd. This commit reworks how emit paths are specified in `Compilation.CreateOptions`, how they are represented internally, and how the cache usage is specified. There are now 3 options for `Compilation.CacheMode`: * `.none`: do not use the cache. The paths we have to emit to are relative to the compiler cwd (they're either user-specified, or defaults inferred from the root name). If we create any temporary files (e.g. the ZCU object when using the LLVM backend) they are emitted to a directory in `local_cache/tmp/`, which is deleted once the update finishes. * `.whole`: cache the compilation based on all inputs, including file contents. All emit paths are computed by the compiler (and will be stored as relative to the local cache directory); it is a CLI error to specify an explicit emit path. Artifacts (including temporary files) are written to a directory under `local_cache/tmp/`, which is later renamed to an appropriate `local_cache/o/`. The caller (who is using `--listen`; e.g. the build system) learns the name of this directory, and can get the artifacts from it. * `.incremental`: similar to `.whole`, but Zig source file contents, and anything else which incremental compilation can handle changes for, is not included in the cache manifest. We don't need to do the dance where the output directory is initially in `tmp/`, because our digest is computed entirely from CLI inputs. To be clear, the difference between `CacheMode.whole` and `CacheMode.incremental` is unchanged. `CacheMode.none` is new (previously it was sort of poorly imitated with `CacheMode.whole`). The defined behavior for temporary/intermediate files is new. `.none` is used for direct CLI invocations like `zig build-exe foo.zig`. The other cache modes are reserved for `--listen`, and the cache mode in use is currently just based on the presence of the `-fincremental` flag. There are two cases in which `CacheMode.whole` is used despite there being no `--listen` flag: `zig test` and `zig run`. Unless an explicit `-femit-bin=xxx` argument is passed on the CLI, these subcommands will use `CacheMode.whole`, so that they can put the output somewhere without polluting the cwd (plus, caching is potentially more useful for direct usage of these subcommands). Users of `--listen` (such as the build system) can now use `std.zig.EmitArtifact.cacheName` to find out what an output will be named. This avoids having to synchronize logic between the compiler and all users of `--listen`.
2025-06-12compiler: get most backends compiling againmlugg
As of this commit, every backend other than self-hosted Wasm and self-hosted SPIR-V compiles and (at least somewhat) functions again. Those two backends are currently disabled with panics. Note that `Zcu.Feature.separate_thread` is *not* enabled for the fixed backends. Avoiding linker references from codegen is a non-trivial task, and can be done after this branch.