Commit graph

363 commits

Author SHA1 Message Date
Alex Rønne Petersen
7f20b9f9db
musl: Add hexagon-linux-musl headers. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
3df67dc414
musl: Add hexagon-linux-musl sources.
This is from Qualcomm's fork: https://github.com/quic/musl

I maintain a fork of musl where I rebase Qualcomm's changes on top of the latest
musl release, which I then use as the basis for musl updates in Zig. My fork can
be found here: https://github.com/alexrp/musl/tree/hexagon
2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
2174014349
wasi-libc: Remove pointless alltypes.h.in file. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
c2f5515fb0 glibc: Add missing stubs-lp64s.h for loongarch64-linux-gnusf.
https://sourceware.org/bugzilla/show_bug.cgi?id=32776
2025-04-06 14:24:49 +02:00
Alex Rønne Petersen
6667e0fbb4
Revert "glibc: Patch to work around missing features in LLVM's s390x assembler."
This reverts commit b230e4f598.

Closes #21329.
2025-04-04 06:08:10 +02:00
TCROC
d590b87b6f
glibc: fix uninitialized memory in __pthread_cond_s for <=2.40
* https://sourceware.org/bugzilla/show_bug.cgi?id=32786
* https://inbox.sourceware.org/libc-alpha/87zfhpfqsm.fsf@oldenburg.str.redhat.com
2025-03-13 20:23:27 +00:00
Alex Rønne Petersen
bedf806672
Merge pull request #22999 from alexrp/mingw-update 2025-02-25 12:54:55 +01:00
Alex Rønne Petersen
37706cc1d9 libc: Update Linux headers to 6.13.4. 2025-02-25 11:24:18 +01: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
ed10a5db58
mingw: Update MinGW-w64 headers to 3839e21b08807479a31d5a9764666f82ae2f0356. 2025-02-24 11:59:10 +01:00
Alex Rønne Petersen
31f353cd92 musl: Fix typo in m68k clone() assembly. 2025-02-22 08:13:44 +01:00
Alex Rønne Petersen
05d8b565ad wasi-libc: Deduplicate sources and headers with regards to upstream musl.
Unfortunately some duplicate files must remain in lib/libc/wasi/libc-top-half
because they include internal headers *in the same directory* which have edits
relative to upstream musl. Because C is an amazing language, there is no way to
make it so that e.g. upstream musl's src/stdio/fputc.c includes wasi-libc's
src/stdio/putc.h instead of the upstream putc.h. The preprocessor always
searches the current directory first for quote includes.

Anyway, this still takes us from 2.9M to 1.4M for the combination of
lib/libc/wasi and lib/libc/include/wasm-wasi-musl, so I still call it a win.
2025-02-21 09:23:50 +01:00
Alex Rønne Petersen
8a3aebaee0 musl: Apply Rich Felker's CVE-2025-26519 mitigation patches.
https://www.openwall.com/lists/oss-security/2025/02/13/2

Closes #22883.
2025-02-14 06:42:57 +01:00
Hugo Beauzée-Luyssen
462d26171b glibc: don't redirect fts to fts64 before glibc 2.23 2025-02-14 02:11:26 +01:00
Andrew Kelley
1d8857bbe3
Merge pull request #22695 from alexrp/glibc-2-41
glibc 2.41
2025-02-10 17:32:55 -08:00
Andrew Kelley
ea1ce2df9b
Merge pull request #22808 from ziglang/fast-gpa
introduce std.heap.SmpAllocator
2025-02-08 04:54:38 -08:00
Alex Rønne Petersen
975cd9fc4f
musl: Align the stack pointer given to clone() on riscv. 2025-02-08 05:31:56 +01:00
Hugo Beauzée-Luyssen
a06a7108c8 generic glibc: guard memfd_create & mlock2 declarations
They were introduced in glibc 2.27
2025-02-08 01:02:28 +01:00
Hugo Beauzée-Luyssen
edee702a7f
generic glibc: guard pidfd_spawn(p) declarations 2025-02-06 18:00:45 +01:00
Hugo Beauzée-Luyssen
9d85c79f2f
generic glibc: guard pidfd function declarations
They were introduced in 2.36 & 2.39
2025-02-06 18:00:44 +01:00
Hugo Beauzée-Luyssen
e716d13555
generic glibc: guard definitions of functions introduced in 2.36 2025-02-06 18:00:43 +01:00
Hugo Beauzée-Luyssen
5d2584e53e
generic glibc: guard statx declaration
It was added in glibc 2.28
2025-02-06 10:08:12 +01:00
Hugo Beauzée-Luyssen
fdef5c564d
generic glibc: guard close_range declaration
It is only available starting from glibc 2.34
2025-02-06 10:08:12 +01:00
Alex Rønne Petersen
a5b8a2938d
glibc: Update abilists file to 2.41. 2025-01-31 14:38:23 +01:00
Alex Rønne Petersen
5702d67af6
glibc: Update source files to 2.41. 2025-01-31 14:38:21 +01:00
Alex Rønne Petersen
2ba137b02b
glibc: Update header files to 2.41. 2025-01-31 14:30:32 +01:00
Frank Denis
e60072635e
Add libdl shims from wasi-libc 2025-01-29 12:48:56 +01:00
Frank Denis
8a8da49b52
Re-add lazy preopen changes 2025-01-29 11:54:08 +01:00
Frank Denis
3f4c43b0aa
Update wasi-libc to d03829489904d38c624f6de9983190f1e5e7c9c5 2025-01-29 11:54:02 +01:00
Alex Rønne Petersen
b3d9b0e3f6 musl: Manually inline __tls_get_addr into s390x __tls_get_offset.
See these mailing list threads:

