Commit dfd7b7f233

Alex Rønne Petersen <alex@alexrp.com>
2025-11-12 16:04:17
std.Target: remove Abi.cygnus
There is approximately zero chance of the Zig team ever spending any effort on supporting Cygwin; the MSVC and MinGW-w64 ABIs are superior in every way that matters, and not least because they lead to binaries that just run natively on Windows without needing a POSIX emulation environment installed.
1 parent 92bc619
Changed files (7)
lib/compiler/aro/aro/Compilation.zig
@@ -292,16 +292,9 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
                 }
                 try define(w, "__MSVCRT__");
                 try define(w, "__MINGW32__");
-            } else if (comp.target.abi == .cygnus) {
-                try define(w, "__CYGWIN__");
-                if (ptr_width == 64) {
-                    try define(w, "__CYGWIN64__");
-                } else {
-                    try define(w, "__CYGWIN32__");
-                }
             }
 
-            if (comp.target.abi.isGnu() or comp.target.abi == .cygnus) {
+            if (comp.target.abi.isGnu()) {
                 // MinGW and Cygwin define __declspec(a) to __attribute((a)).
                 // Like Clang we make the define no op if -fdeclspec is enabled.
                 if (comp.langopts.declspec_attrs) {
@@ -370,7 +363,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
         .ps4,
         .ps5,
         => try defineStd(w, "unix", is_gnu),
-        .windows => if (comp.target.abi.isGnu() or comp.target.abi == .cygnus) {
+        .windows => if (comp.target.abi.isGnu()) {
             try defineStd(w, "unix", is_gnu);
         },
         else => {},
lib/compiler/aro/aro/target.zig
@@ -375,7 +375,7 @@ pub fn isWindowsMSVCEnvironment(target: std.Target) bool {
 }
 
 pub fn isCygwinMinGW(target: std.Target) bool {
-    return target.os.tag == .windows and (target.abi == .gnu or target.abi == .cygnus);
+    return target.os.tag == .windows and (target.abi == .gnu);
 }
 
 pub fn isPS(target: std.Target) bool {
@@ -727,7 +727,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
         .muslx32 => "muslx32",
         .msvc => "msvc",
         .itanium => "itanium",
-        .cygnus => "cygnus",
         .simulator => "simulator",
         .macabi => "macabi",
         .ohos => "ohos",
lib/std/zig/LibCDirs.zig
@@ -262,7 +262,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
         .androideabi,
         .msvc,
         .itanium,
-        .cygnus,
         .simulator,
         .macabi,
         => unreachable,
lib/std/Target.zig
@@ -758,7 +758,6 @@ pub const Abi = enum {
     muslx32,
     msvc,
     itanium,
-    cygnus,
     simulator,
     macabi,
     ohos,
@@ -3208,7 +3207,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
                 .long, .ulong => return 32,
                 .longlong, .ulonglong, .double => return 64,
                 .longdouble => switch (target.abi) {
-                    .gnu, .ilp32, .cygnus => return 80,
+                    .gnu, .ilp32 => return 80,
                     else => return 64,
                 },
             },
@@ -3216,13 +3215,10 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
                 .char => return 8,
                 .short, .ushort => return 16,
                 .int, .uint, .float => return 32,
-                .long, .ulong => switch (target.abi) {
-                    .cygnus => return 64,
-                    else => return 32,
-                },
+                .long, .ulong => return 32,
                 .longlong, .ulonglong, .double => return 64,
                 .longdouble => switch (target.abi) {
-                    .gnu, .ilp32, .cygnus => return 80,
+                    .gnu, .ilp32 => return 80,
                     else => return 64,
                 },
             },
@@ -3331,7 +3327,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
             .windows, .uefi => switch (c_type) {
                 .longlong, .ulonglong, .double => return 8,
                 .longdouble => switch (target.abi) {
-                    .gnu, .ilp32, .cygnus => return 4,
+                    .gnu, .ilp32 => return 4,
                     else => return 8,
                 },
                 else => {},
@@ -3438,7 +3434,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
         .x86 => switch (target.os.tag) {
             .windows, .uefi => switch (c_type) {
                 .longdouble => switch (target.abi) {
-                    .gnu, .ilp32, .cygnus => return 4,
+                    .gnu, .ilp32 => return 4,
                     else => return 8,
                 },
                 else => {},
src/codegen/llvm.zig
@@ -295,7 +295,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
         .muslx32 => "muslx32",
         .msvc => "msvc",
         .itanium => "itanium",
-        .cygnus => "cygnus",
         .simulator => "simulator",
         .macabi => "macabi",
         .ohos, .ohoseabi => "ohos",
@@ -420,7 +419,6 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
         .sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128",
         .s390x => "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
         .x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) {
-            .cygnus => "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32",
             .gnu => if (target.ofmt == .coff)
                 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"
             else
src/target.zig
@@ -63,7 +63,7 @@ pub fn supports_fpic(target: *const std.Target) bool {
     return switch (target.os.tag) {
         .windows,
         .uefi,
-        => target.abi == .gnu or target.abi == .cygnus,
+        => target.abi == .gnu,
         else => true,
     };
 }
@@ -93,7 +93,6 @@ pub fn useEmulatedTls(target: *const std.Target) bool {
     if (target.abi.isOpenHarmony()) return true;
     return switch (target.os.tag) {
         .openbsd => true,
-        .windows => target.abi == .cygnus,
         else => false,
     };
 }
test/llvm_targets.zig
@@ -299,7 +299,6 @@ const targets = [_]std.Target.Query{
     .{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none },
     .{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none },
     .{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none },
-    .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .cygnus },
     .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .gnu },
     .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .itanium },
     .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc },
@@ -333,7 +332,6 @@ const targets = [_]std.Target.Query{
     .{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none },
     .{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none },
     .{ .cpu_arch = .x86_64, .os_tag = .uefi, .abi = .none },
-    .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .cygnus },
     .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu },
     .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .itanium },
     .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .msvc },