| author | |
| committer | |
| log | 43371cf388c66721d9ce1ef6ab397113b5e72608 |
| tree | 5e3b06c53077ec1648fed5c313f091b57e3aff8f |
| parent | 806470b492f15c4e3350ce4a48e607f2c8e94ff8 |
| parent | abd05b38195dd8b258505433555e52e3631edcfc |
| signature |
`s390x-linux` and general big-endian stuff29 files changed, 455 insertions(+), 182 deletions(-)
.forgejo/workflows/ci.yaml+20| ... | @@ -73,6 +73,26 @@ jobs: | ... | @@ -73,6 +73,26 @@ jobs: |
| 73 | - name: Build and Test | 73 | - name: Build and Test |
| 74 | run: sh ci/riscv64-linux-release.sh | 74 | run: sh ci/riscv64-linux-release.sh |
| 75 | timeout-minutes: 420 | 75 | timeout-minutes: 420 |
| 76 | s390x-linux-debug: | ||
| 77 | runs-on: [self-hosted, s390x-linux] | ||
| 78 | steps: | ||
| 79 | - name: Checkout | ||
| 80 | uses: actions/checkout@v4 | ||
| 81 | with: | ||
| 82 | fetch-depth: 0 | ||
| 83 | - name: Build and Test | ||
| 84 | run: sh ci/s390x-linux-debug.sh | ||
| 85 | timeout-minutes: 240 | ||
| 86 | s390x-linux-release: | ||
| 87 | runs-on: [self-hosted, s390x-linux] | ||
| 88 | steps: | ||
| 89 | - name: Checkout | ||
| 90 | uses: actions/checkout@v4 | ||
| 91 | with: | ||
| 92 | fetch-depth: 0 | ||
| 93 | - name: Build and Test | ||
| 94 | run: sh ci/s390x-linux-release.sh | ||
| 95 | timeout-minutes: 180 | ||
| 76 | x86_64-freebsd-debug: | 96 | x86_64-freebsd-debug: |
| 77 | runs-on: [self-hosted, x86_64-freebsd] | 97 | runs-on: [self-hosted, x86_64-freebsd] |
| 78 | steps: | 98 | steps: |
ci/s390x-linux-debug.sh created+65| ... | @@ -0,0 +1,65 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Requires cmake ninja-build | ||
| 4 | |||
| 5 | set -x | ||
| 6 | set -e | ||
| 7 | |||
| 8 | TARGET="s390x-linux-musl" | ||
| 9 | MCPU="z15" | ||
| 10 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1354+94e98bfe8" | ||
| 11 | PREFIX="$HOME/deps/$CACHE_BASENAME" | ||
| 12 | ZIG="$PREFIX/bin/zig" | ||
| 13 | |||
| 14 | # Override the cache directories because they won't actually help other CI runs | ||
| 15 | # which will be testing alternate versions of zig, and ultimately would just | ||
| 16 | # fill up space on the hard drive for no reason. | ||
| 17 | export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" | ||
| 18 | export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" | ||
| 19 | |||
| 20 | mkdir build-debug | ||
| 21 | cd build-debug | ||
| 22 | |||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | ||
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | ||
| 25 | |||
| 26 | cmake .. \ | ||
| 27 | -DCMAKE_INSTALL_PREFIX="stage3-debug" \ | ||
| 28 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | ||
| 29 | -DCMAKE_BUILD_TYPE=Debug \ | ||
| 30 | -DZIG_TARGET_TRIPLE="$TARGET" \ | ||
| 31 | -DZIG_TARGET_MCPU="$MCPU" \ | ||
| 32 | -DZIG_STATIC=ON \ | ||
| 33 | -DZIG_NO_LIB=ON \ | ||
| 34 | -GNinja \ | ||
| 35 | -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \ | ||
| 36 | -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE | ||
| 37 | # https://github.com/ziglang/zig/issues/22213 | ||
| 38 | |||
| 39 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | ||
| 40 | # so that installation and testing do not get affected by them. | ||
| 41 | unset CC | ||
| 42 | unset CXX | ||
| 43 | |||
| 44 | ninja install | ||
| 45 | |||
| 46 | # No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts. | ||
| 47 | stage3-debug/bin/zig build test docs \ | ||
| 48 | --maxrss 30064771072 \ | ||
| 49 | -Dstatic-llvm \ | ||
| 50 | -Dskip-non-native \ | ||
| 51 | -Dtarget=native-native-musl \ | ||
| 52 | --search-prefix "$PREFIX" \ | ||
| 53 | --zig-lib-dir "$PWD/../lib" \ | ||
| 54 | --test-timeout 4m | ||
| 55 | |||
| 56 | stage3-debug/bin/zig build \ | ||
| 57 | --prefix stage4-debug \ | ||
| 58 | -Denable-llvm \ | ||
| 59 | -Dno-lib \ | ||
| 60 | -Dtarget=$TARGET \ | ||
| 61 | -Dcpu=$MCPU \ | ||
| 62 | -Duse-zig-libcxx \ | ||
| 63 | -Dversion-string="$(stage3-debug/bin/zig version)" | ||
| 64 | |||
| 65 | stage4-debug/bin/zig test ../test/behavior.zig | ||
ci/s390x-linux-release.sh created+71| ... | @@ -0,0 +1,71 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Requires cmake ninja-build | ||
| 4 | |||
| 5 | set -x | ||
| 6 | set -e | ||
| 7 | |||
| 8 | TARGET="s390x-linux-musl" | ||
| 9 | MCPU="z15" | ||
| 10 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1354+94e98bfe8" | ||
| 11 | PREFIX="$HOME/deps/$CACHE_BASENAME" | ||
| 12 | ZIG="$PREFIX/bin/zig" | ||
| 13 | |||
| 14 | # Override the cache directories because they won't actually help other CI runs | ||
| 15 | # which will be testing alternate versions of zig, and ultimately would just | ||
| 16 | # fill up space on the hard drive for no reason. | ||
| 17 | export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" | ||
| 18 | export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" | ||
| 19 | |||
| 20 | mkdir build-release | ||
| 21 | cd build-release | ||
| 22 | |||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | ||
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | ||
| 25 | |||
| 26 | cmake .. \ | ||
| 27 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | ||
| 28 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | ||
| 29 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 30 | -DZIG_TARGET_TRIPLE="$TARGET" \ | ||
| 31 | -DZIG_TARGET_MCPU="$MCPU" \ | ||
| 32 | -DZIG_STATIC=ON \ | ||
| 33 | -DZIG_NO_LIB=ON \ | ||
| 34 | -GNinja \ | ||
| 35 | -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \ | ||
| 36 | -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE | ||
| 37 | # https://github.com/ziglang/zig/issues/22213 | ||
| 38 | |||
| 39 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | ||
| 40 | # so that installation and testing do not get affected by them. | ||
| 41 | unset CC | ||
| 42 | unset CXX | ||
| 43 | |||
| 44 | ninja install | ||
| 45 | |||
| 46 | # No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts. | ||
| 47 | stage3-release/bin/zig build test docs \ | ||
| 48 | --maxrss 30064771072 \ | ||
| 49 | -Dstatic-llvm \ | ||
| 50 | -Dskip-non-native \ | ||
| 51 | -Dtarget=native-native-musl \ | ||
| 52 | --search-prefix "$PREFIX" \ | ||
| 53 | --zig-lib-dir "$PWD/../lib" \ | ||
| 54 | --test-timeout 4m | ||
| 55 | |||
| 56 | # Ensure that stage3 and stage4 are byte-for-byte identical. | ||
| 57 | stage3-release/bin/zig build \ | ||
| 58 | --prefix stage4-release \ | ||
| 59 | -Denable-llvm \ | ||
| 60 | -Dno-lib \ | ||
| 61 | -Doptimize=ReleaseFast \ | ||
| 62 | -Dstrip \ | ||
| 63 | -Dtarget=$TARGET \ | ||
| 64 | -Dcpu=$MCPU \ | ||
| 65 | -Duse-zig-libcxx \ | ||
| 66 | -Dversion-string="$(stage3-release/bin/zig version)" | ||
| 67 | |||
| 68 | # diff returns an error code if the files differ. | ||
| 69 | echo "If the following command fails, it means nondeterminism has been" | ||
| 70 | echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." | ||
| 71 | diff stage3-release/bin/zig stage4-release/bin/zig | ||
doc/langref/runtime_shrExact_overflow.zig+1-1| ... | @@ -7,7 +7,7 @@ pub fn main() void { | ... | @@ -7,7 +7,7 @@ pub fn main() void { |
| 7 | const y = @shrExact(x, 2); | 7 | const y = @shrExact(x, 2); |
| 8 | std.debug.print("value: {}\n", .{y}); | 8 | std.debug.print("value: {}\n", .{y}); |
| 9 | 9 | ||
| 10 | if ((builtin.cpu.arch.isRISCV() or builtin.cpu.arch.isLoongArch()) and builtin.zig_backend == .stage2_llvm) @panic("https://github.com/ziglang/zig/issues/24304"); | 10 | if ((builtin.cpu.arch.isRISCV() or builtin.cpu.arch.isLoongArch() or builtin.cpu.arch == .s390x) and builtin.zig_backend == .stage2_llvm) @panic("https://github.com/ziglang/zig/issues/24304"); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // exe=fail | 13 | // exe=fail |
doc/langref/test_defining_variadic_function.zig+4| ... | @@ -22,6 +22,10 @@ test "defining a variadic function" { | ... | @@ -22,6 +22,10 @@ test "defining a variadic function" { |
| 22 | // https://github.com/ziglang/zig/issues/16961 | 22 | // https://github.com/ziglang/zig/issues/16961 |
| 23 | return error.SkipZigTest; | 23 | return error.SkipZigTest; |
| 24 | } | 24 | } |
| 25 | if (builtin.cpu.arch == .s390x) { | ||
| 26 | // https://github.com/ziglang/zig/issues/21350#issuecomment-3543006475 | ||
| 27 | return error.SkipZigTest; | ||
| 28 | } | ||
| 25 | 29 | ||
| 26 | try std.testing.expectEqual(@as(c_int, 0), add(0)); | 30 | try std.testing.expectEqual(@as(c_int, 0), add(0)); |
| 27 | try std.testing.expectEqual(@as(c_int, 1), add(1, @as(c_int, 1))); | 31 | try std.testing.expectEqual(@as(c_int, 1), add(1, @as(c_int, 1))); |
lib/compiler/aro/aro/Compilation.zig+5| ... | @@ -774,6 +774,11 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { | ... | @@ -774,6 +774,11 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 774 | try w.print("#define __wasm_{s}__ 1\n", .{feature.name}); | 774 | try w.print("#define __wasm_{s}__ 1\n", .{feature.name}); |
| 775 | } | 775 | } |
| 776 | }, | 776 | }, |
| 777 | .s390x => { | ||
| 778 | try define(w, "__s390__"); | ||
| 779 | try define(w, "__s390x__"); | ||
| 780 | try define(w, "__zarch__"); | ||
| 781 | }, | ||
| 777 | else => {}, | 782 | else => {}, |
| 778 | } | 783 | } |
| 779 | 784 |
lib/compiler/std-docs.zig+7-4| ... | @@ -348,12 +348,12 @@ fn buildWasmBinary( | ... | @@ -348,12 +348,12 @@ fn buildWasmBinary( |
| 348 | result_error_bundle = try std.zig.Server.allocErrorBundle(arena, body); | 348 | result_error_bundle = try std.zig.Server.allocErrorBundle(arena, body); |
| 349 | }, | 349 | }, |
| 350 | .emit_digest => { | 350 | .emit_digest => { |
| 351 | const EmitDigest = std.zig.Server.Message.EmitDigest; | 351 | var r: std.Io.Reader = .fixed(body); |
| 352 | const emit_digest = @as(*align(1) const EmitDigest, @ptrCast(body)); | 352 | const emit_digest = r.takeStruct(std.zig.Server.Message.EmitDigest, .little) catch unreachable; |
| 353 | if (!emit_digest.flags.cache_hit) { | 353 | if (!emit_digest.flags.cache_hit) { |
| 354 | std.log.info("source changes detected; rebuilt wasm component", .{}); | 354 | std.log.info("source changes detected; rebuilt wasm component", .{}); |
| 355 | } | 355 | } |
| 356 | const digest = body[@sizeOf(EmitDigest)..][0..Cache.bin_digest_len]; | 356 | const digest = r.takeArray(Cache.bin_digest_len) catch unreachable; |
| 357 | result = .{ | 357 | result = .{ |
| 358 | .root_dir = Cache.Directory.cwd(), | 358 | .root_dir = Cache.Directory.cwd(), |
| 359 | .sub_path = try std.fs.path.join(arena, &.{ | 359 | .sub_path = try std.fs.path.join(arena, &.{ |
| ... | @@ -415,7 +415,10 @@ fn sendMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag) !void { | ... | @@ -415,7 +415,10 @@ fn sendMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag) !void { |
| 415 | .tag = tag, | 415 | .tag = tag, |
| 416 | .bytes_len = 0, | 416 | .bytes_len = 0, |
| 417 | }; | 417 | }; |
| 418 | try file.writeAll(std.mem.asBytes(&header)); | 418 | var w = file.writer(&.{}); |
| 419 | w.interface.writeStruct(header, .little) catch |err| switch (err) { | ||
| 420 | error.WriteFailed => return w.err.?, | ||
| 421 | }; | ||
| 419 | } | 422 | } |
| 420 | 423 | ||
| 421 | fn openBrowserTab(gpa: Allocator, url: []const u8) !void { | 424 | fn openBrowserTab(gpa: Allocator, url: []const u8) !void { |
lib/std/Build/Step.zig+4-1| ... | @@ -680,7 +680,10 @@ fn sendMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag) !void { | ... | @@ -680,7 +680,10 @@ fn sendMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag) !void { |
| 680 | .tag = tag, | 680 | .tag = tag, |
| 681 | .bytes_len = 0, | 681 | .bytes_len = 0, |
| 682 | }; | 682 | }; |
| 683 | try file.writeAll(std.mem.asBytes(&header)); | 683 | var w = file.writer(&.{}); |
| 684 | w.interface.writeStruct(header, .little) catch |err| switch (err) { | ||
| 685 | error.WriteFailed => return w.err.?, | ||
| 686 | }; | ||
| 684 | } | 687 | } |
| 685 | 688 | ||
| 686 | pub fn handleVerbose( | 689 | pub fn handleVerbose( |
lib/std/Build/Step/CheckObject.zig+53-27| ... | @@ -1857,15 +1857,26 @@ const ElfDumper = struct { | ... | @@ -1857,15 +1857,26 @@ const ElfDumper = struct { |
| 1857 | 1857 | ||
| 1858 | fn parseAndDumpObject(step: *Step, check: Check, bytes: []const u8) ![]const u8 { | 1858 | fn parseAndDumpObject(step: *Step, check: Check, bytes: []const u8) ![]const u8 { |
| 1859 | const gpa = step.owner.allocator; | 1859 | const gpa = step.owner.allocator; |
| 1860 | var reader: std.Io.Reader = .fixed(bytes); | ||
| 1861 | 1860 | ||
| 1862 | const hdr = try reader.takeStruct(elf.Elf64_Ehdr, .little); | 1861 | // `std.elf.Header` takes care of endianness issues for us. |
| 1863 | if (!mem.eql(u8, hdr.e_ident[0..4], "\x7fELF")) { | 1862 | var reader: std.Io.Reader = .fixed(bytes); |
| 1864 | return error.InvalidMagicNumber; | 1863 | const hdr = try elf.Header.read(&reader); |
| 1864 | |||
| 1865 | var shdrs = try gpa.alloc(elf.Elf64_Shdr, hdr.shnum); | ||
| 1866 | defer gpa.free(shdrs); | ||
| 1867 | { | ||
| 1868 | var shdr_it = hdr.iterateSectionHeadersBuffer(bytes); | ||
| 1869 | var shdr_i: usize = 0; | ||
| 1870 | while (try shdr_it.next()) |shdr| : (shdr_i += 1) shdrs[shdr_i] = shdr; | ||
| 1865 | } | 1871 | } |
| 1866 | 1872 | ||
| 1867 | const shdrs = @as([*]align(1) const elf.Elf64_Shdr, @ptrCast(bytes.ptr + hdr.e_shoff))[0..hdr.e_shnum]; | 1873 | var phdrs = try gpa.alloc(elf.Elf64_Phdr, hdr.shnum); |
| 1868 | const phdrs = @as([*]align(1) const elf.Elf64_Phdr, @ptrCast(bytes.ptr + hdr.e_phoff))[0..hdr.e_phnum]; | 1874 | defer gpa.free(phdrs); |
| 1875 | { | ||
| 1876 | var phdr_it = hdr.iterateProgramHeadersBuffer(bytes); | ||
| 1877 | var phdr_i: usize = 0; | ||
| 1878 | while (try phdr_it.next()) |phdr| : (phdr_i += 1) phdrs[phdr_i] = phdr; | ||
| 1879 | } | ||
| 1869 | 1880 | ||
| 1870 | var ctx = ObjectContext{ | 1881 | var ctx = ObjectContext{ |
| 1871 | .gpa = gpa, | 1882 | .gpa = gpa, |
| ... | @@ -1875,13 +1886,21 @@ const ElfDumper = struct { | ... | @@ -1875,13 +1886,21 @@ const ElfDumper = struct { |
| 1875 | .phdrs = phdrs, | 1886 | .phdrs = phdrs, |
| 1876 | .shstrtab = undefined, | 1887 | .shstrtab = undefined, |
| 1877 | }; | 1888 | }; |
| 1878 | ctx.shstrtab = ctx.getSectionContents(ctx.hdr.e_shstrndx); | 1889 | ctx.shstrtab = ctx.getSectionContents(ctx.hdr.shstrndx); |
| 1890 | |||
| 1891 | defer gpa.free(ctx.symtab.symbols); | ||
| 1892 | defer gpa.free(ctx.dysymtab.symbols); | ||
| 1893 | defer gpa.free(ctx.dyns); | ||
| 1879 | 1894 | ||
| 1880 | for (ctx.shdrs, 0..) |shdr, i| switch (shdr.sh_type) { | 1895 | for (ctx.shdrs, 0..) |shdr, i| switch (shdr.sh_type) { |
| 1881 | elf.SHT_SYMTAB, elf.SHT_DYNSYM => { | 1896 | elf.SHT_SYMTAB, elf.SHT_DYNSYM => { |
| 1882 | const raw = ctx.getSectionContents(i); | 1897 | const raw = ctx.getSectionContents(i); |
| 1883 | const nsyms = @divExact(raw.len, @sizeOf(elf.Elf64_Sym)); | 1898 | const nsyms = @divExact(raw.len, @sizeOf(elf.Elf64_Sym)); |
| 1884 | const symbols = @as([*]align(1) const elf.Elf64_Sym, @ptrCast(raw.ptr))[0..nsyms]; | 1899 | const symbols = try gpa.alloc(elf.Elf64_Sym, nsyms); |
| 1900 | |||
| 1901 | var r: std.Io.Reader = .fixed(raw); | ||
| 1902 | for (0..nsyms) |si| symbols[si] = r.takeStruct(elf.Elf64_Sym, ctx.hdr.endian) catch unreachable; | ||
| 1903 | |||
| 1885 | const strings = ctx.getSectionContents(shdr.sh_link); | 1904 | const strings = ctx.getSectionContents(shdr.sh_link); |
| 1886 | 1905 | ||
| 1887 | switch (shdr.sh_type) { | 1906 | switch (shdr.sh_type) { |
| ... | @@ -1900,6 +1919,17 @@ const ElfDumper = struct { | ... | @@ -1900,6 +1919,17 @@ const ElfDumper = struct { |
| 1900 | else => unreachable, | 1919 | else => unreachable, |
| 1901 | } | 1920 | } |
| 1902 | }, | 1921 | }, |
| 1922 | elf.SHT_DYNAMIC => { | ||
| 1923 | const raw = ctx.getSectionContents(i); | ||
| 1924 | const ndyns = @divExact(raw.len, @sizeOf(elf.Elf64_Dyn)); | ||
| 1925 | const dyns = try gpa.alloc(elf.Elf64_Dyn, ndyns); | ||
| 1926 | |||
| 1927 | var r: std.Io.Reader = .fixed(raw); | ||
| 1928 | for (0..ndyns) |si| dyns[si] = r.takeStruct(elf.Elf64_Dyn, ctx.hdr.endian) catch unreachable; | ||
| 1929 | |||
| 1930 | ctx.dyns = dyns; | ||
| 1931 | ctx.dyns_strings = ctx.getSectionContents(shdr.sh_link); | ||
| 1932 | }, | ||
| 1903 | 1933 | ||
| 1904 | else => {}, | 1934 | else => {}, |
| 1905 | }; | 1935 | }; |
| ... | @@ -1923,9 +1953,9 @@ const ElfDumper = struct { | ... | @@ -1923,9 +1953,9 @@ const ElfDumper = struct { |
| 1923 | try ctx.dumpSymtab(.dysymtab, writer); | 1953 | try ctx.dumpSymtab(.dysymtab, writer); |
| 1924 | } else return step.fail("no dynamic symbol table found", .{}), | 1954 | } else return step.fail("no dynamic symbol table found", .{}), |
| 1925 | 1955 | ||
| 1926 | .dynamic_section => if (ctx.getSectionByName(".dynamic")) |shndx| { | 1956 | .dynamic_section => if (ctx.dyns.len > 0) { |
| 1927 | try ctx.dumpDynamicSection(shndx, writer); | 1957 | try ctx.dumpDynamicSection(writer); |
| 1928 | } else return step.fail("no .dynamic section found", .{}), | 1958 | } else return step.fail("no dynamic section found", .{}), |
| 1929 | 1959 | ||
| 1930 | .dump_section => { | 1960 | .dump_section => { |
| 1931 | const name = mem.sliceTo(@as([*:0]const u8, @ptrCast(check.data.items.ptr + check.payload.dump_section)), 0); | 1961 | const name = mem.sliceTo(@as([*:0]const u8, @ptrCast(check.data.items.ptr + check.payload.dump_section)), 0); |
| ... | @@ -1942,17 +1972,19 @@ const ElfDumper = struct { | ... | @@ -1942,17 +1972,19 @@ const ElfDumper = struct { |
| 1942 | const ObjectContext = struct { | 1972 | const ObjectContext = struct { |
| 1943 | gpa: Allocator, | 1973 | gpa: Allocator, |
| 1944 | data: []const u8, | 1974 | data: []const u8, |
| 1945 | hdr: elf.Elf64_Ehdr, | 1975 | hdr: elf.Header, |
| 1946 | shdrs: []align(1) const elf.Elf64_Shdr, | 1976 | shdrs: []const elf.Elf64_Shdr, |
| 1947 | phdrs: []align(1) const elf.Elf64_Phdr, | 1977 | phdrs: []const elf.Elf64_Phdr, |
| 1948 | shstrtab: []const u8, | 1978 | shstrtab: []const u8, |
| 1949 | symtab: Symtab = .{}, | 1979 | symtab: Symtab = .{}, |
| 1950 | dysymtab: Symtab = .{}, | 1980 | dysymtab: Symtab = .{}, |
| 1981 | dyns: []const elf.Elf64_Dyn = &.{}, | ||
| 1982 | dyns_strings: []const u8 = &.{}, | ||
| 1951 | 1983 | ||
| 1952 | fn dumpHeader(ctx: ObjectContext, writer: anytype) !void { | 1984 | fn dumpHeader(ctx: ObjectContext, writer: anytype) !void { |
| 1953 | try writer.writeAll("header\n"); | 1985 | try writer.writeAll("header\n"); |
| 1954 | try writer.print("type {s}\n", .{@tagName(ctx.hdr.e_type)}); | 1986 | try writer.print("type {s}\n", .{@tagName(ctx.hdr.type)}); |
| 1955 | try writer.print("entry {x}\n", .{ctx.hdr.e_entry}); | 1987 | try writer.print("entry {x}\n", .{ctx.hdr.entry}); |
| 1956 | } | 1988 | } |
| 1957 | 1989 | ||
| 1958 | fn dumpPhdrs(ctx: ObjectContext, writer: anytype) !void { | 1990 | fn dumpPhdrs(ctx: ObjectContext, writer: anytype) !void { |
| ... | @@ -2011,16 +2043,10 @@ const ElfDumper = struct { | ... | @@ -2011,16 +2043,10 @@ const ElfDumper = struct { |
| 2011 | } | 2043 | } |
| 2012 | } | 2044 | } |
| 2013 | 2045 | ||
| 2014 | fn dumpDynamicSection(ctx: ObjectContext, shndx: usize, writer: anytype) !void { | 2046 | fn dumpDynamicSection(ctx: ObjectContext, writer: anytype) !void { |
| 2015 | const shdr = ctx.shdrs[shndx]; | ||
| 2016 | const strtab = ctx.getSectionContents(shdr.sh_link); | ||
| 2017 | const data = ctx.getSectionContents(shndx); | ||
| 2018 | const nentries = @divExact(data.len, @sizeOf(elf.Elf64_Dyn)); | ||
| 2019 | const entries = @as([*]align(1) const elf.Elf64_Dyn, @ptrCast(data.ptr))[0..nentries]; | ||
| 2020 | |||
| 2021 | try writer.writeAll(ElfDumper.dynamic_section_label ++ "\n"); | 2047 | try writer.writeAll(ElfDumper.dynamic_section_label ++ "\n"); |
| 2022 | 2048 | ||
| 2023 | for (entries) |entry| { | 2049 | for (ctx.dyns) |entry| { |
| 2024 | const key = @as(u64, @bitCast(entry.d_tag)); | 2050 | const key = @as(u64, @bitCast(entry.d_tag)); |
| 2025 | const value = entry.d_val; | 2051 | const value = entry.d_val; |
| 2026 | 2052 | ||
| ... | @@ -2067,7 +2093,7 @@ const ElfDumper = struct { | ... | @@ -2067,7 +2093,7 @@ const ElfDumper = struct { |
| 2067 | elf.DT_RPATH, | 2093 | elf.DT_RPATH, |
| 2068 | elf.DT_RUNPATH, | 2094 | elf.DT_RUNPATH, |
| 2069 | => { | 2095 | => { |
| 2070 | const name = getString(strtab, @intCast(value)); | 2096 | const name = getString(ctx.dyns_strings, @intCast(value)); |
| 2071 | try writer.print(" {s}", .{name}); | 2097 | try writer.print(" {s}", .{name}); |
| 2072 | }, | 2098 | }, |
| 2073 | 2099 | ||
| ... | @@ -2256,8 +2282,8 @@ const ElfDumper = struct { | ... | @@ -2256,8 +2282,8 @@ const ElfDumper = struct { |
| 2256 | }; | 2282 | }; |
| 2257 | 2283 | ||
| 2258 | const Symtab = struct { | 2284 | const Symtab = struct { |
| 2259 | symbols: []align(1) const elf.Elf64_Sym = &[0]elf.Elf64_Sym{}, | 2285 | symbols: []const elf.Elf64_Sym = &.{}, |
| 2260 | strings: []const u8 = &[0]u8{}, | 2286 | strings: []const u8 = &.{}, |
| 2261 | 2287 | ||
| 2262 | fn get(st: Symtab, index: usize) ?elf.Elf64_Sym { | 2288 | fn get(st: Symtab, index: usize) ?elf.Elf64_Sym { |
| 2263 | if (index >= st.symbols.len) return null; | 2289 | if (index >= st.symbols.len) return null; |
lib/std/Build/Step/Run.zig+44-31| ... | @@ -1927,6 +1927,7 @@ fn pollZigTest( | ... | @@ -1927,6 +1927,7 @@ fn pollZigTest( |
| 1927 | .ns_elapsed = if (timer) |*t| t.read() else 0, | 1927 | .ns_elapsed = if (timer) |*t| t.read() else 0, |
| 1928 | } }; | 1928 | } }; |
| 1929 | const body = stdout.take(header.bytes_len) catch unreachable; | 1929 | const body = stdout.take(header.bytes_len) catch unreachable; |
| 1930 | var body_r: std.Io.Reader = .fixed(body); | ||
| 1930 | switch (header.tag) { | 1931 | switch (header.tag) { |
| 1931 | .zig_version => { | 1932 | .zig_version => { |
| 1932 | if (!std.mem.eql(u8, builtin.zig_version_string, body)) return run.step.fail( | 1933 | if (!std.mem.eql(u8, builtin.zig_version_string, body)) return run.step.fail( |
| ... | @@ -1942,29 +1943,23 @@ fn pollZigTest( | ... | @@ -1942,29 +1943,23 @@ fn pollZigTest( |
| 1942 | // restart the test runner). | 1943 | // restart the test runner). |
| 1943 | assert(opt_metadata.* == null); | 1944 | assert(opt_metadata.* == null); |
| 1944 | 1945 | ||
| 1945 | const TmHdr = std.zig.Server.Message.TestMetadata; | 1946 | const tm_hdr = body_r.takeStruct(std.zig.Server.Message.TestMetadata, .little) catch unreachable; |
| 1946 | const tm_hdr: *align(1) const TmHdr = @ptrCast(body); | ||
| 1947 | results.test_count = tm_hdr.tests_len; | 1947 | results.test_count = tm_hdr.tests_len; |
| 1948 | 1948 | ||
| 1949 | const names_bytes = body[@sizeOf(TmHdr)..][0 .. results.test_count * @sizeOf(u32)]; | 1949 | const names = try arena.alloc(u32, results.test_count); |
| 1950 | const expected_panic_msgs_bytes = body[@sizeOf(TmHdr) + names_bytes.len ..][0 .. results.test_count * @sizeOf(u32)]; | 1950 | for (names) |*dest| dest.* = body_r.takeInt(u32, .little) catch unreachable; |
| 1951 | const string_bytes = body[@sizeOf(TmHdr) + names_bytes.len + expected_panic_msgs_bytes.len ..][0..tm_hdr.string_bytes_len]; | ||
| 1952 | 1951 | ||
| 1953 | const names = std.mem.bytesAsSlice(u32, names_bytes); | 1952 | const expected_panic_msgs = try arena.alloc(u32, results.test_count); |
| 1954 | const expected_panic_msgs = std.mem.bytesAsSlice(u32, expected_panic_msgs_bytes); | 1953 | for (expected_panic_msgs) |*dest| dest.* = body_r.takeInt(u32, .little) catch unreachable; |
| 1955 | 1954 | ||
| 1956 | const names_aligned = try arena.alloc(u32, names.len); | 1955 | const string_bytes = body_r.take(tm_hdr.string_bytes_len) catch unreachable; |
| 1957 | for (names_aligned, names) |*dest, src| dest.* = src; | ||
| 1958 | |||
| 1959 | const expected_panic_msgs_aligned = try arena.alloc(u32, expected_panic_msgs.len); | ||
| 1960 | for (expected_panic_msgs_aligned, expected_panic_msgs) |*dest, src| dest.* = src; | ||
| 1961 | 1956 | ||
| 1962 | options.progress_node.setEstimatedTotalItems(names.len); | 1957 | options.progress_node.setEstimatedTotalItems(names.len); |
| 1963 | opt_metadata.* = .{ | 1958 | opt_metadata.* = .{ |
| 1964 | .string_bytes = try arena.dupe(u8, string_bytes), | 1959 | .string_bytes = try arena.dupe(u8, string_bytes), |
| 1965 | .ns_per_test = try arena.alloc(u64, results.test_count), | 1960 | .ns_per_test = try arena.alloc(u64, results.test_count), |
| 1966 | .names = names_aligned, | 1961 | .names = names, |
| 1967 | .expected_panic_msgs = expected_panic_msgs_aligned, | 1962 | .expected_panic_msgs = expected_panic_msgs, |
| 1968 | .next_index = 0, | 1963 | .next_index = 0, |
| 1969 | .prog_node = options.progress_node, | 1964 | .prog_node = options.progress_node, |
| 1970 | }; | 1965 | }; |
| ... | @@ -1983,8 +1978,7 @@ fn pollZigTest( | ... | @@ -1983,8 +1978,7 @@ fn pollZigTest( |
| 1983 | assert(fuzz_context == null); | 1978 | assert(fuzz_context == null); |
| 1984 | const md = &opt_metadata.*.?; | 1979 | const md = &opt_metadata.*.?; |
| 1985 | 1980 | ||
| 1986 | const TrHdr = std.zig.Server.Message.TestResults; | 1981 | const tr_hdr = body_r.takeStruct(std.zig.Server.Message.TestResults, .little) catch unreachable; |
| 1987 | const tr_hdr: *align(1) const TrHdr = @ptrCast(body); | ||
| 1988 | assert(tr_hdr.index == active_test_index); | 1982 | assert(tr_hdr.index == active_test_index); |
| 1989 | 1983 | ||
| 1990 | switch (tr_hdr.flags.status) { | 1984 | switch (tr_hdr.flags.status) { |
| ... | @@ -2026,18 +2020,21 @@ fn pollZigTest( | ... | @@ -2026,18 +2020,21 @@ fn pollZigTest( |
| 2026 | requestNextTest(child.stdin.?, md, &sub_prog_node) catch |err| return .{ .write_failed = err }; | 2020 | requestNextTest(child.stdin.?, md, &sub_prog_node) catch |err| return .{ .write_failed = err }; |
| 2027 | }, | 2021 | }, |
| 2028 | .coverage_id => { | 2022 | .coverage_id => { |
| 2029 | const fuzz = fuzz_context.?.fuzz; | 2023 | coverage_id = body_r.takeInt(u64, .little) catch unreachable; |
| 2030 | const msg_ptr: *align(1) const [4]u64 = @ptrCast(body); | 2024 | const cumulative_runs = body_r.takeInt(u64, .little) catch unreachable; |
| 2031 | coverage_id = msg_ptr[0]; | 2025 | const cumulative_unique = body_r.takeInt(u64, .little) catch unreachable; |
| 2026 | const cumulative_coverage = body_r.takeInt(u64, .little) catch unreachable; | ||
| 2027 | |||
| 2032 | { | 2028 | { |
| 2029 | const fuzz = fuzz_context.?.fuzz; | ||
| 2033 | fuzz.queue_mutex.lock(); | 2030 | fuzz.queue_mutex.lock(); |
| 2034 | defer fuzz.queue_mutex.unlock(); | 2031 | defer fuzz.queue_mutex.unlock(); |
| 2035 | try fuzz.msg_queue.append(fuzz.gpa, .{ .coverage = .{ | 2032 | try fuzz.msg_queue.append(fuzz.gpa, .{ .coverage = .{ |
| 2036 | .id = coverage_id.?, | 2033 | .id = coverage_id.?, |
| 2037 | .cumulative = .{ | 2034 | .cumulative = .{ |
| 2038 | .runs = msg_ptr[1], | 2035 | .runs = cumulative_runs, |
| 2039 | .unique = msg_ptr[2], | 2036 | .unique = cumulative_unique, |
| 2040 | .coverage = msg_ptr[3], | 2037 | .coverage = cumulative_coverage, |
| 2041 | }, | 2038 | }, |
| 2042 | .run = run, | 2039 | .run = run, |
| 2043 | } }); | 2040 | } }); |
| ... | @@ -2046,8 +2043,7 @@ fn pollZigTest( | ... | @@ -2046,8 +2043,7 @@ fn pollZigTest( |
| 2046 | }, | 2043 | }, |
| 2047 | .fuzz_start_addr => { | 2044 | .fuzz_start_addr => { |
| 2048 | const fuzz = fuzz_context.?.fuzz; | 2045 | const fuzz = fuzz_context.?.fuzz; |
| 2049 | const msg_ptr: *align(1) const u64 = @ptrCast(body); | 2046 | const addr = body_r.takeInt(u64, .little) catch unreachable; |
| 2050 | const addr = msg_ptr.*; | ||
| 2051 | { | 2047 | { |
| 2052 | fuzz.queue_mutex.lock(); | 2048 | fuzz.queue_mutex.lock(); |
| 2053 | defer fuzz.queue_mutex.unlock(); | 2049 | defer fuzz.queue_mutex.unlock(); |
| ... | @@ -2116,7 +2112,10 @@ fn sendMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag) !void { | ... | @@ -2116,7 +2112,10 @@ fn sendMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag) !void { |
| 2116 | .tag = tag, | 2112 | .tag = tag, |
| 2117 | .bytes_len = 0, | 2113 | .bytes_len = 0, |
| 2118 | }; | 2114 | }; |
| 2119 | try file.writeAll(@ptrCast(&header)); | 2115 | var w = file.writer(&.{}); |
| 2116 | w.interface.writeStruct(header, .little) catch |err| switch (err) { | ||
| 2117 | error.WriteFailed => return w.err.?, | ||
| 2118 | }; | ||
| 2120 | } | 2119 | } |
| 2121 | 2120 | ||
| 2122 | fn sendRunTestMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag, index: u32) !void { | 2121 | fn sendRunTestMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag, index: u32) !void { |
| ... | @@ -2124,8 +2123,13 @@ fn sendRunTestMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag, index: | ... | @@ -2124,8 +2123,13 @@ fn sendRunTestMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag, index: |
| 2124 | .tag = tag, | 2123 | .tag = tag, |
| 2125 | .bytes_len = 4, | 2124 | .bytes_len = 4, |
| 2126 | }; | 2125 | }; |
| 2127 | const full_msg = std.mem.asBytes(&header) ++ std.mem.asBytes(&index); | 2126 | var w = file.writer(&.{}); |
| 2128 | try file.writeAll(full_msg); | 2127 | w.interface.writeStruct(header, .little) catch |err| switch (err) { |
| 2128 | error.WriteFailed => return w.err.?, | ||
| 2129 | }; | ||
| 2130 | w.interface.writeInt(u32, index, .little) catch |err| switch (err) { | ||
| 2131 | error.WriteFailed => return w.err.?, | ||
| 2132 | }; | ||
| 2129 | } | 2133 | } |
| 2130 | 2134 | ||
| 2131 | fn sendRunFuzzTestMessage( | 2135 | fn sendRunFuzzTestMessage( |
| ... | @@ -2138,10 +2142,19 @@ fn sendRunFuzzTestMessage( | ... | @@ -2138,10 +2142,19 @@ fn sendRunFuzzTestMessage( |
| 2138 | .tag = .start_fuzzing, | 2142 | .tag = .start_fuzzing, |
| 2139 | .bytes_len = 4 + 1 + 8, | 2143 | .bytes_len = 4 + 1 + 8, |
| 2140 | }; | 2144 | }; |
| 2141 | const full_msg = std.mem.asBytes(&header) ++ std.mem.asBytes(&index) ++ | 2145 | var w = file.writer(&.{}); |
| 2142 | std.mem.asBytes(&kind) ++ std.mem.asBytes(&amount_or_instance); | 2146 | w.interface.writeStruct(header, .little) catch |err| switch (err) { |
| 2143 | 2147 | error.WriteFailed => return w.err.?, | |
| 2144 | try file.writeAll(full_msg); | 2148 | }; |
| 2149 | w.interface.writeInt(u32, index, .little) catch |err| switch (err) { | ||
| 2150 | error.WriteFailed => return w.err.?, | ||
| 2151 | }; | ||
| 2152 | w.interface.writeByte(@intFromEnum(kind)) catch |err| switch (err) { | ||
| 2153 | error.WriteFailed => return w.err.?, | ||
| 2154 | }; | ||
| 2155 | w.interface.writeInt(u64, amount_or_instance, .little) catch |err| switch (err) { | ||
| 2156 | error.WriteFailed => return w.err.?, | ||
| 2157 | }; | ||
| 2145 | } | 2158 | } |
| 2146 | 2159 | ||
| 2147 | fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult { | 2160 | fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult { |
lib/std/os/linux/IoUring.zig+2| ... | @@ -4488,6 +4488,8 @@ test "copy_cqes with wrapping sq.cqes buffer" { | ... | @@ -4488,6 +4488,8 @@ test "copy_cqes with wrapping sq.cqes buffer" { |
| 4488 | } | 4488 | } |
| 4489 | 4489 | ||
| 4490 | test "bind/listen/connect" { | 4490 | test "bind/listen/connect" { |
| 4491 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/25956 | ||
| 4492 | |||
| 4491 | var ring = IoUring.init(4, 0) catch |err| switch (err) { | 4493 | var ring = IoUring.init(4, 0) catch |err| switch (err) { |
| 4492 | error.SystemOutdated => return error.SkipZigTest, | 4494 | error.SystemOutdated => return error.SkipZigTest, |
| 4493 | error.PermissionDenied => return error.SkipZigTest, | 4495 | error.PermissionDenied => return error.SkipZigTest, |
lib/std/zig/Server.zig+23-15| ... | @@ -238,26 +238,34 @@ pub fn serveErrorBundle(s: *Server, error_bundle: std.zig.ErrorBundle) !void { | ... | @@ -238,26 +238,34 @@ pub fn serveErrorBundle(s: *Server, error_bundle: std.zig.ErrorBundle) !void { |
| 238 | try s.out.flush(); | 238 | try s.out.flush(); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | pub fn allocErrorBundle(allocator: std.mem.Allocator, body: []const u8) !std.zig.ErrorBundle { | 241 | pub fn allocErrorBundle(gpa: std.mem.Allocator, body: []const u8) error{ OutOfMemory, EndOfStream }!std.zig.ErrorBundle { |
| 242 | const eb_hdr = @as(*align(1) const OutMessage.ErrorBundle, @ptrCast(body)); | 242 | var r: Reader = .fixed(body); |
| 243 | const extra_bytes = | 243 | const hdr = r.takeStruct(OutMessage.ErrorBundle, .little) catch |err| switch (err) { |
| 244 | body[@sizeOf(OutMessage.ErrorBundle)..][0 .. @sizeOf(u32) * eb_hdr.extra_len]; | 244 | error.EndOfStream => |e| return e, |
| 245 | const string_bytes = | 245 | error.ReadFailed => unreachable, |
| 246 | body[@sizeOf(OutMessage.ErrorBundle) + extra_bytes.len ..][0..eb_hdr.string_bytes_len]; | 246 | }; |
| 247 | const unaligned_extra: []align(1) const u32 = @ptrCast(extra_bytes); | 247 | |
| 248 | 248 | var eb: std.zig.ErrorBundle = .{ | |
| 249 | var error_bundle: std.zig.ErrorBundle = .{ | ||
| 250 | .string_bytes = &.{}, | 249 | .string_bytes = &.{}, |
| 251 | .extra = &.{}, | 250 | .extra = &.{}, |
| 252 | }; | 251 | }; |
| 253 | errdefer error_bundle.deinit(allocator); | 252 | errdefer eb.deinit(gpa); |
| 253 | |||
| 254 | const extra = try gpa.alloc(u32, hdr.extra_len); | ||
| 255 | eb.extra = extra; | ||
| 256 | const string_bytes = try gpa.alloc(u8, hdr.string_bytes_len); | ||
| 257 | eb.string_bytes = string_bytes; | ||
| 254 | 258 | ||
| 255 | error_bundle.string_bytes = try allocator.dupe(u8, string_bytes); | 259 | r.readSliceEndian(u32, extra, .little) catch |err| switch (err) { |
| 256 | const extra = try allocator.alloc(u32, unaligned_extra.len); | 260 | error.EndOfStream => |e| return e, |
| 257 | @memcpy(extra, unaligned_extra); | 261 | error.ReadFailed => unreachable, |
| 258 | error_bundle.extra = extra; | 262 | }; |
| 263 | r.readSliceAll(string_bytes) catch |err| switch (err) { | ||
| 264 | error.EndOfStream => |e| return e, | ||
| 265 | error.ReadFailed => unreachable, | ||
| 266 | }; | ||
| 259 | 267 | ||
| 260 | return error_bundle; | 268 | return eb; |
| 261 | } | 269 | } |
| 262 | 270 | ||
| 263 | pub const TestMetadata = struct { | 271 | pub const TestMetadata = struct { |
lib/std/zon/parse.zig+1| ... | @@ -3129,6 +3129,7 @@ test "std.zon free on error" { | ... | @@ -3129,6 +3129,7 @@ test "std.zon free on error" { |
| 3129 | 3129 | ||
| 3130 | test "std.zon vector" { | 3130 | test "std.zon vector" { |
| 3131 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/15330 | 3131 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/15330 |
| 3132 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .s390x) return error.SkipZigTest; // github.com/ziglang/zig/issues/25957 | ||
| 3132 | 3133 | ||
| 3133 | const gpa = std.testing.allocator; | 3134 | const gpa = std.testing.allocator; |
| 3134 | 3135 |
src/codegen/c.zig+26-10| ... | @@ -5084,16 +5084,32 @@ fn bitcast(f: *Function, dest_ty: Type, operand: CValue, operand_ty: Type) !CVal | ... | @@ -5084,16 +5084,32 @@ fn bitcast(f: *Function, dest_ty: Type, operand: CValue, operand_ty: Type) !CVal |
| 5084 | } else operand; | 5084 | } else operand; |
| 5085 | 5085 | ||
| 5086 | const local = try f.allocLocal(null, dest_ty); | 5086 | const local = try f.allocLocal(null, dest_ty); |
| 5087 | try w.writeAll("memcpy(&"); | 5087 | // On big-endian targets, copying ABI integers with padding bits is awkward, because the padding bits are at the low bytes of the value. |
| 5088 | try f.writeCValue(w, local, .Other); | 5088 | // We need to offset the source or destination pointer appropriately and copy the right number of bytes. |
| 5089 | try w.writeAll(", &"); | 5089 | if (target.cpu.arch.endian() == .big and dest_ty.isAbiInt(zcu) and !operand_ty.isAbiInt(zcu)) { |
| 5090 | try f.writeCValue(w, operand_lval, .Other); | 5090 | // e.g. [10]u8 -> u80. We need to offset the destination so that we copy to the least significant bits of the integer. |
| 5091 | try w.writeAll(", sizeof("); | 5091 | const offset = dest_ty.abiSize(zcu) - operand_ty.abiSize(zcu); |
| 5092 | try f.renderType( | 5092 | try w.writeAll("memcpy((char *)&"); |
| 5093 | w, | 5093 | try f.writeCValue(w, local, .Other); |
| 5094 | if (dest_ty.abiSize(zcu) <= operand_ty.abiSize(zcu)) dest_ty else operand_ty, | 5094 | try w.print(" + {d}, &", .{offset}); |
| 5095 | ); | 5095 | try f.writeCValue(w, operand_lval, .Other); |
| 5096 | try w.writeAll("));"); | 5096 | try w.print(", {d});", .{operand_ty.abiSize(zcu)}); |
| 5097 | } else if (target.cpu.arch.endian() == .big and operand_ty.isAbiInt(zcu) and !dest_ty.isAbiInt(zcu)) { | ||
| 5098 | // e.g. u80 -> [10]u8. We need to offset the source so that we copy from the least significant bits of the integer. | ||
| 5099 | const offset = operand_ty.abiSize(zcu) - dest_ty.abiSize(zcu); | ||
| 5100 | try w.writeAll("memcpy(&"); | ||
| 5101 | try f.writeCValue(w, local, .Other); | ||
| 5102 | try w.writeAll(", (const char *)&"); | ||
| 5103 | try f.writeCValue(w, operand_lval, .Other); | ||
| 5104 | try w.print(" + {d}, {d});", .{ offset, dest_ty.abiSize(zcu) }); | ||
| 5105 | } else { | ||
| 5106 | try w.writeAll("memcpy(&"); | ||
| 5107 | try f.writeCValue(w, local, .Other); | ||
| 5108 | try w.writeAll(", &"); | ||
| 5109 | try f.writeCValue(w, operand_lval, .Other); | ||
| 5110 | try w.print(", {d});", .{@min(dest_ty.abiSize(zcu), operand_ty.abiSize(zcu))}); | ||
| 5111 | } | ||
| 5112 | |||
| 5097 | try f.object.newline(); | 5113 | try f.object.newline(); |
| 5098 | 5114 | ||
| 5099 | // Ensure padding bits have the expected value. | 5115 | // Ensure padding bits have the expected value. |
src/codegen/llvm.zig+9-22| ... | @@ -3651,35 +3651,22 @@ pub const Object = struct { | ... | @@ -3651,35 +3651,22 @@ pub const Object = struct { |
| 3651 | .opt => {}, // pointer like optional expected | 3651 | .opt => {}, // pointer like optional expected |
| 3652 | else => unreachable, | 3652 | else => unreachable, |
| 3653 | } | 3653 | } |
| 3654 | const bits = ty.bitSize(zcu); | ||
| 3655 | const bytes: usize = @intCast(std.mem.alignForward(u64, bits, 8) / 8); | ||
| 3656 | |||
| 3657 | var stack = std.heap.stackFallback(32, o.gpa); | 3654 | var stack = std.heap.stackFallback(32, o.gpa); |
| 3658 | const allocator = stack.get(); | 3655 | const allocator = stack.get(); |
| 3659 | 3656 | ||
| 3660 | const limbs = try allocator.alloc( | 3657 | const bits: usize = @intCast(ty.bitSize(zcu)); |
| 3661 | std.math.big.Limb, | 3658 | |
| 3662 | std.mem.alignForward(usize, bytes, @sizeOf(std.math.big.Limb)) / | 3659 | const buffer = try allocator.alloc(u8, (bits + 7) / 8); |
| 3663 | @sizeOf(std.math.big.Limb), | 3660 | defer allocator.free(buffer); |
| 3664 | ); | 3661 | const limbs = try allocator.alloc(std.math.big.Limb, std.math.big.int.calcTwosCompLimbCount(bits)); |
| 3665 | defer allocator.free(limbs); | 3662 | defer allocator.free(limbs); |
| 3666 | @memset(limbs, 0); | ||
| 3667 | 3663 | ||
| 3668 | val.writeToPackedMemory(ty, pt, std.mem.sliceAsBytes(limbs)[0..bytes], 0) catch unreachable; | 3664 | val.writeToPackedMemory(ty, pt, buffer, 0) catch unreachable; |
| 3669 | 3665 | ||
| 3670 | if (builtin.target.cpu.arch.endian() == .little) { | 3666 | var big: std.math.big.int.Mutable = .init(limbs, 0); |
| 3671 | if (target.cpu.arch.endian() == .big) | 3667 | big.readTwosComplement(buffer, bits, target.cpu.arch.endian(), .unsigned); |
| 3672 | std.mem.reverse(u8, std.mem.sliceAsBytes(limbs)[0..bytes]); | ||
| 3673 | } else if (target.cpu.arch.endian() == .little) { | ||
| 3674 | for (limbs) |*limb| { | ||
| 3675 | limb.* = std.mem.nativeToLittle(usize, limb.*); | ||
| 3676 | } | ||
| 3677 | } | ||
| 3678 | 3668 | ||
| 3679 | return o.builder.bigIntConst(llvm_int_ty, .{ | 3669 | return o.builder.bigIntConst(llvm_int_ty, big.toConst()); |
| 3680 | .limbs = limbs, | ||
| 3681 | .positive = true, | ||
| 3682 | }); | ||
| 3683 | } | 3670 | } |
| 3684 | 3671 | ||
| 3685 | fn lowerValue(o: *Object, pt: Zcu.PerThread, arg_val: InternPool.Index) Error!Builder.Constant { | 3672 | fn lowerValue(o: *Object, pt: Zcu.PerThread, arg_val: InternPool.Index) Error!Builder.Constant { |
src/target.zig+2| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | const builtin = @import("builtin"); | ||
| 1 | const std = @import("std"); | 2 | const std = @import("std"); |
| 2 | const assert = std.debug.assert; | 3 | const assert = std.debug.assert; |
| 3 | 4 | ||
| ... | @@ -255,6 +256,7 @@ pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.C | ... | @@ -255,6 +256,7 @@ pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.C |
| 255 | /// debug mode. A given target should only return true here if it is passing greater | 256 | /// debug mode. A given target should only return true here if it is passing greater |
| 256 | /// than or equal to the number of behavior tests as the respective LLVM backend. | 257 | /// than or equal to the number of behavior tests as the respective LLVM backend. |
| 257 | pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool { | 258 | pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool { |
| 259 | if (comptime builtin.cpu.arch.endian() == .big) return false; // https://github.com/ziglang/zig/issues/25961 | ||
| 258 | if (target.cpu.arch.isSpirV()) return true; | 260 | if (target.cpu.arch.isSpirV()) return true; |
| 259 | if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) { | 261 | if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) { |
| 260 | if (target.os.tag == .illumos) { | 262 | if (target.os.tag == .illumos) { |
stage1/zig.h+4-2| ... | @@ -28,6 +28,8 @@ | ... | @@ -28,6 +28,8 @@ |
| 28 | #define zig_arm | 28 | #define zig_arm |
| 29 | #elif defined(__hexagon__) | 29 | #elif defined(__hexagon__) |
| 30 | #define zig_hexagon | 30 | #define zig_hexagon |
| 31 | #elif defined(__kvx__) | ||
| 32 | #define zig_kvx | ||
| 31 | #elif defined(__loongarch32) | 33 | #elif defined(__loongarch32) |
| 32 | #define zig_loongarch32 | 34 | #define zig_loongarch32 |
| 33 | #define zig_loongarch | 35 | #define zig_loongarch |
| ... | @@ -383,7 +385,7 @@ | ... | @@ -383,7 +385,7 @@ |
| 383 | #define zig_trap() __asm__ volatile("udf #0xfdee") | 385 | #define zig_trap() __asm__ volatile("udf #0xfdee") |
| 384 | #elif defined(zig_hexagon) | 386 | #elif defined(zig_hexagon) |
| 385 | #define zig_trap() __asm__ volatile("r27:26 = memd(#0xbadc0fee)") | 387 | #define zig_trap() __asm__ volatile("r27:26 = memd(#0xbadc0fee)") |
| 386 | #elif defined(zig_loongarch) || defined(zig_powerpc) | 388 | #elif defined(zig_kvx) || defined(zig_loongarch) || defined(zig_powerpc) |
| 387 | #define zig_trap() __asm__ volatile(".word 0x0") | 389 | #define zig_trap() __asm__ volatile(".word 0x0") |
| 388 | #elif defined(zig_mips) | 390 | #elif defined(zig_mips) |
| 389 | #define zig_trap() __asm__ volatile(".word 0x3d") | 391 | #define zig_trap() __asm__ volatile(".word 0x3d") |
| ... | @@ -419,7 +421,7 @@ | ... | @@ -419,7 +421,7 @@ |
| 419 | #define zig_breakpoint() __asm__ volatile("brk #0xf000") | 421 | #define zig_breakpoint() __asm__ volatile("brk #0xf000") |
| 420 | #elif defined(zig_hexagon) | 422 | #elif defined(zig_hexagon) |
| 421 | #define zig_breakpoint() __asm__ volatile("brkpt") | 423 | #define zig_breakpoint() __asm__ volatile("brkpt") |
| 422 | #elif defined(zig_loongarch) | 424 | #elif defined(zig_kvx) || defined(zig_loongarch) |
| 423 | #define zig_breakpoint() __asm__ volatile("break 0x0") | 425 | #define zig_breakpoint() __asm__ volatile("break 0x0") |
| 424 | #elif defined(zig_mips) | 426 | #elif defined(zig_mips) |
| 425 | #define zig_breakpoint() __asm__ volatile("break") | 427 | #define zig_breakpoint() __asm__ volatile("break") |
stage1/zig1.wasm| Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ | |||
test/c_abi/cfuncs.c+15-9| ... | @@ -77,6 +77,10 @@ static void assert_or_panic(bool ok) { | ... | @@ -77,6 +77,10 @@ static void assert_or_panic(bool ok) { |
| 77 | # define ZIG_NO_COMPLEX | 77 | # define ZIG_NO_COMPLEX |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | #ifdef __s390x__ | ||
| 81 | # define ZIG_NO_COMPLEX | ||
| 82 | #endif | ||
| 83 | |||
| 80 | #ifdef __x86_64__ | 84 | #ifdef __x86_64__ |
| 81 | #define ZIG_NO_RAW_F16 | 85 | #define ZIG_NO_RAW_F16 |
| 82 | #endif | 86 | #endif |
| ... | @@ -2728,7 +2732,7 @@ void run_c_tests(void) { | ... | @@ -2728,7 +2732,7 @@ void run_c_tests(void) { |
| 2728 | } | 2732 | } |
| 2729 | #endif | 2733 | #endif |
| 2730 | 2734 | ||
| 2731 | #if !defined(ZIG_PPC32) && !defined(__hexagon__) | 2735 | #if !defined(ZIG_PPC32) && !defined(__hexagon__) && !defined(__s390x__) |
| 2732 | { | 2736 | { |
| 2733 | struct Struct_u64_u64 s = zig_ret_struct_u64_u64(); | 2737 | struct Struct_u64_u64 s = zig_ret_struct_u64_u64(); |
| 2734 | assert_or_panic(s.a == 1); | 2738 | assert_or_panic(s.a == 1); |
| ... | @@ -2807,7 +2811,7 @@ void run_c_tests(void) { | ... | @@ -2807,7 +2811,7 @@ void run_c_tests(void) { |
| 2807 | 2811 | ||
| 2808 | #if !defined __i386__ && !defined __arm__ && !defined __aarch64__ && \ | 2812 | #if !defined __i386__ && !defined __arm__ && !defined __aarch64__ && \ |
| 2809 | !defined __powerpc__ && !defined ZIG_RISCV64 && !defined(__loongarch__) && \ | 2813 | !defined __powerpc__ && !defined ZIG_RISCV64 && !defined(__loongarch__) && \ |
| 2810 | !defined(__mips64__) && !defined(__hexagon__) | 2814 | !defined(__mips64__) && !defined(__hexagon__) && !defined(__s390x__) |
| 2811 | { | 2815 | { |
| 2812 | struct SmallStructInts s = {1, 2, 3, 4}; | 2816 | struct SmallStructInts s = {1, 2, 3, 4}; |
| 2813 | zig_small_struct_ints(s); | 2817 | zig_small_struct_ints(s); |
| ... | @@ -2816,7 +2820,7 @@ void run_c_tests(void) { | ... | @@ -2816,7 +2820,7 @@ void run_c_tests(void) { |
| 2816 | 2820 | ||
| 2817 | #if !defined __arm__ && !defined __aarch64__ && \ | 2821 | #if !defined __arm__ && !defined __aarch64__ && \ |
| 2818 | !defined __powerpc__ && !defined ZIG_RISCV64 && !defined(__loongarch__) && \ | 2822 | !defined __powerpc__ && !defined ZIG_RISCV64 && !defined(__loongarch__) && \ |
| 2819 | !defined(__mips64__) && !defined(__hexagon__) | 2823 | !defined(__mips64__) && !defined(__hexagon__) && !defined(__s390x__) |
| 2820 | { | 2824 | { |
| 2821 | struct MedStructInts s = {1, 2, 3}; | 2825 | struct MedStructInts s = {1, 2, 3}; |
| 2822 | zig_med_struct_ints(s); | 2826 | zig_med_struct_ints(s); |
| ... | @@ -2843,7 +2847,7 @@ void run_c_tests(void) { | ... | @@ -2843,7 +2847,7 @@ void run_c_tests(void) { |
| 2843 | 2847 | ||
| 2844 | #if !defined __i386__ && !defined __arm__ && \ | 2848 | #if !defined __i386__ && !defined __arm__ && \ |
| 2845 | !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && \ | 2849 | !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && \ |
| 2846 | !defined(__mips64__) && !defined(__hexagon__) | 2850 | !defined(__mips64__) && !defined(__hexagon__) && !defined(__s390x__) |
| 2847 | { | 2851 | { |
| 2848 | struct SplitStructInts s = {1234, 100, 1337}; | 2852 | struct SplitStructInts s = {1234, 100, 1337}; |
| 2849 | zig_split_struct_ints(s); | 2853 | zig_split_struct_ints(s); |
| ... | @@ -2851,7 +2855,7 @@ void run_c_tests(void) { | ... | @@ -2851,7 +2855,7 @@ void run_c_tests(void) { |
| 2851 | #endif | 2855 | #endif |
| 2852 | 2856 | ||
| 2853 | #if !defined __arm__ && !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && \ | 2857 | #if !defined __arm__ && !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && \ |
| 2854 | !defined(__mips64__) && !defined(__hexagon__) | 2858 | !defined(__mips64__) && !defined(__hexagon__) && !defined(__s390x__) |
| 2855 | { | 2859 | { |
| 2856 | struct MedStructMixed s = {1234, 100.0f, 1337.0f}; | 2860 | struct MedStructMixed s = {1234, 100.0f, 1337.0f}; |
| 2857 | zig_med_struct_mixed(s); | 2861 | zig_med_struct_mixed(s); |
| ... | @@ -2860,14 +2864,15 @@ void run_c_tests(void) { | ... | @@ -2860,14 +2864,15 @@ void run_c_tests(void) { |
| 2860 | 2864 | ||
| 2861 | #if !defined __i386__ && !defined __arm__ && \ | 2865 | #if !defined __i386__ && !defined __arm__ && \ |
| 2862 | !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && \ | 2866 | !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && \ |
| 2863 | !defined(__mips64__) && !defined(__hexagon__) | 2867 | !defined(__mips64__) && !defined(__hexagon__) && !defined(__s390x__) |
| 2864 | { | 2868 | { |
| 2865 | struct SplitStructMixed s = {1234, 100, 1337.0f}; | 2869 | struct SplitStructMixed s = {1234, 100, 1337.0f}; |
| 2866 | zig_split_struct_mixed(s); | 2870 | zig_split_struct_mixed(s); |
| 2867 | } | 2871 | } |
| 2868 | #endif | 2872 | #endif |
| 2869 | 2873 | ||
| 2870 | #if !defined(__powerpc__) && !defined(__loongarch__) && !defined(__mips64__) && !defined(__hexagon__) | 2874 | #if !defined(__powerpc__) && !defined(__loongarch__) && !defined(__mips64__) && !defined(__hexagon__) && \ |
| 2875 | !defined(__s390x__) | ||
| 2871 | { | 2876 | { |
| 2872 | struct BigStruct s = {30, 31, 32, 33, 34}; | 2877 | struct BigStruct s = {30, 31, 32, 33, 34}; |
| 2873 | struct BigStruct res = zig_big_struct_both(s); | 2878 | struct BigStruct res = zig_big_struct_both(s); |
| ... | @@ -2880,7 +2885,7 @@ void run_c_tests(void) { | ... | @@ -2880,7 +2885,7 @@ void run_c_tests(void) { |
| 2880 | #endif | 2885 | #endif |
| 2881 | 2886 | ||
| 2882 | #if !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && !defined(__mips64__) && \ | 2887 | #if !defined ZIG_PPC32 && !defined _ARCH_PPC64 && !defined(__loongarch__) && !defined(__mips64__) && \ |
| 2883 | !defined(__hexagon__) | 2888 | !defined(__hexagon__) && !defined(__s390x__) |
| 2884 | { | 2889 | { |
| 2885 | struct Rect r1 = {1, 21, 16, 4}; | 2890 | struct Rect r1 = {1, 21, 16, 4}; |
| 2886 | struct Rect r2 = {178, 189, 21, 15}; | 2891 | struct Rect r2 = {178, 189, 21, 15}; |
| ... | @@ -2888,7 +2893,8 @@ void run_c_tests(void) { | ... | @@ -2888,7 +2893,8 @@ void run_c_tests(void) { |
| 2888 | } | 2893 | } |
| 2889 | #endif | 2894 | #endif |
| 2890 | 2895 | ||
| 2891 | #if !defined ZIG_PPC32 && !defined(__loongarch__) && !defined(__mips64__) && !defined(__hexagon__) | 2896 | #if !defined ZIG_PPC32 && !defined(__loongarch__) && !defined(__mips64__) && !defined(__hexagon__) && \ |
| 2897 | !defined(__s390x__) | ||
| 2892 | { | 2898 | { |
| 2893 | struct FloatRect r1 = {1, 21, 16, 4}; | 2899 | struct FloatRect r1 = {1, 21, 16, 4}; |
| 2894 | struct FloatRect r2 = {178, 189, 21, 15}; | 2900 | struct FloatRect r2 = {178, 189, 21, 15}; |
test/c_abi/main.zig+46-2| ... | @@ -12,7 +12,8 @@ const expect = std.testing.expect; | ... | @@ -12,7 +12,8 @@ const expect = std.testing.expect; |
| 12 | const expectEqual = std.testing.expectEqual; | 12 | const expectEqual = std.testing.expectEqual; |
| 13 | const have_i128 = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isArm() and | 13 | const have_i128 = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isArm() and |
| 14 | !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isPowerPC32() and builtin.cpu.arch != .riscv32 and | 14 | !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isPowerPC32() and builtin.cpu.arch != .riscv32 and |
| 15 | builtin.cpu.arch != .hexagon; | 15 | builtin.cpu.arch != .hexagon and |
| 16 | builtin.cpu.arch != .s390x; // https://github.com/llvm/llvm-project/issues/168460 | ||
| 16 | 17 | ||
| 17 | const have_f128 = builtin.cpu.arch.isWasm() or (builtin.cpu.arch.isX86() and !builtin.os.tag.isDarwin()); | 18 | const have_f128 = builtin.cpu.arch.isWasm() or (builtin.cpu.arch.isX86() and !builtin.os.tag.isDarwin()); |
| 18 | const have_f80 = builtin.cpu.arch.isX86(); | 19 | const have_f80 = builtin.cpu.arch.isX86(); |
| ... | @@ -185,7 +186,8 @@ extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble; | ... | @@ -185,7 +186,8 @@ extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble; |
| 185 | 186 | ||
| 186 | const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isMIPS() and | 187 | const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isMIPS() and |
| 187 | !builtin.cpu.arch.isArm() and !builtin.cpu.arch.isPowerPC32() and !builtin.cpu.arch.isRISCV() and | 188 | !builtin.cpu.arch.isArm() and !builtin.cpu.arch.isPowerPC32() and !builtin.cpu.arch.isRISCV() and |
| 188 | builtin.cpu.arch != .hexagon; | 189 | builtin.cpu.arch != .hexagon and |
| 190 | builtin.cpu.arch != .s390x; | ||
| 189 | 191 | ||
| 190 | test "C ABI complex float" { | 192 | test "C ABI complex float" { |
| 191 | if (!complex_abi_compatible) return error.SkipZigTest; | 193 | if (!complex_abi_compatible) return error.SkipZigTest; |
| ... | @@ -329,6 +331,7 @@ test "C ABI struct u64 u64" { | ... | @@ -329,6 +331,7 @@ test "C ABI struct u64 u64" { |
| 329 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 331 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 330 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 332 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 331 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 333 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 334 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 332 | 335 | ||
| 333 | const s = c_ret_struct_u64_u64(); | 336 | const s = c_ret_struct_u64_u64(); |
| 334 | try expect(s.a == 21); | 337 | try expect(s.a == 21); |
| ... | @@ -363,6 +366,7 @@ extern fn c_struct_f32(Struct_f32) void; | ... | @@ -363,6 +366,7 @@ extern fn c_struct_f32(Struct_f32) void; |
| 363 | test "C ABI struct f32" { | 366 | test "C ABI struct f32" { |
| 364 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 367 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 365 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 368 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 369 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 366 | 370 | ||
| 367 | const s = c_ret_struct_f32(); | 371 | const s = c_ret_struct_f32(); |
| 368 | try expect(s.a == 2.5); | 372 | try expect(s.a == 2.5); |
| ... | @@ -390,6 +394,7 @@ test "C ABI struct f64" { | ... | @@ -390,6 +394,7 @@ test "C ABI struct f64" { |
| 390 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 394 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 391 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; | 395 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; |
| 392 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; | 396 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; |
| 397 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 393 | 398 | ||
| 394 | const s = c_ret_struct_f64(); | 399 | const s = c_ret_struct_f64(); |
| 395 | try expect(s.a == 2.5); | 400 | try expect(s.a == 2.5); |
| ... | @@ -421,6 +426,7 @@ test "C ABI struct {f32,f32} f32" { | ... | @@ -421,6 +426,7 @@ test "C ABI struct {f32,f32} f32" { |
| 421 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; | 426 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; |
| 422 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 427 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 423 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 428 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 429 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 424 | 430 | ||
| 425 | const s = c_ret_struct_f32f32_f32(); | 431 | const s = c_ret_struct_f32f32_f32(); |
| 426 | try expect(s.a.b == 1.0); | 432 | try expect(s.a.b == 1.0); |
| ... | @@ -454,6 +460,7 @@ test "C ABI struct f32 {f32,f32}" { | ... | @@ -454,6 +460,7 @@ test "C ABI struct f32 {f32,f32}" { |
| 454 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; | 460 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; |
| 455 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 461 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 456 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 462 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 463 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 457 | 464 | ||
| 458 | const s = c_ret_struct_f32_f32f32(); | 465 | const s = c_ret_struct_f32_f32f32(); |
| 459 | try expect(s.a == 1.0); | 466 | try expect(s.a == 1.0); |
| ... | @@ -491,6 +498,7 @@ test "C ABI struct{u32,union{u32,struct{u32,u32}}}" { | ... | @@ -491,6 +498,7 @@ test "C ABI struct{u32,union{u32,struct{u32,u32}}}" { |
| 491 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 498 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 492 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 499 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 493 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 500 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 501 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 494 | 502 | ||
| 495 | const s = c_ret_struct_u32_union_u32_u32u32(); | 503 | const s = c_ret_struct_u32_union_u32_u32u32(); |
| 496 | try expect(s.a == 1); | 504 | try expect(s.a == 1); |
| ... | @@ -511,6 +519,7 @@ test "C ABI struct i32 i32" { | ... | @@ -511,6 +519,7 @@ test "C ABI struct i32 i32" { |
| 511 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 519 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 512 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; | 520 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; |
| 513 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 521 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 522 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 514 | 523 | ||
| 515 | const s: Struct_i32_i32 = .{ | 524 | const s: Struct_i32_i32 = .{ |
| 516 | .a = 1, | 525 | .a = 1, |
| ... | @@ -543,6 +552,7 @@ test "C ABI big struct" { | ... | @@ -543,6 +552,7 @@ test "C ABI big struct" { |
| 543 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 552 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 544 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 553 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 545 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 554 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 555 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 546 | 556 | ||
| 547 | const s = BigStruct{ | 557 | const s = BigStruct{ |
| 548 | .a = 1, | 558 | .a = 1, |
| ... | @@ -571,6 +581,7 @@ test "C ABI big union" { | ... | @@ -571,6 +581,7 @@ test "C ABI big union" { |
| 571 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 581 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 572 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 582 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 573 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 583 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 584 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 574 | 585 | ||
| 575 | const x = BigUnion{ | 586 | const x = BigUnion{ |
| 576 | .a = BigStruct{ | 587 | .a = BigStruct{ |
| ... | @@ -606,6 +617,7 @@ test "C ABI medium struct of ints and floats" { | ... | @@ -606,6 +617,7 @@ test "C ABI medium struct of ints and floats" { |
| 606 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 617 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 607 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 618 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 608 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 619 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 620 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 609 | 621 | ||
| 610 | const s = MedStructMixed{ | 622 | const s = MedStructMixed{ |
| 611 | .a = 1234, | 623 | .a = 1234, |
| ... | @@ -641,6 +653,7 @@ test "C ABI small struct of ints" { | ... | @@ -641,6 +653,7 @@ test "C ABI small struct of ints" { |
| 641 | if (builtin.cpu.arch == .aarch64_be) return error.SkipZigTest; | 653 | if (builtin.cpu.arch == .aarch64_be) return error.SkipZigTest; |
| 642 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 654 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 643 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 655 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 656 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 644 | 657 | ||
| 645 | const s = SmallStructInts{ | 658 | const s = SmallStructInts{ |
| 646 | .a = 1, | 659 | .a = 1, |
| ... | @@ -676,6 +689,7 @@ test "C ABI medium struct of ints" { | ... | @@ -676,6 +689,7 @@ test "C ABI medium struct of ints" { |
| 676 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 689 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 677 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 690 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 678 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 691 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 692 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 679 | 693 | ||
| 680 | const s = MedStructInts{ | 694 | const s = MedStructInts{ |
| 681 | .x = 1, | 695 | .x = 1, |
| ... | @@ -756,6 +770,7 @@ test "C ABI split struct of ints" { | ... | @@ -756,6 +770,7 @@ test "C ABI split struct of ints" { |
| 756 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 770 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 757 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 771 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 758 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 772 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 773 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 759 | 774 | ||
| 760 | const s = SplitStructInt{ | 775 | const s = SplitStructInt{ |
| 761 | .a = 1234, | 776 | .a = 1234, |
| ... | @@ -785,6 +800,7 @@ test "C ABI split struct of ints and floats" { | ... | @@ -785,6 +800,7 @@ test "C ABI split struct of ints and floats" { |
| 785 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 800 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 786 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 801 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 787 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 802 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 803 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 788 | 804 | ||
| 789 | const s = SplitStructMixed{ | 805 | const s = SplitStructMixed{ |
| 790 | .a = 1234, | 806 | .a = 1234, |
| ... | @@ -814,6 +830,7 @@ test "C ABI sret and byval together" { | ... | @@ -814,6 +830,7 @@ test "C ABI sret and byval together" { |
| 814 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 830 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 815 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 831 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 816 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 832 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 833 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 817 | 834 | ||
| 818 | const s = BigStruct{ | 835 | const s = BigStruct{ |
| 819 | .a = 1, | 836 | .a = 1, |
| ... | @@ -868,6 +885,7 @@ test "C ABI structs of floats as parameter" { | ... | @@ -868,6 +885,7 @@ test "C ABI structs of floats as parameter" { |
| 868 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 885 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 869 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 886 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 870 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 887 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 888 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 871 | 889 | ||
| 872 | const v3 = Vector3{ | 890 | const v3 = Vector3{ |
| 873 | .x = 3.0, | 891 | .x = 3.0, |
| ... | @@ -910,6 +928,7 @@ test "C ABI structs of ints as multiple parameters" { | ... | @@ -910,6 +928,7 @@ test "C ABI structs of ints as multiple parameters" { |
| 910 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 928 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 911 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 929 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 912 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 930 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 931 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 913 | 932 | ||
| 914 | const r1 = Rect{ | 933 | const r1 = Rect{ |
| 915 | .left = 1, | 934 | .left = 1, |
| ... | @@ -949,6 +968,7 @@ test "C ABI structs of floats as multiple parameters" { | ... | @@ -949,6 +968,7 @@ test "C ABI structs of floats as multiple parameters" { |
| 949 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 968 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 950 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 969 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 951 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 970 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 971 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 952 | 972 | ||
| 953 | const r1 = FloatRect{ | 973 | const r1 = FloatRect{ |
| 954 | .left = 1, | 974 | .left = 1, |
| ... | @@ -1064,6 +1084,7 @@ test "Struct with array as padding." { | ... | @@ -1064,6 +1084,7 @@ test "Struct with array as padding." { |
| 1064 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 1084 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 1065 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 1085 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 1066 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 1086 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 1087 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 1067 | 1088 | ||
| 1068 | c_struct_with_array(.{ .a = 1, .padding = undefined, .b = 2 }); | 1089 | c_struct_with_array(.{ .a = 1, .padding = undefined, .b = 2 }); |
| 1069 | 1090 | ||
| ... | @@ -1091,6 +1112,7 @@ test "Float array like struct" { | ... | @@ -1091,6 +1112,7 @@ test "Float array like struct" { |
| 1091 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 1112 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 1092 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 1113 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 1093 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 1114 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 1115 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 1094 | 1116 | ||
| 1095 | c_float_array_struct(.{ | 1117 | c_float_array_struct(.{ |
| 1096 | .origin = .{ | 1118 | .origin = .{ |
| ... | @@ -1119,6 +1141,7 @@ test "small simd vector" { | ... | @@ -1119,6 +1141,7 @@ test "small simd vector" { |
| 1119 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; | 1141 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 1120 | if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; | 1142 | if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; |
| 1121 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 1143 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 1144 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 1122 | 1145 | ||
| 1123 | c_small_vec(.{ 1, 2 }); | 1146 | c_small_vec(.{ 1, 2 }); |
| 1124 | 1147 | ||
| ... | @@ -1136,6 +1159,7 @@ test "medium simd vector" { | ... | @@ -1136,6 +1159,7 @@ test "medium simd vector" { |
| 1136 | if (builtin.zig_backend == .stage2_x86_64 and !comptime builtin.cpu.has(.x86, .avx)) return error.SkipZigTest; | 1159 | if (builtin.zig_backend == .stage2_x86_64 and !comptime builtin.cpu.has(.x86, .avx)) return error.SkipZigTest; |
| 1137 | if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; | 1160 | if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; |
| 1138 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 1161 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 1162 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 1139 | 1163 | ||
| 1140 | c_medium_vec(.{ 1, 2, 3, 4 }); | 1164 | c_medium_vec(.{ 1, 2, 3, 4 }); |
| 1141 | 1165 | ||
| ... | @@ -1184,6 +1208,7 @@ extern fn c_ret_vector_4_float() Vector4Float; | ... | @@ -1184,6 +1208,7 @@ extern fn c_ret_vector_4_float() Vector4Float; |
| 1184 | test "float simd vectors" { | 1208 | test "float simd vectors" { |
| 1185 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 1209 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 1186 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 1210 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 1211 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 1187 | 1212 | ||
| 1188 | { | 1213 | { |
| 1189 | c_vector_2_float(.{ 1.0, 2.0 }); | 1214 | c_vector_2_float(.{ 1.0, 2.0 }); |
| ... | @@ -5469,6 +5494,7 @@ test "C ABI pointer sized float struct" { | ... | @@ -5469,6 +5494,7 @@ test "C ABI pointer sized float struct" { |
| 5469 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 5494 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 5470 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 5495 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 5471 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; | 5496 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; |
| 5497 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5472 | 5498 | ||
| 5473 | c_ptr_size_float_struct(.{ .x = 1, .y = 2 }); | 5499 | c_ptr_size_float_struct(.{ .x = 1, .y = 2 }); |
| 5474 | 5500 | ||
| ... | @@ -5493,6 +5519,7 @@ test "DC: Zig passes to C" { | ... | @@ -5493,6 +5519,7 @@ test "DC: Zig passes to C" { |
| 5493 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5519 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5494 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5520 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5495 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5521 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5522 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5496 | try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 })); | 5523 | try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 })); |
| 5497 | } | 5524 | } |
| 5498 | test "DC: Zig returns to C" { | 5525 | test "DC: Zig returns to C" { |
| ... | @@ -5500,6 +5527,7 @@ test "DC: Zig returns to C" { | ... | @@ -5500,6 +5527,7 @@ test "DC: Zig returns to C" { |
| 5500 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 5527 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 5501 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5528 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5502 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5529 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5530 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5503 | try expectOk(c_assert_ret_DC()); | 5531 | try expectOk(c_assert_ret_DC()); |
| 5504 | } | 5532 | } |
| 5505 | test "DC: C passes to Zig" { | 5533 | test "DC: C passes to Zig" { |
| ... | @@ -5508,6 +5536,7 @@ test "DC: C passes to Zig" { | ... | @@ -5508,6 +5536,7 @@ test "DC: C passes to Zig" { |
| 5508 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5536 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5509 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5537 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5510 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5538 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5539 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5511 | try expectOk(c_send_DC()); | 5540 | try expectOk(c_send_DC()); |
| 5512 | } | 5541 | } |
| 5513 | test "DC: C returns to Zig" { | 5542 | test "DC: C returns to Zig" { |
| ... | @@ -5515,6 +5544,7 @@ test "DC: C returns to Zig" { | ... | @@ -5515,6 +5544,7 @@ test "DC: C returns to Zig" { |
| 5515 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 5544 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 5516 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5545 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5517 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5546 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5547 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5518 | try expectEqual(DC{ .v1 = -0.25, .v2 = 15 }, c_ret_DC()); | 5548 | try expectEqual(DC{ .v1 = -0.25, .v2 = 15 }, c_ret_DC()); |
| 5519 | } | 5549 | } |
| 5520 | 5550 | ||
| ... | @@ -5542,12 +5572,14 @@ test "CFF: Zig passes to C" { | ... | @@ -5542,12 +5572,14 @@ test "CFF: Zig passes to C" { |
| 5542 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5572 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5543 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5573 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5544 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5574 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5575 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5545 | try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 })); | 5576 | try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 })); |
| 5546 | } | 5577 | } |
| 5547 | test "CFF: Zig returns to C" { | 5578 | test "CFF: Zig returns to C" { |
| 5548 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 5579 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 5549 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5580 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5550 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5581 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5582 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5551 | try expectOk(c_assert_ret_CFF()); | 5583 | try expectOk(c_assert_ret_CFF()); |
| 5552 | } | 5584 | } |
| 5553 | test "CFF: C passes to Zig" { | 5585 | test "CFF: C passes to Zig" { |
| ... | @@ -5558,6 +5590,7 @@ test "CFF: C passes to Zig" { | ... | @@ -5558,6 +5590,7 @@ test "CFF: C passes to Zig" { |
| 5558 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5590 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5559 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5591 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5560 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5592 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5593 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5561 | 5594 | ||
| 5562 | try expectOk(c_send_CFF()); | 5595 | try expectOk(c_send_CFF()); |
| 5563 | } | 5596 | } |
| ... | @@ -5567,6 +5600,7 @@ test "CFF: C returns to Zig" { | ... | @@ -5567,6 +5600,7 @@ test "CFF: C returns to Zig" { |
| 5567 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 5600 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 5568 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5601 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5569 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5602 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5603 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5570 | try expectEqual(CFF{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }, c_ret_CFF()); | 5604 | try expectEqual(CFF{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }, c_ret_CFF()); |
| 5571 | } | 5605 | } |
| 5572 | pub extern fn c_assert_CFF(lv: CFF) c_int; | 5606 | pub extern fn c_assert_CFF(lv: CFF) c_int; |
| ... | @@ -5593,12 +5627,14 @@ test "PD: Zig passes to C" { | ... | @@ -5593,12 +5627,14 @@ test "PD: Zig passes to C" { |
| 5593 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5627 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5594 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5628 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5595 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5629 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5630 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5596 | try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 })); | 5631 | try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 })); |
| 5597 | } | 5632 | } |
| 5598 | test "PD: Zig returns to C" { | 5633 | test "PD: Zig returns to C" { |
| 5599 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 5634 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 5600 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5635 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5601 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5636 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5637 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5602 | try expectOk(c_assert_ret_PD()); | 5638 | try expectOk(c_assert_ret_PD()); |
| 5603 | } | 5639 | } |
| 5604 | test "PD: C passes to Zig" { | 5640 | test "PD: C passes to Zig" { |
| ... | @@ -5606,12 +5642,14 @@ test "PD: C passes to Zig" { | ... | @@ -5606,12 +5642,14 @@ test "PD: C passes to Zig" { |
| 5606 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5642 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5607 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5643 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5608 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5644 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5645 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5609 | try expectOk(c_send_PD()); | 5646 | try expectOk(c_send_PD()); |
| 5610 | } | 5647 | } |
| 5611 | test "PD: C returns to Zig" { | 5648 | test "PD: C returns to Zig" { |
| 5612 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 5649 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 5613 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; | 5650 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 5614 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5651 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5652 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5615 | try expectEqual(PD{ .v1 = null, .v2 = 0.5 }, c_ret_PD()); | 5653 | try expectEqual(PD{ .v1 = null, .v2 = 0.5 }, c_ret_PD()); |
| 5616 | } | 5654 | } |
| 5617 | pub extern fn c_assert_PD(lv: PD) c_int; | 5655 | pub extern fn c_assert_PD(lv: PD) c_int; |
| ... | @@ -5645,6 +5683,7 @@ extern fn c_modify_by_ref_param(ByRef) ByRef; | ... | @@ -5645,6 +5683,7 @@ extern fn c_modify_by_ref_param(ByRef) ByRef; |
| 5645 | test "C function modifies by ref param" { | 5683 | test "C function modifies by ref param" { |
| 5646 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 5684 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 5647 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5685 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5686 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5648 | 5687 | ||
| 5649 | const res = c_modify_by_ref_param(.{ .val = 1, .arr = undefined }); | 5688 | const res = c_modify_by_ref_param(.{ .val = 1, .arr = undefined }); |
| 5650 | try expect(res.val == 42); | 5689 | try expect(res.val == 42); |
| ... | @@ -5669,6 +5708,7 @@ test "C function that takes byval struct called via function pointer" { | ... | @@ -5669,6 +5708,7 @@ test "C function that takes byval struct called via function pointer" { |
| 5669 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 5708 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 5670 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5709 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5671 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5710 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5711 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5672 | 5712 | ||
| 5673 | var fn_ptr = &c_func_ptr_byval; | 5713 | var fn_ptr = &c_func_ptr_byval; |
| 5674 | _ = &fn_ptr; | 5714 | _ = &fn_ptr; |
| ... | @@ -5701,6 +5741,7 @@ test "f16 struct" { | ... | @@ -5701,6 +5741,7 @@ test "f16 struct" { |
| 5701 | if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest; | 5741 | if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 5702 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 5742 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 5703 | if (builtin.cpu.arch.isArm() and builtin.mode != .Debug) return error.SkipZigTest; | 5743 | if (builtin.cpu.arch.isArm() and builtin.mode != .Debug) return error.SkipZigTest; |
| 5744 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5704 | 5745 | ||
| 5705 | const a = c_f16_struct(.{ .a = 12 }); | 5746 | const a = c_f16_struct(.{ .a = 12 }); |
| 5706 | try expect(a.a == 34); | 5747 | try expect(a.a == 34); |
| ... | @@ -5810,6 +5851,7 @@ test "Stdcall ABI structs" { | ... | @@ -5810,6 +5851,7 @@ test "Stdcall ABI structs" { |
| 5810 | if (builtin.cpu.arch == .aarch64_be) return error.SkipZigTest; | 5851 | if (builtin.cpu.arch == .aarch64_be) return error.SkipZigTest; |
| 5811 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5852 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5812 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5853 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5854 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5813 | 5855 | ||
| 5814 | const res = stdcall_coord2( | 5856 | const res = stdcall_coord2( |
| 5815 | .{ .x = 0x1111, .y = 0x2222 }, | 5857 | .{ .x = 0x1111, .y = 0x2222 }, |
| ... | @@ -5825,6 +5867,7 @@ test "Stdcall ABI big union" { | ... | @@ -5825,6 +5867,7 @@ test "Stdcall ABI big union" { |
| 5825 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 5867 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 5826 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5868 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5827 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5869 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5870 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5828 | 5871 | ||
| 5829 | const x = BigUnion{ | 5872 | const x = BigUnion{ |
| 5830 | .a = BigStruct{ | 5873 | .a = BigStruct{ |
| ... | @@ -5899,6 +5942,7 @@ test "byval tail callsite attribute" { | ... | @@ -5899,6 +5942,7 @@ test "byval tail callsite attribute" { |
| 5899 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 5942 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 5900 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5943 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5901 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5944 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5945 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | ||
| 5902 | 5946 | ||
| 5903 | // Originally reported at https://github.com/ziglang/zig/issues/16290 | 5947 | // Originally reported at https://github.com/ziglang/zig/issues/16290 |
| 5904 | // the bug was that the extern function had the byval attribute, but | 5948 | // the bug was that the extern function had the byval attribute, but |
test/error_traces.zig+1| ... | @@ -437,6 +437,7 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { | ... | @@ -437,6 +437,7 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { |
| 437 | .{ .aarch64, .linux }, | 437 | .{ .aarch64, .linux }, |
| 438 | .{ .loongarch64, .linux }, | 438 | .{ .loongarch64, .linux }, |
| 439 | .{ .riscv64, .linux }, | 439 | .{ .riscv64, .linux }, |
| 440 | .{ .s390x, .linux }, | ||
| 440 | .{ .x86_64, .windows }, | 441 | .{ .x86_64, .windows }, |
| 441 | .{ .x86, .windows }, | 442 | .{ .x86, .windows }, |
| 442 | .{ .x86_64, .macos }, | 443 | .{ .x86_64, .macos }, |
test/link/elf.zig+3| ... | @@ -5,6 +5,9 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -5,6 +5,9 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 5 | // https://github.com/ziglang/zig/issues/25323 | 5 | // https://github.com/ziglang/zig/issues/25323 |
| 6 | if (builtin.os.tag == .freebsd) return elf_step; | 6 | if (builtin.os.tag == .freebsd) return elf_step; |
| 7 | 7 | ||
| 8 | // https://github.com/ziglang/zig/issues/25961 | ||
| 9 | if (comptime builtin.cpu.arch.endian() == .big) return elf_step; | ||
| 10 | |||
| 8 | const default_target = b.resolveTargetQuery(.{ | 11 | const default_target = b.resolveTargetQuery(.{ |
| 9 | .cpu_arch = .x86_64, // TODO relax this once ELF linker is able to handle other archs | 12 | .cpu_arch = .x86_64, // TODO relax this once ELF linker is able to handle other archs |
| 10 | .os_tag = .linux, | 13 | .os_tag = .linux, |
test/link/macho.zig+3| ... | @@ -6,6 +6,9 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -6,6 +6,9 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 6 | // https://github.com/ziglang/zig/issues/25323 | 6 | // https://github.com/ziglang/zig/issues/25323 |
| 7 | if (builtin.os.tag == .freebsd) return macho_step; | 7 | if (builtin.os.tag == .freebsd) return macho_step; |
| 8 | 8 | ||
| 9 | // https://github.com/ziglang/zig/issues/25961 | ||
| 10 | if (comptime builtin.cpu.arch.endian() == .big) return macho_step; | ||
| 11 | |||
| 9 | const x86_64_target = b.resolveTargetQuery(.{ | 12 | const x86_64_target = b.resolveTargetQuery(.{ |
| 10 | .cpu_arch = .x86_64, | 13 | .cpu_arch = .x86_64, |
| 11 | .os_tag = .macos, | 14 | .os_tag = .macos, |
test/src/ErrorTrace.zig+1| ... | @@ -39,6 +39,7 @@ pub fn addCase(self: *ErrorTrace, case: Case) void { | ... | @@ -39,6 +39,7 @@ pub fn addCase(self: *ErrorTrace, case: Case) void { |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | fn shouldTestNonLlvm(target: *const std.Target) bool { | 41 | fn shouldTestNonLlvm(target: *const std.Target) bool { |
| 42 | if (comptime builtin.cpu.arch.endian() == .big) return false; // https://github.com/ziglang/zig/issues/25961 | ||
| 42 | return switch (target.cpu.arch) { | 43 | return switch (target.cpu.arch) { |
| 43 | .x86_64 => switch (target.ofmt) { | 44 | .x86_64 => switch (target.ofmt) { |
| 44 | .elf => !target.os.tag.isBSD() and target.os.tag != .illumos, | 45 | .elf => !target.os.tag.isBSD() and target.os.tag != .illumos, |
test/src/StackTrace.zig+8-5| ... | @@ -44,12 +44,15 @@ fn addCaseTarget( | ... | @@ -44,12 +44,15 @@ fn addCaseTarget( |
| 44 | target: *const std.Build.ResolvedTarget, | 44 | target: *const std.Build.ResolvedTarget, |
| 45 | triple: ?[]const u8, | 45 | triple: ?[]const u8, |
| 46 | ) void { | 46 | ) void { |
| 47 | const both_backends = switch (target.result.cpu.arch) { | 47 | const both_backends = b: { |
| 48 | .x86_64 => switch (target.result.ofmt) { | 48 | if (comptime builtin.cpu.arch.endian() == .big) break :b false; // https://github.com/ziglang/zig/issues/25961 |
| 49 | .elf => !target.result.os.tag.isBSD() and target.result.os.tag != .illumos, | 49 | break :b switch (target.result.cpu.arch) { |
| 50 | .x86_64 => switch (target.result.ofmt) { | ||
| 51 | .elf => !target.result.os.tag.isBSD() and target.result.os.tag != .illumos, | ||
| 52 | else => false, | ||
| 53 | }, | ||
| 50 | else => false, | 54 | else => false, |
| 51 | }, | 55 | }; |
| 52 | else => false, | ||
| 53 | }; | 56 | }; |
| 54 | const both_pie = switch (target.result.os.tag) { | 57 | const both_pie = switch (target.result.os.tag) { |
| 55 | .fuchsia, .openbsd => false, | 58 | .fuchsia, .openbsd => false, |
test/standalone/c_compiler/test.c-25| ... | @@ -25,30 +25,5 @@ int main (int argc, char *argv[]) | ... | @@ -25,30 +25,5 @@ int main (int argc, char *argv[]) |
| 25 | 25 | ||
| 26 | if (!ok) abort(); | 26 | if (!ok) abort(); |
| 27 | 27 | ||
| 28 | // Test some basic arithmetic from compiler-rt | ||
| 29 | { | ||
| 30 | double complex z = 0.0 + I * 4.0; | ||
| 31 | double complex w = 0.0 + I * 16.0; | ||
| 32 | double complex product = z * w; | ||
| 33 | double complex quotient = z / w; | ||
| 34 | |||
| 35 | if (!(creal(product) == -64.0)) abort(); | ||
| 36 | if (!(cimag(product) == 0.0)) abort(); | ||
| 37 | if (!(creal(quotient) == 0.25)) abort(); | ||
| 38 | if (!(cimag(quotient) == 0.0)) abort(); | ||
| 39 | } | ||
| 40 | |||
| 41 | { | ||
| 42 | float complex z = 4.0 + I * 4.0; | ||
| 43 | float complex w = 2.0 - I * 2.0; | ||
| 44 | float complex product = z * w; | ||
| 45 | float complex quotient = z / w; | ||
| 46 | |||
| 47 | if (!(creal(product) == 16.0)) abort(); | ||
| 48 | if (!(cimag(product) == 0.0)) abort(); | ||
| 49 | if (!(creal(quotient) == 0.0)) abort(); | ||
| 50 | if (!(cimag(quotient) == 2.0)) abort(); | ||
| 51 | } | ||
| 52 | |||
| 53 | return EXIT_SUCCESS; | 28 | return EXIT_SUCCESS; |
| 54 | } | 29 | } |
test/standalone/glibc_compat/build.zig+16-12| ... | @@ -141,12 +141,14 @@ pub fn build(b: *std.Build) void { | ... | @@ -141,12 +141,14 @@ pub fn build(b: *std.Build) void { |
| 141 | check.checkInDynamicSymtab(); | 141 | check.checkInDynamicSymtab(); |
| 142 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT powf"); | 142 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT powf"); |
| 143 | 143 | ||
| 144 | // An atexit local symbol is defined, and depends on undefined dynamic | 144 | if (target.result.cpu.arch != .s390x) { |
| 145 | // __cxa_atexit. | 145 | // An atexit local symbol is defined, and depends on undefined dynamic |
| 146 | check.checkInSymtab(); | 146 | // __cxa_atexit. |
| 147 | check.checkContains("FUNC LOCAL HIDDEN atexit"); | 147 | check.checkInSymtab(); |
| 148 | check.checkInDynamicSymtab(); | 148 | check.checkContains("FUNC LOCAL HIDDEN atexit"); |
| 149 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit"); | 149 | check.checkInDynamicSymtab(); |
| 150 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit"); | ||
| 151 | } | ||
| 150 | 152 | ||
| 151 | test_step.dependOn(&check.step); | 153 | test_step.dependOn(&check.step); |
| 152 | } | 154 | } |
| ... | @@ -250,12 +252,14 @@ pub fn build(b: *std.Build) void { | ... | @@ -250,12 +252,14 @@ pub fn build(b: *std.Build) void { |
| 250 | check.checkInDynamicSymtab(); | 252 | check.checkInDynamicSymtab(); |
| 251 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT exit"); | 253 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT exit"); |
| 252 | 254 | ||
| 253 | // An atexit local symbol is defined, and depends on undefined dynamic | 255 | if (target.result.cpu.arch != .s390x) { |
| 254 | // __cxa_atexit. | 256 | // An atexit local symbol is defined, and depends on undefined dynamic |
| 255 | check.checkInSymtab(); | 257 | // __cxa_atexit. |
| 256 | check.checkContains("FUNC LOCAL HIDDEN atexit"); | 258 | check.checkInSymtab(); |
| 257 | check.checkInDynamicSymtab(); | 259 | check.checkContains("FUNC LOCAL HIDDEN atexit"); |
| 258 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit"); | 260 | check.checkInDynamicSymtab(); |
| 261 | check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit"); | ||
| 262 | } | ||
| 259 | 263 | ||
| 260 | test_step.dependOn(&check.step); | 264 | test_step.dependOn(&check.step); |
| 261 | } | 265 | } |
test/tests.zig+8-8| ... | @@ -1756,14 +1756,13 @@ const c_abi_targets = blk: { | ... | @@ -1756,14 +1756,13 @@ const c_abi_targets = blk: { |
| 1756 | }, | 1756 | }, |
| 1757 | }, | 1757 | }, |
| 1758 | 1758 | ||
| 1759 | // Clang explodes when parsing `cfuncs.c`. | 1759 | .{ |
| 1760 | // .{ | 1760 | .target = .{ |
| 1761 | // .target = .{ | 1761 | .cpu_arch = .s390x, |
| 1762 | // .cpu_arch = .s390x, | 1762 | .os_tag = .linux, |
| 1763 | // .os_tag = .linux, | 1763 | .abi = .musl, |
| 1764 | // .abi = .musl, | 1764 | }, |
| 1765 | // }, | 1765 | }, |
| 1766 | // }, | ||
| 1767 | 1766 | ||
| 1768 | .{ | 1767 | .{ |
| 1769 | .target = std.Target.Query.parse(.{ | 1768 | .target = std.Target.Query.parse(.{ |
| ... | @@ -2500,6 +2499,7 @@ fn addOneModuleTest( | ... | @@ -2500,6 +2499,7 @@ fn addOneModuleTest( |
| 2500 | } | 2499 | } |
| 2501 | 2500 | ||
| 2502 | pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: OptimizeMode) bool { | 2501 | pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: OptimizeMode) bool { |
| 2502 | if (comptime builtin.cpu.arch.endian() == .big) return true; // https://github.com/ziglang/zig/issues/25961 | ||
| 2503 | if (use_llvm) |x| return x; | 2503 | if (use_llvm) |x| return x; |
| 2504 | if (query.ofmt == .c) return false; | 2504 | if (query.ofmt == .c) return false; |
| 2505 | switch (optimize_mode) { | 2505 | switch (optimize_mode) { |
tools/incr-check.zig+13-8| ... | @@ -290,9 +290,8 @@ const Eval = struct { | ... | @@ -290,9 +290,8 @@ const Eval = struct { |
| 290 | return; | 290 | return; |
| 291 | }, | 291 | }, |
| 292 | .emit_digest => { | 292 | .emit_digest => { |
| 293 | const EbpHdr = std.zig.Server.Message.EmitDigest; | 293 | var r: std.Io.Reader = .fixed(body); |
| 294 | const ebp_hdr = @as(*align(1) const EbpHdr, @ptrCast(body)); | 294 | _ = r.takeStruct(std.zig.Server.Message.EmitDigest, .little) catch unreachable; |
| 295 | _ = ebp_hdr; | ||
| 296 | if (stderr.bufferedLen() > 0) { | 295 | if (stderr.bufferedLen() > 0) { |
| 297 | const stderr_data = try poller.toOwnedSlice(.stderr); | 296 | const stderr_data = try poller.toOwnedSlice(.stderr); |
| 298 | if (eval.allow_stderr) { | 297 | if (eval.allow_stderr) { |
| ... | @@ -307,7 +306,7 @@ const Eval = struct { | ... | @@ -307,7 +306,7 @@ const Eval = struct { |
| 307 | // This message indicates the end of the update. | 306 | // This message indicates the end of the update. |
| 308 | } | 307 | } |
| 309 | 308 | ||
| 310 | const digest = body[@sizeOf(EbpHdr)..][0..Cache.bin_digest_len]; | 309 | const digest = r.takeArray(Cache.bin_digest_len) catch unreachable; |
| 311 | const result_dir = ".local-cache" ++ std.fs.path.sep_str ++ "o" ++ std.fs.path.sep_str ++ Cache.binToHex(digest.*); | 310 | const result_dir = ".local-cache" ++ std.fs.path.sep_str ++ "o" ++ std.fs.path.sep_str ++ Cache.binToHex(digest.*); |
| 312 | 311 | ||
| 313 | const bin_name = try std.zig.EmitArtifact.bin.cacheName(arena, .{ | 312 | const bin_name = try std.zig.EmitArtifact.bin.cacheName(arena, .{ |
| ... | @@ -519,7 +518,10 @@ const Eval = struct { | ... | @@ -519,7 +518,10 @@ const Eval = struct { |
| 519 | .tag = .update, | 518 | .tag = .update, |
| 520 | .bytes_len = 0, | 519 | .bytes_len = 0, |
| 521 | }; | 520 | }; |
| 522 | try eval.child.stdin.?.writeAll(std.mem.asBytes(&header)); | 521 | var w = eval.child.stdin.?.writer(&.{}); |
| 522 | w.interface.writeStruct(header, .little) catch |err| switch (err) { | ||
| 523 | error.WriteFailed => return w.err.?, | ||
| 524 | }; | ||
| 523 | } | 525 | } |
| 524 | 526 | ||
| 525 | fn end(eval: *Eval, poller: *Poller) !void { | 527 | fn end(eval: *Eval, poller: *Poller) !void { |
| ... | @@ -836,9 +838,12 @@ fn requestExit(child: *std.process.Child, eval: *Eval) void { | ... | @@ -836,9 +838,12 @@ fn requestExit(child: *std.process.Child, eval: *Eval) void { |
| 836 | .tag = .exit, | 838 | .tag = .exit, |
| 837 | .bytes_len = 0, | 839 | .bytes_len = 0, |
| 838 | }; | 840 | }; |
| 839 | child.stdin.?.writeAll(std.mem.asBytes(&header)) catch |err| switch (err) { | 841 | var w = eval.child.stdin.?.writer(&.{}); |
| 840 | error.BrokenPipe => {}, | 842 | w.interface.writeStruct(header, .little) catch |err| switch (err) { |
| 841 | else => eval.fatal("failed to send exit: {s}", .{@errorName(err)}), | 843 | error.WriteFailed => switch (w.err.?) { |
| 844 | error.BrokenPipe => {}, | ||
| 845 | else => |e| eval.fatal("failed to send exit: {s}", .{@errorName(e)}), | ||
| 846 | }, | ||
| 842 | }; | 847 | }; |
| 843 | 848 | ||
| 844 | // Send EOF to stdin. | 849 | // Send EOF to stdin. |