287 Commits

Author SHA1 Message Date
Andrew Kelley
4c068c3be1 glibc patch: inline x86-lp_size.h
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-05 22:43:53 -07:00
Motiejus Jakštys
9e76385afc glibc patch: add backwards compatibility for some symbols
- `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-05 22:43:53 -07:00
Andrew Kelley
ad34de32a8 update glibc start files to 2.39
README file stays intact.
2024-06-05 22:43:53 -07:00
Andrew Kelley
53137050f8 glibc: update abilists file
generated from ziglang/glibc-abi-tool commit
fc5d0a7046b76795e4219f8f168e118ec29fbc53 which now contains glibc 2.39
2024-06-05 22:43:53 -07:00
Markus F.X.J. Oberhumer
4c2e57d406 glibc: use __GLIBC_USE_DEPRECATED_SCANF for glibc versions < 2.7 2024-06-05 22:43:53 -07:00
Markus F.X.J. Oberhumer
a8db261ebb glibc: move __GLIBC__ version defines to the top of the file 2024-06-05 22:43:53 -07:00
Pat Tullmann
95a9053363 glibc: strlcpy and strlcat arrived in glibc 2.38
So only expose these in generic-glibc/string.h if Zig is building
a v2.38 (or later) glibc stub.

Announcement of 2.38 that notes strlcpy and strlcat:
https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00010.html
2024-06-05 22:43:53 -07:00
Pat Tullmann
8a82496520 glibc headers: reallocarray added to glibc in v2.26
Here's the glibc commit that adds reallocarray to glibc:
https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da

The reallocarray symbol is declared in both stdlib.h and malloc.h.

Fix #17607
2024-06-05 22:43:53 -07:00
Xavier Bouchoux
9f9fa2df93 glibc patch: add backwards compatibility for strtol-family functions
following suit from b40943e253c079ec3de1b149dd2ef0ccc3da38a4,
add a version guard in addition to the ISOC2X check.
2024-06-05 22:43:53 -07:00
Motiejus Jakštys
7c4bf07060 glibc patch: add a few dn_* functions
This is necessary to build glib.
2024-06-05 22:43:53 -07:00
Motiejus Jakštys
5af14711a8 glibc patch: add backwards compatibility for some symbols
- `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-05 22:43:53 -07:00
Andrew Kelley
a4a88e441f glibc patch: version-gate _DYNAMIC_STACK_SIZE_SOURCE
This is a patch to glibc features.h which makes
_DYNAMIC_STACK_SIZE_SOURCE undefined unless the version is >= 2.34.

This feature was introduced with glibc 2.34 and without this patch, code
built against these headers but then run on an older glibc will end up
making a call to sysconf() that returns -1 for the value of SIGSTKSZ
and MINSIGSTKSZ.
2024-06-05 22:43:53 -07:00
Andrew Kelley
cbe9923c22 glibc patch: don't hardcode __GLIBC_MINOR__
Instead Zig passes it based on the target.
2024-06-05 22:43:53 -07:00
Andrew Kelley
8a4f583bb5 update glibc headers to 2.39 2024-06-05 22:43:53 -07:00
Andrew Kelley
46b2f67905 update musl libc.S to v1.2.5
adds loongarch64 and riscv32
2024-06-04 22:37:28 -07:00
Andrew Kelley
0098e650fb update musl source files to v1.2.5
adds loongarch64 and riscv32
2024-06-04 16:54:14 -07:00
Andrew Kelley
85a46ee520 update musl headers to v1.2.5
adds loongarch64 and riscv32
2024-06-04 16:54:11 -07:00
Elaine Gibson
add74427b9 mingw: support -municode 2024-03-27 10:05:57 +00:00
Markus F.X.J. Oberhumer
fc72630d0f glibc: use __GLIBC_USE_DEPRECATED_SCANF for glibc versions < 2.7 2024-01-25 15:29:36 +01:00
Markus F.X.J. Oberhumer
c63216441c glibc: move __GLIBC__ version defines to the top of the file 2024-01-25 15:29:36 +01: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
Andrew Kelley
9df0177f33 mingw: add the mingw stdio functions back
We would rather use the ucrt for these, but sometimes dependencies on
the mingw stdio functions creep in. 仕方ない.

The cost is only paid if they are used; otherwise the symbols are
garbage-collected at link time.
2024-01-08 11:52:38 -07:00
Andrew Kelley
6405d37d9f add config.h 2024-01-08 11:52:38 -07:00
Andrew Kelley
c26bace606 mingw-w64: update CRT files to latest git commit
Upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

* adds ucrtbase.def.in
* mingwex: replace mingw crt files with ucrt files
* adds missing mingw-w64 ucrt files

