update musl libc.S to v1.2.5

adds loongarch64 and riscv32
This commit is contained in:
Andrew Kelley 2024-06-04 22:37:28 -07:00
parent 0098e650fb
commit 46b2f67905
2 changed files with 79 additions and 32 deletions

37
lib/libc/musl/libc.S vendored
View file

@ -168,7 +168,7 @@ _IO_putc:
.weak _IO_putc_unlocked .weak _IO_putc_unlocked
.type _IO_putc_unlocked, %function; .type _IO_putc_unlocked, %function;
_IO_putc_unlocked: _IO_putc_unlocked:
#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl ___tls_get_addr .globl ___tls_get_addr
.type ___tls_get_addr, %function; .type ___tls_get_addr, %function;
___tls_get_addr: ___tls_get_addr:
@ -187,7 +187,7 @@ __aio_suspend_time64:
.globl __assert_fail .globl __assert_fail
.type __assert_fail, %function; .type __assert_fail, %function;
__assert_fail: __assert_fail:
#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl __cachectl .globl __cachectl
.type __cachectl, %function; .type __cachectl, %function;
__cachectl: __cachectl:
@ -498,7 +498,7 @@ __localtime64:
.type __localtime64_r, %function; .type __localtime64_r, %function;
__localtime64_r: __localtime64_r:
#endif #endif
#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl __longjmp .globl __longjmp
.type __longjmp, %function; .type __longjmp, %function;
__longjmp: __longjmp:
@ -576,17 +576,17 @@ __recvmmsg_time64:
.globl __res_state .globl __res_state
.type __res_state, %function; .type __res_state, %function;
__res_state: __res_state:
#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl __restore .globl __restore
.type __restore, %function; .type __restore, %function;
__restore: __restore:
#endif #endif
#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl __restore_rt .globl __restore_rt
.type __restore_rt, %function; .type __restore_rt, %function;
__restore_rt: __restore_rt:
#endif #endif
#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl __riscv_flush_icache .globl __riscv_flush_icache
.type __riscv_flush_icache, %function; .type __riscv_flush_icache, %function;
__riscv_flush_icache: __riscv_flush_icache:
@ -796,7 +796,7 @@ _dl_debug_state:
.globl _dlstart .globl _dlstart
.type _dlstart, %function; .type _dlstart, %function;
_dlstart: _dlstart:
#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl _dlstart_data .globl _dlstart_data
.type _dlstart_data, %function; .type _dlstart_data, %function;
_dlstart_data: _dlstart_data:
@ -807,7 +807,7 @@ _exit:
.weak _fini .weak _fini
.type _fini, %function; .type _fini, %function;
_fini: _fini:
#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl _flush_cache .globl _flush_cache
.type _flush_cache, %function; .type _flush_cache, %function;
_flush_cache: _flush_cache:
@ -908,7 +908,7 @@ aligned_alloc:
.globl alphasort .globl alphasort
.type alphasort, %function; .type alphasort, %function;
alphasort: alphasort:
#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.globl arch_prctl .globl arch_prctl
.type arch_prctl, %function; .type arch_prctl, %function;
arch_prctl: arch_prctl:
@ -1033,12 +1033,12 @@ cabsf:
.globl cabsl .globl cabsl
.type cabsl, %function; .type cabsl, %function;
cabsl: cabsl:
#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.weak cachectl .weak cachectl
.type cachectl, %function; .type cachectl, %function;
cachectl: cachectl:
#endif #endif
#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.weak cacheflush .weak cacheflush
.type cacheflush, %function; .type cacheflush, %function;
cacheflush: cacheflush:
@ -2549,12 +2549,12 @@ insque:
.globl ioctl .globl ioctl
.type ioctl, %function; .type ioctl, %function;
ioctl: ioctl:
#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) #if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
.globl ioperm .globl ioperm
.type ioperm, %function; .type ioperm, %function;
ioperm: ioperm:
#endif #endif
#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) #if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
.globl iopl .globl iopl
.type iopl, %function; .type iopl, %function;
iopl: iopl:
@ -3435,6 +3435,9 @@ pread:
.globl preadv .globl preadv
.type preadv, %function; .type preadv, %function;
preadv: preadv:
.globl preadv2
.type preadv2, %function;
preadv2:
.globl printf .globl printf
.type printf, %function; .type printf, %function;
printf: printf:
@ -3840,6 +3843,9 @@ pwrite:
.globl pwritev .globl pwritev
.type pwritev, %function; .type pwritev, %function;
pwritev: pwritev:
.globl pwritev2
.type pwritev2, %function;
pwritev2:
.globl qsort .globl qsort
.type qsort, %function; .type qsort, %function;
qsort: qsort:
@ -3993,7 +3999,7 @@ rintf:
.globl rintl .globl rintl
.type rintl, %function; .type rintl, %function;
rintl: rintl:
#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) #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)
.weak riscv_flush_icache .weak riscv_flush_icache
.type riscv_flush_icache, %function; .type riscv_flush_icache, %function;
riscv_flush_icache: riscv_flush_icache:
@ -4463,6 +4469,9 @@ statfs:
.globl statvfs .globl statvfs
.type statvfs, %function; .type statvfs, %function;
statvfs: statvfs:
.globl statx
.type statx, %function;
statx:
.globl stime .globl stime
.type stime, %function; .type stime, %function;
stime: stime:

