Commit graph

46 commits

Author SHA1 Message Date
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
fca2a7a638 test(llvm_targets): remove unused thumb-3ds 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
c5a68e4168
test: Remove x86-freebsd-none and powerpc-freebsd-eabihf from llvm_targets.
These will be dropped in FreeBSD 15.0, so there's no point in us spending
resources these now.
2025-05-29 16:48:28 +02:00
Alex Rønne Petersen
d47cc5777d
test: Remove some nonsensical NetBSD targets from llvm_targets.
* mips64/mips64el on NetBSD are soft float; we have no support for this yet.
* powerpc64 does not appear to be a thing.
* riscv32/riscv64 have not seen official releases yet.
2025-05-17 04:41:26 +02:00
Alex Rønne Petersen
6282129218
test: Add {powerpc64,riscv32}-netbsd-none to llvm_targets. 2025-05-11 11:15:23 +02:00
Alex Rønne Petersen
ba9f2571b7
test: Remove some nonsensical FreeBSD targets from llvm_targets. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
fc55c1b7a1
Merge pull request #23698 from alexrp/goff-xcoff-stubs
`link`: Stub out GOFF/XCOFF linker code based on LLVM
2025-04-28 07:50:37 +02:00
Alex Rønne Petersen
78df3c9301
Merge pull request #23663 from alexrp/emit-asm-only 2025-04-28 02:18:45 +02:00
Alex Rønne Petersen
e7b46363ae std.Target: Remove Os.Tag.elfiamcu.
The last Intel Quark MCU was released in 2015. Quark was announced to be EOL in
2019, and stopped shipping entirely in 2022.

The OS tag was only meaningful for Intel's weird fork of Linux 3.8.7 with a
special ABI that differs from the regular i386 System V ABI; beyond that, the
CPU itself is just a plain old P54C (i586). We of course keep support for the
CPU itself, just not Intel's Linux fork.
2025-04-28 00:24:09 +02:00
Alex Rønne Petersen
711e055f18
test: Uncomment a bunch of targets in llvm_targets. 2025-04-27 14:09:32 +02:00
Alex Rønne Petersen
2d44bc5d2b
test: Add powerpc(64)-aix to llvm_targets. 2025-04-27 03:54:32 +02:00
Alex Rønne Petersen
b59f7f0726
test: Remove sparc(64)-illumos from llvm_targets.
Illumos dropped support for SPARC many years ago.
2025-04-27 02:53:46 +02:00
Alex Rønne Petersen
962b491745
test: Remove sparc-solaris and x86-solaris from llvm_targets.
These are no longer supported.
2025-04-27 02:53:45 +02:00
Alex Rønne Petersen
d9122e9f15
test: Remove some thumb(eb)-*-* targets from llvm_targets.
There is no evidence that these operating systems support pure Thumb, not even
just in userland.
2025-04-27 02:53:33 +02:00
Alex Rønne Petersen
c974590525
test: Remove mips(64)(el)-freebsd targets from llvm_targets.
These were dropped in FreeBSD 14 and we're not going to add e.g. libc support
for them anyway, so they're effectively dead to us.
2025-04-27 01:13:50 +02:00
Alex Rønne Petersen
b22d53a5e7
test: Remove some dead FreeBSD targets from llvm_targets.
These were dropped in FreeBSD 12.x, and we now require 13.4+.
2025-04-06 08:05:07 +02:00
Alex Rønne Petersen
8954e9748a
std.Target: Add Abi.muslf32 and Abi.muslsf. 2025-04-04 06:08:09 +02:00
Alex Rønne Petersen
09b39f77b7
std.Target: Remove Os.Tag.bridgeos.
It doesn't appear that targeting bridgeOS is meaningfully supported by Apple.
Even LLVM/Clang appear to have incomplete support for it, suggesting that Apple
never bothered to upstream that support. So there's really no sense in us
pretending to support this.
2024-12-03 20:43:15 +01:00
Alex Rønne Petersen
78b8ce5095
test: Change llvm_targets to actually emit an object for each target.
Without doing this, we don't actually test whether the data layout string we
generate matches LLVM's.

