Commit Graph

29194 Commits

Author SHA1 Message Date
Jakub Konka
2e1fc0dd14 handle visionos target OS tag in the compiler
* rename .xros to .visionos as agreed in the tracking issue
* add support for VisionOS platform in the MachO linker
2024-05-09 15:04:15 +02:00
Jakub Konka
8f202ba7c7 link/macho: add support for VisionOS 2024-05-09 14:09:31 +02:00
Andrew Kelley
bcb534c295 Merge branch 'llvm18'
Upgrades the LLVM, Clang, and LLD dependencies to LLVM 18.x

Related to #16270
2024-05-09 01:52:26 -07:00
Andrew Kelley
74f52954b9 update tarballs to 0.13.0-dev.130+98a30acad 2024-05-08 23:17:08 -07:00
Andrew Kelley
98a30acad6 libcxxabi patch: respect NDEBUG
zig patch: respect NDEBUG. Otherwise the file path makes it into the
binary, causing non-reproducible builds.
2024-05-08 19:37:30 -07:00
Andrew Kelley
cd1ddca698 CI: update x86_64-macos tarball
This one contains a patch to fix an LLVM 18 regression that has been
merged upstream already.
2024-05-08 19:37:30 -07:00
Andrew Kelley
e89d6fc503 fix wrong int alignment for i65..i127 on x86 arch 2024-05-08 19:37:30 -07:00
Andrew Kelley
107d4f6683 disable x86_64-macos -OReleaseSmall tests
tracked by #19851
2024-05-08 19:37:30 -07:00
Andrew Kelley
126c9a34af restructure unit test to be easier to debug 2024-05-08 19:37:29 -07:00
Jacob Young
08cecc1c7e x86_64: fix C abi of incomplete sse register 2024-05-08 19:37:29 -07:00
Andrew Kelley
e9efed9ed1 LLVM: zeroext/signext does happen on macos
Fixes a regression introduced in 3ce7fee9dd8bbb6f56e47758a9a8ada028400c71.
2024-05-08 19:37:29 -07:00
Andrew Kelley
7e1cba73fc Type.intAbiAlignment: update for LLVM 18 changes
This function is intended to match what the backend desires.
No kink shaming.
2024-05-08 19:37:29 -07:00
Andrew Kelley
88ada2121f LLVM: fix x86 and x86_64 datalayout string calculation
now it matches clang again
2024-05-08 19:37:29 -07:00
Andrew Kelley
708894cf99 add a debug subcommand for printing LLVM integer type alignment
Useful when debugging why upgrading from LLVM 17 to 18 caused C ABI
regressions. Turns out LLVM 18 does the following insane thing:

```diff
-[nix-shell:~/dev/zig/build-llvm17]$ stage4/bin/zig llvm-ints i386-linux-musl
+[nix-shell:~/src/zig/build-llvm18]$ stage4/bin/zig llvm-ints i386-linux-musl
 LLVMABIAlignmentOfType(i1) == 1
 LLVMABIAlignmentOfType(i8) == 1
 LLVMABIAlignmentOfType(i16) == 2
 LLVMABIAlignmentOfType(i32) == 4
 LLVMABIAlignmentOfType(i64) == 4
-LLVMABIAlignmentOfType(i128) == 4
-LLVMABIAlignmentOfType(i256) == 4
+LLVMABIAlignmentOfType(i128) == 16
+LLVMABIAlignmentOfType(i256) == 16
```
2024-05-08 19:37:29 -07:00
Andrew Kelley
6730b366a0 LLVM backend: no more signext on aarch64
Clang doesn't do it, so Zig must not do it in order to match the C ABI.
2024-05-08 19:37:29 -07:00
Andrew Kelley
6986d2aca9 x86_64 sysv C ABI: fix f128 param and return types
Clang 17 passed struct{f128} parameters using rdi and rax, while Clang
18 matches GCC 13.2 behavior, passing them using xmm0.

This commit makes Zig's LLVM backend match Clang 18 and GCC 13.2. The
commit deletes a hack in x86_64/abi.zig which miscategorized f128 as
"memory" which obviously disagreed with the spec.
2024-05-08 19:37:29 -07:00
Evan Haas
bc69cb9b10 translate-c: update UnaryExprOrTypeTrait enum for LLVM 18 2024-05-08 19:37:29 -07:00
Andrew Kelley
badc28c06e disable regressed test from LLVM 18 upgrade
tracked by #19825
2024-05-08 19:37:29 -07:00
Andrew Kelley
200e06b239 update maxIntAlignment for x86 to 16
LLVMABIAlignmentOfType(i128) reports 16 on this target, however the C
ABI uses align(4).

Clang in LLVM 17 does this:

%struct.foo = type { i32, i128 }

Clang in LLVM 18 does this:

%struct.foo = type <{ i32, i128 }>

