authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-12-08 14:47:00+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-12-09 10:47:18+01:00
logb94bb6f96f475efcdb24c64fe36a4ec22bf18cdf
tree5f4dbcd0e64510204de85de0479db4b988f183bf
parent7cd2c1ce8770ccd3bb5a9d9c79baf4d0013ab0c8

std.Target: Remove our broken support for the ancient and obsolete Arm OABI.

NetBSD has long since migrated to the EABI and doesn't officially support the OABI anymore. The ABI selection logic in LLVM only actually picks OABI for NetBSD as a last resort if the EABI isn't selected. That fallback is likely to be removed in the future. So just remove this support in Zig entirely. While here, I also removed some leftover 32-bit Arm and 32-bit x86 code for Apple targets, which are long dead and unsupported by Zig.

2 files changed, 20 insertions(+), 75 deletions(-)

lib/std/Target.zig+15-71
...@@ -2351,7 +2351,6 @@ pub const DynamicLinker = struct {...@@ -2351,7 +2351,6 @@ pub const DynamicLinker = struct {
2351 // TODO: `700` ABI support.2351 // TODO: `700` ABI support.
2352 .arc => if (abi == .gnu) init("/lib/ld-linux-arc.so.2") else none,2352 .arc => if (abi == .gnu) init("/lib/ld-linux-arc.so.2") else none,
23532353
2354 // TODO: OABI support (`/lib/ld-linux.so.2`).
2355 .arm,2354 .arm,
2356 .armeb,2355 .armeb,
2357 .thumb,2356 .thumb,
...@@ -2676,6 +2675,10 @@ pub fn stackAlignment(target: Target) u16 {...@@ -2676,6 +2675,10 @@ pub fn stackAlignment(target: Target) u16 {
2676 => return 2,2675 => return 2,
2677 .amdgcn,2676 .amdgcn,
2678 => return 4,2677 => return 4,
2678 .arm,
2679 .armeb,
2680 .thumb,
2681 .thumbeb,
2679 .lanai,2682 .lanai,
2680 .mips,2683 .mips,
2681 .mipsel,2684 .mipsel,
...@@ -2694,17 +2697,8 @@ pub fn stackAlignment(target: Target) u16 {...@@ -2694,17 +2697,8 @@ pub fn stackAlignment(target: Target) u16 {
2694 .wasm32,2697 .wasm32,
2695 .wasm64,2698 .wasm64,
2696 => return 16,2699 => return 16,
2697 // Some of the following prongs should really be testing the ABI (e.g. for Arm, it's APCS vs2700 // Some of the following prongs should really be testing the ABI, but our current `Abi` enum
2698 // AAPCS16 vs AAPCS). But our current Abi enum is not able to handle that level of nuance.2701 // can't handle that level of nuance yet.
2699 .arm,
2700 .armeb,
2701 .thumb,
2702 .thumbeb,
2703 => switch (target.os.tag) {
2704 .netbsd => {},
2705 .watchos => return 16,
2706 else => return 8,
2707 },
2708 .powerpc64,2702 .powerpc64,
2709 .powerpc64le,2703 .powerpc64le,
2710 => if (target.os.tag == .linux or target.os.tag == .aix) return 16,2704 => 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 {...@@ -3045,11 +3039,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
3045 .short, .ushort => return 16,3039 .short, .ushort => return 16,
3046 .int, .uint, .float => return 32,3040 .int, .uint, .float => return 32,
3047 .long, .ulong => switch (target.cpu.arch) {3041 .long, .ulong => switch (target.cpu.arch) {
3048 .x86, .arm => return 32,3042 .x86_64 => return 64,
3049 .x86_64 => switch (target.abi) {
3050 .gnux32, .muslx32 => return 32,
3051 else => return 64,
3052 },
3053 else => switch (target.abi) {3043 else => switch (target.abi) {
3054 .ilp32 => return 32,3044 .ilp32 => return 32,
3055 else => return 64,3045 else => return 64,
...@@ -3057,11 +3047,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -3057,11 +3047,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
3057 },3047 },
3058 .longlong, .ulonglong, .double => return 64,3048 .longlong, .ulonglong, .double => return 64,
3059 .longdouble => switch (target.cpu.arch) {3049 .longdouble => switch (target.cpu.arch) {
3060 .aarch64 => return 64,
3061 .x86 => switch (target.abi) {
3062 .android => return 64,
3063 else => return 80,
3064 },
3065 .x86_64 => return 80,3050 .x86_64 => return 80,
3066 else => return 64,3051 else => return 64,
3067 },3052 },
...@@ -3111,7 +3096,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -3111,7 +3096,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
3111 .ps3,3096 .ps3,
3112 .contiki,3097 .contiki,
3113 .opengl,3098 .opengl,
3114 => @panic("TODO specify the C integer and float type sizes for this OS"),3099 => @panic("specify the C integer and float type sizes for this OS"),
3115 }3100 }
3116}3101}
31173102
...@@ -3155,24 +3140,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {...@@ -3155,24 +3140,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
3155 return @min(3140 return @min(
3156 std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),3141 std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
3157 @as(u16, switch (target.cpu.arch) {3142 @as(u16, switch (target.cpu.arch) {
3158 .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
3159 .netbsd => switch (target.abi) {
3160 .gnueabi,
3161 .gnueabihf,
3162 .eabi,
3163 .eabihf,
3164 .android,
3165 .androideabi,
3166 .musleabi,
3167 .musleabihf,
3168 => 8,
3169
3170 else => 4,
3171 },
3172 .ios, .tvos, .watchos, .visionos => 4,
3173 else => 8,
3174 },
3175
3176 .msp430,3143 .msp430,
3177 => 2,3144 => 2,
31783145
...@@ -3187,6 +3154,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {...@@ -3187,6 +3154,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
3187 .propeller2,3154 .propeller2,
3188 => 4,3155 => 4,
31893156
3157 .arm,
3158 .armeb,
3159 .thumb,
3160 .thumbeb,
3190 .amdgcn,3161 .amdgcn,
3191 .bpfel,3162 .bpfel,
3192 .bpfeb,3163 .bpfeb,
...@@ -3232,29 +3203,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {...@@ -3232,29 +3203,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
3232pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {3203pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
3233 // Overrides for unusual alignments3204 // Overrides for unusual alignments
3234 switch (target.cpu.arch) {3205 switch (target.cpu.arch) {
3235 .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
3236 .netbsd => switch (target.abi) {
3237 .gnueabi,
3238 .gnueabihf,
3239 .eabi,
3240 .eabihf,
3241 .android,
3242 .androideabi,
3243 .musleabi,
3244 .musleabihf,
3245 => {},
3246
3247 else => switch (c_type) {
3248 .longdouble => return 4,
3249 else => {},
3250 },
3251 },
3252 .ios, .tvos, .watchos, .visionos => switch (c_type) {
3253 .longdouble => return 4,
3254 else => {},
3255 },
3256 else => {},
3257 },
3258 .arc => switch (c_type) {3206 .arc => switch (c_type) {
3259 .longdouble => return 4,3207 .longdouble => return 4,
3260 else => {},3208 else => {},
...@@ -3366,13 +3314,9 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention {...@@ -3366,13 +3314,9 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention {
3366 .windows => .{ .aarch64_aapcs_win = .{} },3314 .windows => .{ .aarch64_aapcs_win = .{} },
3367 else => .{ .aarch64_aapcs = .{} },3315 else => .{ .aarch64_aapcs = .{} },
3368 },3316 },
3369 .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {3317 .arm, .armeb, .thumb, .thumbeb => switch (target.abi.floatAbi()) {
3370 .netbsd => .{ .arm_apcs = .{} },3318 .soft => .{ .arm_aapcs = .{} },
3371 .watchos => .{ .arm_aapcs16_vfp = .{} },3319 .hard => .{ .arm_aapcs_vfp = .{} },
3372 else => switch (target.abi.floatAbi()) {
3373 .soft => .{ .arm_aapcs = .{} },
3374 .hard => .{ .arm_aapcs_vfp = .{} },
3375 },
3376 },3320 },
3377 .mips64, .mips64el => switch (target.abi) {3321 .mips64, .mips64el => switch (target.abi) {
3378 .gnuabin32 => .{ .mips64_n32 = .{} },3322 .gnuabin32 => .{ .mips64_n32 = .{} },
lib/std/builtin.zig+5-4
...@@ -220,7 +220,7 @@ pub const CallingConvention = union(enum(u8)) {...@@ -220,7 +220,7 @@ pub const CallingConvention = union(enum(u8)) {
220 };220 };
221 /// Deprecated; use `.x86_thiscall`.221 /// Deprecated; use `.x86_thiscall`.
222 pub const Thiscall: CallingConvention = .{ .x86_thiscall = .{} };222 pub const Thiscall: CallingConvention = .{ .x86_thiscall = .{} };
223 /// Deprecated; use `.arm_apcs`.223 /// Deprecated; do not use.
224 pub const APCS: CallingConvention = .{ .arm_apcs = .{} };224 pub const APCS: CallingConvention = .{ .arm_apcs = .{} };
225 /// Deprecated; use `.arm_aapcs`.225 /// Deprecated; use `.arm_aapcs`.
226 pub const AAPCS: CallingConvention = .{ .arm_aapcs = .{} };226 pub const AAPCS: CallingConvention = .{ .arm_aapcs = .{} };
...@@ -284,13 +284,14 @@ pub const CallingConvention = union(enum(u8)) {...@@ -284,13 +284,14 @@ pub const CallingConvention = union(enum(u8)) {
284 aarch64_vfabi_sve: CommonOptions,284 aarch64_vfabi_sve: CommonOptions,
285285
286 // Calling convetions for the `arm`, `armeb`, `thumb`, and `thumbeb` architectures.286 // Calling convetions for the `arm`, `armeb`, `thumb`, and `thumbeb` architectures.
287 /// ARM Procedure Call Standard (obsolete)287 /// Deprecated; do not use.
288 arm_apcs: CommonOptions,288 arm_apcs: CommonOptions, // Removal of `arm_apcs` is blocked by #21842.
289 /// ARM Architecture Procedure Call Standard289 /// ARM Architecture Procedure Call Standard
290 arm_aapcs: CommonOptions,290 arm_aapcs: CommonOptions,
291 /// ARM Architecture Procedure Call Standard Vector Floating-Point291 /// ARM Architecture Procedure Call Standard Vector Floating-Point
292 arm_aapcs_vfp: CommonOptions,292 arm_aapcs_vfp: CommonOptions,
293 arm_aapcs16_vfp: CommonOptions,293 /// Deprecated; do not use.
294 arm_aapcs16_vfp: CommonOptions, // Removal of `arm_aapcs16_vfp` is blocked by #21842.
294 arm_interrupt: ArmInterruptOptions,295 arm_interrupt: ArmInterruptOptions,
295296
296 // Calling conventions for the `mips64` and `mips64el` architectures.297 // Calling conventions for the `mips64` and `mips64el` architectures.