Commit Graph

1874 Commits

Author SHA1 Message Date
Alex Rønne Petersen e6fe7a329a std.os.linux.tls: Add hexagon support. 2024-07-30 02:33:16 +02:00
Alex Rønne Petersen d2b21d5823 std.os.linux.tls: Add s390x support. 2024-07-30 02:33:16 +02:00
Alex Rønne Petersen 9db992bd9b std.os.linux.tls: Add loongarch support. 2024-07-30 02:33:15 +02:00
Alex Rønne Petersen 44d4656dfc std.os.linux.tls: Add m68k support. 2024-07-30 02:32:55 +02:00
Alex Rønne Petersen 37275c0f69 std.os.linux.tls: Fix layout computation for the modified Variant I. 2024-07-30 02:32:32 +02:00
Alex Rønne Petersen b52e054261 std.os.linux.tls: Refactor and improve documentation.
* Elaborate on the sub-variants of Variant I.
* Clarify the use of the TCB term.
* Rename a bunch of stuff to be more accurate/descriptive.
* Follow Zig's style around namespacing more.
* Use a structure for the ABI TCB.

No functional change intended.
2024-07-30 02:32:32 +02:00
Alex Rønne Petersen 876383cb2a std.os.linux: Hook up newly added syscall enums. 2024-07-30 01:32:48 +02:00
Alex Rønne Petersen 7e0f9c45f2 std.os.linux: Adjust for rename of mips syscall enums. 2024-07-30 01:32:48 +02:00
Alex Rønne Petersen e77b3ff74f std.os.linux.syscalls: Regenerate based on Linux v6.7. 2024-07-30 01:32:48 +02:00
Alex Rønne Petersen ce5063e188 std.os.linux.AUDIT: Rewrite ARCH in terms of std.elf.EM.
Closes #20743.
2024-07-30 01:30:35 +02:00
Alex Rønne Petersen 2386bfe854 std.os.linux.start_pie: Rewrite relocate() to avoid jump tables and libcalls.
The code would cause LLVM to emit a jump table for the switch in the loop over
the dynamic tags. That jump table was far enough away that the compiler decided
to go through the GOT, which would of course break at this early stage as we
haven't applied MIPS's local GOT relocations yet, nor can we until we've walked
through the _DYNAMIC array.

The first attempt at rewriting this used code like this:

    var sorted_dynv = [_]elf.Addr{0} ** elf.DT_NUM;

But this is also problematic as it results in a memcpy() call. Instead, we
explicitly initialize it to undefined and use a loop of volatile stores to
clear it.
2024-07-30 01:26:10 +02:00
Alex Rønne Petersen 68cebde186 std.os.linux.start_pie: Inline the getDynamicSymbol() function.
On MIPS, this call will require a relocation, which we can't do until after PIE
relocations have been applied.
2024-07-30 01:26:10 +02:00
Alex Rønne Petersen 5633767b20 std.os.linux.start_pie: Add powerpc and powerpc64 support.
Closes #20305.
2024-07-30 01:26:09 +02:00
Alex Rønne Petersen adfbd8a98b std.os.linux.start_pie: Add mips and mips64 support. 2024-07-30 01:24:55 +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 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
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
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
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
Matthew Ettler d30d37e356 feat(std.os.uefi.protocol): add Serial IO 2024-07-28 12:37:53 +00:00
Jarrod Meyer 2de0e2eca3 Watch.zig: add initial windows implementation 2024-07-27 11:32:43 -04:00
Jarrod Meyer 2b8f444dde windows: reintroduce ReadDirectoryChangesW
- additionally, introduces FileNotifyChangeFilter to improve use/readability
2024-07-27 11:32:43 -04:00
Jarrod Meyer 9323a00067 windows: add Timeout status result for GetQueuedCompletionStatus 2024-07-27 11:32:43 -04:00
Jarrod Meyer 7434accc3d windows: make the WaitForMultipleObjectsEx assertion inclusive
- additionally, the parameter must be nonzero: https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects
2024-07-27 11:32:43 -04:00
Alex Rønne Petersen 66b71273a2 std.os.linux: Fix default value for perf_event_attr.clockid field.
Closes #20810.
2024-07-26 18:21:10 -07:00
Alex Rønne Petersen 38c492bb53 std.os.linux.start_pie: Add hexagon support. 2024-07-24 20:12:38 +02:00
Alex Rønne Petersen a0b2b987c8 std.os.linux.start_pie: Add arc support. 2024-07-24 20:12:38 +02:00
Alex Rønne Petersen bc054a713e std.os.linux.start_pie: Add csky support. 2024-07-24 20:12:38 +02:00
Alex Rønne Petersen 2dabb7ec77 std.os.linux.start_pie: Handle armeb, thumb, thumbeb, and aarch64_be too. 2024-07-24 20:12:38 +02:00
Andrew Kelley 4de8bba648 Merge pull request #20749 from alexrp/start-pie
`std.os.linux.start_pie`: Implement `getDynamicSymbol()` for loongarch64, m68k, and s390x
2024-07-24 10:27:20 -07:00
Alex Rønne Petersen 1c6bee0834 std.os.linux.start_pie: Add s390x support. 2024-07-24 00:28:08 +02:00
Alex Rønne Petersen 6fac71ec74 std.os.linux.start_pie: Add m68k support. 2024-07-24 00:28:07 +02:00
Alex Rønne Petersen 1fd45766a7 std.os.linux.start_pie: Add loongarch support. 2024-07-24 00:27:46 +02:00
Alex Rønne Petersen 2d4fc1bb7a std.os.linux.tls: Fix setThreadPointer() for armeb and thumbeb. 2024-07-23 21:17:29 +02:00
Alex Rønne Petersen 0473457b68 std.os.linux.tls: Set some constants correctly for powerpcle. 2024-07-23 21:14:19 +02:00
Alex Rønne Petersen c631110f5c std.os.linux.tls: Set tls_tcb_size correctly for thumbeb. 2024-07-23 21:14:19 +02:00
Alex Rønne Petersen d694ddd279 std.os.linux.tls: Set tls_variant correctly for thumbeb. 2024-07-23 21:14:19 +02:00
Alex Rønne Petersen d2d325a862 std.os.linux.AUDIT: Fix s390x; add loongarch64 and xtensa. 2024-07-23 21:14:19 +02:00
Alex Rønne Petersen 93311d6bca std.os.linux: Also define O for armeb and thumbeb. 2024-07-23 21:14:19 +02:00
Alex Rønne Petersen 92bc802033 std.os.linux: Also define MAP for armeb and thumbeb. 2024-07-23 21:14:19 +02:00
Alex Rønne Petersen fcbb192b49 std.os.linux: Define (MIN)SIGSTKSZ for all supported Linux architectures. 2024-07-23 21:14:19 +02:00
Alex Rønne Petersen b21de4de5e std.os.linux: Define syscalls for armeb and thumbeb too. 2024-07-23 21:14:19 +02:00