aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/glibc
AgeCommit message (Collapse)Author
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-08-01glibc: update crt0 code to 2.42Alex Rønne Petersen
2025-07-31glibc: update abilists file to 2.42Alex Rønne Petersen
2025-04-04Revert "glibc: Patch to work around missing features in LLVM's s390x assembler."Alex Rønne Petersen
This reverts commit b230e4f598bd18b47f3f1c981869c597a06c7452. Closes #21329.
2025-03-13glibc: fix uninitialized memory in __pthread_cond_s for <=2.40TCROC
* https://sourceware.org/bugzilla/show_bug.cgi?id=32786 * https://inbox.sourceware.org/libc-alpha/87zfhpfqsm.fsf@oldenburg.str.redhat.com
2025-01-31glibc: Update abilists file to 2.41.Alex Rønne Petersen
2025-01-31glibc: Update source files to 2.41.Alex Rønne Petersen
2025-01-21Merge pull request #22541 from ziglang/pipelineAndrew Kelley
Compilation pipeline: spawn Jobs earlier that produce linker inputs
2025-01-21libc: Remove a bunch of code for architectures we don't actually support.Alex Rønne Petersen
Namely: * alpha * hppa * ia64 * microblaze * nios2 * or1k * s390 * sh
2025-01-20reject crti.o/crtn.o, embrace the futureAndrew Kelley
crti.o/crtn.o is a legacy strategy for calling constructor functions upon object loading that has been superseded by the init_array/fini_array mechanism. Zig code depends on neither, since the language intentionally has no way to initialize data at runtime, but alas the Zig linker still must support this feature since popular languages depend on it. Anyway, the way it works is that crti.o has the machine code prelude of two functions called _init and _fini, each in their own section with the respective name. crtn.o has the machine code instructions comprising the exitlude for each function. In between, objects use the .init and .fini link section to populate the function body. This function is then expected to be called upon object initialization and deinitialization. This mechanism is depended on by libc, for example musl and glibc, but only for older ISAs. By the time the libcs gained support for newer ISAs, they had moved on to the init_array/fini_array mechanism instead. For the Zig linker, we are trying to move the linker towards order-independent objects which is incompatible with the legacy crti/crtn mechanism. Therefore, this commit drops support entirely for crti/crtn mechanism, which is necessary since the other commits in this branch make it nondeterministic in which order the libc objects and the other link inputs are sent to the linker. The linker is still expected to produce a deterministic output, however, by ignoring object input order for the purposes of symbol resolution.
2024-11-02glibc: Fix an LP_SIZE redefinition warning for gnux32.Alex Rønne Petersen
2024-10-03glibc: Update abilists file for loongarch64-linux-gnusf support.Alex Rønne Petersen
Also a 269 KB -> 240 KB size reduction due to the new format version.
2024-09-23libc: Work around LLVM's misassembly of `j <reg>` on mips r6.Alex Rønne Petersen
See: https://github.com/ziglang/zig/issues/21315
2024-09-06Merge pull request #21195 from alexrp/glibc-fixesAndrew Kelley
`glibc`: Some bug fixes, plus arc and csky start files
2024-09-06glibc: Patch to work around missing features in LLVM's s390x assembler.Alex Rønne Petersen
Revert this with LLVM 20.
2024-09-05glibc: Add csky start files.Alex Rønne Petersen
2024-09-05glibc: Add arc start files.Alex Rønne Petersen
2024-08-23glibc: Define _IO_stdin_used in start code and reference it in stub asm.Alex Rønne Petersen
This is necessary to inform the real, non-stub glibc that a program built with Zig is using a modern `FILE` structure, i.e. glibc 2.1+. This is particularly important on lesser-used architectures where the legacy code is poorly tested; for example, glibc 2.40 introduced a regression for the legacy case in the libio cleanup code, causing all Zig-compiled MIPS binaries to crash on exit.
2024-08-23glibc: Add missing xstatver.h for some linux architectures.Alex Rønne Petersen
Specifically for alpha, arm, hppa, microblaze, and sh. Closes #20054.
2024-08-14loongarch: add glibc start.S to make zig-bootstrap work for ↵YANG Xudong
loongarch64-linux-gnu (#21015)
2024-08-08Update glibc start files to 2.40.Alex Rønne Petersen
2024-08-05glibc: update abilists fileAndrew Kelley
updated for glibc 2.40, and adds arc, csky, and m68k
2024-06-06test/link/glibc_compat: Add C test case for glibc versionsPat Tullmann
glibc_runtime_check.c is a simple test case that exercises glibc functions that might smoke out linking problems with Zig's C compiler. The build.zig compiles it against a variety of glibc versions. Also document and test glibc v2.2.5 (from 2002) as the oldest working glibc target for C binaries.
2024-06-05glibc: restore "weak_hidden_alias" macro for older glibc versionsPat Tullmann
The fstat,lstat,stat,mknod stubs used to build older (before v2.33) glibc versions depend on the weak_hidden_alias macro. It was removed from the glibc libc-symbols header, so patch it back in for the older builds.
2024-06-05glibc patch: get correct files compiled into libc_nonshared.aKang Seonghoon
The scope of libc_nonshared.a was greatly changed in glibc 2.33 and 2.34, but only the change from 2.34 was reflected so far. Glibc 2.33 finally switched to versioned symbols for stat functions, meaning that libc_nonshared.a no longer contains them since 2.33. Relevant files were therefore reverted to 2.32 versions and renamed accordingly. This commit also removes errno.c, which was probably added to libc_nonshared.a based on a wrong assumption that glibc/include/errno.h requires glibc/csu/errno.c. In reality errno.h should refer to __libc_errno (not to be confused with the public __errno_location), which should be imported from libc.so. The inclusion of errno.c resulted in wrong compile options as well; this commit fixes them as well.
2024-06-05glibc patch: remove some static asserts from fstatatAndrew Kelley
These are tripping on 32-bit x86 but are intended to prevent glibc itself from being built with a bad configuration. Zig is only using this file to create libc_nonshared.a, so it's not relevant.
2024-06-05glibc patch: don't check __LIBC macroAndrew Kelley
This is the only place in all of glibc that this macro is referenced. What is it doing? Only preventing fstatat.c from knowing the type definition of `__time64_t`, apparently. Fixes compilation of fstatat.c on 32-bit x86.
2024-06-05glibc patch: add missing includes for inttypes.hAndrew Kelley
I don't know where glibc thinks uintptr_t is coming from, but here it is.
2024-06-05glibc patch: make fstatat.c and fstatat64.c compileAndrew Kelley
instead of importing every header file under the sun, I copied a couple inline functions into these files to make them work.
2024-06-05glibc patch: inline x86-lp_size.hAndrew Kelley
I could have just included the file from upstream glibc, but it was too silly so I just inlined it. This patch could be dropped in a future glibc update if desired. If omitted it will cause easily solvable C compilation failures building glibc nonshared.
2024-06-05glibc patch: add backwards compatibility for some symbolsMotiejus Jakštys
- `fcntl` was renamed to `fcntl64` in glibc 2.28 (see #9485) - `res_{,n}{search,query,querydomain}` became "their own" symbols since glibc 2.34: they were prefixed with `__` before. This PR makes it possible to use `fcntl` with glibc 2.27 or older and the `res_*` functions with glibc 2.33 or older. These patches will become redundant with universal-headers and can be dropped. But we have to do with what we have now.
2024-06-05update glibc start files to 2.39Andrew Kelley
README file stays intact.
2024-06-05glibc: update abilists fileAndrew Kelley
generated from ziglang/glibc-abi-tool commit fc5d0a7046b76795e4219f8f168e118ec29fbc53 which now contains glibc 2.39
2024-01-04minor cosmetic fixupsAndrew Kelley
* fix typos and redundancies in docs * use Target.isGnuLibc
2024-01-04lib/libc/glibc/: Add README.mdPat Tullmann
Add a README with an overview of how Zig's glibc support is implemented.
2024-01-04glibc: restore "weak_hidden_alias" macro for older glibc versionsPat Tullmann
The fstat,lstat,stat,mknod stubs used to build older (before v2.33) glibc versions depend on the weak_hidden_alias macro. It was removed from the glibc libc-symbols header, so patch it back in for the older builds.
2024-01-04glibc: remove unused stat-related files for 2.33+Kang Seonghoon
Effectively reverts 3dcd3612dca6f649a1e05f558c5d6ed462d2e4a4.
2024-01-04glibc: get correct files compiled into libc_nonshared.aKang Seonghoon
The scope of libc_nonshared.a was greatly changed in glibc 2.33 and 2.34, but only the change from 2.34 was reflected so far. Glibc 2.33 finally switched to versioned symbols for stat functions, meaning that libc_nonshared.a no longer contains them since 2.33. Relevant files were therefore reverted to 2.32 versions and renamed accordingly. This commit also removes errno.c, which was probably added to libc_nonshared.a based on a wrong assumption that glibc/include/errno.h requires glibc/csu/errno.c. In reality errno.h should refer to __libc_errno (not to be confused with the public __errno_location), which should be imported from libc.so. The inclusion of errno.c resulted in wrong compile options as well; this commit fixes them as well. Fixes #16152
2023-10-13glibc patch: remove some static asserts from fstatatAndrew Kelley
These are tripping on 32-bit x86 but are intended to prevent glibc itself from being built with a bad configuration. Zig is only using this file to create libc_nonshared.a, so it's not relevant.
2023-10-13glibc patch: don't check __LIBC macroAndrew Kelley
This is the only place in all of glibc that this macro is referenced. What is it doing? Only preventing fstatat.c from knowing the type definition of `__time64_t`, apparently. Fixes compilation of fstatat.c on 32-bit x86.
2023-10-13glibc patch: add missing includes for inttypes.hAndrew Kelley
I don't know where glibc thinks uintptr_t is coming from, but here it is.
2023-10-13glibc patch: make fstatat.c and fstatat64.c compileAndrew Kelley
instead of importing every header file under the sun, I copied a couple inline functions into these files to make them work.
2023-10-13glibc patch: inline x86-lp_size.hAndrew Kelley
I could have just included the file from upstream glibc, but it was too silly so I just inlined it. This patch could be dropped in a future glibc update if desired. If omitted it will cause easily solvable C compilation failures building glibc nonshared.
2023-10-13glibc patch: add backwards compatibility for some symbolsMotiejus Jakštys
- `fcntl` was renamed to `fcntl64` in glibc 2.28 (see #9485) - `res_{,n}{search,query,querydomain}` became "their own" symbols since glibc 2.34: they were prefixed with `__` before. This PR makes it possible to use `fcntl` with glibc 2.27 or older and the `res_*` functions with glibc 2.33 or older. These patches will become redundant with universal-headers and can be dropped. But we have to do with what we have now.
2023-10-13glibc: update libc-modules.h to 2.38Andrew Kelley
2023-10-13update glibc start files to 2.38Andrew Kelley
I went ahead and left the README.md file deleted because it had broken git hashes. Better to use `git log -- lib/libc/glibc/` to find out the patches.
2023-10-13glibc: update abilists fileAndrew Kelley
generated from the latest commits of ziglang/glibc-abi-tool which contains glibc 2.35, 2.36, 2.37, and 2.38.
2023-05-04glibc hacks: add another commit to our patchesMotiejus Jakštys
2023-03-28glibc compat: add a test and READMEMotiejus Jakštys
2023-03-28glibc: add backwards compatibility for some symbolsMotiejus Jakštys
- `fcntl` was renamed to `fcntl64` in glibc 2.28 (see #9485) - `res_{,n}{search,query,querydomain}` became "their own" symbols since glibc 2.34: they were prefixed with `__` before. This PR makes it possible to use `fcntl` with glibc 2.27 or older and the `res_*` functions with glibc 2.33 or older. These patches will become redundant with universal-headers and can be dropped. But we have to do with what we have now. Closes #9485