7090 Commits

Author SHA1 Message Date
Andrew Kelley
7221e9560e std.Build.RunStep: don't close stdin
Instead, ignore stdin. Otherwise this interfers with a sub-process which
expects to have a stdin file descriptor open.
2023-04-10 18:35:14 -07:00
Andrew Kelley
60eabc0eca std.Build.CompileStep: remove run() and install()
These functions are problematic in light of dependencies because they
run and install, respectively, for the *owner* package rather than for
the *user* package. By removing these functions, the build script is
forced to provide the *Build object to associate the new step with,
making everything less surprising.

Unfortunately, this is a widely breaking change.

see #15079
2023-04-10 18:35:14 -07:00
Andrew Kelley
38698f4f6a std.Build.CompileStep: delete install_step field
This was used to ensure that an artifact would only be installed once,
but this is not only unnecessary, but actively harmful, in the face of
dependencies.

see #15079
2023-04-10 18:35:14 -07:00
Andrew Kelley
d2ad3f5074 std.Build.CompileStep: remove redundant dest_builder field
The destination *Build object is already known to be step.owner, while
the source object is artifact.step.owner.
2023-04-10 18:35:14 -07:00
Andrew Kelley
311d50f9dc
Merge pull request #14827 from adriandelgado/log10-int
std.math: port `int_log10` from Rust
2023-04-10 13:01:28 -04:00
GethDW
2c639d6570 std.MultiArrayList: add support for tagged unions. 2023-04-10 12:15:05 -04:00
Andrew Kelley
aeae71f462
Merge pull request #15068 from Snektron/spirv-test-runner-support
spirv: test runner support
2023-04-10 10:44:35 -04:00
Andrew Kelley
dfe3440540 std.os.sendto: use ws2_32 on Windows
closes #9971
2023-04-09 20:08:18 -04:00
Andrew Kelley
95ac94b7ac std.debug: fix segfault/panic race condition
closes #7859
closes #12207
2023-04-09 14:09:52 -04:00
Andrew Kelley
2ee328995a
Merge pull request #15123 from truemedian/http-server
std.http: add http server
2023-04-09 10:44:52 -04:00
Robin Voetter
a7563e453d
spirv: minimal start code
For SPIR-V, only export the main function if it is actually declared. Kernel
entry points will often have parameters and more than one kernel declared.

In general, SPIR-V binaries should mostly be compiled as libraries and not as
executables. However, this start code is required so that we can build test
executables.

Note that a call to isSpirV() would emit the code for that function, even though
the call is at comptime. To save that function from being emitted the checks
are just inlined manually.
2023-04-09 01:51:55 +02:00
Robin Voetter
f12beb857a
amdgpu,nvptx: unify kernel calling conventions
AmdgpuKernel and NvptxKernel are unified into a Kernel calling convention.
There is really no reason for these to be separate; no backend is allowed to
emit the calling convention of the other. This is in the same spirit as the
.Interrupt calling convention lowering to different LLVM calling conventions,
and opens the way for SPIR-V kernels to be exported using the Kernel calling
convention.
2023-04-09 01:51:54 +02:00
Robin Voetter
ba60d456b4
spirv: cannot build libc
SPIR-V cannot build libc, ssp, compiler-rt, etc at the time of this commit, so
prevent trying to build them.
2023-04-09 01:51:48 +02:00
Robin Voetter
12ff362654
spirv: make genericName match target name.
Changes the 'generic name' of the target to spirv, from spir-v.
2023-04-09 01:51:48 +02:00
Robin Voetter
6dc1fafe98
std: add generic target for spirv
This adds a general target for SPIR-V compilation. Previously there was not
any target machine defined for SPIR-V.

TODO is to reword the features for this target. We don't really need the full
list of capabilities in the features, we should only put a few features here
which we can actually use during code generation.
2023-04-09 01:51:47 +02:00
David CARLIER
2e2d37917d std: add FreeBSD's procctl api. 2023-04-08 18:31:01 +03:00
Nameless
7f9a4625fd
std.http: reenable protocol read tests, add missing branch in findHeaders end 2023-04-08 09:59:37 -05:00
Nameless
ef6d58ed3b
std.http: add documentation 2023-04-08 09:59:36 -05:00
Nameless
8250a92544
update package manager to use req.do(), fix chunked trailer reading 2023-04-08 09:59:36 -05:00
Nameless
52c78f4974
fix bugs, waitForCompleteHead -> do, move redirecting to do instead of read
fix for 32bit arches

curate error sets for api facing functions, expose raw errors in client.last_error

fix bugged dependency loop, disable protocol tests (needs mocking)

add separate mutex for bundle rescan
2023-04-08 09:59:36 -05:00
Nameless
aecbfa3a1e
add buffering to connection instead of the http protocol, to allow passing through upgrades 2023-04-08 09:59:36 -05:00
Nameless
08bdaf3bd6
std.http: add http server
* extract http protocol into protocol.zig, as it is shared between client and server
* coalesce Request and Response back into Client.zig, they don't contain
  any large chunks of code anymore
* http.Server is implemented as basic as possible, a simple example below:

