musl: update libc.S to v1.2.4

This commit is contained in:
Andrew Kelley 2023-06-19 17:06:39 -07:00 committed by Jacob Young
parent b20ccff515
commit 09c7f1bd7c
2 changed files with 248 additions and 218 deletions

233
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_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)
.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_i386) && !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)
.globl __cachectl .globl __cachectl
.type __cachectl, %function; .type __cachectl, %function;
__cachectl: __cachectl:
@ -313,10 +313,10 @@ __fseterr:
.type __fsetlocking, %function; .type __fsetlocking, %function;
__fsetlocking: __fsetlocking:
#ifdef PTR32 #ifdef PTR32
.globl __fstat_time64 .weak __fstat_time64
.type __fstat_time64, %function; .type __fstat_time64, %function;
__fstat_time64: __fstat_time64:
.globl __fstatat_time64 .weak __fstatat_time64
.type __fstatat_time64, %function; .type __fstatat_time64, %function;
__fstatat_time64: __fstatat_time64:
.globl __ftime64 .globl __ftime64
@ -338,22 +338,12 @@ __fwritable:
.globl __fwriting .globl __fwriting
.type __fwriting, %function; .type __fwriting, %function;
__fwriting: __fwriting:
#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
.globl __fxstat .globl __fxstat
.type __fxstat, %function; .type __fxstat, %function;
__fxstat: __fxstat:
#endif
WEAK64 __fxstat64
.type __fxstat64, %function;
__fxstat64:
#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
.globl __fxstatat .globl __fxstatat
.type __fxstatat, %function; .type __fxstatat, %function;
__fxstatat: __fxstatat:
#endif
WEAK64 __fxstatat64
.type __fxstatat64, %function;
__fxstatat64:
.weak __getdelim .weak __getdelim
.type __getdelim, %function; .type __getdelim, %function;
__getdelim: __getdelim:
@ -508,7 +498,7 @@ __localtime64:
.type __localtime64_r, %function; .type __localtime64_r, %function;
__localtime64_r: __localtime64_r:
#endif #endif
#if !defined(ARCH_mips) && !defined(ARCH_i386) && !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)
.globl __longjmp .globl __longjmp
.type __longjmp, %function; .type __longjmp, %function;
__longjmp: __longjmp:
@ -521,14 +511,9 @@ __lstat_time64:
.type __lutimes_time64, %function; .type __lutimes_time64, %function;
__lutimes_time64: __lutimes_time64:
#endif #endif
#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
.globl __lxstat .globl __lxstat
.type __lxstat, %function; .type __lxstat, %function;
__lxstat: __lxstat:
#endif
WEAK64 __lxstat64
.type __lxstat64, %function;
__lxstat64:
#ifdef PTR32 #ifdef PTR32
.globl __mktime64 .globl __mktime64
.type __mktime64, %function; .type __mktime64, %function;
@ -591,7 +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_i386) && !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)
.globl __restore
.type __restore, %function;
__restore:
#endif
#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
.globl __restore_rt
.type __restore_rt, %function;
__restore_rt:
#endif
#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
.globl __riscv_flush_icache .globl __riscv_flush_icache
.type __riscv_flush_icache, %function; .type __riscv_flush_icache, %function;
__riscv_flush_icache: __riscv_flush_icache:
@ -792,27 +787,27 @@ __xpg_basename:
.weak __xpg_strerror_r .weak __xpg_strerror_r
.type __xpg_strerror_r, %function; .type __xpg_strerror_r, %function;
__xpg_strerror_r: __xpg_strerror_r:
#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
.globl __xstat .globl __xstat
.type __xstat, %function; .type __xstat, %function;
__xstat: __xstat:
#endif
WEAK64 __xstat64
.type __xstat64, %function;
__xstat64:
.weak _dl_debug_state .weak _dl_debug_state
.type _dl_debug_state, %function; .type _dl_debug_state, %function;
_dl_debug_state: _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)
.globl _dlstart_data
.type _dlstart_data, %function;
_dlstart_data:
#endif
.globl _exit .globl _exit
.type _exit, %function; .type _exit, %function;
_exit: _exit:
.weak _fini .weak _fini
.type _fini, %function; .type _fini, %function;
_fini: _fini:
#if !defined(ARCH_riscv64) && !defined(ARCH_i386) && !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)
.globl _flush_cache .globl _flush_cache
.type _flush_cache, %function; .type _flush_cache, %function;
_flush_cache: _flush_cache:
@ -886,45 +881,24 @@ adjtimex:
.globl aio_cancel .globl aio_cancel
.type aio_cancel, %function; .type aio_cancel, %function;
aio_cancel: aio_cancel:
.weak aio_cancel64
.type aio_cancel64, %function;
aio_cancel64:
.globl aio_error .globl aio_error
.type aio_error, %function; .type aio_error, %function;
aio_error: aio_error:
.weak aio_error64
.type aio_error64, %function;
aio_error64:
.globl aio_fsync .globl aio_fsync
.type aio_fsync, %function; .type aio_fsync, %function;
aio_fsync: aio_fsync:
.weak aio_fsync64
.type aio_fsync64, %function;
aio_fsync64:
.globl aio_read .globl aio_read
.type aio_read, %function; .type aio_read, %function;
aio_read: aio_read:
.weak aio_read64
.type aio_read64, %function;
aio_read64:
.globl aio_return .globl aio_return
.type aio_return, %function; .type aio_return, %function;
aio_return: aio_return:
.weak aio_return64
.type aio_return64, %function;
aio_return64:
.globl aio_suspend .globl aio_suspend
.type aio_suspend, %function; .type aio_suspend, %function;
aio_suspend: aio_suspend:
.weak aio_suspend64
.type aio_suspend64, %function;
aio_suspend64:
.globl aio_write .globl aio_write
.type aio_write, %function; .type aio_write, %function;
aio_write: aio_write:
.weak aio_write64
.type aio_write64, %function;
aio_write64:
.globl alarm .globl alarm
.type alarm, %function; .type alarm, %function;
alarm: alarm:
@ -934,10 +908,7 @@ aligned_alloc:
.globl alphasort .globl alphasort
.type alphasort, %function; .type alphasort, %function;
alphasort: alphasort:
.weak alphasort64 #if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
.type alphasort64, %function;
alphasort64:
#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
.globl arch_prctl .globl arch_prctl
.type arch_prctl, %function; .type arch_prctl, %function;
arch_prctl: arch_prctl:
@ -1062,12 +1033,12 @@ cabsf:
.globl cabsl .globl cabsl
.type cabsl, %function; .type cabsl, %function;
cabsl: cabsl:
#if !defined(ARCH_riscv64) && !defined(ARCH_i386) && !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)
.weak cachectl .weak cachectl
.type cachectl, %function; .type cachectl, %function;
cachectl: cachectl:
#endif #endif
#if !defined(ARCH_riscv64) && !defined(ARCH_i386) && !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)
.weak cacheflush .weak cacheflush
.type cacheflush, %function; .type cacheflush, %function;
cacheflush: cacheflush:
@ -1384,9 +1355,6 @@ creall:
.globl creat .globl creat
.type creat, %function; .type creat, %function;
creat: creat:
.weak creat64
.type creat64, %function;
creat64:
.globl crypt .globl crypt
.type crypt, %function; .type crypt, %function;
crypt: crypt:
@ -1729,9 +1697,6 @@ faccessat:
.globl fallocate .globl fallocate
.type fallocate, %function; .type fallocate, %function;
fallocate: fallocate:
.weak fallocate64
.type fallocate64, %function;
fallocate64:
.globl fanotify_init .globl fanotify_init
.type fanotify_init, %function; .type fanotify_init, %function;
fanotify_init: fanotify_init:
@ -1858,9 +1823,6 @@ fgetln:
.globl fgetpos .globl fgetpos
.type fgetpos, %function; .type fgetpos, %function;
fgetpos: fgetpos:
.weak fgetpos64
.type fgetpos64, %function;
fgetpos64:
.globl fgetpwent .globl fgetpwent
.type fgetpwent, %function; .type fgetpwent, %function;
fgetpwent: fgetpwent:
@ -1966,9 +1928,6 @@ fnmatch:
.globl fopen .globl fopen
.type fopen, %function; .type fopen, %function;
fopen: fopen:
.weak fopen64
.type fopen64, %function;
fopen64:
.globl fopencookie .globl fopencookie
.type fopencookie, %function; .type fopencookie, %function;
fopencookie: fopencookie:
@ -2035,9 +1994,6 @@ fremovexattr:
.globl freopen .globl freopen
.type freopen, %function; .type freopen, %function;
freopen: freopen:
.weak freopen64
.type freopen64, %function;
freopen64:
.globl frexp .globl frexp
.type frexp, %function; .type frexp, %function;
frexp: frexp:
@ -2056,42 +2012,24 @@ fseek:
.weak fseeko .weak fseeko
.type fseeko, %function; .type fseeko, %function;
fseeko: fseeko:
.weak fseeko64
.type fseeko64, %function;
fseeko64:
.globl fsetpos .globl fsetpos
.type fsetpos, %function; .type fsetpos, %function;
fsetpos: fsetpos:
.weak fsetpos64
.type fsetpos64, %function;
fsetpos64:
.globl fsetxattr .globl fsetxattr
.type fsetxattr, %function; .type fsetxattr, %function;
fsetxattr: fsetxattr:
.globl fstat WEAK64 fstat
.type fstat, %function; .type fstat, %function;
fstat: fstat:
.weak fstat64 WEAK64 fstatat
.type fstat64, %function;
fstat64:
.globl fstatat
.type fstatat, %function; .type fstatat, %function;
fstatat: fstatat:
.weak fstatat64
.type fstatat64, %function;
fstatat64:
.weak fstatfs .weak fstatfs
.type fstatfs, %function; .type fstatfs, %function;
fstatfs: fstatfs:
.weak fstatfs64
.type fstatfs64, %function;
fstatfs64:
.globl fstatvfs .globl fstatvfs
.type fstatvfs, %function; .type fstatvfs, %function;
fstatvfs: fstatvfs:
.weak fstatvfs64
.type fstatvfs64, %function;
fstatvfs64:
.globl fsync .globl fsync
.type fsync, %function; .type fsync, %function;
fsync: fsync:
@ -2101,9 +2039,6 @@ ftell:
.weak ftello .weak ftello
.type ftello, %function; .type ftello, %function;
ftello: ftello:
.weak ftello64
.type ftello64, %function;
ftello64:
.globl ftime .globl ftime
.type ftime, %function; .type ftime, %function;
ftime: ftime:
@ -2113,18 +2048,12 @@ ftok:
.globl ftruncate .globl ftruncate
.type ftruncate, %function; .type ftruncate, %function;
ftruncate: ftruncate:
.weak ftruncate64
.type ftruncate64, %function;
ftruncate64:
.globl ftrylockfile .globl ftrylockfile
.type ftrylockfile, %function; .type ftrylockfile, %function;
ftrylockfile: ftrylockfile:
.globl ftw .globl ftw
.type ftw, %function; .type ftw, %function;
ftw: ftw:
.weak ftw64
.type ftw64, %function;
ftw64:
.globl funlockfile .globl funlockfile
.type funlockfile, %function; .type funlockfile, %function;
funlockfile: funlockfile:
@ -2203,9 +2132,6 @@ getdelim:
.globl getdents .globl getdents
.type getdents, %function; .type getdents, %function;
getdents: getdents:
.weak getdents64
.type getdents64, %function;
getdents64:
.globl getdomainname .globl getdomainname
.type getdomainname, %function; .type getdomainname, %function;
getdomainname: getdomainname:
@ -2380,9 +2306,6 @@ getresuid:
.globl getrlimit .globl getrlimit
.type getrlimit, %function; .type getrlimit, %function;
getrlimit: getrlimit:
.weak getrlimit64
.type getrlimit64, %function;
getrlimit64:
.globl getrusage .globl getrusage
.type getrusage, %function; .type getrusage, %function;
getrusage: getrusage:
@ -2479,15 +2402,9 @@ getxattr:
.globl glob .globl glob
.type glob, %function; .type glob, %function;
glob: glob:
.weak glob64
.type glob64, %function;
glob64:
.globl globfree .globl globfree
.type globfree, %function; .type globfree, %function;
globfree: globfree:
.weak globfree64
.type globfree64, %function;
globfree64:
.globl gmtime .globl gmtime
.type gmtime, %function; .type gmtime, %function;
gmtime: gmtime:
@ -2632,12 +2549,12 @@ insque:
.globl ioctl .globl ioctl
.type ioctl, %function; .type ioctl, %function;
ioctl: ioctl:
#if !defined(ARCH_riscv64) && !defined(ARCH_aarch64) #if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)
.globl ioperm .globl ioperm
.type ioperm, %function; .type ioperm, %function;
ioperm: ioperm:
#endif #endif
#if !defined(ARCH_riscv64) && !defined(ARCH_aarch64) #if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)
.globl iopl .globl iopl
.type iopl, %function; .type iopl, %function;
iopl: iopl:
@ -2897,9 +2814,6 @@ linkat:
.globl lio_listio .globl lio_listio
.type lio_listio, %function; .type lio_listio, %function;
lio_listio: lio_listio:
.weak lio_listio64
.type lio_listio64, %function;
lio_listio64:
.globl listen .globl listen
.type listen, %function; .type listen, %function;
listen: listen:
@ -2945,9 +2859,6 @@ localtime_r:
.globl lockf .globl lockf
.type lockf, %function; .type lockf, %function;
lockf: lockf:
.weak lockf64
.type lockf64, %function;
lockf64:
.globl log .globl log
.type log, %function; .type log, %function;
log: log:
@ -3029,18 +2940,12 @@ lsearch:
.weak lseek .weak lseek
.type lseek, %function; .type lseek, %function;
lseek: lseek:
.weak lseek64
.type lseek64, %function;
lseek64:
.globl lsetxattr .globl lsetxattr
.type lsetxattr, %function; .type lsetxattr, %function;
lsetxattr: lsetxattr:
.globl lstat .globl lstat
.type lstat, %function; .type lstat, %function;
lstat: lstat:
.weak lstat64
.type lstat64, %function;
lstat64:
.globl lutimes .globl lutimes
.type lutimes, %function; .type lutimes, %function;
lutimes: lutimes:
@ -3146,27 +3051,15 @@ mknodat:
.globl mkostemp .globl mkostemp
.type mkostemp, %function; .type mkostemp, %function;
mkostemp: mkostemp:
.weak mkostemp64
.type mkostemp64, %function;
mkostemp64:
.weak mkostemps .weak mkostemps
.type mkostemps, %function; .type mkostemps, %function;
mkostemps: mkostemps:
.weak mkostemps64
.type mkostemps64, %function;
mkostemps64:
.globl mkstemp .globl mkstemp
.type mkstemp, %function; .type mkstemp, %function;
mkstemp: mkstemp:
.weak mkstemp64
.type mkstemp64, %function;
mkstemp64:
.globl mkstemps .globl mkstemps
.type mkstemps, %function; .type mkstemps, %function;
mkstemps: mkstemps:
.weak mkstemps64
.type mkstemps64, %function;
mkstemps64:
.globl mktemp .globl mktemp
.type mktemp, %function; .type mktemp, %function;
mktemp: mktemp:
@ -3185,9 +3078,6 @@ mlockall:
.weak mmap .weak mmap
.type mmap, %function; .type mmap, %function;
mmap: mmap:
.weak mmap64
.type mmap64, %function;
mmap64:
.globl modf .globl modf
.type modf, %function; .type modf, %function;
modf: modf:
@ -3329,9 +3219,6 @@ nexttowardl:
.globl nftw .globl nftw
.type nftw, %function; .type nftw, %function;
nftw: nftw:
.weak nftw64
.type nftw64, %function;
nftw64:
.globl ngettext .globl ngettext
.type ngettext, %function; .type ngettext, %function;
ngettext: ngettext:
@ -3380,9 +3267,6 @@ ntohs:
.globl open .globl open
.type open, %function; .type open, %function;
open: open:
.weak open64
.type open64, %function;
open64:
.globl open_by_handle_at .globl open_by_handle_at
.type open_by_handle_at, %function; .type open_by_handle_at, %function;
open_by_handle_at: open_by_handle_at:
@ -3395,9 +3279,6 @@ open_wmemstream:
.globl openat .globl openat
.type openat, %function; .type openat, %function;
openat: openat:
.weak openat64
.type openat64, %function;
openat64:
.globl opendir .globl opendir
.type opendir, %function; .type opendir, %function;
opendir: opendir:
@ -3443,15 +3324,9 @@ posix_close:
.globl posix_fadvise .globl posix_fadvise
.type posix_fadvise, %function; .type posix_fadvise, %function;
posix_fadvise: posix_fadvise:
.weak posix_fadvise64
.type posix_fadvise64, %function;
posix_fadvise64:
.globl posix_fallocate .globl posix_fallocate
.type posix_fallocate, %function; .type posix_fallocate, %function;
posix_fallocate: posix_fallocate:
.weak posix_fallocate64
.type posix_fallocate64, %function;
posix_fallocate64:
.globl posix_madvise .globl posix_madvise
.type posix_madvise, %function; .type posix_madvise, %function;
posix_madvise: posix_madvise:
@ -3557,24 +3432,15 @@ prctl:
.globl pread .globl pread
.type pread, %function; .type pread, %function;
pread: pread:
.weak pread64
.type pread64, %function;
pread64:
.globl preadv .globl preadv
.type preadv, %function; .type preadv, %function;
preadv: preadv:
.weak preadv64
.type preadv64, %function;
preadv64:
.globl printf .globl printf
.type printf, %function; .type printf, %function;
printf: printf:
.globl prlimit .globl prlimit
.type prlimit, %function; .type prlimit, %function;
prlimit: prlimit:
.weak prlimit64
.type prlimit64, %function;
prlimit64:
.globl process_vm_readv .globl process_vm_readv
.type process_vm_readv, %function; .type process_vm_readv, %function;
process_vm_readv: process_vm_readv:
@ -3971,15 +3837,9 @@ putwchar_unlocked:
.globl pwrite .globl pwrite
.type pwrite, %function; .type pwrite, %function;
pwrite: pwrite:
.weak pwrite64
.type pwrite64, %function;
pwrite64:
.globl pwritev .globl pwritev
.type pwritev, %function; .type pwritev, %function;
pwritev: pwritev:
.weak pwritev64
.type pwritev64, %function;
pwritev64:
.globl qsort .globl qsort
.type qsort, %function; .type qsort, %function;
qsort: qsort:
@ -4013,12 +3873,6 @@ readahead:
.globl readdir .globl readdir
.type readdir, %function; .type readdir, %function;
readdir: readdir:
.weak readdir64
.type readdir64, %function;
readdir64:
.weak readdir64_r
.type readdir64_r, %function;
readdir64_r:
.globl readdir_r .globl readdir_r
.type readdir_r, %function; .type readdir_r, %function;
readdir_r: readdir_r:
@ -4139,7 +3993,7 @@ rintf:
.globl rintl .globl rintl
.type rintl, %function; .type rintl, %function;
rintl: rintl:
#if !defined(ARCH_mips) && !defined(ARCH_i386) && !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)
.weak riscv_flush_icache .weak riscv_flush_icache
.type riscv_flush_icache, %function; .type riscv_flush_icache, %function;
riscv_flush_icache: riscv_flush_icache:
@ -4186,9 +4040,6 @@ scalbnl:
.globl scandir .globl scandir
.type scandir, %function; .type scandir, %function;
scandir: scandir:
.weak scandir64
.type scandir64, %function;
scandir64:
.globl scanf .globl scanf
.type scanf, %function; .type scanf, %function;
scanf: scanf:
@ -4285,9 +4136,6 @@ send:
.globl sendfile .globl sendfile
.type sendfile, %function; .type sendfile, %function;
sendfile: sendfile:
.weak sendfile64
.type sendfile64, %function;
sendfile64:
.globl sendmmsg .globl sendmmsg
.type sendmmsg, %function; .type sendmmsg, %function;
sendmmsg: sendmmsg:
@ -4393,9 +4241,6 @@ setreuid:
.globl setrlimit .globl setrlimit
.type setrlimit, %function; .type setrlimit, %function;
setrlimit: setrlimit:
.weak setrlimit64
.type setrlimit64, %function;
setrlimit64:
.globl setservent .globl setservent
.type setservent, %function; .type setservent, %function;
setservent: setservent:
@ -4612,21 +4457,12 @@ sscanf:
.globl stat .globl stat
.type stat, %function; .type stat, %function;
stat: stat:
.weak stat64
.type stat64, %function;
stat64:
.weak statfs .weak statfs
.type statfs, %function; .type statfs, %function;
statfs: statfs:
.weak statfs64
.type statfs64, %function;
statfs64:
.globl statvfs .globl statvfs
.type statvfs, %function; .type statvfs, %function;
statvfs: statvfs:
.weak statvfs64
.type statvfs64, %function;
statvfs64:
.globl stime .globl stime
.type stime, %function; .type stime, %function;
stime: stime:
@ -4984,9 +4820,6 @@ timespec_get:
.globl tmpfile .globl tmpfile
.type tmpfile, %function; .type tmpfile, %function;
tmpfile: tmpfile:
.weak tmpfile64
.type tmpfile64, %function;
tmpfile64:
.globl tmpnam .globl tmpnam
.type tmpnam, %function; .type tmpnam, %function;
tmpnam: tmpnam:
@ -5029,9 +4862,6 @@ trunc:
.globl truncate .globl truncate
.type truncate, %function; .type truncate, %function;
truncate: truncate:
.weak truncate64
.type truncate64, %function;
truncate64:
.globl truncf .globl truncf
.type truncf, %function; .type truncf, %function;
truncf: truncf:
@ -5152,9 +4982,6 @@ verrx:
.globl versionsort .globl versionsort
.type versionsort, %function; .type versionsort, %function;
versionsort: versionsort:
.weak versionsort64
.type versionsort64, %function;
versionsort64:
.globl vfork .globl vfork
.type vfork, %function; .type vfork, %function;
vfork: vfork:

