aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Target.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-12-08 14:47:00 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2024-12-09 10:47:18 +0100
commitb94bb6f96f475efcdb24c64fe36a4ec22bf18cdf (patch)
tree5f4dbcd0e64510204de85de0479db4b988f183bf /lib/std/Target.zig
parent7cd2c1ce8770ccd3bb5a9d9c79baf4d0013ab0c8 (diff)
downloadzig-b94bb6f96f475efcdb24c64fe36a4ec22bf18cdf.tar.gz
zig-b94bb6f96f475efcdb24c64fe36a4ec22bf18cdf.zip
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.
Diffstat (limited to 'lib/std/Target.zig')
-rw-r--r--lib/std/Target.zig86
1 files changed, 15 insertions, 71 deletions
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 = .{} },