9044 Commits

Author SHA1 Message Date
Shane Peelar
ec337051a9 Fix slight deviation from spec in handling Elf*_Rela relative relocations
`Elf*_Rela` relocations store their argument in `r_addend`, including for `R_*_RELATIVE` relocations.  Unlike `Elf*_Rel` relocations, they are not applied as a delta to the destination virtual address.  Instead, they are computed from `base_address + r_addend` directly.
2024-06-08 16:02:47 -04:00
Andrew Kelley
7ae9d8089d
Merge pull request #19007 from rootbeer/glibc-c-test
test/link/glibc_compat: Add C test case for glibc versions
2024-06-08 15:57:35 -04:00
Ryan Liptak
65cad8ab13 Fix index-of-out-bounds when no versions are found in the sdk lib dir
The current code wrongly assumes that versions[0] will always exist after the iterateAndFilterByVersion call.
2024-06-08 15:36:21 -04:00
Igor Anić
45b62c4529 io_uring: don't assume completions order
We are posting two submission (zero copy send and receive) and then
reading two completions. There is no guarantee that those completions
will be in the order of submissions.
This test was expecting fist send completion then receive.
Fix is allowing them to come other way too.
2024-06-08 15:35:41 -04:00
Ekin Dursun
0ba64e9ce3 Add ECONNREFUSED to sendto 2024-06-08 15:35:00 -04:00
Krzysztof Wolicki
6327a3994a
std.Build: remove deprecated b.host in favor of b.graph.host (#20237) 2024-06-08 12:22:38 -07:00
MrDmitry
84d1580873 Report error on missing values for addConfigHeader 2024-06-08 15:18:56 -04:00
Ben Crist
a9e9c9965d
Build system: Support Windows depfiles with unquoted, backslash escaped spaces (#20100) 2024-06-06 18:40:10 +00:00
Andrew Kelley
63754916c5 disable failing IoUring test
tracked by #20212
2024-06-06 11:13:22 -07:00
Pat Tullmann
ed795a907d target.zig: Constrain aarch64 to glibc version 2.17 or later
Had constrained the `aarch64_be` target, but not `aarch64`.  This
constraint is necessary because earlier versions of glibc do not support
the aarch64 architecture.

Also, skip unsupported test cases.
2024-06-06 09:36:16 -07:00
Maciej 'vesim' Kuliński
a4e01074b5 Add support for []enum in Build.option 2024-06-06 12:27:29 -04:00
Andrew Kelley
1118ea2e34 glibc: add min version annotation for riscv32 and loongarch64 2024-06-05 22:43:54 -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
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
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
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
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 67455c5e70e86dbb7805ff9a415f1b13b14f36da. 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 67455c5e70e86dbb7805ff9a415f1b13b14f36da.
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
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
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 e09963d8544c19812db20e520f09f6e5d9a57d64
2024-06-02 17:22:15 -04: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
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
Andrew Kelley
4918c2ce2d std.Build.Step.Run: global lock when child inherits stderr
The docs for setting stdio to "inherit" say:

It also means that this step will obtain a global lock to prevent other
steps from running in the meantime.

The implementation of this lock was missing but is now provided by this
commit.

closes #20119
2024-05-31 18:59:53 -04:00
Andrew Kelley
c564a16a01 std.Progress: IPC fixes
Reduce node_storage_buffer_len from 200 to 83. This makes messages over
the pipe fit in a single packet (4096 bytes). There is now a comptime
assert to ensure this. In practice this is plenty of storage because
typical terminal heights are significantly less than 83 rows.

Handling of split reads is fixed; instead of using a global
`remaining_read_trash_bytes`, the value is stored in the "saved
metadata" for the IPC node.

Saved metadata is split into two arrays so that the "find" operation can
quickly scan over fds for a match, looking at 332 bytes maximum, and
only reading the memory for the other data upon match. More typical
number of bytes read for this operation would be 0 (no child processes),
4 (1 child process), or 64 (16 child processes reporting progress).

Removed an align(4) that was leftover from an older design.

This also includes part of Jacob Young's not-yet-landed patch that
implements `writevNonblock`.
2024-05-31 04:06:12 -04:00
George Thayamkery
30a35a897f not android check on std.debug.getContext
have_getcontext must be false for android, this makes sure that
std.debug.getContext wont call the non-existant function (and thus hit a
compileError)
2024-05-31 01:25:49 +03:00
Manlio Perillo
e54fcdb5b2 std/math: import "math/float.zig" only once
math.zig imported the "math/float.zig" file multiple time, making the
code unnecessarily more verbose.
2024-05-30 19:57:24 +03:00
expikr
103b885fc6
math.hypot: fix incorrect over/underflow behavior (#19472) 2024-05-30 09:58:05 +00:00
Andrew Kelley
3b77f1ed7e rename zig-cache to .zig-cache
closes #20077
2024-05-29 10:20:15 -07:00
Ryan Liptak
d750a78b2c std.Progress: Fix Windows console API implementation
3a3d2187f986066859cfb793fb7ee1cae4dfea08 unintentionally broke some of the Windows console API implementation.

- The 'marker' character was no longer being written at all
- The ANSI escape codes for syncing were being written unconditionally
2024-05-28 22:46:12 -04:00
T. M
3518d22d56 std: Avoid overflowing in the midpoint calculation in upperBound 2024-05-28 20:44:42 -04:00
Linus Groh
b5e99b5295 std.Build.step.Compile: Fix lib{c,cpp} mixup in dependsOnSystemLibrary() 2024-05-28 20:39:42 -04:00
Andrew Kelley
3a3d2187f9 std.Progress: better Windows support
* Merge a bunch of related state together into TerminalMode. Windows
  sometimes follows the same path as posix via ansi_escape_codes,
  sometimes not.
* Use a different thread entry point for Windows API but share the same
  entry point on Windows when the terminal is in ansi_escape_codes mode.
* Only clear the terminal when the stderr lock is held.
* Don't try to clear the terminal when nothing has been written yet.
* Don't try to clear the terminal in IPC mode.
* Fix size detection logic bug under error conditions.
2024-05-28 12:31:10 -07:00
Ryan Liptak
40afac40b8 std.Progress: Use Windows console API calls when ANSI escape codes are not supported 2024-05-28 10:41:07 -07:00
Andrew Kelley
65a0e14e4f std.Progress: relax some of the atomic orderings
Generates better machine code, particularly on ARM
2024-05-27 20:56:49 -07:00