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 {...@@ -292,16 +292,9 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
292 }292 }
293 try define(w, "__MSVCRT__");293 try define(w, "__MSVCRT__");
294 try define(w, "__MINGW32__");294 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 }
302 }295 }
303296
304 if (comp.target.abi.isGnu() or comp.target.abi == .cygnus) {297 if (comp.target.abi.isGnu()) {
305 // MinGW and Cygwin define __declspec(a) to __attribute((a)).298 // MinGW and Cygwin define __declspec(a) to __attribute((a)).
306 // Like Clang we make the define no op if -fdeclspec is enabled.299 // Like Clang we make the define no op if -fdeclspec is enabled.
307 if (comp.langopts.declspec_attrs) {300 if (comp.langopts.declspec_attrs) {
...@@ -370,7 +363,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {...@@ -370,7 +363,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
370 .ps4,363 .ps4,
371 .ps5,364 .ps5,
372 => try defineStd(w, "unix", is_gnu),365 => 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()) {
374 try defineStd(w, "unix", is_gnu);367 try defineStd(w, "unix", is_gnu);
375 },368 },
376 else => {},369 else => {},
lib/compiler/aro/aro/target.zig+1-2
...@@ -375,7 +375,7 @@ pub fn isWindowsMSVCEnvironment(target: std.Target) bool {...@@ -375,7 +375,7 @@ pub fn isWindowsMSVCEnvironment(target: std.Target) bool {
375}375}
376376
377pub fn isCygwinMinGW(target: std.Target) bool {377pub 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);
379}379}
380380
381pub fn isPS(target: std.Target) bool {381pub fn isPS(target: std.Target) bool {
...@@ -727,7 +727,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {...@@ -727,7 +727,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
727 .muslx32 => "muslx32",727 .muslx32 => "muslx32",
728 .msvc => "msvc",728 .msvc => "msvc",
729 .itanium => "itanium",729 .itanium => "itanium",
730 .cygnus => "cygnus",
731 .simulator => "simulator",730 .simulator => "simulator",
732 .macabi => "macabi",731 .macabi => "macabi",
733 .ohos => "ohos",732 .ohos => "ohos",
lib/std/Target.zig+5-9
...@@ -758,7 +758,6 @@ pub const Abi = enum {...@@ -758,7 +758,6 @@ pub const Abi = enum {
758 muslx32,758 muslx32,
759 msvc,759 msvc,
760 itanium,760 itanium,
761 cygnus,
762 simulator,761 simulator,
763 macabi,762 macabi,
764 ohos,763 ohos,
...@@ -3208,7 +3207,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {...@@ -3208,7 +3207,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
3208 .long, .ulong => return 32,3207 .long, .ulong => return 32,
3209 .longlong, .ulonglong, .double => return 64,3208 .longlong, .ulonglong, .double => return 64,
3210 .longdouble => switch (target.abi) {3209 .longdouble => switch (target.abi) {
3211 .gnu, .ilp32, .cygnus => return 80,3210 .gnu, .ilp32 => return 80,
3212 else => return 64,3211 else => return 64,
3213 },3212 },
3214 },3213 },
...@@ -3216,13 +3215,10 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {...@@ -3216,13 +3215,10 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
3216 .char => return 8,3215 .char => return 8,
3217 .short, .ushort => return 16,3216 .short, .ushort => return 16,
3218 .int, .uint, .float => return 32,3217 .int, .uint, .float => return 32,
3219 .long, .ulong => switch (target.abi) {3218 .long, .ulong => return 32,
3220 .cygnus => return 64,
3221 else => return 32,
3222 },
3223 .longlong, .ulonglong, .double => return 64,3219 .longlong, .ulonglong, .double => return 64,
3224 .longdouble => switch (target.abi) {3220 .longdouble => switch (target.abi) {
3225 .gnu, .ilp32, .cygnus => return 80,3221 .gnu, .ilp32 => return 80,
3226 else => return 64,3222 else => return 64,
3227 },3223 },
3228 },3224 },
...@@ -3331,7 +3327,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {...@@ -3331,7 +3327,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
3331 .windows, .uefi => switch (c_type) {3327 .windows, .uefi => switch (c_type) {
3332 .longlong, .ulonglong, .double => return 8,3328 .longlong, .ulonglong, .double => return 8,
3333 .longdouble => switch (target.abi) {3329 .longdouble => switch (target.abi) {
3334 .gnu, .ilp32, .cygnus => return 4,3330 .gnu, .ilp32 => return 4,
3335 else => return 8,3331 else => return 8,
3336 },3332 },
3337 else => {},3333 else => {},
...@@ -3438,7 +3434,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {...@@ -3438,7 +3434,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
3438 .x86 => switch (target.os.tag) {3434 .x86 => switch (target.os.tag) {
3439 .windows, .uefi => switch (c_type) {3435 .windows, .uefi => switch (c_type) {
3440 .longdouble => switch (target.abi) {3436 .longdouble => switch (target.abi) {
3441 .gnu, .ilp32, .cygnus => return 4,3437 .gnu, .ilp32 => return 4,
3442 else => return 8,3438 else => return 8,
3443 },3439 },
3444 else => {},3440 else => {},
lib/std/zig/LibCDirs.zig-1
...@@ -262,7 +262,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {...@@ -262,7 +262,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
262 .androideabi,262 .androideabi,
263 .msvc,263 .msvc,
264 .itanium,264 .itanium,
265 .cygnus,
266 .simulator,265 .simulator,
267 .macabi,266 .macabi,
268 => unreachable,267 => unreachable,
src/codegen/llvm.zig-2
...@@ -295,7 +295,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8...@@ -295,7 +295,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
295 .muslx32 => "muslx32",295 .muslx32 => "muslx32",
296 .msvc => "msvc",296 .msvc => "msvc",
297 .itanium => "itanium",297 .itanium => "itanium",
298 .cygnus => "cygnus",
299 .simulator => "simulator",298 .simulator => "simulator",
300 .macabi => "macabi",299 .macabi => "macabi",
301 .ohos, .ohoseabi => "ohos",300 .ohos, .ohoseabi => "ohos",
...@@ -420,7 +419,6 @@ pub fn dataLayout(target: *const std.Target) []const u8 {...@@ -420,7 +419,6 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
420 .sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128",419 .sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128",
421 .s390x => "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",420 .s390x => "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
422 .x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) {421 .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",
424 .gnu => if (target.ofmt == .coff)422 .gnu => if (target.ofmt == .coff)
425 "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"423 "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"
426 else424 else
src/target.zig+1-2
...@@ -63,7 +63,7 @@ pub fn supports_fpic(target: *const std.Target) bool {...@@ -63,7 +63,7 @@ pub fn supports_fpic(target: *const std.Target) bool {
63 return switch (target.os.tag) {63 return switch (target.os.tag) {
64 .windows,64 .windows,
65 .uefi,65 .uefi,
66 => target.abi == .gnu or target.abi == .cygnus,66 => target.abi == .gnu,
67 else => true,67 else => true,
68 };68 };
69}69}
...@@ -93,7 +93,6 @@ pub fn useEmulatedTls(target: *const std.Target) bool {...@@ -93,7 +93,6 @@ pub fn useEmulatedTls(target: *const std.Target) bool {
93 if (target.abi.isOpenHarmony()) return true;93 if (target.abi.isOpenHarmony()) return true;
94 return switch (target.os.tag) {94 return switch (target.os.tag) {
95 .openbsd => true,95 .openbsd => true,
96 .windows => target.abi == .cygnus,
97 else => false,96 else => false,
98 };97 };
99}98}
test/llvm_targets.zig-2
...@@ -299,7 +299,6 @@ const targets = [_]std.Target.Query{...@@ -299,7 +299,6 @@ const targets = [_]std.Target.Query{
299 .{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none },299 .{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none },
300 .{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none },300 .{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none },
301 .{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none },301 .{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none },
302 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .cygnus },
303 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .gnu },302 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .gnu },
304 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .itanium },303 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .itanium },
305 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc },304 .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc },
...@@ -333,7 +332,6 @@ const targets = [_]std.Target.Query{...@@ -333,7 +332,6 @@ const targets = [_]std.Target.Query{
333 .{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none },332 .{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none },
334 .{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none },333 .{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none },
335 .{ .cpu_arch = .x86_64, .os_tag = .uefi, .abi = .none },334 .{ .cpu_arch = .x86_64, .os_tag = .uefi, .abi = .none },
336 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .cygnus },
337 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu },335 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu },
338 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .itanium },336 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .itanium },
339 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .msvc },337 .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .msvc },