Commit graph

33513 commits

Author SHA1 Message Date
Alex Rønne Petersen
dc66f4384f
build: increase test-std max rss 2025-03-27 04:36:27 +00:00
Андрей Краевский
aac800ec65
std.meta.FieldType -> @FieldType 2025-03-27 03:49:38 +00:00
Alex Rønne Petersen
f71590d4c4
build.zig: Statically link LLVM libraries for experimental targets if requested. 2025-03-27 00:31:11 +01:00
Alex Rønne Petersen
09783b8544
ci: Build stage4 and run behavior tests with it on aarch64-linux-debug.
This ensures that we at least have some relatively lightweight coverage of
building and using stage4 from a newly built stage3.
2025-03-27 00:22:54 +01:00
Alex Rønne Petersen
db7db48028
Merge pull request #23339 from Iced-Sun/master
std.posix: update LFS64 interfaces for android bionic C
2025-03-26 23:25:08 +01:00
Alex Rønne Petersen
2489b5fd74
build.zig: Stop setting _WIN32_WINNT=0x601 (Windows 7) when targeting MinGW.
Our default minimum version for Windows has been Windows 10 for a while.
2025-03-26 23:12:55 +01:00
Felix "xq" Queißner
0ed905b9c6 Enables parsing for '-Wl,-rpath,' in pkg-config output, allows better support for NixOS linking. 2025-03-26 22:55:18 +01:00
Alex Rønne Petersen
ccffc7f108
build.zig: Don't disable LTO when targeting MinGW.
We stopped building mingw32.lib with LTO recently, so this is no longer needed.
2025-03-26 22:46:27 +01:00
Pratham
5bb9963bbb
abiAndDynamicLinkerFromFile: return an error when the file is not actually dynamic (#19928) 2025-03-26 19:54:10 +00:00
Alex Rønne Petersen
b9efdbb412
std.process: Fix getBaseAddress() to handle all Darwin OSs. 2025-03-26 20:39:07 +01:00
Alex Rønne Petersen
d56a99442b
std.process: Don't use _mh_execute_header in getBaseAddress() on BSDs.
Only the Mach-O format has this symbol.
2025-03-26 20:39:07 +01:00
Alex Rønne Petersen
0cf5f0d0b0
std.process: Fix getBaseAddress() for linux + libc.
In this case we should use the getauxval() from libc, not our own.
2025-03-26 20:39:07 +01:00
wooster0
263ba34619 linux: don't export getauxval when not required 2025-03-26 20:37:35 +01:00
Eric Joldasov
27c1f2b3a0 zig build: allow to choose "lazy mode" for fetching process
`--fetch` flag now has additional optional parameter, which specifies
how lazy dependencies should be fetched:
 * `needed` — lazy dependencies are fetched only if they are required
   for current build configuration to work. Default and works same
   as old `--fetch` flag.
 * `all` — lazy dependencies are always fetched. If `--system` flag
   is used after that, it's guaranteed that **any** build configuration
   will not require additional download of dependencies during build.
   Helpful for distro packagers and CI systems:
   https://www.github.com/ziglang/zig/issues/14597#issuecomment-1426827495

If none is passed, behaviour is same as if `needed` was passed.

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
2025-03-26 19:00:33 +01:00
Kendall Condon
b4b1daf001
Allocator.create: properly handle alignment for zero-sized types (#21864) 2025-03-26 15:31:57 +00:00
Alex Rønne Petersen
27108cc99e
ci: Don't do the update-zig1 test steps on aarch64-linux.
We already do these on the x86_64-linux machines. They're fairly costly, and it
seems very unlikely to me that they'll uncover issues that wouldn't be uncovered
on x86_64-linux.
2025-03-26 16:30:21 +01:00
Alex Rønne Petersen
628092c8c7
ci: Don't build the compiler for arm-linux-musleabihf on aarch64-linux.
We already do this smoke test on the x86_64-linux machines, so I don't see a
point in duplicating this effort here.
2025-03-26 16:30:02 +01:00
Alex Rønne Petersen
d9165aacce
ci: Set execute bit on aarch64-linux scripts. 2025-03-26 16:30:00 +01:00
dweiller
b84db311d9 zig build: add env_map entries to hash for Step.Run
This change fixes false-positive cache hits for run steps that get run
with different sets of environment variables due the the environment map
being excluded from the cache hash.
2025-03-26 14:48:04 +01:00
孙冰
0118912e2d
std.posix: update LFS64 interfaces for android bionic C 2025-03-26 20:00:05 +08:00
孙冰
d7e944a628
std.Target: Update default Android API level to 24
API level 24 completes _FILE_OFFSET_BITS=64 support in bionic, c.f.
https://android.googlesource.com/platform/bionic/+/HEAD/docs/status.md.

According to https://apilevels.com, API level 24 (Android 7 released in 2017)
has 97% cumulative usage.
2025-03-26 19:48:21 +08:00
Andrew Barchuk
5b4759bd3c Clarify the multidimensional array example
Use a rectangular matrix instead of a square one to distinguish rows and
columns more clearly. Extend the example with row access.
2025-03-26 11:52:52 +01:00
Alex Rønne Petersen
b350049f51
Merge pull request #23062 from ianic/io_uring_bind
io_uring: Update to kernel changes in 6.11 and 6.12
2025-03-26 11:39:56 +01:00
mlugg
a7ff042f98 Zcu: include named tests in resolved references
Oops, a little typo from yours truly! No test for this one, because we
don't have any way of testing the reference trace.
2025-03-26 10:20:19 +00:00
Ryan Liptak
63014d3819 Add test to ensure the BatBadBut mitigation handles trailing . and space safely
Context:
- https://blog.rust-lang.org/2024/09/04/cve-2024-43402.html
- https://github.com/rust-lang/rust/pull/129962

Note that the Rust test case for this checks that it executes the batch file successfully with the proper mitigation in place, while the Zig test case expects a FileNotFound error. This is because of a PATHEXT optimization that Zig does, and that Rust doesn't do because Rust doesn't do PATHEXT appending (it only appends .exe specifically). See the added comment for more details.
2025-03-26 10:55:18 +01:00
Pat Tullmann
2210c4c360 lib/std/posix: test ftruncate via std.fs.File.setEndPos()
Add a test for std.fs.File's `setEndPos` (which is a simple wrapper around
`std.posix.ftruncate`) to exercise some success and failure paths.

Explicitly check that the `ftruncate` length isn't negative when
interpreted as a signed value.  This avoids having to decode overloaded
`EINVAL` errors.

Add errno handling to Windows path to map INVALID_PARAMETER to FileTooBig.

Fixes #22960
2025-03-26 02:57:23 +01:00
Jonathan Marler
1408288b95 support more process creation options on Windows
Adds a CreateProcessFlags packed struct for all the possible flags to
CreateProcessW on windows.  In addition, propagates the existing
`start_suspended` option in std.process.Child which was previously only
used on Darwin.  Also adds a `create_no_window` option to std.process.Child
which is a commonly used flag for launching console executables on
windows without causing a new console window to "pop up".
2025-03-25 23:48:27 +01:00
Arnau Camprubí
8a8b3019f3
Fix std.debug.dumpHex address offsets 2025-03-25 23:20:56 +01:00
Alex Rønne Petersen
cb8d7a8110
Merge pull request #23310 from Rexicon226/fix-23309
big.int: return normalized results from `{add,sub}Carry`
2025-03-25 18:44:35 +01:00
Kuwazy
6b6dc1cd3a
Added check for HTTP version and GET method when upgrading WebSocket to comply with RFC 6455. (#23332) 2025-03-25 15:00:50 +01:00
Alex Rønne Petersen
e1c6af2840
Merge pull request #23220 from samy-00007/bytesAsSlice-fix
Minor fix for `Allocator.remap` and `mem.bytesAsSlice` for zero-sized types
2025-03-25 13:45:10 +01:00
孙冰
fbbdde41b4 std.c: android bionic C supports arc4random_buf and getentropy
1. https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/bits/getentropy.h
2. https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/stdlib.h
2025-03-25 13:17:45 +01:00
Alex Rønne Petersen
c94d926bba
Merge pull request #23007 from rootbeer/posix-eaccess-eperm
lib/std: Make usage of PermissionDenied & AccessDenied consistent
2025-03-25 11:21:05 +01:00
godalming123
5bb4fef30a
Update the documentation comment in arena_allocator.zig to be more accurate
Update the documentation comment in arena_allocator.zig to specify that free() is a no-op unless the item is the most recent allocation.
2025-03-25 06:19:28 +00:00
samy007
4595b1ee06 std.mem.bytesAsSlice: fix to support zero-bytes sized types
also added a test for json parsing of zero sized type
2025-03-24 22:08:05 +01:00
samy007
be483dabc8 fix: Allocator.remap now handles zero-bytes sized types 2025-03-24 22:05:57 +01:00
Chris Clark
525466b49d
std.zig.Ast: Fix error case memory leak in parse() 2025-03-24 20:14:01 +01:00
David Rubin
89db4f2e93 Sema: use unwrapped generic owner in getFuncInstanceIes 2025-03-24 19:04:10 +00:00
Pat Tullmann
14c046fc07 lib/std: PermissionDenied/AccessDenied cleanup and fallout
This PR consistently maps .ACCES into AccessDenied and .PERM into
PermissionDenied.  AccessDenied is returned if the file mode bit
(user/group/other rwx bits) disallow access (errno was `EACCES`).
PermissionDenied is returned if something else denies access (errno was
`EPERM`) (immutable bit, SELinux, capabilities, etc).  This somewhat
subtle distinction is a POSIX thing.

Most of the change is updating std.posix Error Sets to contain both
errors, and then propagating the pair up through caller Error Sets.

Fixes #16782
2025-03-24 16:20:45 +01:00
Pat Tullmann
02373eb2a5 lib/std/: WASI code should follow POSIX semantics for AccessDenied/PermissionDenied
Use error.AccessDenied for permissions (rights) failures on Wasi
(`EACCES`) and error.PermissionDenied (`EPERM`) for systemic failures.
And pass-through underlying Wasi errors (PermissionDenied or AccessDenied)
without mapping.
2025-03-24 16:20:45 +01:00
Pat Tullmann
f304d8e50a windows: Use AccessDenied for ACCESS_DENIED on Windows
Windows defines an `ACCESS_DENIED` error code.  There is no
PERMISSION_DENIED (or its equivalent) which seems to only exist on POSIX
systems.  Fix a couple Windows calls code to return `error.AccessDenied`
for `ACCESS_DENIED` and to stop mapping AccessDenied into
PermissionDenied.
2025-03-24 16:20:45 +01:00
Meghan Denny
972cab5bb0
std: add bit_set.findLastSet() (#22411) 2025-03-24 16:12:23 +01:00
oittaa
c1db72cdbc
std.math: Add least common multiple (lcm) 2025-03-24 16:07:40 +01:00
rpkak
9f8d938d38 DepTokenizer: allow space between target and colon 2025-03-24 15:31:03 +01:00
Pavel Verigo
33ad2c949e stage2-wasm: packed store/load 128 bits 2025-03-24 15:00:00 +01:00
Pavel Verigo
911f4527f0 stage2-wasm: behavior tests pass with ReleaseFast/Small 2025-03-24 15:00:00 +01:00
Pavel Verigo
47cd0961cb stage2-wasm: pass field_parent_ptr tests
Handle packed containers, also fixes packed union lowering for non int type + union field pointer logic fix
2025-03-24 15:00:00 +01:00
Pavel Verigo
58b38238f5 stage2-wasm: enable undef test + ignore undef store/memset with safety off 2025-03-24 15:00:00 +01:00
Pavel Verigo
07f14bd43b stage2-wasm: fix error union handling 2025-03-24 15:00:00 +01:00
Pavel Verigo
0e109add37 stage2-wasm: clean memcpy + fix another bug in aggr_init for optionals arr 2025-03-24 15:00:00 +01:00