91 Commits

Author SHA1 Message Date
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 61cd38e8ac feat(libzigc): add common implementations of pthread_spin_*
* and remove their mingw, musl and wasi implementations
2026-04-21 09:03:06 +02:00
badayvedat a05a25e2bb zig libc: export fdiml and fdimf (#31759)
Exports `fdiml` and `fdimf` in zig libc and removes from from musl and mingw libc.

Contributes to: https://codeberg.org/ziglang/zig/issues/30978

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31759
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: badayvedat <badayvedat@gmail.com>
Co-committed-by: badayvedat <badayvedat@gmail.com>
2026-04-16 01:11:04 +02:00
rpkak 208a74a5c5 libc: remove duplicates of some functions
mingw,musl,wasi-libc: remove c files, that only provide functions already included in zigc

mingw: remove c files, that only provide functions, which are in ucrt

mingw: do not include mingw files/zigc functions on targets on which they in ucrt
2026-04-03 15:26:09 +02:00
mihael 9a53be5fb4 libzigc/math: Implement more precise sincosl in compiler_rt
The changes were tested by running:
```bash
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=sincosl -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```

Additionally, I've added unit tests for `sincos`.
2026-04-02 23:54:20 +02:00
mihael a6d6af947d libzigc/math: Implement more precise cosl in compiler_rt
The implementation was ported from `musl`. Unit tests for `f80` and `f128` were also added.
`__cosl` was already implemented in `trig.zig` while working on `sinl`.

The changes were tested by running:
```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter='math.cosl' -fqemu -fwasmtime --summary line
Build Summary: 553/553 steps succeeded
```
2026-04-02 23:54:20 +02:00
mihael b5ec3e597e libzigc/math: Implement more precise sinl in compiler_rt
The implementation was ported from `musl`. Unit tests for `f80` and `f128` were also added.

The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=sinl -fqemu -fwasmtime --summary line
Build Summary: 553/553 steps succeeded
```
2026-04-02 23:54:20 +02:00
mihael bd1dc8948f libzigc/math: Remove straggler rint file in vendored MinGW
Seems like it was missed when implementing `rint`.

This was checked by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=rint -fqemu -fwasmtime --summary line
Build Summary: 2209/2209 steps succeeded
```
2026-04-02 23:54:19 +02:00
mihael 245c160a7b libzigc/math: Implement rintf
The implementation was ported from `musl` to Zig code, and the `rint`
unit tests were generalized so they could be used for `rintf` as well.

This was checked both through unit tests and running `libc-test` suite:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=rintf -fqemu -fwasmtime --summary line
Build Summary: 1657/1657 steps succeeded
```
2026-04-02 23:54:19 +02:00
mihael db1e649575 libzigc/math: Implement frexpl
The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=frexpl -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```
2026-04-02 23:54:19 +02:00
mihael 521a093334 libzigc/math: Implement frexpf
The `frexp` implementation was generalized so it can be used for `f32`
and `c_longdouble` types as well.

The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=frexp -fqemu -fwasmtime --summary line
Build Summary: 737/737 steps succeeded

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=frexpf -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```
2026-04-02 23:54:19 +02:00
mihael ba4af7aa8a libzigc/math: Switch to compiler_rt impl of tanl 2026-04-02 23:54:19 +02:00
mihael a8b710697e libzigc/math: Switch to compiler_rt impl of sincosl 2026-04-02 23:54:19 +02:00
mihael 691416c24d libzigc: Implement tanhf
The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=tanhf -fqemu -fwasmtime --summary line
Build Summary: 553/553 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael 4cad6f5372 libzigc: Implement modfl
The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=modfl -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael 0141787257 libzigc: implement modff
`modf` function was generalized and renamed to `modfGeneric`, `modf` and
`modff` provide the appropriate type while calling that function. The
unit tests were also generalized so they can be reused for different
float types.

Both `modf` and `modff` were tested after making these changes:
```
$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=modf -fqemu -fwasmtime --summary line
Build Summary: 921/921 steps succeeded
```

```
stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=modff -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael 159568a05a Reimplement coshf in libzigc
The function basically calls the Zig std's implementation.

The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=coshf -fqemu -fwasmtime --summary line
Build Summary: 553/553 steps succeeded
```
2026-03-10 00:42:32 +01:00
rpkak 4ea9904923 remove some unused libc files 2026-02-13 19:57:59 +01:00
Pivok f1b2554023 libzigc: hypotf, hypotl (#31150)
Implements hypotf and hypotl for libzigc #30978.

Continuation of #31104

Commands i run:

```
$ stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=../../libc-test -Dtest-filter=hypotf -fqemu -fwasmtime --summary line
Build Summary: 365/369 steps succeeded (4 skipped)

$ stage4/bin/zig build test-modules -Dtest-target-filter=windows -Dtest-filter=hypotf --summary line
Build Summary: 53/101 steps succeeded (48 skipped)
```

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31150
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Pivok <pivoc@protonmail.com>
Co-committed-by: Pivok <pivoc@protonmail.com>
2026-02-09 07:59:40 +01:00
kj4tmp@gmail.com e60ba21114 libzigc: roundl 2026-02-01 00:59:35 +01:00
GasInfinity f0649dd978 feat(libzigc): use common implementations for strings.h and string.h
* forwards all functions to their equivalent `std`
* removes their musl, wasi-libc and mingw implementations
2026-01-17 22:37:29 +01:00
GasInfinity e22bf480aa feat(libzigc): use common implementation for wchar.h
* but does not fully implement it (missing locale/unicode tables)
* also removes their musl/mingw implementation
2026-01-15 18:01:20 +01:00
rpkak 08d37d6e14 compiler_rt: fix sqrtf implementation; libc: remove sqrt implementations 2026-01-10 00:09:54 +01:00
rpkak 813ae89208 libc -> libzigc: copysign 2026-01-10 00:09:54 +01:00
rpkak aa7dac9739 libc: remove fmin/fmax implementations 2026-01-10 00:09:54 +01:00
rpkak a2861a6c8d libc: remove fmod implementations 2026-01-10 00:09:54 +01:00
rpkak 9dd32d5e65 libc: remove some more log implementations 2026-01-10 00:09:54 +01:00
GasInfinity 7f6eab2704 feat(libzigc): add nan, nanf, nanl and bsearch
* also remove musl implementation
2026-01-09 00:26:20 +01:00
mercenary eab93d3574 libc: remove log/f, log2/f and log10/f
These symbols are already provided by compiler_rt
2026-01-01 15:25:40 +01:00
mercenary 1c05823ff8 libc: remove exp and expf
These symbols are already provided by compiler_rt
2025-12-29 15:55:18 +01:00
David Senoner 70e22d79a4 libc: delete superfluous c and assembly trunc implementations 2025-08-28 20:09:07 +02:00
David Senoner f707de15a1 libc: delete superfluous c and assembly ceil implementation 2025-08-28 07:33:50 +02:00
David Senoner 9399fcddce libc: use zig isnan and derivates for mingw 2025-08-27 03:58:32 +02:00
David Senoner b78751051f delete superfluous assembly libc floor implementations 2025-07-04 20:05:18 +02:00
Alex Rønne Petersen 879bc2e5cb mingw: Update MinGW-w64 sources to 38c8142f660b6ba11e7c408f2de1e9f8bfaf839e. 2025-06-11 18:27:15 +02:00
Alex Rønne Petersen 6671442a7c mingw: Update MinGW-w64 definitions to 38c8142f660b6ba11e7c408f2de1e9f8bfaf839e. 2025-06-11 15:28:36 +02:00
Super User 7bc3f294ce Added zig patch comments to annotate the deletion of the sincos symbol 2025-06-02 14:05:03 +00:00
Koki Ueha 71ff3830df libc: replace MinGW's trigonometric functions with compiler_rt's
- sinf
- cosf
- sincos
- sincosf
- tanf
2025-06-01 11:25:51 +00:00
Alex Rønne Petersen 0cbff2ff7f mingw: Remove libscrnsav(e,w) support.
This defines a WinMain() function that can be potentially problematic when it
isn't wanted. If we add back support for this library in the future, it should
be built separately from mingw32.lib and on demand.
2025-05-30 01:03:47 +02:00
David 55848363fd libc: implement common abs for various integer sizes (#23893)
* libc: implement common `abs` for various integer sizes

* libc: move imaxabs to inttypes.zig and don't use cInclude

* libc: delete `fabs` c implementations because already implemented in compiler_rt

* libc: export functions depending on the target libc

Previously all the functions that were exported were handled equally,
though some may exist and some not inside the same file. Moving the
checks inside the file allows handling different functions differently

* remove empty ifs in inttypes

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>

* remove empty ifs in stdlib

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>

* libc: use `@abs` for the absolute value calculation

---------

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-05-21 00:57:38 +02:00
Alex Rønne Petersen 8afe928b6e mingw: Update MinGW-w64 sources to 3839e21b08807479a31d5a9764666f82ae2f0356. 2025-02-24 12:01:07 +01:00
Alex Rønne Petersen 8019694e17 mingw: Add upstream RtlSecureZeroMemory implementation.
Closes #22475.
2025-01-14 05:31:14 +01:00
Alex Rønne Petersen 45fff0a511 mingw: Update sources to dcd7fefc703fb4b12187235386900d34cc13fdc5. 2024-12-14 07:02:14 +01:00
Elaine Gibson add74427b9 mingw: support -municode 2024-03-27 10:05:57 +00:00
Andrew Kelley f47e92ca0d mingw-w64: update to latest master
upstream commit 0bac2d3cdb122dadcdee90009f7e24a69d56939f
2024-03-20 11:26:09 -07:00
Andrew Kelley 25fb6de83c mingw-w64: update to reflect latest tool changes
upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

closes #18968
2024-03-20 11:23:51 -07:00
Elaine Gibson b126978555 mingw-w64: remove msvcrt sources 2024-01-20 00:21:34 +00:00
Elaine Gibson bbecbaab0a mingw-w64: add missing CRT sources 2024-01-20 00:21:34 +00:00
Krzysztof Wolicki 78549d1e10 mingw: Add missing misc/mingw-access.c and misc/ucrt-access.c 2024-01-14 11:25:01 -08:00
Andrew Kelley 9a4a74eb65 mingw: remove pow.c from aarch64-windows mingw builds
I observed a duplicate symbol linker error; pow was defined both by
mingwex.lib and ucrtbase.dll.
2024-01-08 11:53:06 -07:00