Commit Graph

4080 Commits

Author SHA1 Message Date
Nameless
de028d5130 std/os/uefi: fix packed struct bitfields 2021-07-03 15:28:57 -07:00
Andrew Kelley
390a4ded98 Merge pull request #9258 from ziglang/shared-cache-locking
Shared Cache Locking
2021-07-03 15:28:29 -07:00
Andrew Kelley
b0be0c77d8 Merge pull request #9148 from marler8997/windowsChildOutput
finish ChildProcess collectOutputWindows
2021-07-03 15:25:22 -07:00
Andrew Kelley
caddd7eb18 std.crypto.p256: fix neg function compile error
There was a typo here and the neg function referenced a non-existent
variable.
2021-07-03 15:19:50 -07:00
Andrew Kelley
2b6727c98f std.os.linux.bpf: fix incorrect usage of unexpectedErrno 2021-07-03 15:19:50 -07:00
Andrew Kelley
5ef70b8b87 mips: fix syscall_pipe
Previously the fd parameter was ignored and so the result would not get
populated. Now it passes the fd pointer to the inline assembly so that
the results can be observed.
2021-07-03 15:19:50 -07:00
Isaac Freund
e75dfbcb3f std/build: add --sysroot general option 2021-06-26 12:51:49 +02:00
Isaac Freund
3e4f3a1924 zig build: add --libc general option
This new option sets a default libc paths file to be used for all
LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.

This is required to allow users to cross compile projects linking system
libraries without needing to patch the build.zig.
2021-06-26 12:41:05 +02:00
mason1920
939408289c Bring your own MAX_PATH_BYTES
Previous to #7082, users could overwrite PATH_MAX in the root file to support std.os.toPosixPath, permitting the "bring your own operating system" layer to implement the POSIX API for opening files. Unfortunately that is no longer the case.

This commit intends to fix what is arguably a regression from 0.7 in a way that doesn't break any code targeting 0.8.0, making it suitable to be included in a 0.8 patch release.
However in a future release that permits breaking changes, I am of the opinion that it would be beneficial to overwrite the value, even for "supported" operating systems. Same for all the other POSIX/BYOOS functions and values. However this is beyond the scope of this commit. Further discussion of this will be made into an issue in due time.
2021-06-21 16:18:59 -07:00
Andrew Kelley
d0575310dc Merge pull request #9168 from LemonBoy/fix-pie
std: Fix PIE startup sequence
2021-06-20 17:03:50 -07:00
LemonBoy
b72d55ea5f std: Make copy_file_range checks run at compile-time
* Avoid emitting the copy_file_range symbol at all to prevent link-time
  errors.
* Fix a bug in the check logic, the has_copy_file_range_syscall was
  set to the wrong value in case of ENOSYS
* If link_libc is true don't fall-back to the raw syscall approach,
  there's no policy about what to do in this case but let's follow what
  the other impls do.