```zig
fn handler(res: *Server.Response) !void {
    while (true) {
        defer res.reset();

        try res.waitForCompleteHead();
        res.headers.transfer_encoding = .{ .content_length = 14 };
        res.headers.connection = res.request.headers.connection;
        try res.sendResponseHead();
        _ = try res.write("Hello, World!\n");

        if (res.connection.closing) break;
    }
}

pub fn main() !void {
    var server = Server.init(std.heap.page_allocator, .{ .reuse_address = true });
    defer server.deinit();

    try server.listen(try net.Address.parseIp("127.0.0.1", 8080));

    while (true) {
        const res = try server.accept(.{ .dynamic = 8192 });

        const thread = try std.Thread.spawn(.{}, handler, .{res});
        thread.detach();
    }
}
```
2023-04-08 09:59:35 -05:00
Nameless
fde05b10b3 tls.Client: don't read if we don't need more data 2023-04-08 03:37:05 -04:00
mateusz
0866396308
std.json: allow returning custom errors from custom stringify 2023-04-07 15:01:09 +03:00
Andrew Kelley
9f957184a1 Merge remote-tracking branch 'origin/master' into llvm16 2023-04-06 13:58:54 -07:00
alion02
8853005672 Fix crash on some Windows machines 2023-04-06 07:26:07 +02:00
Andrew Kelley
f289277599 Merge remote-tracking branch 'origin/master' into llvm16 2023-04-05 22:05:31 -07:00
jim price
3487514626 std.os: add mincore syscall
The mincore syscall is available on some UNIX like operating systems
and allows a user to determine if a page is resident in memory.
2023-04-06 00:57:23 -04:00
David CARLIER
3e467c778a std: add os_log/signpost api (sort of linux's perf event equivalent)
subset.
2023-04-06 07:31:06 +03:00
Nikita Ronja
d92b5fcfb0 Add NetBSD termios constants to std.c.netbsd 2023-04-06 03:46:44 +03:00
David CARLIER
080136e4ad std: add madvise flags to freebsd 2023-04-05 13:54:01 +03:00
David CARLIER
f86f531e9c std: add a subset of the apple's QOS api 2023-04-05 09:01:35 +02:00
Jacob Young
ad5fb4879b std: fix memory bugs
This fixes logged errors during CI based on the new GPA checks.
2023-04-05 08:23:07 +02:00
Jakub Konka
5ea6e78943
Merge pull request #15162 from jacobly0/x86_64-start
x86_64: get enough things working to enable full `start.zig` logic
2023-04-05 03:02:42 +02:00
Ganesan Rajagopal
49b56f88b9
GPA: Catch invalid frees
* GPA: Catch invalid frees

Fix #14791: Catch cases where an invalid slice is passed to free().
This was silently ignored before but now logs an error. This change
uses a AutoHashMap to keep track of the sizes which seems to be an
overkill but seems like the easiest way to catch these errors.

* GPA: Add wrong alignment checks to free/resize

Implement @Inkryption's suggestion to catch free/resize with the wrong
alignment. I also changed the naming to match large allocations.
2023-04-04 13:11:25 +03:00
David CARLIER
771d07268f std: freebsd MAP* constants update, MAP_ALIGNED_SUPER and the MAP_ALIGNED macro. 2023-04-04 12:57:16 +03:00
Jacob Young
c91929090d start: disable extra start logic on various x86_64 subtargets 2023-04-03 15:19:07 -04:00
Jacob Young
f0d13489f8 Elf: add program headers for the program header table 2023-04-03 17:45:17 +02:00
Jacob Young
fde1ec5d0e x86_64: remove returns from naked functions 2023-04-03 17:45:16 +02:00
Veikka Tuominen
a31450375e
Merge pull request #15134 from castholm/reverse-iterator
std.mem.reverseIterator: misc improvements
2023-04-02 18:06:55 +03:00
Jacob Young
83a208c355 x86_64: implement large cmp 2023-04-02 04:49:53 -04:00
Jakub Konka
a88c0b4d08 link: handle -u flag in all linkers
Also clean up parsing of linker args - reuse `ArgsIterator`.

In MachO, ensure we add every symbol marked with `-u` as undefined
before proceeding with symbol resolution. Additionally, ensure those
symbols are never garbage collected.

MachO entry_in_dylib test: pass `-u _my_main` when linking executable
so that it is not incorrectly garbage collected by the linker.
2023-04-01 14:22:44 +02:00
Carl Åstholm
3cd72951c0 std.mem.reverseIterator: add nextPtr() 2023-03-31 22:50:31 +02:00
Carl Åstholm
0bbc1ec206 std.mem.reverseIterator: accept pointer to array 2023-03-31 22:48:32 +02:00
Jakub Konka
f6845bbbc6 std: bump max macOS version to 13.3 2023-03-31 21:22:30 +02:00
Jakub Konka
349349fa01 std: simplify VirtualProtectEx and fix ntdll signature 2023-03-30 21:08:31 +02:00
Jakub Konka
ba5302c4f8 std: move ntdll wrappers to std.os.windows 2023-03-30 21:08:31 +02:00
Jakub Konka
5d387742fd coff: reimplement VirtualProtectEx using our own ntdll wrapper 2023-03-30 21:08:31 +02:00
bing
64214b1ca6
Change ordering of prep provide buffers args 2023-03-30 16:51:57 +00:00
Jakub Konka
2b80552603
Merge pull request #14771 from kcbanner/coff_dynamicbase
Allow dynamicbase to be disabled by CompileStep
2023-03-28 20:18:25 +02:00