29112 Commits

Author SHA1 Message Date
Matthew Lugg
88146ea704 std.process.Child: prevent racing children from inheriting one another's pipes
The added comment explains the issue here relatively well. The new
progress API made this bug obvious because it became visibly clear that
certain Compile steps were seemingly "hanging" until other steps
completed. As it turned out, these child processes had raced to spawn,
and hence one had inherited the other's stdio pipes, meaning the `poll`
call in `std.Build.Step.evalZigProcess` was not identifying the child
stdout as closed until an unrelated process terminated.
2024-06-06 10:43:14 -07:00
Jacob Young
6e469bc44d EnumMap: fix init 2024-06-06 10:41:03 -07:00
Andrew Kelley
2d4b264527 std autodocs server: don't trim all URLs
This is a partial revert of 6635360dbdbd6793b741648d51d25f12550e01db.
2024-05-22 07:18:14 -07:00
Veikka Tuominen
95845ba2ac llvm: fix @wasmMemory{Size,Grow} for wasm64
Closes #19942
2024-05-22 07:17:50 -07:00
Jiacai Liu
4a09703f62 std-docs: use open for macOS. 2024-05-22 07:15:30 -07:00
Andrew Kelley
82908b525d Merge pull request #19987 from Frojdholm/fix-gpa-double-free-stack-traces
gpa: Fix GeneralPurposeAllocator double free stack traces
2024-05-22 07:05:17 -07:00
Wes Koerber
aba1dbc954 fix: incorrect field sizes in std.os.linux.ifmap 2024-05-22 07:04:56 -07:00
Andrew Kelley
6ce3c2423e Merge pull request #19926 from squeek502/windows-sdk-cachepath-registry
WindowsSdk: Fix finding the _Instances directory when it's not in the default location
2024-05-22 07:04:47 -07:00
Ronald Chen
52150b701c [std] Fixed bug missing optional for lpName param on CreateEventExW. fixes #19946
https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventexw
2024-05-22 07:04:35 -07:00
Dominic
869880adac astgen: fix result info for catch switch_block_err_union 2024-05-22 07:04:01 -07:00
190n
511aa28983 Do not run asserts for WASI alignment when not targeting WASI 2024-05-22 07:03:54 -07:00
Lucas Santos
e57c9c0931 Avoid unnecessary operation in PageAllocator.
There's no need to call `alignForward` before `VirtualAlloc`.
From [MSDN](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc):
```
If the lpAddress parameter is NULL, this value is rounded up to the next page boundary
```
2024-05-22 07:03:25 -07:00
Abhinav Gupta
d37182383d ChildProcess: document StdIo behaviors (#17553)
Add some basic documentation for the different ChildProcess.StdIo
behaviors and the fields they affect.
2024-05-22 07:03:09 -07:00
Veikka Tuominen
1216050520 define an error set for std.io.tty.Config.setColor 2024-05-22 07:02:54 -07:00
Pyry Kovanen
8832314acf llvm: always include debug information for global variables 2024-05-22 07:02:27 -07:00
Karl Bohlmark
4616fb0937 fix integer overflow in IoUring buffer ring size calculation 2024-05-22 07:02:23 -07:00
Pavel Verigo
fa4a626fac std.compress.flate: fix panic when reading into empty buffer 2024-05-22 07:02:16 -07:00
Jacob Young
33c3bf0631 cmake: make static curses configurable
Not sure why this exists in the first place, but disabling it reduces
the required dependencies of a CI runner.
2024-05-22 07:01:21 -07:00
Jacob Young
2563d32425 fs: handle OBJECT_NAME_COLLISION in makeOpenPath
This fixes a race condition when two threads/processes try to
`makeOpenPath` the same path simultaneously.
2024-05-22 07:01:14 -07:00
mlugg
33809a0c53 InternPool: eliminate var_args_param_type
This was a "fake" type used to handle C varargs parameters, much like
generic poison. In fact, it is treated identically to generic poison in
all cases other than one (the final coercion of a call argument), which
is trivially special-cased. Thus, it makes sense to remove this special
tag and instead use `generic_poison_type` in its place. This fixes
several bugs in Sema related to missing handling of this tag.

Resolves: #19781
2024-05-22 07:01:07 -07:00
Jacob Young
2648e3651e link: restore lost passthrough behavior
Fixes bug introduced by 3b5be9fb6e06f6494ca05fb087a2121e220beb3f
2024-05-22 07:00:19 -07:00
Jacob Young
d09afc08da lld: use a response file on NameTooLong 2024-05-22 06:59:22 -07:00
Ryan Liptak
ddde99bdfa Build system: Allow specifying Win32 resource include paths using LazyPath
Adds an `include_paths` field to RcSourceFile that takes a slice of LazyPaths. The paths are resolved and subsequently appended to the -rcflags as `/I <resolved path>`.

This fixes an accidental regression from https://github.com/ziglang/zig/pull/19174. Before that PR, all Win32 resource compilation would inherit the CC flags (via `addCCArgs`), which included things like include directories. After that PR, though, that is no longer the case.

However, this commit intentionally does not restore the previous behavior (inheriting the C include paths). Instead, each .rc file will need to have its include paths specified directly and the include paths only apply to one particular resource script. This allows more fine-grained control and has less potentially surprising behavior (at the cost of some convenience).

Closes #19605
2024-05-22 06:58:09 -07:00
reokodoku
f2110b0c0d Change std.os to std.posix in error messages 2024-05-22 06:57:16 -07:00
Anton Lilja
7ce03acb9d LLVM: Fix panic when using tagged union backed by enum with negative values 2024-05-22 06:56:49 -07:00
Antonio Gomes
c3aa32e984 Sema: Don't generate runtime instructions on zirSplat if dest_ty doesn't have runtime bits 2024-05-22 06:56:30 -07:00
Igor Anić
efe06c5f31 std.tar: fix finding tar root_dir (#19829)
For issue #19820.
2024-05-01 12:05:29 -07:00
Jacob Young
7b908cb024 cbe: fix ub with integer @abs 2024-05-01 12:05:25 -07:00
Andrew Kelley
16d3f7b2fa std.Build.Step.CheckObject: fix parseDumpNames
This function incorrectly assumed that module name subsections, function
name subsections, and local name subsections are encoded the same,
however according to
[the specification](https://webassembly.github.io/spec/core/appendix/custom.html)
they are encoded differently.

This commit adds support for parsing module name subsections correctly,
which started appearing after upgrading to LLVM 18.
2024-05-01 12:05:20 -07:00
Andrew Kelley
fa5011aa31 C backend: avoid memcpy when len=0
As of Clang 18, calling memcpy() with a misaligned pointer trips UBSAN,
even if the length is zero. This unfortunately includes any call to
`@memcpy` when source or destination are undefined and the length is
zero.

This patch makes the C backend avoid calling memcpy when the length is
zero, thereby avoiding undefined behavior.

A zig1.wasm update will be needed in the llvm18 branch to activate this
code.
2024-05-01 12:05:12 -07:00
Alain Greppin
595a7f8b08 NetBSD: avoid ldd error on executables. zig cc produce 4 PT_LOAD segments,
wheras on NetBSD, only 2 PT_LOAD are usually produced by other compilers
(tested with host gcc and clang).

    $ ldd -v main_4segs
    .../main_4segs: wrong number of segments (4 != 2)
    .../main_4segs: invalid ELF class 2; expected 1
2024-05-01 12:05:05 -07:00
daurnimator
6c482b8033 test/link/glibc_compat: fix incorrect strlcpy result 2024-05-01 12:04:52 -07:00
Julian
ad63be7eb9 Sema+llvm: properly implement Interrupt callconv
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2024-05-01 12:04:44 -07:00
Alexandre Janon
704f8f4013 Fix ELF alignment for freestanding targets (#19766)
* Fix the ELF binaries for freestanding target created with the self-hosted linker.

    The ELF specification (generic ABI) states that ``loadable process segments must have congruent
    values for p_vaddr and p_offset, modulo the page size''. Linux refuses to load binaries that
    don't meet this requirement (execve() fails with EINVAL).
2024-05-01 12:04:19 -07:00
zhylmzr
ef9fb428b7 fix: object size error in archive 2024-05-01 12:04:03 -07:00
Andrew Kelley
600b652825 Merge pull request #19698 from squeek502/windows-batbadbut
std.process.Child: Mitigate arbitrary command execution vulnerability on Windows (BatBadBut)
2024-04-24 13:50:29 -07:00
Ryan Liptak
e36bf2baff windows.GetFinalPathNameByHandle: Support volumes mounted as paths
A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like `\??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}`. In order to get the `C:\Mnt\Foo` path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH.

Fixes #19731
2024-04-24 13:45:36 -07:00
IntegratedQuantum
4babedf1be Clarify the blocking behavior of RwLock.lockShared(). (#19752) 2024-04-24 13:45:29 -07:00
Sean
0dc64d9064 Update fmt.zig tests
Changed uses of `std.testing.expect` to `std.testing.expectEqual`, `std.testing.expectError`, and `std.testing.expectEqualStrings` where appropriate
2024-04-24 13:45:18 -07:00
Andrew Kelley
5d29b9fad6 CI: enable builds of 0.12.x branch 2024-04-23 17:23:29 -07:00
Eric Joldasov
6de152ec7c std.zig.system: fix ELF file search
* Adjust buffer length a bit.
 * Fix detecting if file is a script. Logic below was unreachable,
 because 99% of scripts failed "At least 255 bytes long" check and were detected as ELF files.
 It should be "At least 4" instead (minimum value of "ELF magic length" and "smallest possible interpreter path length").
 * Fix parsing interpreter path, when text after shebang:
     1. does not have newline,
     2. has leading spaces and tabs,
     3. separates interpreter and arguments by tab or NUL.
 * Remove empty error set from `defaultAbiAndDynamicLinker`.

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
2024-04-23 17:22:04 -07:00
clickingbuttons
cc25f75478 std.crypto: make ff.ct_unprotected.limbsCmpLt compile (#19741)
* std.crypto: make ff.ct_unprotected.limbsCmpLt compile

* std.crypto: add ff.ct test

* fix testCt to work on x86

* disable test on stage2-c

---------

Co-authored-by: Frank Denis <124872+jedisct1@users.noreply.github.com>
2024-04-23 17:17:02 -07:00
David Rubin
eb28c8aa35 error on undefined end index 2024-04-23 17:16:54 -07:00
Frank Denis
f6773232ac Fix WASI threads, again
Properly call the entrypoint when it doesn't return an optional error,
and use the per-thread copy of the arguments list.
2024-04-23 17:16:08 -07:00
Jacob Young
9deea9b1d8 x86_64: fix C abi for unions
Closes #19721
2024-04-23 17:16:03 -07:00
Jakub Konka
8e0a802ea1 link/macho: make --verbose-link represent the actual linker line 2024-04-23 17:15:47 -07:00
Jakub Konka
eb5d67b146 Merge pull request #19714 from ziglang/elf-merge-strings
link/elf: implement string merging
2024-04-23 17:14:03 -07:00
Jakub Konka
082e5091af Merge pull request #19710 from jacobly0/elf-segment-align
Elf: fix unaligned segments on non-linux
2024-04-23 17:13:22 -07:00
Jared Baur
3b1f9b476c Fix usage of unexpectedErrno
`unexpectedErrno` comes from `std.posix`, not `std.os`.
2024-04-23 17:12:24 -07:00
Marco F
2478b5bb0e update list of missing features in no-LLVM built zig2 2024-04-23 17:12:07 -07:00