12933 Commits

Author SHA1 Message Date
Andrew Kelley
5cbb642525 stage1: small mem usage improvement for IR
move a boolean field to be represented implicitly with the enum tag.
Just borrowing one of the many strategies of stage2.

This simple change took the peak mem usage from std lib tests on
my machine from 8.21 GiB to 8.11 GiB.
2021-03-18 13:14:26 -07:00
Jakub Konka
17c066e925
Merge pull request #8282 from kubkon/zld
macho: upstream zld linker
2021-03-18 19:14:17 +01:00
Evan Haas
b54514d9dd
translate-c: Use [N:0] arrays when initializer is a string literal (#8264)
* translate-c: Use [N:0] arrays when initializer is a string literal

Translate incomplete arrays as [N:0] when initialized by a string literal.
This preserves a bit more of the type information from the original C program.

Fixes #8215
2021-03-18 14:41:04 +02:00
root
75a7abb0c4 std: Fix std.fs.path.joinZ 2021-03-18 14:33:38 +02:00
Veikka Tuominen
bcc97bc1ed
Merge pull request #8247 from Ersikan/fmt-fix-encoding
zig fmt: fix non-UTF-8 encoding #2820
2021-03-18 14:30:11 +02:00
Jakub Konka
f3b4f79c7f zld: temporarily disable testing shared lib linking 2021-03-18 11:10:31 +01:00
Jakub Konka
2cf1c1b96b macho: honor verbose_link when linking with zld 2021-03-18 11:10:09 +01:00
Jakub Konka
861ea64009 macho: remove now obsolete LLD fixups 2021-03-18 11:09:47 +01:00
Dimenus
dfeca48e35 @intCast takes two args 2021-03-17 22:58:52 -07:00
Jakub Konka
7516dfff83 zld: use zld when linking aarch64 by default and cross-comp 2021-03-18 00:37:13 +01:00
Jakub Konka
900658a85d rebase with master 2021-03-17 20:05:29 +01:00
Jakub Konka
1ec620be62 zld: fix GOT loads and indirection on x86_64 2021-03-17 19:59:57 +01:00
Jakub Konka
ac0c669473 zld: add/fix more issues
* fix debug info for static archives
* allow handling of empty object files
* fix some relocs for GOT loads
2021-03-17 19:59:13 +01:00
Jakub Konka
de209afbba zld: fix TLV initializers 2021-03-17 19:59:13 +01:00
Jakub Konka
349f878ecf zld: mimick Apple and add __DATA_CONST seg 2021-03-17 19:59:13 +01:00
Jakub Konka
62f43fbc06 zld: clean up use of commands.zig module 2021-03-17 19:59:13 +01:00
Jakub Konka
d484b3b3cb zld: use aarch64 for opcodes 2021-03-17 19:59:13 +01:00
Jakub Konka
dc34ac2b9e zld: fix incorrect offset calc for DICE 2021-03-17 19:59:13 +01:00
Jakub Konka
5d8944edc1 Revert log.warn hack 2021-03-17 19:59:13 +01:00
Jakub Konka
a1b0ec5277 zld: start bringing x64 up to speed 2021-03-17 19:59:13 +01:00
Jakub Konka
066c1386a3 zld: demote logs from warn to debug 2021-03-17 19:59:13 +01:00
Jakub Konka
b0ee480177 zld: merge and sort sections 2021-03-17 19:59:13 +01:00
Jakub Konka
44ebf48631 zld: fix handling of section alignment 2021-03-17 19:59:13 +01:00
Jakub Konka
7c22f4f851 zld: pass test-std and test-compiler-rt 2021-03-17 19:59:13 +01:00
Jakub Konka
7cbdbab376 zld: differentiate locals from globals 2021-03-17 19:59:13 +01:00
Jakub Konka
7e32947871 zld: add nop to reloc module 2021-03-17 19:59:13 +01:00
Jakub Konka
d2008db623 zld: bullet-proof stubs for long jumps 2021-03-17 19:59:13 +01:00
Jakub Konka
14590795b1 zld: cleanup section alignment when allocating 2021-03-17 19:59:13 +01:00
Jakub Konka
586c704212 zld: pass stage2 tests linked with zld! 2021-03-17 19:59:13 +01:00
Jakub Konka
e825a15b05 zld: replace ldr with add if indivisible 2021-03-17 19:59:13 +01:00
Jakub Konka
f52f23618d macho: start upstreaming zld 2021-03-17 19:59:13 +01:00
Jakub Konka
0f7b036eb7
Merge pull request #8281 from kubkon/macho-got-refactor
stage2+macho: refactor global offset table for incremental linker
2021-03-17 19:44:32 +01:00
Frank Denis
119fc318a7 std/crypto/chacha20: add round-reduced versions & cleanup internals
See https://eprint.iacr.org/2019/1492.pdf for justification.

8 rounds ChaCha20 provides a 2.5x speedup, and is still believed
to be safe.

Round-reduced versions are actually deployed (ex: Android filesystem
encryption), and thanks to the magic of comptime, it doesn't take much
to support them.

This also makes the ChaCha20 code more consistent with the Salsa20 code,
removing internal functions that were not part of the public API any more.

No breaking changes; the public API remains backwards compatible.
2021-03-17 11:25:51 -07:00
Andrew Kelley
587243c7a5
Merge pull request #8273 from jedisct1/pbkdf2-check
crypto/pbkdf2: simplify the check for the max number of iterations
2021-03-17 11:25:19 -07:00
Jakub Konka
e5234c0e9e macho: offset table part of GOT 2021-03-17 12:16:36 +01:00
Jakub Konka
b9fa80e588 macho: use latest bind functionality 2021-03-17 12:10:39 +01:00
Jakub Konka
1181543dad macho: extract writing stub helper preamble into fn 2021-03-17 12:10:39 +01:00
Jakub Konka
3df2ae1f9d macho: clean up writing of stub helper section 2021-03-17 12:10:39 +01:00
Jakub Konka
643b4898f5 macho: handle all jumps in stubs on aarch64 2021-03-17 12:10:39 +01:00
Jakub Konka
3019676440 macho: apply some renames to bring closer to zld 2021-03-17 12:10:39 +01:00
Ersikan
36db4b7cc4 test-cli: Remove temporary directory after tests 2021-03-17 10:27:41 +01:00
Ersikan
8942243f7a zig fmt: factorize source file reading and decoding
Now reading a source file and decoding it from UTF-16LE to UTF-8 is
done in a single function. Error messages are improved, and an error is
emitted when the source file has a BOM not supported (UTF-16BE, UTF-32).

Please note that the BOM of UTF-32 is composed of the same bytes as the
BOM of UTF-16 followed by a null character. Therefore a source file in
UTF-16LE starting with a null byte will be interpreted as an UTF-32, and
rejeted because of an invalid format. In pratice this is not a problem,
as the code would have been rejected later anyway because of the null
character.
2021-03-17 10:27:26 +01:00
Ersikan
a354000090 zig fmt: fix non-UTF-8 encoding #2820
Fixes #2820

After reading the source code, the first two bytes are inspected, and
if they correspond to a UTF-16 BOM in little-endian order, the source
code is converted to UTF-8.
2021-03-17 10:26:47 +01:00
Frank Denis
6d9b3e7b19 pbkdf2: use std.math.divCeil() 2021-03-17 10:11:47 +01:00
Evan Haas
f76bd56588 translate-c: fix __builtin_object_size
Previous code assumed `c_long` and `usize` were the same size.
Use `isize` instead.
2021-03-17 09:06:47 +02:00
Evan Haas
715370a10a translate-c: demote usage of un-implemented builtins 2021-03-17 09:06:47 +02:00
Andrew Kelley
4683de1e91
Merge pull request #8252 from tadeokondrak/llvm-bool
stage2 llvm bindings: use correct type for LLVMBool for ABI compat
2021-03-16 21:56:00 -07:00
Tadeo Kondrak
e8aa6f90d6
stage2 llvm bindings: use correct type for LLVMBool for ABI compat 2021-03-16 17:05:36 -06:00
Evan Haas
c558a1ae26 translate-c: Implement generic selection expressions
Enables translation of C code that uses the `_Generic` keyword
2021-03-17 00:07:33 +02:00
xackus
9a94415680 translate-c: improve std.meta.cast 2021-03-17 00:05:42 +02:00