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

40,893 commits

Author SHA1 Message Date
Alex Rønne Petersen
402b4680b5
update_cpu_features: map xs1b xcore model to LLVM's xs1b-generic 2026-10-26 11:02:42 +01:00
Alex Rønne Petersen
6847e90ce7
update_cpu_features: remove generic bpf model
This was just identical to the v1 model.
2026-10-26 11:02:42 +01:00
Alex Rønne Petersen
599901643f
update_cpu_features: remove probe bpf model 2026-10-26 11:02:42 +01:00
Alex Rønne Petersen
75a29594b2
update_cpu_features: add hwmult16 dependency to hwmult32 msp430 feature 2026-10-26 11:02:42 +01:00
Alex Rønne Petersen
730aa6c502
update_cpu_features: remove generic msp430 model
This was just identical to the msp430 model.
2026-10-26 11:02:42 +01:00
Alex Rønne Petersen
2e961dbcc4
update_cpu_features: add some missing hexagon feature dependencies 2026-10-26 11:02:42 +01:00
Alex Rønne Petersen
51506ce615
update_cpu_features: remove csky float ABI options 2026-10-26 11:02:41 +01:00
Alex Rønne Petersen
48445c4bd3
update_cpu_features: remove hard_tp csky codegen option 2026-10-26 11:02:41 +01:00
Alex Rønne Petersen
81b96e5b70
update_cpu_features: properly remove soft-tp and stack-size csky features 2026-10-26 11:02:41 +01:00
Alex Rønne Petersen
203f8b219b
update_cpu_features: add vfpu feature to allegrex mips model 2026-10-26 11:02:41 +01:00
Alex Rønne Petersen
71635df82b
update_cpu_features: remove soft_float feature from r3000a mips model
Soft float should be communicated with the target triple, i.e. mipsel-psx-eabi.
2026-10-26 11:02:41 +01:00
Alex Rønne Petersen
ebcbd7c812
update_cpu_features: remove notraps mips feature
It no longer serves a purpose with the LLVM backend special case removed.
2026-10-26 11:02:41 +01:00
Alex Rønne Petersen
289389cae2
update_cpu_features: remove incorrect e500v2 powerpc model 2026-10-26 11:02:41 +01:00
Alex Rønne Petersen
d728a9bb7b
update_cpu_features: add some missing features to e6500 powerpc model 2026-10-26 11:02:41 +01:00
Matthew Lugg
8d6c05f8ec link.Lld: fix linking ELF shared libraries with -l on Windows
In Zig 0.17.0, we started lowering these to `-L/ -l:/path/to/lib.so` in
the LLD invocation, but that obviously doesn't work on Windows. Luckily,
LLD's, uh, curious approach to path concatenation means that we can just
pass `-L ""` instead of `-L/` and everything works.

Resolves: https://codeberg.org/ziglang/zig/issues/37257
2026-10-26 10:26:58 +01:00
Matthew Lugg
94661e1cca link.MachO: deduplicate LC_LOAD_DYLIB load commands
I did look into whether we should be deduplicating sooner (e.g. in the
linker frontend), but this seems to be where other linkers deduplicate,
so at least for now let's just match that.

