302 Commits

Author SHA1 Message Date
Alex Rønne Petersen
ddc815e3d8 drop support for powerpc64 ELF v1
* ELF v1 on powerpc64 is only barely kept on life support in a couple of Linux
  distros. I don't anticipate that this will last much longer.
* Most of the Linux world has moved to powerpc64le which requires ELF v2.
* Some Linux distros have even started supporting powerpc64 with ELF v2.
* The BSD world has long since moved to ELF v2.
* We have no actual linking support for ELF v1.
* ELF v1 had confused DWARF register mappings which is becoming a problem in
  our DWARF code in std.debug.

It's clear that ELF v1 is on its way out, and we never fully supported it
anyway. So let's not waste any time or energy on it going forward.

closes #5927
2025-10-06 01:28:56 +02:00
Alex Rønne Petersen
73602f2a13
std.Target: baseline model for s390x-zos should be arch10, not arch8 2025-10-05 00:23:51 +02:00
Jacob Young
e1f3fc6ce2 Coff2: create a new linker from scratch 2025-10-02 17:44:52 -04:00
Andrew Kelley
426af68b7d compiler: require comptime vector indexes 2025-09-20 18:33:00 -07:00
Alex Rønne Petersen
5e9e1fb0c8
std.Target: adjustments to LoongArch CPU models
* Remove the generic model; we already have generic_la32 and generic_la64 and
  pick appropriately based on bitness.
* Remove the loongarch64 model. We used this as our baseline for 64-bit, but it's
  actually pretty misleading and useless; it doesn't represent any real CPU and
  has less features than generic_la64.
* Add la64v1_0 and la64v1_1 models.
* Change our baseline CPU model for 64-bit to be la64v1_0, thus adding LSX to
  the baseline feature set.
2025-09-18 12:42:24 +02:00
Andrew Kelley
b7104231af
Merge pull request #25077 from ziglang/GenericReader
std.Io: delete GenericReader, AnyReader, FixedBufferStream; and related API breakage
2025-08-30 12:43:52 -07:00
Alex Rønne Petersen
0b9f5e2549
std.Target: fix alignment for int/long types on m68k 2025-08-30 06:36:41 +02:00
Alex Rønne Petersen
fdd32a2257
std.Target: add managarm OS tag 2025-08-30 06:36:41 +02:00
Alex Rønne Petersen
464eef390b
std.Target: make ultrasparc3 the baseline for sparc64-solaris
https://github.com/llvm/llvm-project/pull/149990
2025-08-30 06:36:41 +02:00
Alex Rønne Petersen
2c0cc81e74
std.Target: bump feature bit count from 288 to 317
/lib/std/debug.zig:559:14: error: reached unreachable code
        if (!ok) unreachable; // assertion failure
                 ^~~~~~~~~~~
    /lib/std/Target/riscv.zig:335:21: note: called at comptime here
        std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-08-30 06:36:41 +02:00
Andrew Kelley
79f267f6b9 std.Io: delete GenericReader
and delete deprecated alias std.io
2025-08-29 17:14:26 -07:00
Maciej 'vesim' Kuliński
ff859088e4 std.Target: add vita os
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-26 07:50:06 +02:00
Alex Rønne Petersen
5d019abe4e start adding big endian RISC-V support
The big endian RISC-V effort is mostly driven by MIPS (the company) which is
pivoting to RISC-V, and presumably needs a big endian variant to fill the niche
that big endian MIPS (the ISA) did.

