authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-20 03:43:03+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-23 09:27:17+02:00
logee72f06f47055ecf3fa650eae9ef49446745f509
treea97f16c8d6e40b487be730c32f8aca43445b5c3f
parentc55e83eab1369373fe6db5072802c2fc1c4d7ebc
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: add tags and info for alpha, hppa, microblaze, sh


8 files changed, 561 insertions(+), 8 deletions(-)

lib/std/Target.zig+153-5
......@@ -733,6 +733,7 @@ pub const Os = struct {
733733};
734734
735735pub const aarch64 = @import("Target/aarch64.zig");
736pub const alpha = @import("Target/generic.zig");
736737pub const amdgcn = @import("Target/amdgcn.zig");
737738pub const arc = @import("Target/arc.zig");
738739pub const arm = @import("Target/arm.zig");
......@@ -740,10 +741,12 @@ pub const avr = @import("Target/avr.zig");
740741pub const bpf = @import("Target/bpf.zig");
741742pub const csky = @import("Target/csky.zig");
742743pub const hexagon = @import("Target/hexagon.zig");
744pub const hppa = @import("Target/generic.zig");
743745pub const kalimba = @import("Target/generic.zig");
744746pub const lanai = @import("Target/lanai.zig");
745747pub const loongarch = @import("Target/loongarch.zig");
746748pub const m68k = @import("Target/m68k.zig");
749pub const microblaze = @import("Target/generic.zig");
747750pub const mips = @import("Target/mips.zig");
748751pub const msp430 = @import("Target/msp430.zig");
749752pub const nvptx = @import("Target/nvptx.zig");
......@@ -752,6 +755,7 @@ pub const powerpc = @import("Target/powerpc.zig");
752755pub const propeller = @import("Target/propeller.zig");
753756pub const riscv = @import("Target/riscv.zig");
754757pub const s390x = @import("Target/s390x.zig");
758pub const sh = @import("Target/generic.zig");
755759pub const sparc = @import("Target/sparc.zig");
756760pub const spirv = @import("Target/spirv.zig");
757761pub const ve = @import("Target/ve.zig");
......@@ -826,10 +830,13 @@ pub const Abi = enum {
826830 .arm,
827831 .armeb,
828832 .csky,
833 .hppa,
829834 .mips,
830835 .mipsel,
831836 .powerpc,
832837 .powerpcle,
838 .sh,
839 .sheb,
833840 .thumb,
834841 .thumbeb,
835842 => .eabi,
......@@ -864,6 +871,10 @@ pub const Abi = enum {
864871 => .gnu,
865872 .csky,
866873 => .gnueabi,
874 .hppa,
875 .sh,
876 .sheb,
877 => .gnueabihf,
867878
868879 // No glibc or musl support.
869880 .xtensa,
......@@ -1064,6 +1075,7 @@ pub const ObjectFormat = enum {
10641075pub fn toElfMachine(target: *const Target) std.elf.EM {
10651076 return switch (target.cpu.arch) {
10661077 .aarch64, .aarch64_be => .AARCH64,
1078 .alpha => .ALPHA,
10671079 .amdgcn => .AMDGPU,
10681080 .arc, .arceb => .ARC_COMPACT,
10691081 .arm, .armeb, .thumb, .thumbeb => .ARM,
......@@ -1071,10 +1083,12 @@ pub fn toElfMachine(target: *const Target) std.elf.EM {
10711083 .bpfeb, .bpfel => .BPF,
10721084 .csky => .CSKY,
10731085 .hexagon => .QDSP6,
1086 .hppa, .hppa64 => .PARISC,
10741087 .kalimba => .CSR_KALIMBA,
10751088 .lanai => .LANAI,
10761089 .loongarch32, .loongarch64 => .LOONGARCH,
10771090 .m68k => .@"68K",
1091 .microblaze, .microblazeel => .MICROBLAZE,
10781092 .mips, .mips64, .mipsel, .mips64el => .MIPS,
10791093 .msp430 => .MSP430,
10801094 .or1k => .OR1K,
......@@ -1083,6 +1097,7 @@ pub fn toElfMachine(target: *const Target) std.elf.EM {
10831097 .propeller => .PROPELLER,
10841098 .riscv32, .riscv32be, .riscv64, .riscv64be => .RISCV,
10851099 .s390x => .S390,
1100 .sh, .sheb => .SH,
10861101 .sparc => if (target.cpu.has(.sparc, .v9)) .SPARC32PLUS else .SPARC,
10871102 .sparc64 => .SPARCV9,
10881103 .ve => .VE,
......@@ -1103,6 +1118,7 @@ pub fn toElfMachine(target: *const Target) std.elf.EM {
11031118
11041119pub fn toCoffMachine(target: *const Target) std.coff.IMAGE.FILE.MACHINE {
11051120 return switch (target.cpu.arch) {
1121 .alpha => .ALPHA64,
11061122 .arm => .ARM,
11071123 .thumb => .ARMNT,
11081124 .aarch64 => .ARM64,
......@@ -1114,6 +1130,7 @@ pub fn toCoffMachine(target: *const Target) std.coff.IMAGE.FILE.MACHINE {
11141130 .powerpcle => .POWERPC,
11151131 .riscv32 => .RISCV32,
11161132 .riscv64 => .RISCV64,
1133 .sh => .SH3,
11171134 .x86 => .I386,
11181135 .x86_64 => .AMD64,
11191136
......@@ -1127,9 +1144,13 @@ pub fn toCoffMachine(target: *const Target) std.coff.IMAGE.FILE.MACHINE {
11271144 .bpfel,
11281145 .csky,
11291146 .hexagon,
1147 .hppa,
1148 .hppa64,
11301149 .kalimba,
11311150 .lanai,
11321151 .m68k,
1152 .microblaze,
1153 .microblazeel,
11331154 .mips64,
11341155 .msp430,
11351156 .nvptx,
......@@ -1142,6 +1163,7 @@ pub fn toCoffMachine(target: *const Target) std.coff.IMAGE.FILE.MACHINE {
11421163 .riscv32be,
11431164 .riscv64be,
11441165 .s390x,
1166 .sheb,
11451167 .sparc,
11461168 .sparc64,
11471169 .spirv32,
......@@ -1323,6 +1345,7 @@ pub const Cpu = struct {
13231345 pub const Arch = enum {
13241346 aarch64,
13251347 aarch64_be,
1348 alpha,
13261349 amdgcn,
13271350 arc,
13281351 arceb,
......@@ -1333,11 +1356,15 @@ pub const Cpu = struct {
13331356 bpfel,
13341357 csky,
13351358 hexagon,
1359 hppa,
1360 hppa64,
13361361 kalimba,
13371362 lanai,
13381363 loongarch32,
13391364 loongarch64,
13401365 m68k,
1366 microblaze,
1367 microblazeel,
13411368 mips,
13421369 mipsel,
13431370 mips64,
......@@ -1356,6 +1383,8 @@ pub const Cpu = struct {
13561383 riscv64,
13571384 riscv64be,
13581385 s390x,
1386 sh,
1387 sheb,
13591388 sparc,
13601389 sparc64,
13611390 spirv32,
......@@ -1393,18 +1422,21 @@ pub const Cpu = struct {
13931422 /// For a given family tag, it is guaranteed that an `std.Target.<tag>` namespace exists
13941423 /// containing CPU model and feature data.
13951424 pub const Family = enum {
1425 aarch64,
1426 alpha,
13961427 amdgcn,
13971428 arc,
13981429 arm,
1399 aarch64,
14001430 avr,
14011431 bpf,
14021432 csky,
14031433 hexagon,
1434 hppa,
14041435 kalimba,
14051436 lanai,
14061437 loongarch,
14071438 m68k,
1439 microblaze,
14081440 mips,
14091441 msp430,
14101442 nvptx,
......@@ -1413,6 +1445,7 @@ pub const Cpu = struct {
14131445 propeller,
14141446 riscv,
14151447 s390x,
1448 sh,
14161449 sparc,
14171450 spirv,
14181451 ve,
......@@ -1425,6 +1458,7 @@ pub const Cpu = struct {
14251458 pub inline fn family(arch: Arch) Family {
14261459 return switch (arch) {
14271460 .aarch64, .aarch64_be => .aarch64,
1461 .alpha => .alpha,
14281462 .amdgcn => .amdgcn,
14291463 .arc, .arceb => .arc,
14301464 .arm, .armeb, .thumb, .thumbeb => .arm,
......@@ -1432,10 +1466,12 @@ pub const Cpu = struct {
14321466 .bpfeb, .bpfel => .bpf,
14331467 .csky => .csky,
14341468 .hexagon => .hexagon,
1469 .hppa, .hppa64 => .hppa,
14351470 .kalimba => .kalimba,
14361471 .lanai => .lanai,
14371472 .loongarch32, .loongarch64 => .loongarch,
14381473 .m68k => .m68k,
1474 .microblaze, .microblazeel => .microblaze,
14391475 .mips, .mipsel, .mips64, .mips64el => .mips,
14401476 .msp430 => .msp430,
14411477 .or1k => .or1k,
......@@ -1444,6 +1480,7 @@ pub const Cpu = struct {
14441480 .propeller => .propeller,
14451481 .riscv32, .riscv32be, .riscv64, .riscv64be => .riscv,
14461482 .s390x => .s390x,
1483 .sh, .sheb => .sh,
14471484 .sparc, .sparc64 => .sparc,
14481485 .spirv32, .spirv64 => .spirv,
14491486 .ve => .ve,
......@@ -1490,6 +1527,13 @@ pub const Cpu = struct {
14901527 };
14911528 }
14921529
1530 pub inline fn isHppa(arch: Arch) bool {
1531 return switch (arch) {
1532 .hppa, .hppa64 => true,
1533 else => false,
1534 };
1535 }
1536
14931537 pub inline fn isWasm(arch: Arch) bool {
14941538 return switch (arch) {
14951539 .wasm32, .wasm64 => true,
......@@ -1522,6 +1566,13 @@ pub const Cpu = struct {
15221566 };
15231567 }
15241568
1569 pub inline fn isMicroblaze(arch: Arch) bool {
1570 return switch (arch) {
1571 .microblaze, .microblazeel => true,
1572 else => false,
1573 };
1574 }
1575
15251576 pub inline fn isMIPS(arch: Arch) bool {
15261577 return arch.isMIPS32() or arch.isMIPS64();
15271578 }
......@@ -1572,6 +1623,13 @@ pub const Cpu = struct {
15721623 };
15731624 }
15741625
1626 pub inline fn isSh(arch: Arch) bool {
1627 return switch (arch) {
1628 .sh, .sheb => true,
1629 else => false,
1630 };
1631 }
1632
15751633 pub inline fn isBpf(arch: Arch) bool {
15761634 return switch (arch) {
15771635 .bpfel, .bpfeb => true,
......@@ -1605,6 +1663,7 @@ pub const Cpu = struct {
16051663 pub fn endian(arch: Arch) std.builtin.Endian {
16061664 return switch (arch) {
16071665 .aarch64,
1666 .alpha,
16081667 .arm,
16091668 .arc,
16101669 .avr,
......@@ -1614,6 +1673,7 @@ pub const Cpu = struct {
16141673 .kalimba,
16151674 .loongarch32,
16161675 .loongarch64,
1676 .microblazeel,
16171677 .mipsel,
16181678 .mips64el,
16191679 .msp430,
......@@ -1622,6 +1682,7 @@ pub const Cpu = struct {
16221682 .propeller,
16231683 .riscv32,
16241684 .riscv64,
1685 .sh,
16251686 .thumb,
16261687 .ve,
16271688 .wasm32,
......@@ -1636,8 +1697,11 @@ pub const Cpu = struct {
16361697 .arceb,
16371698 .armeb,
16381699 .bpfeb,
1700 .hppa,
1701 .hppa64,
16391702 .lanai,
16401703 .m68k,
1704 .microblaze,
16411705 .mips,
16421706 .mips64,
16431707 .or1k,
......@@ -1646,6 +1710,7 @@ pub const Cpu = struct {
16461710 .riscv32be,
16471711 .riscv64be,
16481712 .s390x,
1713 .sheb,
16491714 .thumbeb,
16501715 .sparc,
16511716 .sparc64,
......@@ -1748,6 +1813,9 @@ pub const Cpu = struct {
17481813 .aarch64_vfabi_sve,
17491814 => &.{ .aarch64, .aarch64_be },
17501815
1816 .alpha_osf,
1817 => &.{.alpha},
1818
17511819 .arm_aapcs,
17521820 .arm_aapcs_vfp,
17531821 .arm_interrupt,
......@@ -1813,6 +1881,12 @@ pub const Cpu = struct {
18131881 .hexagon_sysv_hvx,
18141882 => &.{.hexagon},
18151883
1884 .hppa_elf,
1885 => &.{.hppa},
1886
1887 .hppa64_elf,
1888 => &.{.hppa64},
1889
18161890 .lanai_sysv,
18171891 => &.{.lanai},
18181892
......@@ -1828,6 +1902,9 @@ pub const Cpu = struct {
18281902 .m68k_interrupt,
18291903 => &.{.m68k},
18301904
1905 .microblaze_std,
1906 => &.{ .microblaze, .microblazeel },
1907
18311908 .msp430_eabi,
18321909 => &.{.msp430},
18331910
......@@ -1841,6 +1918,10 @@ pub const Cpu = struct {
18411918 .s390x_sysv_vx,
18421919 => &.{.s390x},
18431920
1921 .sh_gnu,
1922 .sh_renesas,
1923 => &.{ .sh, .sheb },
1924
18441925 .ve_sysv,
18451926 => &.{.ve},
18461927
......@@ -2384,6 +2465,8 @@ pub const DynamicLinker = struct {
23842465 .aarch64_be,
23852466 .hexagon,
23862467 .m68k,
2468 .microblaze,
2469 .microblazeel,
23872470 .powerpc64,
23882471 .powerpc64le,
23892472 .s390x,
......@@ -2419,6 +2502,17 @@ pub const DynamicLinker = struct {
24192502 else => return none,
24202503 }}),
24212504
2505 .sh,
2506 .sheb,
2507 => |arch| initFmt("/lib/ld-musl-{t}{s}.so.1", .{
2508 arch,
2509 switch (abi) {
2510 .musleabi => "-nofpu",
2511 .musleabihf => "",
2512 else => return none,
2513 },
2514 }),
2515
24222516 .riscv32,
24232517 .riscv64,
24242518 => |arch| if (abi == .musl) initFmt("/lib/ld-musl-{s}{s}.so.1", .{
......@@ -2432,6 +2526,7 @@ pub const DynamicLinker = struct {
24322526 }) else none,
24332527
24342528 .x86 => if (abi == .musl) init("/lib/ld-musl-i386.so.1") else none,
2529
24352530 .x86_64 => initFmt("/lib/ld-musl-{s}.so.1", .{switch (abi) {
24362531 .musl => "x86_64",
24372532 .muslx32 => "x32",
......@@ -2475,7 +2570,10 @@ pub const DynamicLinker = struct {
24752570 else => return none,
24762571 }}),
24772572
2573 .hppa,
24782574 .m68k,
2575 .microblaze,
2576 .microblazeel,
24792577 .xtensa,
24802578 .xtensaeb,
24812579 => if (abi == .gnu) init("/lib/ld.so.1") else none,
......@@ -2531,10 +2629,22 @@ pub const DynamicLinker = struct {
25312629
25322630 .s390x => if (abi == .gnu) init("/lib/ld64.so.1") else none,
25332631
2534 .sparc => if (abi == .gnu) init("/lib/ld-linux.so.2") else none,
2632 .sh,
2633 .sheb,
2634 => switch (abi) {
2635 .gnueabi,
2636 .gnueabihf,
2637 => init("/lib/ld-linux.so.2"),
2638 else => none,
2639 },
2640
2641 .alpha,
2642 .sparc,
2643 .x86,
2644 => if (abi == .gnu) init("/lib/ld-linux.so.2") else none,
2645
25352646 .sparc64 => if (abi == .gnu) init("/lib64/ld-linux.so.2") else none,
25362647
2537 .x86 => if (abi == .gnu) init("/lib/ld-linux.so.2") else none,
25382648 .x86_64 => switch (abi) {
25392649 .gnu => init("/lib64/ld-linux-x86-64.so.2"),
25402650 .gnux32 => init("/libx32/ld-linux-x32.so.2"),
......@@ -2712,10 +2822,13 @@ pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
27122822 .armeb,
27132823 .csky,
27142824 .hexagon,
2825 .hppa,
27152826 .kalimba,
27162827 .lanai,
27172828 .loongarch32,
27182829 .m68k,
2830 .microblaze,
2831 .microblazeel,
27192832 .mips,
27202833 .mipsel,
27212834 .nvptx,
......@@ -2725,6 +2838,8 @@ pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
27252838 .propeller,
27262839 .riscv32,
27272840 .riscv32be,
2841 .sh,
2842 .sheb,
27282843 .sparc,
27292844 .spirv32,
27302845 .thumb,
......@@ -2738,9 +2853,11 @@ pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
27382853
27392854 .aarch64,
27402855 .aarch64_be,
2856 .alpha,
27412857 .amdgcn,
27422858 .bpfeb,
27432859 .bpfel,
2860 .hppa64,
27442861 .loongarch64,
27452862 .mips64,
27462863 .mips64el,
......@@ -2772,17 +2889,20 @@ pub fn stackAlignment(target: *const Target) u16 {
27722889 => return 4,
27732890 .arm,
27742891 .armeb,
2775 .thumb,
2776 .thumbeb,
2892 .hppa,
27772893 .lanai,
27782894 .mips,
27792895 .mipsel,
27802896 .sparc,
2897 .thumb,
2898 .thumbeb,
27812899 => return 8,
27822900 .aarch64,
27832901 .aarch64_be,
2902 .alpha,
27842903 .bpfeb,
27852904 .bpfel,
2905 .hppa64,
27862906 .loongarch32,
27872907 .loongarch64,
27882908 .mips64,
......@@ -2950,6 +3070,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
29503070 else => return 128,
29513071 },
29523072
3073 .alpha,
29533074 .riscv32,
29543075 .riscv32be,
29553076 .riscv64,
......@@ -3059,6 +3180,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
30593180 },
30603181 },
30613182
3183 .alpha,
30623184 .riscv32,
30633185 .riscv32be,
30643186 .riscv64,
......@@ -3251,8 +3373,12 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
32513373 .arceb,
32523374 .csky,
32533375 .kalimba,
3376 .microblaze,
3377 .microblazeel,
32543378 .or1k,
32553379 .propeller,
3380 .sh,
3381 .sheb,
32563382 .x86,
32573383 .xcore,
32583384 .xtensa,
......@@ -3265,6 +3391,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
32653391 .bpfeb,
32663392 .bpfel,
32673393 .hexagon,
3394 .hppa,
32683395 .lanai,
32693396 .m68k,
32703397 .mips,
......@@ -3279,6 +3406,8 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
32793406
32803407 .aarch64,
32813408 .aarch64_be,
3409 .alpha,
3410 .hppa64,
32823411 .loongarch32,
32833412 .loongarch64,
32843413 .mips64,
......@@ -3351,8 +3480,12 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
33513480 .arceb,
33523481 .csky,
33533482 .kalimba,
3483 .microblaze,
3484 .microblazeel,
33543485 .or1k,
33553486 .propeller,
3487 .sh,
3488 .sheb,
33563489 .xcore,
33573490 .xtensa,
33583491 .xtensaeb,
......@@ -3364,6 +3497,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
33643497 .bpfeb,
33653498 .bpfel,
33663499 .hexagon,
3500 .hppa,
33673501 .lanai,
33683502 .m68k,
33693503 .mips,
......@@ -3379,6 +3513,8 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
33793513
33803514 .aarch64,
33813515 .aarch64_be,
3516 .alpha,
3517 .hppa64,
33823518 .loongarch32,
33833519 .loongarch64,
33843520 .mips64,
......@@ -3416,14 +3552,19 @@ pub fn cMaxIntAlignment(target: *const Target) u16 {
34163552 .arceb,
34173553 .csky,
34183554 .kalimba,
3555 .microblaze,
3556 .microblazeel,
34193557 .or1k,
34203558 .propeller,
3559 .sh,
3560 .sheb,
34213561 .xcore,
34223562 => 4,
34233563
34243564 .arm,
34253565 .armeb,
34263566 .hexagon,
3567 .hppa,
34273568 .lanai,
34283569 .loongarch32,
34293570 .m68k,
......@@ -3444,9 +3585,11 @@ pub fn cMaxIntAlignment(target: *const Target) u16 {
34443585
34453586 .aarch64,
34463587 .aarch64_be,
3588 .alpha,
34473589 .amdgcn,
34483590 .bpfel,
34493591 .bpfeb,
3592 .hppa64,
34503593 .loongarch64,
34513594 .mips64,
34523595 .mips64el,
......@@ -3483,6 +3626,7 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
34833626 .windows => .{ .aarch64_aapcs_win = .{} },
34843627 else => .{ .aarch64_aapcs = .{} },
34853628 },
3629 .alpha => .{ .alpha_osf = .{} },
34863630 .arm, .armeb, .thumb, .thumbeb => switch (target.abi.float()) {
34873631 .soft => .{ .arm_aapcs = .{} },
34883632 .hard => .{ .arm_aapcs_vfp = .{} },
......@@ -3511,6 +3655,8 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
35113655 .bpfel, .bpfeb => .{ .bpf_std = .{} },
35123656 .csky => .{ .csky_sysv = .{} },
35133657 .hexagon => .{ .hexagon_sysv = .{} },
3658 .hppa => .{ .hppa_elf = .{} },
3659 .hppa64 => .{ .hppa64_elf = .{} },
35143660 .kalimba => null,
35153661 .lanai => .{ .lanai_sysv = .{} },
35163662 .loongarch64 => .{ .loongarch64_lp64 = .{} },
......@@ -3519,10 +3665,12 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
35193665 .{ .m68k_gnu = .{} }
35203666 else
35213667 .{ .m68k_sysv = .{} },
3668 .microblaze, .microblazeel => .{ .microblaze_std = .{} },
35223669 .msp430 => .{ .msp430_eabi = .{} },
35233670 .or1k => .{ .or1k_sysv = .{} },
35243671 .propeller => .{ .propeller_sysv = .{} },
35253672 .s390x => .{ .s390x_sysv = .{} },
3673 .sh, .sheb => .{ .sh_gnu = .{} },
35263674 .ve => .{ .ve_sysv = .{} },
35273675 .xcore => .{ .xcore_xs1 = .{} },
35283676 .xtensa, .xtensaeb => .{ .xtensa_windowed = .{} },
lib/std/builtin.zig+39
......@@ -229,6 +229,9 @@ pub const CallingConvention = union(enum(u8)) {
229229 aarch64_vfabi: CommonOptions,
230230 aarch64_vfabi_sve: CommonOptions,
231231
232 /// The standard `alpha` calling convention.
233 alpha_osf: CommonOptions,
234
232235 // Calling convetions for the `arm`, `armeb`, `thumb`, and `thumbeb` architectures.
233236 /// ARM Architecture Procedure Call Standard
234237 arm_aapcs: CommonOptions,
......@@ -296,6 +299,12 @@ pub const CallingConvention = union(enum(u8)) {
296299 hexagon_sysv: CommonOptions,
297300 hexagon_sysv_hvx: CommonOptions,
298301
302 /// The standard `hppa` calling convention.
303 hppa_elf: CommonOptions,
304
305 /// The standard `hppa64` calling convention.
306 hppa64_elf: CommonOptions,
307
299308 /// The standard `lanai` calling convention.
300309 lanai_sysv: CommonOptions,
301310
......@@ -311,6 +320,9 @@ pub const CallingConvention = union(enum(u8)) {
311320 m68k_rtd: CommonOptions,
312321 m68k_interrupt: CommonOptions,
313322
323 /// The standard `microblaze`/`microblazeel` calling convention.
324 microblaze_std: CommonOptions,
325
314326 /// The standard `msp430` calling convention.
315327 msp430_eabi: CommonOptions,
316328
......@@ -324,6 +336,10 @@ pub const CallingConvention = union(enum(u8)) {
324336 s390x_sysv: CommonOptions,
325337 s390x_sysv_vx: CommonOptions,
326338
339 // Calling conventions for the `sh`/`sheb` architecture.
340 sh_gnu: CommonOptions,
341 sh_renesas: CommonOptions,
342
327343 /// The standard `ve` calling convention.
328344 ve_sysv: CommonOptions,
329345
......@@ -858,6 +874,13 @@ pub const VaListAarch64 = extern struct {
858874 __vr_offs: c_int,
859875};
860876
877/// This data structure is used by the Zig language code generation and
878/// therefore must be kept in sync with the compiler implementation.
879pub const VaListAlpha = extern struct {
880 __base: *anyopaque,
881 __offset: c_int,
882};
883
861884/// This data structure is used by the Zig language code generation and
862885/// therefore must be kept in sync with the compiler implementation.
863886pub const VaListArm = extern struct {
......@@ -891,6 +914,16 @@ pub const VaListS390x = extern struct {
891914 __overflow_area_pointer: *anyopaque,
892915};
893916
917/// This data structure is used by the Zig language code generation and
918/// therefore must be kept in sync with the compiler implementation.
919pub const VaListSh = extern struct {
920 __va_next_o: *anyopaque,
921 __va_next_o_limit: *anyopaque,
922 __va_next_fp: *anyopaque,
923 __va_next_fp_limit: *anyopaque,
924 __va_next_stack: *anyopaque,
925};
926
894927/// This data structure is used by the Zig language code generation and
895928/// therefore must be kept in sync with the compiler implementation.
896929pub const VaListX86_64 = extern struct {
......@@ -925,10 +958,14 @@ pub const VaList = switch (builtin.cpu.arch) {
925958 .bpfel,
926959 .bpfeb,
927960 .csky,
961 .hppa,
962 .hppa64,
928963 .lanai,
929964 .loongarch32,
930965 .loongarch64,
931966 .m68k,
967 .microblaze,
968 .microblazeel,
932969 .mips,
933970 .mipsel,
934971 .mips64,
......@@ -953,6 +990,7 @@ pub const VaList = switch (builtin.cpu.arch) {
953990 .stage2_llvm => @compileError("disabled due to miscompilations"),
954991 },
955992 },
993 .alpha => VaListAlpha,
956994 .arm, .armeb, .thumb, .thumbeb => VaListArm,
957995 .hexagon => if (builtin.target.abi.isMusl()) VaListHexagon else *u8,
958996 .powerpc, .powerpcle => switch (builtin.os.tag) {
......@@ -960,6 +998,7 @@ pub const VaList = switch (builtin.cpu.arch) {
960998 else => VaListPowerPc,
961999 },
9621000 .s390x => VaListS390x,
1001 .sh, .sheb => VaListSh, // This is wrong for `sh_renesas`: https://github.com/ziglang/zig/issues/24692#issuecomment-3150779829
9631002 .x86_64 => switch (builtin.os.tag) {
9641003 .uefi, .windows => switch (builtin.zig_backend) {
9651004 else => *u8,
lib/std/builtin/assembly.zig+315
......@@ -2197,6 +2197,321 @@ pub const Clobbers = switch (@import("builtin").cpu.arch) {
21972197 msa_map: bool = false,
21982198 msa_unmap: bool = false,
21992199 },
2200 .alpha => packed struct {
2201 /// Whether the inline assembly code may perform stores to memory
2202 /// addresses other than those derived from input pointer provenance.
2203 memory: bool = false,
2204
2205 r0: bool = false,
2206 r1: bool = false,
2207 r2: bool = false,
2208 r3: bool = false,
2209 r4: bool = false,
2210 r5: bool = false,
2211 r6: bool = false,
2212 r7: bool = false,
2213 r8: bool = false,
2214 r9: bool = false,
2215 r10: bool = false,
2216 r11: bool = false,
2217 r12: bool = false,
2218 r13: bool = false,
2219 r14: bool = false,
2220 r15: bool = false,
2221 r16: bool = false,
2222 r17: bool = false,
2223 r18: bool = false,
2224 r19: bool = false,
2225 r20: bool = false,
2226 r21: bool = false,
2227 r22: bool = false,
2228 r23: bool = false,
2229 r24: bool = false,
2230 r25: bool = false,
2231 r26: bool = false,
2232 r27: bool = false,
2233 r28: bool = false,
2234 r29: bool = false,
2235 r30: bool = false,
2236
2237 f0: bool = false,
2238 f1: bool = false,
2239 f2: bool = false,
2240 f3: bool = false,
2241 f4: bool = false,
2242 f5: bool = false,
2243 f6: bool = false,
2244 f7: bool = false,
2245 f8: bool = false,
2246 f9: bool = false,
2247 f10: bool = false,
2248 f11: bool = false,
2249 f12: bool = false,
2250 f13: bool = false,
2251 f14: bool = false,
2252 f15: bool = false,
2253 f16: bool = false,
2254 f17: bool = false,
2255 f18: bool = false,
2256 f19: bool = false,
2257 f20: bool = false,
2258 f21: bool = false,
2259 f22: bool = false,
2260 f23: bool = false,
2261 f24: bool = false,
2262 f25: bool = false,
2263 f26: bool = false,
2264 f27: bool = false,
2265 f28: bool = false,
2266 f29: bool = false,
2267 f30: bool = false,
2268 },
2269 .hppa, .hppa64 => packed struct {
2270 /// Whether the inline assembly code may perform stores to memory
2271 /// addresses other than those derived from input pointer provenance.
2272 memory: bool = false,
2273
2274 sar: bool = false,
2275
2276 r1: bool = false,
2277 r2: bool = false,
2278 r3: bool = false,
2279 r4: bool = false,
2280 r5: bool = false,
2281 r6: bool = false,
2282 r7: bool = false,
2283 r8: bool = false,
2284 r9: bool = false,
2285 r10: bool = false,
2286 r11: bool = false,
2287 r12: bool = false,
2288 r13: bool = false,
2289 r14: bool = false,
2290 r15: bool = false,
2291 r16: bool = false,
2292 r17: bool = false,
2293 r18: bool = false,
2294 r19: bool = false,
2295 r20: bool = false,
2296 r21: bool = false,
2297 r22: bool = false,
2298 r23: bool = false,
2299 r24: bool = false,
2300 r25: bool = false,
2301 r26: bool = false,
2302 r27: bool = false,
2303 r28: bool = false,
2304 r29: bool = false,
2305 r30: bool = false,
2306 r31: bool = false,
2307
2308 fr4: bool = false,
2309 fr5: bool = false,
2310 fr6: bool = false,
2311 fr7: bool = false,
2312 fr8: bool = false,
2313 fr9: bool = false,
2314 fr10: bool = false,
2315 fr11: bool = false,
2316 fr12: bool = false,
2317 fr13: bool = false,
2318 fr14: bool = false,
2319 fr15: bool = false,
2320 fr16: bool = false,
2321 fr17: bool = false,
2322 fr18: bool = false,
2323 fr19: bool = false,
2324 fr20: bool = false,
2325 fr21: bool = false,
2326 fr22: bool = false,
2327 fr23: bool = false,
2328 fr24: bool = false,
2329 fr25: bool = false,
2330 fr26: bool = false,
2331 fr27: bool = false,
2332 fr28: bool = false,
2333 fr29: bool = false,
2334 fr30: bool = false,
2335 fr31: bool = false,
2336
2337 fr4r: bool = false,
2338 fr5r: bool = false,
2339 fr6r: bool = false,
2340 fr7r: bool = false,
2341 fr8r: bool = false,
2342 fr9r: bool = false,
2343 fr10r: bool = false,
2344 fr11r: bool = false,
2345 fr12r: bool = false,
2346 fr13r: bool = false,
2347 fr14r: bool = false,
2348 fr15r: bool = false,
2349 fr16r: bool = false,
2350 fr17r: bool = false,
2351 fr18r: bool = false,
2352 fr19r: bool = false,
2353 fr20r: bool = false,
2354 fr21r: bool = false,
2355 fr22r: bool = false,
2356 fr23r: bool = false,
2357 fr24r: bool = false,
2358 fr25r: bool = false,
2359 fr26r: bool = false,
2360 fr27r: bool = false,
2361 fr28r: bool = false,
2362 fr29r: bool = false,
2363 fr30r: bool = false,
2364 fr31r: bool = false,
2365 },
2366 .microblaze, .microblazeel => packed struct {
2367 /// Whether the inline assembly code may perform stores to memory
2368 /// addresses other than those derived from input pointer provenance.
2369 memory: bool = false,
2370
2371 rmsr: bool = false,
2372
2373 r1: bool = false,
2374 r2: bool = false,
2375 r3: bool = false,
2376 r4: bool = false,
2377 r5: bool = false,
2378 r6: bool = false,
2379 r7: bool = false,
2380 r8: bool = false,
2381 r9: bool = false,
2382 r10: bool = false,
2383 r11: bool = false,
2384 r12: bool = false,
2385 r13: bool = false,
2386 r14: bool = false,
2387 r15: bool = false,
2388 r16: bool = false,
2389 r17: bool = false,
2390 r18: bool = false,
2391 r19: bool = false,
2392 r20: bool = false,
2393 r21: bool = false,
2394 r22: bool = false,
2395 r23: bool = false,
2396 r24: bool = false,
2397 r25: bool = false,
2398 r26: bool = false,
2399 r27: bool = false,
2400 r28: bool = false,
2401 r29: bool = false,
2402 r30: bool = false,
2403 r31: bool = false,
2404 },
2405 .sh, .sheb => packed struct {
2406 /// Whether the inline assembly code may perform stores to memory
2407 /// addresses other than those derived from input pointer provenance.
2408 memory: bool = false,
2409
2410 sr: bool = false,
2411 gbr: bool = false,
2412 pr: bool = false,
2413
2414 r0: bool = false,
2415 r1: bool = false,
2416 r2: bool = false,
2417 r3: bool = false,
2418 r4: bool = false,
2419 r5: bool = false,
2420 r6: bool = false,
2421 r7: bool = false,
2422 r8: bool = false,
2423 r9: bool = false,
2424 r10: bool = false,
2425 r11: bool = false,
2426 r12: bool = false,
2427 r13: bool = false,
2428 r14: bool = false,
2429 r15: bool = false,
2430
2431 mach: bool = false,
2432 macl: bool = false,
2433
2434 fr0: bool = false,
2435 fr1: bool = false,
2436 fr2: bool = false,
2437 fr3: bool = false,
2438 fr4: bool = false,
2439 fr5: bool = false,
2440 fr6: bool = false,
2441 fr7: bool = false,
2442 fr8: bool = false,
2443 fr9: bool = false,
2444 fr10: bool = false,
2445 fr11: bool = false,
2446 fr12: bool = false,
2447 fr13: bool = false,
2448 fr14: bool = false,
2449 fr15: bool = false,
2450
2451 dr0: bool = false,
2452 dr2: bool = false,
2453 dr4: bool = false,
2454 dr6: bool = false,
2455 dr8: bool = false,
2456 dr10: bool = false,
2457 dr12: bool = false,
2458 dr14: bool = false,
2459
2460 fv0: bool = false,
2461 fv4: bool = false,
2462 fv8: bool = false,
2463 fv12: bool = false,
2464
2465 xf0: bool = false,
2466 xf1: bool = false,
2467 xf2: bool = false,
2468 xf3: bool = false,
2469 xf4: bool = false,
2470 xf5: bool = false,
2471 xf6: bool = false,
2472 xf7: bool = false,
2473 xf8: bool = false,
2474 xf9: bool = false,
2475 xf10: bool = false,
2476 xf11: bool = false,
2477 xf12: bool = false,
2478 xf13: bool = false,
2479 xf14: bool = false,
2480 xf15: bool = false,
2481
2482 xd0: bool = false,
2483 xd2: bool = false,
2484 xd4: bool = false,
2485 xd6: bool = false,
2486 xd8: bool = false,
2487 xd10: bool = false,
2488 xd12: bool = false,
2489 xd14: bool = false,
2490
2491 xmtrx: bool = false,
2492
2493 fpul: bool = false,
2494 fpscr: bool = false,
2495
2496 ms: bool = false,
2497 me: bool = false,
2498
2499 rs: bool = false,
2500 re: bool = false,
2501
2502 a0: bool = false,
2503 a0g: bool = false,
2504 a1: bool = false,
2505 a1g: bool = false,
2506 m0: bool = false,
2507 m1: bool = false,
2508 x0: bool = false,
2509 x1: bool = false,
2510 y0: bool = false,
2511 y1: bool = false,
2512
2513 dsr: bool = false,
2514 },
22002515 else => packed struct {
22012516 /// Whether the inline assembly code may perform stores to memory
22022517 /// addresses other than those derived from input pointer provenance.
src/Sema.zig+6
......@@ -9043,8 +9043,10 @@ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention
90439043 .aarch64_aapcs_win,
90449044 .aarch64_vfabi,
90459045 .aarch64_vfabi_sve,
9046 .alpha_osf,
90469047 .arm_aapcs,
90479048 .arm_aapcs_vfp,
9049 .microblaze_std,
90489050 .mips64_n64,
90499051 .mips64_n32,
90509052 .mips_o32,
......@@ -9068,6 +9070,8 @@ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention
90689070 .csky_sysv,
90699071 .hexagon_sysv,
90709072 .hexagon_sysv_hvx,
9073 .hppa_elf,
9074 .hppa64_elf,
90719075 .lanai_sysv,
90729076 .loongarch64_lp64,
90739077 .loongarch32_ilp32,
......@@ -9078,6 +9082,8 @@ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention
90789082 .or1k_sysv,
90799083 .s390x_sysv,
90809084 .s390x_sysv_vx,
9085 .sh_gnu,
9086 .sh_renesas,
90819087 .ve_sysv,
90829088 .xcore_xs1,
90839089 .xcore_xs2,
src/codegen/c.zig+2
......@@ -8106,6 +8106,8 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8
81068106 inline else => |m| "interrupt(\"" ++ @tagName(m) ++ "\")",
81078107 },
81088108
8109 .sh_renesas => "renesas",
8110
81098111 .m68k_rtd => "m68k_rtd",
81108112
81118113 .avr_interrupt,
src/codegen/llvm.zig+27
......@@ -106,10 +106,17 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
106106 .wasm64 => "wasm64",
107107 .ve => "ve",
108108
109 .alpha,
109110 .arceb,
111 .hppa,
112 .hppa64,
110113 .kalimba,
114 .microblaze,
115 .microblazeel,
111116 .or1k,
112117 .propeller,
118 .sh,
119 .sheb,
113120 .xtensaeb,
114121 => unreachable, // Gated by hasLlvmSupport().
115122 };
......@@ -475,10 +482,17 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
475482 .loongarch64 => "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128",
476483 .xtensa => "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32",
477484
485 .alpha,
478486 .arceb,
487 .hppa,
488 .hppa64,
479489 .kalimba,
490 .microblaze,
491 .microblazeel,
480492 .or1k,
481493 .propeller,
494 .sh,
495 .sheb,
482496 .xtensaeb,
483497 => unreachable, // Gated by hasLlvmSupport().
484498 };
......@@ -11908,6 +11922,8 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s
1190811922 .aarch64_aapcs,
1190911923 .aarch64_aapcs_darwin,
1191011924 .aarch64_aapcs_win,
11925 .alpha_osf,
11926 .microblaze_std,
1191111927 .mips64_n64,
1191211928 .mips64_n32,
1191311929 .mips_o32,
......@@ -11930,6 +11946,8 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s
1193011946 .csky_sysv,
1193111947 .hexagon_sysv,
1193211948 .hexagon_sysv_hvx,
11949 .hppa_elf,
11950 .hppa64_elf,
1193311951 .lanai_sysv,
1193411952 .loongarch64_lp64,
1193511953 .loongarch32_ilp32,
......@@ -11940,6 +11958,8 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s
1194011958 .propeller_sysv,
1194111959 .s390x_sysv,
1194211960 .s390x_sysv_vx,
11961 .sh_gnu,
11962 .sh_renesas,
1194311963 .ve_sysv,
1194411964 .xcore_xs1,
1194511965 .xcore_xs2,
......@@ -13111,10 +13131,17 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {
1311113131 },
1311213132
1311313133 // LLVM does does not have a backend for these.
13134 .alpha,
1311413135 .arceb,
13136 .hppa,
13137 .hppa64,
1311513138 .kalimba,
13139 .microblaze,
13140 .microblazeel,
1311613141 .or1k,
1311713142 .propeller,
13143 .sh,
13144 .sheb,
1311813145 .xtensaeb,
1311913146 => unreachable,
1312013147 }
src/link/Dwarf.zig+2
......@@ -3905,6 +3905,8 @@ fn updateLazyType(
39053905
39063906 .m68k_rtd => .LLVM_M68kRTD,
39073907
3908 .sh_renesas => .GNU_renesas_sh,
3909
39083910 .amdgcn_kernel => .LLVM_OpenCLKernel,
39093911 .nvptx_kernel,
39103912 .spirv_kernel,
src/target.zig+17-3
......@@ -216,10 +216,17 @@ pub fn hasLlvmSupport(target: *const std.Target, ofmt: std.Target.ObjectFormat)
216216 => false,
217217
218218 // No LLVM backend exists.
219 .alpha,
219220 .arceb,
221 .hppa,
222 .hppa64,
220223 .kalimba,
224 .microblaze,
225 .microblazeel,
221226 .or1k,
222227 .propeller,
228 .sh,
229 .sheb,
223230 .xtensaeb,
224231 => false,
225232 };
......@@ -709,19 +716,26 @@ pub fn minFunctionAlignment(target: *const std.Target) Alignment {
709716 .csky,
710717 .m68k,
711718 .msp430,
719 .sh,
720 .sheb,
712721 .s390x,
713722 .xcore,
714723 => .@"2",
724 .aarch64,
725 .aarch64_be,
726 .alpha,
715727 .arc,
716728 .arceb,
717729 .arm,
718730 .armeb,
719 .aarch64,
720 .aarch64_be,
721731 .hexagon,
732 .hppa,
733 .hppa64,
722734 .lanai,
723735 .loongarch32,
724736 .loongarch64,
737 .microblaze,
738 .microblazeel,
725739 .mips,
726740 .mipsel,
727741 .powerpc,
......@@ -733,8 +747,8 @@ pub fn minFunctionAlignment(target: *const std.Target) Alignment {
733747 .xtensa,
734748 .xtensaeb,
735749 => .@"4",
736 .bpfel,
737750 .bpfeb,
751 .bpfel,
738752 .mips64,
739753 .mips64el,
740754 => .@"8",