Commit graph

366 commits

Author SHA1 Message Date
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 3dcd3612dc.
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 b40943e253,
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
Andrew Kelley
2314051aca update glibc start files to 2.38
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-13 17:44:27 -07:00
Andrew Kelley
f458c13494 glibc: update abilists file
generated from the latest commits of ziglang/glibc-abi-tool which
contains glibc 2.35, 2.36, 2.37, and 2.38.
2023-10-13 17:44:27 -07:00
Michael Dusan
5d6521d281
macos: better SDK version detection
SDK version detection:
- read SDKSettings.json before inferral from SDK path
- vendored libc: add SDKSettings.json for SDK version info

resolveLibSystem:
- adjust search order to { search_dirs, { sysroot or vendored }}
- previous search order was { sysroot, search_dirs, vendored }
2023-09-25 15:53:05 -04:00
Michael Dusan
52e8354926
macos: vendored libc: combine headers: part 1
- combine *-macos-* → any-macos-any
- SDK headers as a single tree support targeting multiple arch/versions
- bump to SDK 14.0 (release candidate)
2023-09-25 15:53:05 -04:00
Jakub Konka
ddf5859c22 macos: add <paths.h> header to Zig shipped libc 2023-08-19 14:23:00 +02:00
Andrew Kelley
09c7f1bd7c musl: update libc.S to v1.2.4 2023-06-20 12:55:38 -04:00
Andrew Kelley
a5d8c310ee musl: update src files to v1.2.4 2023-06-20 12:55:38 -04:00
Andrew Kelley
928c4c9bd3 musl: update headers to v1.2.4 2023-06-20 12:55:38 -04:00
Andrew Kelley
6bd93ef4eb update linux kernel headers to 6.3.8 2023-06-15 12:04:36 -07:00
Jakub Konka
7e0a02ee25 macos+libc: add zlib.h,sys/paths.h,netinet/{ip.h,udp.h} 2023-06-04 16:37:53 +02:00
Frank Denis
dcc1b4fd15
Update wasi-libc to 3189cd1ceec8771e8f27faab58ad05d4d6c369ef (#15817)
Also remove all the wasi-libc files we used to ship, but never compile.

The latest wasi-libc HEAD has an extra commit (a6f871343313220b76009827ed0153586361c0d5), which makes preopen initialization lazy.

Unfortunately, that breaks quite a lot of things on our end. Applications now need to explicitly call __wasilibc_populate_preopens() everywhere when the libc is linked. That can wait after 0.11.
2023-05-23 22:12:53 +02:00
Motiejus Jakštys
892d4e1302 glibc hacks: add another commit to our patches 2023-05-04 10:36:37 +03:00
Motiejus Jakštys
3eaca9bbc6 glibc hacks: also add a few dn_* functions 2023-05-04 10:36:05 +03:00
Jakub Konka
35f9c84449 macos: add missing getopt.h header 2023-04-13 00:19:33 +02:00
Andrew Kelley
13aa7871b2
Merge pull request #15101 from motiejus/glibc_compat
glibc: add backwards compatibility for some symbols
2023-04-06 17:15:58 -04:00
Jakub Konka
381dc2d950
Merge pull request #15139 from ziglang/macos-13-fixes
Fixes for latest macOS 13.3 SDK release
2023-04-01 14:22:29 +02:00
Jakub Konka
a0a854b1fc libc: update macOS libSystem.13.tbd 2023-04-01 08:33:13 +02:00
Jakub Konka
26c88e4f45 libc: update macOS libc headers to latest SDK 13.3 2023-03-31 21:20:47 +02:00
Jakub Konka
23cf44c227 libc: add missing sys/timex.h to macOS libc headers 2023-03-31 12:36:38 +02:00
Motiejus Jakštys
652e8cf864 glibc compat: add a test and README 2023-03-28 22:29:20 +03:00
Motiejus Jakštys
7e6aeead85 glibc: 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.

Closes #9485
2023-03-28 20:35:08 +03:00