Commit Graph

29462 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 b40943e253,
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
c09f5f3795 glibc: add riscv32 and loongarch64 2024-06-05 22:43:53 -07:00
Andrew Kelley
16d65358e9 musl: add missing entry to available_libcs 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
3964b2a315
Merge pull request #20000 from Frojdholm/fix-gpa-crash-when-deallocating-metadata
Fix GeneralPurposeAllocator crash when deallocating metadata
2024-06-05 21:13:58 -04:00
wooster0
aef66eebe3 objcopy build step: don't accept multiple sections
The actual `zig objcopy` does not accept keeping multiple sections.
If you pass multiple `-j .section` arguments to `zig objcopy`, it will
only respect the last one passed.

Originally I changed `zig objcopy` to accept multiple sections
and then concatenate them instead of returning after outputting the
first section (see emitElf) but I realized concatenating probably doesn't make sense.
2024-06-05 19:39:43 -04:00
YANG Xudong
87150468fc generate loongarch64 Linux syscalls 2024-06-05 18:54:14 -04:00
Andrew Kelley
95f0dce7da seriously people, don't put "zig-" in your package names
related #20178
2024-06-05 15:49:47 -07:00
Ryan Liptak
b32aa99b87 File.getOrEnableAnsiEscapeSupport: Do not attempt to set DISABLE_NEWLINE_AUTO_RETURN
Follow up to #20172. Fixes #20188
2024-06-05 18:06:29 -04:00
Michael Dusan
9fe0c1dc50 ld.lld: fix -m option for big-endian arm/aarch64 2024-06-05 18:05:49 -04:00
freakmangd
9bbfb09fc3
translate-c: promote macros that reference var decls to inline functions 2024-06-05 23:06:51 +03:00
Andrew Kelley
8f27fdb84e
Merge pull request #20120 from vahur/move-consts-to-rdata
mark anondecls as constants in llvm ir
2024-06-05 14:24:00 -04:00
Andrew Kelley
8c04ffba86
Merge pull request #20192 from squeek502/fs-handle-leaks
Fix handle leaks in `Dir.makeOpenPathAccessMaskW` and a `fs` test
2024-06-05 13:45:35 -04:00
Andrew Kelley
3b77f23e76
Merge pull request #20194 from ziglang/musl-v1.2.5
upgrade musl to v1.2.5
2024-06-05 13:44:05 -04:00
Andrew Kelley
ac3faa6cb3 LLVM backend: loongarch64 support 2024-06-05 13:43:35 -04:00
Andrew Kelley
46b2f67905 update musl libc.S to v1.2.5
adds loongarch64 and riscv32
2024-06-04 22:37:28 -07:00
Ryan Liptak
016e87e7ef fs tests: Fix leaking a directory handle in "makepath existing directories" test 2024-06-04 19:02:16 -07:00
Ryan Liptak
5490021ab7 Dir.makeOpenPathAccessMaskW: Fix leaking intermediate directory handles
Fixes a regression introduced in 67455c5e70. The `errdefer` cannot run since its not possible for an error to occur, and we don't want it to run on the last handle, so we move the closing back down to where it was before 67455c5e70.
2024-06-04 18:45:25 -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
Frank Denis
332fbb4b02
crypto.edwards25519: add the ability to check for group membership (#20175)
Most of the functions related to points on the Edwards25519 curve
check that input points are not in a small-order subgroup.

They don't check that points are on the prime-order subgroup,
because this is expensive, and not always necessary.

However, applications may require such a check in order to
ensure that a public key is valid, and that a secret key counterpart
exists.

Many functions in the public API of libsodium related to arithmetic
over Edwards25519 also do that check unconditionally. This is
expensive, but a good way to catch bugs in protocols and
implementations.

So, add a `rejectUnexpectedSubgroup()` function to achieve this.

The documentation on the edwards25519->curve25519 conversion
function was also updated, in order to explain how to match
libsodium's behavior if necessary.

We use an addition chain to multiply the point by the order of
the prime group.

An alternative we may implement later is Pornin's point halving
technique: https://eprint.iacr.org/2022/1164.pdf
2024-06-04 10:11:05 +02:00
Frank Denis
993885c040
sha3.keccak: allow Keccak[f=200] (#20181)
We support Keccak[f=200] just fine, so allow it.
2024-06-04 10:10:46 +02:00
Andrew Kelley
7fc3fb955a
Merge pull request #20172 from squeek502/windows-vt-enable
Add `File.getOrEnableAnsiEscapeSupport` and use it
2024-06-03 13:29:23 -04:00
Veikka Tuominen
7f6ec51c8b
Merge pull request #20084 from Vexu/missing-errors
Add missing errors to `@ptrFromInt` and Signal calling convention validation
2024-06-03 14:20:21 +03:00
Ryan Liptak
337f09e932 Add File.getOrEnableAnsiEscapeSupport and use it
On Windows, the console mode flag `ENABLE_VIRTUAL_TERMINAL_PROCESSING` determines whether or not ANSI escape codes are parsed/acted on. On the newer Windows Terminal, this flag is set by default, but on the older Windows Console, it is not set by default, but *can* be enabled (since Windows 10 RS1 from June 2016).

The new `File.getOrEnableAnsiEscapeSupport` function will get the current status of ANSI escape code support, but will also attempt to enable `ENABLE_VIRTUAL_TERMINAL_PROCESSING` on Windows if necessary which will provide better/more consistent results for things like `std.Progress` and `std.io.tty`.

This type of change was not done previously due to a mistaken assumption (on my part) that the console mode would persist after the run of a program. However, it turns out that the console mode is always reset to the default for each program run in a console session.
2024-06-02 16:46:21 -07:00
Meghan Denny
db75a8781b
std.meta.hasUniqueRepresentation: better support packed structs 2024-06-02 23:29:10 +00:00
Garfield Lee
17dc939346 lib/std/fs/File: enable VT seq support for Windows Console
* Newer versions of Windows added VT seq support not only in Windows Terminal, but also in the old-fashioned Windows Console (standalone conhost.exe), though not enabled by default.
* Try setting the newer console mode flags provides better experience for Windows Console users.

Co-authored-by: Kexy Biscuit <kexybiscuit@biscuitt.in>
2024-06-02 15:37:38 -07:00
Carl Åstholm
d74180c373 Replace YES_COLOR with CLICOLOR_FORCE
Instead of introducing YES_COLOR, a completely new standard, into the mix
it might make more sense to instead tag along with the CLICOLOR_FORCE env var,
which dates back to at least 2000 with FreeBSD 4.1.1 and which is
supported by tools like CMake.

<https://bixense.com/clicolors/>
2024-06-02 17:35:34 -04:00
Andrew Kelley
85eb5a3069 std.Progress: fix line upper bound calculation
closes #20161

problem introduced in e09963d854
2024-06-02 17:22:15 -04:00
Andrew Kelley
0c2cd83814 zig run: finish progress node before executing child
also lock stderr for good measure. it's generally a good idea to lock
stderr when you are spawning and waiting for a child that inherits stderr.
2024-06-02 15:27:28 -04:00
Veikka Tuominen
15791b8b1a Sema: validate function signature for Signal calling convention 2024-06-02 21:42:13 +03:00
Veikka Tuominen
17a0458e53 Sema: add missing error for runtime @ptrFromInt to comptime-only type
Closes #20083
2024-06-02 21:42:13 +03:00
Ryan Liptak
2cf8e73781 Progress: Emit \r\n on Windows, include new line bytes in line_upper_bound_len
The \r\n is necessary to get the progress tree to work properly in the old console when ENABLE_VIRTUAL_TERMINAL_PROCESSING and DISABLE_NEWLINE_AUTO_RETURN are set.

The line_upper_bound_len fix addresses part of #20161
2024-06-02 13:04:25 -04:00
Veikka Tuominen
5e1ccd96e5 remove std.Ini 2024-06-02 13:03:29 -04:00
Veikka Tuominen
c01d8c8b20 pass -fno-builtin when testing lib/c.zig, lib/compiler_rt.zig 2024-06-02 10:10:35 +03:00
Veikka Tuominen
06d9f88f97 llvm: disable constant anons on Darwin 2024-06-01 19:32:19 +03:00
koenditor
64ef45eb05 Support Vectors in std.math.clamp 2024-06-01 13:28:16 +03:00
Andrew Kelley
e09963d854 std.Progress: keep the cursor at the beginning
This changes the terminal display to keep the cursor at the top left of
the progress display, so that unlocked stderr writes, perhaps by child
processes, don't get eaten by the clear.
2024-05-31 19:00:14 -04:00