GCC already supports these targets, but LLVM support will only appear in 22;
this commit just adds the necessary target knowledge and checks on our end.
2025-08-25 16:15:17 +02:00
GasInfinity
306176046e chore(std.Target): explicitly set baseline only to arm with 3ds
* `arm` is the only supported tag for 3ds

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-22 04:14:53 +02:00
GasInfinity
851f31b0e1 chore(std.Target): document the 3ds version range 2025-08-22 04:14:53 +02:00
GasInfinity
cc71936eb9 feat(std.Target): add 3ds os 2025-08-22 04:14:53 +02:00
Alex Rønne Petersen
113d3dd3f0 std.Target: bump default android API level from 24 to 29
According to https://apilevels.com, 88.5% of Android users are on 29+. Older API
levels require libc as of https://github.com/ziglang/zig/pull/24629, which has
confused some users. Seems reasonable to bump the default so most people won't
be confused by this.
2025-08-13 08:59:13 +02:00
Alex Rønne Petersen
163e9ce7d9
Merge pull request #24629 from alexrp/android-requires-libc
`std.Target`: require libc for Android API levels prior to 29
2025-08-04 17:59:47 +02:00
Alex Rønne Petersen
ba7cc72c47
std.Target: bump watchos min version to 8.0.0 2025-08-03 20:08:19 +02:00
Alex Rønne Petersen
71722df4ab
std.Target: bump driverkit min version to 20.0.0 2025-08-03 20:08:07 +02:00
Alex Rønne Petersen
e9093b8d18
std.Target: bump max versions for Apple targets 2025-08-03 20:05:21 +02:00
Alex Rønne Petersen
5b74d33471
std.Target: bump amdhsa max version to 6.4.2 2025-08-03 20:00:32 +02:00
Alex Rønne Petersen
afe458e9b6
std.Target: bump vulkan max version to 1.4.321 2025-08-03 19:59:46 +02:00
Alex Rønne Petersen
7f2140710f
std.Target: bump cuda max version to 12.9.1 2025-08-03 19:59:46 +02:00
Alex Rønne Petersen
39b653c5e7
std.Target: bump freebsd max version to 14.3.0 2025-08-03 19:59:43 +02:00
Alex Rønne Petersen
af3baee5ca
std.Target: bump linux max version to 6.16.0 2025-08-03 19:59:40 +02:00
Alex Rønne Petersen
1808ecfa04
std.Target: bump fuchsia max version to 27.0.0 2025-08-03 19:59:35 +02:00
Alex Rønne Petersen
03facba496
std.Target: require libc for Android API levels prior to 29
Emulated TLS depends on libc pthread functions.

Closes #24589.
2025-07-31 17:08:25 +02:00
Alex Rønne Petersen
259b7c3f3f
std.Target: pull Os.requiresLibC() up to Target 2025-07-30 18:58:47 +02:00
Andrew Kelley
0cb558ba3a better default min versions for freebsd and netbsd
Without this change, by default you get a failure when trying to cross
compile for these targets.

freebsd was error: undefined symbol: __libc_start1
netbsd was warning: invalid target NetBSD libc version: 9.4.0
error: unable to build NetBSD libc shared objects: InvalidTargetLibCVersion

now they work by default
2025-07-15 15:32:18 +02:00
Andrew Kelley
7e2a26c0c4 std.io.Writer.printValue: rework logic
Alignment and fill options only apply to numbers.

Rework the implementation to mainly branch on the format string rather
than the type information. This is more straightforward to maintain and
more straightforward for comptime evaluation.

Enums support being printed as decimal, hexadecimal, octal, and binary.

`formatInteger` is another possible format method that is
unconditionally called when the value type is struct and one of the
integer-printing format specifiers are used.
2025-07-07 22:43:53 -07:00
Andrew Kelley
0e37ff0d59 std.fmt: breaking API changes
added adapter to AnyWriter and GenericWriter to help bridge the gap
between old and new API

make std.testing.expectFmt work at compile-time

std.fmt no longer has a dependency on std.unicode. Formatted printing
was never properly unicode-aware. Now it no longer pretends to be.

Breakage/deprecations:
* std.fs.File.reader -> std.fs.File.deprecatedReader
* std.fs.File.writer -> std.fs.File.deprecatedWriter
* std.io.GenericReader -> std.io.Reader
* std.io.GenericWriter -> std.io.Writer
* std.io.AnyReader -> std.io.Reader
* std.io.AnyWriter -> std.io.Writer
* std.fmt.format -> std.fmt.deprecatedFormat
* std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape
* std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape
* std.fmt.fmtSliceHexLower -> {x}
* std.fmt.fmtSliceHexUpper -> {X}
* std.fmt.fmtIntSizeDec -> {B}
* std.fmt.fmtIntSizeBin -> {Bi}
* std.fmt.fmtDuration -> {D}
* std.fmt.fmtDurationSigned -> {D}
* {} -> {f} when there is a format method
* format method signature
  - anytype -> *std.io.Writer
  - inferred error set -> error{WriteFailed}
  - options -> (deleted)