Resolves: https://codeberg.org/ziglang/zig/issues/37357
2026-10-26 10:25:42 +01:00
Ryan Liptak
0084f08c30 zig fmt: Add --upgrade flag to usage text 2026-10-25 17:39:53 -07:00
mlugg
b7f2c6d8fe Merge pull request 'Elf2: performance improvements & small refactors' (#37400) from mlugg/elf2-perf into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37400
2026-10-25 11:14:37 +01:00
Danielkonge
2f90fcd839 spirv: fix negative integers in switch 2026-10-25 09:50:54 +01:00
Frank Denis
064c785055 Merge pull request 'crypto.ff: support even moduli / products of arbitrary integers' (#37330) from jedisct1/zig:ff-fixes14 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37330
2026-10-25 08:38:01 +01:00
Frank Denis
4707a01ad3 crypto.ff: add functions to create a moduli from two integers
An RSA modulus is the product of two integers, so add functions
to directly contruct such moduli.
2026-10-25 08:38:01 +01:00
Frank Denis
bb3fd33224 crypto.ff: add some tests for even moduli 2026-10-25 08:38:01 +01:00
Frank Denis
00795888e8 crypto.ff: add support for even moduli
Allow options to create a modulus. Right now, there's one option,
to allow even moduli (starting at 2).

Even moduli are disabled by default: even moduli can't use the
Montgomery form, so multiplication and exponentiation are slower.

The Option struct is there to future-proof the interface, as we
can later use it to add support for blinding, etc.
2026-10-25 08:38:01 +01:00
Frank Denis
0f17c8c1e7 crypto.ff: optimize short public exponents
For short public exponents like the ones commonly used in RSA,
just start at their highest set bit and skip leading zeros;
no nned to build a table.

Separate exponent decoding and representation conversion from
the exp loop by the way.
2026-10-25 08:38:01 +01:00
Frank Denis
ad2225deb5 crypto.ff: add a function to decode reduced field elements
Add fromBytesReduced() to accept values below 2^m.bits()
(including values at or above the modulus).
2026-10-25 08:38:01 +01:00
Matthew Lugg
fac41b3ec9
Elf2: minor performance improvements 2026-10-25 00:21:56 +01:00
Matthew Lugg
8d471cd901
Elf2: switch string table to ArrayHashMap
This seems to be a performance win, presumably thanks to the entire hash
being stored which avoids redundant string comparisons.
2026-10-25 00:21:55 +01:00
Matthew Lugg
50752ce0f5
Elf2: slightly refactor object processing, and add more tracy calls 2026-10-25 00:21:55 +01:00
Matthew Lugg
1cdcac604f
Elf2: fix a performance issue 2026-10-25 00:21:55 +01:00
Matthew Lugg
d74e9a786f
Elf2: prepare to support simple relaxations 2026-10-25 00:21:55 +01:00
Matthew Lugg
7cc50a4fb3
Elf2: absorb GotReloc into SymbolReloc 2026-10-25 00:21:53 +01:00
Andrew Kelley
720939f8c9 Merge pull request 'loongarch: minor improvements' (#37287) from AstraFall/zig:loongarch/pr into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37287
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-10-24 23:23:21 +02:00
Andrew Kelley
bca1cc3eef Merge pull request 'llvm: fix bugs related on padding of struct and unions' (#37347) from pavelverigo/zig:i37335 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37347
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-24 23:21:24 +02:00
Leon Lombar
3423b14e83 print_zir: simplify casts
Not sure how useful this is, but I got Jacob's blessing so yeah, yolo
2026-10-24 23:16:49 +02:00
Ryan Liptak
723085b9bf Build: fetch pending lazy dependencies and retry when artifact/etc is not found
Before the changes in this commit, the intention was to gather all pending lazy dependencies of all package scripts, and then only handle fetching after the root package script exits. However, that's not always feasible, since it's possible for a lazy dependency to depend on a lazy dependency, which means that the first fetch-and-retry can only know about the root's lazy dependencies. Then, during the second attempt at configuring, the root package script will see its lazy dependency as available, but in reality that dependency's package script may return error.LazyDependencyNeeded, which won't matter until *after* the root package script has finished running. Therefore, the root package script will continue running as if its lazy dependency is fully available, when in reality it has requested a fetch-and-retry.

This means that something like an `artifact` call in the root package script that depends on a lazy dependency of a lazy dependency will fail after the first fetch-and-retry, because the necessary remaining pending lazy dependencies would only get fetched once the root script finished.

In case it's helpful, the reproduction looks something like this:

root
└─ child1 (.lazy = true, gotten in root's build.zig via either `dependency` or `try dependencyLazy`)
   └─ child2 (.lazy = true, gotten in child1's build.zig via `try dependencyLazy`)

To fix this, whenever an artifact/module/etc is looked up and not found while there are pending lazy dependencies, we now immediately exit, fetch, and retry, since that artifact/module/etc could only exist after one of those pending lazy dependencies is made available (i.e. the dependency's configuration stopped part-way due to a missing lazy dependency).

Before (fails):

> zig build
debug(fetch): FileNotFound: zig-pkg\zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN
debug(fetch): FileNotFound: C:\Users\Ryan\AppData\Local\zig\p/zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN.tar.gz
debug: configuration cache incomplete_manifest
info: fetching lazy dependency zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN
debug(fetch): FileNotFound: zig-pkg\zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN
debug(fetch): FileNotFound: C:\Users\Ryan\AppData\Local\zig\p/zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN.tar.gz
debug(fetch): FileNotFound: zig-pkg\zig_test_repo2-0.0.0-eVW_ihsPAAAmwffTitFedoK7HGHiRfQTshvARXs0-qJx
debug(fetch): FileNotFound: C:\Users\Ryan\AppData\Local\zig\p/zig_test_repo2-0.0.0-eVW_ihsPAAAmwffTitFedoK7HGHiRfQTshvARXs0-qJx.tar.gz
debug: configuration cache incomplete_manifest
panic: unable to find artifact "zig_test_repo1_lib"

After (succeeds):

> zig build
debug(fetch): FileNotFound: zig-pkg\zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN
debug(fetch): FileNotFound: C:\Users\Ryan\AppData\Local\zig\p/zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN.tar.gz
debug: configuration cache incomplete_manifest
info: fetching lazy dependency zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN
debug(fetch): FileNotFound: zig-pkg\zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN
debug(fetch): FileNotFound: C:\Users\Ryan\AppData\Local\zig\p/zig_test_repo1-0.0.0-FuDjYawXAAAK0sFpnAa7IPMoTJpCs44sgfKP7ZBi3oAN.tar.gz
debug(fetch): FileNotFound: zig-pkg\zig_test_repo2-0.0.0-eVW_ihsPAAAmwffTitFedoK7HGHiRfQTshvARXs0-qJx
debug(fetch): FileNotFound: C:\Users\Ryan\AppData\Local\zig\p/zig_test_repo2-0.0.0-eVW_ihsPAAAmwffTitFedoK7HGHiRfQTshvARXs0-qJx.tar.gz
debug: configuration cache incomplete_manifest
info: fetching lazy dependency zig_test_repo2-0.0.0-eVW_ihsPAAAmwffTitFedoK7HGHiRfQTshvARXs0-qJx
debug(fetch): FileNotFound: zig-pkg\zig_test_repo2-0.0.0-eVW_ihsPAAAmwffTitFedoK7HGHiRfQTshvARXs0-qJx
debug(fetch): FileNotFound: C:\Users\Ryan\AppData\Local\zig\p/zig_test_repo2-0.0.0-eVW_ihsPAAAmwffTitFedoK7HGHiRfQTshvARXs0-qJx.tar.gz
debug: configuration cache incomplete_manifest
2026-10-24 23:10:20 +02:00
Andrew Kelley
680ab55488 Merge pull request 'ArrayList: remove usages of Managed from std/zig/llvm, lib/compiler/Maker, docs/wasm/markdown' (#37385) from Der_Teufel/zig:arraylist-managed into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37385
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-24 23:07:01 +02:00
Andrew Kelley
935a3b9c75 Merge pull request 'std: update more ArrayList usages to unmanaged' (#37362) from masabence/zig:more-arraylist-unmanaged into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37362
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-24 23:06:14 +02:00
Frank Denis
09ee89a89c cbe: Fix @reduce(.Add) and @reduce(.Mul) with narrow integers
For integers up to 64 bits, the generated code used += and *=,
but the C type might be bigger than the Zig type.

For example, a sum or product of u1, u7 or i3 integers would end
up out of range.

Fix this by using zig_addw and zig_mulw if the integer bit width
doesn't match the C type.
2026-10-24 23:04:43 +02:00
Martin
3bb0056d60 std.http: update usages of array_list.Managed to ArrayList 2026-10-24 23:04:11 +02:00
David Rubin
735e31ad99 pcurves: fix addMixed for x = 0
On P-256 and P-384 (a = -3), the curve equation at x = 0 reduces to
y^2 = B. B is a quadratic residue mod p on both curves, so the
points (0, +/-sqrt(B)) exist, are valid, and lie in the prime-order
group since the cofactor is 1.

The final select only checks , so for q = (0, +/-sqrt(B))
it discards the correct sum and returns p.
2026-10-24 23:02:22 +02:00
David Rubin
16126cf141 x86_64: rewrite cmpxchg_{weak,strong} implementation 2026-10-24 22:59:09 +02:00
Andrew Kelley
def373ed78 Merge pull request 'llvm: pass some behavior tests (30%) for spirv target' (#37300) from alichraghi/zig:llvm-spirv into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37300
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-24 22:34:19 +02:00
David Rubin
7ef64ccf55 compiler-rt: fix f80 conversions for subnormal destination
The conversion was discarding f80's explicit leading significand bit
and using incorrect shift and sticky-bit calculations. Now we
preserve that bit and correct the rounding logic. Also ensures
f128 NaNs remain NaNs when converted to f80, even when their payload
is truncated away, rather than becoming infinity.
2026-10-24 13:42:01 +02:00
Alex Rønne Petersen
11c8c38332 disentangle std.c and std.posix on Windows
std.c should reflect the CRT, not std.posix's bizarre view of the world.

Also:

* Audit some incorrect std.c types and function signatures
* Remove ws2_32 from std.c (dubious quality, and ws2_32 isn't libc)
* Remove remnants of Windows support in std.posix

closes https://codeberg.org/ziglang/zig/issues/37382
2026-10-24 07:23:58 +02:00
Sassan Haradji
77d0a9c07e
Zcu: allow align(1) on functions for targets without function alignment
Targets such as wasm32 and wasm64 do not support setting function alignment, but align(1) is a no-op and should be accepted. Reject only alignments greater than 1 on those targets.

Update the compile-error tests and add a positive test covering align(1) on wasm.
2026-10-24 07:21:58 +02:00
Andrew Kelley
d9c4f16e44 Merge pull request 'build system: avoid the possibility of infinite fetch-and-retry loops for lazy dependencies' (#37391) from squeek502/zig:maker-lazy-loops into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37391
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-24 04:55:08 +02:00
Ryan Liptak
be69013825 Build.declareDependency{Step}: only populate unlazy_deps when the package is not available
The logic in Maker expects unlazy_deps to only be populated for deps that need to be fetched. Without this check, declareDependency/declareDependencyStep could lead to an infinite fetch-and-retry loop.
2026-10-23 17:15:17 -07:00
Ryan Liptak
b9f95fc512 Maker: Add generated dependencies.zig as an input to the config cache manifest
Without this, Maker could enter an infinite loop when a step required some lazy dependencies that were unavailable, and then after the fetch that made them available, the config would get a cache hit so the step would still be configured as needing lazy dependencies, and so on.

Now, any change to the generated dependencies.zig file will cause the configuration phase to be re-run.
2026-10-23 17:15:17 -07:00
Alex Rønne Petersen
76af1bbc4d ci: update Wasmtime to v50.0.0 2026-10-23 23:36:12 +02:00
Alex Rønne Petersen
dbc0a15080 Maker: fix stack UAF of dynamic_linker_path in Step.Compile.appendModuleFlags()
closes https://codeberg.org/ziglang/zig/issues/37377
2026-10-23 23:33:00 +02:00