Commit Graph

30195 Commits

Author SHA1 Message Date
Vojtech Antosik
647f76ccd6
std.process.Child: return any pre-exec errors from spawn 2024-08-03 00:31:27 +02:00
Vojtech Antosik
bb8776dd69
std.process.Child: fix failing test 2024-08-01 03:36:53 +02:00
Vojtech Antosik
7f9bb47430
std.process.Child: move detached child test to standalone 2024-07-31 17:02:20 +02:00
Vojtech Antosik
bd91dc5883
std.process.Child: kill child after test 2024-07-31 00:15:11 +02:00
Vojtech Antosik
f4e01b0e48
std.process.Child: detached process spawning 2024-07-30 22:54:21 +02:00
Andrew Kelley
38e0f049c5
Merge pull request #20389 from alexrp/riscv32
Some `riscv32-linux` porting work
2024-07-29 16:13:35 -07:00
Ryan Liptak
73a444766e langref: Make pointer_coerce_const_optional test less obfuscated
This test was originally introduced in 5f38d6e2e9, where it looked like this:

    test "cast *[1][*]const u8 to [*]const ?[*]const u8" {
        const window_name = [1][*]const u8{c"window name"};
        const x: [*]const ?[*]const u8 = &window_name;
        assert(mem.eql(u8, std.cstr.toSliceConst(x[0].?), "window name"));
    }

Over the years, this has become more and more obfuscated, to the point that the verbosity of the `expect` call overshadows the point of the example. This commit intends to update this test to match the spirit of the original version of the test, while shedding the obfuscation.
2024-07-29 16:07:12 -07:00
Ryan Liptak
efde3ed04a Fix compile error due to GetModuleFileNameW binding change
In https://github.com/ziglang/zig/pull/19641, this binding changed from `[*]u16` to `LPWSTR` which made it a sentinel-terminated pointer. This introduced a compiler error in the `std.os.windows.GetModuleFileNameW` wrapper since it takes a `[*]u16` pointer. This commit changes the binding back to what it was before instead of introducing a breaking change to `std.os.windows.GetModuleFileNameW`

Related: https://github.com/ziglang/zig/issues/20858
2024-07-29 16:06:36 -07:00
Andrew Kelley
d60c100eb6
Merge pull request #20865 from ehaas/aro-translate-c-static-assert
Aro translate c: Render error diagnostics properly and ignore _Static_assert decls during translation
2024-07-29 15:28:31 -07:00
Alex Rønne Petersen
f7cebf21c9 c: Handle armeb and thumbeb in clone(). 2024-07-29 13:24:29 -07:00
Andrew Kelley
7342017404
Merge pull request #20822 from alexrp/start-mips-fixes
`start`: A handful of MIPS fixes
2024-07-29 12:02:59 -07:00
Andrew Kelley
19e4de135f
Merge pull request #20839 from alexrp/musl-stuff
`musl`: Align `CFLAGS` with upstream
2024-07-29 11:34:18 -07:00
Alex Rønne Petersen
27507ad971 compiler: Enable -Werror=date-time for C/C++ code in release builds.
We advertise reproducible builds for release modes, so let's help users achieve
that in C/C++ code. Users can still override this manually if they really want.
2024-07-29 11:27:38 -07:00
Andrew Kelley
c37fe4b678
Merge pull request #20841 from alexrp/atomic-stuff
`std.atomic`: `cache_line` and `spinLoopHint()` specialization for more architectures
2024-07-29 11:05:43 -07:00
Evan Haas
699e103717
aro_translate_c: Add a more helpful error message for error.StreamTooLong 2024-07-29 10:25:55 -07:00
Evan Haas
5d8e56c2eb
aro_translate_c: do not translate _Static_assert declarations
This does not completely ignore static asserts - they are validated by aro
during parsing; any failures will render an error and non-zero exit code.

Emit a warning comment that _Static_asserts are not translated - this
matches the behavior of the existing clang-based translate-c.

Aro currently does not store source locations for _Static_assert
declarations so I've hard-coded token index 0 for now.
2024-07-29 10:25:55 -07:00
Evan Haas
d7b9bbecaf
aro_translate_c: Render errors properly
The error count is not set until the diagnostics are actually rendered
2024-07-29 10:25:55 -07:00
Alex Rønne Petersen
d633b35f35
start: Always inline the call to std.os.linux.pie.relocate().
At this stage, we're not ready to make calls yet on some architectures (e.g. MIPS).
2024-07-29 10:08:34 +02:00
Alex Rønne Petersen
d6c637c36b
start: Set std.os.linux.elf_aux_maybe after PIE relocations.
Accesses to this global variable can require relocations on some platforms (e.g.
MIPS). If we do it before PIE relocations have been applied, we'll crash.
2024-07-29 10:05:28 +02:00
Alex Rønne Petersen
e33af8e902
start: Perform the posixCallMainAndExit() call with jalr on mips.
It's actually important for the ABI that r25 (t9) contains the address of the
called function, so that this standard prologue sequence works:

    lui $2, %hi(_gp_disp)
    addiu $2, $2, %lo(_gp_disp)
    addu $gp, $2, $t9

(This is a bit similar to the ToC situation on powerpc that was fixed in
7bc78967b400322a0fc5651f37a1b0428c37fb9d.)
2024-07-29 10:05:25 +02:00
Alex Rønne Petersen
77fc3b88fb
start: Set up the gp register on mips and mips64. 2024-07-29 10:04:54 +02:00
Alex Rønne Petersen
13945548fc
std.fs: Rework to always use statx() instead of fstat()/fstatat() on Linux.
statx() is strictly superior to stat() and friends. We can do this because the
standard library declares Linux 4.19 to be the minimum version supported in
std.Target. This is also necessary on riscv32 where there is only statx().

