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", .android => "android",
.androideabi => "androideabi", .androideabi => "androideabi",
.code16 => "code16",
.eabi => "eabi", .eabi => "eabi",
.eabihf => "eabihf", .eabihf => "eabihf",
.gnu => "gnu", .gnu => "gnu",
@ -1630,11 +1629,11 @@ test parseAbi {
try testing.expect(query.abi == .android); try testing.expect(query.abi == .android);
try testing.expectEqual(query.android_api_level, 17); try testing.expectEqual(query.android_api_level, 17);
try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code162", null)); try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp322", null));
try testing.expect(query.abi == .code16); try testing.expect(query.abi == .ilp32);
try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code16.2", null)); try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp32.2", null));
try testing.expect(query.abi == .code16); try testing.expect(query.abi == .ilp32);
} }
/// Parse OS string with common aliases in `<os>(.?<version>(...<version>))?` format. /// Parse OS string with common aliases in `<os>(.?<version>(...<version>))?` format.

View file

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

View file

@ -254,7 +254,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
.ohos, .ohos,
.ohoseabi, .ohoseabi,
=> return "musl", => return "musl",
.code16,
.eabi, .eabi,
.eabihf, .eabihf,
.ilp32, .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 // For x86, we need to populate some CPU feature flags depending on architecture
// and mode: // and mode:
// * 16bit_mode => if the abi is code16 // * 16bit_mode => if the arch is x86_16
// * 32bit_mode => if the arch is x86 // * 32bit_mode => if the arch is x86
// However, the "mode" flags can be used as overrides, so if the user explicitly // However, the "mode" flags can be used as overrides, so if the user explicitly
// sets one of them, that takes precedence. // sets one of them, that takes precedence.
switch (query_cpu_arch) { switch (query_cpu_arch) {
.x86_16 => { .x86_16 => {
cpu.features.addFeature( cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"16bit_mode"));
@intFromEnum(Target.x86.Feature.@"16bit_mode"),
);
}, },
.x86 => { .x86 => {
if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{ if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{
.@"16bit_mode", .@"32bit_mode", .@"16bit_mode", .@"32bit_mode",
})) { })) {
switch (query_abi) { cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"32bit_mode"));
.code16 => cpu.features.addFeature(
@intFromEnum(Target.x86.Feature.@"16bit_mode"),
),
else => cpu.features.addFeature(
@intFromEnum(Target.x86.Feature.@"32bit_mode"),
),
}
} }
}, },
.arm, .armeb => { .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? // What do we do if the user specifies +thumb_mode?
}, },
.thumb, .thumbeb => { .thumb, .thumbeb => {
cpu.features.addFeature( cpu.features.addFeature(@intFromEnum(Target.arm.Feature.thumb_mode));
@intFromEnum(Target.arm.Feature.thumb_mode),
);
}, },
else => {}, else => {},
} }

View file

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