Fixes #9146
2021-06-20 16:54:39 -07:00
hadroncfy
cf6e2d318a HashMap.getOrPutAssumeCapacityAdapted should set key to undefined (#9138)
* std.hash_map.HashMap: getOrPutAssumeCapacityAdapted should set key to undefined

* add test for std.hash_map.HashMap.getOrPutAdapted
2021-06-20 16:26:01 -07:00
d18g
71ec89383b Fix lakemont CpuModel (#9099)
Lakemont has no x86, no MMX, no SSE and no way of handling any fp-math. In theory LLVM is able to implicitly use the soft-float emulation library calls to legalize any such operation but, given Zig's use of many non-standard features, sometimes we hit a weak spot in the X86 codegen backend.

Consider this as a work-around for this LLVM problem, fixing the problem in LLVM is not so high in my todo list as the target is pretty niche and Intel axed it in '19.

(Commit message by @LemonBoy)
2021-06-17 20:28:37 -07:00
Michael Dusan
4adbdcb587 netbsd: add more std.os.bits 2021-06-17 20:28:37 -07:00
Björn Linse
52ead255a2 std: don't reference non-existant ComptimeStringHashMap type 2021-06-15 13:32:14 -07:00
Isaac Freund
4453f6a5ce std: fix auto hash of tagged union with void field 2021-06-14 12:16:36 -07:00
viri
7f6e7e3e5d std.windows: fix OVERLAPPED, add OVERLAPPED_ENTRY 2021-06-14 12:14:46 -07:00
LemonBoy
5c9eb94a2b std: Fix complex ldexp implementation
Two bugs in the implementation ported from musl made all the complex
functions relying on ldexp return incorrect results in some cases.

Spotted in #9047
2021-06-14 12:13:53 -07:00
codic12
54229fec33 c.zig: fix waitpid() definition 2021-06-11 14:50:48 -07:00
Veikka Tuominen
e3a74697f0 Merge pull request #8330 from kivikakk/single-limb-bigint-overflow
bigint add failures with aliasing
2021-06-11 10:31:08 -07:00
LemonBoy
a913311f3c std: Fix tanh for negative inputs
It turns out the code was not ported correctly from C and produced wrong
results for negative input values. As a bonus fix the NaN codepath by
adding yet another missing piece of code.

Spotted in #9047
2021-06-11 10:30:07 -07:00
Andrew Kelley
ec4c60c481 zig fmt 2021-06-11 10:28:42 -07:00
Frank Denis
80e1797faf aes 128-bit key expansion test - properly test the inverse round keys (#9065) 2021-06-10 10:22:03 -07:00
Jakub Konka
f677c24740 Re-enable multiple wasm32 vector tests
Fixes #5339
2021-06-10 10:21:13 -07:00
Filippo Casarin
05380a11a4 std.math.sqrt_int: fixed odd size integers types 2021-06-10 10:20:09 -07:00
viri
4a3ac16711 std.Progress: use *W functions on windows
Closes #534.
See: https://source.winehq.org/git/wine.git/blob/refs/heads/stable:/dlls/kernelbase/console.c#l520
2021-06-10 10:19:37 -07:00
Dustin Taylor
0c25ff81a3 Limit Fixed Buffer Stream seekTo (#9023) 2021-06-08 12:27:22 -07:00
LemonBoy
7ca86936ca std: Add helpers to safely align pointers
Add two helpers to ensure people won't ignore some edge cases such as
pointers overflowing the address space.

Also fix #8924 to some degree, the amount of unchecked alignForward is
still scary.

Revert "tests: disable i386-linux-gnu -lc target due to CI failures"

This reverts commit 97a2f4e7ae.
2021-06-06 18:07:47 -07:00
LemonBoy
5c765b2ec4 std: Fix some BPF fn definitions
Cros-checked with bpf.h of kernel 5.12.9.
2021-06-06 18:02:52 -07:00
LemonBoy
a745a17aa9 build: Avoid using undefined variables
Closes #9013
Closes #8928
Closes #7991
2021-06-06 18:01:52 -07:00
Sebastien Marie
27f6db66e3 openbsd: adjust dynamic linker path (#9010)
the dynamic linker on OpenBSD is at /usr/libexec/ld.so (and not /libexec/ld.so)
2021-06-06 18:01:40 -07:00
LemonBoy
072c3202c3 std: Better handing of POLLHUP in ChildProcess (#8988)
* std: Better handing of POLLHUP in ChildProcess

Upon hitting the EOF condition there are two main differences between
how Linux and the *BSD-derived systems behave: the former sets POLLHUP
and POLLIN and, after reading any residual data, only POLLHUP remains
set. The latter signal the EOF condition by setting both flags thus
requiring some extra checks to determine if the stream is "done".

DragonFly workaround/hack for POLLHUP is no longer required.

Closes #8969
2021-06-05 19:54:26 -07:00
LemonBoy
07852a4bc8 compiler-rt: Fix __floatunsitf signature
The function transforms an unsigned integer into a f128.

Closes #8996
2021-06-05 10:35:05 -07:00
Felix (xq) Queißner
167754b31b Makes std.io.StreamSource usable with freestanding 2021-06-04 13:04:36 -04:00
Jacob G-W
5d94e754f4 fmt: fix #8974
also add a regression test
2021-06-04 10:49:05 +03:00
Andrew Kelley
9c08a33b22 Merge pull request #8750 from lithdew/master
x/io, x/os: async i/o reactor, cross-platform socket syscalls and bits
2021-06-04 01:21:28 -04:00
Martin Wickham
6953c8544b Fix return type of HashMap.getAdapted 2021-06-03 17:58:06 -05:00
Martin Wickham
fc9430f567 Breaking hash map changes for 0.8.0
- hash/eql functions moved into a Context object
- *Context functions pass an explicit context
- *Adapted functions pass specialized keys and contexts
- new getPtr() function returns a pointer to value
- remove functions renamed to fetchRemove
- new remove functions return bool
- removeAssertDiscard deleted, use assert(remove(...)) instead
- Keys and values are stored in separate arrays
- Entry is now {*K, *V}, the new KV is {K, V}
- BufSet/BufMap functions renamed to match other set/map types
- fixed iterating-while-modifying bug in src/link/C.zig
2021-06-03 17:02:16 -05:00
Jonathan Marler
99b6305aa8 handle LimitToBig error on setrlimit 2021-06-01 23:39:48 -04:00
Andrew Kelley
f693247295 Merge pull request #8917 from ifreund/fix-float-tokenize2
stage1, stage2: disallow 1.e9 and 0x1.p9 as float literals
2021-06-01 14:00:54 -04:00
Kenta Iwasaki
4909aa1da4 os/bits: remove duplicate sockaddr_storage for dragonfly 2021-06-01 18:35:13 +09:00
Kenta Iwasaki
aad8491dbd os: make msghdr, msghdr_const, and sockaddr_storage backwards-compatible
`msghdr` and `msghdr_const` definitions have been added back the way
they were in std.os. std.os.sendmsg has also been modified to accept a
msghdr_const again to ensure backwards-compatibility with this PR.
Underneath the hood, std.os.sendmsg will @ptrCast the provided
msghdr_const into a std.x.os.Socket.Message.

`sockaddr_storage` definitions have been added back the way they were in
std.os, except that it now simply aliases
std.x.os.Socket.Address.Native.Storage as all of
std.x.os.Socket.Address.Native.Storage's fields are equivalent to the
fields that were previously defined for std.x.os.bits.sockaddr_storage.

std.x.os.Socket.sendMessage now no longer is a stub that aliases
std.os.sendmsg, but instead calls and handles
errors from std.os.system.sendmsg directly.

Addresses feedback to urge backwards compatibility from @andrewrk.
2021-06-01 18:24:43 +09:00
Kenta Iwasaki
6950e4c294 x/os/net: remove unnecessary comptime prefix in resolveScopeID() 2021-06-01 18:24:43 +09:00
Kenta Iwasaki
278e5d398e x: replace std.builtin with std.Target.current 2021-06-01 18:24:43 +09:00
Kenta Iwasaki
21ec0158a1 os: sockaddr_storage -> std.x.os.Socket.Address.Native.Storage 2021-06-01 18:24:42 +09:00
Kenta Iwasaki
7b6ec3e354 x/os: {read, write}Vectorized() -> {read, write}Message() 2021-06-01 18:23:54 +09:00
lithdew
9ba65592d6 os: have sendmsg, recvmsg flags be c_int 2021-06-01 18:22:58 +09:00
lithdew
12650bcda4 x/os, x/tcp: fix Socket.Message init values and tcp test buf len 2021-06-01 18:22:58 +09:00
lithdew
494665e408 std/c: have sendmsg, recvmsg flags be u32 2021-06-01 18:22:58 +09:00
lithdew
d41575737e std/c: add recvmsg, sendmsg 2021-06-01 18:22:58 +09:00