Andrew Kelley
ed847b85c2
Merge pull request #20777 from alexrp/start-abi-hardening
...
`start`: Harden against program interpreters that don't adhere fully to the ABI
2024-07-25 16:29:08 -07:00
Julian Vesper
3344ed8b8f
aarch64: reenable tests that are no longer regressed
...
Closes #12012
2024-07-25 20:23:23 +03:00
Andrew Kelley
94f4f9c4ef
add sub-compilation cache inputs to parents in whole mode
...
closes #20782
2024-07-24 19:40:54 -07:00
Alex Rønne Petersen
fff5ce053f
start: Align the stack on sparc64 just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-25 00:55:52 +02:00
Alex Rønne Petersen
ebefee6088
start: Fix mips stack alignment value (should be 8, not 16).
2024-07-25 00:55:36 +02:00
Alex Rønne Petersen
5478b0eb38
start: Simplify mips and mips64 startup code.
...
Switches from using r1 as a temporary to r2. That way, we don't have to set the
`noat` assembler option. (r1 is the scratch register used by the assembler's
pseudoinstructions; the assembler warns when code uses that register explicitly
without `noat` set.)
2024-07-25 00:55:00 +02:00
Alex Rønne Petersen
be56c67b14
std.coff: Add missing entries to MachineType.
...
Sources:
* https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants
* 88a28aa575/include/winnt.h (L2720-L2758)
2024-07-24 15:02:55 -07:00
Alex Rønne Petersen
47c0464e86
start: Explicitly clear the link register on mips and mips64 just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
1b13d7477d
start: Properly escape percent signs in the s390x inline asm.
...
Silly mistake in 8ffc41f74705246e61f3c02c253d40b1464ea2bf.
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
ce81525f3f
start: Align the stack on s390x just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
52653ec82b
start: Align the stack on powerpc just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
714e743393
start: Align the stack on aarch64 just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:52 +02:00
Alex Rønne Petersen
9771390f89
start: Simplify the sparc64 inline asm a bit.
2024-07-24 20:12:14 +02:00
Alex Rønne Petersen
58e38ff1f8
start: Add a comment explaining the sparc64 stack bias.
2024-07-24 20:12:14 +02:00
Alex Rønne Petersen
5c96192c19
start: Add a comment explaining our paranoid stance on ABI guarantees.
2024-07-24 20:12:14 +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
557c4f04c2
start: Handle loongarch32 together with loongarch64.
...
Nothing bitness-specific about this startup code.
2024-07-24 10:25:51 -07:00
Andrew Kelley
75cf7fca90
Merge pull request #20767 from ziglang/emit-options
...
add "trace pc guard" as optional additional coverage instrumentation
2024-07-24 07:36:21 -07:00
Lucas Santos
1e74904aa2
Replace some dynamic functions with static ones.
...
PR [19271](https://github.com/ziglang/zig/pull/19271 ) added some static function implementations from kernel32, but some parts of the library still used the dynamically loaded versions.
2024-07-24 01:04:38 -07:00
Andrew Kelley
399f4fe7d6
Merge pull request #20719 from alexrp/misc-porting
...
`std.os.linux`: A handful of random porting fixes, mostly for `armeb` and `thumbeb`
2024-07-23 20:04:26 -07:00
Andrew Kelley
26d2a7960e
default "trace pc guard" coverage off
...
* Add -f(no-)sanitize-coverage-trace-pc-guard CLI flag which defaults to
off. This value lowers to TracePCGuard = true (LLVM backend) and -Xclang
-fsanitize-coverage-trace-pc-guard. These settings are not
automatically included with -ffuzz.
* Add `Build.Step.Compile` flag for sanitize_coverage_trace_pc_guard
with appropriate documentation.
* Add `zig cc` integration for the respective flags.
* Avoid crashing in ELF linker code when -ffuzz -femit-llvm-ir used
together.
2024-07-23 17:30:53 -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
Frank Denis
2e8acdf6fa
Fix compilation issues in crypto.bccrypt and poly1305 ( #20756 )
2024-07-23 19:45:24 +00:00
Alex Rønne Petersen
be1e1fa180
std.Build.Step.Run: Fix invocation syntax for Wasmtime 14+.
...
https://github.com/bytecodealliance/wasmtime/issues/7384
2024-07-23 12:39:40 -07: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
Alex Rønne Petersen
b3e82b899f
std.os.linux: Import arch bits for armeb and thumbeb too.
2024-07-23 21:14:19 +02:00
Andrew Kelley
718f8d5314
Merge pull request #20706 from alexrp/sigaction-nosys
...
`std.posix`: Make `sigaction()` infallible
2024-07-23 11:49:43 -07:00
Pat Tullmann
e8503ecb65
Default std.posix.system.ucontext_t is void
...
PR https://github.com/ziglang/zig/pull/20679 ("std.c reorganization")
switched feature-detection code to use "T != void" checks in place of
"@hasDecl". However, the std.posix.system struct is empty, so
compile-time feature detection against symbols in there (specifically
`std.posix.system.ucontext_t` in this case), fail at compile time on
freestanding targets.
This PR adds a void ucontext_t into the std.posix.system default.
This PR also adds pseudo-"freestanding" variation of the StackIterator
"unwind" test. It is sort of hacky (its freestanding, but assumes it can
invoke a Linux exit syscall), but it does detect this problem.
Fixes #20710
2024-07-23 11:47:29 -07:00
Andrew Kelley
33c7984183
add std.testing.random_seed
...
closes #17609
2024-07-23 11:43:12 -07:00
Andrew Kelley
6f3e9939d0
Merge pull request #20725 from ziglang/fuzz
...
initial support for integrated fuzzing
2024-07-23 11:39:19 -07:00
Andrew Kelley
8a8a7ba35b
Merge pull request #20733 from alexrp/start-porting
...
`start`: Add startup code for loongarch64, m68k, and s390x
2024-07-22 18:25:24 -07:00
Veikka Tuominen
05a8c4796f
Merge pull request #18962 from fifty-six/master
...
std.builtin.panic(uefi): usability improvements
2024-07-23 04:06:30 +03:00
Frank Denis
d2c9a51d1e
Fix function definition: ChaCha20With64BitNonce counter is u64 ( #20734 )
...
Fixes #20732
2024-07-22 23:04:32 +00:00
Andrew Kelley
ae09f9bbce
std.mem: delete workaround now that zig1.wasm is updated
2024-07-22 14:26:17 -07:00
Andrew Kelley
bde8c4a46a
update start code to use @disableInstrumentation
...
This prevents it from trying to access thread local storage before it
has set up thread local storage, particularly when code coverage
instrumentation is enabled.
2024-07-22 14:26:17 -07:00
Andrew Kelley
25198810c8
add new builtin: @disableInstrumentation
...
This is needed to ensure that start code does not try to access thread
local storage before it has set up thread local storage.
2024-07-22 13:07:02 -07:00
Andrew Kelley
7802cf9814
avoid depending on a zig1.wasm update
2024-07-22 13:07:02 -07:00
Andrew Kelley
1741b821c3
add the build system API for enabling fuzzing
2024-07-22 13:07:02 -07:00
Andrew Kelley
54b7e144b1
initial support for integrated fuzzing
...
* Add the `-ffuzz` and `-fno-fuzz` CLI arguments.
* Detect fuzz testing flags from zig cc.
* Set the correct clang flags when fuzz testing is requested. It can be
combined with TSAN and UBSAN.
* Compilation: build fuzzer library when needed which is currently an
empty zig file.
* Add optforfuzzing to every function in the llvm backend for modules
that have requested fuzzing.
* In ZigLLVMTargetMachineEmitToFile, add the optimization passes for
sanitizer coverage.
* std.mem.eql uses a naive implementation optimized for fuzzing when
builtin.fuzz is true.
Tracked by #20702
2024-07-22 13:07:02 -07:00
Andrew Kelley
eac7fd4da5
Merge pull request #20556 from McSinyx/setpgid
...
Allow setting PGID in std.process.Child.spawn
2024-07-22 11:17:18 -07:00