diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 8820e76c36..ca871e91f3 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -2351,7 +2351,6 @@ pub const DynamicLinker = struct { // TODO: `700` ABI support. .arc => if (abi == .gnu) init("/lib/ld-linux-arc.so.2") else none, - // TODO: OABI support (`/lib/ld-linux.so.2`). .arm, .armeb, .thumb, @@ -2676,6 +2675,10 @@ pub fn stackAlignment(target: Target) u16 { => return 2, .amdgcn, => return 4, + .arm, + .armeb, + .thumb, + .thumbeb, .lanai, .mips, .mipsel, @@ -2694,17 +2697,8 @@ pub fn stackAlignment(target: Target) u16 { .wasm32, .wasm64, => return 16, - // Some of the following prongs should really be testing the ABI (e.g. for Arm, it's APCS vs - // AAPCS16 vs AAPCS). But our current Abi enum is not able to handle that level of nuance. - .arm, - .armeb, - .thumb, - .thumbeb, - => switch (target.os.tag) { - .netbsd => {}, - .watchos => return 16, - else => return 8, - }, + // Some of the following prongs should really be testing the ABI, but our current `Abi` enum + // can't handle that level of nuance yet. .powerpc64, .powerpc64le, => if (target.os.tag == .linux or target.os.tag == .aix) return 16, @@ -3045,11 +3039,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { .short, .ushort => return 16, .int, .uint, .float => return 32, .long, .ulong => switch (target.cpu.arch) { - .x86, .arm => return 32, - .x86_64 => switch (target.abi) { - .gnux32, .muslx32 => return 32, - else => return 64, - }, + .x86_64 => return 64, else => switch (target.abi) { .ilp32 => return 32, else => return 64, @@ -3057,11 +3047,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { }, .longlong, .ulonglong, .double => return 64, .longdouble => switch (target.cpu.arch) { - .aarch64 => return 64, - .x86 => switch (target.abi) { - .android => return 64, - else => return 80, - }, .x86_64 => return 80, else => return 64, }, @@ -3111,7 +3096,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { .ps3, .contiki, .opengl, - => @panic("TODO specify the C integer and float type sizes for this OS"), + => @panic("specify the C integer and float type sizes for this OS"), } } @@ -3155,24 +3140,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { return @min( std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8), @as(u16, switch (target.cpu.arch) { - .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) { - .netbsd => switch (target.abi) { - .gnueabi, - .gnueabihf, - .eabi, - .eabihf, - .android, - .androideabi, - .musleabi, - .musleabihf, - => 8, - - else => 4, - }, - .ios, .tvos, .watchos, .visionos => 4, - else => 8, - }, - .msp430, => 2, @@ -3187,6 +3154,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { .propeller2, => 4, + .arm, + .armeb, + .thumb, + .thumbeb, .amdgcn, .bpfel, .bpfeb, @@ -3232,29 +3203,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { // Overrides for unusual alignments switch (target.cpu.arch) { - .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) { - .netbsd => switch (target.abi) { - .gnueabi, - .gnueabihf, - .eabi, - .eabihf, - .android, - .androideabi, - .musleabi, - .musleabihf, - => {}, - - else => switch (c_type) { - .longdouble => return 4, - else => {}, - }, - }, - .ios, .tvos, .watchos, .visionos => switch (c_type) { - .longdouble => return 4, - else => {}, - }, - else => {}, - }, .arc => switch (c_type) { .longdouble => return 4, else => {}, @@ -3366,13 +3314,9 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { .windows => .{ .aarch64_aapcs_win = .{} }, else => .{ .aarch64_aapcs = .{} }, }, - .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) { - .netbsd => .{ .arm_apcs = .{} }, - .watchos => .{ .arm_aapcs16_vfp = .{} }, - else => switch (target.abi.floatAbi()) { - .soft => .{ .arm_aapcs = .{} }, - .hard => .{ .arm_aapcs_vfp = .{} }, - }, + .arm, .armeb, .thumb, .thumbeb => switch (target.abi.floatAbi()) { + .soft => .{ .arm_aapcs = .{} }, + .hard => .{ .arm_aapcs_vfp = .{} }, }, .mips64, .mips64el => switch (target.abi) { .gnuabin32 => .{ .mips64_n32 = .{} }, diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 52fe2c5e23..5ddde66a0a 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -220,7 +220,7 @@ pub const CallingConvention = union(enum(u8)) { }; /// Deprecated; use `.x86_thiscall`. pub const Thiscall: CallingConvention = .{ .x86_thiscall = .{} }; - /// Deprecated; use `.arm_apcs`. + /// Deprecated; do not use. pub const APCS: CallingConvention = .{ .arm_apcs = .{} }; /// Deprecated; use `.arm_aapcs`. pub const AAPCS: CallingConvention = .{ .arm_aapcs = .{} }; @@ -284,13 +284,14 @@ pub const CallingConvention = union(enum(u8)) { aarch64_vfabi_sve: CommonOptions, // Calling convetions for the `arm`, `armeb`, `thumb`, and `thumbeb` architectures. - /// ARM Procedure Call Standard (obsolete) - arm_apcs: CommonOptions, + /// Deprecated; do not use. + arm_apcs: CommonOptions, // Removal of `arm_apcs` is blocked by #21842. /// ARM Architecture Procedure Call Standard arm_aapcs: CommonOptions, /// ARM Architecture Procedure Call Standard Vector Floating-Point arm_aapcs_vfp: CommonOptions, - arm_aapcs16_vfp: CommonOptions, + /// Deprecated; do not use. + arm_aapcs16_vfp: CommonOptions, // Removal of `arm_aapcs16_vfp` is blocked by #21842. arm_interrupt: ArmInterruptOptions, // Calling conventions for the `mips64` and `mips64el` architectures.