26997 Commits

Author SHA1 Message Date
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
ea3f1d27e0 std: disable failing test 2023-11-14 16:51:38 +01:00
Jakub Konka
4adb8f786f elf: do not pointlessly store zerofill data for TLVs 2023-11-14 16:51:25 +01:00
Andrew Kelley
f8b38a174f adjust building from source without LLVM process
The idea here is that the zig2 executable is perhaps the more useful
deliverable until we implement our own optimization passes. This will
allow system packages to provide Zig, and use it to compile Zig
projects, all without LLVM!
2023-11-14 02:17:51 -05: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
xdBronch
5de0636577 expose to build system 2023-11-13 14:57:51 +02:00
Andrew Kelley
caae40c216
Merge pull request #17892 from ziglang/bootstrap-without-llvm
Add an easy way to build from source without LLVM
2023-11-13 01:38:46 -05: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
Andrew Kelley
557cb64691 bootstrap.c: add -pthread if the compiler is gnu
otherwise we get undefined symbol errors on pthread stuff
2023-11-12 17:30:24 -07:00
Jacob Young
0dbaa8d3ae zig.h: workaround for gcc f128 miscompilations 2023-11-12 17:30:24 -07:00
Andrew Kelley
f45aac4903 CI: test building from source without LLVM 2023-11-12 17:30:24 -07:00
Andrew Kelley
3c921522b5 bootstrap.c: update aro module 2023-11-12 17:30:24 -07:00
Andrew Kelley
910143e54c README: make note of what features are missing without LLVM 2023-11-12 17:30:24 -07:00
Andrew Kelley
621e89a863 add bootstrap.c for building from source without LLVM
When a zig compiler without LLVM extensions is satisfactory, this
greatly simplified build-from-source process can be used.

This could be useful for users who only want to contribute to the
standard library, for example.
2023-11-12 17:30:24 -07: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
Andrew Kelley
78df899b88
Merge pull request #17967 from jacobly0/x86_64-cases 2023-11-11 04:42:33 -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
Andrew Kelley
97e23896a9
Merge pull request #17962 from ziglang/libssp
move libssp into libcompiler_rt
2023-11-10 22:27:45 -05:00
Jacob Young
89cac88e91 behavior: add testing for LLVM SROA bugs 2023-11-10 18:04:09 -05:00
Jacob Young
59375b3c22 llvm: workaround SROA misoptimizations in LLVM
Workaround #16392
2023-11-10 15:46:42 -05:00
dweiller
138a35df8f zstandard: fix division by zero when using RingBuffer
This change fixes some division-by-zero bugs introduced by the optimized
ring buffer read/write functions in d8c067966.

There are edge cases where decompression can use a length zero ring
buffer as the size of the ring buffer used is exactly the the window
size specified by a Zstandard frame, and this can be zero. Switching
away from loops to mem copies means that we need to ensure ring buffers
do not have length zero ring when attempting to read/write from them.
2023-11-10 15:18:16 -05:00
Andrew Kelley
dfee782d7c compiler_rt: provide strncpy impl for ssp 2023-11-10 13:12:16 -07:00
Andrew Kelley
53f74d6a04 move libssp into libcompiler_rt
closes #7265
2023-11-10 13:12:10 -07:00
Andrew Kelley
2a81a0f388 stage1: we don't need have_stage1 config option anymore 2023-11-10 13:12:05 -07:00