View file

@ -30,7 +30,9 @@ const elf = std.elf;
const native_endian = @import("builtin").target.cpu.arch.endian(); const native_endian = @import("builtin").target.cpu.arch.endian();
const inputs = .{ const inputs = .{
.riscv32,
.riscv64, .riscv64,
.loongarch64,
.mips, .mips,
.mips64, .mips64,
.x86, .x86,
@ -581,15 +583,17 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
fn archIndex(arch: std.Target.Cpu.Arch) u8 { fn archIndex(arch: std.Target.Cpu.Arch) u8 {
return switch (arch) { return switch (arch) {
// zig fmt: off // zig fmt: off
.riscv64 => 0, .riscv64 => 0,
.mips => 1, .mips => 1,
.mips64 => 2, .mips64 => 2,
.x86 => 3, .x86 => 3,
.x86_64 => 4, .x86_64 => 4,
.powerpc => 5, .powerpc => 5,
.powerpc64 => 6, .powerpc64 => 6,
.aarch64 => 7, .aarch64 => 7,
else => unreachable, .riscv32 => 8,
.loongarch64 => 9,
else => unreachable,
// zig fmt: on // zig fmt: on
}; };
} }
@ -597,15 +601,17 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {
fn archMuslName(arch: std.Target.Cpu.Arch) []const u8 { fn archMuslName(arch: std.Target.Cpu.Arch) []const u8 {
return switch (arch) { return switch (arch) {
// zig fmt: off // zig fmt: off
.riscv64 => "riscv64", .riscv64 => "riscv64",
.mips => "mips", .mips => "mips",
.mips64 => "mips64", .mips64 => "mips64",
.x86 => "i386", .x86 => "i386",
.x86_64 => "x86_64", .x86_64 => "x86_64",
.powerpc => "powerpc", .powerpc => "powerpc",
.powerpc64 => "powerpc64", .powerpc64 => "powerpc64",
.aarch64 => "aarch64", .aarch64 => "aarch64",
else => unreachable, .riscv32 => "riscv32",
.loongarch64 => "loongarch64",
else => unreachable,
// zig fmt: on // zig fmt: on
}; };
} }
@ -693,6 +699,7 @@ const blacklisted_symbols = [_][]const u8{
"__ceilx", "__ceilx",
"__clear_cache", "__clear_cache",
"__clzdi2", "__clzdi2",
"__chk_fail",
"__clzsi2", "__clzsi2",
"__clzti2", "__clzti2",
"__cmpdf2", "__cmpdf2",
@ -844,6 +851,10 @@ const blacklisted_symbols = [_][]const u8{
"__ltsf2", "__ltsf2",
"__lttf2", "__lttf2",
"__ltxf2", "__ltxf2",
"__memcpy_chk",
"__memmove_chk",
"__memset",
"__memset_chk",
"__moddi3", "__moddi3",
"__modsi3", "__modsi3",
"__modti3", "__modti3",
@ -896,6 +907,10 @@ const blacklisted_symbols = [_][]const u8{
"__sinx", "__sinx",
"__sqrth", "__sqrth",
"__sqrtx", "__sqrtx",
"__strcat_chk",
"__strcpy_chk",
"__strncat_chk",
"__strncpy_chk",
"__subdf3", "__subdf3",
"__subkf3", "__subkf3",
"__subodi4", "__subodi4",
@ -940,24 +955,47 @@ const blacklisted_symbols = [_][]const u8{
"__unordtf2", "__unordtf2",
"__zig_probe_stack", "__zig_probe_stack",
"ceilf128", "ceilf128",
"ceilq",
"cosf128", "cosf128",
"cosq",
"exp2f128", "exp2f128",
"exp2q",
"expf128", "expf128",
"expq",
"fabsf128", "fabsf128",
"fabsq",
"fabsq.2",
"fabsq.3",
"floorf128", "floorf128",
"floorq",
"fmaf128", "fmaf128",
"fmaq", "fmaq",
"fmaxf128", "fmaxf128",
"fmaxq",
"fmaxq.2",
"fmaxq.3",
"fminf128", "fminf128",
"fminq",
"fmodf128", "fmodf128",
"fmodq",
"log10f128", "log10f128",
"log10q",
"log2f128", "log2f128",
"log2q",
"logf128", "logf128",
"logq",
"roundf128", "roundf128",
"roundq",
"sincosf128", "sincosf128",
"sincosq",
"sinf128", "sinf128",
"sinq",
"sqrtf128", "sqrtf128",
"sqrtq",
"tanf128",
"tanq",
"truncf128", "truncf128",
"truncq",
"__aarch64_cas16_acq", "__aarch64_cas16_acq",
"__aarch64_cas16_acq_rel", "__aarch64_cas16_acq_rel",
"__aarch64_cas16_rel", "__aarch64_cas16_rel",