Skip to content

Commit

Permalink
Merge pull request #22141 from alexrp/target-remove-bridgeos
Browse files Browse the repository at this point in the history
`std.Target`: Remove `Os.Tag.bridgeos`
  • Loading branch information
alexrp authored Dec 5, 2024
2 parents c9d6f8b + 4e29c67 commit d70be20
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 130 deletions.
1 change: 0 additions & 1 deletion lib/compiler/aro/aro/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
24 changes: 4 additions & 20 deletions lib/std/Target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub const Os = struct {
netbsd,
openbsd,

bridgeos,
driverkit,
ios,
macos,
Expand Down Expand Up @@ -69,14 +68,14 @@ pub const Os = struct {
vulkan,

// LLVM tags deliberately omitted:
// - bridgeos
// - darwin
// - kfreebsd
// - nacl
// - shadermodel

pub inline fn isDarwin(tag: Tag) bool {
return switch (tag) {
.bridgeos,
.driverkit,
.ios,
.macos,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -168,9 +166,6 @@ pub const Os = struct {
.plan9,
.serenity,

// This should use semver once we determine the version history.
.bridgeos,

.illumos,

.ps3,
Expand Down Expand Up @@ -432,9 +427,6 @@ pub const Os = struct {
.plan9,
.serenity,

// This should use semver once we determine the version history.
.bridgeos,

.illumos,

.ps3,
Expand Down Expand Up @@ -701,7 +693,6 @@ pub const Os = struct {
.freebsd,
.aix,
.netbsd,
.bridgeos,
.driverkit,
.macos,
.ios,
Expand Down Expand Up @@ -927,7 +918,6 @@ pub const Abi = enum {
.serenity,
.zos,
.dragonfly,
.bridgeos,
.driverkit,
.macos,
.illumos,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -2159,7 +2149,6 @@ pub const DynamicLinker = struct {
.netbsd,
.openbsd,

.bridgeos,
.driverkit,
.ios,
.macos,
Expand Down Expand Up @@ -2546,7 +2535,6 @@ pub const DynamicLinker = struct {
else => none,
},

.bridgeos => if (cpu.arch == .aarch64) init("/usr/lib/dyld") else none,
.driverkit,
.ios,
.macos,
Expand Down Expand Up @@ -3045,7 +3033,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
},
},

.bridgeos,
.driverkit,
.ios,
.macos,
Expand All @@ -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,
Expand Down
99 changes: 0 additions & 99 deletions src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
.aix,
.zos,
=> "ibm",
.bridgeos,
.driverkit,
.ios,
.macos,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -303,103 +301,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
return llvm_triple.toOwnedSlice();
}

pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
return switch (os_tag) {
.freestanding => .UnknownOS,
.windows, .uefi => .Win32,
.dragonfly => .DragonFly,
.freebsd => .FreeBSD,
.fuchsia => .Fuchsia,
.ios => .IOS,
.linux => .Linux,
.ps3 => .Lv2,
.macos => .MacOSX,
.netbsd => .NetBSD,
.openbsd => .OpenBSD,
.solaris, .illumos => .Solaris,
.zos => .ZOS,
.haiku => .Haiku,
.rtems => .RTEMS,
.aix => .AIX,
.cuda => .CUDA,
.nvcl => .NVCL,
.amdhsa => .AMDHSA,
.opencl => .UnknownOS, // https://llvm.org/docs/SPIRVUsage.html#target-triples
.ps4 => .PS4,
.ps5 => .PS5,
.elfiamcu => .ELFIAMCU,
.tvos => .TvOS,
.watchos => .WatchOS,
.visionos => .XROS,
.mesa3d => .Mesa3D,
.amdpal => .AMDPAL,
.hermit => .HermitCore,
.hurd => .Hurd,
.wasi => .WASI,
.emscripten => .Emscripten,
.driverkit => .DriverKit,
.vulkan => .Vulkan,
.serenity => .Serenity,
.bridgeos => .BridgeOS,

.opengl,
.plan9,
.contiki,
.other,
=> .UnknownOS,
};
}

pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType {
return switch (arch_tag) {
.arm => .arm,
.armeb => .armeb,
.aarch64 => .aarch64,
.aarch64_be => .aarch64_be,
.arc => .arc,
.avr => .avr,
.bpfel => .bpfel,
.bpfeb => .bpfeb,
.csky => .csky,
.hexagon => .hexagon,
.loongarch32 => .loongarch32,
.loongarch64 => .loongarch64,
.m68k => .m68k,
.mips => .mips,
.mipsel => .mipsel,
.mips64 => .mips64,
.mips64el => .mips64el,
.msp430 => .msp430,
.powerpc => .ppc,
.powerpcle => .ppcle,
.powerpc64 => .ppc64,
.powerpc64le => .ppc64le,
.amdgcn => .amdgcn,
.riscv32 => .riscv32,
.riscv64 => .riscv64,
.sparc => .sparc,
.sparc64 => .sparcv9, // In LLVM, sparc64 == sparcv9.
.s390x => .systemz,
.thumb => .thumb,
.thumbeb => .thumbeb,
.x86 => .x86,
.x86_64 => .x86_64,
.xcore => .xcore,
.xtensa => .xtensa,
.nvptx => .nvptx,
.nvptx64 => .nvptx64,
.spirv => .spirv,
.spirv32 => .spirv32,
.spirv64 => .spirv64,
.kalimba => .kalimba,
.lanai => .lanai,
.wasm32 => .wasm32,
.wasm64 => .wasm64,
.ve => .ve,
.propeller1, .propeller2, .spu_2 => .UnknownArch,
};
}

pub fn supportsTailCall(target: std.Target) bool {
switch (target.cpu.arch) {
.wasm32, .wasm64 => return std.Target.wasm.featureSetHas(target.cpu.features, .tail_call),
Expand Down
11 changes: 2 additions & 9 deletions src/link/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
}

Expand All @@ -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,
Expand Down Expand Up @@ -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 },
Expand Down
1 change: 0 additions & 1 deletion test/llvm_targets.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit d70be20

Please sign in to comment.