From 09b39f77b7e380857c79adaec4765350163d6e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 3 Dec 2024 20:07:51 +0100 Subject: [PATCH] std.Target: Remove Os.Tag.bridgeos. It doesn't appear that targeting bridgeOS is meaningfully supported by Apple. Even LLVM/Clang appear to have incomplete support for it, suggesting that Apple never bothered to upstream that support. So there's really no sense in us pretending to support this. --- lib/compiler/aro/aro/target.zig | 1 - lib/std/Target.zig | 24 ++++-------------------- src/codegen/llvm.zig | 3 --- src/link/MachO.zig | 11 ++--------- test/llvm_targets.zig | 1 - 5 files changed, 6 insertions(+), 34 deletions(-) diff --git a/lib/compiler/aro/aro/target.zig b/lib/compiler/aro/aro/target.zig index 56bc4dd46a..b1ffcd6e7e 100644 --- a/lib/compiler/aro/aro/target.zig +++ b/lib/compiler/aro/aro/target.zig @@ -663,7 +663,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 { .driverkit => "driverkit", .visionos => "xros", .serenity => "serenity", - .bridgeos => "bridgeos", .opencl, .opengl, .vulkan, diff --git a/lib/std/Target.zig b/lib/std/Target.zig index c5a800097d..6eb5d047ba 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -38,7 +38,6 @@ pub const Os = struct { netbsd, openbsd, - bridgeos, driverkit, ios, macos, @@ -69,6 +68,7 @@ pub const Os = struct { vulkan, // LLVM tags deliberately omitted: + // - bridgeos // - darwin // - kfreebsd // - nacl @@ -76,7 +76,6 @@ pub const Os = struct { pub inline fn isDarwin(tag: Tag) bool { return switch (tag) { - .bridgeos, .driverkit, .ios, .macos, @@ -124,7 +123,6 @@ pub const Os = struct { pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 { return switch (tag) { .windows, .uefi => ".dll", - .bridgeos, .driverkit, .ios, .macos, @@ -168,9 +166,6 @@ pub const Os = struct { .plan9, .serenity, - // This should use semver once we determine the version history. - .bridgeos, - .illumos, .ps3, @@ -432,9 +427,6 @@ pub const Os = struct { .plan9, .serenity, - // This should use semver once we determine the version history. - .bridgeos, - .illumos, .ps3, @@ -701,7 +693,6 @@ pub const Os = struct { .freebsd, .aix, .netbsd, - .bridgeos, .driverkit, .macos, .ios, @@ -927,7 +918,6 @@ pub const Abi = enum { .serenity, .zos, .dragonfly, - .bridgeos, .driverkit, .macos, .illumos, @@ -1049,7 +1039,7 @@ pub const ObjectFormat = enum { pub fn default(os_tag: Os.Tag, arch: Cpu.Arch) ObjectFormat { return switch (os_tag) { .aix => .xcoff, - .bridgeos, .driverkit, .ios, .macos, .tvos, .visionos, .watchos => .macho, + .driverkit, .ios, .macos, .tvos, .visionos, .watchos => .macho, .plan9 => .plan9, .uefi, .windows => .coff, .zos => .goff, @@ -1975,7 +1965,7 @@ pub const Cpu = struct { .amdgcn => &amdgcn.cpu.gfx906, .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline, .aarch64 => switch (os.tag) { - .bridgeos, .driverkit, .macos => &aarch64.cpu.apple_m1, + .driverkit, .macos => &aarch64.cpu.apple_m1, .ios, .tvos => &aarch64.cpu.apple_a7, .visionos => &aarch64.cpu.apple_m2, .watchos => &aarch64.cpu.apple_s4, @@ -2159,7 +2149,6 @@ pub const DynamicLinker = struct { .netbsd, .openbsd, - .bridgeos, .driverkit, .ios, .macos, @@ -2546,7 +2535,6 @@ pub const DynamicLinker = struct { else => none, }, - .bridgeos => if (cpu.arch == .aarch64) init("/usr/lib/dyld") else none, .driverkit, .ios, .macos, @@ -3045,7 +3033,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { }, }, - .bridgeos, .driverkit, .ios, .macos, @@ -3069,10 +3056,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { }, .longlong, .ulonglong, .double => return 64, .longdouble => switch (target.cpu.arch) { - .aarch64 => switch (target.os.tag) { - .bridgeos => return 128, - else => return 64, - }, + .aarch64 => return 64, .x86 => switch (target.abi) { .android => return 64, else => return 80, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 0a755e25a8..abfd1c2a10 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -167,7 +167,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .aix, .zos, => "ibm", - .bridgeos, .driverkit, .ios, .macos, @@ -218,7 +217,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .hurd => "hurd", .wasi => "wasi", .emscripten => "emscripten", - .bridgeos => "bridgeos", .macos => "macosx", .ios => "ios", .tvos => "tvos", @@ -340,7 +338,6 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { .driverkit => .DriverKit, .vulkan => .Vulkan, .serenity => .Serenity, - .bridgeos => .BridgeOS, .opengl, .plan9, diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 9cfe839ca3..8bec62420b 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -3539,7 +3539,7 @@ pub fn requiresCodeSig(self: MachO) bool { const target = self.getTarget(); return switch (target.cpu.arch) { .aarch64 => switch (target.os.tag) { - .bridgeos, .driverkit, .macos => true, + .driverkit, .macos => true, .ios, .tvos, .visionos, .watchos => target.abi == .simulator, else => false, }, @@ -4143,7 +4143,6 @@ pub const Platform = struct { const cmd = lc.cast(macho.build_version_command).?; return .{ .os_tag = switch (cmd.platform) { - .BRIDGEOS => .bridgeos, .DRIVERKIT => .driverkit, .IOS, .IOSSIMULATOR => .ios, .MACCATALYST => .ios, @@ -4191,11 +4190,7 @@ pub const Platform = struct { return .{ .os_tag = target.os.tag, .abi = target.abi, - // This should use semver once we determine the version history. - .version = if (target.os.tag == .bridgeos) - .{ .major = 0, .minor = 0, .patch = 0 } - else - target.os.version_range.semver.min, + .version = target.os.version_range.semver.min, }; } @@ -4205,7 +4200,6 @@ pub const Platform = struct { pub fn toApplePlatform(plat: Platform) macho.PLATFORM { return switch (plat.os_tag) { - .bridgeos => .BRIDGEOS, .driverkit => .DRIVERKIT, .ios => switch (plat.abi) { .macabi => .MACCATALYST, @@ -4284,7 +4278,6 @@ const SupportedPlatforms = struct { // Source: https://github.com/apple-oss-distributions/ld64/blob/59a99ab60399c5e6c49e6945a9e1049c42b71135/src/ld/PlatformSupport.cpp#L52 // zig fmt: off const supported_platforms = [_]SupportedPlatforms{ - .{ .bridgeos, .none, 0x010000, 0x010000 }, .{ .driverkit, .none, 0x130000, 0x130000 }, .{ .ios, .none, 0x0C0000, 0x070000 }, .{ .ios, .macabi, 0x0D0000, 0x0D0000 }, diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig index 284c1fcd70..eed8178fe4 100644 --- a/test/llvm_targets.zig +++ b/test/llvm_targets.zig @@ -2,7 +2,6 @@ const std = @import("std"); const Cases = @import("src/Cases.zig"); const targets = [_]std.Target.Query{ - .{ .cpu_arch = .aarch64, .os_tag = .bridgeos, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .driverkit, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .freebsd, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .freestanding, .abi = .none },