Clang is working around the 16-byte alignment to use align(4) for the C
ABI by making the LLVM struct packed.
2024-05-08 19:37:29 -07:00
Andrew Kelley
927f24a6ff disable regressed test from LLVM 18 upgrade
tracked by #19824
2024-05-08 19:37:29 -07:00
Andrew Kelley
0b31e2ab27 std.Target: add spirv to toCoffTarget 2024-05-08 19:37:29 -07:00
Andrew Kelley
7663da238e link.Wasm: add missing CPU feature 2024-05-08 19:37:29 -07:00
Andrew Kelley
5f0a2f2a0c refresh cmake list of compiler source files 2024-05-08 19:37:29 -07:00
Andrew Kelley
80f38c0cbb update zig1.wasm
In particular, contains fixes to the C backend that avoid tripping UBSAN
in clang 18.
2024-05-08 19:37:29 -07:00
Andrew Kelley
6c403e8aca CI: revert the changes to aarch64-windows script 2024-05-08 19:37:29 -07:00
Andrew Kelley
b7799ef322 std.Target.maxIntAlignment: move to compiler implementation
This should not be a public API, and the x86 backend does not support
the value 16.
2024-05-08 19:37:29 -07:00
Andrew Kelley
62381011e0 apparently LLVM depends on ws2_32.dll now 2024-05-08 19:37:29 -07:00
Andrew Kelley
c71943f125 CI: fix windows paths for fetching tarball 2024-05-08 19:37:29 -07:00
Andrew Kelley
bffc4ebd78 CI: fix tarball prefix path to be shared across all users 2024-05-08 19:37:29 -07:00
Andrew Kelley
2c317b2cba libcxx, libtsan, libunwind: fix error reporting
use a consistent error set to avoid failure when bootstrapping from zig1
2024-05-08 19:37:29 -07:00
Andrew Kelley
b018f2bae1 CI: download tarball if not already present on macos runners 2024-05-08 19:37:29 -07:00
Andrew Kelley
e07ad33f1d update CI tarballs for LLVM 18
Also makes the windows CI scripts fetch the tarballs from the network if
not already on disk.
2024-05-08 19:37:29 -07:00
Andrew Kelley
f6f0fefd8b libc++: patch tz impl to crash on windows instead of FTBFS 2024-05-08 19:37:29 -07:00
Andrew Kelley
fb948fbacc zig cc: -Wno-overriding-t-option was renamed
in LLVM commit 1c66d08b0137cef7761b8220d3b7cb7833f57cdb
2024-05-08 19:37:29 -07:00
Andrew Kelley
27a9240ccb suppress C++ type-limits warnings
Zig has no more C++ code; these warnings are being tripped by the Clang
code copy-pasted into Zig. No sense in detecting them.
2024-05-08 19:37:29 -07:00
Andrew Kelley
72d6f79454 add M68kRTD to clang calling conventions 2024-05-08 19:37:29 -07:00
Andrew Kelley
3c21db6392 update detectAMDProcessor to detect znver4 2024-05-08 19:37:29 -07:00
Andrew Kelley
78002dbe47 add detect-cpu subcommand for debugging CPU features
This brings back `detectNativeCpuWithLLVM` so that we can troubleshoot
during LLVM upgrades.

closes #19793
2024-05-08 19:37:29 -07:00
Andrew Kelley
06ee65af9e libcxx: update to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42

This adds the flag `-D_LIBCPP_HARDENING_MODE` which is determined based
on the Zig optimization mode.

This commit also fixes libunwind, libcxx, and libcxxabi to properly
report sub compilation errors.
2024-05-08 19:37:29 -07:00
Andrew Kelley
bc6ebc6f25 libcxxabi: update to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42
2024-05-08 19:37:29 -07:00
Andrew Kelley
6295415da7 libunwind: update to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42
2024-05-08 19:37:29 -07:00
Andrew Kelley
a6856ef6d2 LLVM 18 uses 16 byte alignment for x86_64 i128 2024-05-08 19:37:28 -07:00
Andrew Kelley
65bea9ac07 LLVM 18 update: avoid passing vectors sometimes
LLVM now refuses to lower arguments and return values on x86 targets
when the total vector bit size is >= 512.

This code detects such a situation and uses byref instead of byval.
2024-05-08 19:37:28 -07:00
Andrew Kelley
21f1e76efe zig cc: update clang CLI data to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42
2024-05-08 19:37:28 -07:00
Andrew Kelley
376387c390 add missing clang static library to the build 2024-05-08 19:37:28 -07:00
Andrew Kelley
d34fae26d5 LLVM 18 std lib updates and fixes
* some manual fixes to generated CPU features code. In the future it
  would be nice to make the script do those automatically.

* add to various target OS switches. Some of the values I was unsure of
  and added TODO panics, for example in the case of spirv CPU arch.
2024-05-08 19:37:28 -07:00
Andrew Kelley
109ec72924 update CPU features to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42
2024-05-08 19:37:28 -07:00
Andrew Kelley
6a018d3e65 update zig_clang C++ API wrapper bindings to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42
2024-05-08 19:37:28 -07:00
Andrew Kelley
243ae3a6cb update for LLVM 18 new target data
New OSs:
* XROS
* Serenity
* Vulkan

Removed OSs:
* Ananas
* CloudABI
* Minix
* Contiki

New CPUs:
* spirv

The removed stuff is removed from LLVM but not Zig.
2024-05-08 19:37:28 -07:00
Andrew Kelley
70c85b1bf1 update C language headers to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42
2024-05-08 19:37:28 -07:00