aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-10-16 04:36:40 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-11-02 10:42:53 +0100
commit270fbbcd86b02fcd02ad9b818d9de39dfe671754 (patch)
treec81290bd31fdbfed3ba1a1d34394e271f30b80f2 /src/target.zig
parent8045268698bb46e954c886b913fe216c59f5824e (diff)
downloadzig-270fbbcd86b02fcd02ad9b818d9de39dfe671754.tar.gz
zig-270fbbcd86b02fcd02ad9b818d9de39dfe671754.zip
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.
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig
index e4f1d28043..2327ff0c4a 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -438,6 +438,16 @@ pub fn arePointersLogical(target: std.Target, as: AddressSpace) bool {
}
pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {
+ // This special-casing should be removed with LLVM 20.
+ switch (target.cpu.arch) {
+ .mips, .mipsel => return "o32",
+ .mips64, .mips64el => return switch (target.abi) {
+ .gnuabin32, .muslabin32 => "n32",
+ else => "n64",
+ },
+ else => {},
+ }
+
// LLD does not support ELFv1. Rather than having LLVM produce ELFv1 code and then linking it
// into a broken ELFv2 binary, just force LLVM to use ELFv2 as well. This will break when glibc
// is linked as glibc only supports ELFv2 for little endian, but there's nothing we can do about