23178 Commits

Author SHA1 Message Date
Jakub Konka
49e33a2f23
Merge pull request #15052 from jacobly0/x86-val-tracking
x86_64: fix value tracking bugs
2023-03-25 08:34:57 +01:00
tjog
f6a2b72ba8 std.process.Child: implement maxrss on Darwin
Notably the Darwin (XNU) kernel the maxrss field is number of bytes
and not kilobytes (kibibytes) like other platforms (e.g. Linux, BSD).

watchOS and tvOS are not supported because they do not have the ability
to spawn a child process. iOS is enabled but due to OS sandboxing it
should fail with a permission error.
2023-03-25 03:20:50 +01:00
Jacob Young
4ab4bd04fe x86_64: add back assume unused
This seems to have been asserting due to a value tracking bug that has
since been fixed.
2023-03-24 21:34:38 -04:00
Jacob Young
0987ed1970 x86_64: detect canonicalisation hazards 2023-03-24 17:57:58 -04:00
Jacob Young
5e0f091684 x86_64: try to fix br canonicalization 2023-03-24 17:57:58 -04:00
Jacob Young
935ec9ec6a x86_64: canonicalize each br of a block 2023-03-24 17:57:58 -04:00
Jacob Young
c604111e22 x86_64: fix block result value tracking 2023-03-24 17:57:58 -04:00
Jacob Young
12c07fcf20 x86_64: fix more value tracking bugs 2023-03-24 17:57:58 -04:00
Jacob Young
dbe1b4a7e5 x86_64: fix value tracking bugs 2023-03-24 17:57:58 -04:00
Jakub Konka
f99b75360d
Merge pull request #15061 from ziglang/fix-15036
build: fix adding rpaths on darwin, improve CheckObjectStep to allow matching FileSource paths
2023-03-24 07:22:05 +01:00
Jakub Konka
3aa0a7ecdf
Merge pull request #15035 from xEgoist/windowsMaxRss
Implement getMaxRss for Windows
2023-03-24 07:16:49 +01:00
Jakub Konka
145f93ba96 build: allow for deferred FileSource matching in CheckObjectStep
Re-enable all of functionality of MachO dylib test.
2023-03-23 23:46:53 +01:00
Jakub Konka
5d2892740a build: when parsing rpaths, do not expand special runtime paths on Darwin
Special runtime paths on Darwin are: `@executable_path` and `@loader_path`.
2023-03-23 22:35:27 +01:00
Jakub Konka
dcdb878360 macho+zld: only check for alias symbols for non-extern relocations 2023-03-23 22:32:09 +01:00
Mateusz Poliwczak
4d31e3c917 std.base64: don't overflow dest with padding 2023-03-23 22:52:15 +02:00
xEgoist
8f4548dd69 fmt: lib/std/os/windows/ntdll.zig 2023-03-23 15:20:03 -05:00
xEgoist
2f5af6c972 Refactored GetProcessMemoryInfo to return VM_COUNTERS
This change allows the function to return the process memory info
directly instead of copying the result of the underlying Nt function.
2023-03-23 06:13:26 -05:00
Phil Eaton
38ee46dda3
Two more examples of possible syntax when dealing with errors (#15042)
Add an example of if with try without else switch; add example of catch with block returning value
2023-03-23 10:06:46 +01:00
Frank Denis
9fedecf4ab
http.Client: don't prematurely check transfer_{encoding,compression} (#15040)
Common headers in a response are:

    Content-Encoding: gzip
    Transfer-Encoding: chunked

We used to return `HttpHeadersInvalid` if a `Transfer-Encoding` header
was received while the compression was already set.

However, Transfer-Encoding may not include compression. We should
only return an error if we are setting a value that was already set.

Fixes compatibility with a bunch of websites.
2023-03-23 10:05:58 +01:00
Jakub Konka
dc6b05408a
Merge pull request #15041 from ziglang/fix-14923
macho: fix Go mislinking on aarch64-macos, and misc cleanup
2023-03-22 18:30:00 +01:00
Frank Denis
d61ac0db8c
TLS: Favor ChaCha over AES-based ciphers on CPUs without AES support (#15034)
On CPUs without AES support, ChaCha is always faster and safer than
software AES.

Add `crypto.core.aes.has_hardware_support` to represent whether
AES acceleration is available or not, and in `tls.Client`, favor
AES-based ciphers only if hardware support is available.

This matches what BoringSSL is doing.
2023-03-22 17:58:24 +01:00
Jakub Konka
1eb4264b7a macho+zld: make sure we populate source section index lookup if no undefs 2023-03-22 15:13:52 +01:00
Jakub Konka
c984201ddb macho+zld: refactor parsing of relocation target 2023-03-22 15:13:17 +01:00
xEgoist
70469d428d Implemented Zig wrapper for GetProcessMemoryInfo
`GetProcessMemoryInfo` is implemented using `NtQueryInformationProcess`
with `ProcessVmCounters` to obtain `VM_COUNTERS`. The structs, enum
definitions are found in `winternl.h` or `ntddk.h` in the latest WDK.
This should give the same results as using `K32GetProcessMemoryInfo`
2023-03-22 06:13:11 -05:00
xEgoist
cc44183787 Implemented getMaxRss for Windows
In Windows, the equivalent to maxrss is PeakWorkingSetSize which is
found in PROCESS_MEMORY_COUNTERS in bytes.

Currently, this is done by calling `GetProcessMemoryInfo` in kernel32.
2023-03-22 06:13:11 -05:00
Frank Denis
84b89d7cfe
crypto.hmac: set the recommended key size to the block size (#15031)
HMAC supports arbitrary key sizes, and there are no practical reasons
to use more than 256 bit keys.

It still makes sense to match the security level, though, especially
since a distinction between the block size and the key size can be
confusing.

Using HMAC.key_size instead of HMAC.mac_size caused our TLS
implementation to compute wrong shared secrets when SHA-384 was
used. So, fix it directly in `crypto.hmac` in order to prevent
other misuses.
2023-03-22 06:17:52 +00:00
Jakub Konka
8bffe87e9e macho: collect all exports into the export trie 2023-03-21 21:31:24 +01:00
Jakub Konka
1be8621815 macho+zld: when finding by address, note the end of section symbols too
Previously, if we were looking for the very last symbol by address in some
section, and the next symbol happened to also have the same address value
but would reside in a different section, we would keep going finding the
wrong symbol in the wrong section.

This mechanism turns out vital for correct linking of Go binaries
where the runtime looks for specially crafted synthetic symbols
which mark the beginning and end of each section. In this case,
we had an unfortunate clash between the end of PC marked machine code
section (`_runtime.etext`) and beginning of read-only data (`_runtime.rodata`).
2023-03-21 21:27:22 +01:00
Veikka Tuominen
87e07d8671 fix broken test cases exposed by ec445fb6b8bb3f3d423cafa4f3a7860da65ca233
shoulda rebased
2023-03-21 20:57:14 +02:00
Jakub Konka
dc98009e36 macho+zld: save all defined globals in the export trie 2023-03-21 16:12:25 +01:00
Jakub Konka
cb34d6f436 macho+zld: put locals and globals in function-starts section 2023-03-21 14:43:02 +01:00
Jakub Konka
83352678d4 macho+zld: put __TEXT bound sections in __TEXT segment 2023-03-21 14:30:30 +01:00
Roman Frołow
0787b11f19
naming: mid for index and mid_item for item 2023-03-21 15:12:13 +02:00
John Schmidt
ec445fb6b8 Improve error messages for break type coercion 2023-03-21 15:09:42 +02:00
r00ster91
8642770eff langref: add missing return types to builtin functions
This should add all remaining missing return types to all builtin
functions.
For @clz, @ctz, and @popCount it uses anytype for the lack of a better
alternative. We already use this return type for other builtin functions in the langref
to indicate that the type is not always the same.
It is not possible to use anytype as the return type for regular
functions but builtin functions are special.
2023-03-21 15:05:57 +02:00
mlugg
f9b5829508 Sema: implement @export for arbitrary values 2023-03-21 15:04:39 +02:00
Veikka Tuominen
5e161c102d
Merge pull request #14841 from squeek502/is-cygwin-pty-stuff
`os.isCygwinPty`: Fix a bug, replace kernel32 call, and optimize
2023-03-21 15:03:33 +02:00
Marcus Ramse
1e087d3a64 std.json: support tuples 2023-03-21 15:01:45 +02:00
Veikka Tuominen
cd3575b0f0
Merge pull request #14848 from r00ster91/json
std.json: fix 2 TODOs
2023-03-21 15:00:47 +02:00
Xavier Bouchoux
898e4473e8 CBE: implement aggregateInit() for array of array case.
fixes `error(compilation): clang failed with stderr: error: array type 'uint32_t[10]' (aka 'unsigned int[10]') is not assignable`
2023-03-21 14:56:04 +02:00
Veikka Tuominen
f7204c7f37
Merge pull request #15028 from Vexu/compile-errors
Sema: improve error message of field access of wrapped type
2023-03-21 14:55:36 +02:00
Jakub Konka
b73159f4f5 macho: use TOOL=0x5 to mean ZIG as the build tool 2023-03-21 13:47:09 +01:00
Jakub Konka
073f9a18a9 macho+zld: return null rather than error on invalid AbbrevKind 2023-03-21 11:38:49 +01:00
Jakub Konka
a88ffa7fa9 macho+zld: save locals from section atoms to symtab too 2023-03-21 11:38:19 +01:00
Jakub Konka
515e1c93e1
Merge pull request #14993 from jacobly0/x86_64
x86_64: implement more operations
2023-03-21 11:16:29 +01:00
Jacob Young
c58b5732f3 x86_64: implement @byteSwap and @bitReverse 2023-03-21 08:49:54 +01:00
Jacob Young
f316cb29cc x86_64: implement atomic and fence ops 2023-03-21 08:49:54 +01:00
Jacob Young
3f4569bf18 codegen: fix backend breakage due to optional layout change 2023-03-21 08:49:54 +01:00
Jacob Young
6c453dd806 x86_64: implement some slice ops 2023-03-21 08:49:54 +01:00
Jacob Young
958c8e1ce9 x86_64: implement @popCount for older processors
This fixes the behavior tests when compiled for baseline.
2023-03-21 08:49:54 +01:00