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 {
23512351 // TODO: `700` ABI support.
23522352 .arc => if (abi == .gnu) init("/lib/ld-linux-arc.so.2") else none,
23532353
2354 // TODO: OABI support (`/lib/ld-linux.so.2`).
23552354 .arm,
23562355 .armeb,
23572356 .thumb,
......@@ -2676,6 +2675,10 @@ pub fn stackAlignment(target: Target) u16 {
26762675 => return 2,
26772676 .amdgcn,
26782677 => return 4,
2678 .arm,
2679 .armeb,
2680 .thumb,
2681 .thumbeb,
26792682 .lanai,
26802683 .mips,
26812684 .mipsel,
......@@ -2694,17 +2697,8 @@ pub fn stackAlignment(target: Target) u16 {
26942697 .wasm32,
26952698 .wasm64,
26962699 => return 16,
2697 // Some of the following prongs should really be testing the ABI (e.g. for Arm, it's APCS vs
2698 // AAPCS16 vs AAPCS). But our current Abi enum is not able to handle that level of nuance.
2699 .arm,
2700 .armeb,
2701 .thumb,
2702 .thumbeb,
2703 => switch (target.os.tag) {
2704 .netbsd => {},
2705 .watchos => return 16,
2706 else => return 8,
2707 },
2700 // Some of the following prongs should really be testing the ABI, but our current `Abi` enum
2701 // can't handle that level of nuance yet.
27082702 .powerpc64,
27092703 .powerpc64le,
27102704 => 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 {
30453039 .short, .ushort => return 16,
30463040 .int, .uint, .float => return 32,
30473041 .long, .ulong => switch (target.cpu.arch) {
3048 .x86, .arm => return 32,
3049 .x86_64 => switch (target.abi) {
3050 .gnux32, .muslx32 => return 32,
3051 else => return 64,
3052 },
3042 .x86_64 => return 64,
30533043 else => switch (target.abi) {
30543044 .ilp32 => return 32,
30553045 else => return 64,
......@@ -3057,11 +3047,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
30573047 },
30583048 .longlong, .ulonglong, .double => return 64,
30593049 .longdouble => switch (target.cpu.arch) {
3060 .aarch64 => return 64,
3061 .x86 => switch (target.abi) {
3062 .android => return 64,
3063 else => return 80,
3064 },
30653050 .x86_64 => return 80,
30663051 else => return 64,
30673052 },
......@@ -3111,7 +3096,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
31113096 .ps3,
31123097 .contiki,
31133098 .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"),
31153100 }
31163101}
31173102
......@@ -3155,24 +3140,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
31553140 return @min(
31563141 std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
31573142 @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
31763143 .msp430,
31773144 => 2,
31783145
......@@ -3187,6 +3154,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
31873154 .propeller2,
31883155 => 4,
31893156
3157 .arm,
3158 .armeb,
3159 .thumb,
3160 .thumbeb,
31903161 .amdgcn,
31913162 .bpfel,
31923163 .bpfeb,
......@@ -3232,29 +3203,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
32323203pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
32333204 // Overrides for unusual alignments
32343205 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 },
32583206 .arc => switch (c_type) {
32593207 .longdouble => return 4,
32603208 else => {},
......@@ -3366,13 +3314,9 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention {
33663314 .windows => .{ .aarch64_aapcs_win = .{} },
33673315 else => .{ .aarch64_aapcs = .{} },
33683316 },
3369 .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
3370 .netbsd => .{ .arm_apcs = .{} },
3371 .watchos => .{ .arm_aapcs16_vfp = .{} },
3372 else => switch (target.abi.floatAbi()) {
3373 .soft => .{ .arm_aapcs = .{} },
3374 .hard => .{ .arm_aapcs_vfp = .{} },
3375 },
3317 .arm, .armeb, .thumb, .thumbeb => switch (target.abi.floatAbi()) {
3318 .soft => .{ .arm_aapcs = .{} },
3319 .hard => .{ .arm_aapcs_vfp = .{} },
33763320 },
33773321 .mips64, .mips64el => switch (target.abi) {
33783322 .gnuabin32 => .{ .mips64_n32 = .{} },
lib/std/builtin.zig+5-4
......@@ -220,7 +220,7 @@ pub const CallingConvention = union(enum(u8)) {
220220 };
221221 /// Deprecated; use `.x86_thiscall`.
222222 pub const Thiscall: CallingConvention = .{ .x86_thiscall = .{} };
223 /// Deprecated; use `.arm_apcs`.
223 /// Deprecated; do not use.
224224 pub const APCS: CallingConvention = .{ .arm_apcs = .{} };
225225 /// Deprecated; use `.arm_aapcs`.
226226 pub const AAPCS: CallingConvention = .{ .arm_aapcs = .{} };
......@@ -284,13 +284,14 @@ pub const CallingConvention = union(enum(u8)) {
284284 aarch64_vfabi_sve: CommonOptions,
285285
286286 // Calling convetions for the `arm`, `armeb`, `thumb`, and `thumbeb` architectures.
287 /// ARM Procedure Call Standard (obsolete)
288 arm_apcs: CommonOptions,
287 /// Deprecated; do not use.
288 arm_apcs: CommonOptions, // Removal of `arm_apcs` is blocked by #21842.
289289 /// ARM Architecture Procedure Call Standard
290290 arm_aapcs: CommonOptions,
291291 /// ARM Architecture Procedure Call Standard Vector Floating-Point
292292 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.
294295 arm_interrupt: ArmInterruptOptions,
295296
296297 // Calling conventions for the `mips64` and `mips64el` architectures.