Commit Graph

31785 Commits

Author SHA1 Message Date
Alex Rønne Petersen
2f003f39b2
Merge pull request #21599 from alexrp/thumb-porting 2024-11-03 14:25:30 +01:00
Alex Rønne Petersen
947b7195bf llvm: Update the list of address spaces for LLVM 19.
Mainly affects amdgcn.
2024-11-03 13:44:38 +01:00
Alex Rønne Petersen
621487d5ab
test: Add thumb-linux-(musl)eabi(hf) target triples for module tests. 2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
d89cf3e7d8
test: Add the ability to skip specific modules for a target. 2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
3a2647b7d3
glibc: Don't build CRT objects that won't be used. 2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
4c70aea460
Compilation: Use the regular module mechanism for setting PIC on CRT objects.
addCCArgs() will then pass the appropriate flag to Clang.
2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
39abcc303c
Compilation: Pass -fno-PIC to clang if PIC is disabled.
Let's not implicitly rely on whatever Clang's default is.
2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
c9e67e71c1
std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().
The old isARM() function was a portability trap. With the name it had, it seemed
like the obviously correct function to use, but it didn't include Thumb. In the
vast majority of cases where someone wants to ask "is the target Arm?", Thumb
*should* be included.

There are exactly 3 cases in the codebase where we do actually need to exclude
Thumb, although one of those is in Aro and mirrors a check in Clang that is
itself likely a bug. These rare cases can just add an extra isThumb() check.
2024-11-03 09:29:30 +01:00
Alex Rønne Petersen
53d7a7b3c0
Merge pull request #21717 from alexrp/ilp32-abis
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
Some initial work on x32 and n32 ABI support
2024-11-03 07:13:56 +01:00
Alex Rønne Petersen
4e843b4e2b
llvm: Remove extraneous commas for branch hint metadata in textual IR output. 2024-11-02 11:06:33 +01:00
Alex Rønne Petersen
e4e3d7ab41
Sema: Disallow calling functions with certain special calling conventions. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
f508e22705
link.Dwarf: Some minor corrections to calling conventions to ~match Clang.
This can't be completely 1:1 due to the fact that we model CCs more precisely,
but this is about as close as we can get.
2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
c217fd2b9c
cbe: Support some more calling conventions. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
3a5142af8d
compiler: Handle arm_aapcs16_vfp alongside arm_aapcs_vfp in some places. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
be8a527eb2
std.os.windows: Deprecate WINAPI in favor of CallingConvention.winapi. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
5a6cc552e3
std.os.windows: Fix some incorrect callconv specifiers.
Closes #21869.
2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
82e82b6267
start: Fix callconv for the wWinMainCRTStartup symbol.
This just uses the C calling convention in the vcruntime sources.
2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
8a2d960627
start: Fix a calling convention check to use eql().
Also modernize some callconv uses.

Closes #21813.
2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
baf60426d4
std.Target: Rename amdgpu module to amdgcn.
This was an inconsistency left over from c825b567b2.
2024-11-02 10:44:14 +01:00
Alex Rønne Petersen
a5bc9cbb15
llvm: Fix lowering of gnuilp32 ABI to be gnu_ilp32.
LLVM doesn't even recognize the gnuilp32 spelling as an alternative.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
d61e4ef8b0
generate_linux_syscalls: Generate syscalls for x32.
Also update the syscalls file based on Linux 6.10. No diffs other than x32.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
43878f51d9
glibc: Emit _IO_stdin_used reference in .rodata.
This fixes an X86_64_32 relocation linker error when targeting gnux32.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
50cae505f7
glibc: Fix an LP_SIZE redefinition warning for gnux32. 2024-11-02 10:42:53 +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
8baf887f4e
std.zig.target: Add mips64(el)-linux-muslabin32 and x86_64-linux-muslx32. 2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
ec0e6440b1
musl: Update sources from musl 1.2.5.
Adds mipsn32 and x32 sources.

