authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-27 01:20:19+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-28 00:24:09+02:00
loge7b46363aea6e42c206cb7b1bd8c9b47a83d9045
tree9a31a2fea3bf9b68a461f65073c6bf5c5caa3158
parent1b76d4c53adafebcbfcf0476276375353139dacb

std.Target: Remove Os.Tag.elfiamcu.

The last Intel Quark MCU was released in 2015. Quark was announced to be EOL in 2019, and stopped shipping entirely in 2022. The OS tag was only meaningful for Intel's weird fork of Linux 3.8.7 with a special ABI that differs from the regular i386 System V ABI; beyond that, the CPU itself is just a plain old P54C (i586). We of course keep support for the CPU itself, just not Intel's Linux fork.

8 files changed, 37 insertions(+), 82 deletions(-)

lib/compiler/aro/aro/Driver/GCCDetector.zig+6-10
......@@ -284,15 +284,11 @@ fn collectLibDirsAndTriples(
284284 },
285285 .x86 => {
286286 lib_dirs.appendSliceAssumeCapacity(&X86LibDirs);
287 // MCU toolchain is 32 bit only and its triple alias is TargetTriple
288 // itself, which will be appended below.
289 if (target.os.tag != .elfiamcu) {
290 triple_aliases.appendSliceAssumeCapacity(&X86Triples);
291 biarch_libdirs.appendSliceAssumeCapacity(&X86_64LibDirs);
292 biarch_triple_aliases.appendSliceAssumeCapacity(&X86_64Triples);
293 biarch_libdirs.appendSliceAssumeCapacity(&X32LibDirs);
294 biarch_triple_aliases.appendSliceAssumeCapacity(&X32Triples);
295 }
287 triple_aliases.appendSliceAssumeCapacity(&X86Triples);
288 biarch_libdirs.appendSliceAssumeCapacity(&X86_64LibDirs);
289 biarch_triple_aliases.appendSliceAssumeCapacity(&X86_64Triples);
290 biarch_libdirs.appendSliceAssumeCapacity(&X32LibDirs);
291 biarch_triple_aliases.appendSliceAssumeCapacity(&X32Triples);
296292 },
297293 .loongarch64 => {
298294 lib_dirs.appendSliceAssumeCapacity(&LoongArch64LibDirs);
......@@ -511,7 +507,7 @@ fn findBiarchMultilibs(
511507
512508 const multilib_filter = Multilib.Filter{
513509 .base = path,
514 .file = if (target.os.tag == .elfiamcu) "libgcc.a" else "crtbegin.o",
510 .file = "crtbegin.o",
515511 };
516512
517513 const Want = enum {
lib/compiler/aro/aro/Toolchain.zig+1-4
......@@ -83,9 +83,7 @@ pub fn discover(tc: *Toolchain) !void {
8383
8484 const target = tc.getTarget();
8585 tc.inner = switch (target.os.tag) {
86 .elfiamcu,
87 .linux,
88 => if (target.cpu.arch == .hexagon)
86 .linux => if (target.cpu.arch == .hexagon)
8987 .{ .unknown = {} } // TODO
9088 else if (target.cpu.arch.isMIPS())
9189 .{ .unknown = {} } // TODO
......@@ -418,7 +416,6 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !voi
418416 const unw = try tc.getUnwindLibKind();
419417 const target = tc.getTarget();
420418 if ((target.abi.isAndroid() and unw == .libgcc) or
421 target.os.tag == .elfiamcu or
422419 target.ofmt == .wasm or
423420 target_util.isWindowsMSVCEnvironment(target) or
424421 unw == .none) return;
lib/compiler/aro/aro/target.zig+1-2
......@@ -412,7 +412,7 @@ pub fn defaultFpEvalMethod(target: std.Target) LangOpts.FPEvalMethod {
412412/// Value of the `-m` flag for `ld` for this target
413413pub fn ldEmulationOption(target: std.Target, arm_endianness: ?std.builtin.Endian) ?[]const u8 {
414414 return switch (target.cpu.arch) {
415 .x86 => if (target.os.tag == .elfiamcu) "elf_iamcu" else "elf_i386",
415 .x86 => "elf_i386",
416416 .arm,
417417 .armeb,
418418 .thumb,
......@@ -642,7 +642,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
642642 .amdhsa => "amdhsa",
643643 .ps4 => "ps4",
644644 .ps5 => "ps5",
645 .elfiamcu => "elfiamcu",
646645 .mesa3d => "mesa3d",
647646 .contiki => "contiki",
648647 .amdpal => "amdpal",
lib/compiler/aro/aro/toolchains/Linux.zig+3-12
......@@ -170,7 +170,6 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra
170170 const is_static_pie = try self.getStaticPIE(d);
171171 const is_static = self.getStatic(d);
172172 const is_android = target.abi.isAndroid();
173 const is_iamcu = target.os.tag == .elfiamcu;
174173 const is_ve = target.cpu.arch == .ve;
175174 const has_crt_begin_end_files = target.abi != .none; // TODO: clang checks for MIPS vendor
176175
......@@ -225,7 +224,7 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra
225224 try argv.appendSlice(&.{ "-o", d.output_name orelse "a.out" });
226225
227226 if (!d.nostdlib and !d.nostartfiles and !d.relocatable) {
228 if (!is_android and !is_iamcu) {
227 if (!is_android) {
229228 if (!d.shared) {
230229 const crt1 = if (is_pie)
231230 "Scrt1.o"
......@@ -241,9 +240,7 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra
241240 try argv.appendSlice(&.{ "-z", "max-page-size=0x4000000" });
242241 }
243242
244 if (is_iamcu) {
245 try argv.append(try tc.getFilePath("crt0.o"));
246 } else if (has_crt_begin_end_files) {
243 if (has_crt_begin_end_files) {
247244 var path: []const u8 = "";
248245 if (tc.getRuntimeLibKind() == .compiler_rt and !is_android) {
249246 const crt_begin = try tc.getCompilerRt("crtbegin", .object);
......@@ -285,19 +282,13 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra
285282 if (!d.nolibc) {
286283 try argv.append("-lc");
287284 }
288 if (is_iamcu) {
289 try argv.append("-lgloss");
290 }
291285 if (is_static or is_static_pie) {
292286 try argv.append("--end-group");
293287 } else {
294288 try tc.addRuntimeLibs(argv);
295289 }
296 if (is_iamcu) {
297 try argv.appendSlice(&.{ "--as-needed", "-lsoftfp", "--no-as-needed" });
298 }
299290 }
300 if (!d.nostartfiles and !is_iamcu) {
291 if (!d.nostartfiles) {
301292 if (has_crt_begin_end_files) {
302293 var path: []const u8 = "";
303294 if (tc.getRuntimeLibKind() == .compiler_rt and !is_android) {
lib/std/Target.zig+3-24
......@@ -20,7 +20,6 @@ pub const Os = struct {
2020 other,
2121
2222 contiki,
23 elfiamcu,
2423 fuchsia,
2524 hermit,
2625
......@@ -156,8 +155,6 @@ pub const Os = struct {
156155 .freestanding,
157156 .other,
158157
159 .elfiamcu,
160
161158 .haiku,
162159 .plan9,
163160 .serenity,
......@@ -400,8 +397,6 @@ pub const Os = struct {
400397 .freestanding,
401398 .other,
402399
403 .elfiamcu,
404
405400 .haiku,
406401 .plan9,
407402 .serenity,
......@@ -729,7 +724,6 @@ pub const Os = struct {
729724 .amdhsa,
730725 .ps4,
731726 .ps5,
732 .elfiamcu,
733727 .mesa3d,
734728 .contiki,
735729 .amdpal,
......@@ -922,7 +916,6 @@ pub const Abi = enum {
922916 .wasi, .emscripten => .musl,
923917
924918 .contiki,
925 .elfiamcu,
926919 .fuchsia,
927920 .hermit,
928921 .plan9,
......@@ -1094,7 +1087,7 @@ pub fn toElfMachine(target: Target) std.elf.EM {
10941087 .sparc => if (Target.sparc.featureSetHas(target.cpu.features, .v9)) .SPARC32PLUS else .SPARC,
10951088 .sparc64 => .SPARCV9,
10961089 .ve => .VE,
1097 .x86 => if (target.os.tag == .elfiamcu) .IAMCU else .@"386",
1090 .x86 => .@"386",
10981091 .x86_64 => .X86_64,
10991092 .xcore => .XCORE,
11001093 .xtensa => .XTENSA,
......@@ -2155,7 +2148,6 @@ pub const DynamicLinker = struct {
21552148 .other,
21562149
21572150 .contiki,
2158 .elfiamcu,
21592151 .hermit,
21602152
21612153 .aix,
......@@ -2550,7 +2542,6 @@ pub const DynamicLinker = struct {
25502542 .other,
25512543
25522544 .contiki,
2553 .elfiamcu,
25542545 .hermit,
25552546
25562547 .aix,
......@@ -2690,7 +2681,7 @@ pub fn stackAlignment(target: Target) u16 {
26902681 .riscv64,
26912682 => if (!Target.riscv.featureSetHas(target.cpu.features, .e)) return 16,
26922683 .x86 => if (target.os.tag != .windows and target.os.tag != .uefi) return 16,
2693 .x86_64 => return if (target.os.tag == .elfiamcu) 4 else 16,
2684 .x86_64 => return 16,
26942685 else => {},
26952686 }
26962687
......@@ -2851,7 +2842,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
28512842 },
28522843 },
28532844
2854 .elfiamcu,
28552845 .fuchsia,
28562846 .hermit,
28572847
......@@ -2918,10 +2908,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
29182908 .longdouble => switch (target.cpu.arch) {
29192909 .x86 => switch (target.abi) {
29202910 .android => return 64,
2921 else => switch (target.os.tag) {
2922 .elfiamcu => return 64,
2923 else => return 80,
2924 },
2911 else => return 80,
29252912 },
29262913
29272914 .powerpc,
......@@ -3089,10 +3076,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
30893076 switch (target.cpu.arch) {
30903077 .avr => return 1,
30913078 .x86 => switch (target.os.tag) {
3092 .elfiamcu => switch (c_type) {
3093 .longlong, .ulonglong, .double => return 4,
3094 else => {},
3095 },
30963079 .windows, .uefi => switch (c_type) {
30973080 .longlong, .ulonglong, .double => return 8,
30983081 .longdouble => switch (target.abi) {
......@@ -3191,10 +3174,6 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
31913174 },
31923175 .avr => return 1,
31933176 .x86 => switch (target.os.tag) {
3194 .elfiamcu => switch (c_type) {
3195 .longlong, .ulonglong, .double, .longdouble => return 4,
3196 else => {},
3197 },
31983177 .windows, .uefi => switch (c_type) {
31993178 .longdouble => switch (target.abi) {
32003179 .gnu, .ilp32, .cygnus => return 4,
src/codegen/llvm.zig+23-28
......@@ -208,7 +208,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
208208 .opencl => "unknown", // https://llvm.org/docs/SPIRVUsage.html#target-triples
209209 .ps4 => "ps4",
210210 .ps5 => "ps5",
211 .elfiamcu => "elfiamcu",
212211 .mesa3d => "mesa3d",
213212 .amdpal => "amdpal",
214213 .hermit => "hermit",
......@@ -402,36 +401,32 @@ pub fn dataLayout(target: std.Target) []const u8 {
402401 "E-m:l-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
403402 else
404403 "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
405 .x86 => switch (target.os.tag) {
406 .elfiamcu => "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32",
407 .windows => switch (target.abi) {
408 .cygnus => "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32",
409 .gnu => if (target.ofmt == .coff)
410 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"
411 else
412 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32",
413 else => blk: {
414 const msvc = switch (target.abi) {
415 .none, .msvc => true,
416 else => false,
417 };
404 .x86 => if (target.os.tag == .windows) switch (target.abi) {
405 .cygnus => "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32",
406 .gnu => if (target.ofmt == .coff)
407 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"
408 else
409 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32",
410 else => blk: {
411 const msvc = switch (target.abi) {
412 .none, .msvc => true,
413 else => false,
414 };
418415
419 break :blk if (target.ofmt == .coff)
420 if (msvc)
421 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32"
422 else
423 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"
424 else if (msvc)
425 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32"
416 break :blk if (target.ofmt == .coff)
417 if (msvc)
418 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32"
426419 else
427 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32";
428 },
420 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"
421 else if (msvc)
422 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32"
423 else
424 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32";
429425 },
430 else => if (target.ofmt == .macho)
431 "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128"
432 else
433 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
434 },
426 } else if (target.ofmt == .macho)
427 "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128"
428 else
429 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
435430 .x86_64 => if (target.os.tag.isDarwin() or target.ofmt == .macho)
436431 "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
437432 else switch (target.abi) {
src/link/Elf.zig-1
......@@ -4174,7 +4174,6 @@ fn getLDMOption(target: std.Target) ?[]const u8 {
41744174 .s390x => "elf64_s390",
41754175 .sparc64 => "elf64_sparc",
41764176 .x86 => switch (target.os.tag) {
4177 .elfiamcu => "elf_iamcu",
41784177 .freebsd => "elf_i386_fbsd",
41794178 else => "elf_i386",
41804179 },
test/llvm_targets.zig-1
......@@ -292,7 +292,6 @@ const targets = [_]std.Target.Query{
292292 .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .musl },
293293 .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .none },
294294
295 .{ .cpu_arch = .x86, .os_tag = .elfiamcu, .abi = .none },
296295 .{ .cpu_arch = .x86, .os_tag = .freebsd, .abi = .none },
297296 .{ .cpu_arch = .x86, .os_tag = .freestanding, .abi = .none },
298297 .{ .cpu_arch = .x86, .os_tag = .haiku, .abi = .none },