* https://www.openwall.com/lists/musl/2024/11/23/3
* https://www.openwall.com/lists/musl/2025/01/24/1

This supplants cc73d7ad74.
2025-01-24 20:02:30 +01:00
Andrew Kelley
b31a2c9555
Merge pull request #22541 from ziglang/pipeline
Compilation pipeline: spawn Jobs earlier that produce linker inputs
2025-01-21 14:27:05 -05:00
Alex Rønne Petersen
f1f269c6ee libc: Remove a bunch of code for architectures we don't actually support.
Namely:

* alpha
* hppa
* ia64
* microblaze
* nios2
* or1k
* s390
* sh
2025-01-21 09:30:16 +01:00
Andrew Kelley
f5485a52bc reject crti.o/crtn.o, embrace the future
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.
2025-01-20 20:59:52 -08:00
Andrew Kelley
b07958e6b7 delete asm files from wasi libc
why the hell are there asm files in wasi libc to begin with?
2025-01-17 12:34:15 -08:00
Andrew Kelley
e6dc85f1b4 remove memcpy and memmove from bundled libcs
These are provided instead by compiler_rt.

Part of #2879
2025-01-17 12:34:15 -08: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
6066e7bfd1
std.zig.target: Remove wasm32-freestanding-musl.
This is, at least today, a very broken target: It doesn't actually build either
musl or wasi-libc even if you use -lc. It does give you musl headers, but that's
it. Those headers are not terribly useful, however, without any implementation
code. You can sort of call some math functions because they just so happen to
have implementations in compiler-rt. But that's only true for a small subset,
and I don't think users should be relying on the ABI surface of a library that
is an implementation detail of the compiler.

Clearly, a freestanding-capable libc of sorts is a useful thing as evidenced by
newlib, picolibc, etc existing. However, calling it "musl" is misleading when it
isn't actually musl-compatible, nor can it ever be because the musl API surface
is inextricably tied to the Linux kernel. In the discussion on #20690, there was
agreement that once we split up the API and ABI components in the target string,
the API component should be about compatibility, not whether you literally get a
particular implementation of it. Also, we decided that Linux musl and wasi-libc
musl shouldn't use the same API tag precisely because they're not actually
compatible.

(And besides, how would any syscall even be implemented in freestanding? Who or
what would we be calling?)

So I think we should remove this triple for now. If we decide to reintroduce
something like this, especially once #2879 gets going, we should come up with a
bespoke name for it rather than using "musl".
2024-12-15 12:25:12 +01:00
Alex Rønne Petersen
45fff0a511
mingw: Update sources to dcd7fefc703fb4b12187235386900d34cc13fdc5. 2024-12-14 07:02:14 +01:00
Alex Rønne Petersen
87083e8e7e
mingw: Update headers to dcd7fefc703fb4b12187235386900d34cc13fdc5. 2024-12-14 07:02:12 +01:00
Michael Dusan
a68119f8f1 macos: vendored libc: bump to SDK 15.1 2024-12-13 03:55:54 +01:00
Alex Rønne Petersen
c666ebb1f8
musl: Add unwinding protection in clone() implementations.
Whatever was in the frame pointer register prior to clone() will no longer be
valid in the child process, so zero it to protect FP-based unwinders. This is
just an extension of what was already done for i386 and x86_64. Only applied
to architectures where the _start() code also zeroes the frame pointer.
2024-12-11 00:10:17 +01:00
Alex Rønne Petersen
67e524da54
musl: Update libc.S against musl 1.2.5.
All supported architectures included except for x32 (currently broken).
2024-11-23 03:10:58 +01:00
Alex Rønne Petersen
cc73d7ad74
musl: Mark __tls_get_addr as hidden before invoking it on s390x.
https://www.openwall.com/lists/musl/2024/11/23/3
2024-11-23 03:10:54 +01:00
Alex Rønne Petersen
4972a871c5
musl: Mark __restore(_rt) functions hidden on riscv.
https://www.openwall.com/lists/musl/2024/11/23/2
2024-11-23 01:24:35 +01:00
Alex Rønne Petersen
ea26af0b9d
musl: Set symbol type for the START function on i386 and x86_64.
https://www.openwall.com/lists/musl/2024/11/23/1
2024-11-23 01:23:02 +01:00
Alex Rønne Petersen
50cae505f7
glibc: Fix an LP_SIZE redefinition warning for gnux32. 2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
ec0e6440b1
musl: Update sources from musl 1.2.5.
Adds mipsn32 and x32 sources.

Also remove some useless .in files.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
3ec27ae648
musl: Update headers from musl 1.2.5.
Adds mips64-linux-muslabin32 and x86_64-linux-muslx32 headers.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
92ae5818d2 musl: Align _init/_fini symbols correctly on arm.
See upstream patch: https://www.openwall.com/lists/musl/2024/10/10/4
2024-10-11 03:20:39 +02:00
Alex Rønne Petersen
4cc1b060eb
glibc: Update abilists file for loongarch64-linux-gnusf support.
Also a 269 KB -> 240 KB size reduction due to the new format version.
2024-10-03 04:39:39 +02:00