A number of targets had to be commented out due to this change:

* Some are using a non-working experimental LLVM backend (arc, csky, ...).
* Some don't have working LLD support (lanai, sparc, ...).
* Some don't have working self-hosted linker support (nvptx).
* Some are using ABIs that haven't been standardized (loongarch32).

Finally, all non-x86 uefi targets are hopelessly broken and can't really be
fixed until we change our emit logic to lower *-uefi-* verbatim rather than to
*-windows-*. See: https://github.com/ziglang/zig/issues/21630
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
0bf054f4c5
test: Remove aarch64(_be)-linux-gnuilp32 from llvm_targets.
LLVM doesn't handle this target correctly (pointer size, etc).
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
abf3032ff1
test: Add m68k-linux-musl to llvm_targets. 2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
322013c648
test: Add aarch64(_be)-linux-musl to llvm_targets. 2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
11d51ea5a2
test: Remove aarch64-rtems-ilp32 from llvm_targets.
LLVM can't represent this target at the moment.
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
4369d3b93d
test: Add *-windows-cygnus triples to llvm_targets. 2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
b72b81292f
test: Remove some unsupported ohos triples from llvm_targets. 2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
11915ae48e
std.zig.target: Change mips64(el)-linux-musl triples to -muslabi64.
With this, MIPS triples for musl are in line with glibc triples.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
270fbbcd86
std.Target: Add muslabin32 and muslabi64 tags to Abi.
Once we upgrade to LLVM 20, these should be lowered verbatim rather than to
simply musl. Similarly, the special case in llvmMachineAbi() should go away.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
bf31c9505c
test: Add some missing android, haiku, illumos, solaris triples to llvm_targets. 2024-10-26 22:00:49 +02:00
Alex Rønne Petersen
f5beb50619
test: Remove some loongarch32 triples that were erroneously added to llvm_targets.
glibc and musl do not support loongarch32 yet.
2024-10-16 01:10:35 +02:00
Alex Rønne Petersen
b6b86cb878
test: Fix powerpc-aix-eabihf target triple in llvm_targets. 2024-10-06 22:41:53 +02:00
Alex Rønne Petersen
1992428044
test: Add some missing x86_64-linux-* triples to llvm_targets. 2024-10-06 10:26:00 +02:00
Alex Rønne Petersen
5e9764c512
test: Add android/androideabi triples to llvm_targets. 2024-10-06 10:24:35 +02:00
Alex Rønne Petersen
e3e60491ba
test: Add ohos/ohoseabi triples to llvm_targets. 2024-10-06 10:22:39 +02:00
Alex Rønne Petersen
530edea1ca
test: Rewrite the target triple list for llvm_targets.
This removes some triples that didn't really make sense (e.g. msp430-linux) and
adds more exhaustive coverage of supported triples.
2024-10-03 05:01:24 +02:00
Alex Rønne Petersen
eb4539a27d
std.Target: Rename glsl450 Arch tag to opengl.
Versions can simply use the normal version range mechanism, or alternatively an
Abi tag if that makes more sense. For now, we only care about 4.5 anyway.
2024-08-12 08:59:47 +02:00
Alex Rønne Petersen
c8ca05e93a
std.Target: Remove sparcel architecture tag.
What is `sparcel`, you might ask? Good question!

If you take a peek in the SPARC v8 manual, §2.2, it is quite explicit that SPARC
v8 is a big-endian architecture. No little-endian or mixed-endian support to be
found here.

On the other hand, the SPARC v9 manual, in §3.2.1.2, states that it has support
for mixed-endian operation, with big-endian mode being the default.

Ok, so `sparcel` must just be referring to SPARC v9 running in little-endian
mode, surely?

Nope:

* 40b4fd7a3e/llvm/lib/Target/Sparc/SparcTargetMachine.cpp (L226)
* 40b4fd7a3e/llvm/lib/Target/Sparc/SparcTargetMachine.cpp (L104)

