Commit 16fc083f2b

Alex Rønne Petersen <alex@alexrp.com>
2025-11-23 10:10:57
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
1 parent 6d543bc
Changed files (5)
lib
src
codegen
lib/compiler/aro/aro/Target.zig
@@ -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.
lib/std/zig/LibCDirs.zig
@@ -254,7 +254,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
         .ohos,
         .ohoseabi,
         => return "musl",
-        .code16,
         .eabi,
         .eabihf,
         .ilp32,
lib/std/zig/system.zig
@@ -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 => {},
     }
lib/std/Target.zig
@@ -746,7 +746,6 @@ pub const Abi = enum {
     gnuf32,
     gnusf,
     gnux32,
-    code16,
     eabi,
     eabihf,
     ilp32,
src/codegen/llvm.zig
@@ -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",