Commit Graph

30068 Commits

Author SHA1 Message Date
Andrew Kelley
6f3767862d implement std.testing.fuzzInput
For now this returns a dummy fuzz input.
2024-07-25 18:52:20 -07:00
Andrew Kelley
3256df2ff8 llvm: always include instrumentation function attributes 2024-07-25 18:52:20 -07:00
Andrew Kelley
5058beb179 implement std.testing.fuzzInput
for the -fno-fuzz case. The other case will take more work in libfuzzer.
2024-07-25 18:52:20 -07:00
Alex Rønne Petersen
1c35e73b61 llvm: Don't emit safety memset() for stores of undef in Debug with safety off.
Before, this code:

    @setRuntimeSafety(false);
    var arr: [38]elf.Addr = undefined;

would emit a call to memset() in the output code in Debug mode, while in all the
release modes, LLVM optimized the memset() out as expected. Emitting the call in
Debug mode is problematic in some contexts, e.g. in std.os.linux.start_pie where
we are not yet ready to correctly perform calls because relocations haven't been
applied yet, or in the early stages of a dynamic linker, etc.
2024-07-25 18:04:50 -07:00
Eugene-Dash
81a172a506
Add std.json.ParseOptions.parse_numbers to preserve float precision (#20744) 2024-07-25 20:55:06 -04:00
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
b22357b88b
Merge pull request #20783 from ziglang/cache-fix
build compiler_rt and fuzzer in parallel; fix false positive cache hits
2024-07-25 07:12:39 -07:00
Jacob Young
18685e928d main: avoid sending an empty file system inputs message
When all compiler inputs are invalid paths, there could be errors yet no
valid file system inputs.

Closes #20713
2024-07-25 03:59:30 -07:00
Andrew Kelley
94f4f9c4ef add sub-compilation cache inputs to parents in whole mode
closes #20782
2024-07-24 19:40:54 -07:00
Andrew Kelley
4135cc9d0b CLI: better error message when build runner cannot be spawned 2024-07-24 19:40:38 -07:00
Andrew Kelley
3844b91db7 Compilation: build compiler_rt and fuzzer in parallel
With the rest of the pipeline.

Tracked by #9188
2024-07-24 18:24:00 -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
Jacob Young
f4f5b2bc41 llvm: force TargetOptions.UseInitArray to true
The `TargetOptions` default constructor initializes all `bool`s to
`false`, yet clang defaults to setting this option to `true`.  Since
recent glibc versions on linux do not appear to support this being set
to `false`, just changing the default for now unless a use case for
making it configurable is found.
2024-07-24 15:24:17 -07: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 8ffc41f747.
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
fa95c89a71
Merge pull request #20758 from pavelverigo/stage2-wasm-compiler-rt-test-pass
stage2-wasm: pass compiler_rt test suite
2024-07-23 20:42:25 -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
Andrew Kelley
33d4742456 LLVM: more fine-grained sancov emit options
Exposes sanitizer coverage flags to the target machine emit function.
Makes it easier to change sancov options without rebuilding the C++
files.

This also enables PCTable = true for sancov which is needed by AFL, and
adds the corresponding Clang flag.
2024-07-23 16:04:58 -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
Jakub Konka
7aaebd1774
Merge pull request #20751 from Rexicon226/riscv-eflags
elf: add riscv eflag collisions
2024-07-23 22:29:57 +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
Pavel Verigo
ba8522e6c7 stage2-wasm: fix bigint div and trunc 2024-07-23 21:17:04 +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