View file

@ -11,6 +11,7 @@
//! * One of the following, corresponding to the CPU architecture: //! * One of the following, corresponding to the CPU architecture:
//! - `-DARCH_riscv64` //! - `-DARCH_riscv64`
//! - `-DARCH_mips` //! - `-DARCH_mips`
//! - `-DARCH_mips64`
//! - `-DARCH_i386` //! - `-DARCH_i386`
//! - `-DARCH_x86_64` //! - `-DARCH_x86_64`
//! - `-DARCH_powerpc` //! - `-DARCH_powerpc`
@ -28,9 +29,20 @@ const log = std.log;
const elf = std.elf; const elf = std.elf;
const native_endian = @import("builtin").target.cpu.arch.endian(); const native_endian = @import("builtin").target.cpu.arch.endian();
const arches: [7]std.Target.Cpu.Arch = blk: { const inputs = .{
var result: [7]std.Target.Cpu.Arch = undefined; .riscv64,
for (.{ .riscv64, .mips, .x86, .x86_64, .powerpc, .powerpc64, .aarch64 }) |arch| { .mips,
.mips64,
.x86,
.x86_64,
.powerpc,
.powerpc64,
.aarch64,
};
const arches: [inputs.len]std.Target.Cpu.Arch = blk: {
var result: [inputs.len]std.Target.Cpu.Arch = undefined;
for (inputs) |arch| {
result[archIndex(arch)] = arch; result[archIndex(arch)] = arch;
} }
break :blk result; break :blk result;
@ -56,6 +68,7 @@ const MultiSym = struct {
fn is32Only(ms: MultiSym) bool { fn is32Only(ms: MultiSym) bool {
return ms.present[archIndex(.riscv64)] == false and return ms.present[archIndex(.riscv64)] == false and
ms.present[archIndex(.mips)] == true and ms.present[archIndex(.mips)] == true and
ms.present[archIndex(.mips64)] == false and
ms.present[archIndex(.x86)] == true and ms.present[archIndex(.x86)] == true and
ms.present[archIndex(.x86_64)] == false and ms.present[archIndex(.x86_64)] == false and
ms.present[archIndex(.powerpc)] == true and ms.present[archIndex(.powerpc)] == true and
@ -97,6 +110,7 @@ const MultiSym = struct {
const map = .{ const map = .{
.{ .riscv64, 8 }, .{ .riscv64, 8 },
.{ .mips, 4 }, .{ .mips, 4 },
.{ .mips64, 8 },
.{ .x86, 4 }, .{ .x86, 4 },
.{ .x86_64, 8 }, .{ .x86_64, 8 },
.{ .powerpc, 4 }, .{ .powerpc, 4 },
@ -118,6 +132,7 @@ const MultiSym = struct {
const map = .{ const map = .{
.{ .riscv64, 16 }, .{ .riscv64, 16 },
.{ .mips, 8 }, .{ .mips, 8 },
.{ .mips64, 16 },
.{ .x86, 8 }, .{ .x86, 8 },
.{ .x86_64, 16 }, .{ .x86_64, 16 },
.{ .powerpc, 8 }, .{ .powerpc, 8 },
@ -139,6 +154,7 @@ const MultiSym = struct {
const map = .{ const map = .{
.{ .riscv64, 2 }, .{ .riscv64, 2 },
.{ .mips, 1 }, .{ .mips, 1 },
.{ .mips64, 2 },
.{ .x86, 1 }, .{ .x86, 1 },
.{ .x86_64, 2 }, .{ .x86_64, 2 },
.{ .powerpc, 1 }, .{ .powerpc, 1 },
@ -187,17 +203,23 @@ pub fn main() !void {
} }
for (arches) |arch| { for (arches) |arch| {
const libc_so_path = try std.fmt.allocPrint(arena, "{s}/lib/libc.so", .{@tagName(arch)}); const libc_so_path = try std.fmt.allocPrint(arena, "{s}/lib/libc.so", .{
archMuslName(arch),
});
// Read the ELF header. // Read the ELF header.
const elf_bytes = try build_all_dir.readFileAllocOptions( const elf_bytes = build_all_dir.readFileAllocOptions(
arena, arena,
libc_so_path, libc_so_path,
100 * 1024 * 1024, 100 * 1024 * 1024,
1 * 1024 * 1024, 1 * 1024 * 1024,
@alignOf(elf.Elf64_Ehdr), @alignOf(elf.Elf64_Ehdr),
null, null,
); ) catch |err| {
std.debug.panic("unable to read '{s}/{s}': {s}", .{
build_all_path, libc_so_path, @errorName(err),
});
};
const header = try elf.Header.parse(elf_bytes[0..@sizeOf(elf.Elf64_Ehdr)]); const header = try elf.Header.parse(elf_bytes[0..@sizeOf(elf.Elf64_Ehdr)]);
const parse: Parse = .{ const parse: Parse = .{
@ -437,9 +459,15 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
const dynstr = elf_bytes[dynstr_offset..]; const dynstr = elf_bytes[dynstr_offset..];
// Sort the list by address, ascending. // Sort the list by address, ascending.
mem.sort(Sym, @alignCast(8, dyn_syms), {}, S.symbolAddrLessThan); // We need a copy to fix alignment.
const copied_dyn_syms = copy: {
const ptr = try arena.alloc(Sym, dyn_syms.len);
@memcpy(ptr, dyn_syms);
break :copy ptr;
};
mem.sort(Sym, copied_dyn_syms, {}, S.symbolAddrLessThan);
for (dyn_syms) |sym| { for (copied_dyn_syms) |sym| {
const this_section = s(sym.st_shndx); const this_section = s(sym.st_shndx);
const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0)); const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0));
const ty = @truncate(u4, sym.st_info); const ty = @truncate(u4, sym.st_info);
@ -555,19 +583,36 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {
// zig fmt: off // zig fmt: off
.riscv64 => 0, .riscv64 => 0,
.mips => 1, .mips => 1,
.x86 => 2, .mips64 => 2,
.x86_64 => 3, .x86 => 3,
.powerpc => 4, .x86_64 => 4,
.powerpc64 => 5, .powerpc => 5,
.aarch64 => 6, .powerpc64 => 6,
.aarch64 => 7,
else => unreachable,
// zig fmt: on
};
}
fn archMuslName(arch: std.Target.Cpu.Arch) []const u8 {
return switch (arch) {
// zig fmt: off
.riscv64 => "riscv64",
.mips => "mips",
.mips64 => "mips64",
.x86 => "i386",
.x86_64 => "x86_64",
.powerpc => "powerpc",
.powerpc64 => "powerpc64",
.aarch64 => "aarch64",
else => unreachable, else => unreachable,
// zig fmt: on // zig fmt: on
}; };
} }
fn archSetName(arch_set: [arches.len]bool) []const u8 { fn archSetName(arch_set: [arches.len]bool) []const u8 {
for (arches, 0..) |arch, i| { for (arches, arch_set) |arch, set_item| {
if (arch_set[i]) { if (set_item) {
return @tagName(arch); return @tagName(arch);
} }
} }
@ -913,4 +958,162 @@ const blacklisted_symbols = [_][]const u8{
"sinf128", "sinf128",
"sqrtf128", "sqrtf128",
"truncf128", "truncf128",
"__aarch64_cas16_acq",
"__aarch64_cas16_acq_rel",
"__aarch64_cas16_rel",
"__aarch64_cas16_relax",
"__aarch64_cas1_acq",
"__aarch64_cas1_acq_rel",
"__aarch64_cas1_rel",
"__aarch64_cas1_relax",
"__aarch64_cas2_acq",
"__aarch64_cas2_acq_rel",
"__aarch64_cas2_rel",
"__aarch64_cas2_relax",
"__aarch64_cas4_acq",
"__aarch64_cas4_acq_rel",
"__aarch64_cas4_rel",
"__aarch64_cas4_relax",
"__aarch64_cas8_acq",
"__aarch64_cas8_acq_rel",
"__aarch64_cas8_rel",
"__aarch64_cas8_relax",
"__aarch64_ldadd1_acq",
"__aarch64_ldadd1_acq_rel",
"__aarch64_ldadd1_rel",
"__aarch64_ldadd1_relax",
"__aarch64_ldadd2_acq",
"__aarch64_ldadd2_acq_rel",
"__aarch64_ldadd2_rel",
"__aarch64_ldadd2_relax",
"__aarch64_ldadd4_acq",
"__aarch64_ldadd4_acq_rel",
"__aarch64_ldadd4_rel",
"__aarch64_ldadd4_relax",
"__aarch64_ldadd8_acq",
"__aarch64_ldadd8_acq_rel",
"__aarch64_ldadd8_rel",
"__aarch64_ldadd8_relax",
"__aarch64_ldclr1_acq",
"__aarch64_ldclr1_acq_rel",
"__aarch64_ldclr1_rel",
"__aarch64_ldclr1_relax",
"__aarch64_ldclr2_acq",
"__aarch64_ldclr2_acq_rel",
"__aarch64_ldclr2_rel",
"__aarch64_ldclr2_relax",
"__aarch64_ldclr4_acq",
"__aarch64_ldclr4_acq_rel",
"__aarch64_ldclr4_rel",
"__aarch64_ldclr4_relax",
"__aarch64_ldclr8_acq",
"__aarch64_ldclr8_acq_rel",
"__aarch64_ldclr8_rel",
"__aarch64_ldclr8_relax",
"__aarch64_ldeor1_acq",
"__aarch64_ldeor1_acq_rel",
"__aarch64_ldeor1_rel",
"__aarch64_ldeor1_relax",
"__aarch64_ldeor2_acq",
"__aarch64_ldeor2_acq_rel",
"__aarch64_ldeor2_rel",
"__aarch64_ldeor2_relax",
"__aarch64_ldeor4_acq",
"__aarch64_ldeor4_acq_rel",
"__aarch64_ldeor4_rel",
"__aarch64_ldeor4_relax",
"__aarch64_ldeor8_acq",
"__aarch64_ldeor8_acq_rel",
"__aarch64_ldeor8_rel",
"__aarch64_ldeor8_relax",
"__aarch64_ldset1_acq",
"__aarch64_ldset1_acq_rel",
"__aarch64_ldset1_rel",
"__aarch64_ldset1_relax",
"__aarch64_ldset2_acq",
"__aarch64_ldset2_acq_rel",
"__aarch64_ldset2_rel",
"__aarch64_ldset2_relax",
"__aarch64_ldset4_acq",
"__aarch64_ldset4_acq_rel",
"__aarch64_ldset4_rel",
"__aarch64_ldset4_relax",
"__aarch64_ldset8_acq",
"__aarch64_ldset8_acq_rel",
"__aarch64_ldset8_rel",
"__aarch64_ldset8_relax",
"__aarch64_swp1_acq",
"__aarch64_swp1_acq_rel",
"__aarch64_swp1_rel",
"__aarch64_swp1_relax",
"__aarch64_swp2_acq",
"__aarch64_swp2_acq_rel",
"__aarch64_swp2_rel",
"__aarch64_swp2_relax",
"__aarch64_swp4_acq",
"__aarch64_swp4_acq_rel",
"__aarch64_swp4_rel",
"__aarch64_swp4_relax",
"__aarch64_swp8_acq",
"__aarch64_swp8_acq_rel",
"__aarch64_swp8_rel",
"__aarch64_swp8_relax",
"__addhf3",
"__atomic_compare_exchange_16",
"__atomic_exchange_16",
"__atomic_fetch_add_16",
"__atomic_fetch_and_16",
"__atomic_fetch_nand_16",
"__atomic_fetch_or_16",
"__atomic_fetch_sub_16",
"__atomic_fetch_umax_1",
"__atomic_fetch_umax_16",
"__atomic_fetch_umax_2",
"__atomic_fetch_umax_4",
"__atomic_fetch_umax_8",
"__atomic_fetch_umin_1",
"__atomic_fetch_umin_16",
"__atomic_fetch_umin_2",
"__atomic_fetch_umin_4",
"__atomic_fetch_umin_8",
"__atomic_fetch_xor_16",
"__atomic_load_16",
"__atomic_store_16",
"__cmphf2",
"__cmpxf2",
"__divdc3",
"__divhc3",
"__divhf3",
"__divkc3",
"__divsc3",
"__divtc3",
"__divxc3",
"__eqhf2",
"__extendhfdf2",
"__fixhfdi",
"__fixhfsi",
"__fixhfti",
"__fixunshfdi",
"__fixunshfsi",
"__fixunshfti",
"__floatdihf",
"__floatsihf",
"__floattihf",
"__floatundihf",
"__floatunsihf",
"__floatuntihf",
"__gehf2",
"__gthf2",
"__lehf2",
"__lthf2",
"__mulhc3",
"__mulhf3",
"__neghf2",
"__negkf2",
"__negtf2",
"__negxf2",
"__nehf2",
"__subhf3",
"__unordhf2",
"__unordxf2",
}; };