So, `sparcel` in LLVM is referring to some sort of fantastical little-endian
SPARC v8 architecture. I've scoured the internet and I can find absolutely no
evidence that such a thing exists or has ever existed. In fact, I can find no
evidence that a little-endian implementation of SPARC v9 ever existed, either.
Or any SPARC version, actually!

The support was added here: https://reviews.llvm.org/D8741

Notably, there is no mention whatsoever of what CPU this might be referring to,
and no justification given for the "but some are little" comment added in the
patch.

My best guess is that this might have been some private exercise in creating a
little-endian version of SPARC that never saw the light of day. Given that SPARC
v8 explicitly doesn't support little-endian operation (let alone little-endian
instruction encoding!), and no CPU is known to be implemented as such, I think
it's very reasonable for us to just remove this support.
2024-07-30 06:30:25 +02:00
Alex Rønne Petersen
d1d95294fd std.Target.Cpu.Arch: Remove the aarch64_32 tag.
This is a misfeature that we inherited from LLVM:

* https://reviews.llvm.org/D61259
* https://reviews.llvm.org/D61939

(`aarch64_32` and `arm64_32` are equivalent.)

I truly have no idea why this triple passed review in LLVM. It is, to date, the
*only* tag in the architecture component that is not, in fact, an architecture.
In reality, it is just an ILP32 ABI for AArch64 (*not* AArch32).

The triples that use `aarch64_32` look like `aarch64_32-apple-watchos`. Yes,
that triple is exactly what you think; it has no ABI component. They really,
seriously did this.

Since only Apple could come up with silliness like this, it should come as no
surprise that no one else uses `aarch64_32`. Later on, a GNU ILP32 ABI for
AArch64 was developed, and support was added to LLVM:

* https://reviews.llvm.org/D94143
* https://reviews.llvm.org/D104931

Here, sanity seems to have prevailed, and a triple using this ABI looks like
`aarch64-linux-gnu_ilp32` as you would expect.

As can be seen from the diffs in this commit, there was plenty of confusion
throughout the Zig codebase about what exactly `aarch64_32` was. So let's just
remove it. In its place, we'll use `aarch64-watchos-ilp32`,
`aarch64-linux-gnuilp32`, and so on. We'll then translate these appropriately
when talking to LLVM. Hence, this commit adds the `ilp32` ABI tag (we already
have `gnuilp32`).
2024-07-28 19:44:52 -07:00
Alex Rønne Petersen
c825b567b2
std.Target: Remove the r600 arch tag.
These are quite old GPUs, and it is unlikely that Zig will ever be able to
target them.

See: https://en.wikipedia.org/wiki/Radeon_HD_2000_series
2024-07-21 22:38:30 +02:00
Jakub Konka
47e840a9b9 test/llvm_targets: add watchos, tvos and visionos to test matrix 2024-05-09 22:19:45 +02:00
Andrew Kelley
3179f58c41 rename std.zig.CrossTarget to std.Target.Query 2024-01-01 17:51:18 -07:00
Andrew Kelley
142471fcc4 zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.

The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.

* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
  std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
  std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
  `std.Build.Module.addCMacro` is provided.
  - remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
  - use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
  - use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
  Along with other fields, those unspecified options will be inherited
  from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
  to get the host target.
2024-01-01 17:51:18 -07:00
Jacob Young
9e0a34f329 llvm: fix data layout calculation for experimental llvm targets
Closes #16616
2023-08-01 19:20:22 -07:00
Jacob Young
f9717f87f5 llvm: fix data layout on ios
Closes #16549
2023-07-26 16:49:32 -07:00
Jacob Young
c610cde1eb test: test for issues starting codegen on many targets
Specifically this is to make sure llvm data layout generation doesn't
regress.  The no emit bin is to allow testing targets that can't
currently be linked.  The commented out targets are ones that fail in
the linker anyway when no emit bin is passed.
2023-07-23 23:48:19 -04:00