26948 Commits

Author SHA1 Message Date
Andrew Kelley
2a81a0f388 stage1: we don't need have_stage1 config option anymore 2023-11-10 13:12:05 -07:00
Andrew Kelley
24b020d9f6 Compilation: fix logic regarding needs_c_symbols 2023-11-10 13:12:00 -07:00
Jakub Konka
9ad03b628f
Merge pull request #17955 from ziglang/issue-17951
macho: handle special section/segment boundary symbols
2023-11-10 18:36:06 +01:00
Bogdan Romanyuk
ec934c6d32 disallow calling @trap at comptime 2023-11-10 18:39:42 +02:00
Jakub Konka
17177727c0 test/link: refactor common bits between ELF and MachO tests 2023-11-10 13:50:33 +01:00
Jakub Konka
7566a8fbd8 test/link: spawn ELF and MachO tests from the same root test/link/link.zig 2023-11-10 13:44:43 +01:00
Jakub Konka
197fd41e27 macho: check for null Module before creating llvm_object 2023-11-10 13:43:43 +01:00
Jakub Konka
0f2489d8fc macho: resolve special section/segment boundary symbols
Boundary symbols have a special name prefix:

* section$start$segname$sectname
* section$stop$segname$sectname
* segment$start$segname
* segment$stop$segname

and will resolve to either start or end of the respective
section/segment if found.

If not found, we return an error stating we couldn't find the
requested section/segment rather than silently failing and resolving
the address to 0 which seems to be the case with Apple's ld64.
2023-11-10 12:52:56 +01:00
Andrew Kelley
03adafd802
Merge pull request #17947 from jacobly0/fwd-clang-errs
Compilation: forward clang diagnostics to error bundles
2023-11-10 02:35:22 -05:00
Jakub Konka
c550eb3e8a
Merge pull request #17933 from ziglang/elf-r-mode
elf: the dreaded `-r` mode
2023-11-10 07:57:52 +01:00
mlugg
3f10b3ee1e Sema: do not allow comptime-only pointer fields in packed structs 2023-11-10 06:51:48 +00:00
mlugg
e9b3fcaa43 Sema: remove unused function 2023-11-10 06:51:48 +00:00
Jacob Young
a67d378543 stage1: implement wasi seek shim 2023-11-09 20:12:47 -05:00
Jakub Konka
73fd4ed54b test/link/elf: make .eh_frame relocatable test also verify COMDATs we emit 2023-11-09 23:22:47 +01:00
Jakub Konka
08882234d1 elf: fix overflowing designated capacity when writing COMDAT groups 2023-11-09 23:16:41 +01:00
Jacob Young
10f4486c0b Compilation: forward clang diagnostics to error bundles 2023-11-09 16:43:12 -05:00
Jakub Konka
6e797d8648 elf: add SHF_INFO_LINK flag to any emitted SHT_RELA section 2023-11-09 19:41:50 +01:00
Jakub Konka
27970bab07 elf: format shdr flags when dumping state 2023-11-09 18:49:19 +01:00
Bogdan Romanyuk
6b9f7e26c9 preserve 'undefined' in @bitCast 2023-11-09 19:40:20 +02:00
Jakub Konka
03c3a85ea3 elf: write out COMDAT groups to file 2023-11-09 18:29:58 +01:00
Jakub Konka
acd7cbf0b5 elf: init output COMDAT group sections 2023-11-09 17:41:14 +01:00
Bogdan Romanyuk
ee8da40769 replace deprecated std.math.absCast 2023-11-09 17:39:27 +02:00
Jakub Konka
031d9faf02 elf: separate logic for reseting shdr indexes into a separate fn 2023-11-09 15:05:29 +01:00
Jakub Konka
50f48022f0 test/link/elf: fix .eh_frame test 2023-11-09 14:51:00 +01:00
Jakub Konka
1f8dd27e40 elf: correctly format output .eh_frame when emitting relocatable 2023-11-09 14:46:28 +01:00
Jakub Konka
b1fcf0ed8f elf: emit .rela.eh_frame section contents 2023-11-09 12:24:49 +01:00
Jakub Konka
0efc471122 elf: calculate required size for .rela.eh_frame 2023-11-09 12:02:20 +01:00
Jakub Konka
666ac6bf9b elf: track .rela.eh_frame section and emit .eh_frame section symbol 2023-11-09 11:49:32 +01:00
Jakub Konka
f607126614 test/link/elf: verify we can output a valid relocatable with .eh_frame section 2023-11-09 11:49:04 +01:00
Jakub Konka
0de5dd2ef1 elf: misc fixes 2023-11-09 10:32:39 +01:00
Linus Groh
e72049bc61 std.math: Add isPositiveZero() and isNegativeZero() 2023-11-09 00:55:43 -07:00
Andrew Kelley
b2ed2c4d4f
Merge pull request #17888 from AdamGoertz/zig-reduce
zig-reduce: Add reductions for `if` and `while`
2023-11-09 00:52:38 -07:00
mlugg
d99bed1b10 Sema: optimize runtime array_mul
There are two optimizations here, which work together to avoid a
pathological case.

The first optimization is that AstGen now records the result type of an
array multiplication expression where possible. This type is not used
according to the language specification, but instead as an optimization.
In the expression '.{x} ** 1000', if we know that the result must be an
array, then it is much more efficient to coerce the LHS to an array with
length 1 before doing the multiplication. Otherwise, we end up with a
1000-element tuple which we must coerce to an array by individually
extracting each field.