* std.fmt.Formatted
  - now takes context type explicitly
  - no fmt string
2025-07-07 22:43:51 -07:00
Andrew Kelley
aa52bb8327 zig fmt 2025-07-07 13:39:16 -07:00
Ali Cheraghi
1df79ab895 remove spirv cpu arch 2025-06-23 06:03:03 +02:00
Jacob Young
917640810e Target: pass and use locals by pointer instead of by value
This struct is larger than 256 bytes and code that copies it
consistently shows up in profiles of the compiler.
2025-06-19 11:45:06 -04:00
Andrew Kelley
5a52da1b7a CI: skip llvm backend tests in the script for testing x86 backend 2025-06-06 23:42:15 -07:00
Alex Rønne Petersen
9d534790eb std.Target: Introduce Cpu convenience functions for feature tests.
Before:

* std.Target.arm.featureSetHas(target.cpu.features, .has_v7)
* std.Target.x86.featureSetHasAny(target.cpu.features, .{ .sse, .avx, .cmov })
* std.Target.wasm.featureSetHasAll(target.cpu.features, .{ .atomics, .bulk_memory })

After:

* target.cpu.has(.arm, .has_v7)
* target.cpu.hasAny(.x86, &.{ .sse, .avx, .cmov })
* target.cpu.hasAll(.wasm, &.{ .atomics, .bulk_memory })
2025-06-05 06:12:00 +02:00
Jacob Young
ec579aa0f3
Legalize: implement scalarization of @shuffle 2025-06-01 08:24:01 +01:00
Ali Cheraghi
0901328f12 spirv: write error value in an storage buffer 2025-05-21 12:57:40 +03:30
Alex Rønne Petersen
1a82cceb8c
std.Target: Factor arch/ABI into NetBSD minimum OS version selection.
Based on data in std.zig.target.
2025-05-17 04:41:27 +02:00
Alex Rønne Petersen
6028db7f29
std.Target: Add isNetBSDLibC() function. 2025-05-17 04:41:27 +02:00
Alex Rønne Petersen
8a7d925d36
std.Target: Fix requiresLibC() for NetBSD. 2025-05-17 04:41:27 +02:00
Alex Rønne Petersen
3d6f83b331
std.Target: Adjust DynamicLinker.standard() for NetBSD.
* powerpc64 does not appear to be a thing.
* riscv32/riscv64 have not had actual releases yet.
2025-05-17 04:41:27 +02:00
Alex Rønne Petersen
8285de62d5
Merge pull request #23745 from alexrp/target-os-versions
`std.Target`: Update supported OS version ranges
2025-05-12 16:59:46 +02:00
Alex Rønne Petersen
833d4c9ce4
Merge pull request #23835 from alexrp/freebsd-libc
Support dynamically-linked FreeBSD libc when cross-compiling
2025-05-12 01:19:23 +02:00
Alex Rønne Petersen
c3906718b3
Merge pull request #23810 from alexrp/more-test-targets 2025-05-11 20:52:47 +02:00
Alex Rønne Petersen
837e0f9c37 std.Target: Remove ObjectFormat.nvptx (and associated linker code).
Textual PTX is just assembly language like any other. And if we do ever add
support for emitting PTX object files after reverse engineering the bytecode
format, we'd be emitting ELF files like the CUDA toolchain. So there's really no
need for a special ObjectFormat tag here, nor linker code that treats it as a
distinct format.
2025-05-10 12:21:57 +02:00
Alex Rønne Petersen
0e3609b8e0
std.Target: Factor arch/ABI into FreeBSD minimum OS version selection.
Based on data in std.zig.target.
2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
309ff9c34e
std.Target: Add isFreeBSDLibC() function. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
46042170cb
std.Target: Fix requiresLibC() for FreeBSD. 2025-05-10 12:19:26 +02:00