31141 Commits

Author SHA1 Message Date
Jakub Konka
1714b74edf incr-check: actually handle end message for a compiler update 2024-09-25 17:54:50 +02:00
Jakub Konka
1c2048ebcc incr-check: add --debug-link flag for verbose linker logging 2024-09-25 17:54:50 +02:00
Jakub Konka
50074a835a elf: remove unused code 2024-09-25 17:54:50 +02:00
Jakub Konka
10c68d05db elf: change how we create new program headers
We do not want to create additional ones per update that are duplicates
of existing ones.
2024-09-25 17:54:50 +02:00
Jakub Konka
992c6c3f68 elf: reset output symtab contexts before re-updating 2024-09-25 17:54:50 +02:00
Jakub Konka
82cf762b02 elf: reset (merge) sections sizes before updating 2024-09-25 17:54:50 +02:00
Jakub Konka
db3db1150e elf: do not re-create special program headers if already created 2024-09-25 17:54:50 +02:00
Jakub Konka
62c282ba46 elf: do not re-create synthetic sections if already created 2024-09-25 17:54:50 +02:00
Maciej 'vesim' Kuliński
4ceefca14b mips: use byval for all integer types 2024-09-25 07:37:03 -07:00
Andrew Kelley
efc98fcbeb disallow non-scalar sentinel types
see #17969
2024-09-25 03:02:05 -07:00
Alex Rønne Petersen
a40cdad18c tsan: Update to LLVM 19.1.0. 2024-09-24 23:58:21 -07:00
matt
7f6b7c5608 fix THREAD_STATE_NONE on darwin
#21094
2024-09-24 22:41:00 -07:00
Krzysztof Wolicki
4d09fb491f
fetch: fix mutating unrelated fields when saving (#19816)
closes #19725
2024-09-24 13:38:13 -07:00
Meghan Denny
5e4da1ff30
std: add arch bits for s390x-linux (#21342)
see #21402
2024-09-24 13:35:12 -07:00
Nameless
8d76c02f9a uefi: erroneous alignment check in pool_allocator
Fixes #21446

Both UefiPoolAllocator and UefiRawPoolAllocator were
passing the value of `log2_ptr_align` directly to
`mem.alignAllocLen` which expects a alignment value.

Both of these calls to `mem.alignAllocLen` are pointless
and the result of the alignment both always true, and
was thrown away anyway.

I have removed these calls entirely.
2024-09-24 13:30:53 -07:00
WillLillis
37cd21eb5f fix: disallow discard as errdefer capture 2024-09-24 13:21:06 -07:00
Alex Kladov
ffd071f558 fix IB in fifoToOwnedArrayList
memcpy requires non-overlapping arguments.

fifo.realign() handles this case correctly and tries to provide an
optimized implementation.

This probably wasn't hit in practice, as, in a typical usage, fifo's
head is not advanced.
2024-09-24 13:19:06 -07:00
Frank Denis
c062c532d7 Add post-quantum key agreement X25519MLKEM768
X25519MLKEM768 replaces X25519Kyber768Draft00 now that NIST has
released ML-KEM.

IANA has assigned the codepoint 0x11ec:
https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8
2024-09-24 13:18:32 -07:00
Alex Rønne Petersen
d3ba5f397d compiler-rt: Export extra soft float libcall names for thumb-windows-gnu. 2024-09-23 21:20:00 -07:00
Alex Rønne Petersen
5daf47a212 zig.h: Improve portability of zig_trap() and zig_breakpoint(). 2024-09-23 17:34:15 -07:00
Alex Rønne Petersen
c1cc63e5ff libc: Work around LLVM's misassembly of j <reg> on mips r6.
See: https://github.com/ziglang/zig/issues/21315
2024-09-23 17:26:30 -07:00
Lucas Santos
b19d0fb0fd
Improve efficiency of buffered_reader. (#21256)
The previous implementation of buffered_reader always reads from the
unbuffered reader into the internal buffer, and then dumps the data onto
the destination. This is inefficient, as sometimes it's possible to read
directly into the destination. The previous strategy generates more
memory copies and unbuffered reads than necessary.
2024-09-23 17:20:27 -07:00
Alex Rønne Petersen
d1901c744c std.Target: Remove Cpu.Arch.dxil and ObjectFormat.dxcontainer.
See: https://devblogs.microsoft.com/directx/directx-adopting-spir-v

Since we never hooked up the (experimental) DirectX LLVM backend, we've never
actually supported targeting DXIL in Zig. With Microsoft moving away from DXIL,
that seems very unlikely to change.
2024-09-23 17:17:25 -07:00
Fri3dNstuff
b2c53eb0d7
std.math: change gcd's implementation to use Stein's algorithm instead of Euclid's (#21077) 2024-09-23 17:15:57 -07:00
Andrew Kelley
a08f8d44da
Merge pull request #21472 from alexrp/libunwind
`libunwind`: Update `gcc_personality_v0.c` to LLVM 19.1.0.
2024-09-23 13:19:14 -07:00
Igor Stojković
0676c04681
tokenizer: fix 0 byte following invalid (#21482)
closes #21481
2024-09-23 13:06:30 -07:00
Will Lillis
943176bbfc
fix: Add error note when attempt is made to destructure error union (#21491)
closes #21417
2024-09-23 13:04:24 -07:00
Lucas Santos
509639717a std.equalRange: Compute lower and upper bounds simultaneously
The current implementation of `equalRange` just calls `lowerRange` and `upperRange`, but a lot of
the work done by these two functions can be shared. Specifically, each iteration gives information about whether the lower bound or the upper bound can be tightened. This leads to fewer iterations and, since there is one comparison per iteration, fewer comparisons.
Implementation adapted from [GCC](519ec1cfe9/libstdc%2B%2B-v3/include/bits/stl_algo.h (L2063)).
This sample demonstrates the difference between the current implementation and mine:

```zig
fn S(comptime T: type) type {
    return struct {
        needle: T,
        count: *usize,

        pub fn order(context: @This(), item: T) std.math.Order {
            context.count.* += 1;
            return std.math.order(item, context.needle);
        }
        pub fn orderLength(context: @This(), item: []const u8) std.math.Order {
            context.count.* += 1;
            return std.math.order(item.len, context.needle);
        }
    };
}
pub fn main() !void {
    var count: usize = 0;

    try std.testing.expectEqual(.{ 0, 0 }, equalRange(i32, &[_]i32{}, S(i32){ .needle = 0, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 0, 0 }, equalRange(i32, &[_]i32{ 2, 4, 8, 16, 32, 64 }, S(i32){ .needle = 0, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 0, 1 }, equalRange(i32, &[_]i32{ 2, 4, 8, 16, 32, 64 }, S(i32){ .needle = 2, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 2, 2 }, equalRange(i32, &[_]i32{ 2, 4, 8, 16, 32, 64 }, S(i32){ .needle = 5, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 2, 3 }, equalRange(i32, &[_]i32{ 2, 4, 8, 16, 32, 64 }, S(i32){ .needle = 8, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 5, 6 }, equalRange(i32, &[_]i32{ 2, 4, 8, 16, 32, 64 }, S(i32){ .needle = 64, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 6, 6 }, equalRange(i32, &[_]i32{ 2, 4, 8, 16, 32, 64 }, S(i32){ .needle = 100, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 2, 6 }, equalRange(i32, &[_]i32{ 2, 4, 8, 8, 8, 8, 15, 22 }, S(i32){ .needle = 8, .count = &count }, S(i32).order));
    try std.testing.expectEqual(.{ 2, 2 }, equalRange(u32, &[_]u32{ 2, 4, 8, 16, 32, 64 }, S(u32){ .needle = 5, .count = &count }, S(u32).order));
    try std.testing.expectEqual(.{ 1, 1 }, equalRange(f32, &[_]f32{ -54.2, -26.7, 0.0, 56.55, 100.1, 322.0 }, S(f32){ .needle = -33.4, .count = &count }, S(f32).order));
    try std.testing.expectEqual(.{ 3, 5 }, equalRange(
        []const u8,
        &[_][]const u8{ "Mars", "Venus", "Earth", "Saturn", "Uranus", "Mercury", "Jupiter", "Neptune" },
        S(usize){ .needle = 6, .count = &count },
        S(usize).orderLength,
    ));

    std.debug.print("Count: {}\n", .{count});
}
```
For each comparison, we bump the count. With the current implementation, we get 57 comparisons. With mine, we get 43.

With contributions from @Olvilock.
This is my second attempt at this, since I messed up the [first one](https://github.com/ziglang/zig/pull/21290).
2024-09-23 13:03:06 -07:00
Jakub Konka
8c232922bd
Merge pull request #21493 from ziglang/elf-fixes
elf: misc fixes
2024-09-23 10:58:02 +02:00
Jakub Konka
e0acf43248 elf: always override existing __start/__stop symbols 2024-09-23 07:06:47 +02:00
Jakub Konka
7c2abff1e1 elf: only allocate __dso_handle symbol if not found in any object 2024-09-23 07:06:41 +02:00
Jakub Konka
6929a5f440 elf: remove dead code 2024-09-23 06:59:03 +02:00
Jakub Konka
f4c4ca4b4c elf: fix condition for skipping symbols if atom is dead
Skipping the symbols too early when resolving would end up in the
linker not deduping CIEs fully.
2024-09-23 06:56:36 +02:00
Alex Rønne Petersen
a9d1c6acb2
libunwind: Use -Wno-dll-attribute-on-redeclaration for Windows like upstream.
This silences a bunch of noisy warnings when building libunwind.
2024-09-21 01:20:36 +02:00
Alex Rønne Petersen
9bc2185997
libunwind: Update gcc_personality_v0.c to LLVM 19.1.0.
Notably, this fixes libunwind compilation for thumb-windows-gnu.
2024-09-21 01:16:47 +02:00
mochalins
d83a3f1746 doc: Bump LLVM version in README 2024-09-19 23:06:09 -07:00
Andrew Kelley
c6ad4521c7 Merge branch 'llvm19'
Upgrades the LLVM, Clang, and LLD dependencies to LLVM 19.x

Related to #16270

Big thanks to Alex Rønne Petersen for doing the bulk of the upgrade work
in this branch.
2024-09-19 22:47:56 -07:00
Andrew Kelley
075ec55552 disable failing test
tracked by #21457
2024-09-19 18:20:22 -07:00
Andrew Kelley
6294e65eeb compiler_rt does not need a build_options module 2024-09-19 18:20:22 -07:00
Andrew Kelley
cefcf39faa compiler_rt: strong linkage when compiling to .c
This works around a problem that started happening with LLD around
version 18.1.8:

```
lld-link: error: duplicate symbol: .weak.__nexf2.default
>>> defined at CMakeFiles/zig2.dir/compiler_rt.c.obj
>>> defined at compiler_rt.lib(compiler_rt.lib.obj)
```
2024-09-19 18:20:22 -07:00
Andrew Kelley
38af1b7ed1 CI: update tarballs to 0.14.0-dev.1622+2ac543388 2024-09-19 18:20:22 -07:00
Andrew Kelley
6c15d69660 Revert "ci: Build with ZIG2_NO_RTLIB on Windows machines."
This reverts commit 7e66b6d0684fb1b3aa76381486e655e4d13bc0a5.

I don't think this is needed, I don't get any errors locally when I
bootstrap windows without this change.
2024-09-19 18:20:22 -07:00
Alex Rønne Petersen
916eaad1ef std.Target: Update CPU models/features for LLVM 19.1.0. 2024-09-19 18:20:22 -07:00
Alex Rønne Petersen
a463c369cd libcxx: Update to LLVM 19.1.0. 2024-09-19 18:20:22 -07:00
Alex Rønne Petersen
6b96c70ba3 clang: Update compiler-provided C headers to Clang 19.1.0. 2024-09-19 18:20:21 -07:00
Andrew Kelley
0d7a9c4806 CI: update tarballs
This time the LLVM builds have assertions enabled.

Also the zig builds support `-rtlib=none` for disabling compiler-rt.
2024-09-19 18:20:21 -07:00
Alex Rønne Petersen
bc278719d9 test: Disable shared_lib_unwind on x86_64-macos.
https://github.com/ziglang/zig/issues/21337
2024-09-19 18:20:21 -07:00
Alex Rønne Petersen
335ed630a0 ci: Build with ZIG2_NO_RTLIB on Windows machines.
Windows does not really have weak symbols. So when we bootstrap with `zig cc`
and link both Zig's compiler-rt and the CBE's `compiler_rt.c` we end up with
duplicate symbol errors at link time.
2024-09-19 18:20:21 -07:00
Alex Rønne Petersen
3dd6456c0f cmake: Add a ZIG2_NO_RTLIB option for building zig2 without compiler-rt. 2024-09-19 18:20:21 -07:00
Andrew Kelley
c234655e35 CI: update tarballs to LLVM 19.1.0rc4
oops, I forgot to enable LLVM assertions though
2024-09-19 18:20:21 -07:00