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 {...@@ -1258,7 +1258,6 @@ pub fn toLLVMTriple(target: *const Target, buf: []u8) []const u8 {
12581258
1259 .android => "android",1259 .android => "android",
1260 .androideabi => "androideabi",1260 .androideabi => "androideabi",
1261 .code16 => "code16",
1262 .eabi => "eabi",1261 .eabi => "eabi",
1263 .eabihf => "eabihf",1262 .eabihf => "eabihf",
1264 .gnu => "gnu",1263 .gnu => "gnu",
...@@ -1630,11 +1629,11 @@ test parseAbi {...@@ -1630,11 +1629,11 @@ test parseAbi {
1630 try testing.expect(query.abi == .android);1629 try testing.expect(query.abi == .android);
1631 try testing.expectEqual(query.android_api_level, 17);1630 try testing.expectEqual(query.android_api_level, 17);
16321631
1633 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code162", null));1632 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp322", null));
1634 try testing.expect(query.abi == .code16);1633 try testing.expect(query.abi == .ilp32);
16351634
1636 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "code16.2", null));1635 try testing.expectError(error.InvalidAbiVersion, parseAbi(&query, "ilp32.2", null));
1637 try testing.expect(query.abi == .code16);1636 try testing.expect(query.abi == .ilp32);
1638}1637}
16391638
1640/// Parse OS string with common aliases in `<os>(.?<version>(...<version>))?` format.1639/// Parse OS string with common aliases in `<os>(.?<version>(...<version>))?` format.
lib/std/Target.zig-1
...@@ -746,7 +746,6 @@ pub const Abi = enum {...@@ -746,7 +746,6 @@ pub const Abi = enum {
746 gnuf32,746 gnuf32,
747 gnusf,747 gnusf,
748 gnux32,748 gnux32,
749 code16,
750 eabi,749 eabi,
751 eabihf,750 eabihf,
752 ilp32,751 ilp32,
lib/std/zig/LibCDirs.zig-1
...@@ -254,7 +254,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {...@@ -254,7 +254,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
254 .ohos,254 .ohos,
255 .ohoseabi,255 .ohoseabi,
256 => return "musl",256 => return "musl",
257 .code16,
258 .eabi,257 .eabi,
259 .eabihf,258 .eabihf,
260 .ilp32,259 .ilp32,
lib/std/zig/system.zig+4-15
...@@ -380,28 +380,19 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {...@@ -380,28 +380,19 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
380380
381 // For x86, we need to populate some CPU feature flags depending on architecture381 // For x86, we need to populate some CPU feature flags depending on architecture
382 // and mode:382 // and mode:
383 // * 16bit_mode => if the abi is code16383 // * 16bit_mode => if the arch is x86_16
384 // * 32bit_mode => if the arch is x86384 // * 32bit_mode => if the arch is x86
385 // However, the "mode" flags can be used as overrides, so if the user explicitly385 // However, the "mode" flags can be used as overrides, so if the user explicitly
386 // sets one of them, that takes precedence.386 // sets one of them, that takes precedence.
387 switch (query_cpu_arch) {387 switch (query_cpu_arch) {
388 .x86_16 => {388 .x86_16 => {
389 cpu.features.addFeature(389 cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"16bit_mode"));
390 @intFromEnum(Target.x86.Feature.@"16bit_mode"),
391 );
392 },390 },
393 .x86 => {391 .x86 => {
394 if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{392 if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{
395 .@"16bit_mode", .@"32bit_mode",393 .@"16bit_mode", .@"32bit_mode",
396 })) {394 })) {
397 switch (query_abi) {395 cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"32bit_mode"));
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 }
405 }396 }
406 },397 },
407 .arm, .armeb => {398 .arm, .armeb => {
...@@ -409,9 +400,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {...@@ -409,9 +400,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
409 // What do we do if the user specifies +thumb_mode?400 // What do we do if the user specifies +thumb_mode?
410 },401 },
411 .thumb, .thumbeb => {402 .thumb, .thumbeb => {
412 cpu.features.addFeature(403 cpu.features.addFeature(@intFromEnum(Target.arm.Feature.thumb_mode));
413 @intFromEnum(Target.arm.Feature.thumb_mode),
414 );
415 },404 },
416 else => {},405 else => {},
417 }406 }
src/codegen/llvm.zig-1
...@@ -277,7 +277,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8...@@ -277,7 +277,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
277 .gnusf => "gnusf",277 .gnusf => "gnusf",
278 .gnux32 => "gnux32",278 .gnux32 => "gnux32",
279 .ilp32 => "unknown",279 .ilp32 => "unknown",
280 .code16 => "code16",
281 .eabi => "eabi",280 .eabi => "eabi",
282 .eabihf => "eabihf",281 .eabihf => "eabihf",
283 .android => "android",282 .android => "android",