Commit Graph

30253 Commits

Author SHA1 Message Date
David Rubin
574028ed5e
riscv: boilerplate for creating lazy functions 2024-07-26 04:05:44 -07:00
David Rubin
9bc7e8c852
riscv: update tests 2024-07-26 04:05:43 -07:00
David Rubin
64c6473443
riscv: implement add_sat and ptr_slice_len_ptr
this is enough to use the basic functions of an ArrayList!
2024-07-26 04:05:43 -07:00
David Rubin
45443f9c37
cmake: update to reflect added riscv64 backend files 2024-07-26 04:05:43 -07:00
David Rubin
6ac1b2d82a
riscv: add 32-bit support to integer @abs 2024-07-26 04:05:42 -07:00
David Rubin
1820f44104
riscv: implement sub-byte addition 2024-07-26 04:05:42 -07:00
David Rubin
81ca3a1d59
riscv: fix logic bug in ptr_elem_ptr
I was doing duplicate work with `elemOffset` multiplying by the abi size and then the `ptr_add` `genBinOp` also multiplying.

This led to having writes happening in the wrong place.
2024-07-26 04:05:41 -07:00
David Rubin
cde6956b21
riscv: remove redundant assert in genBinOp 2024-07-26 04:05:41 -07:00
David Rubin
ba58b7b881
heap: create a work-around page-allocator
the risc-v backend doesn't have `@cmpxchg*` implemented and so it can't use the hint that the current page-allocator uses.
this work-around branch can be removed when I implement the atomic built-in.
2024-07-26 04:05:41 -07:00
David Rubin
d3f75522d7
lower: fix logic bug in cmp_gt 2024-07-26 04:05:40 -07:00
David Rubin
c78ebeb44c
riscv: implement ptr_slice_ptr_ptr
just one step closer to allocation
2024-07-26 04:05:40 -07:00
David Rubin
93e9c7a963
riscv: implement @clz 2024-07-26 04:05:39 -07:00
David Rubin
8d30fc45c4
riscv: implement more operators
we can run `std.debug.print` now, with both run-time strings and integers!
2024-07-26 04:05:39 -07:00
David Rubin
9766b68c47
riscv: un-cache the avl and vtype when returning from a function call
the csrs `avl` and `vtype` are considered caller-saved so it could have changed while inside of the function.
the easiest way to handle this is to just set the cached `vtype` and `avl` to null, so that the next time something
needs to set it, it'll emit an instruction instead of relying on a potentially invalid setting.
2024-07-26 04:05:38 -07:00
Andrew Kelley
f2bf6c1b11
Merge pull request #20776 from alexrp/start-pie-more-arches
`std.os.linux.start_pie`: Add arc, csky, and hexagon support (and arm variants)
2024-07-25 19:33:54 -07:00
Alex Rønne Petersen
2458e53e73 std.zig.target: Handle m68k in muslArchName(). 2024-07-25 19:31:39 -07:00
Alex Rønne Petersen
9536d65230 main: Don't pass --seed for zig run. 2024-07-25 19:30:13 -07:00
Andrew Kelley
afddfe25d8
Merge pull request #20773 from ziglang/fuzz
integrate fuzz testing into the build system
2024-07-25 18:52:39 -07:00
Andrew Kelley
688c2df646 fuzzer: use the cmp values
seems to provide better scoring
2024-07-25 18:52:21 -07:00
Andrew Kelley
6a63372053 fuzzer: basic implementation
just some experimentation. I didn't expect this to be effective so
quickly but it already can find a comparison made with mem.eql
2024-07-25 18:52:21 -07:00
Andrew Kelley
a3c74aca99 add --debug-rt CLI arg to the compiler + bonus edits
The flag makes compiler_rt and libfuzzer be in debug mode.

Also:
* fuzzer: override debug logs and disable debug logs for frequently
  called functions
* std.Build.Fuzz: fix bug of rerunning the old unit test binary
* report errors from rebuilding the unit tests better
* link.Elf: additionally add tsan lib and fuzzer lib to the hash
2024-07-25 18:52:21 -07:00
Andrew Kelley
90dfd86ebe test runner: always report fuzz tests
This way they can be smoke tested.
2024-07-25 18:52:21 -07:00
Andrew Kelley
b501adccbe std.Build.Fuzz: fix progress node hierarchy 2024-07-25 18:52:21 -07:00
Andrew Kelley
7366b4b9e2 test runner: handle start_fuzzing message 2024-07-25 18:52:21 -07:00
Andrew Kelley
bce3b1efb0 build runner sends a start_fuzzing message to test runner 2024-07-25 18:52:21 -07:00
Andrew Kelley
711ed56ce3 build runner: extract logic to std.Build.Fuzz 2024-07-25 18:52:21 -07:00
Andrew Kelley
047640383e add --fuzz CLI argument to zig build
This flag makes the build runner rebuild unit tests after the pipeline
finishes, if it finds any unit tests.

I did not make this integrate with file system watching yet.

The test runner is updated to detect which tests are fuzz tests.

Run step is updated to track which test indexes are fuzz tests.
2024-07-25 18:52:20 -07:00
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
Alex Rønne Petersen
d0557a699e
std.elf: Add Elf32_Relr and Elf64_Relr definitions. 2024-07-26 00:40:41 +02:00
Julian Vesper
3344ed8b8f aarch64: reenable tests that are no longer regressed
Closes #12012
2024-07-25 20:23:23 +03:00
Alex Rønne Petersen
c009264f5b
std.elf: Add some newer dynamic tag types. 2024-07-25 18:55:08 +02: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