Also remove some useless .in files.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
3ec27ae648
musl: Update headers from musl 1.2.5.
Adds mips64-linux-muslabin32 and x86_64-linux-muslx32 headers.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
94cf5b26f4
process_headers: Add muslabin32 and muslx32 support. 2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
497b502ce4
process_headers: Simplify the code a bit. 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
8045268698
std.zig.target: Update musl path helpers to support alternative ABIs.
This is needed for muslx32 and muslabin32 support.
2024-11-02 10:38:06 +01:00
Alex Rønne Petersen
533d8ea771
musl: Fix needsCrtiCrtn() for m68k. 2024-11-02 10:38:06 +01:00
Alex Rønne Petersen
243c25007f
musl: Update the list of architectures with time32 compat helpers. 2024-11-02 10:38:06 +01:00
Alex Rønne Petersen
20cdfe9fb6
std.Target: Pick arm_aapcs16_vfp for arm-watchos-* in cCallingConvention().
This is a legacy target, but we should still get it right.
2024-11-02 10:30:48 +01:00
Alex Rønne Petersen
f7da31b1f4
std.builtin: Some minor fixes to CallingConvention doc comments. 2024-11-02 10:30:48 +01:00
Alex Rønne Petersen
e27b4647d8
Merge pull request #21617 from alexrp/target-dyld-stuff
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
Improve the `DynamicLinker` API and fix `detectAbiAndDynamicLinker()` for non-Linux/Hurd ELF hosts
2024-11-02 10:29:41 +01:00
Alex Rønne Petersen
8abbdb56a4
Merge pull request #21729 from alexrp/target-cpu-baseline
`std.Target.Cpu.Model`: Further refinements to `generic()` and `baseline()`
2024-11-02 10:27:03 +01:00
Alex Rønne Petersen
fccf15fc9f std.Target: Remove armv7k/armv7s.
Like d1d95294fd, this is more Apple nonsense where
they abused the arch component of the triple to encode what's really an ABI.

Handling this correctly in Zig's target triple model would take quite a bit of
work. Fortunately, the last Armv7-based Apple Watch was released in 2017 and
these targets are now considered legacy. By the time Zig hits 1.0, they will be
a distant memory. So just remove them.
2024-11-02 10:25:40 +01:00
Alex Rønne Petersen
ab89af3d39
Merge pull request #21860 from alexrp/llvm-triple-stuff
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
More support for OS/libc version ranges in `std.Target` and improvements to LLVM target triple construction
2024-11-02 02:00:25 +01:00
Andrew Kelley
aaf54ce6a7 link.File.Wasm.Archive: simplify
Don't use the reader interface
Avoid unnecessary heap allocations

At first I started working on incorporating the Archive fields into the
Wasm data model, however, I realized a better strategy: simply omit
Archive data from the serialized linker state. Those files can be
trivially reparsed on next compiler process start. If they haven't
changed, great. Otherwise if they have, the prelink phase needs to be
restarted anyway.
2024-11-01 14:41:56 -07:00
Andrew Kelley
d30e287543
Merge pull request #21874 from ziglang/wasm-linker
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
link.File.Wasm: unify the string tables
2024-11-01 02:16:36 -07:00
Brook Jeynes
a99449d8be
std.c: Added utsname struct definition for .macos (#21873) 2024-11-01 07:57:00 +00:00
Alex Rønne Petersen
3c1ccbdf39
std.Target: Add support for specifying Android API level. 2024-11-01 06:23:59 +01:00
Alex Rønne Petersen
c5395f7cd9
llvm: Set OS min version and libc version in ~all cases.
Except Windows, because that just doesn't really fit into LLVM's target triple
format currently.
2024-11-01 06:23:59 +01:00
Alex Rønne Petersen
60c0f522d9
llvm: Set vendor type in LLVM target triple for more OSs.
Annoyingly, LLVM and Clang have various checks throughout that depend on these
vendor types being set.
2024-11-01 06:23:59 +01:00
Alex Rønne Petersen
f89982bf53
std.Target: Add semver min/max versions for a bunch of OSs. 2024-11-01 06:23:59 +01:00
Alex Rønne Petersen
ed68083d8f
std.Target: Update known OS max versions. 2024-11-01 06:23:59 +01:00
Alex Rønne Petersen
ace26004a3
std.Target: Remove arch-specific handling for macos in Os.VersionRange.default().
The minimum is now the same for both aarch64 and x86_64.
2024-11-01 06:23:59 +01:00
Alex Rønne Petersen
af48ce6379
std.Target: Sort some OS switches according to the Os enum. 2024-11-01 06:23:59 +01:00
Andrew Kelley
e501cf51a0 link.File.Wasm: unify the string tables
Before, the wasm struct had a string table, the ZigObject had a string
table, and each Object had a string table.

Now there is just the one. This makes for more efficient use of memory
and simplifies logic, particularly with regards to linker state
serialization.

This commit additionally adds significantly more integer type safety.
2024-10-31 22:01:10 -07:00