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
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
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.
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.
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
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.
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.
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.
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
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.
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.
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.