authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-04 22:37:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-04 22:37:28-07:00
log46b2f67905e67bab1573f7b72536800bd8f6e669
treea06594e9f3bc9362ff2443f9482709504a38e6a2
parent0098e650fbceae74c8c468716c0810476f72ec47

update musl libc.S to v1.2.5

adds loongarch64 and riscv32

2 files changed, 79 insertions(+), 32 deletions(-)

lib/libc/musl/libc.S+23-14
...@@ -168,7 +168,7 @@ _IO_putc:...@@ -168,7 +168,7 @@ _IO_putc:
168.weak _IO_putc_unlocked168.weak _IO_putc_unlocked
169.type _IO_putc_unlocked, %function;169.type _IO_putc_unlocked, %function;
170_IO_putc_unlocked:170_IO_putc_unlocked:
171#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)171#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
172.globl ___tls_get_addr172.globl ___tls_get_addr
173.type ___tls_get_addr, %function;173.type ___tls_get_addr, %function;
174___tls_get_addr:174___tls_get_addr:
...@@ -187,7 +187,7 @@ __aio_suspend_time64:...@@ -187,7 +187,7 @@ __aio_suspend_time64:
187.globl __assert_fail187.globl __assert_fail
188.type __assert_fail, %function;188.type __assert_fail, %function;
189__assert_fail:189__assert_fail:
190#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)190#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
191.globl __cachectl191.globl __cachectl
192.type __cachectl, %function;192.type __cachectl, %function;
193__cachectl:193__cachectl:
...@@ -498,7 +498,7 @@ __localtime64:...@@ -498,7 +498,7 @@ __localtime64:
498.type __localtime64_r, %function;498.type __localtime64_r, %function;
499__localtime64_r:499__localtime64_r:
500#endif500#endif
501#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)501#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_loongarch64)
502.globl __longjmp502.globl __longjmp
503.type __longjmp, %function;503.type __longjmp, %function;
504__longjmp:504__longjmp:
...@@ -576,17 +576,17 @@ __recvmmsg_time64:...@@ -576,17 +576,17 @@ __recvmmsg_time64:
576.globl __res_state576.globl __res_state
577.type __res_state, %function;577.type __res_state, %function;
578__res_state:578__res_state:
579#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)579#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
580.globl __restore580.globl __restore
581.type __restore, %function;581.type __restore, %function;
582__restore:582__restore:
583#endif583#endif
584#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)584#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
585.globl __restore_rt585.globl __restore_rt
586.type __restore_rt, %function;586.type __restore_rt, %function;
587__restore_rt:587__restore_rt:
588#endif588#endif
589#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)589#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_loongarch64)
590.globl __riscv_flush_icache590.globl __riscv_flush_icache
591.type __riscv_flush_icache, %function;591.type __riscv_flush_icache, %function;
592__riscv_flush_icache:592__riscv_flush_icache:
...@@ -796,7 +796,7 @@ _dl_debug_state:...@@ -796,7 +796,7 @@ _dl_debug_state:
796.globl _dlstart796.globl _dlstart
797.type _dlstart, %function;797.type _dlstart, %function;
798_dlstart:798_dlstart:
799#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)799#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
800.globl _dlstart_data800.globl _dlstart_data
801.type _dlstart_data, %function;801.type _dlstart_data, %function;
802_dlstart_data:802_dlstart_data:
...@@ -807,7 +807,7 @@ _exit:...@@ -807,7 +807,7 @@ _exit:
807.weak _fini807.weak _fini
808.type _fini, %function;808.type _fini, %function;
809_fini:809_fini:
810#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)810#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
811.globl _flush_cache811.globl _flush_cache
812.type _flush_cache, %function;812.type _flush_cache, %function;
813_flush_cache:813_flush_cache:
...@@ -908,7 +908,7 @@ aligned_alloc:...@@ -908,7 +908,7 @@ aligned_alloc:
908.globl alphasort908.globl alphasort
909.type alphasort, %function;909.type alphasort, %function;
910alphasort:910alphasort:
911#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)911#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
912.globl arch_prctl912.globl arch_prctl
913.type arch_prctl, %function;913.type arch_prctl, %function;
914arch_prctl:914arch_prctl:
...@@ -1033,12 +1033,12 @@ cabsf:...@@ -1033,12 +1033,12 @@ cabsf:
1033.globl cabsl1033.globl cabsl
1034.type cabsl, %function;1034.type cabsl, %function;
1035cabsl:1035cabsl:
1036#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)1036#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
1037.weak cachectl1037.weak cachectl
1038.type cachectl, %function;1038.type cachectl, %function;
1039cachectl:1039cachectl:
1040#endif1040#endif
1041#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)1041#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
1042.weak cacheflush1042.weak cacheflush
1043.type cacheflush, %function;1043.type cacheflush, %function;
1044cacheflush:1044cacheflush:
...@@ -2549,12 +2549,12 @@ insque:...@@ -2549,12 +2549,12 @@ insque:
2549.globl ioctl2549.globl ioctl
2550.type ioctl, %function;2550.type ioctl, %function;
2551ioctl:2551ioctl:
2552#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)2552#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
2553.globl ioperm2553.globl ioperm
2554.type ioperm, %function;2554.type ioperm, %function;
2555ioperm:2555ioperm:
2556#endif2556#endif
2557#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)2557#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
2558.globl iopl2558.globl iopl
2559.type iopl, %function;2559.type iopl, %function;
2560iopl:2560iopl:
...@@ -3435,6 +3435,9 @@ pread:...@@ -3435,6 +3435,9 @@ pread:
3435.globl preadv3435.globl preadv
3436.type preadv, %function;3436.type preadv, %function;
3437preadv:3437preadv:
3438.globl preadv2
3439.type preadv2, %function;
3440preadv2:
3438.globl printf3441.globl printf
3439.type printf, %function;3442.type printf, %function;
3440printf:3443printf:
...@@ -3840,6 +3843,9 @@ pwrite:...@@ -3840,6 +3843,9 @@ pwrite:
3840.globl pwritev3843.globl pwritev
3841.type pwritev, %function;3844.type pwritev, %function;
3842pwritev:3845pwritev:
3846.globl pwritev2
3847.type pwritev2, %function;
3848pwritev2:
3843.globl qsort3849.globl qsort
3844.type qsort, %function;3850.type qsort, %function;
3845qsort:3851qsort:
...@@ -3993,7 +3999,7 @@ rintf:...@@ -3993,7 +3999,7 @@ rintf:
3993.globl rintl3999.globl rintl
3994.type rintl, %function;4000.type rintl, %function;
3995rintl:4001rintl:
3996#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)4002#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_loongarch64)
3997.weak riscv_flush_icache4003.weak riscv_flush_icache
3998.type riscv_flush_icache, %function;4004.type riscv_flush_icache, %function;
3999riscv_flush_icache:4005riscv_flush_icache:
...@@ -4463,6 +4469,9 @@ statfs:...@@ -4463,6 +4469,9 @@ statfs:
4463.globl statvfs4469.globl statvfs
4464.type statvfs, %function;4470.type statvfs, %function;
4465statvfs:4471statvfs:
4472.globl statx
4473.type statx, %function;
4474statx:
4466.globl stime4475.globl stime
4467.type stime, %function;4476.type stime, %function;
4468stime:4477stime:
tools/gen_stubs.zig+56-18
...@@ -30,7 +30,9 @@ const elf = std.elf;...@@ -30,7 +30,9 @@ const elf = std.elf;
30const native_endian = @import("builtin").target.cpu.arch.endian();30const native_endian = @import("builtin").target.cpu.arch.endian();
3131
32const inputs = .{32const inputs = .{
33 .riscv32,
33 .riscv64,34 .riscv64,
35 .loongarch64,
34 .mips,36 .mips,
35 .mips64,37 .mips64,
36 .x86,38 .x86,
...@@ -581,15 +583,17 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)...@@ -581,15 +583,17 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
581fn archIndex(arch: std.Target.Cpu.Arch) u8 {583fn archIndex(arch: std.Target.Cpu.Arch) u8 {
582 return switch (arch) {584 return switch (arch) {
583 // zig fmt: off585 // zig fmt: off
584 .riscv64 => 0,586 .riscv64 => 0,
585 .mips => 1,587 .mips => 1,
586 .mips64 => 2,588 .mips64 => 2,
587 .x86 => 3,589 .x86 => 3,
588 .x86_64 => 4,590 .x86_64 => 4,
589 .powerpc => 5,591 .powerpc => 5,
590 .powerpc64 => 6,592 .powerpc64 => 6,
591 .aarch64 => 7,593 .aarch64 => 7,
592 else => unreachable,594 .riscv32 => 8,
595 .loongarch64 => 9,
596 else => unreachable,
593 // zig fmt: on597 // zig fmt: on
594 };598 };
595}599}
...@@ -597,15 +601,17 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {...@@ -597,15 +601,17 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {
597fn archMuslName(arch: std.Target.Cpu.Arch) []const u8 {601fn archMuslName(arch: std.Target.Cpu.Arch) []const u8 {
598 return switch (arch) {602 return switch (arch) {
599 // zig fmt: off603 // zig fmt: off
600 .riscv64 => "riscv64",604 .riscv64 => "riscv64",
601 .mips => "mips",605 .mips => "mips",
602 .mips64 => "mips64",606 .mips64 => "mips64",
603 .x86 => "i386",607 .x86 => "i386",
604 .x86_64 => "x86_64",608 .x86_64 => "x86_64",
605 .powerpc => "powerpc",609 .powerpc => "powerpc",
606 .powerpc64 => "powerpc64",610 .powerpc64 => "powerpc64",
607 .aarch64 => "aarch64",611 .aarch64 => "aarch64",
608 else => unreachable,612 .riscv32 => "riscv32",
613 .loongarch64 => "loongarch64",
614 else => unreachable,
609 // zig fmt: on615 // zig fmt: on
610 };616 };
611}617}
...@@ -693,6 +699,7 @@ const blacklisted_symbols = [_][]const u8{...@@ -693,6 +699,7 @@ const blacklisted_symbols = [_][]const u8{
693 "__ceilx",699 "__ceilx",
694 "__clear_cache",700 "__clear_cache",
695 "__clzdi2",701 "__clzdi2",
702 "__chk_fail",
696 "__clzsi2",703 "__clzsi2",
697 "__clzti2",704 "__clzti2",
698 "__cmpdf2",705 "__cmpdf2",
...@@ -844,6 +851,10 @@ const blacklisted_symbols = [_][]const u8{...@@ -844,6 +851,10 @@ const blacklisted_symbols = [_][]const u8{
844 "__ltsf2",851 "__ltsf2",
845 "__lttf2",852 "__lttf2",
846 "__ltxf2",853 "__ltxf2",
854 "__memcpy_chk",
855 "__memmove_chk",
856 "__memset",
857 "__memset_chk",
847 "__moddi3",858 "__moddi3",
848 "__modsi3",859 "__modsi3",
849 "__modti3",860 "__modti3",
...@@ -896,6 +907,10 @@ const blacklisted_symbols = [_][]const u8{...@@ -896,6 +907,10 @@ const blacklisted_symbols = [_][]const u8{
896 "__sinx",907 "__sinx",
897 "__sqrth",908 "__sqrth",
898 "__sqrtx",909 "__sqrtx",
910 "__strcat_chk",
911 "__strcpy_chk",
912 "__strncat_chk",
913 "__strncpy_chk",
899 "__subdf3",914 "__subdf3",
900 "__subkf3",915 "__subkf3",
901 "__subodi4",916 "__subodi4",
...@@ -940,24 +955,47 @@ const blacklisted_symbols = [_][]const u8{...@@ -940,24 +955,47 @@ const blacklisted_symbols = [_][]const u8{
940 "__unordtf2",955 "__unordtf2",
941 "__zig_probe_stack",956 "__zig_probe_stack",
942 "ceilf128",957 "ceilf128",
958 "ceilq",
943 "cosf128",959 "cosf128",
960 "cosq",
944 "exp2f128",961 "exp2f128",
962 "exp2q",
945 "expf128",963 "expf128",
964 "expq",
946 "fabsf128",965 "fabsf128",
966 "fabsq",
967 "fabsq.2",
968 "fabsq.3",
947 "floorf128",969 "floorf128",
970 "floorq",
948 "fmaf128",971 "fmaf128",
949 "fmaq",972 "fmaq",
950 "fmaxf128",973 "fmaxf128",
974 "fmaxq",
975 "fmaxq.2",
976 "fmaxq.3",
951 "fminf128",977 "fminf128",
978 "fminq",
952 "fmodf128",979 "fmodf128",
980 "fmodq",
953 "log10f128",981 "log10f128",
982 "log10q",
954 "log2f128",983 "log2f128",
984 "log2q",
955 "logf128",985 "logf128",
986 "logq",
956 "roundf128",987 "roundf128",
988 "roundq",
957 "sincosf128",989 "sincosf128",
990 "sincosq",
958 "sinf128",991 "sinf128",
992 "sinq",
959 "sqrtf128",993 "sqrtf128",
994 "sqrtq",
995 "tanf128",
996 "tanq",
960 "truncf128",997 "truncf128",
998 "truncq",
961 "__aarch64_cas16_acq",999 "__aarch64_cas16_acq",
962 "__aarch64_cas16_acq_rel",1000 "__aarch64_cas16_acq_rel",
963 "__aarch64_cas16_rel",1001 "__aarch64_cas16_rel",