authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-11-12 16:04:17+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-11-12 22:39:04+01:00
logdfd7b7f2337d84ce660253a37079489f7780b055
treef66bd79c031553c05c159f1e0fc3b1d3e21cc821
parent92bc619c49fb4b7281bdc1c3c0bc3e41a9d20d4d

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.

7 files changed, 9 insertions(+), 27 deletions(-)

lib/compiler/aro/aro/Compilation.zig+2-9
......@@ -292,16 +292,9 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
292292 }
293293 try define(w, "__MSVCRT__");
294294 try define(w, "__MINGW32__");
295 } else if (comp.target.abi == .cygnus) {
296 try define(w, "__CYGWIN__");
297 if (ptr_width == 64) {
298 try define(w, "__CYGWIN64__");
299 } else {
300 try define(w, "__CYGWIN32__");
301 }
302295 }
303296
304 if (comp.target.abi.isGnu() or comp.target.abi == .cygnus) {
297 if (comp.target.abi.isGnu()) {
305298 // MinGW and Cygwin define __declspec(a) to __attribute((a)).
306299 // Like Clang we make the define no op if -fdeclspec is enabled.
307300 if (comp.langopts.declspec_attrs) {
......@@ -370,7 +363,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
370363 .ps4,
371364 .ps5,
372365 => try defineStd(w, "unix", is_gnu),
373 .windows => if (comp.target.abi.isGnu() or comp.target.abi == .cygnus) {
366 .windows => if (comp.target.abi.isGnu()) {
374367 try defineStd(w, "unix", is_gnu);
375368 },
376369 else => {},
lib/compiler/aro/aro/target.zig+1-2
......@@ -375,7 +375,7 @@ pub fn isWindowsMSVCEnvironment(target: std.Target) bool {
375375}
376376
377377pub fn isCygwinMinGW(target: std.Target) bool {
378 return target.os.tag == .windows and (target.abi == .gnu or target.abi == .cygnus);
378 return target.os.tag == .windows and (target.abi == .gnu);
379379}
380380
381381pub fn isPS(target: std.Target) bool {
......@@ -727,7 +727,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
727727 .muslx32 => "muslx32",
728728 .msvc => "msvc",
729729 .itanium => "itanium",
730 .cygnus => "cygnus",
731730 .simulator => "simulator",
732731 .macabi => "macabi",
733732 .ohos => "ohos",
lib/std/Target.zig+5-9
......@@ -758,7 +758,6 @@ pub const Abi = enum {
758758 muslx32,
759759 msvc,
760760 itanium,
761 cygnus,
762761 simulator,
763762 macabi,
764763 ohos,
......@@ -3208,7 +3207,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
32083207 .long, .ulong => return 32,
32093208 .longlong, .ulonglong, .double => return 64,
32103209 .longdouble => switch (target.abi) {
3211 .gnu, .ilp32, .cygnus => return 80,
3210 .gnu, .ilp32 => return 80,
32123211 else => return 64,
32133212 },
32143213 },
......@@ -3216,13 +3215,10 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
32163215 .char => return 8,
32173216 .short, .ushort => return 16,
32183217 .int, .uint, .float => return 32,
3219 .long, .ulong => switch (target.abi) {
3220 .cygnus => return 64,
3221 else => return 32,
3222 },
3218 .long, .ulong => return 32,
32233219 .longlong, .ulonglong, .double => return 64,
32243220 .longdouble => switch (target.abi) {
3225 .gnu, .ilp32, .cygnus => return 80,
3221 .gnu, .ilp32 => return 80,
32263222 else => return 64,
32273223 },
32283224 },
......@@ -3331,7 +3327,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
33313327 .windows, .uefi => switch (c_type) {
33323328 .longlong, .ulonglong, .double => return 8,
33333329 .longdouble => switch (target.abi) {
3334 .gnu, .ilp32, .cygnus => return 4,
3330 .gnu, .ilp32 => return 4,
33353331 else => return 8,
33363332 },
33373333 else => {},
......@@ -3438,7 +3434,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
34383434 .x86 => switch (target.os.tag) {
34393435 .windows, .uefi => switch (c_type) {
34403436 .longdouble => switch (target.abi) {
3441 .gnu, .ilp32, .cygnus => return 4,
3437 .gnu, .ilp32 => return 4,
34423438 else => return 8,
34433439 },
34443440 else => {},
lib/std/zig/LibCDirs.zig-1
......@@ -262,7 +262,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
262262 .androideabi,
263263 .msvc,
264264 .itanium,
265 .cygnus,
266265 .simulator,
267266 .macabi,
268267 => unreachable,
src/codegen/llvm.zig-2
......@@ -295,7 +295,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
295295 .muslx32 => "muslx32",
296296 .msvc => "msvc",
297297 .itanium => "itanium",
298 .cygnus => "cygnus",
299298 .simulator => "simulator",
300299 .macabi => "macabi",
301300 .ohos, .ohoseabi => "ohos",
......@@ -420,7 +419,6 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
420419 .sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128",
421420 .s390x => "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
422421 .x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) {
423 .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",
424422 .gnu => if (target.ofmt == .coff)
425423 "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"
426424 else
src/target.zig+1-2
......@@ -63,7 +63,7 @@ pub fn supports_fpic(target: *const std.Target) bool {
6363 return switch (target.os.tag) {
6464 .windows,
6565 .uefi,
66 => target.abi == .gnu or target.abi == .cygnus,
66 => target.abi == .gnu,
6767 else => true,
6868 };
6969}
......@@ -93,7 +93,6 @@ pub fn useEmulatedTls(target: *const std.Target) bool {
9393 if (target.abi.isOpenHarmony()) return true;
9494 return switch (target.os.tag) {
9595 .openbsd => true,
96 .windows => target.abi == .cygnus,
9796 else => false,
9897 };
9998}
test/llvm_targets.zig-2
......@@ -299,7 +299,6 @@ const targets = [_]std.Target.Query{
299299 .{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none },
300300 .{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none },
301301 .{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none },
302 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .cygnus },
303302 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .gnu },
304303 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .itanium },
305304 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc },
......@@ -333,7 +332,6 @@ const targets = [_]std.Target.Query{
333332 .{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none },
334333 .{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none },
335334 .{ .cpu_arch = .x86_64, .os_tag = .uefi, .abi = .none },
336 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .cygnus },
337335 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu },
338336 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .itanium },
339337 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .msvc },