Secondly, the previous logic would repeatedly extract element/field
values from the LHS when initializing the result. This is unnecessary:
each element must only be extracted once, and the result reused.

These changes together give huge improvements to compiler performance on
a pathological case: AIR instructions go from 65551 to 15, and total AIR
bytes go from 1.86MiB to 264.57KiB. Codegen time spent on this function
(in a debug compiler build) goes from minutes to essentially zero.

Resolves: #17586
2023-11-08 23:55:53 -07:00
Andrew Kelley
a1d688b86a
Merge pull request #17913 from jacobly0/vararg-int
Sema: implement vararg integer promotions
2023-11-08 23:52:59 -07:00
mlugg
997eaf6d87 Sema: do not force resolution of struct field inits when calling function pointer field
b3462b7 caused a regression in a third-party project, since it forced
resolution of field initializers for any field call 'foo.bar()', despite
this only being necessary when 'bar' is a comptime field.

See https://github.com/ziglang/zig/pull/17692#issuecomment-1802096734.
2023-11-08 23:47:10 -07:00
frmdstryr
f258a391da
Speed up ast.tokenLocation 2023-11-09 01:45:25 +00:00
Luuk de Gram
2ac0ba03a6 wasm-linker: ensure symbol fields are set for decls
Previously the symbol tag field would remain `undefined` until it
was set during `flush`. However, the symbol's tag would be observed
earlier than where it was being set. We now set it to the explicit
tag `undefined` so this can be caught during debug. The symbol tag of
a decl will now also be set right after `updateDecl` and `updateFunc`.

Likewise, we now also set the `name` field during atom creation for
decls, as well as set the other fields to the max(u32) to ensure we
get a compiler crash during debug to ensure any misses will be caught.
2023-11-09 00:00:17 +01:00
Veikka Tuominen
10a28bc4c4
Merge pull request #17935 from ianic/fix_io_uring_test_kernel_5_4
Fix io_uring tests on kernel 5.4
2023-11-09 00:49:22 +02:00
Andrew Kelley
be14fe1fa1
Merge pull request #17930 from jacobly0/x86_64
x86_64: pass more tests with an x86_64 backend compiled compiler
2023-11-08 13:51:59 -07:00
Jacob Young
52d8099dae Sema: don't allow passing non-extern types to varargs parameters 2023-11-08 14:43:23 -05:00
Jacob Young
045a5e924c Sema: implement vararg integer promotions 2023-11-08 14:43:23 -05:00
Igor Anić
715e5f757f fix io_uring tests on kernel 5.4
Unsupported tests are now skipped on kernel 5.4:
```
uname -a
Linux d20 5.4.0-166-generic #183-Ubuntu SMP Mon Oct 2 11:31:37 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
zig test lib/std/std.zig --zig-lib-dir lib --main-mod-path lib/std 2>&1 | cat
709/2616 test.nop... OK
710/2616 test.readv... OK
711/2616 test.writev/fsync/readv... OK
712/2616 test.write/read... SKIP
713/2616 test.splice/read... SKIP
714/2616 test.write_fixed/read_fixed... OK
715/2616 test.openat... SKIP
716/2616 test.close... SKIP
717/2616 test.accept/connect/send/recv... SKIP
718/2616 test.sendmsg/recvmsg... OK
719/2616 test.timeout (after a relative time)... SKIP
720/2616 test.timeout (after a number of completions)... OK
721/2616 test.timeout_remove... SKIP
722/2616 test.accept/connect/recv/link_timeout... SKIP
723/2616 test.fallocate... SKIP
724/2616 test.statx... SKIP
725/2616 test.accept/connect/recv/cancel... SKIP
726/2616 test.register_files_update... SKIP
727/2616 test.shutdown... SKIP
728/2616 test.renameat... SKIP
729/2616 test.unlinkat... SKIP
730/2616 test.mkdirat... SKIP
731/2616 test.symlinkat... SKIP
732/2616 test.linkat... SKIP
733/2616 test.provide_buffers: read... SKIP
734/2616 test.remove_buffers... SKIP
735/2616 test.provide_buffers: accept/connect/send/recv... SKIP
736/2616 test.accept multishot... SKIP
```
2023-11-08 18:52:03 +01:00
Jakub Konka
0299ed5036 elf: fix 32bit build 2023-11-08 18:45:43 +01:00
Jakub Konka
9bcb432a0e elf: test emitting relocatable 2023-11-08 18:41:09 +01:00
Igor Anić
7a1dbbd4f9 fix io_uring timeout_remove test on kernel 5.4
There is no grantee that `copy_cqes` will return exactly wait_nr number of cqes.
If there are ready cqes it can return > 0 but < wait_nr number of cqes.
2023-11-08 18:25:29 +01:00
Jakub Konka
29d7727254 elf: emit SHN_COMMON symbols in -r mode 2023-11-08 18:15:41 +01:00
Jakub Konka
0b4d398c40 elf: streamline codepaths for different linker modes (object, ar, exe/dyn) 2023-11-08 17:35:56 +01:00
Jakub Konka
a16e6706b3 elf: LLVM emits relocs to undef local symbols - color me surprised! 2023-11-08 15:10:28 +01:00
Jacob Young
e387d30b26 x86_64: fix signed not of more than 64 bits 2023-11-08 08:49:34 -05:00
Jacob Young
6c15c34421 MachO: support -fsingle-threaded mode 2023-11-08 08:40:10 -05:00