The rules that govern which set of files are included or excluded is
contained in the logic for tools/update_mingw.zig
2024-01-08 11:52:38 -07:00
Andrew Kelley
9346cd38e8 update mingw-w64 headers to latest git commit
Upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

Martin Storsjö suggested synchronizing with git snapshots rather than
waiting for tagged releases. Let's try this for a few releases of Zig
and see how we like it.

These headers were configured with `--with-default-msvcrt=ucrt`.

See related issue #18477.
2024-01-08 11:52:37 -07:00
Andrew Kelley
362460ec24 minor cosmetic fixups
* fix typos and redundancies in docs
* use Target.isGnuLibc
2024-01-04 17:26:06 -07:00
Pat Tullmann
4a5d73a34d glibc: strlcpy and strlcat arrived in glibc 2.38
So only expose these in generic-glibc/string.h if Zig is building
a v2.38 (or later) glibc stub.

Announcement of 2.38 that notes strlcpy and strlcat:
https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00010.html
2024-01-04 17:12:07 -07:00
Pat Tullmann
71e809852c lib/libc/glibc/: Add README.md
Add a README with an overview of how Zig's glibc support is implemented.
2024-01-04 17:12:07 -07:00
Pat Tullmann
2c6372a117 glibc: restore "weak_hidden_alias" macro for older glibc versions
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-04 17:12:07 -07:00
Kang Seonghoon
f1bd218a88 glibc: remove unused stat-related files for 2.33+
Effectively reverts 3dcd3612dca6f649a1e05f558c5d6ed462d2e4a4.
2024-01-04 17:12:07 -07:00
Kang Seonghoon
7dcf7412c4 glibc: get correct files compiled into libc_nonshared.a
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
2024-01-04 17:12:07 -07:00
Andrew Kelley
94cee4fb27 mingw-w64: add shcore def files
these are copied from mingw-w64 v10.0.0
2023-11-02 12:20:09 -07:00
Pat Tullmann
1631dc923d glibc headers: reallocarray added to glibc in v2.26
Here's the glibc commit that adds reallocarray to glibc:
https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da

The reallocarray symbol is declared in both stdlib.h and malloc.h.

Fix #17607
2023-10-20 06:45:24 -04:00
Xavier Bouchoux
0afead5651 glibc patch: add backwards compatibility for strtol-family functions
following suit from b40943e253c079ec3de1b149dd2ef0ccc3da38a4,
add a version guard in addition to the ISOC2X check.
2023-10-16 22:43:28 +02:00
Andrew Kelley
701ef1f8c2 glibc patch: remove some static asserts from fstatat
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-13 19:32:54 -07:00
Andrew Kelley
0b16500604 glibc patch: don't check __LIBC macro
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-13 19:31:57 -07:00
Andrew Kelley
6d8b7e95b5 glibc patch: add missing includes for inttypes.h
I don't know where glibc thinks uintptr_t is coming from, but here it
is.
2023-10-13 18:12:00 -07:00
Andrew Kelley
50e18343a9 glibc patch: make fstatat.c and fstatat64.c compile
instead of importing every header file under the sun, I copied a couple
inline functions into these files to make them work.
2023-10-13 18:06:12 -07:00
Andrew Kelley
89aa63bec7 glibc patch: inline x86-lp_size.h
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-13 18:03:00 -07:00
Motiejus Jakštys
b7e5a31d79 glibc patch: add a few dn_* functions
This is necessary to build glib.
2023-10-13 17:44:27 -07:00
Motiejus Jakštys
b40943e253 glibc patch: add backwards compatibility for some symbols
- `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-13 17:44:27 -07:00
Andrew Kelley
f9c9ae84c6 glibc patch: version-gate _DYNAMIC_STACK_SIZE_SOURCE
This is a patch to glibc features.h which makes
_DYNAMIC_STACK_SIZE_SOURCE undefined unless the version is >= 2.34.

This feature was introduced with glibc 2.34 and without this patch, code
built against these headers but then run on an older glibc will end up
making a call to sysconf() that returns -1 for the value of SIGSTKSZ
and MINSIGSTKSZ.
2023-10-13 17:44:27 -07:00
Andrew Kelley
4bfa18b07f glibc patch: don't hardcode __GLIBC_MINOR__
Instead Zig passes it based on the target.
2023-10-13 17:44:27 -07:00
Andrew Kelley
8d3892b755 update glibc headers to 2.38 2023-10-13 17:44:27 -07:00
Andrew Kelley
4a3002848c glibc: update libc-modules.h to 2.38 2023-10-13 17:44:27 -07:00