13565 Commits

Author SHA1 Message Date
David
941090d94f
Move duplicate field detection for struct init expressions into AstGen
Partially addresses #17916.
2023-11-16 14:38:16 +00:00
Krzysztof Wolicki
acf9de376d
Sema: Add error for non-power of 2 field alignment when reifying Unions, Structs, Pointers 2023-11-16 10:19:54 +02:00
Jakub Konka
6e4d7362ce elf: fix emitting start/stop synthetic symbols 2023-11-15 19:20:03 +01:00
Jakub Konka
d771c0a7a1 elf: create .got.plt unconditionally 2023-11-15 19:07:09 +01:00
Jakub Konka
6f3bbd5eaa elf: we were writing too many symbols in the symtab 2023-11-15 19:00:13 +01:00
Jakub Konka
760ce69734 elf: actually write synthetic globals to output symtab 2023-11-15 15:07:09 +01:00
Jacob Young
0c6cb8d8c8 x86_64: actually track state during @divFloor of i128
Closes #17998
2023-11-14 22:50:05 -05:00
Jakub Konka
6fd1c64f23
Merge pull request #17978 from ziglang/elf-x86-tls
x86_64+elf: TLS support
2023-11-14 22:09:15 +01:00
Jakub Konka
4adb8f786f elf: do not pointlessly store zerofill data for TLVs 2023-11-14 16:51:25 +01:00
Jakub Konka
e883907431 coff: revert .rdata to be read-only again 2023-11-13 23:23:06 +01:00
Jakub Konka
028bfdbca3 coff: mark dirty any reloc target at [addr,..) inclusive 2023-11-13 23:07:21 +01:00
Michael Dusan
569182dbb2 compilation: forbid PIE for dynamic libraries
but allow for { .exe, .o, .a }.

closes #17928
2023-11-13 20:30:57 +01:00
Jakub Konka
8c748d5fd7 elf: setting offset to maxInt for non-allocated non-incremental sections is bad 2023-11-13 17:57:57 +01:00
Andrew Kelley
91b897ef58 rework memory management of Module.Namespace hash maps
The motivating problem here was a memory leak in the hash maps of
Module.Namespace.

The commit deletes more of the legacy incremental compilation
implementation. It had things like use of orderedRemove and trying to do
too much OOP-style creation and deletion of objects.

Instead, this commit iterates over all the namespaces on Module deinit
and calls deinit on the hash map fields. This logic is much simpler to
reason about.

Similarly, change global inline assembly to an array hash map since
iterating over the values is a primary use of it, and clean up the
remaining values on Module deinit, solving another memory leak.

After this there are no more memory leaks remaining when using the
x86 backend in a libc-less compiler.
2023-11-12 23:21:21 -05:00
kcbanner
53500a5768 sema: fixup underflows during struct / ptr array init when using -fstrip 2023-11-12 18:22:57 -05:00
Jacob Young
80b73e3e8f x86_64: resolve tlv references on first use and spill to the stack
This avoids any arbitrary memory operand possibly clobbering rax and
sometime rdi with no warning.
2023-11-12 18:12:41 -05:00
Jakub Konka
3d3153c58e x86_64: use .rax for local exec as prescribed by the spec 2023-11-12 18:12:41 -05:00
Jakub Konka
c6833e6273 x86_64: remove unreachable Elf prong 2023-11-12 18:12:41 -05:00
Jakub Konka
575c29e5c4 elf: set symbol flags such as needs_zig_got in ZigObject 2023-11-12 18:12:41 -05:00
Jakub Konka
412519dd49 x86_64: seems like we will need to keep track of rax and reserve rax+rdi for TLS 2023-11-12 18:12:41 -05:00
Jakub Konka
0dab319e86 elf: dump PLT entries 2023-11-12 18:12:41 -05:00
Jakub Konka
984c598590 x86_64: emit TLS local dynamic model when PIC 2023-11-12 18:12:41 -05:00
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 547481c31c8a538a7badbdce66d81820177ce87f.

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