Commit Graph

13543 Commits

Author SHA1 Message Date
Jakub Konka 51efee2cb6 elf: fix allocating local TLS symbols 2023-11-12 18:12:41 -05:00
Jakub Konka 1afc6917f5 x86_64: get something going for the local exec model 2023-11-12 18:12:41 -05:00
Jakub Konka b48baeeebb elf: fix typo in initial section offsets 2023-11-12 18:12:41 -05:00
Jakub Konka aa0fbbcb39 elf: check for empty relocs buffers in ZigObject before emitting section 2023-11-12 18:12:40 -05:00
Jakub Konka f34247c4bc elf: lower TLS data into appropriate TLS section 2023-11-12 18:12:40 -05:00
Andrew Kelley 70d8baaec1 Revert "Sema: fix comparison with undefined"
This reverts commit 547481c31c.

There is a comment that did not get addressed with this patch, and the
required test cases are not added.

Reopens #17798.
2023-11-12 14:33:17 -07:00
Ian Johnson 7048e93665 Package.Fetch.git: handle optional pkt-line LF
Addresses a comment in #17779 pointing out the inability to fetch the
upstream BoringSSL sources over Git. The reason for this is because the
Git server used in this case did not include the optional (but
recommended) LF terminator for textual pkt-line data. This commit
adjusts handling of textual pkt-line data so that it works both with and
without the optional trailing LF.
2023-11-12 05:11:23 -05:00
Bogdan Romanyuk 547481c31c Sema: fix comparison with undefined 2023-11-12 11:03:23 +02:00
Jacob Young 2eeb735822 Dwarf: improve x86_64 backend debug info
Closes #17811
2023-11-12 03:21:52 -05:00
kcbanner 3fc6a2f113 sema: pass sema through if available for the array_type case in bitSizeAdvanced 2023-11-11 13:11:51 +00:00
Andrew Kelley 63e5476450 Merge pull request #17963 from jacobly0/workaround/16392
llvm: workaround SROA misoptimizations in LLVM
2023-11-11 05:08:36 -05:00
Jacob Young ae8992629c BitcodeReader: followup cleanup 2023-11-10 22:35:35 -05:00
Jacob Young d93f1f3c72 Sema: detect unneeded source locations earlier
This avoids a lot of work that just needs deferred cleanup anyway.
Crucially, also avoids use of undefined in `failWithNeededComptime`.
2023-11-10 22:35:35 -05:00
Jacob Young b5f89d681f Module: fix use of undefined during decl cleanup 2023-11-10 22:35:35 -05:00
Jacob Young 59375b3c22 llvm: workaround SROA misoptimizations in LLVM
Workaround #16392
2023-11-10 15:46:42 -05:00
Andrew Kelley 53f74d6a04 move libssp into libcompiler_rt
closes #7265
2023-11-10 13:12:10 -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 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
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
Jakub Konka 031d9faf02 elf: separate logic for reseting shdr indexes into a separate fn 2023-11-09 15:05:29 +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 0de5dd2ef1 elf: misc fixes 2023-11-09 10:32:39 +01: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
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
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
Jakub Konka 0299ed5036 elf: fix 32bit build 2023-11-08 18:45:43 +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