While here, I improved std.fs.File.metadata() to gather as much information as
possible when calling statx() since that is the expectation from this particular
API.
2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
4e5068c35c
std: Stop supporting Linux/glibc versions older than declared in std.Target. 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
6eb9cb6f28
std.os.linux.tls: Handle riscv32 in setThreadPointer(). 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
aeb3abc7e6
std.os.linux.start_pie: Handle riscv32 in getDynamicSymbol(). 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
43410cdfe9
std.os.linux: Remove the sparc64 workaround in fadvise().
This does not seem to be needed anymore, and it's unclear if it was ever truly
needed or if it was just there to deal with a QEMU/strace bug.

See: https://github.com/ziglang/zig/pull/8301#issuecomment-2184995749
2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
890433e292
std.os.linux: Define timespec as kernel_timespec (64-bit) for riscv32.
This is kind of a hack because the timespec in UAPI headers is actually still
32-bit while __kernel_timespec is 64-bit. But, importantly, all the syscalls
take __kernel_timespec from the get-go (because riscv32 support is so recent).

Defining our timespec this way will allow all the syscall wrappers in
std.os.linux to do the right thing for riscv32. For other 32-bit architectures,
we have to use the 64-bit time syscalls explicitly to solve the Y2038 problem.
2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
cafce8c767
std.os.linux.test: Partially skip statx() test on riscv32.
No fstatat(), so there's no point doing the rest of it.
2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
7532a8a584
std.os.linux: Add riscv32 support. 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
2d1ee678eb
std.os.linux: Some adjustments after syscall generation strategy changes. 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
4e7c3cca91
std.os.linux.syscalls: Regenerate based on Linux v6.7.
loongarch64 syscalls not updated because it seems like that kernel port hasn't
been working for a year or so:

    In file included from arch/loongarch/include/uapi/asm/unistd.h:5:
    include/uapi/asm-generic/unistd.h:2:10: fatal error: 'asm/bitsperlong.h' file not found

That file is just missing from the tree. 🤷
2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
7e74276661
generate_linux_syscalls: Rework generation strategy for newer kernel ports.
If we're going to abuse the preprocessor, we may as well go all the way and have
it generate a convenient format for us. This achieves two things:

1. We no longer need hacks for the arch-specific syscalls.
2. We now generate the correct syscall names for 32-bit platforms.

The latter is because we now resolve __SC_3264, etc.
2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
f494a47ca5
generate_linux_syscalls: Add some missing include paths for riscv. 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
290609eff5
generate_linux_syscalls: Add riscv32 support. 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
0460248900
generate_linux_syscalls: Handle riscv_hwprobe. 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
e0b9ebf322
gen_stubs: Add riscv32 handling in a few more places. 2024-07-29 09:50:41 +02:00
Alex Rønne Petersen
a59ab5ffa5
std.Thread: Add some syscall comments to LinuxThreadImpl.ThreadCompletion.freeAndExit(). 2024-07-29 09:50:40 +02:00
Alex Rønne Petersen
b83d10214b
std.Thread: Implement LinuxThreadImpl.ThreadCompletion.freeAndExit() for riscv32. 2024-07-29 09:50:09 +02:00
Alex Rønne Petersen
b958225e68
c: Implement clone() for riscv32-linux. 2024-07-29 09:50:09 +02:00
Alex Rønne Petersen
8b176ab303
start: Implement _start() for riscv32. 2024-07-29 09:50:09 +02:00
Alex Rønne Petersen
e74c368962
std.zig.target: Set the minimum glibc for riscv32 to 2.33.
Relevant release notes:

* https://sourceware.org/legacy-ml/libc-announce/2018/msg00000.html
* https://sourceware.org/pipermail/libc-announce/2021/000030.html

Note that the supported ISAs/ABIs are explicitly listed in each, and only 2.33
actually supports the 32-bit ones.
2024-07-29 09:50:09 +02:00
Alex Rønne Petersen
c31409baa9
std.Target.Abi: Handle a few more GNU ABIs in isGnu().
Importantly, this ensures that the compiler understands that these ABIs need glibc.
2024-07-29 09:50:09 +02:00
Alex Rønne Petersen
6ec7757914
link.Elf: Define __global_pointer$ for riscv32 too.
See: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
2024-07-29 09:50:09 +02:00
Alex Rønne Petersen
11badbfe8e
musl: Fix needsCrtiCrtn() to return false for riscv32 too. 2024-07-29 09:50:09 +02:00
Alex Rønne Petersen
9d23e711ef
std.atomic: Implement specialized spinLoopHint() for more architectures. 2024-07-29 09:41:47 +02:00
Alex Rønne Petersen
5b68595255
std.atomic: Define specialized cache_line values for more architectures. 2024-07-29 09:41:24 +02:00
Andrew Kelley
390c7d84b2
Merge pull request #19833 from tealsnow/posix-INVAL
std.posix: handle INVAL in openZ, openatZ and openatWasi
2024-07-28 22:29:31 -07:00
matt ettler
ed7f11ffa7 chore: correct non-standard comments.
Comments throughout the codebase start with a space.
This commit corrects comments that do not adhere to this
norm.
2024-07-28 21:34:14 -07:00
Sammy James
00d6ea4764 Add libcpp option to test options 2024-07-28 20:40:53 -07:00
Andrew Kelley
3a0da431db
Merge pull request #20667 from jayrod246/windows-watch
Build Runner: Initial Implementation for File System Watching on Windows
2024-07-28 20:35:18 -07:00