aboutsummaryrefslogtreecommitdiff
path: root/lib/c.zig
AgeCommit message (Collapse)Author
2025-08-27libc: use zig isnan and derivates for mingwDavid Senoner
2025-05-21libc: implement common `abs` for various integer sizes (#23893)David
* 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-10Introduce common `bzero` libc implementation. (#23812)David
* Introduce common `bzero` libc implementation. * Update test name according to review Co-authored-by: Linus Groh <mail@linusgroh.de> * address code review - import common implementation when musl or wasi is included - don't use `c_builtins`, use `@memset` * bzero calling conv to .c * Apply review Co-authored-by: Veikka Tuominen <git@vexu.eu> --------- Co-authored-by: Linus Groh <mail@linusgroh.de> Co-authored-by: Veikka Tuominen <git@vexu.eu>
2025-04-11Introduce libzigc for libc function implementations in Zig.Alex Rønne Petersen
This lays the groundwork for #2879. This library will be built and linked when a static libc is going to be linked into the compilation. Currently, that means musl, wasi-libc, and MinGW-w64. As a demonstration, this commit removes the musl C code for a few string functions and implements them in libzigc. This means that those libzigc functions are now load-bearing for musl and wasi-libc. Note that if a function has an implementation in compiler-rt already, libzigc should not implement it. Instead, as we recently did for memcpy/memmove, we should delete the libc copy and rely on the compiler-rt implementation. I repurposed the existing "universal libc" code to do this. That code hadn't seen development beyond basic string functions in years, and was only usable-ish on freestanding. I think that if we want to seriously pursue the idea of Zig providing a freestanding libc, we should do so only after defining clear goals (and non-goals) for it. See also #22240 for a similar case.
2025-03-05Remove uses of deprecated callconv aliasesLinus Groh
2024-11-08c: Include Os.Tag.other in the list of freestanding OSs.Alex Rønne Petersen
2024-11-08c: Use internal linkage when running tests.Alex Rønne Petersen
This matches what we do for compiler-rt.
2024-10-23handle _fltused in compiler_rtAndrew Kelley
so we don't have to do an entire compilation unit for just this silly symbol
2024-08-27compiler,lib,test,langref: migrate `@setCold` to `@branchHint`mlugg
2024-08-27lib,test,tools,doc: update usages of @exportmlugg
2024-08-07std.os.linux: Move clone() here and stop exporting it.Alex Rønne Petersen
2024-07-29Merge pull request #20389 from alexrp/riscv32Andrew Kelley
Some `riscv32-linux` porting work
2024-07-29c: Handle armeb and thumbeb in clone().Alex Rønne Petersen
2024-07-29c: Implement clone() for riscv32-linux.Alex Rønne Petersen
2024-03-11std.builtin: make link mode fields lowercaseTristan Ross
2023-07-31std: finish cleanup up asmJacob Young
This also required implementing the necessary syntax in the x86_64 backend.
2023-06-25std.cstr: deprecate namespaceEric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-02-04Add support for mips64/mips64elSuirad
2022-11-04all: rename i386 to x86Ali Chraghi
2022-10-17Merge pull request #11747 from Luukdegram/compiler-rtAndrew Kelley
compiler_rt: Move mem implementations from c.zig
2022-10-15compiler_rt: Move mem implementations from c.zigLuuk de Gram
This moves functions that LLVM generates calls to, to the compiler_rt implementation itself, rather than c.zig. This is a prerequisite for native backends to link with compiler-rt. This also allows native backends to generate calls to `memcpy` and the like.
2022-10-12zig_libc: do not call abort() on amdgpuRobin Voetter
2022-09-20std: add return address parameter to panic fnVeikka Tuominen
2022-09-12universal-libc: fix strncmp testsAndrew Kelley
The specification for this function is that it returns a positive value, zero, or negative value, not that it returns the difference between ascii values.
2022-07-01Sema: validate deref operator type and valueVeikka Tuominen
2022-05-13target: Rename sparcv9 -> sparc64Koakuma
Rename all references of sparcv9 to sparc64, to make Zig align more with other projects. Also, added new function to convert glibc arch name to Zig arch name, since it refers to the architecture as sparcv9. This is based on the suggestion by @kubkon in PR 11847. (https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-05-06flatten lib/std/special and improve "pkg inside another" logicAndrew Kelley
stage2: change logic for detecting whether the main package is inside the std package. Previously it relied on realpath() which is not portable. This uses resolve() which is how imports already work. * stage2: fix cleanup bug when creating Module * flatten lib/std/special/* to lib/* - this was motivated by making main_pkg_is_inside_std false for compiler_rt & friends. * rename "mini libc" to "universal libc"