authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-11-23 10:10:57+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-11-23 10:22:03+01:00
log16fc083f2b5e542c0a35034debb058836e093b48
treee970e90fa6050aea2c7365a925c02319b308f91c
parent6d543bcf94b2deefa918cb29de93fc32a10d4abf
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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

5 files changed, 8 insertions(+), 23 deletions(-)

lib/compiler/aro/aro/Target.zig+4-5
......@@ -1258,7 +1258,6 @@ pub fn toLLVMTriple(target: *const Target, buf: []u8) []const u8 {
12581258
12591259 .android => "android",
12601260 .androideabi => "androideabi",
1261 .code16 => "code16",
12621261 .eabi => "eabi",
12631262 .eabihf => "eabihf",
12641263 .gnu => "gnu",
......@@ -1630,11 +1629,11 @@ test parseAbi {
16301629 try testing.expect(query.abi == .android);
16311630 try testing.expectEqual(query.android_api_level, 17);
16321631
1633 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code162", null));
1634 try testing.expect(query.abi == .code16);
1632 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp322", null));
1633 try testing.expect(query.abi == .ilp32);
16351634
1636 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code16.2", null));
1637 try testing.expect(query.abi == .code16);
1635 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp32.2", null));
1636 try testing.expect(query.abi == .ilp32);
16381637}
16391638
16401639/// Parse OS string with common aliases in `<os>(.?<version>(...<version>))?` format.
lib/std/Target.zig-1
......@@ -746,7 +746,6 @@ pub const Abi = enum {
746746 gnuf32,
747747 gnusf,
748748 gnux32,
749 code16,
750749 eabi,
751750 eabihf,
752751 ilp32,
lib/std/zig/LibCDirs.zig-1
......@@ -254,7 +254,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
254254 .ohos,
255255 .ohoseabi,
256256 => return "musl",
257 .code16,
258257 .eabi,
259258 .eabihf,
260259 .ilp32,
lib/std/zig/system.zig+4-15
......@@ -380,28 +380,19 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
380380
381381 // For x86, we need to populate some CPU feature flags depending on architecture
382382 // and mode:
383 // * 16bit_mode => if the abi is code16
383 // * 16bit_mode => if the arch is x86_16
384384 // * 32bit_mode => if the arch is x86
385385 // However, the "mode" flags can be used as overrides, so if the user explicitly
386386 // sets one of them, that takes precedence.
387387 switch (query_cpu_arch) {
388388 .x86_16 => {
389 cpu.features.addFeature(
390 @intFromEnum(Target.x86.Feature.@"16bit_mode"),
391 );
389 cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"16bit_mode"));
392390 },
393391 .x86 => {
394392 if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{
395393 .@"16bit_mode", .@"32bit_mode",
396394 })) {
397 switch (query_abi) {
398 .code16 => cpu.features.addFeature(
399 @intFromEnum(Target.x86.Feature.@"16bit_mode"),
400 ),
401 else => cpu.features.addFeature(
402 @intFromEnum(Target.x86.Feature.@"32bit_mode"),
403 ),
404 }
395 cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"32bit_mode"));
405396 }
406397 },
407398 .arm, .armeb => {
......@@ -409,9 +400,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
409400 // What do we do if the user specifies +thumb_mode?
410401 },
411402 .thumb, .thumbeb => {
412 cpu.features.addFeature(
413 @intFromEnum(Target.arm.Feature.thumb_mode),
414 );
403 cpu.features.addFeature(@intFromEnum(Target.arm.Feature.thumb_mode));
415404 },
416405 else => {},
417406 }
src/codegen/llvm.zig-1
......@@ -277,7 +277,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
277277 .gnusf => "gnusf",
278278 .gnux32 => "gnux32",
279279 .ilp32 => "unknown",
280 .code16 => "code16",
281280 .eabi => "eabi",
282281 .eabihf => "eabihf",
283282 .android => "android",