├── crt ├── crti.c ├── crtn.c ├── Scrt1.c ├── x32 │ ├── crtn.s │ └── crti.s ├── x86_64 │ ├── crtn.s │ └── crti.s ├── i386 │ ├── crtn.s │ └── crti.s ├── aarch64 │ └── crtn.s ├── arm │ ├── crtn.s │ └── crti.s ├── or1k │ ├── crtn.s │ └── crti.s ├── microblaze │ ├── crtn.s │ └── crti.s ├── s390x │ └── crtn.s ├── powerpc │ └── crtn.s ├── powerpc64 │ └── crtn.s ├── mips │ └── crtn.s ├── mips64 │ └── crtn.s └── mipsn32 │ └── crtn.s ├── VERSION ├── src ├── thread │ ├── tls.c │ ├── syscall_cp.c │ ├── mtx_destroy.c │ ├── sem_destroy.c │ ├── pthread_getconcurrency.c │ ├── sem_wait.c │ ├── cnd_destroy.c │ ├── cnd_init.c │ ├── pthread_attr_destroy.c │ ├── pthread_mutex_destroy.c │ ├── pthread_spin_destroy.c │ ├── thrd_yield.c │ ├── pthread_rwlock_destroy.c │ ├── pthread_setschedprio.c │ ├── tss_delete.c │ ├── pthread_condattr_destroy.c │ ├── pthread_mutexattr_destroy.c │ ├── pthread_spin_init.c │ ├── pthread_rwlockattr_destroy.c │ ├── sem_unlink.c │ ├── pthread_barrierattr_destroy.c │ ├── pthread_spin_unlock.c │ ├── s390x │ │ └── __unmapself.s │ ├── default_attr.c │ ├── call_once.c │ ├── pthread_rwlock_rdlock.c │ ├── pthread_rwlock_wrlock.c │ ├── aarch64 │ │ ├── __unmapself.s │ │ └── __set_thread_area.s │ ├── clone.c │ ├── pthread_condattr_init.c │ ├── pthread_mutexattr_init.c │ ├── pthread_spin_trylock.c │ ├── m68k │ │ └── __m68k_read_tp.s │ ├── pthread_rwlockattr_init.c │ ├── pthread_setschedparam.c │ ├── arm │ │ └── __unmapself.s │ ├── pthread_attr_setschedpolicy.c │ ├── pthread_barrierattr_init.c │ ├── pthread_mutex_getprioceiling.c │ ├── thrd_exit.c │ ├── mips64 │ │ └── __unmapself.s │ ├── mipsn32 │ │ └── __unmapself.s │ ├── pthread_cond_wait.c │ ├── pthread_mutex_setprioceiling.c │ ├── sem_getvalue.c │ ├── microblaze │ │ ├── __unmapself.s │ │ └── __set_thread_area.s │ ├── pthread_getschedparam.c │ ├── or1k │ │ ├── __set_thread_area.s │ │ └── __unmapself.s │ ├── powerpc │ │ └── __unmapself.s │ ├── pthread_mutexattr_setprotocol.c │ ├── pthread_rwlock_trywrlock.c │ ├── powerpc64 │ │ ├── __unmapself.s │ │ └── __set_thread_area.s │ ├── mips │ │ └── __unmapself.s │ ├── pthread_spin_lock.c │ ├── pthread_attr_setdetachstate.c │ ├── pthread_setconcurrency.c │ ├── pthread_attr_setguardsize.c │ ├── __set_thread_area.c │ ├── pthread_attr_setschedparam.c │ └── pthread_rwlockattr_setpshared.c ├── internal │ ├── syscall.c │ ├── version.c │ ├── sh │ │ └── __shcall.c │ ├── floatscan.h │ ├── intscan.h │ ├── syscall_ret.c │ ├── lock.h │ └── m68k │ │ └── syscall.s ├── setjmp │ ├── longjmp.c │ └── setjmp.c ├── signal │ ├── sigsetjmp.c │ ├── sigrtmin.c │ ├── sigrtmax.c │ ├── psiginfo.c │ ├── kill.c │ ├── sigpending.c │ ├── sigwaitinfo.c │ ├── sigsuspend.c │ ├── getitimer.c │ ├── sigpause.c │ ├── x86_64 │ │ └── restore.s │ ├── killpg.c │ ├── siglongjmp.c │ ├── x32 │ │ └── restore.s │ ├── setitimer.c │ ├── sighold.c │ └── sigrelse.c ├── math │ ├── i386 │ │ ├── __invtrigl.s │ │ ├── acosf.s │ │ ├── acosl.s │ │ ├── asinf.s │ │ ├── asinl.s │ │ ├── ceil.s │ │ ├── exp2.s │ │ ├── exp2f.s │ │ ├── exp2l.s │ │ ├── expf.s │ │ ├── expm1.s │ │ ├── expm1f.s │ │ ├── expm1l.s │ │ ├── ceilf.s │ │ ├── ceill.s │ │ ├── floorf.s │ │ ├── floorl.s │ │ ├── ldexp.s │ │ ├── ldexpf.s │ │ ├── ldexpl.s │ │ ├── remquof.s │ │ ├── remquol.s │ │ ├── scalbln.s │ │ ├── trunc.s │ │ ├── truncf.s │ │ ├── truncl.s │ │ ├── scalblnf.s │ │ ├── scalblnl.s │ │ ├── fabs.s │ │ ├── fabsf.s │ │ ├── fabsl.s │ │ ├── rint.s │ │ ├── sqrtl.s │ │ ├── log.s │ │ ├── rintf.s │ │ ├── rintl.s │ │ ├── log2.s │ │ ├── logf.s │ │ ├── logl.s │ │ ├── atanl.s │ │ ├── log10.s │ │ ├── log2f.s │ │ ├── log2l.s │ │ ├── log10f.s │ │ ├── log10l.s │ │ ├── atan2l.s │ │ ├── lrint.s │ │ ├── sqrtf.s │ │ ├── lrintf.s │ │ ├── lrintl.s │ │ ├── llrint.s │ │ ├── llrintl.s │ │ ├── llrintf.s │ │ ├── fmod.s │ │ ├── fmodf.s │ │ ├── fmodl.s │ │ └── remainderl.s │ ├── x32 │ │ ├── __invtrigl.s │ │ ├── ceill.s │ │ ├── expm1l.s │ │ ├── truncl.s │ │ ├── sqrt.s │ │ ├── sqrtf.s │ │ ├── sqrtl.s │ │ ├── fabsl.s │ │ ├── llrint.s │ │ ├── lrint.s │ │ ├── lrintf.s │ │ ├── llrintf.s │ │ ├── rintl.s │ │ ├── log2l.s │ │ ├── logl.s │ │ ├── atanl.s │ │ ├── log10l.s │ │ ├── atan2l.s │ │ ├── llrintl.s │ │ ├── lrintl.s │ │ ├── fabsf.s │ │ ├── fabs.s │ │ ├── fmodl.s │ │ ├── asinl.s │ │ └── remainderl.s │ ├── x86_64 │ │ ├── __invtrigl.s │ │ ├── ceill.s │ │ ├── expm1l.s │ │ ├── truncl.s │ │ ├── sqrt.s │ │ ├── sqrtf.s │ │ ├── lrint.s │ │ ├── sqrtl.s │ │ ├── fabsl.s │ │ ├── llrint.s │ │ ├── lrintf.s │ │ ├── rintl.s │ │ ├── llrintf.s │ │ ├── atanl.s │ │ ├── log2l.s │ │ ├── logl.s │ │ ├── log10l.s │ │ ├── atan2l.s │ │ ├── lrintl.s │ │ ├── fabsf.s │ │ ├── llrintl.s │ │ ├── fabs.s │ │ ├── fmodl.s │ │ ├── asinl.s │ │ └── remainderl.s │ ├── nan.c │ ├── nanf.c │ ├── lround.c │ ├── lroundf.c │ ├── nanl.c │ ├── tgammaf.c │ ├── llround.c │ ├── llroundf.c │ ├── lroundl.c │ ├── ldexp.c │ ├── ldexpf.c │ ├── llroundl.c │ ├── ldexpl.c │ ├── finite.c │ ├── finitef.c │ ├── signgam.c │ ├── lgamma.c │ ├── lgammaf.c │ ├── nexttowardl.c │ ├── significand.c │ ├── aarch64 │ │ ├── ceil.c │ │ ├── ceilf.c │ │ ├── fabs.c │ │ ├── fabsf.c │ │ ├── floor.c │ │ ├── floorf.c │ │ ├── rint.c │ │ ├── rintf.c │ │ ├── round.c │ │ ├── roundf.c │ │ ├── sqrt.c │ │ ├── sqrtf.c │ │ ├── trunc.c │ │ ├── truncf.c │ │ ├── nearbyint.c │ │ ├── nearbyintf.c │ │ ├── lround.c │ │ ├── lroundf.c │ │ ├── fmaxf.c │ │ ├── fminf.c │ │ ├── fmax.c │ │ ├── fmin.c │ │ ├── llround.c │ │ ├── llroundf.c │ │ ├── fmaf.c │ │ ├── fma.c │ │ ├── lrint.c │ │ ├── lrintf.c │ │ ├── llrint.c │ │ └── llrintf.c │ ├── powerpc64 │ │ ├── fabs.c │ │ ├── fabsf.c │ │ ├── sqrt.c │ │ ├── sqrtf.c │ │ ├── fma.c │ │ └── fmaf.c │ ├── significandf.c │ ├── lrintf.c │ ├── llrint.c │ ├── llrintf.c │ ├── s390x │ │ ├── fma.c │ │ └── fmaf.c │ ├── sqrtl.c │ ├── remainder.c │ ├── remainderf.c │ ├── fabs.c │ ├── fabsf.c │ ├── logbf.c │ ├── fdim.c │ ├── fdimf.c │ ├── __signbitf.c │ ├── copysign.c │ ├── __signbit.c │ ├── scalbln.c │ └── scalblnf.c ├── fenv │ ├── arm │ │ └── fenv.c │ ├── mips │ │ └── fenv-sf.c │ ├── powerpc │ │ └── fenv-sf.c │ ├── mips64 │ │ └── fenv-sf.c │ ├── mipsn32 │ │ └── fenv-sf.c │ ├── sh │ │ └── fenv-nofpu.c │ ├── fegetexceptflag.c │ ├── feholdexcept.c │ ├── fesetexceptflag.c │ └── feupdateenv.c ├── string │ ├── arm │ │ └── memcpy.c │ ├── strrchr.c │ ├── wcslen.c │ ├── bzero.c │ ├── strcpy.c │ ├── strnlen.c │ ├── strpbrk.c │ ├── wcpcpy.c │ ├── wcswcs.c │ ├── index.c │ ├── strncpy.c │ ├── wcscasecmp_l.c │ ├── rindex.c │ ├── wcscasecmp.c │ ├── wcscmp.c │ ├── strcat.c │ ├── wcspbrk.c │ ├── wmemset.c │ ├── bcopy.c │ ├── mempcpy.c │ ├── wcpncpy.c │ ├── wcsncasecmp_l.c │ ├── wcsnlen.c │ ├── bcmp.c │ ├── wcscat.c │ ├── wcscpy.c │ ├── wmemchr.c │ ├── wmemcmp.c │ ├── strchr.c │ ├── strcmp.c │ ├── wcsspn.c │ ├── wcsncmp.c │ ├── wmemcpy.c │ ├── explicit_bzero.c │ ├── wcsrchr.c │ ├── wcschr.c │ ├── memcmp.c │ ├── strdup.c │ └── wcsncpy.c ├── misc │ ├── gethostid.c │ ├── ffs.c │ ├── ffsl.c │ ├── ffsll.c │ ├── issetugid.c │ ├── uname.c │ ├── getrusage.c │ ├── setpriority.c │ ├── setdomainname.c │ ├── getresgid.c │ ├── getresuid.c │ └── getpriority.c ├── network │ ├── res_init.c │ ├── in6addr_any.c │ ├── in6addr_loopback.c │ ├── if_freenameindex.c │ ├── h_errno.c │ ├── recv.c │ ├── send.c │ ├── listen.c │ ├── shutdown.c │ ├── htonl.c │ ├── htons.c │ ├── ntohl.c │ ├── ntohs.c │ ├── bind.c │ ├── herror.c │ ├── connect.c │ ├── serv.c │ ├── sockatmark.c │ ├── accept.c │ ├── netname.c │ ├── getpeername.c │ └── getsockname.c ├── stdlib │ ├── abs.c │ ├── labs.c │ ├── atof.c │ ├── llabs.c │ ├── imaxabs.c │ ├── div.c │ ├── ldiv.c │ ├── lldiv.c │ ├── imaxdiv.c │ └── gcvt.c ├── locale │ ├── catclose.c │ ├── catgets.c │ ├── pleval.h │ ├── iconv_close.c │ ├── catopen.c │ └── freelocale.c ├── unistd │ ├── setpgrp.c │ ├── posix_close.c │ ├── sync.c │ ├── dup.c │ ├── _exit.c │ ├── getgid.c │ ├── getlogin.c │ ├── getpid.c │ ├── getuid.c │ ├── setsid.c │ ├── fsync.c │ ├── getegid.c │ ├── geteuid.c │ ├── getppid.c │ ├── getpgrp.c │ ├── getsid.c │ ├── chdir.c │ ├── fdatasync.c │ ├── getpgid.c │ ├── ctermid.c │ ├── setpgid.c │ ├── setgid.c │ ├── setuid.c │ ├── acct.c │ ├── getgroups.c │ ├── read.c │ ├── setegid.c │ ├── seteuid.c │ ├── unlinkat.c │ ├── write.c │ ├── readv.c │ ├── setregid.c │ ├── setreuid.c │ ├── writev.c │ ├── symlinkat.c │ ├── renameat.c │ ├── fchownat.c │ ├── linkat.c │ ├── pipe.c │ ├── tcsetpgrp.c │ ├── pause.c │ ├── ftruncate.c │ ├── readlinkat.c │ └── tcgetpgrp.c ├── complex │ ├── cimag.c │ ├── cimagf.c │ ├── creal.c │ ├── crealf.c │ ├── cabs.c │ ├── cabsf.c │ ├── carg.c │ ├── cargf.c │ ├── cimagl.c │ ├── creall.c │ ├── conj.c │ ├── conjf.c │ ├── ccoshl.c │ ├── cexpl.c │ ├── csinhl.c │ ├── csqrtl.c │ ├── ctanhl.c │ ├── ccosf.c │ ├── cpowf.c │ ├── conjl.c │ ├── cacoshf.c │ ├── ccos.c │ ├── csinf.c │ ├── ctanf.c │ ├── casinhf.c │ ├── catanhf.c │ ├── cacosf.c │ ├── cacosh.c │ ├── cpow.c │ ├── cproj.c │ ├── cprojf.c │ ├── clogf.c │ ├── catanh.c │ ├── csin.c │ ├── ctan.c │ └── casinh.c ├── prng │ ├── __seed48.c │ ├── srand48.c │ ├── lcong48.c │ └── rand48.h ├── stdio │ ├── __fclose_ca.c │ ├── fgetc.c │ ├── getchar.c │ ├── fputc.c │ ├── getchar_unlocked.c │ ├── getwc.c │ ├── putchar.c │ ├── putchar_unlocked.c │ ├── putwc.c │ ├── setlinebuf.c │ ├── vprintf.c │ ├── putw.c │ ├── getw.c │ ├── setbuf.c │ ├── getc.c │ ├── getline.c │ ├── putc.c │ ├── vwprintf.c │ ├── setbuffer.c │ ├── rewind.c │ ├── getwchar.c │ ├── vsprintf.c │ ├── fsetpos.c │ ├── putwchar.c │ ├── clearerr.c │ ├── vscanf.c │ ├── puts.c │ ├── flockfile.c │ ├── getc_unlocked.c │ └── ofl_add.c ├── time │ ├── difftime.c │ ├── asctime.c │ ├── times.c │ ├── localtime.c │ ├── ctime.c │ ├── gmtime.c │ ├── timer_delete.c │ ├── ctime_r.c │ ├── clock_settime.c │ ├── nanosleep.c │ ├── timer_getoverrun.c │ ├── timer_gettime.c │ └── time.c ├── ctype │ ├── isascii.c │ ├── toascii.c │ ├── __ctype_get_mb_cur_max.c │ └── wcswidth.c ├── dirent │ ├── dirfd.c │ ├── telldir.c │ └── closedir.c ├── ldso │ ├── aarch64 │ │ └── dlsym.s │ ├── or1k │ │ └── dlsym.s │ ├── s390x │ │ └── dlsym.s │ ├── x32 │ │ └── dlsym.s │ ├── dlclose.c │ ├── x86_64 │ │ └── dlsym.s │ ├── microblaze │ │ └── dlsym.s │ ├── arm │ │ └── dlsym.s │ ├── dlsym.c │ ├── tlsdesc.c │ ├── dladdr.c │ ├── i386 │ │ └── dlsym.s │ └── sh │ │ └── dlsym.s ├── multibyte │ ├── mblen.c │ ├── mbsinit.c │ ├── wctomb.c │ ├── c32rtomb.c │ ├── mbstowcs.c │ ├── wcstombs.c │ └── mbrlen.c ├── process │ ├── wait.c │ ├── s390x │ │ └── vfork.s │ ├── posix_spawnattr_destroy.c │ ├── posix_spawnattr_init.c │ ├── execv.c │ ├── posix_spawn_file_actions_init.c │ ├── posix_spawnattr_setpgroup.c │ ├── waitpid.c │ ├── arm │ │ └── vfork.s │ ├── posix_spawnattr_getflags.c │ ├── posix_spawnattr_getpgroup.c │ ├── posix_spawnattr_getsigmask.c │ ├── posix_spawnattr_setsigmask.c │ ├── waitid.c │ ├── x86_64 │ │ └── vfork.s │ ├── posix_spawnattr_getsigdefault.c │ ├── posix_spawnattr_setsigdefault.c │ ├── fdop.h │ ├── i386 │ │ └── vfork.s │ └── x32 │ │ └── vfork.s ├── conf │ └── pathconf.c ├── mq │ ├── mq_close.c │ ├── mq_getattr.c │ ├── mq_send.c │ ├── mq_receive.c │ └── mq_setattr.c ├── sched │ ├── sched_yield.c │ ├── sched_getscheduler.c │ ├── sched_getparam.c │ ├── sched_rr_get_interval.c │ ├── sched_setparam.c │ └── sched_setscheduler.c ├── mman │ ├── munlockall.c │ ├── mlockall.c │ ├── mlock.c │ ├── munlock.c │ ├── msync.c │ ├── mincore.c │ └── madvise.c ├── stat │ ├── mkfifo.c │ ├── umask.c │ ├── futimens.c │ ├── mkfifoat.c │ ├── mkdirat.c │ ├── mknodat.c │ └── lchmod.c ├── legacy │ ├── isastream.c │ ├── getpagesize.c │ └── valloc.c ├── linux │ ├── flock.c │ ├── setfsgid.c │ ├── setfsuid.c │ ├── adjtimex.c │ ├── pivot_root.c │ ├── syncfs.c │ ├── vhangup.c │ ├── reboot.c │ ├── unshare.c │ ├── chroot.c │ ├── klogctl.c │ ├── setns.c │ ├── iopl.c │ ├── arch_prctl.c │ ├── brk.c │ ├── clock_adjtime.c │ ├── setgroups.c │ ├── sethostname.c │ ├── getrandom.c │ ├── quotactl.c │ ├── personality.c │ ├── sysinfo.c │ ├── tee.c │ ├── utimes.c │ ├── memfd_create.c │ ├── cap.c │ ├── readahead.c │ ├── settimeofday.c │ ├── stime.c │ └── vmsplice.c ├── passwd │ ├── lckpwdf.c │ └── getspent.c ├── termios │ ├── tcflow.c │ ├── tcflush.c │ ├── tcdrain.c │ ├── tcgetattr.c │ ├── tcgetsid.c │ └── tcsendbreak.c ├── temp │ ├── mkstemp.c │ ├── mkstemps.c │ └── mkostemp.c ├── include │ ├── langinfo.h │ ├── arpa │ │ └── inet.h │ ├── sys │ │ ├── time.h │ │ ├── auxv.h │ │ └── sysinfo.h │ └── errno.h ├── malloc │ └── aligned_alloc.c ├── env │ └── __environ.c ├── exit │ ├── _Exit.c │ └── arm │ │ └── __aeabi_atexit.c ├── fcntl │ └── creat.c └── errno │ └── __errno_location.c ├── arch ├── generic │ └── bits │ │ ├── io.h │ │ ├── hwcap.h │ │ ├── mman.h │ │ ├── poll.h │ │ ├── ptrace.h │ │ ├── resource.h │ │ ├── ioctl_fix.h │ │ ├── kd.h │ │ ├── vt.h │ │ ├── link.h │ │ └── soundcard.h ├── or1k │ └── bits │ │ ├── user.h │ │ ├── endian.h │ │ ├── setjmp.h │ │ ├── reg.h │ │ └── posix.h ├── i386 │ └── bits │ │ ├── mman.h │ │ ├── setjmp.h │ │ ├── endian.h │ │ └── posix.h ├── x32 │ └── bits │ │ ├── mman.h │ │ ├── endian.h │ │ ├── setjmp.h │ │ └── posix.h ├── s390x │ └── bits │ │ ├── link.h │ │ ├── endian.h │ │ ├── setjmp.h │ │ ├── reg.h │ │ ├── ioctl_fix.h │ │ ├── posix.h │ │ ├── sem.h │ │ └── statfs.h ├── x86_64 │ └── bits │ │ ├── mman.h │ │ ├── endian.h │ │ ├── setjmp.h │ │ └── posix.h ├── m68k │ ├── bits │ │ ├── endian.h │ │ ├── setjmp.h │ │ ├── posix.h │ │ └── ptrace.h │ └── atomic_arch.h ├── sh │ └── bits │ │ ├── setjmp.h │ │ ├── posix.h │ │ ├── endian.h │ │ └── ptrace.h ├── aarch64 │ └── bits │ │ ├── setjmp.h │ │ ├── reg.h │ │ ├── posix.h │ │ └── endian.h ├── arm │ └── bits │ │ ├── setjmp.h │ │ ├── ioctl_fix.h │ │ ├── reg.h │ │ ├── posix.h │ │ └── endian.h ├── microblaze │ └── bits │ │ ├── setjmp.h │ │ ├── reg.h │ │ ├── posix.h │ │ └── endian.h ├── mips │ └── bits │ │ ├── setjmp.h │ │ ├── poll.h │ │ ├── posix.h │ │ ├── hwcap.h │ │ ├── endian.h │ │ └── resource.h ├── mips64 │ └── bits │ │ ├── setjmp.h │ │ ├── poll.h │ │ ├── posix.h │ │ ├── hwcap.h │ │ ├── endian.h │ │ └── resource.h ├── mipsn32 │ └── bits │ │ ├── setjmp.h │ │ ├── poll.h │ │ ├── posix.h │ │ ├── hwcap.h │ │ ├── endian.h │ │ └── resource.h ├── powerpc │ └── bits │ │ ├── setjmp.h │ │ ├── reg.h │ │ └── posix.h └── powerpc64 │ └── bits │ ├── setjmp.h │ ├── reg.h │ ├── posix.h │ └── endian.h ├── include ├── lastlog.h ├── memory.h ├── sys │ ├── kd.h │ ├── vt.h │ ├── stropts.h │ ├── syslog.h │ ├── ucontext.h │ ├── vfs.h │ ├── soundcard.h │ ├── dir.h │ ├── errno.h │ ├── fcntl.h │ ├── poll.h │ ├── signal.h │ ├── termios.h │ ├── reg.h │ └── klog.h ├── syscall.h ├── arpa │ └── nameser_compat.h ├── wait.h ├── stdnoreturn.h ├── netinet │ └── in_systm.h └── stdc-predef.h ├── libgcov_musl.a └── .gitignore /crt/crti.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crt/crtn.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.1.21 2 | -------------------------------------------------------------------------------- /src/thread/tls.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/generic/bits/io.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/or1k/bits/user.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/internal/syscall.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/setjmp/longjmp.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/setjmp/setjmp.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/signal/sigsetjmp.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/thread/syscall_cp.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/generic/bits/hwcap.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/generic/bits/mman.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/generic/bits/poll.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/generic/bits/ptrace.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/generic/bits/resource.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/math/i386/__invtrigl.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/math/x32/__invtrigl.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/math/x86_64/__invtrigl.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arch/generic/bits/ioctl_fix.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crt/Scrt1.c: -------------------------------------------------------------------------------- 1 | #include "crt1.c" 2 | -------------------------------------------------------------------------------- /src/math/i386/acosf.s: -------------------------------------------------------------------------------- 1 | # see acos.s 2 | -------------------------------------------------------------------------------- /src/math/i386/acosl.s: -------------------------------------------------------------------------------- 1 | # see acos.s 2 | -------------------------------------------------------------------------------- /src/math/i386/asinf.s: -------------------------------------------------------------------------------- 1 | # see asin.s 2 | -------------------------------------------------------------------------------- /src/math/i386/asinl.s: -------------------------------------------------------------------------------- 1 | # see asin.s 2 | -------------------------------------------------------------------------------- /src/math/i386/ceil.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/i386/exp2.s: -------------------------------------------------------------------------------- 1 | # see exp.s 2 | -------------------------------------------------------------------------------- /src/math/i386/exp2f.s: -------------------------------------------------------------------------------- 1 | # see exp.s 2 | -------------------------------------------------------------------------------- /src/math/i386/exp2l.s: -------------------------------------------------------------------------------- 1 | # see exp.s 2 | -------------------------------------------------------------------------------- /src/math/i386/expf.s: -------------------------------------------------------------------------------- 1 | # see exp.s 2 | -------------------------------------------------------------------------------- /src/math/i386/expm1.s: -------------------------------------------------------------------------------- 1 | # see exp.s 2 | -------------------------------------------------------------------------------- /src/math/i386/expm1f.s: -------------------------------------------------------------------------------- 1 | # see exp.s 2 | -------------------------------------------------------------------------------- /src/math/i386/expm1l.s: -------------------------------------------------------------------------------- 1 | # see exp.s 2 | -------------------------------------------------------------------------------- /include/lastlog.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/memory.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/sys/kd.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/sys/vt.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /src/math/i386/ceilf.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/i386/ceill.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/i386/floorf.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/i386/floorl.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/i386/ldexp.s: -------------------------------------------------------------------------------- 1 | # see scalbn.s 2 | -------------------------------------------------------------------------------- /src/math/i386/ldexpf.s: -------------------------------------------------------------------------------- 1 | # see scalbnf.s 2 | -------------------------------------------------------------------------------- /src/math/i386/ldexpl.s: -------------------------------------------------------------------------------- 1 | # see scalbnl.s 2 | -------------------------------------------------------------------------------- /src/math/i386/remquof.s: -------------------------------------------------------------------------------- 1 | # see remquo.s 2 | -------------------------------------------------------------------------------- /src/math/i386/remquol.s: -------------------------------------------------------------------------------- 1 | # see remquo.s 2 | -------------------------------------------------------------------------------- /src/math/i386/scalbln.s: -------------------------------------------------------------------------------- 1 | # see scalbn.s 2 | -------------------------------------------------------------------------------- /src/math/i386/trunc.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/i386/truncf.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/i386/truncl.s: -------------------------------------------------------------------------------- 1 | # see floor.s 2 | -------------------------------------------------------------------------------- /src/math/x32/ceill.s: -------------------------------------------------------------------------------- 1 | # see floorl.s 2 | -------------------------------------------------------------------------------- /src/math/x32/expm1l.s: -------------------------------------------------------------------------------- 1 | # see exp2l.s 2 | -------------------------------------------------------------------------------- /src/math/x32/truncl.s: -------------------------------------------------------------------------------- 1 | # see floorl.s 2 | -------------------------------------------------------------------------------- /src/math/x86_64/ceill.s: -------------------------------------------------------------------------------- 1 | # see floorl.s 2 | -------------------------------------------------------------------------------- /src/math/x86_64/expm1l.s: -------------------------------------------------------------------------------- 1 | # see exp2l.s 2 | -------------------------------------------------------------------------------- /src/math/x86_64/truncl.s: -------------------------------------------------------------------------------- 1 | # see floorl.s 2 | -------------------------------------------------------------------------------- /arch/generic/bits/kd.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /arch/generic/bits/vt.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/sys/stropts.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/sys/syslog.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/sys/ucontext.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/sys/vfs.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/syscall.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /src/math/i386/scalblnf.s: -------------------------------------------------------------------------------- 1 | # see scalbnf.s 2 | -------------------------------------------------------------------------------- /src/math/i386/scalblnl.s: -------------------------------------------------------------------------------- 1 | # see scalbnl.s 2 | -------------------------------------------------------------------------------- /arch/i386/bits/mman.h: -------------------------------------------------------------------------------- 1 | #define MAP_32BIT 0x40 2 | -------------------------------------------------------------------------------- /arch/x32/bits/mman.h: -------------------------------------------------------------------------------- 1 | #define MAP_32BIT 0x40 2 | -------------------------------------------------------------------------------- /arch/generic/bits/link.h: -------------------------------------------------------------------------------- 1 | typedef uint32_t Elf_Symndx; 2 | -------------------------------------------------------------------------------- /arch/s390x/bits/link.h: -------------------------------------------------------------------------------- 1 | typedef uint64_t Elf_Symndx; 2 | -------------------------------------------------------------------------------- /arch/x86_64/bits/mman.h: -------------------------------------------------------------------------------- 1 | #define MAP_32BIT 0x40 2 | -------------------------------------------------------------------------------- /include/sys/soundcard.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /arch/generic/bits/soundcard.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /arch/i386/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[6]; 2 | -------------------------------------------------------------------------------- /arch/m68k/bits/endian.h: -------------------------------------------------------------------------------- 1 | #define __BYTE_ORDER __BIG_ENDIAN 2 | -------------------------------------------------------------------------------- /arch/or1k/bits/endian.h: -------------------------------------------------------------------------------- 1 | #define __BYTE_ORDER __BIG_ENDIAN 2 | -------------------------------------------------------------------------------- /arch/s390x/bits/endian.h: -------------------------------------------------------------------------------- 1 | #define __BYTE_ORDER __BIG_ENDIAN 2 | -------------------------------------------------------------------------------- /arch/sh/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[15]; 2 | -------------------------------------------------------------------------------- /arch/x32/bits/endian.h: -------------------------------------------------------------------------------- 1 | #define __BYTE_ORDER __LITTLE_ENDIAN 2 | -------------------------------------------------------------------------------- /arch/aarch64/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[22]; 2 | -------------------------------------------------------------------------------- /arch/arm/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long long __jmp_buf[32]; 2 | -------------------------------------------------------------------------------- /arch/i386/bits/endian.h: -------------------------------------------------------------------------------- 1 | #define __BYTE_ORDER __LITTLE_ENDIAN 2 | -------------------------------------------------------------------------------- /arch/m68k/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[39]; 2 | -------------------------------------------------------------------------------- /arch/or1k/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[13]; 2 | -------------------------------------------------------------------------------- /arch/s390x/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[18]; 2 | -------------------------------------------------------------------------------- /arch/x32/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long long __jmp_buf[8]; 2 | -------------------------------------------------------------------------------- /arch/x86_64/bits/endian.h: -------------------------------------------------------------------------------- 1 | #define __BYTE_ORDER __LITTLE_ENDIAN 2 | -------------------------------------------------------------------------------- /arch/x86_64/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[8]; 2 | -------------------------------------------------------------------------------- /include/arpa/nameser_compat.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | -------------------------------------------------------------------------------- /include/sys/dir.h: -------------------------------------------------------------------------------- 1 | #include 2 | #define direct dirent 3 | -------------------------------------------------------------------------------- /arch/aarch64/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 64 3 | -------------------------------------------------------------------------------- /arch/arm/bits/ioctl_fix.h: -------------------------------------------------------------------------------- 1 | #undef FIOQSIZE 2 | #define FIOQSIZE 0x545e 3 | -------------------------------------------------------------------------------- /arch/microblaze/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[18]; 2 | -------------------------------------------------------------------------------- /arch/mips/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long long __jmp_buf[13]; 2 | -------------------------------------------------------------------------------- /arch/mips64/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long long __jmp_buf[23]; 2 | -------------------------------------------------------------------------------- /arch/mipsn32/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long long __jmp_buf[23]; 2 | -------------------------------------------------------------------------------- /arch/powerpc/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long long __jmp_buf[56]; 2 | -------------------------------------------------------------------------------- /arch/powerpc64/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned __int128 __jmp_buf[32]; 2 | -------------------------------------------------------------------------------- /arch/s390x/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 64 3 | -------------------------------------------------------------------------------- /arch/s390x/bits/ioctl_fix.h: -------------------------------------------------------------------------------- 1 | #undef FIOQSIZE 2 | #define FIOQSIZE 0x545e 3 | -------------------------------------------------------------------------------- /src/fenv/arm/fenv.c: -------------------------------------------------------------------------------- 1 | #if !__ARM_PCS_VFP 2 | #include "../fenv.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /arch/arm/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 32 3 | /* FIXME */ 4 | -------------------------------------------------------------------------------- /arch/mips/bits/poll.h: -------------------------------------------------------------------------------- 1 | #define POLLWRNORM POLLOUT 2 | #define POLLWRBAND 0x100 3 | -------------------------------------------------------------------------------- /arch/mips64/bits/poll.h: -------------------------------------------------------------------------------- 1 | #define POLLWRNORM POLLOUT 2 | #define POLLWRBAND 0x100 3 | -------------------------------------------------------------------------------- /libgcov_musl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsds/sgx-lkl-musl/HEAD/libgcov_musl.a -------------------------------------------------------------------------------- /arch/mipsn32/bits/poll.h: -------------------------------------------------------------------------------- 1 | #define POLLWRNORM POLLOUT 2 | #define POLLWRBAND 0x100 3 | -------------------------------------------------------------------------------- /arch/or1k/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 32 3 | /* FIXME */ 4 | -------------------------------------------------------------------------------- /arch/powerpc/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 32 3 | /* FIXME */ 4 | -------------------------------------------------------------------------------- /src/fenv/mips/fenv-sf.c: -------------------------------------------------------------------------------- 1 | #ifdef __mips_soft_float 2 | #include "../fenv.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /src/fenv/powerpc/fenv-sf.c: -------------------------------------------------------------------------------- 1 | #ifdef _SOFT_FLOAT 2 | #include "../fenv.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /arch/microblaze/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 32 3 | /* FIXME */ 4 | -------------------------------------------------------------------------------- /arch/powerpc64/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 64 3 | /* FIXME */ 4 | -------------------------------------------------------------------------------- /src/fenv/mips64/fenv-sf.c: -------------------------------------------------------------------------------- 1 | #ifdef __mips_soft_float 2 | #include "../fenv.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /src/fenv/mipsn32/fenv-sf.c: -------------------------------------------------------------------------------- 1 | #ifdef __mips_soft_float 2 | #include "../fenv.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /src/string/arm/memcpy.c: -------------------------------------------------------------------------------- 1 | #if __ARMEB__ || __thumb__ 2 | #include "../memcpy.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /arch/aarch64/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_LP64_OFF64 1 2 | #define _POSIX_V7_LP64_OFF64 1 3 | -------------------------------------------------------------------------------- /arch/arm/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/i386/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/m68k/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/m68k/bits/ptrace.h: -------------------------------------------------------------------------------- 1 | #define PTRACE_GET_THREAD_AREA 25 2 | #define PTRACE_SINGLEBLOCK 33 3 | -------------------------------------------------------------------------------- /arch/mips/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/mips64/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_LP64_OFFBIG 1 2 | #define _POSIX_V7_LP64_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/or1k/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/s390x/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_LP64_OFF64 1 2 | #define _POSIX_V7_LP64_OFF64 1 3 | -------------------------------------------------------------------------------- /arch/sh/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/x32/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/x86_64/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_LP64_OFF64 1 2 | #define _POSIX_V7_LP64_OFF64 1 3 | -------------------------------------------------------------------------------- /src/fenv/sh/fenv-nofpu.c: -------------------------------------------------------------------------------- 1 | #if !__SH_FPU_ANY__ && !__SH4__ 2 | #include "../fenv.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /src/misc/gethostid.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gethostid() 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/network/res_init.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int res_init() 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /arch/mipsn32/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/powerpc/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /arch/powerpc64/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_LP64_OFF64 1 2 | #define _POSIX_V7_LP64_OFF64 1 3 | -------------------------------------------------------------------------------- /crt/x32/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | pop %rax 3 | ret 4 | 5 | .section .fini 6 | pop %rax 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/nan.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double nan(const char *s) 4 | { 5 | return NAN; 6 | } 7 | -------------------------------------------------------------------------------- /src/math/nanf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float nanf(const char *s) 4 | { 5 | return NAN; 6 | } 7 | -------------------------------------------------------------------------------- /src/math/x32/sqrt.s: -------------------------------------------------------------------------------- 1 | .global sqrt 2 | .type sqrt,@function 3 | sqrt: sqrtsd %xmm0, %xmm0 4 | ret 5 | -------------------------------------------------------------------------------- /src/math/x86_64/sqrt.s: -------------------------------------------------------------------------------- 1 | .global sqrt 2 | .type sqrt,@function 3 | sqrt: sqrtsd %xmm0, %xmm0 4 | ret 5 | -------------------------------------------------------------------------------- /src/stdlib/abs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int abs(int a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/mtx_destroy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void mtx_destroy(mtx_t *mtx) 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /arch/microblaze/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_ILP32_OFFBIG 1 2 | #define _POSIX_V7_ILP32_OFFBIG 1 3 | -------------------------------------------------------------------------------- /crt/x86_64/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | pop %rax 3 | ret 4 | 5 | .section .fini 6 | pop %rax 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/lround.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lround(double x) 4 | { 5 | return round(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/lroundf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lroundf(float x) 4 | { 5 | return roundf(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/nanl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double nanl(const char *s) 4 | { 5 | return NAN; 6 | } 7 | -------------------------------------------------------------------------------- /src/math/tgammaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float tgammaf(float x) 4 | { 5 | return tgamma(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/x32/sqrtf.s: -------------------------------------------------------------------------------- 1 | .global sqrtf 2 | .type sqrtf,@function 3 | sqrtf: sqrtss %xmm0, %xmm0 4 | ret 5 | -------------------------------------------------------------------------------- /src/math/x32/sqrtl.s: -------------------------------------------------------------------------------- 1 | .global sqrtl 2 | .type sqrtl,@function 3 | sqrtl: fldt 8(%esp) 4 | fsqrt 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x86_64/sqrtf.s: -------------------------------------------------------------------------------- 1 | .global sqrtf 2 | .type sqrtf,@function 3 | sqrtf: sqrtss %xmm0, %xmm0 4 | ret 5 | -------------------------------------------------------------------------------- /src/stdlib/labs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long labs(long a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /crt/i386/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | add $12,%esp 3 | ret 4 | 5 | .section .fini 6 | add $12,%esp 7 | ret 8 | -------------------------------------------------------------------------------- /include/sys/errno.h: -------------------------------------------------------------------------------- 1 | #warning redirecting incorrect #include to 2 | #include 3 | -------------------------------------------------------------------------------- /include/sys/fcntl.h: -------------------------------------------------------------------------------- 1 | #warning redirecting incorrect #include to 2 | #include 3 | -------------------------------------------------------------------------------- /include/sys/poll.h: -------------------------------------------------------------------------------- 1 | #warning redirecting incorrect #include to 2 | #include 3 | -------------------------------------------------------------------------------- /include/wait.h: -------------------------------------------------------------------------------- 1 | #warning redirecting incorrect #include to 2 | #include 3 | -------------------------------------------------------------------------------- /src/locale/catclose.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int catclose (nl_catd catd) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/math/i386/fabs.s: -------------------------------------------------------------------------------- 1 | .global fabs 2 | .type fabs,@function 3 | fabs: 4 | fldl 4(%esp) 5 | fabs 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/i386/fabsf.s: -------------------------------------------------------------------------------- 1 | .global fabsf 2 | .type fabsf,@function 3 | fabsf: 4 | flds 4(%esp) 5 | fabs 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/i386/fabsl.s: -------------------------------------------------------------------------------- 1 | .global fabsl 2 | .type fabsl,@function 3 | fabsl: 4 | fldt 4(%esp) 5 | fabs 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/i386/rint.s: -------------------------------------------------------------------------------- 1 | .global rint 2 | .type rint,@function 3 | rint: 4 | fldl 4(%esp) 5 | frndint 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/i386/sqrtl.s: -------------------------------------------------------------------------------- 1 | .global sqrtl 2 | .type sqrtl,@function 3 | sqrtl: fldt 4(%esp) 4 | fsqrt 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/llround.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llround(double x) 4 | { 5 | return round(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/llroundf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llroundf(float x) 4 | { 5 | return roundf(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/lroundl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lroundl(long double x) 4 | { 5 | return roundl(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/x32/fabsl.s: -------------------------------------------------------------------------------- 1 | .global fabsl 2 | .type fabsl,@function 3 | fabsl: 4 | fldt 8(%esp) 5 | fabs 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/x32/llrint.s: -------------------------------------------------------------------------------- 1 | .global llrint 2 | .type llrint,@function 3 | llrint: 4 | cvtsd2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x32/lrint.s: -------------------------------------------------------------------------------- 1 | .global lrint 2 | .type lrint,@function 3 | lrint: 4 | cvtsd2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x32/lrintf.s: -------------------------------------------------------------------------------- 1 | .global lrintf 2 | .type lrintf,@function 3 | lrintf: 4 | cvtss2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x86_64/lrint.s: -------------------------------------------------------------------------------- 1 | .global lrint 2 | .type lrint,@function 3 | lrint: 4 | cvtsd2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x86_64/sqrtl.s: -------------------------------------------------------------------------------- 1 | .global sqrtl 2 | .type sqrtl,@function 3 | sqrtl: fldt 8(%rsp) 4 | fsqrt 5 | ret 6 | -------------------------------------------------------------------------------- /src/signal/sigrtmin.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int __libc_current_sigrtmin() 4 | { 5 | return 35; 6 | } 7 | -------------------------------------------------------------------------------- /src/unistd/setpgrp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | pid_t setpgrp(void) 4 | { 5 | return setpgid(0, 0); 6 | } 7 | -------------------------------------------------------------------------------- /include/sys/signal.h: -------------------------------------------------------------------------------- 1 | #warning redirecting incorrect #include to 2 | #include 3 | -------------------------------------------------------------------------------- /src/complex/cimag.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double (cimag)(double complex z) 4 | { 5 | return cimag(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/cimagf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float (cimagf)(float complex z) 4 | { 5 | return cimagf(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/internal/version.c: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | #include "libc.h" 3 | 4 | const char __libc_version[] = VERSION; 5 | -------------------------------------------------------------------------------- /src/math/i386/log.s: -------------------------------------------------------------------------------- 1 | .global log 2 | .type log,@function 3 | log: 4 | fldln2 5 | fldl 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/rintf.s: -------------------------------------------------------------------------------- 1 | .global rintf 2 | .type rintf,@function 3 | rintf: 4 | flds 4(%esp) 5 | frndint 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/i386/rintl.s: -------------------------------------------------------------------------------- 1 | .global rintl 2 | .type rintl,@function 3 | rintl: 4 | fldt 4(%esp) 5 | frndint 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/ldexp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double ldexp(double x, int n) 4 | { 5 | return scalbn(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/ldexpf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float ldexpf(float x, int n) 4 | { 5 | return scalbnf(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/x32/llrintf.s: -------------------------------------------------------------------------------- 1 | .global llrintf 2 | .type llrintf,@function 3 | llrintf: 4 | cvtss2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x32/rintl.s: -------------------------------------------------------------------------------- 1 | .global rintl 2 | .type rintl,@function 3 | rintl: 4 | fldt 8(%esp) 5 | frndint 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/x86_64/fabsl.s: -------------------------------------------------------------------------------- 1 | .global fabsl 2 | .type fabsl,@function 3 | fabsl: 4 | fldt 8(%rsp) 5 | fabs 6 | ret 7 | -------------------------------------------------------------------------------- /src/math/x86_64/llrint.s: -------------------------------------------------------------------------------- 1 | .global llrint 2 | .type llrint,@function 3 | llrint: 4 | cvtsd2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x86_64/lrintf.s: -------------------------------------------------------------------------------- 1 | .global lrintf 2 | .type lrintf,@function 3 | lrintf: 4 | cvtss2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/math/x86_64/rintl.s: -------------------------------------------------------------------------------- 1 | .global rintl 2 | .type rintl,@function 3 | rintl: 4 | fldt 8(%rsp) 5 | frndint 6 | ret 7 | -------------------------------------------------------------------------------- /src/network/in6addr_any.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; 4 | -------------------------------------------------------------------------------- /src/signal/sigrtmax.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int __libc_current_sigrtmax() 4 | { 5 | return _NSIG-1; 6 | } 7 | -------------------------------------------------------------------------------- /src/stdlib/atof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double atof(const char *s) 4 | { 5 | return strtod(s, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdlib/llabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llabs(long long a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/sem_destroy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sem_destroy(sem_t *sem) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.lo 3 | *.a 4 | *.so 5 | *.so.1 6 | config.mak 7 | lib/musl-gcc.specs 8 | /obj/ 9 | /lib/ 10 | -------------------------------------------------------------------------------- /include/sys/termios.h: -------------------------------------------------------------------------------- 1 | #warning redirecting incorrect #include to 2 | #include 3 | -------------------------------------------------------------------------------- /src/complex/creal.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double (creal)(double complex z) 4 | { 5 | return creal(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/crealf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float (crealf)(float complex z) 4 | { 5 | return crealf(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/i386/log2.s: -------------------------------------------------------------------------------- 1 | .global log2 2 | .type log2,@function 3 | log2: 4 | fld1 5 | fldl 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/logf.s: -------------------------------------------------------------------------------- 1 | .global logf 2 | .type logf,@function 3 | logf: 4 | fldln2 5 | flds 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/logl.s: -------------------------------------------------------------------------------- 1 | .global logl 2 | .type logl,@function 3 | logl: 4 | fldln2 5 | fldt 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/llroundl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llroundl(long double x) 4 | { 5 | return roundl(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/x32/log2l.s: -------------------------------------------------------------------------------- 1 | .global log2l 2 | .type log2l,@function 3 | log2l: 4 | fld1 5 | fldt 8(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x32/logl.s: -------------------------------------------------------------------------------- 1 | .global logl 2 | .type logl,@function 3 | logl: 4 | fldln2 5 | fldt 8(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/llrintf.s: -------------------------------------------------------------------------------- 1 | .global llrintf 2 | .type llrintf,@function 3 | llrintf: 4 | cvtss2si %xmm0,%rax 5 | ret 6 | -------------------------------------------------------------------------------- /src/prng/__seed48.c: -------------------------------------------------------------------------------- 1 | #include "rand48.h" 2 | 3 | unsigned short __seed48[7] = { 0, 0, 0, 0xe66d, 0xdeec, 0x5, 0xb }; 4 | -------------------------------------------------------------------------------- /src/stdio/__fclose_ca.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | int __fclose_ca(FILE *f) 4 | { 5 | return f->close(f); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdlib/imaxabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | intmax_t imaxabs(intmax_t a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /src/time/difftime.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double difftime(time_t t1, time_t t0) 4 | { 5 | return t1-t0; 6 | } 7 | -------------------------------------------------------------------------------- /src/ctype/isascii.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef isascii 3 | 4 | int isascii(int c) 5 | { 6 | return !(c&~0x7f); 7 | } 8 | -------------------------------------------------------------------------------- /src/dirent/dirfd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "__dirent.h" 3 | 4 | int dirfd(DIR *d) 5 | { 6 | return d->fd; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/i386/atanl.s: -------------------------------------------------------------------------------- 1 | .global atanl 2 | .type atanl,@function 3 | atanl: 4 | fldt 4(%esp) 5 | fld1 6 | fpatan 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/log10.s: -------------------------------------------------------------------------------- 1 | .global log10 2 | .type log10,@function 3 | log10: 4 | fldlg2 5 | fldl 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/log2f.s: -------------------------------------------------------------------------------- 1 | .global log2f 2 | .type log2f,@function 3 | log2f: 4 | fld1 5 | flds 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/log2l.s: -------------------------------------------------------------------------------- 1 | .global log2l 2 | .type log2l,@function 3 | log2l: 4 | fld1 5 | fldt 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/ldexpl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double ldexpl(long double x, int n) 4 | { 5 | return scalbnl(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/x32/atanl.s: -------------------------------------------------------------------------------- 1 | .global atanl 2 | .type atanl,@function 3 | atanl: 4 | fldt 8(%esp) 5 | fld1 6 | fpatan 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/atanl.s: -------------------------------------------------------------------------------- 1 | .global atanl 2 | .type atanl,@function 3 | atanl: 4 | fldt 8(%rsp) 5 | fld1 6 | fpatan 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/log2l.s: -------------------------------------------------------------------------------- 1 | .global log2l 2 | .type log2l,@function 3 | log2l: 4 | fld1 5 | fldt 8(%rsp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/logl.s: -------------------------------------------------------------------------------- 1 | .global logl 2 | .type logl,@function 3 | logl: 4 | fldln2 5 | fldt 8(%rsp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/stdio/fgetc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "getc.h" 3 | 4 | int fgetc(FILE *f) 5 | { 6 | return do_getc(f); 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_getconcurrency.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int pthread_getconcurrency() 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/unistd/posix_close.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_close(int fd, int flags) 4 | { 5 | return close(fd); 6 | } 7 | -------------------------------------------------------------------------------- /arch/mips/bits/hwcap.h: -------------------------------------------------------------------------------- 1 | #define HWCAP_MIPS_R6 (1 << 0) 2 | #define HWCAP_MIPS_MSA (1 << 1) 3 | #define HWCAP_MIPS_CRC32 (1 << 2) 4 | -------------------------------------------------------------------------------- /crt/aarch64/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | ldp x29,x30,[sp],#16 3 | ret 4 | 5 | .section .fini 6 | ldp x29,x30,[sp],#16 7 | ret 8 | -------------------------------------------------------------------------------- /src/complex/cabs.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double cabs(double complex z) 4 | { 5 | return hypot(creal(z), cimag(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/cabsf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float cabsf(float complex z) 4 | { 5 | return hypotf(crealf(z), cimagf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/carg.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double carg(double complex z) 4 | { 5 | return atan2(cimag(z), creal(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/cargf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float cargf(float complex z) 4 | { 5 | return atan2f(cimagf(z), crealf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/cimagl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | long double (cimagl)(long double complex z) 4 | { 5 | return cimagl(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/creall.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double (creall)(long double complex z) 4 | { 5 | return creall(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/ldso/aarch64/dlsym.s: -------------------------------------------------------------------------------- 1 | .global dlsym 2 | .hidden __dlsym 3 | .type dlsym,%function 4 | dlsym: 5 | mov x2,x30 6 | b __dlsym 7 | -------------------------------------------------------------------------------- /src/math/finite.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int finite(double x) 5 | { 6 | return isfinite(x); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/finitef.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int finitef(float x) 5 | { 6 | return isfinite(x); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/i386/log10f.s: -------------------------------------------------------------------------------- 1 | .global log10f 2 | .type log10f,@function 3 | log10f: 4 | fldlg2 5 | flds 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/log10l.s: -------------------------------------------------------------------------------- 1 | .global log10l 2 | .type log10l,@function 3 | log10l: 4 | fldlg2 5 | fldt 4(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/signgam.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | int __signgam = 0; 5 | 6 | weak_alias(__signgam, signgam); 7 | -------------------------------------------------------------------------------- /src/math/x32/log10l.s: -------------------------------------------------------------------------------- 1 | .global log10l 2 | .type log10l,@function 3 | log10l: 4 | fldlg2 5 | fldt 8(%esp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/log10l.s: -------------------------------------------------------------------------------- 1 | .global log10l 2 | .type log10l,@function 3 | log10l: 4 | fldlg2 5 | fldt 8(%rsp) 6 | fyl2x 7 | ret 8 | -------------------------------------------------------------------------------- /src/misc/ffs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "atomic.h" 3 | 4 | int ffs(int i) 5 | { 6 | return i ? a_ctz_l(i)+1 : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/multibyte/mblen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int mblen(const char *s, size_t n) 4 | { 5 | return mbtowc(0, s, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/network/in6addr_loopback.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; 4 | -------------------------------------------------------------------------------- /src/process/wait.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | pid_t wait(int *status) 4 | { 5 | return waitpid((pid_t)-1, status, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdio/getchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "getc.h" 3 | 4 | int getchar(void) 5 | { 6 | return do_getc(stdin); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdlib/div.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | div_t div(int num, int den) 4 | { 5 | return (div_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/sem_wait.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sem_wait(sem_t *sem) 4 | { 5 | return sem_timedwait(sem, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/unistd/sync.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | void sync(void) 5 | { 6 | __syscall(SYS_sync); 7 | } 8 | -------------------------------------------------------------------------------- /arch/mips64/bits/hwcap.h: -------------------------------------------------------------------------------- 1 | #define HWCAP_MIPS_R6 (1 << 0) 2 | #define HWCAP_MIPS_MSA (1 << 1) 3 | #define HWCAP_MIPS_CRC32 (1 << 2) 4 | -------------------------------------------------------------------------------- /arch/mipsn32/bits/hwcap.h: -------------------------------------------------------------------------------- 1 | #define HWCAP_MIPS_R6 (1 << 0) 2 | #define HWCAP_MIPS_MSA (1 << 1) 3 | #define HWCAP_MIPS_CRC32 (1 << 2) 4 | -------------------------------------------------------------------------------- /src/dirent/telldir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "__dirent.h" 3 | 4 | long telldir(DIR *dir) 5 | { 6 | return dir->tell; 7 | } 8 | -------------------------------------------------------------------------------- /src/ldso/or1k/dlsym.s: -------------------------------------------------------------------------------- 1 | .global dlsym 2 | .hidden __dlsym 3 | .type dlsym,@function 4 | dlsym: 5 | l.j __dlsym 6 | l.ori r5, r9, 0 7 | -------------------------------------------------------------------------------- /src/ldso/s390x/dlsym.s: -------------------------------------------------------------------------------- 1 | .global dlsym 2 | .hidden __dlsym 3 | .type dlsym,@function 4 | dlsym: 5 | lgr %r4, %r14 6 | jg __dlsym 7 | -------------------------------------------------------------------------------- /src/math/i386/atan2l.s: -------------------------------------------------------------------------------- 1 | .global atan2l 2 | .type atan2l,@function 3 | atan2l: 4 | fldt 4(%esp) 5 | fldt 16(%esp) 6 | fpatan 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x32/atan2l.s: -------------------------------------------------------------------------------- 1 | .global atan2l 2 | .type atan2l,@function 3 | atan2l: 4 | fldt 8(%esp) 5 | fldt 24(%esp) 6 | fpatan 7 | ret 8 | -------------------------------------------------------------------------------- /src/misc/ffsl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "atomic.h" 3 | 4 | int ffsl(long i) 5 | { 6 | return i ? a_ctz_l(i)+1 : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/multibyte/mbsinit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int mbsinit(const mbstate_t *st) 4 | { 5 | return !st || !*(unsigned *)st; 6 | } 7 | -------------------------------------------------------------------------------- /src/stdio/fputc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "putc.h" 3 | 4 | int fputc(int c, FILE *f) 5 | { 6 | return do_putc(c, f); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/getchar_unlocked.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | int getchar_unlocked(void) 4 | { 5 | return getc_unlocked(stdin); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdio/getwc.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | #include 3 | 4 | wint_t getwc(FILE *f) 5 | { 6 | return fgetwc(f); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "putc.h" 3 | 4 | int putchar(int c) 5 | { 6 | return do_putc(c, stdout); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdlib/ldiv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ldiv_t ldiv(long num, long den) 4 | { 5 | return (ldiv_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/unistd/dup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int dup(int fd) 5 | { 6 | return syscall(SYS_dup, fd); 7 | } 8 | -------------------------------------------------------------------------------- /arch/arm/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if __ARMEB__ 2 | #define __BYTE_ORDER __BIG_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __LITTLE_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /src/complex/conj.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double complex conj(double complex z) 4 | { 5 | return CMPLX(creal(z), -cimag(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/conjf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex conjf(float complex z) 4 | { 5 | return CMPLXF(crealf(z), -cimagf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/conf/pathconf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long pathconf(const char *path, int name) 4 | { 5 | return fpathconf(-1, name); 6 | } 7 | -------------------------------------------------------------------------------- /src/ldso/x32/dlsym.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global dlsym 3 | .hidden __dlsym 4 | .type dlsym,@function 5 | dlsym: 6 | mov (%rsp),%rdx 7 | jmp __dlsym 8 | -------------------------------------------------------------------------------- /src/math/x86_64/atan2l.s: -------------------------------------------------------------------------------- 1 | .global atan2l 2 | .type atan2l,@function 3 | atan2l: 4 | fldt 8(%rsp) 5 | fldt 24(%rsp) 6 | fpatan 7 | ret 8 | -------------------------------------------------------------------------------- /src/stdio/putchar_unlocked.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | int putchar_unlocked(int c) 4 | { 5 | return putc_unlocked(c, stdout); 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/cnd_destroy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void cnd_destroy(cnd_t *c) 4 | { 5 | /* For private cv this is a no-op */ 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/cnd_init.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int cnd_init(cnd_t *c) 4 | { 5 | *c = (cnd_t){ 0 }; 6 | return thrd_success; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_attr_destroy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_attr_destroy(pthread_attr_t *a) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/unistd/_exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | _Noreturn void _exit(int status) 5 | { 6 | _Exit(status); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | gid_t getgid(void) 5 | { 6 | return __syscall(SYS_getgid); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getlogin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *getlogin(void) 5 | { 6 | return getenv("LOGNAME"); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getpid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | pid_t getpid(void) 5 | { 6 | return __syscall(SYS_getpid); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | uid_t getuid(void) 5 | { 6 | return __syscall(SYS_getuid); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/setsid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | pid_t setsid(void) 5 | { 6 | return syscall(SYS_setsid); 7 | } 8 | -------------------------------------------------------------------------------- /arch/aarch64/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if __AARCH64EB__ 2 | #define __BYTE_ORDER __BIG_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __LITTLE_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /arch/sh/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if __BIG_ENDIAN__ 2 | #define __BYTE_ORDER __BIG_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __LITTLE_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /crt/arm/crtn.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | 3 | .section .init 4 | pop {r0,lr} 5 | bx lr 6 | 7 | .section .fini 8 | pop {r0,lr} 9 | bx lr 10 | -------------------------------------------------------------------------------- /src/complex/ccoshl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | //FIXME 4 | long double complex ccoshl(long double complex z) 5 | { 6 | return ccosh(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/cexpl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | //FIXME 4 | long double complex cexpl(long double complex z) 5 | { 6 | return cexp(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/csinhl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | //FIXME 4 | long double complex csinhl(long double complex z) 5 | { 6 | return csinh(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/csqrtl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | //FIXME 4 | long double complex csqrtl(long double complex z) 5 | { 6 | return csqrt(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/ctanhl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | //FIXME 4 | long double complex ctanhl(long double complex z) 5 | { 6 | return ctanh(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/internal/sh/__shcall.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | hidden int __shcall(void *arg, int (*func)(void *)) 4 | { 5 | return func(arg); 6 | } 7 | -------------------------------------------------------------------------------- /src/ldso/dlclose.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dynlink.h" 3 | 4 | int dlclose(void *p) 5 | { 6 | return __dl_invalid_handle(p); 7 | } 8 | -------------------------------------------------------------------------------- /src/ldso/x86_64/dlsym.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global dlsym 3 | .hidden __dlsym 4 | .type dlsym,@function 5 | dlsym: 6 | mov (%rsp),%rdx 7 | jmp __dlsym 8 | -------------------------------------------------------------------------------- /src/math/i386/lrint.s: -------------------------------------------------------------------------------- 1 | .global lrint 2 | .type lrint,@function 3 | lrint: 4 | fldl 4(%esp) 5 | fistpl 4(%esp) 6 | mov 4(%esp),%eax 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/sqrtf.s: -------------------------------------------------------------------------------- 1 | .global sqrtf 2 | .type sqrtf,@function 3 | sqrtf: flds 4(%esp) 4 | fsqrt 5 | fstps 4(%esp) 6 | flds 4(%esp) 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/lgamma.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | double lgamma(double x) 5 | { 6 | return __lgamma_r(x, &__signgam); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/lgammaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | float lgammaf(float x) 5 | { 6 | return __lgammaf_r(x, &__signgam); 7 | } 8 | -------------------------------------------------------------------------------- /src/misc/ffsll.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "atomic.h" 3 | 4 | int ffsll(long long i) 5 | { 6 | return i ? a_ctz_64(i)+1 : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/mq/mq_close.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int mq_close(mqd_t mqd) 5 | { 6 | return syscall(SYS_close, mqd); 7 | } 8 | -------------------------------------------------------------------------------- /src/prng/srand48.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void srand48(long seed) 4 | { 5 | seed48((unsigned short [3]){ 0x330e, seed, seed>>16 }); 6 | } 7 | -------------------------------------------------------------------------------- /src/process/s390x/vfork.s: -------------------------------------------------------------------------------- 1 | .global vfork 2 | .type vfork,%function 3 | vfork: 4 | svc 190 5 | .hidden __syscall_ret 6 | jg __syscall_ret 7 | -------------------------------------------------------------------------------- /src/sched/sched_yield.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int sched_yield() 5 | { 6 | return syscall(SYS_sched_yield); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/putwc.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | #include 3 | 4 | wint_t putwc(wchar_t c, FILE *f) 5 | { 6 | return fputwc(c, f); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/setlinebuf.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | void setlinebuf(FILE *f) 5 | { 6 | setvbuf(f, 0, _IOLBF, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/string/strrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strrchr(const char *s, int c) 4 | { 5 | return __memrchr(s, c, strlen(s) + 1); 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_mutex_destroy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int pthread_mutex_destroy(pthread_mutex_t *mutex) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_spin_destroy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_spin_destroy(pthread_spinlock_t *s) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/thrd_yield.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | void thrd_yield() 5 | { 6 | __syscall(SYS_sched_yield); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/fsync.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int fsync(int fd) 5 | { 6 | return syscall_cp(SYS_fsync, fd); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getegid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | gid_t getegid(void) 5 | { 6 | return __syscall(SYS_getegid); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/geteuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | uid_t geteuid(void) 5 | { 6 | return __syscall(SYS_geteuid); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getppid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | pid_t getppid(void) 5 | { 6 | return __syscall(SYS_getppid); 7 | } 8 | -------------------------------------------------------------------------------- /arch/powerpc64/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if __BIG_ENDIAN__ 2 | #define __BYTE_ORDER __BIG_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __LITTLE_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /src/complex/ccosf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex ccosf(float complex z) 4 | { 5 | return ccoshf(CMPLXF(-cimagf(z), crealf(z))); 6 | } 7 | -------------------------------------------------------------------------------- /src/complex/cpowf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex cpowf(float complex z, float complex c) 4 | { 5 | return cexpf(c * clogf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/ldso/microblaze/dlsym.s: -------------------------------------------------------------------------------- 1 | .global dlsym 2 | .hidden __dlsym 3 | .type dlsym,@function 4 | dlsym: 5 | brid __dlsym 6 | add r7, r15, r0 7 | -------------------------------------------------------------------------------- /src/math/i386/lrintf.s: -------------------------------------------------------------------------------- 1 | .global lrintf 2 | .type lrintf,@function 3 | lrintf: 4 | flds 4(%esp) 5 | fistpl 4(%esp) 6 | mov 4(%esp),%eax 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/i386/lrintl.s: -------------------------------------------------------------------------------- 1 | .global lrintl 2 | .type lrintl,@function 3 | lrintl: 4 | fldt 4(%esp) 5 | fistpl 4(%esp) 6 | mov 4(%esp),%eax 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/nexttowardl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double nexttowardl(long double x, long double y) 4 | { 5 | return nextafterl(x, y); 6 | } 7 | -------------------------------------------------------------------------------- /src/math/significand.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | double significand(double x) 5 | { 6 | return scalbn(x, -ilogb(x)); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/x32/llrintl.s: -------------------------------------------------------------------------------- 1 | .global llrintl 2 | .type llrintl,@function 3 | llrintl: 4 | fldt 8(%esp) 5 | fistpll 8(%esp) 6 | mov 8(%esp),%rax 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x32/lrintl.s: -------------------------------------------------------------------------------- 1 | .global lrintl 2 | .type lrintl,@function 3 | lrintl: 4 | fldt 8(%esp) 5 | fistpll 8(%esp) 6 | mov 8(%esp),%rax 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/lrintl.s: -------------------------------------------------------------------------------- 1 | .global lrintl 2 | .type lrintl,@function 3 | lrintl: 4 | fldt 8(%rsp) 5 | fistpll 8(%rsp) 6 | mov 8(%rsp),%rax 7 | ret 8 | -------------------------------------------------------------------------------- /src/mman/munlockall.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int munlockall(void) 5 | { 6 | return syscall(SYS_munlockall); 7 | } 8 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_destroy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_destroy(posix_spawnattr_t *attr) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/signal/psiginfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void psiginfo(const siginfo_t *si, const char *msg) 4 | { 5 | psignal(si->si_signo, msg); 6 | } 7 | -------------------------------------------------------------------------------- /src/stat/mkfifo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int mkfifo(const char *path, mode_t mode) 4 | { 5 | return mknod(path, mode | S_IFIFO, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/stat/umask.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | mode_t umask(mode_t mode) 5 | { 6 | return syscall(SYS_umask, mode); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/vprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int vprintf(const char *restrict fmt, va_list ap) 4 | { 5 | return vfprintf(stdout, fmt, ap); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdlib/lldiv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | lldiv_t lldiv(long long num, long long den) 4 | { 5 | return (lldiv_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_rwlock_destroy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_rwlock_destroy(pthread_rwlock_t *rw) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_setschedprio.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_setschedprio(pthread_t t, int prio) 4 | { 5 | return ENOSYS; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/tss_delete.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void tss_delete(tss_t key) 5 | { 6 | __pthread_key_delete(key); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getpgrp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | pid_t getpgrp(void) 5 | { 6 | return __syscall(SYS_getpgid, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getsid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | pid_t getsid(pid_t pid) 5 | { 6 | return syscall(SYS_getsid, pid); 7 | } 8 | -------------------------------------------------------------------------------- /arch/microblaze/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if __MICROBLAZEEL__ 2 | #define __BYTE_ORDER __LITTLE_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __BIG_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /crt/x32/crti.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .global _init 3 | _init: 4 | push %rax 5 | 6 | .section .fini 7 | .global _fini 8 | _fini: 9 | push %rax 10 | -------------------------------------------------------------------------------- /crt/x86_64/crti.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .global _init 3 | _init: 4 | push %rax 5 | 6 | .section .fini 7 | .global _fini 8 | _fini: 9 | push %rax 10 | -------------------------------------------------------------------------------- /src/complex/conjl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | long double complex conjl(long double complex z) 4 | { 5 | return CMPLXL(creall(z), -cimagl(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/ldso/arm/dlsym.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .text 3 | .global dlsym 4 | .hidden __dlsym 5 | .type dlsym,%function 6 | dlsym: 7 | mov r2,lr 8 | b __dlsym 9 | -------------------------------------------------------------------------------- /src/legacy/isastream.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int isastream(int fd) 5 | { 6 | return fcntl(fd, F_GETFD) < 0 ? -1 : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/linux/flock.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int flock(int fd, int op) 5 | { 6 | return syscall(SYS_flock, fd, op); 7 | } 8 | -------------------------------------------------------------------------------- /src/linux/setfsgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int setfsgid(gid_t gid) 5 | { 6 | return syscall(SYS_setfsgid, gid); 7 | } 8 | -------------------------------------------------------------------------------- /src/linux/setfsuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int setfsuid(uid_t uid) 5 | { 6 | return syscall(SYS_setfsuid, uid); 7 | } 8 | -------------------------------------------------------------------------------- /src/locale/catgets.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *catgets (nl_catd catd, int set_id, int msg_id, const char *s) 4 | { 5 | return (char *)s; 6 | } 7 | -------------------------------------------------------------------------------- /src/math/aarch64/ceil.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double ceil(double x) 4 | { 5 | __asm__ ("frintp %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/ceilf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float ceilf(float x) 4 | { 5 | __asm__ ("frintp %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/fabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fabs(double x) 4 | { 5 | __asm__ ("fabs %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/fabsf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fabsf(float x) 4 | { 5 | __asm__ ("fabs %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/floor.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double floor(double x) 4 | { 5 | __asm__ ("frintm %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/floorf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float floorf(float x) 4 | { 5 | __asm__ ("frintm %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/rint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double rint(double x) 4 | { 5 | __asm__ ("frintx %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/rintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float rintf(float x) 4 | { 5 | __asm__ ("frintx %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/round.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double round(double x) 4 | { 5 | __asm__ ("frinta %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/roundf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float roundf(float x) 4 | { 5 | __asm__ ("frinta %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/sqrt.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double sqrt(double x) 4 | { 5 | __asm__ ("fsqrt %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/sqrtf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float sqrtf(float x) 4 | { 5 | __asm__ ("fsqrt %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/trunc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double trunc(double x) 4 | { 5 | __asm__ ("frintz %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/truncf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float truncf(float x) 4 | { 5 | __asm__ ("frintz %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/powerpc64/fabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fabs(double x) 4 | { 5 | __asm__ ("fabs %0, %1" : "=d"(x) : "d"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/powerpc64/fabsf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fabsf(float x) 4 | { 5 | __asm__ ("fabs %0, %1" : "=f"(x) : "f"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/powerpc64/sqrt.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double sqrt(double x) 4 | { 5 | __asm__ ("fsqrt %0, %1" : "=d"(x) : "d"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/powerpc64/sqrtf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float sqrtf(float x) 4 | { 5 | __asm__ ("fsqrts %0, %1" : "=f"(x) : "f"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/significandf.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | float significandf(float x) 5 | { 6 | return scalbnf(x, -ilogbf(x)); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/x32/fabsf.s: -------------------------------------------------------------------------------- 1 | .global fabsf 2 | .type fabsf,@function 3 | fabsf: 4 | mov $0x7fffffff,%eax 5 | movq %rax,%xmm1 6 | andps %xmm1,%xmm0 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/fabsf.s: -------------------------------------------------------------------------------- 1 | .global fabsf 2 | .type fabsf,@function 3 | fabsf: 4 | mov $0x7fffffff,%eax 5 | movq %rax,%xmm1 6 | andps %xmm1,%xmm0 7 | ret 8 | -------------------------------------------------------------------------------- /src/math/x86_64/llrintl.s: -------------------------------------------------------------------------------- 1 | .global llrintl 2 | .type llrintl,@function 3 | llrintl: 4 | fldt 8(%rsp) 5 | fistpll 8(%rsp) 6 | mov 8(%rsp),%rax 7 | ret 8 | -------------------------------------------------------------------------------- /src/misc/issetugid.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include "libc.h" 4 | 5 | int issetugid(void) 6 | { 7 | return libc.secure; 8 | } 9 | -------------------------------------------------------------------------------- /src/mman/mlockall.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int mlockall(int flags) 5 | { 6 | return syscall(SYS_mlockall, flags); 7 | } 8 | -------------------------------------------------------------------------------- /src/passwd/lckpwdf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int lckpwdf() 4 | { 5 | return 0; 6 | } 7 | 8 | int ulckpwdf() 9 | { 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/signal/kill.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int kill(pid_t pid, int sig) 5 | { 6 | return syscall(SYS_kill, pid, sig); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/putw.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int putw(int x, FILE *f) 5 | { 6 | return (int)fwrite(&x, sizeof x, 1, f)-1; 7 | } 8 | -------------------------------------------------------------------------------- /src/stdlib/imaxdiv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | imaxdiv_t imaxdiv(intmax_t num, intmax_t den) 4 | { 5 | return (imaxdiv_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_condattr_destroy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_condattr_destroy(pthread_condattr_t *a) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_mutexattr_destroy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_mutexattr_destroy(pthread_mutexattr_t *a) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_spin_init.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_spin_init(pthread_spinlock_t *s, int shared) 4 | { 5 | return *s = 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/time/asctime.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *asctime(const struct tm *tm) 4 | { 5 | static char buf[26]; 6 | return __asctime_r(tm, buf); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/chdir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int chdir(const char *path) 5 | { 6 | return syscall(SYS_chdir, path); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/fdatasync.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int fdatasync(int fd) 5 | { 6 | return syscall_cp(SYS_fdatasync, fd); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/getpgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | pid_t getpgid(pid_t pid) 5 | { 6 | return syscall(SYS_getpgid, pid); 7 | } 8 | -------------------------------------------------------------------------------- /crt/i386/crti.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .global _init 3 | _init: 4 | sub $12,%esp 5 | 6 | .section .fini 7 | .global _fini 8 | _fini: 9 | sub $12,%esp 10 | -------------------------------------------------------------------------------- /src/ctype/toascii.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* nonsense function that should NEVER be used! */ 4 | int toascii(int c) 5 | { 6 | return c & 0x7f; 7 | } 8 | -------------------------------------------------------------------------------- /src/fenv/fegetexceptflag.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fegetexceptflag(fexcept_t *fp, int mask) 4 | { 5 | *fp = fetestexcept(mask); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/legacy/getpagesize.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "libc.h" 4 | 5 | int getpagesize(void) 6 | { 7 | return PAGE_SIZE; 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/adjtimex.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int adjtimex(struct timex *tx) 5 | { 6 | return syscall(SYS_adjtimex, tx); 7 | } 8 | -------------------------------------------------------------------------------- /src/misc/uname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int uname(struct utsname *uts) 5 | { 6 | return syscall(SYS_uname, uts); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/if_freenameindex.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void if_freenameindex(struct if_nameindex *idx) 5 | { 6 | free(idx); 7 | } 8 | -------------------------------------------------------------------------------- /src/stat/futimens.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int futimens(int fd, const struct timespec times[2]) 4 | { 5 | return utimensat(fd, 0, times, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdio/getw.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int getw(FILE *f) 5 | { 6 | int x; 7 | return fread(&x, sizeof x, 1, f) ? x : EOF; 8 | } 9 | -------------------------------------------------------------------------------- /src/string/wcslen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcslen(const wchar_t *s) 4 | { 5 | const wchar_t *a; 6 | for (a=s; *s; s++); 7 | return s-a; 8 | } 9 | -------------------------------------------------------------------------------- /src/termios/tcflow.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int tcflow(int fd, int action) 5 | { 6 | return ioctl(fd, TCXONC, action); 7 | } 8 | -------------------------------------------------------------------------------- /src/termios/tcflush.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int tcflush(int fd, int queue) 5 | { 6 | return ioctl(fd, TCFLSH, queue); 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_rwlockattr_destroy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_rwlockattr_destroy(pthread_rwlockattr_t *a) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/sem_unlink.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int sem_unlink(const char *name) 5 | { 6 | return shm_unlink(name); 7 | } 8 | -------------------------------------------------------------------------------- /src/time/times.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | clock_t times(struct tms *tms) 5 | { 6 | return __syscall(SYS_times, tms); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/ctermid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *ctermid(char *s) 5 | { 6 | return s ? strcpy(s, "/dev/tty") : "/dev/tty"; 7 | } 8 | -------------------------------------------------------------------------------- /arch/mips/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if _MIPSEL || __MIPSEL || __MIPSEL__ 2 | #define __BYTE_ORDER __LITTLE_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __BIG_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /arch/mips64/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if _MIPSEL || __MIPSEL || __MIPSEL__ 2 | #define __BYTE_ORDER __LITTLE_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __BIG_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /arch/mipsn32/bits/endian.h: -------------------------------------------------------------------------------- 1 | #if _MIPSEL || __MIPSEL || __MIPSEL__ 2 | #define __BYTE_ORDER __LITTLE_ENDIAN 3 | #else 4 | #define __BYTE_ORDER __BIG_ENDIAN 5 | #endif 6 | -------------------------------------------------------------------------------- /src/complex/cacoshf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex cacoshf(float complex z) 4 | { 5 | z = cacosf(z); 6 | return CMPLXF(-cimagf(z), crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/ctype/__ctype_get_mb_cur_max.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "locale_impl.h" 3 | 4 | size_t __ctype_get_mb_cur_max() 5 | { 6 | return MB_CUR_MAX; 7 | } 8 | -------------------------------------------------------------------------------- /src/fenv/feholdexcept.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int feholdexcept(fenv_t *envp) 4 | { 5 | fegetenv(envp); 6 | feclearexcept(FE_ALL_EXCEPT); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/pivot_root.c: -------------------------------------------------------------------------------- 1 | #include "syscall.h" 2 | 3 | int pivot_root(const char *new, const char *old) 4 | { 5 | return syscall(SYS_pivot_root, new, old); 6 | } 7 | -------------------------------------------------------------------------------- /src/linux/syncfs.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int syncfs(int fd) 6 | { 7 | return syscall(SYS_syncfs, fd); 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/vhangup.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int vhangup(void) 6 | { 7 | return syscall(SYS_vhangup); 8 | } 9 | -------------------------------------------------------------------------------- /src/math/aarch64/nearbyint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double nearbyint(double x) 4 | { 5 | __asm__ ("frinti %d0, %d1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/nearbyintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float nearbyintf(float x) 4 | { 5 | __asm__ ("frinti %s0, %s1" : "=w"(x) : "w"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/lrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* uses LONG_MAX > 2^24, see comments in lrint.c */ 4 | 5 | long lrintf(float x) 6 | { 7 | return rintf(x); 8 | } 9 | -------------------------------------------------------------------------------- /src/network/h_errno.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #undef h_errno 4 | int h_errno; 5 | 6 | int *__h_errno_location(void) 7 | { 8 | return &h_errno; 9 | } 10 | -------------------------------------------------------------------------------- /src/stat/mkfifoat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int mkfifoat(int fd, const char *path, mode_t mode) 4 | { 5 | return mknodat(fd, path, mode | S_IFIFO, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdio/setbuf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setbuf(FILE *restrict f, char *restrict buf) 4 | { 5 | setvbuf(f, buf, buf ? _IOFBF : _IONBF, BUFSIZ); 6 | } 7 | -------------------------------------------------------------------------------- /src/string/bzero.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | void bzero(void *s, size_t n) 6 | { 7 | memset(s, 0, n); 8 | } 9 | -------------------------------------------------------------------------------- /src/string/strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strcpy(char *restrict dest, const char *restrict src) 4 | { 5 | __stpcpy(dest, src); 6 | return dest; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/strnlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t strnlen(const char *s, size_t n) 4 | { 5 | const char *p = memchr(s, 0, n); 6 | return p ? p-s : n; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/strpbrk.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strpbrk(const char *s, const char *b) 4 | { 5 | s += strcspn(s, b); 6 | return *s ? (char *)s : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcpcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcpcpy(wchar_t *restrict d, const wchar_t *restrict s) 4 | { 5 | return wcscpy(d, s) + wcslen(s); 6 | } 7 | -------------------------------------------------------------------------------- /src/string/wcswcs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcswcs(const wchar_t *haystack, const wchar_t *needle) 4 | { 5 | return wcsstr(haystack, needle); 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_barrierattr_destroy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_barrierattr_destroy(pthread_barrierattr_t *a) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_spin_unlock.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_spin_unlock(pthread_spinlock_t *s) 4 | { 5 | a_store(s, 0); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/s390x/__unmapself.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global __unmapself 3 | .type __unmapself, @function 4 | __unmapself: 5 | svc 91 # SYS_munmap 6 | svc 1 # SYS_exit 7 | -------------------------------------------------------------------------------- /src/time/localtime.c: -------------------------------------------------------------------------------- 1 | #include "time_impl.h" 2 | 3 | struct tm *localtime(const time_t *t) 4 | { 5 | static struct tm tm; 6 | return __localtime_r(t, &tm); 7 | } 8 | -------------------------------------------------------------------------------- /arch/mips/bits/resource.h: -------------------------------------------------------------------------------- 1 | #define RLIMIT_NOFILE 5 2 | #define RLIMIT_AS 6 3 | #define RLIMIT_RSS 7 4 | #define RLIMIT_NPROC 8 5 | #define RLIMIT_MEMLOCK 9 6 | -------------------------------------------------------------------------------- /arch/mips64/bits/resource.h: -------------------------------------------------------------------------------- 1 | #define RLIMIT_NOFILE 5 2 | #define RLIMIT_AS 6 3 | #define RLIMIT_RSS 7 4 | #define RLIMIT_NPROC 8 5 | #define RLIMIT_MEMLOCK 9 6 | -------------------------------------------------------------------------------- /arch/mipsn32/bits/resource.h: -------------------------------------------------------------------------------- 1 | #define RLIMIT_NOFILE 5 2 | #define RLIMIT_AS 6 3 | #define RLIMIT_RSS 7 4 | #define RLIMIT_NPROC 8 5 | #define RLIMIT_MEMLOCK 9 6 | -------------------------------------------------------------------------------- /include/sys/reg.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_REG_H 2 | #define _SYS_REG_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ldso/dlsym.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dynlink.h" 3 | 4 | void *dlsym(void *restrict p, const char *restrict s) 5 | { 6 | return __dlsym(p, s, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/lround.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lround(double x) 4 | { 5 | long n; 6 | __asm__ ("fcvtas %x0, %d1" : "=r"(n) : "w"(x)); 7 | return n; 8 | } 9 | -------------------------------------------------------------------------------- /src/math/aarch64/lroundf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lroundf(float x) 4 | { 5 | long n; 6 | __asm__ ("fcvtas %x0, %s1" : "=r"(n) : "w"(x)); 7 | return n; 8 | } 9 | -------------------------------------------------------------------------------- /src/math/i386/llrint.s: -------------------------------------------------------------------------------- 1 | .global llrint 2 | .type llrint,@function 3 | llrint: 4 | fldl 4(%esp) 5 | fistpll 4(%esp) 6 | mov 4(%esp),%eax 7 | mov 8(%esp),%edx 8 | ret 9 | -------------------------------------------------------------------------------- /src/math/llrint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* uses LLONG_MAX > 2^53, see comments in lrint.c */ 4 | 5 | long long llrint(double x) 6 | { 7 | return rint(x); 8 | } 9 | -------------------------------------------------------------------------------- /src/math/llrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* uses LLONG_MAX > 2^24, see comments in lrint.c */ 4 | 5 | long long llrintf(float x) 6 | { 7 | return rintf(x); 8 | } 9 | -------------------------------------------------------------------------------- /src/mman/mlock.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int mlock(const void *addr, size_t len) 5 | { 6 | return syscall(SYS_mlock, addr, len); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/recv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ssize_t recv(int fd, void *buf, size_t len, int flags) 4 | { 5 | return recvfrom(fd, buf, len, flags, 0, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdio/getc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "getc.h" 3 | 4 | int getc(FILE *f) 5 | { 6 | return do_getc(f); 7 | } 8 | 9 | weak_alias(getc, _IO_getc); 10 | -------------------------------------------------------------------------------- /src/stdio/getline.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ssize_t getline(char **restrict s, size_t *restrict n, FILE *restrict f) 4 | { 5 | return getdelim(s, n, '\n', f); 6 | } 7 | -------------------------------------------------------------------------------- /src/string/index.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | char *index(const char *s, int c) 6 | { 7 | return strchr(s, c); 8 | } 9 | -------------------------------------------------------------------------------- /src/string/strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strncpy(char *restrict d, const char *restrict s, size_t n) 4 | { 5 | __stpncpy(d, s, n); 6 | return d; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcscasecmp_l.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcscasecmp_l(const wchar_t *l, const wchar_t *r, locale_t locale) 4 | { 5 | return wcscasecmp(l, r); 6 | } 7 | -------------------------------------------------------------------------------- /src/temp/mkstemp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int mkstemp(char *template) 4 | { 5 | return __mkostemps(template, 0, 0); 6 | } 7 | 8 | weak_alias(mkstemp, mkstemp64); 9 | -------------------------------------------------------------------------------- /src/thread/default_attr.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | unsigned __default_stacksize = DEFAULT_STACK_SIZE; 4 | unsigned __default_guardsize = DEFAULT_GUARD_SIZE; 5 | -------------------------------------------------------------------------------- /src/time/ctime.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ctime(const time_t *t) 4 | { 5 | struct tm *tm = localtime(t); 6 | if (!tm) return 0; 7 | return asctime(tm); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/setpgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int setpgid(pid_t pid, pid_t pgid) 5 | { 6 | return syscall(SYS_setpgid, pid, pgid); 7 | } 8 | -------------------------------------------------------------------------------- /crt/or1k/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | l.lwz r9,0(r1) 3 | l.jr r9 4 | l.addi r1,r1,4 5 | 6 | .section .fini 7 | l.lwz r9,0(r1) 8 | l.jr r9 9 | l.addi r1,r1,4 10 | -------------------------------------------------------------------------------- /include/stdnoreturn.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDNORETURN_H 2 | #define _STDNORETURN_H 3 | #ifndef __cplusplus 4 | #include 5 | #define noreturn _Noreturn 6 | #endif 7 | #endif 8 | -------------------------------------------------------------------------------- /src/internal/floatscan.h: -------------------------------------------------------------------------------- 1 | #ifndef FLOATSCAN_H 2 | #define FLOATSCAN_H 3 | 4 | #include 5 | 6 | hidden long double __floatscan(FILE *, int, int); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/legacy/valloc.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include "libc.h" 4 | 5 | void *valloc(size_t size) 6 | { 7 | return memalign(PAGE_SIZE, size); 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/reboot.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int reboot(int type) 5 | { 6 | return syscall(SYS_reboot, 0xfee1dead, 672274793, type); 7 | } 8 | -------------------------------------------------------------------------------- /src/linux/unshare.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int unshare(int flags) 6 | { 7 | return syscall(SYS_unshare, flags); 8 | } 9 | -------------------------------------------------------------------------------- /src/locale/pleval.h: -------------------------------------------------------------------------------- 1 | #ifndef PLEVAL_H 2 | #define PLEVAL_H 3 | 4 | #include 5 | 6 | hidden unsigned long __pleval(const char *, unsigned long); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/math/aarch64/fmaxf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fmaxf(float x, float y) 4 | { 5 | __asm__ ("fmaxnm %s0, %s1, %s2" : "=w"(x) : "w"(x), "w"(y)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/fminf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fminf(float x, float y) 4 | { 5 | __asm__ ("fminnm %s0, %s1, %s2" : "=w"(x) : "w"(x), "w"(y)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/i386/llrintl.s: -------------------------------------------------------------------------------- 1 | .global llrintl 2 | .type llrintl,@function 3 | llrintl: 4 | fldt 4(%esp) 5 | fistpll 4(%esp) 6 | mov 4(%esp),%eax 7 | mov 8(%esp),%edx 8 | ret 9 | -------------------------------------------------------------------------------- /src/mman/munlock.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int munlock(const void *addr, size_t len) 5 | { 6 | return syscall(SYS_munlock, addr, len); 7 | } 8 | -------------------------------------------------------------------------------- /src/mq/mq_getattr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int mq_getattr(mqd_t mqd, struct mq_attr *attr) 5 | { 6 | return mq_setattr(mqd, 0, attr); 7 | } 8 | -------------------------------------------------------------------------------- /src/mq/mq_send.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int mq_send(mqd_t mqd, const char *msg, size_t len, unsigned prio) 4 | { 5 | return mq_timedsend(mqd, msg, len, prio, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/multibyte/wctomb.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int wctomb(char *s, wchar_t wc) 5 | { 6 | if (!s) return 0; 7 | return wcrtomb(s, wc, 0); 8 | } 9 | -------------------------------------------------------------------------------- /src/network/send.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ssize_t send(int fd, const void *buf, size_t len, int flags) 4 | { 5 | return sendto(fd, buf, len, flags, 0, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/signal/sigpending.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int sigpending(sigset_t *set) 5 | { 6 | return syscall(SYS_rt_sigpending, set, _NSIG/8); 7 | } 8 | -------------------------------------------------------------------------------- /src/string/rindex.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | char *rindex(const char *s, int c) 6 | { 7 | return strrchr(s, c); 8 | } 9 | -------------------------------------------------------------------------------- /src/string/wcscasecmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int wcscasecmp(const wchar_t *l, const wchar_t *r) 5 | { 6 | return wcsncasecmp(l, r, -1); 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcscmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcscmp(const wchar_t *l, const wchar_t *r) 4 | { 5 | for (; *l==*r && *l && *r; l++, r++); 6 | return *l - *r; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/call_once.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void call_once(once_flag *flag, void (*func)(void)) 5 | { 6 | __pthread_once(flag, func); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/setgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | #include "libc.h" 4 | 5 | int setgid(gid_t gid) 6 | { 7 | return __setxid(SYS_setgid, gid, 0, 0); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/setuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | #include "libc.h" 4 | 5 | int setuid(uid_t uid) 6 | { 7 | return __setxid(SYS_setuid, uid, 0, 0); 8 | } 9 | -------------------------------------------------------------------------------- /src/complex/ccos.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* cos(z) = cosh(i z) */ 4 | 5 | double complex ccos(double complex z) 6 | { 7 | return ccosh(CMPLX(-cimag(z), creal(z))); 8 | } 9 | -------------------------------------------------------------------------------- /src/include/langinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef LANGINFO_H 2 | #define LANGINFO_H 3 | 4 | #include "../../include/langinfo.h" 5 | 6 | char *__nl_langinfo_l(nl_item, locale_t); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/linux/chroot.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int chroot(const char *path) 6 | { 7 | return syscall(SYS_chroot, path); 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/klogctl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int klogctl (int type, char *buf, int len) 5 | { 6 | return syscall(SYS_syslog, type, buf, len); 7 | } 8 | -------------------------------------------------------------------------------- /src/locale/iconv_close.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int iconv_close(iconv_t cd) 5 | { 6 | if (!((size_t)cd & 1)) free((void *)cd); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/malloc/aligned_alloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "malloc_impl.h" 3 | 4 | void *aligned_alloc(size_t align, size_t len) 5 | { 6 | return __memalign(align, len); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/fmax.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fmax(double x, double y) 4 | { 5 | __asm__ ("fmaxnm %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/fmin.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fmin(double x, double y) 4 | { 5 | __asm__ ("fminnm %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/aarch64/llround.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llround(double x) 4 | { 5 | long long n; 6 | __asm__ ("fcvtas %x0, %d1" : "=r"(n) : "w"(x)); 7 | return n; 8 | } 9 | -------------------------------------------------------------------------------- /src/math/s390x/fma.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fma(double x, double y, double z) 4 | { 5 | __asm__ ("madbr %0, %1, %2" : "+f"(z) : "f"(x), "f"(y)); 6 | return z; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/s390x/fmaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fmaf(float x, float y, float z) 4 | { 5 | __asm__ ("maebr %0, %1, %2" : "+f"(z) : "f"(x), "f"(y)); 6 | return z; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/x32/fabs.s: -------------------------------------------------------------------------------- 1 | .global fabs 2 | .type fabs,@function 3 | fabs: 4 | xor %eax,%eax 5 | dec %rax 6 | shr %rax 7 | movq %rax,%xmm1 8 | andpd %xmm1,%xmm0 9 | ret 10 | -------------------------------------------------------------------------------- /src/misc/getrusage.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int getrusage(int who, struct rusage *ru) 5 | { 6 | return syscall(SYS_getrusage, who, ru); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/listen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int listen(int fd, int backlog) 5 | { 6 | return socketcall(listen, fd, backlog, 0, 0, 0, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/shutdown.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int shutdown(int fd, int how) 5 | { 6 | return socketcall(shutdown, fd, how, 0, 0, 0, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_init.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_init(posix_spawnattr_t *attr) 4 | { 5 | *attr = (posix_spawnattr_t){ 0 }; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/signal/sigwaitinfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sigwaitinfo(const sigset_t *restrict mask, siginfo_t *restrict si) 4 | { 5 | return sigtimedwait(mask, si, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/stdio/putc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "putc.h" 3 | 4 | int putc(int c, FILE *f) 5 | { 6 | return do_putc(c, f); 7 | } 8 | 9 | weak_alias(putc, _IO_putc); 10 | -------------------------------------------------------------------------------- /src/stdio/vwprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int vwprintf(const wchar_t *restrict fmt, va_list ap) 5 | { 6 | return vfwprintf(stdout, fmt, ap); 7 | } 8 | -------------------------------------------------------------------------------- /src/string/strcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strcat(char *restrict dest, const char *restrict src) 4 | { 5 | strcpy(dest + strlen(dest), src); 6 | return dest; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcspbrk.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcspbrk(const wchar_t *s, const wchar_t *b) 4 | { 5 | s += wcscspn(s, b); 6 | return *s ? (wchar_t *)s : NULL; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wmemset.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wmemset(wchar_t *d, wchar_t c, size_t n) 4 | { 5 | wchar_t *ret = d; 6 | while (n--) *d++ = c; 7 | return ret; 8 | } 9 | -------------------------------------------------------------------------------- /src/thread/pthread_rwlock_rdlock.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_rwlock_rdlock(pthread_rwlock_t *rw) 4 | { 5 | return pthread_rwlock_timedrdlock(rw, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_rwlock_wrlock.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_rwlock_wrlock(pthread_rwlock_t *rw) 4 | { 5 | return pthread_rwlock_timedwrlock(rw, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/time/gmtime.c: -------------------------------------------------------------------------------- 1 | #include "time_impl.h" 2 | #include 3 | 4 | struct tm *gmtime(const time_t *t) 5 | { 6 | static struct tm tm; 7 | return __gmtime_r(t, &tm); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/acct.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int acct(const char *filename) 6 | { 7 | return syscall(SYS_acct, filename); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/getgroups.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int getgroups(int count, gid_t list[]) 5 | { 6 | return syscall(SYS_getgroups, count, list); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/read.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | ssize_t read(int fd, void *buf, size_t count) 5 | { 6 | return syscall_cp(SYS_read, fd, buf, count); 7 | } 8 | -------------------------------------------------------------------------------- /src/env/__environ.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char **__environ = 0; 4 | weak_alias(__environ, ___environ); 5 | weak_alias(__environ, _environ); 6 | weak_alias(__environ, environ); 7 | -------------------------------------------------------------------------------- /src/linux/setns.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int setns(int fd, int nstype) 6 | { 7 | return syscall(SYS_setns, fd, nstype); 8 | } 9 | -------------------------------------------------------------------------------- /src/locale/catopen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | nl_catd catopen (const char *name, int oflag) 5 | { 6 | errno = EOPNOTSUPP; 7 | return (nl_catd)-1; 8 | } 9 | -------------------------------------------------------------------------------- /src/math/aarch64/llroundf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llroundf(float x) 4 | { 5 | long long n; 6 | __asm__ ("fcvtas %x0, %s1" : "=r"(n) : "w"(x)); 7 | return n; 8 | } 9 | -------------------------------------------------------------------------------- /src/math/i386/llrintf.s: -------------------------------------------------------------------------------- 1 | .global llrintf 2 | .type llrintf,@function 3 | llrintf: 4 | sub $8,%esp 5 | flds 12(%esp) 6 | fistpll (%esp) 7 | pop %eax 8 | pop %edx 9 | ret 10 | -------------------------------------------------------------------------------- /src/math/sqrtl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double sqrtl(long double x) 4 | { 5 | /* FIXME: implement in C, this is for LDBL_MANT_DIG == 64 only */ 6 | return sqrt(x); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/x86_64/fabs.s: -------------------------------------------------------------------------------- 1 | .global fabs 2 | .type fabs,@function 3 | fabs: 4 | xor %eax,%eax 5 | dec %rax 6 | shr %rax 7 | movq %rax,%xmm1 8 | andpd %xmm1,%xmm0 9 | ret 10 | -------------------------------------------------------------------------------- /src/mman/msync.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int msync(void *start, size_t len, int flags) 5 | { 6 | return syscall_cp(SYS_msync, start, len, flags); 7 | } 8 | -------------------------------------------------------------------------------- /src/mq/mq_receive.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ssize_t mq_receive(mqd_t mqd, char *msg, size_t len, unsigned *prio) 4 | { 5 | return mq_timedreceive(mqd, msg, len, prio, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/prng/lcong48.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "rand48.h" 4 | 5 | void lcong48(unsigned short p[7]) 6 | { 7 | memcpy(__seed48, p, sizeof __seed48); 8 | } 9 | -------------------------------------------------------------------------------- /src/signal/sigsuspend.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int sigsuspend(const sigset_t *mask) 5 | { 6 | return syscall_cp(SYS_rt_sigsuspend, mask, _NSIG/8); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/setbuffer.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | void setbuffer(FILE *f, char *buf, size_t size) 5 | { 6 | setvbuf(f, buf, buf ? _IOFBF : _IONBF, size); 7 | } 8 | -------------------------------------------------------------------------------- /src/string/bcopy.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | void bcopy(const void *s1, void *s2, size_t n) 6 | { 7 | memmove(s2, s1, n); 8 | } 9 | -------------------------------------------------------------------------------- /src/string/mempcpy.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | void *mempcpy(void *dest, const void *src, size_t n) 5 | { 6 | return (char *)memcpy(dest, src, n) + n; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcpncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcpncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) 4 | { 5 | return wcsncpy(d, s, n) + wcsnlen(s, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/string/wcsncasecmp_l.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcsncasecmp_l(const wchar_t *l, const wchar_t *r, size_t n, locale_t locale) 4 | { 5 | return wcsncasecmp(l, r, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/string/wcsnlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcsnlen(const wchar_t *s, size_t n) 4 | { 5 | const wchar_t *z = wmemchr(s, 0, n); 6 | if (z) n = z-s; 7 | return n; 8 | } 9 | -------------------------------------------------------------------------------- /src/thread/aarch64/__unmapself.s: -------------------------------------------------------------------------------- 1 | .global __unmapself 2 | .type __unmapself,%function 3 | __unmapself: 4 | mov x8,#215 // SYS_munmap 5 | svc 0 6 | mov x8,#93 // SYS_exit 7 | svc 0 8 | -------------------------------------------------------------------------------- /src/thread/clone.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pthread_impl.h" 3 | 4 | int __clone(int (*func)(void *), void *stack, int flags, void *arg, ...) 5 | { 6 | return -ENOSYS; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_condattr_init.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_condattr_init(pthread_condattr_t *a) 4 | { 5 | *a = (pthread_condattr_t){0}; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_mutexattr_init.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_mutexattr_init(pthread_mutexattr_t *a) 4 | { 5 | *a = (pthread_mutexattr_t){0}; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_spin_trylock.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | #include 3 | 4 | int pthread_spin_trylock(pthread_spinlock_t *s) 5 | { 6 | return a_cas(s, 0, EBUSY); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/setegid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libc.h" 3 | #include "syscall.h" 4 | 5 | int setegid(gid_t egid) 6 | { 7 | return __setxid(SYS_setresgid, -1, egid, -1); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/seteuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | #include "libc.h" 4 | 5 | int seteuid(uid_t euid) 6 | { 7 | return __setxid(SYS_setresuid, -1, euid, -1); 8 | } 9 | -------------------------------------------------------------------------------- /arch/sh/bits/ptrace.h: -------------------------------------------------------------------------------- 1 | #define PTRACE_GETFDPIC 31 2 | #define PTRACE_GETFDPIC_EXEC 0 3 | #define PTRACE_GETFDPIC_INTERP 1 4 | #define PTRACE_GETDSPREGS 55 5 | #define PTRACE_SETDSPREGS 56 6 | -------------------------------------------------------------------------------- /crt/microblaze/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | lwi r15, r1, 0 3 | rtsd r15, 8 4 | addi r1, r1, 32 5 | 6 | .section .fini 7 | lwi r15, r1, 0 8 | rtsd r15, 8 9 | addi r1, r1, 32 10 | -------------------------------------------------------------------------------- /crt/s390x/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .align 2 3 | lmg %r14, %r15, 272(%r15) 4 | br %r14 5 | 6 | .section .fini 7 | .align 2 8 | lmg %r14, %r15, 272(%r15) 9 | br %r14 10 | -------------------------------------------------------------------------------- /src/complex/csinf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex csinf(float complex z) 4 | { 5 | z = csinhf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/ctanf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex ctanf(float complex z) 4 | { 5 | z = ctanhf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/exit/_Exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | _Noreturn void _Exit(int ec) 5 | { 6 | __syscall(SYS_exit_group, ec); 7 | for (;;) __syscall(SYS_exit, ec); 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/iopl.c: -------------------------------------------------------------------------------- 1 | #include "syscall.h" 2 | 3 | #ifdef SYS_iopl 4 | #include 5 | 6 | int iopl(int level) 7 | { 8 | return syscall(SYS_iopl, level); 9 | } 10 | #endif 11 | -------------------------------------------------------------------------------- /src/math/remainder.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double remainder(double x, double y) 4 | { 5 | int q; 6 | return remquo(x, y, &q); 7 | } 8 | 9 | weak_alias(remainder, drem); 10 | -------------------------------------------------------------------------------- /src/math/remainderf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float remainderf(float x, float y) 4 | { 5 | int q; 6 | return remquof(x, y, &q); 7 | } 8 | 9 | weak_alias(remainderf, dremf); 10 | -------------------------------------------------------------------------------- /src/passwd/getspent.c: -------------------------------------------------------------------------------- 1 | #include "pwf.h" 2 | 3 | void setspent() 4 | { 5 | } 6 | 7 | void endspent() 8 | { 9 | } 10 | 11 | struct spwd *getspent() 12 | { 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/prng/rand48.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | hidden uint64_t __rand48_step(unsigned short *xi, unsigned short *lc); 5 | extern hidden unsigned short __seed48[7]; 6 | -------------------------------------------------------------------------------- /src/process/execv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern char **__environ; 4 | 5 | int execv(const char *path, char *const argv[]) 6 | { 7 | return execve(path, argv, __environ); 8 | } 9 | -------------------------------------------------------------------------------- /src/process/posix_spawn_file_actions_init.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawn_file_actions_init(posix_spawn_file_actions_t *fa) 4 | { 5 | fa->__actions = 0; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_setpgroup.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgrp) 4 | { 5 | attr->__pgrp = pgrp; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/sched/sched_getscheduler.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | 5 | int sched_getscheduler(pid_t pid) 6 | { 7 | return __syscall_ret(-ENOSYS); 8 | } 9 | -------------------------------------------------------------------------------- /src/signal/getitimer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int getitimer(int which, struct itimerval *old) 5 | { 6 | return syscall(SYS_getitimer, which, old); 7 | } 8 | -------------------------------------------------------------------------------- /src/stat/mkdirat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int mkdirat(int fd, const char *path, mode_t mode) 5 | { 6 | return syscall(SYS_mkdirat, fd, path, mode); 7 | } 8 | -------------------------------------------------------------------------------- /src/string/bcmp.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | int bcmp(const void *s1, const void *s2, size_t n) 6 | { 7 | return memcmp(s1, s2, n); 8 | } 9 | -------------------------------------------------------------------------------- /src/string/wcscat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcscat(wchar_t *restrict dest, const wchar_t *restrict src) 4 | { 5 | wcscpy(dest + wcslen(dest), src); 6 | return dest; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcscpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcscpy(wchar_t *restrict d, const wchar_t *restrict s) 4 | { 5 | wchar_t *a = d; 6 | while ((*d++ = *s++)); 7 | return a; 8 | } 9 | -------------------------------------------------------------------------------- /src/string/wmemchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n) 4 | { 5 | for (; n && *s != c; n--, s++); 6 | return n ? (wchar_t *)s : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wmemcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n) 4 | { 5 | for (; n && *l==*r; n--, l++, r++); 6 | return n ? *l-*r : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/termios/tcdrain.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | 5 | int tcdrain(int fd) 6 | { 7 | return syscall_cp(SYS_ioctl, fd, TCSBRK, 1); 8 | } 9 | -------------------------------------------------------------------------------- /src/thread/m68k/__m68k_read_tp.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global __m68k_read_tp 3 | .type __m68k_read_tp,@function 4 | __m68k_read_tp: 5 | move.l #333,%d0 6 | trap #0 7 | move.l %d0,%a0 8 | rts 9 | -------------------------------------------------------------------------------- /src/thread/pthread_rwlockattr_init.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_rwlockattr_init(pthread_rwlockattr_t *a) 4 | { 5 | *a = (pthread_rwlockattr_t){0}; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_setschedparam.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_setschedparam(pthread_t t, int policy, const struct sched_param *param) 4 | { 5 | return ENOSYS; 6 | } 7 | -------------------------------------------------------------------------------- /src/time/timer_delete.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "pthread_impl.h" 4 | 5 | int timer_delete(timer_t t) 6 | { 7 | return __syscall(SYS_timer_delete, t); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/unlinkat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int unlinkat(int fd, const char *path, int flag) 5 | { 6 | return syscall(SYS_unlinkat, fd, path, flag); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/write.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | ssize_t write(int fd, const void *buf, size_t count) 5 | { 6 | return syscall_cp(SYS_write, fd, buf, count); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/casinhf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex casinhf(float complex z) 4 | { 5 | z = casinf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/catanhf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex catanhf(float complex z) 4 | { 5 | z = catanf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/linux/arch_prctl.c: -------------------------------------------------------------------------------- 1 | #include "syscall.h" 2 | #ifdef SYS_arch_prctl 3 | int arch_prctl(int code, unsigned long addr) 4 | { 5 | return syscall(SYS_arch_prctl, code, addr); 6 | } 7 | #endif 8 | -------------------------------------------------------------------------------- /src/linux/brk.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | #include "syscall.h" 5 | 6 | int brk(void *end) 7 | { 8 | return __syscall_ret(-ENOMEM); 9 | } 10 | -------------------------------------------------------------------------------- /src/math/aarch64/fmaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fmaf(float x, float y, float z) 4 | { 5 | __asm__ ("fmadd %s0, %s1, %s2, %s3" : "=w"(x) : "w"(x), "w"(y), "w"(z)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/fabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | double fabs(double x) 5 | { 6 | union {double f; uint64_t i;} u = {x}; 7 | u.i &= -1ULL/2; 8 | return u.f; 9 | } 10 | -------------------------------------------------------------------------------- /src/math/fabsf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float fabsf(float x) 5 | { 6 | union {float f; uint32_t i;} u = {x}; 7 | u.i &= 0x7fffffff; 8 | return u.f; 9 | } 10 | -------------------------------------------------------------------------------- /src/math/i386/fmod.s: -------------------------------------------------------------------------------- 1 | .global fmod 2 | .type fmod,@function 3 | fmod: 4 | fldl 12(%esp) 5 | fldl 4(%esp) 6 | 1: fprem 7 | fnstsw %ax 8 | sahf 9 | jp 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/math/logbf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float logbf(float x) 4 | { 5 | if (!isfinite(x)) 6 | return x * x; 7 | if (x == 0) 8 | return -1/(x*x); 9 | return ilogbf(x); 10 | } 11 | -------------------------------------------------------------------------------- /src/math/powerpc64/fma.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fma(double x, double y, double z) 4 | { 5 | __asm__ ("fmadd %0, %1, %2, %3" : "=d"(x) : "d"(x), "d"(y), "d"(z)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/powerpc64/fmaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fmaf(float x, float y, float z) 4 | { 5 | __asm__ ("fmadds %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/multibyte/c32rtomb.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | size_t c32rtomb(char *restrict s, char32_t c32, mbstate_t *restrict ps) 5 | { 6 | return wcrtomb(s, c32, ps); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/htonl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | uint32_t htonl(uint32_t n) 5 | { 6 | union { int i; char c; } u = { 1 }; 7 | return u.c ? bswap_32(n) : n; 8 | } 9 | -------------------------------------------------------------------------------- /src/network/htons.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | uint16_t htons(uint16_t n) 5 | { 6 | union { int i; char c; } u = { 1 }; 7 | return u.c ? bswap_16(n) : n; 8 | } 9 | -------------------------------------------------------------------------------- /src/network/ntohl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | uint32_t ntohl(uint32_t n) 5 | { 6 | union { int i; char c; } u = { 1 }; 7 | return u.c ? bswap_32(n) : n; 8 | } 9 | -------------------------------------------------------------------------------- /src/network/ntohs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | uint16_t ntohs(uint16_t n) 5 | { 6 | union { int i; char c; } u = { 1 }; 7 | return u.c ? bswap_16(n) : n; 8 | } 9 | -------------------------------------------------------------------------------- /src/stdio/rewind.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | void rewind(FILE *f) 4 | { 5 | FLOCK(f); 6 | __fseeko_unlocked(f, 0, SEEK_SET); 7 | f->flags &= ~F_ERR; 8 | FUNLOCK(f); 9 | } 10 | -------------------------------------------------------------------------------- /src/string/strchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strchr(const char *s, int c) 4 | { 5 | char *r = __strchrnul(s, c); 6 | return *(unsigned char *)r == (unsigned char)c ? r : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int strcmp(const char *l, const char *r) 4 | { 5 | for (; *l==*r && *l; l++, r++); 6 | return *(unsigned char *)l - *(unsigned char *)r; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcsspn.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcsspn(const wchar_t *s, const wchar_t *c) 4 | { 5 | const wchar_t *a; 6 | for (a=s; *s && wcschr(c, *s); s++); 7 | return s-a; 8 | } 9 | -------------------------------------------------------------------------------- /src/thread/arm/__unmapself.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .text 3 | .global __unmapself 4 | .type __unmapself,%function 5 | __unmapself: 6 | mov r7,#91 7 | svc 0 8 | mov r7,#1 9 | svc 0 10 | -------------------------------------------------------------------------------- /src/thread/pthread_attr_setschedpolicy.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_attr_setschedpolicy(pthread_attr_t *a, int policy) 4 | { 5 | a->_a_policy = policy; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_barrierattr_init.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_barrierattr_init(pthread_barrierattr_t *a) 4 | { 5 | *a = (pthread_barrierattr_t){0}; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/time/ctime_r.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ctime_r(const time_t *t, char *buf) 4 | { 5 | struct tm tm, *tm_p = localtime_r(t, &tm); 6 | return tm_p ? asctime_r(tm_p, buf) : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/readv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | ssize_t readv(int fd, const struct iovec *iov, int count) 5 | { 6 | return syscall_cp(SYS_readv, fd, iov, count); 7 | } 8 | -------------------------------------------------------------------------------- /arch/s390x/bits/sem.h: -------------------------------------------------------------------------------- 1 | struct semid_ds { 2 | struct ipc_perm sem_perm; 3 | time_t sem_otime; 4 | time_t sem_ctime; 5 | unsigned short __pad[3], sem_nsems; 6 | unsigned long __unused[2]; 7 | }; 8 | -------------------------------------------------------------------------------- /src/fcntl/creat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int creat(const char *filename, mode_t mode) 4 | { 5 | return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode); 6 | } 7 | 8 | weak_alias(creat, creat64); 9 | -------------------------------------------------------------------------------- /src/fenv/fesetexceptflag.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fesetexceptflag(const fexcept_t *fp, int mask) 4 | { 5 | feclearexcept(~*fp & mask); 6 | feraiseexcept(*fp & mask); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/include/arpa/inet.h: -------------------------------------------------------------------------------- 1 | #ifndef ARPA_INET_H 2 | #define ARPA_INET_H 3 | 4 | #include "../../../include/arpa/inet.h" 5 | 6 | hidden int __inet_aton(const char *, struct in_addr *); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/internal/intscan.h: -------------------------------------------------------------------------------- 1 | #ifndef INTSCAN_H 2 | #define INTSCAN_H 3 | 4 | #include 5 | 6 | hidden unsigned long long __intscan(FILE *, unsigned, int, unsigned long long); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/ldso/tlsdesc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ptrdiff_t __tlsdesc_static() 5 | { 6 | return 0; 7 | } 8 | 9 | weak_alias(__tlsdesc_static, __tlsdesc_dynamic); 10 | -------------------------------------------------------------------------------- /src/math/aarch64/fma.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fma(double x, double y, double z) 4 | { 5 | __asm__ ("fmadd %d0, %d1, %d2, %d3" : "=w"(x) : "w"(x), "w"(y), "w"(z)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/math/fdim.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fdim(double x, double y) 4 | { 5 | if (isnan(x)) 6 | return x; 7 | if (isnan(y)) 8 | return y; 9 | return x > y ? x - y : 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/math/fdimf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fdimf(float x, float y) 4 | { 5 | if (isnan(x)) 6 | return x; 7 | if (isnan(y)) 8 | return y; 9 | return x > y ? x - y : 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/math/i386/fmodf.s: -------------------------------------------------------------------------------- 1 | .global fmodf 2 | .type fmodf,@function 3 | fmodf: 4 | flds 8(%esp) 5 | flds 4(%esp) 6 | 1: fprem 7 | fnstsw %ax 8 | sahf 9 | jp 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/math/i386/fmodl.s: -------------------------------------------------------------------------------- 1 | .global fmodl 2 | .type fmodl,@function 3 | fmodl: 4 | fldt 16(%esp) 5 | fldt 4(%esp) 6 | 1: fprem 7 | fnstsw %ax 8 | sahf 9 | jp 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/misc/setpriority.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int setpriority(int which, id_t who, int prio) 5 | { 6 | return syscall(SYS_setpriority, which, who, prio); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdio/getwchar.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | #include 3 | 4 | wint_t getwchar(void) 5 | { 6 | return fgetwc(stdin); 7 | } 8 | 9 | weak_alias(getwchar, getwchar_unlocked); 10 | -------------------------------------------------------------------------------- /src/stdio/vsprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int vsprintf(char *restrict s, const char *restrict fmt, va_list ap) 5 | { 6 | return vsnprintf(s, INT_MAX, fmt, ap); 7 | } 8 | -------------------------------------------------------------------------------- /src/stdlib/gcvt.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | 5 | char *gcvt(double x, int n, char *b) 6 | { 7 | sprintf(b, "%.*g", n, x); 8 | return b; 9 | } 10 | -------------------------------------------------------------------------------- /src/thread/pthread_mutex_getprioceiling.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_mutex_getprioceiling(const pthread_mutex_t *restrict m, int *restrict ceiling) 4 | { 5 | return EINVAL; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/thrd_exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | _Noreturn void thrd_exit(int result) 6 | { 7 | __pthread_exit((void*)(intptr_t)result); 8 | } 9 | -------------------------------------------------------------------------------- /src/time/clock_settime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int clock_settime(clockid_t clk, const struct timespec *ts) 5 | { 6 | return syscall(SYS_clock_settime, clk, ts); 7 | } 8 | -------------------------------------------------------------------------------- /src/time/nanosleep.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int nanosleep(const struct timespec *req, struct timespec *rem) 5 | { 6 | return syscall_cp(SYS_nanosleep, req, rem); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/setregid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | #include "libc.h" 4 | 5 | int setregid(gid_t rgid, gid_t egid) 6 | { 7 | return __setxid(SYS_setregid, rgid, egid, 0); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/setreuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | #include "libc.h" 4 | 5 | int setreuid(uid_t ruid, uid_t euid) 6 | { 7 | return __setxid(SYS_setreuid, ruid, euid, 0); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/writev.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | ssize_t writev(int fd, const struct iovec *iov, int count) 5 | { 6 | return syscall_cp(SYS_writev, fd, iov, count); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/cacosf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | // FIXME 4 | 5 | float complex cacosf(float complex z) 6 | { 7 | z = casinf(z); 8 | return CMPLXF((float)M_PI_2 - crealf(z), -cimagf(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/complex/cacosh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* acosh(z) = i acos(z) */ 4 | 5 | double complex cacosh(double complex z) 6 | { 7 | z = cacos(z); 8 | return CMPLX(-cimag(z), creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/complex/cpow.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* pow(z, c) = exp(c log(z)), See C99 G.6.4.1 */ 4 | 5 | double complex cpow(double complex z, double complex c) 6 | { 7 | return cexp(c * clog(z)); 8 | } 9 | -------------------------------------------------------------------------------- /src/ldso/dladdr.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | static int stub_dladdr(const void *addr, Dl_info *info) 5 | { 6 | return 0; 7 | } 8 | 9 | weak_alias(stub_dladdr, dladdr); 10 | -------------------------------------------------------------------------------- /src/network/bind.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int bind(int fd, const struct sockaddr *addr, socklen_t len) 5 | { 6 | return socketcall(bind, fd, addr, len, 0, 0, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/process/waitpid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | pid_t waitpid(pid_t pid, int *status, int options) 5 | { 6 | return syscall_cp(SYS_wait4, pid, status, options, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/signal/sigpause.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sigpause(int sig) 4 | { 5 | sigset_t mask; 6 | sigprocmask(0, 0, &mask); 7 | sigdelset(&mask, sig); 8 | return sigsuspend(&mask); 9 | } 10 | -------------------------------------------------------------------------------- /src/signal/x86_64/restore.s: -------------------------------------------------------------------------------- 1 | nop 2 | .global __restore_rt 3 | .hidden __restore_rt 4 | .type __restore_rt,@function 5 | __restore_rt: 6 | mov $15, %rax 7 | syscall 8 | .size __restore_rt,.-__restore_rt 9 | -------------------------------------------------------------------------------- /src/stat/mknodat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int mknodat(int fd, const char *path, mode_t mode, dev_t dev) 5 | { 6 | return syscall(SYS_mknodat, fd, path, mode, dev); 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wcsncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n) 4 | { 5 | for (; n && *l==*r && *l && *r; n--, l++, r++); 6 | return n ? *l - *r : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/string/wmemcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wmemcpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) 4 | { 5 | wchar_t *a = d; 6 | while (n--) *d++ = *s++; 7 | return a; 8 | } 9 | -------------------------------------------------------------------------------- /src/thread/aarch64/__set_thread_area.s: -------------------------------------------------------------------------------- 1 | .global __set_thread_area 2 | .hidden __set_thread_area 3 | .type __set_thread_area,@function 4 | __set_thread_area: 5 | msr tpidr_el0,x0 6 | mov w0,#0 7 | ret 8 | -------------------------------------------------------------------------------- /src/thread/mips64/__unmapself.s: -------------------------------------------------------------------------------- 1 | .set noreorder 2 | .global __unmapself 3 | .type __unmapself, @function 4 | __unmapself: 5 | li $2, 5011 6 | syscall 7 | li $4, 0 8 | li $2, 5058 9 | syscall 10 | -------------------------------------------------------------------------------- /src/thread/mipsn32/__unmapself.s: -------------------------------------------------------------------------------- 1 | .set noreorder 2 | .global __unmapself 3 | .type __unmapself,@function 4 | __unmapself: 5 | li $2, 6011 6 | syscall 7 | li $4, 0 8 | li $2, 6058 9 | syscall 10 | -------------------------------------------------------------------------------- /src/thread/pthread_cond_wait.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_cond_wait(pthread_cond_t *restrict c, pthread_mutex_t *restrict m) 4 | { 5 | return pthread_cond_timedwait(c, m, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/pthread_mutex_setprioceiling.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_mutex_setprioceiling(pthread_mutex_t *restrict m, int ceiling, int *restrict old) 4 | { 5 | return EINVAL; 6 | } 7 | -------------------------------------------------------------------------------- /src/thread/sem_getvalue.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sem_getvalue(sem_t *restrict sem, int *restrict valp) 4 | { 5 | int val = sem->__val[0]; 6 | *valp = val < 0 ? 0 : val; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/symlinkat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int symlinkat(const char *existing, int fd, const char *new) 5 | { 6 | return syscall(SYS_symlinkat, existing, fd, new); 7 | } 8 | -------------------------------------------------------------------------------- /crt/or1k/crti.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .global _init 3 | _init: 4 | l.addi r1,r1,-4 5 | l.sw 0(r1),r9 6 | 7 | .section .fini 8 | .global _fini 9 | _fini: 10 | l.addi r1,r1,-4 11 | l.sw 0(r1),r9 12 | -------------------------------------------------------------------------------- /crt/powerpc/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .align 2 3 | lwz 0,36(1) 4 | addi 1,1,32 5 | mtlr 0 6 | blr 7 | 8 | .section .fini 9 | .align 2 10 | lwz 0,36(1) 11 | addi 1,1,32 12 | mtlr 0 13 | blr 14 | -------------------------------------------------------------------------------- /src/include/sys/time.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_TIME_H 2 | #define SYS_TIME_H 3 | 4 | #include "../../../include/sys/time.h" 5 | 6 | hidden int __futimesat(int, const char *, const struct timeval [2]); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/linux/clock_adjtime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int clock_adjtime (clockid_t clock_id, struct timex *utx) 5 | { 6 | return syscall(SYS_clock_adjtime, clock_id, utx); 7 | } 8 | -------------------------------------------------------------------------------- /src/linux/setgroups.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int setgroups(size_t count, const gid_t list[]) 6 | { 7 | return syscall(SYS_setgroups, count, list); 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/sethostname.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int sethostname(const char *name, size_t len) 6 | { 7 | return syscall(SYS_sethostname, name, len); 8 | } 9 | -------------------------------------------------------------------------------- /src/math/x32/fmodl.s: -------------------------------------------------------------------------------- 1 | .global fmodl 2 | .type fmodl,@function 3 | fmodl: 4 | fldt 24(%esp) 5 | fldt 8(%esp) 6 | 1: fprem 7 | fnstsw %ax 8 | testb $4,%ah 9 | jnz 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/math/x86_64/fmodl.s: -------------------------------------------------------------------------------- 1 | .global fmodl 2 | .type fmodl,@function 3 | fmodl: 4 | fldt 24(%rsp) 5 | fldt 8(%rsp) 6 | 1: fprem 7 | fnstsw %ax 8 | testb $4,%ah 9 | jnz 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/multibyte/mbstowcs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | size_t mbstowcs(wchar_t *restrict ws, const char *restrict s, size_t wn) 5 | { 6 | return mbsrtowcs(ws, (void*)&s, wn, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/sched/sched_getparam.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | 5 | int sched_getparam(pid_t pid, struct sched_param *param) 6 | { 7 | return __syscall_ret(-ENOSYS); 8 | } 9 | -------------------------------------------------------------------------------- /src/stdio/fsetpos.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | int fsetpos(FILE *f, const fpos_t *pos) 4 | { 5 | return __fseeko(f, *(const long long *)pos, SEEK_SET); 6 | } 7 | 8 | weak_alias(fsetpos, fsetpos64); 9 | -------------------------------------------------------------------------------- /src/stdio/putwchar.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | #include 3 | 4 | wint_t putwchar(wchar_t c) 5 | { 6 | return fputwc(c, stdout); 7 | } 8 | 9 | weak_alias(putwchar, putwchar_unlocked); 10 | -------------------------------------------------------------------------------- /src/thread/microblaze/__unmapself.s: -------------------------------------------------------------------------------- 1 | .global __unmapself 2 | .type __unmapself,@function 3 | __unmapself: 4 | ori r12, r0, 91 5 | brki r14, 0x8 6 | ori r12, r0, 1 7 | brki r14, 0x8 8 | nop 9 | -------------------------------------------------------------------------------- /src/thread/pthread_getschedparam.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param *restrict param) 4 | { 5 | return ENOSYS; 6 | } 7 | -------------------------------------------------------------------------------- /src/time/timer_getoverrun.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | 5 | int timer_getoverrun(timer_t t) 6 | { 7 | return syscall(SYS_timer_getoverrun, (intptr_t)t); 8 | } 9 | -------------------------------------------------------------------------------- /include/netinet/in_systm.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETINET_IN_SYSTM_H 2 | #define _NETINET_IN_SYSTM_H 3 | 4 | #include 5 | 6 | typedef uint16_t n_short; 7 | typedef uint32_t n_long, n_time; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/complex/cproj.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double complex cproj(double complex z) 4 | { 5 | if (isinf(creal(z)) || isinf(cimag(z))) 6 | return CMPLX(INFINITY, copysign(0.0, creal(z))); 7 | return z; 8 | } 9 | -------------------------------------------------------------------------------- /src/fenv/feupdateenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int feupdateenv(const fenv_t *envp) 4 | { 5 | int ex = fetestexcept(FE_ALL_EXCEPT); 6 | fesetenv(envp); 7 | feraiseexcept(ex); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /src/ldso/i386/dlsym.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global dlsym 3 | .hidden __dlsym 4 | .type dlsym,@function 5 | dlsym: 6 | push (%esp) 7 | push 12(%esp) 8 | push 12(%esp) 9 | call __dlsym 10 | add $12,%esp 11 | ret 12 | -------------------------------------------------------------------------------- /src/linux/getrandom.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | ssize_t getrandom(void *buf, size_t buflen, unsigned flags) 5 | { 6 | return syscall_cp(SYS_getrandom, buf, buflen, flags); 7 | } 8 | -------------------------------------------------------------------------------- /src/linux/quotactl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int quotactl(int cmd, const char *special, int id, char *addr) 5 | { 6 | return syscall(SYS_quotactl, cmd, special, id, addr); 7 | } 8 | -------------------------------------------------------------------------------- /src/math/__signbitf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | // FIXME: macro in math.h 4 | int __signbitf(float x) 5 | { 6 | union { 7 | float f; 8 | uint32_t i; 9 | } y = { x }; 10 | return y.i>>31; 11 | } 12 | -------------------------------------------------------------------------------- /src/math/aarch64/lrint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lrint(double x) 4 | { 5 | long n; 6 | __asm__ ( 7 | "frintx %d1, %d1\n" 8 | "fcvtzs %x0, %d1\n" : "=r"(n), "+w"(x)); 9 | return n; 10 | } 11 | -------------------------------------------------------------------------------- /src/math/aarch64/lrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lrintf(float x) 4 | { 5 | long n; 6 | __asm__ ( 7 | "frintx %s1, %s1\n" 8 | "fcvtzs %x0, %s1\n" : "=r"(n), "+w"(x)); 9 | return n; 10 | } 11 | -------------------------------------------------------------------------------- /src/math/copysign.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double copysign(double x, double y) { 4 | union {double f; uint64_t i;} ux={x}, uy={y}; 5 | ux.i &= -1ULL/2; 6 | ux.i |= uy.i & 1ULL<<63; 7 | return ux.f; 8 | } 9 | -------------------------------------------------------------------------------- /src/math/x32/asinl.s: -------------------------------------------------------------------------------- 1 | .global asinl 2 | .type asinl,@function 3 | asinl: 4 | fldt 8(%esp) 5 | 1: fld %st(0) 6 | fld1 7 | fsub %st(0),%st(1) 8 | fadd %st(2) 9 | fmulp 10 | fsqrt 11 | fpatan 12 | ret 13 | -------------------------------------------------------------------------------- /src/misc/setdomainname.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int setdomainname(const char *name, size_t len) 6 | { 7 | return syscall(SYS_setdomainname, name, len); 8 | } 9 | -------------------------------------------------------------------------------- /src/network/herror.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | 5 | void herror(const char *msg) 6 | { 7 | fprintf(stderr, "%s%s%s", msg?msg:"", msg?": ":"", hstrerror(h_errno)); 8 | } 9 | -------------------------------------------------------------------------------- /src/process/arm/vfork.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .global vfork 3 | .type vfork,%function 4 | vfork: 5 | mov ip, r7 6 | mov r7, 190 7 | svc 0 8 | mov r7, ip 9 | .hidden __syscall_ret 10 | b __syscall_ret 11 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_getflags.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_getflags(const posix_spawnattr_t *restrict attr, short *restrict flags) 4 | { 5 | *flags = attr->__flags; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_getpgroup.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_getpgroup(const posix_spawnattr_t *restrict attr, pid_t *restrict pgrp) 4 | { 5 | *pgrp = attr->__pgrp; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/sched/sched_rr_get_interval.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int sched_rr_get_interval(pid_t pid, struct timespec *ts) 5 | { 6 | return syscall(SYS_sched_rr_get_interval, pid, ts); 7 | } 8 | -------------------------------------------------------------------------------- /src/sched/sched_setparam.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | 5 | int sched_setparam(pid_t pid, const struct sched_param *param) 6 | { 7 | return __syscall_ret(-ENOSYS); 8 | } 9 | -------------------------------------------------------------------------------- /src/stat/lchmod.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | 5 | int lchmod(const char *path, mode_t mode) 6 | { 7 | return fchmodat(AT_FDCWD, path, mode, AT_SYMLINK_NOFOLLOW); 8 | } 9 | -------------------------------------------------------------------------------- /src/stdio/clearerr.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | void clearerr(FILE *f) 4 | { 5 | FLOCK(f); 6 | f->flags &= ~(F_EOF|F_ERR); 7 | FUNLOCK(f); 8 | } 9 | 10 | weak_alias(clearerr, clearerr_unlocked); 11 | -------------------------------------------------------------------------------- /src/string/explicit_bzero.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | 4 | void explicit_bzero(void *d, size_t n) 5 | { 6 | d = memset(d, 0, n); 7 | __asm__ __volatile__ ("" : : "r"(d) : "memory"); 8 | } 9 | -------------------------------------------------------------------------------- /src/string/wcsrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcsrchr(const wchar_t *s, wchar_t c) 4 | { 5 | const wchar_t *p; 6 | for (p=s+wcslen(s); p>=s && *p!=c; p--); 7 | return p>=s ? (wchar_t *)p : 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/termios/tcgetattr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int tcgetattr(int fd, struct termios *tio) 5 | { 6 | if (ioctl(fd, TCGETS, tio)) 7 | return -1; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /src/termios/tcgetsid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | pid_t tcgetsid(int fd) 5 | { 6 | int sid; 7 | if (ioctl(fd, TIOCGSID, &sid) < 0) 8 | return -1; 9 | return sid; 10 | } 11 | -------------------------------------------------------------------------------- /src/thread/or1k/__set_thread_area.s: -------------------------------------------------------------------------------- 1 | .global __set_thread_area 2 | .hidden __set_thread_area 3 | .type __set_thread_area,@function 4 | __set_thread_area: 5 | l.ori r10, r3, 0 6 | l.jr r9 7 | l.ori r11, r0, 0 8 | -------------------------------------------------------------------------------- /src/thread/powerpc/__unmapself.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global __unmapself 3 | .type __unmapself,%function 4 | __unmapself: 5 | li 0, 91 # __NR_munmap 6 | sc 7 | li 0, 1 #__NR_exit 8 | sc 9 | blr 10 | -------------------------------------------------------------------------------- /src/thread/pthread_mutexattr_setprotocol.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int protocol) 4 | { 5 | if (protocol) return ENOTSUP; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_rwlock_trywrlock.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_rwlock_trywrlock(pthread_rwlock_t *rw) 4 | { 5 | if (a_cas(&rw->_rw_lock, 0, 0x7fffffff)) return EBUSY; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/time/timer_gettime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | 5 | int timer_gettime(timer_t t, struct itimerspec *val) 6 | { 7 | return syscall(SYS_timer_gettime, t, val); 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/renameat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int renameat(int oldfd, const char *old, int newfd, const char *new) 5 | { 6 | return syscall(SYS_renameat, oldfd, old, newfd, new); 7 | } 8 | -------------------------------------------------------------------------------- /crt/powerpc64/crtn.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .align 2 3 | addi 1, 1, 32 4 | ld 0, 16(1) 5 | mtlr 0 6 | blr 7 | 8 | .section .fini 9 | .align 2 10 | addi 1, 1, 32 11 | ld 0, 16(1) 12 | mtlr 0 13 | blr 14 | -------------------------------------------------------------------------------- /src/complex/cprojf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float complex cprojf(float complex z) 4 | { 5 | if (isinf(crealf(z)) || isinf(cimagf(z))) 6 | return CMPLXF(INFINITY, copysignf(0.0, crealf(z))); 7 | return z; 8 | } 9 | -------------------------------------------------------------------------------- /src/ctype/wcswidth.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcswidth(const wchar_t *wcs, size_t n) 4 | { 5 | int l=0, k=0; 6 | for (; n-- && *wcs && (k = wcwidth(*wcs)) >= 0; l+=k, wcs++); 7 | return (k < 0) ? k : l; 8 | } 9 | -------------------------------------------------------------------------------- /src/exit/arm/__aeabi_atexit.c: -------------------------------------------------------------------------------- 1 | int __cxa_atexit(void (*func)(void *), void *arg, void *dso); 2 | 3 | int __aeabi_atexit (void *obj, void (*func) (void *), void *d) 4 | { 5 | return __cxa_atexit (func, obj, d); 6 | } 7 | -------------------------------------------------------------------------------- /src/linux/personality.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | #ifdef SYS_personality 4 | int personality(unsigned long persona) 5 | { 6 | return syscall(SYS_personality, persona); 7 | } 8 | #endif 9 | -------------------------------------------------------------------------------- /src/linux/sysinfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int __lsysinfo(struct sysinfo *info) 5 | { 6 | return syscall(SYS_sysinfo, info); 7 | } 8 | 9 | weak_alias(__lsysinfo, sysinfo); 10 | -------------------------------------------------------------------------------- /src/linux/tee.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | ssize_t tee(int src, int dest, size_t len, unsigned flags) 6 | { 7 | return syscall(SYS_tee, src, dest, len, flags); 8 | } 9 | -------------------------------------------------------------------------------- /src/linux/utimes.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "fcntl.h" 3 | #include "syscall.h" 4 | 5 | int utimes(const char *path, const struct timeval times[2]) 6 | { 7 | return __futimesat(AT_FDCWD, path, times); 8 | } 9 | -------------------------------------------------------------------------------- /src/locale/freelocale.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "locale_impl.h" 3 | 4 | void freelocale(locale_t l) 5 | { 6 | if (__loc_is_allocated(l)) free(l); 7 | } 8 | 9 | weak_alias(freelocale, __freelocale); 10 | -------------------------------------------------------------------------------- /src/math/i386/remainderl.s: -------------------------------------------------------------------------------- 1 | .global remainderl 2 | .type remainderl,@function 3 | remainderl: 4 | fldt 16(%esp) 5 | fldt 4(%esp) 6 | 1: fprem1 7 | fnstsw %ax 8 | sahf 9 | jp 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/math/x86_64/asinl.s: -------------------------------------------------------------------------------- 1 | .global asinl 2 | .type asinl,@function 3 | asinl: 4 | fldt 8(%rsp) 5 | 1: fld %st(0) 6 | fld1 7 | fsub %st(0),%st(1) 8 | fadd %st(2) 9 | fmulp 10 | fsqrt 11 | fpatan 12 | ret 13 | -------------------------------------------------------------------------------- /src/misc/getresgid.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) 6 | { 7 | return syscall(SYS_getresgid, rgid, egid, sgid); 8 | } 9 | -------------------------------------------------------------------------------- /src/misc/getresuid.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) 6 | { 7 | return syscall(SYS_getresuid, ruid, euid, suid); 8 | } 9 | -------------------------------------------------------------------------------- /src/mman/mincore.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int mincore (void *addr, size_t len, unsigned char *vec) 6 | { 7 | return syscall(SYS_mincore, addr, len, vec); 8 | } 9 | -------------------------------------------------------------------------------- /src/multibyte/wcstombs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | size_t wcstombs(char *restrict s, const wchar_t *restrict ws, size_t n) 5 | { 6 | return wcsrtombs(s, &(const wchar_t *){ws}, n, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/connect.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int connect(int fd, const struct sockaddr *addr, socklen_t len) 5 | { 6 | return socketcall_cp(connect, fd, addr, len, 0, 0, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/serv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void endservent(void) 4 | { 5 | } 6 | 7 | void setservent(int stayopen) 8 | { 9 | } 10 | 11 | struct servent *getservent(void) 12 | { 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/network/sockatmark.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int sockatmark(int s) 5 | { 6 | int ret; 7 | if (ioctl(s, SIOCATMARK, &ret) < 0) 8 | return -1; 9 | return ret; 10 | } 11 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_getsigmask.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_getsigmask(const posix_spawnattr_t *restrict attr, sigset_t *restrict mask) 4 | { 5 | *mask = attr->__mask; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_setsigmask.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_setsigmask(posix_spawnattr_t *restrict attr, const sigset_t *restrict mask) 4 | { 5 | attr->__mask = *mask; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/process/waitid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int waitid(idtype_t type, id_t id, siginfo_t *info, int options) 5 | { 6 | return syscall_cp(SYS_waitid, type, id, info, options, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/process/x86_64/vfork.s: -------------------------------------------------------------------------------- 1 | .global vfork 2 | .type vfork,@function 3 | vfork: 4 | pop %rdx 5 | mov $58,%eax 6 | syscall 7 | push %rdx 8 | mov %rax,%rdi 9 | .hidden __syscall_ret 10 | jmp __syscall_ret 11 | -------------------------------------------------------------------------------- /src/string/wcschr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcschr(const wchar_t *s, wchar_t c) 4 | { 5 | if (!c) return (wchar_t *)s + wcslen(s); 6 | for (; *s && *s != c; s++); 7 | return *s ? (wchar_t *)s : 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/temp/mkstemps.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | 4 | int mkstemps(char *template, int len) 5 | { 6 | return __mkostemps(template, len, 0); 7 | } 8 | 9 | weak_alias(mkstemps, mkstemps64); 10 | -------------------------------------------------------------------------------- /src/thread/powerpc64/__unmapself.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global __unmapself 3 | .type __unmapself,%function 4 | __unmapself: 5 | li 0, 91 # __NR_munmap 6 | sc 7 | li 0, 1 #__NR_exit 8 | sc 9 | blr 10 | -------------------------------------------------------------------------------- /src/unistd/fchownat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag) 5 | { 6 | return syscall(SYS_fchownat, fd, path, uid, gid, flag); 7 | } 8 | -------------------------------------------------------------------------------- /src/complex/clogf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | // FIXME 4 | 5 | float complex clogf(float complex z) 6 | { 7 | float r, phi; 8 | 9 | r = cabsf(z); 10 | phi = cargf(z); 11 | return CMPLXF(logf(r), phi); 12 | } 13 | -------------------------------------------------------------------------------- /src/internal/syscall_ret.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | long __syscall_ret(unsigned long r) 5 | { 6 | if (r > -4096UL) { 7 | errno = -r; 8 | return -1; 9 | } 10 | return r; 11 | } 12 | -------------------------------------------------------------------------------- /src/ldso/sh/dlsym.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global dlsym 3 | .hidden __dlsym 4 | .type dlsym, @function 5 | dlsym: 6 | mov.l L1, r0 7 | 1: braf r0 8 | mov.l @r15, r6 9 | 10 | .align 2 11 | L1: .long __dlsym@PLT-(1b+4-.) 12 | -------------------------------------------------------------------------------- /src/linux/memfd_create.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 1 2 | #include 3 | #include "syscall.h" 4 | 5 | int memfd_create(const char *name, unsigned flags) 6 | { 7 | return syscall(SYS_memfd_create, name, flags); 8 | } 9 | -------------------------------------------------------------------------------- /src/math/__signbit.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | // FIXME: macro in math.h 4 | int __signbit(double x) 5 | { 6 | union { 7 | double d; 8 | uint64_t i; 9 | } y = { x }; 10 | return y.i>>63; 11 | } 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/math/aarch64/llrint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llrint(double x) 4 | { 5 | long long n; 6 | __asm__ ( 7 | "frintx %d1, %d1\n" 8 | "fcvtzs %x0, %d1\n" : "=r"(n), "+w"(x)); 9 | return n; 10 | } 11 | -------------------------------------------------------------------------------- /src/math/aarch64/llrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llrintf(float x) 4 | { 5 | long long n; 6 | __asm__ ( 7 | "frintx %s1, %s1\n" 8 | "fcvtzs %x0, %s1\n" : "=r"(n), "+w"(x)); 9 | return n; 10 | } 11 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_getsigdefault.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_getsigdefault(const posix_spawnattr_t *restrict attr, sigset_t *restrict def) 4 | { 5 | *def = attr->__def; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/process/posix_spawnattr_setsigdefault.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int posix_spawnattr_setsigdefault(posix_spawnattr_t *restrict attr, const sigset_t *restrict def) 4 | { 5 | attr->__def = *def; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/signal/killpg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int killpg(pid_t pgid, int sig) 5 | { 6 | if (pgid < 0) { 7 | errno = EINVAL; 8 | return -1; 9 | } 10 | return kill(-pgid, sig); 11 | } 12 | -------------------------------------------------------------------------------- /src/stdio/vscanf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int vscanf(const char *restrict fmt, va_list ap) 5 | { 6 | return vfscanf(stdin, fmt, ap); 7 | } 8 | 9 | weak_alias(vscanf,__isoc99_vscanf); 10 | -------------------------------------------------------------------------------- /src/string/memcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int memcmp(const void *vl, const void *vr, size_t n) 4 | { 5 | const unsigned char *l=vl, *r=vr; 6 | for (; n && *l == *r; n--, l++, r++); 7 | return n ? *l-*r : 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/temp/mkostemp.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | 4 | int mkostemp(char *template, int flags) 5 | { 6 | return __mkostemps(template, 0, flags); 7 | } 8 | 9 | weak_alias(mkostemp, mkostemp64); 10 | -------------------------------------------------------------------------------- /src/thread/mips/__unmapself.s: -------------------------------------------------------------------------------- 1 | .set noreorder 2 | .global __unmapself 3 | .type __unmapself,@function 4 | __unmapself: 5 | move $sp, $25 6 | li $2, 4091 7 | syscall 8 | li $4, 0 9 | li $2, 4001 10 | syscall 11 | -------------------------------------------------------------------------------- /src/thread/powerpc64/__set_thread_area.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global __set_thread_area 3 | .hidden __set_thread_area 4 | .type __set_thread_area, %function 5 | __set_thread_area: 6 | mr 13, 3 7 | li 3, 0 8 | blr 9 | 10 | -------------------------------------------------------------------------------- /src/thread/pthread_spin_lock.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | #include 3 | 4 | int pthread_spin_lock(pthread_spinlock_t *s) 5 | { 6 | while (*(volatile int *)s || a_cas(s, 0, EBUSY)) a_spin(); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/complex/catanh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* atanh = -i atan(i z) */ 4 | 5 | double complex catanh(double complex z) 6 | { 7 | z = catan(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/complex/csin.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* sin(z) = -i sinh(i z) */ 4 | 5 | double complex csin(double complex z) 6 | { 7 | z = csinh(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/complex/ctan.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* tan(z) = -i tanh(i z) */ 4 | 5 | double complex ctan(double complex z) 6 | { 7 | z = ctanh(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/include/sys/auxv.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_AUXV_H 2 | #define SYS_AUXV_H 3 | 4 | #include "../../../include/sys/auxv.h" 5 | 6 | #include 7 | 8 | hidden unsigned long __getauxval(unsigned long); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/include/sys/sysinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_SYSINFO_H 2 | #define SYS_SYSINFO_H 3 | 4 | #include "../../../include/sys/sysinfo.h" 5 | #include 6 | 7 | hidden int __lsysinfo(struct sysinfo *); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/linux/cap.c: -------------------------------------------------------------------------------- 1 | #include "syscall.h" 2 | 3 | int capset(void *a, void *b) 4 | { 5 | return syscall(SYS_capset, a, b); 6 | } 7 | 8 | int capget(void *a, void *b) 9 | { 10 | return syscall(SYS_capget, a, b); 11 | } 12 | -------------------------------------------------------------------------------- /src/linux/readahead.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | ssize_t readahead(int fd, off_t pos, size_t len) 6 | { 7 | return syscall(SYS_readahead, fd, __SYSCALL_LL_O(pos), len); 8 | } 9 | -------------------------------------------------------------------------------- /src/math/x32/remainderl.s: -------------------------------------------------------------------------------- 1 | .global remainderl 2 | .type remainderl,@function 3 | remainderl: 4 | fldt 24(%esp) 5 | fldt 8(%esp) 6 | 1: fprem1 7 | fnstsw %ax 8 | testb $4,%ah 9 | jnz 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/math/x86_64/remainderl.s: -------------------------------------------------------------------------------- 1 | .global remainderl 2 | .type remainderl,@function 3 | remainderl: 4 | fldt 24(%rsp) 5 | fldt 8(%rsp) 6 | 1: fprem1 7 | fnstsw %ax 8 | testb $4,%ah 9 | jnz 1b 10 | fstp %st(1) 11 | ret 12 | -------------------------------------------------------------------------------- /src/multibyte/mbrlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict st) 4 | { 5 | static unsigned internal; 6 | return mbrtowc(0, s, n, st ? st : (mbstate_t *)&internal); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/accept.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int accept(int fd, struct sockaddr *restrict addr, socklen_t *restrict len) 5 | { 6 | return socketcall_cp(accept, fd, addr, len, 0, 0, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/netname.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct netent *getnetbyaddr(uint32_t net, int type) 4 | { 5 | return 0; 6 | } 7 | 8 | struct netent *getnetbyname(const char *name) 9 | { 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/process/fdop.h: -------------------------------------------------------------------------------- 1 | #define FDOP_CLOSE 1 2 | #define FDOP_DUP2 2 3 | #define FDOP_OPEN 3 4 | 5 | struct fdop { 6 | struct fdop *next, *prev; 7 | int cmd, fd, srcfd, oflag; 8 | mode_t mode; 9 | char path[]; 10 | }; 11 | -------------------------------------------------------------------------------- /src/signal/siglongjmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | #include "pthread_impl.h" 5 | 6 | _Noreturn void siglongjmp(sigjmp_buf buf, int ret) 7 | { 8 | longjmp(buf, ret); 9 | } 10 | -------------------------------------------------------------------------------- /src/termios/tcsendbreak.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int tcsendbreak(int fd, int dur) 5 | { 6 | /* nonzero duration is implementation-defined, so ignore it */ 7 | return ioctl(fd, TCSBRK, 0); 8 | } 9 | -------------------------------------------------------------------------------- /src/thread/or1k/__unmapself.s: -------------------------------------------------------------------------------- 1 | .global __unmapself 2 | .type __unmapself,@function 3 | __unmapself: 4 | l.ori r11, r0, 215 /* __NR_munmap */ 5 | l.sys 1 6 | l.ori r3, r0, 0 7 | l.ori r11, r0, 93 /* __NR_exit */ 8 | l.sys 1 9 | -------------------------------------------------------------------------------- /src/thread/pthread_attr_setdetachstate.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_attr_setdetachstate(pthread_attr_t *a, int state) 4 | { 5 | if (state > 1U) return EINVAL; 6 | a->_a_detach = state; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/thread/pthread_setconcurrency.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int pthread_setconcurrency(int val) 5 | { 6 | if (val < 0) return EINVAL; 7 | if (val > 0) return EAGAIN; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /src/unistd/linkat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int linkat(int fd1, const char *existing, int fd2, const char *new, int flag) 5 | { 6 | return syscall(SYS_linkat, fd1, existing, fd2, new, flag); 7 | } 8 | -------------------------------------------------------------------------------- /arch/s390x/bits/statfs.h: -------------------------------------------------------------------------------- 1 | struct statfs { 2 | unsigned f_type, f_bsize; 3 | fsblkcnt_t f_blocks, f_bfree, f_bavail; 4 | fsfilcnt_t f_files, f_ffree; 5 | fsid_t f_fsid; 6 | unsigned f_namelen, f_frsize, f_flags, f_spare[4]; 7 | }; 8 | -------------------------------------------------------------------------------- /src/complex/casinh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* asinh(z) = -i asin(i z) */ 4 | 5 | double complex casinh(double complex z) 6 | { 7 | z = casin(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/include/errno.h: -------------------------------------------------------------------------------- 1 | #ifndef ERRNO_H 2 | #define ERRNO_H 3 | 4 | #include "../../include/errno.h" 5 | 6 | hidden int *___errno_location(void); 7 | 8 | #undef errno 9 | #define errno (*___errno_location()) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/internal/lock.h: -------------------------------------------------------------------------------- 1 | #ifndef LOCK_H 2 | #define LOCK_H 3 | 4 | hidden void __lock(volatile int *); 5 | hidden void __unlock(volatile int *); 6 | #define LOCK(x) __lock(x) 7 | #define UNLOCK(x) __unlock(x) 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/internal/m68k/syscall.s: -------------------------------------------------------------------------------- 1 | .global __syscall 2 | .hidden __syscall 3 | .type __syscall,%function 4 | __syscall: 5 | movem.l %d2-%d5,-(%sp) 6 | movem.l 20(%sp),%d0-%d5/%a0 7 | trap #0 8 | movem.l (%sp)+,%d2-%d5 9 | rts 10 | -------------------------------------------------------------------------------- /src/linux/settimeofday.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | int settimeofday(const struct timeval *tv, const struct timezone *tz) 6 | { 7 | return syscall(SYS_settimeofday, tv, 0); 8 | } 9 | -------------------------------------------------------------------------------- /src/mq/mq_setattr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int mq_setattr(mqd_t mqd, const struct mq_attr *restrict new, struct mq_attr *restrict old) 5 | { 6 | return syscall(SYS_mq_getsetattr, mqd, new, old); 7 | } 8 | -------------------------------------------------------------------------------- /src/sched/sched_setscheduler.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "syscall.h" 4 | 5 | int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param) 6 | { 7 | return __syscall_ret(-ENOSYS); 8 | } 9 | -------------------------------------------------------------------------------- /src/signal/x32/restore.s: -------------------------------------------------------------------------------- 1 | nop 2 | .global __restore_rt 3 | .hidden __restore_rt 4 | .type __restore_rt,@function 5 | __restore_rt: 6 | mov $0x40000201, %rax /* SYS_rt_sigreturn */ 7 | syscall 8 | .size __restore_rt,.-__restore_rt 9 | -------------------------------------------------------------------------------- /src/stdio/puts.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | int puts(const char *s) 4 | { 5 | int r; 6 | FLOCK(stdout); 7 | r = -(fputs(s, stdout) < 0 || putc_unlocked('\n', stdout) < 0); 8 | FUNLOCK(stdout); 9 | return r; 10 | } 11 | -------------------------------------------------------------------------------- /src/thread/microblaze/__set_thread_area.s: -------------------------------------------------------------------------------- 1 | .global __set_thread_area 2 | .hidden __set_thread_area 3 | .type __set_thread_area,@function 4 | __set_thread_area: 5 | ori r21, r5, 0 6 | rtsd r15, 8 7 | ori r3, r0, 0 8 | -------------------------------------------------------------------------------- /src/thread/pthread_attr_setguardsize.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_attr_setguardsize(pthread_attr_t *a, size_t size) 4 | { 5 | if (size > SIZE_MAX/8) return EINVAL; 6 | a->_a_guardsize = size; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/time/time.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | time_t time(time_t *t) 5 | { 6 | struct timespec ts; 7 | __clock_gettime(CLOCK_REALTIME, &ts); 8 | if (t) *t = ts.tv_sec; 9 | return ts.tv_sec; 10 | } 11 | -------------------------------------------------------------------------------- /src/unistd/pipe.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int pipe(int fd[2]) 5 | { 6 | #ifdef SYS_pipe 7 | return syscall(SYS_pipe, fd); 8 | #else 9 | return syscall(SYS_pipe2, fd, 0); 10 | #endif 11 | } 12 | -------------------------------------------------------------------------------- /src/unistd/tcsetpgrp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int tcsetpgrp(int fd, pid_t pgrp) 6 | { 7 | int pgrp_int = pgrp; 8 | return ioctl(fd, TIOCSPGRP, &pgrp_int); 9 | } 10 | -------------------------------------------------------------------------------- /arch/m68k/atomic_arch.h: -------------------------------------------------------------------------------- 1 | #define a_cas a_cas 2 | static inline int a_cas(volatile int *p, int t, int s) 3 | { 4 | __asm__ __volatile__ ( 5 | "cas.l %0, %2, (%1)" 6 | : "+d"(t) : "a"(p), "d"(s) : "memory", "cc"); 7 | return t; 8 | } 9 | -------------------------------------------------------------------------------- /crt/arm/crti.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | 3 | .section .init 4 | .global _init 5 | .type _init,%function 6 | _init: 7 | push {r0,lr} 8 | 9 | .section .fini 10 | .global _fini 11 | .type _fini,%function 12 | _fini: 13 | push {r0,lr} 14 | -------------------------------------------------------------------------------- /crt/mips/crtn.s: -------------------------------------------------------------------------------- 1 | .set noreorder 2 | 3 | .section .init 4 | lw $gp,24($sp) 5 | lw $ra,28($sp) 6 | j $ra 7 | addu $sp,$sp,32 8 | 9 | .section .fini 10 | lw $gp,24($sp) 11 | lw $ra,28($sp) 12 | j $ra 13 | addu $sp,$sp,32 14 | -------------------------------------------------------------------------------- /include/sys/klog.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_KLOG_H 2 | #define _SYS_KLOG_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int klogctl (int, char *, int); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/dirent/closedir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "__dirent.h" 5 | 6 | int closedir(DIR *dir) 7 | { 8 | int ret = close(dir->fd); 9 | free(dir); 10 | return ret; 11 | } 12 | -------------------------------------------------------------------------------- /src/errno/__errno_location.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pthread_impl.h" 3 | 4 | int *__errno_location(void) 5 | { 6 | return &__pthread_self()->errno_val; 7 | } 8 | 9 | weak_alias(__errno_location, ___errno_location); 10 | -------------------------------------------------------------------------------- /src/math/scalbln.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | double scalbln(double x, long n) 5 | { 6 | if (n > INT_MAX) 7 | n = INT_MAX; 8 | else if (n < INT_MIN) 9 | n = INT_MIN; 10 | return scalbn(x, n); 11 | } 12 | -------------------------------------------------------------------------------- /src/network/getpeername.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int getpeername(int fd, struct sockaddr *restrict addr, socklen_t *restrict len) 5 | { 6 | return socketcall(getpeername, fd, addr, len, 0, 0, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/network/getsockname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int getsockname(int fd, struct sockaddr *restrict addr, socklen_t *restrict len) 5 | { 6 | return socketcall(getsockname, fd, addr, len, 0, 0, 0); 7 | } 8 | -------------------------------------------------------------------------------- /src/process/i386/vfork.s: -------------------------------------------------------------------------------- 1 | .global vfork 2 | .type vfork,@function 3 | vfork: 4 | pop %edx 5 | mov $190,%eax 6 | int $128 7 | push %edx 8 | push %eax 9 | .hidden __syscall_ret 10 | call __syscall_ret 11 | pop %edx 12 | ret 13 | -------------------------------------------------------------------------------- /src/process/x32/vfork.s: -------------------------------------------------------------------------------- 1 | .global vfork 2 | .type vfork,@function 3 | vfork: 4 | pop %rdx 5 | mov $0x4000003a,%eax /* SYS_vfork */ 6 | syscall 7 | push %rdx 8 | mov %rax,%rdi 9 | .hidden __syscall_ret 10 | jmp __syscall_ret 11 | -------------------------------------------------------------------------------- /src/signal/setitimer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int setitimer(int which, const struct itimerval *restrict new, struct itimerval *restrict old) 5 | { 6 | return syscall(SYS_setitimer, which, new, old); 7 | } 8 | -------------------------------------------------------------------------------- /src/signal/sighold.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sighold(int sig) 4 | { 5 | sigset_t mask; 6 | 7 | sigemptyset(&mask); 8 | if (sigaddset(&mask, sig) < 0) return -1; 9 | return sigprocmask(SIG_BLOCK, &mask, 0); 10 | } 11 | -------------------------------------------------------------------------------- /src/stdio/flockfile.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | #include "pthread_impl.h" 3 | 4 | void flockfile(FILE *f) 5 | { 6 | if (!ftrylockfile(f)) return; 7 | __lockfile(f); 8 | __register_locked_file(f, __pthread_self()); 9 | } 10 | -------------------------------------------------------------------------------- /src/string/strdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strdup(const char *s) 5 | { 6 | size_t l = strlen(s); 7 | char *d = malloc(l+1); 8 | if (!d) return NULL; 9 | return memcpy(d, s, l+1); 10 | } 11 | -------------------------------------------------------------------------------- /src/thread/__set_thread_area.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int __set_thread_area(void *p) 4 | { 5 | #ifdef SYS_set_thread_area 6 | return __syscall(SYS_set_thread_area, p); 7 | #else 8 | return -ENOSYS; 9 | #endif 10 | } 11 | -------------------------------------------------------------------------------- /src/unistd/pause.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int pause(void) 5 | { 6 | #ifdef SYS_pause 7 | return syscall_cp(SYS_pause); 8 | #else 9 | return syscall_cp(SYS_ppoll, 0, 0, 0, 0); 10 | #endif 11 | } 12 | -------------------------------------------------------------------------------- /crt/microblaze/crti.s: -------------------------------------------------------------------------------- 1 | .section .init 2 | .global _init 3 | .align 2 4 | _init: 5 | addi r1, r1, -32 6 | swi r15, r1, 0 7 | 8 | .section .fini 9 | .global _fini 10 | .align 2 11 | _fini: 12 | addi r1, r1, -32 13 | swi r15, r1, 0 14 | -------------------------------------------------------------------------------- /crt/mips64/crtn.s: -------------------------------------------------------------------------------- 1 | .set noreorder 2 | 3 | .section .init 4 | ld $gp,16($sp) 5 | ld $ra,24($sp) 6 | j $ra 7 | daddu $sp,$sp,32 8 | 9 | .section .fini 10 | ld $gp,16($sp) 11 | ld $ra,24($sp) 12 | j $ra 13 | daddu $sp,$sp,32 14 | -------------------------------------------------------------------------------- /crt/mipsn32/crtn.s: -------------------------------------------------------------------------------- 1 | .set noreorder 2 | .section .init 3 | ld $gp, 16($sp) 4 | ld $ra, 24($sp) 5 | j $ra 6 | addu $sp, $sp, 32 7 | 8 | .section .fini 9 | ld $gp, 16($sp) 10 | ld $ra, 24($sp) 11 | j $ra 12 | addu $sp, $sp, 32 13 | -------------------------------------------------------------------------------- /include/stdc-predef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDC_PREDEF_H 2 | #define _STDC_PREDEF_H 3 | 4 | #define __STDC_ISO_10646__ 201206L 5 | 6 | #if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0 7 | #define __STDC_IEC_559__ 1 8 | #endif 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/linux/stime.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | 5 | int stime(const time_t *t) 6 | { 7 | struct timeval tv = { .tv_sec = *t, .tv_usec = 0 }; 8 | return settimeofday(&tv, (void *)0); 9 | } 10 | -------------------------------------------------------------------------------- /src/linux/vmsplice.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include "syscall.h" 4 | 5 | ssize_t vmsplice(int fd, const struct iovec *iov, size_t cnt, unsigned flags) 6 | { 7 | return syscall(SYS_vmsplice, fd, iov, cnt, flags); 8 | } 9 | -------------------------------------------------------------------------------- /src/math/scalblnf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float scalblnf(float x, long n) 5 | { 6 | if (n > INT_MAX) 7 | n = INT_MAX; 8 | else if (n < INT_MIN) 9 | n = INT_MIN; 10 | return scalbnf(x, n); 11 | } 12 | -------------------------------------------------------------------------------- /src/misc/getpriority.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int getpriority(int which, id_t who) 5 | { 6 | int ret = syscall(SYS_getpriority, which, who); 7 | if (ret < 0) return ret; 8 | return 20-ret; 9 | } 10 | -------------------------------------------------------------------------------- /src/mman/madvise.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int __madvise(void *addr, size_t len, int advice) 5 | { 6 | return syscall(SYS_madvise, addr, len, advice); 7 | } 8 | 9 | weak_alias(__madvise, madvise); 10 | -------------------------------------------------------------------------------- /src/signal/sigrelse.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sigrelse(int sig) 4 | { 5 | sigset_t mask; 6 | 7 | sigemptyset(&mask); 8 | if (sigaddset(&mask, sig) < 0) return -1; 9 | return sigprocmask(SIG_UNBLOCK, &mask, 0); 10 | } 11 | -------------------------------------------------------------------------------- /src/stdio/getc_unlocked.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | int (getc_unlocked)(FILE *f) 4 | { 5 | return getc_unlocked(f); 6 | } 7 | 8 | weak_alias (getc_unlocked, fgetc_unlocked); 9 | weak_alias (getc_unlocked, _IO_getc_unlocked); 10 | -------------------------------------------------------------------------------- /src/stdio/ofl_add.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | FILE *__ofl_add(FILE *f) 4 | { 5 | FILE **head = __ofl_lock(); 6 | f->next = *head; 7 | if (*head) (*head)->prev = f; 8 | *head = f; 9 | __ofl_unlock(); 10 | return f; 11 | } 12 | -------------------------------------------------------------------------------- /src/string/wcsncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcsncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) 4 | { 5 | wchar_t *a = d; 6 | while (n && *s) n--, *d++ = *s++; 7 | wmemset(d, 0, n); 8 | return a; 9 | } 10 | -------------------------------------------------------------------------------- /src/thread/pthread_attr_setschedparam.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_attr_setschedparam(pthread_attr_t *restrict a, const struct sched_param *restrict param) 4 | { 5 | a->_a_prio = param->sched_priority; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/thread/pthread_rwlockattr_setpshared.c: -------------------------------------------------------------------------------- 1 | #include "pthread_impl.h" 2 | 3 | int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *a, int pshared) 4 | { 5 | if (pshared > 1U) return EINVAL; 6 | a->__attr[0] = pshared; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/unistd/ftruncate.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | int ftruncate(int fd, off_t length) 5 | { 6 | return syscall(SYS_ftruncate, fd, __SYSCALL_LL_O(length)); 7 | } 8 | 9 | weak_alias(ftruncate, ftruncate64); 10 | -------------------------------------------------------------------------------- /src/unistd/readlinkat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, size_t bufsize) 5 | { 6 | return syscall(SYS_readlinkat, fd, path, buf, bufsize); 7 | } 8 | -------------------------------------------------------------------------------- /src/unistd/tcgetpgrp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | pid_t tcgetpgrp(int fd) 6 | { 7 | int pgrp; 8 | if (ioctl(fd, TIOCGPGRP, &pgrp) < 0) 9 | return -1; 10 | return pgrp; 11 | } 12 | --------------------------------------------------------------------------------