std.Target: remove Abi.code16

This functionality -- if it's actually needed -- can be reintroduced through
some other mechanism. An ABI is clearly not the right way to represent it.

closes #25918
This commit is contained in:
Alex Rønne Petersen 2025-11-23 10:10:57 +01:00
parent 6d543bcf94
commit 16fc083f2b
No known key found for this signature in database
5 changed files with 8 additions and 23 deletions

View file

@ -1258,7 +1258,6 @@ pub fn toLLVMTriple(target: *const Target, buf: []u8) []const u8 {
.android => "android",
.androideabi => "androideabi",
.code16 => "code16",
.eabi => "eabi",
.eabihf => "eabihf",
.gnu => "gnu",
@ -1630,11 +1629,11 @@ test parseAbi {
try testing.expect(query.abi == .android);
try testing.expectEqual(query.android_api_level, 17);
try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code162", null));
try testing.expect(query.abi == .code16);
try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp322", null));
try testing.expect(query.abi == .ilp32);
try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code16.2", null));
try testing.expect(query.abi == .code16);
try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp32.2", null));
try testing.expect(query.abi == .ilp32);
}
/// Parse OS string with common aliases in `<os>(.?<version>(...<version>))?` format.

View file

@ -746,7 +746,6 @@ pub const Abi = enum {
gnuf32,
gnusf,
gnux32,
code16,
eabi,
eabihf,
ilp32,

View file

@ -254,7 +254,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
.ohos,
.ohoseabi,
=> return "musl",
.code16,
.eabi,
.eabihf,
.ilp32,

View file

@ -380,28 +380,19 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
// For x86, we need to populate some CPU feature flags depending on architecture
// and mode:
// * 16bit_mode => if the abi is code16
// * 16bit_mode => if the arch is x86_16
// * 32bit_mode => if the arch is x86
// However, the "mode" flags can be used as overrides, so if the user explicitly
// sets one of them, that takes precedence.
switch (query_cpu_arch) {
.x86_16 => {
cpu.features.addFeature(
@intFromEnum(Target.x86.Feature.@"16bit_mode"),
);
cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"16bit_mode"));
},
.x86 => {
if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{
.@"16bit_mode", .@"32bit_mode",
})) {
switch (query_abi) {
.code16 => cpu.features.addFeature(
@intFromEnum(Target.x86.Feature.@"16bit_mode"),
),
else => cpu.features.addFeature(
@intFromEnum(Target.x86.Feature.@"32bit_mode"),
),
}
cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"32bit_mode"));
}
},
.arm, .armeb => {
@ -409,9 +400,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
// What do we do if the user specifies +thumb_mode?
},
.thumb, .thumbeb => {
cpu.features.addFeature(
@intFromEnum(Target.arm.Feature.thumb_mode),
);
cpu.features.addFeature(@intFromEnum(Target.arm.Feature.thumb_mode));
},
else => {},
}

View file

@ -277,7 +277,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
.gnusf => "gnusf",
.gnux32 => "gnux32",
.ilp32 => "unknown",
.code16 => "code16",
.eabi => "eabi",
.eabihf => "eabihf",
.android => "android",