summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--MAINTAINERS1
-rw-r--r--Makefile.in2
-rw-r--r--Makerules10
-rw-r--r--Rules.mak31
-rw-r--r--docs/porting.txt11
-rw-r--r--extra/Configs/Config.in144
-rw-r--r--extra/Configs/Config.in.arch8
-rw-r--r--extra/Configs/Config.kvx18
-rw-r--r--extra/Configs/Config.mips1
-rw-r--r--extra/Configs/Config.nds321
-rw-r--r--extra/Configs/Config.riscv3214
-rwxr-xr-x[-rw-r--r--]extra/Configs/Config.x86_641
-rw-r--r--extra/Configs/Config.xtensa3
-rw-r--r--extra/locale/gen_wc8bit.c3
-rw-r--r--extra/locale/programs/locale.c2
-rw-r--r--include/arpa/nameser.h1
-rw-r--r--include/assert.h5
-rw-r--r--include/elf.h11
-rw-r--r--include/fcntl.h25
-rw-r--r--include/features.h20
-rw-r--r--include/internal/time64_helpers.h31
-rw-r--r--include/libc-symbols.h14
-rw-r--r--include/resolv.h2
-rw-r--r--include/setjmp.h22
-rw-r--r--include/stdlib.h4
-rw-r--r--include/string.h4
-rw-r--r--include/sys/auxv.h34
-rw-r--r--include/sys/cdefs.h11
-rw-r--r--include/sys/personality.h18
-rw-r--r--include/sys/resource.h23
-rw-r--r--include/sys/stat.h7
-rw-r--r--ldso/include/dl-defs.h2
-rw-r--r--ldso/include/dl-elf.h41
-rw-r--r--ldso/include/dl-string.h4
-rw-r--r--ldso/include/dl-syscall.h12
-rwxr-xr-x[-rw-r--r--]ldso/include/ldso.h17
-rw-r--r--ldso/ldso/Makefile.in8
-rw-r--r--ldso/ldso/aarch64/elfinterp.c8
-rw-r--r--ldso/ldso/arc/dl-sysdep.h3
-rw-r--r--ldso/ldso/arc/resolve.S45
-rw-r--r--ldso/ldso/arm/dl-startup.h2
-rw-r--r--ldso/ldso/dl-elf.c13
-rw-r--r--ldso/ldso/dl-startup.c43
-rwxr-xr-xldso/ldso/dl-vdso.c362
-rwxr-xr-x[-rw-r--r--]ldso/ldso/ldso.c51
-rw-r--r--ldso/ldso/m68k/dl-startup.h3
-rw-r--r--ldso/ldso/m68k/dl-sysdep.h2
-rw-r--r--ldso/ldso/mips/dl-startup.h3
-rw-r--r--ldso/ldso/powerpc/dl-startup.h4
-rw-r--r--ldso/ldso/riscv32/dl-startup.h92
-rw-r--r--ldso/ldso/riscv32/dl-syscalls.h1
-rw-r--r--ldso/ldso/riscv32/dl-sysdep.h91
-rw-r--r--ldso/ldso/riscv32/elfinterp.c295
-rw-r--r--ldso/ldso/riscv32/resolve.S96
-rw-r--r--ldso/ldso/riscv64/dl-startup.h2
-rw-r--r--ldso/ldso/riscv64/dl-sysdep.h21
-rw-r--r--ldso/ldso/riscv64/elfinterp.c8
-rw-r--r--ldso/ldso/xtensa/dl-startup.h15
-rw-r--r--ldso/ldso/xtensa/dl-sysdep.h3
-rw-r--r--libc/inet/Makefile.in2
-rw-r--r--libc/inet/decoded.c8
-rw-r--r--libc/inet/encoded.c8
-rw-r--r--libc/inet/encodeq.c2
-rw-r--r--libc/inet/getaddrinfo.c3
-rw-r--r--libc/inet/getnet.c3
-rw-r--r--libc/inet/hostid.c3
-rw-r--r--libc/inet/resolv.c503
-rw-r--r--libc/inet/socketcalls.c8
-rw-r--r--libc/misc/Makefile.in3
-rw-r--r--libc/misc/auxvt/Makefile.in23
-rwxr-xr-xlibc/misc/auxvt/getauxval.c48
-rw-r--r--libc/misc/fnmatch/fnmatch_loop.c3
-rw-r--r--libc/misc/getloadavg/Makefile13
-rw-r--r--libc/misc/getloadavg/Makefile.in23
-rw-r--r--libc/misc/getloadavg/getloadavg.c41
-rw-r--r--libc/misc/internals/Makefile.in3
-rw-r--r--libc/misc/internals/__uClibc_main.c3
-rw-r--r--libc/misc/internals/reloc_static_pie.c113
-rw-r--r--libc/misc/internals/tempname.c3
-rw-r--r--libc/misc/mntent/mntent.c21
-rw-r--r--libc/misc/regex/regex_internal.h2
-rw-r--r--libc/misc/sysvipc/sem.c18
-rw-r--r--libc/misc/time/time.c11
-rw-r--r--libc/misc/wchar/wchar.c1
-rw-r--r--libc/signal/sigwait.c3
-rw-r--r--libc/stdlib/malloc-simple/alloc.c20
-rw-r--r--libc/stdlib/malloc-standard/malloc.c1
-rw-r--r--libc/stdlib/malloc-standard/reallocarray.c36
-rw-r--r--libc/stdlib/random.c14
-rw-r--r--libc/string/arc/memcmp.S94
-rw-r--r--libc/string/arc/memcpy.S65
-rw-r--r--libc/string/arc/memset.S61
-rw-r--r--libc/string/arc/strchr.S25
-rw-r--r--libc/string/arc/strcmp.S29
-rw-r--r--libc/string/arc/strlen.S7
-rw-r--r--libc/string/arm/memset.S2
-rw-r--r--libc/string/explicit_bzero.c30
-rw-r--r--libc/string/generic/strchr.c23
-rw-r--r--libc/string/generic/strchrnul.c23
-rw-r--r--libc/string/kvx/memcpy.S4
-rw-r--r--libc/string/strcasestr.c2
-rw-r--r--libc/string/strstr.c2
-rw-r--r--libc/sysdeps/linux/aarch64/bits/fcntl.h26
-rw-r--r--libc/sysdeps/linux/aarch64/bits/hwcap.h99
-rw-r--r--libc/sysdeps/linux/aarch64/crt1.S14
-rw-r--r--libc/sysdeps/linux/alpha/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/alpha/bits/resource.h23
-rw-r--r--libc/sysdeps/linux/arc/asm.h91
-rw-r--r--libc/sysdeps/linux/arc/bits/atomic.h76
-rwxr-xr-xlibc/sysdeps/linux/arc/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/arc/bits/syscalls.h4
-rwxr-xr-xlibc/sysdeps/linux/arc/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/arc/crt1.S4
-rw-r--r--libc/sysdeps/linux/arc/sigrestorer.S3
-rw-r--r--libc/sysdeps/linux/arm/bits/elf-fdpic.h2
-rw-r--r--libc/sysdeps/linux/arm/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/arm/bits/hwcap.h50
-rw-r--r--libc/sysdeps/linux/arm/bits/kernel_stat.h1
-rw-r--r--libc/sysdeps/linux/arm/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/arm/crt1.S21
-rw-r--r--libc/sysdeps/linux/avr32/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/bfin/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/c6x/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/c6x/bits/resource.h9
-rwxr-xr-x[-rw-r--r--]libc/sysdeps/linux/c6x/bits/syscalls.h4
-rw-r--r--libc/sysdeps/linux/common/Makefile.in1
-rw-r--r--libc/sysdeps/linux/common/__rt_sigtimedwait.c16
-rw-r--r--libc/sysdeps/linux/common/__rt_sigwaitinfo.c2
-rw-r--r--libc/sysdeps/linux/common/alarm.c2
-rw-r--r--libc/sysdeps/linux/common/bits/hwcap.h22
-rw-r--r--libc/sysdeps/linux/common/bits/jmp_buf_tag.h37
-rw-r--r--libc/sysdeps/linux/common/bits/kernel-features.h5
-rw-r--r--libc/sysdeps/linux/common/bits/mman-linux.h1
-rw-r--r--libc/sysdeps/linux/common/bits/resource.h17
-rw-r--r--libc/sysdeps/linux/common/bits/sched.h1
-rw-r--r--libc/sysdeps/linux/common/bits/sem.h20
-rwxr-xr-x[-rw-r--r--]libc/sysdeps/linux/common/bits/syscalls-common.h54
-rw-r--r--libc/sysdeps/linux/common/bits/typesizes.h12
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_uwchar.h1
-rw-r--r--libc/sysdeps/linux/common/bits/wchar.h32
-rw-r--r--libc/sysdeps/linux/common/clock_adjtime.c6
-rw-r--r--libc/sysdeps/linux/common/clock_getres.c16
-rw-r--r--libc/sysdeps/linux/common/clock_gettime.c16
-rw-r--r--libc/sysdeps/linux/common/clock_settime.c10
-rw-r--r--libc/sysdeps/linux/common/fstat.c7
-rw-r--r--libc/sysdeps/linux/common/fstat64.c4
-rw-r--r--libc/sysdeps/linux/common/fstatat.c42
-rw-r--r--libc/sysdeps/linux/common/fstatat64.c23
-rw-r--r--libc/sysdeps/linux/common/futimesat.c26
-rw-r--r--libc/sysdeps/linux/common/getrlimit.c56
-rw-r--r--libc/sysdeps/linux/common/getrlimit64.c26
-rwxr-xr-x[-rw-r--r--]libc/sysdeps/linux/common/gettimeofday.c33
-rw-r--r--libc/sysdeps/linux/common/lstat.c3
-rw-r--r--libc/sysdeps/linux/common/lstat64.c2
-rw-r--r--libc/sysdeps/linux/common/nanosleep.c16
-rw-r--r--libc/sysdeps/linux/common/open.c2
-rw-r--r--libc/sysdeps/linux/common/open64.c4
-rw-r--r--libc/sysdeps/linux/common/openat64.c10
-rw-r--r--libc/sysdeps/linux/common/ppoll.c11
-rw-r--r--libc/sysdeps/linux/common/prlimit.c76
-rw-r--r--libc/sysdeps/linux/common/prlimit64.c36
-rw-r--r--libc/sysdeps/linux/common/pselect.c10
-rw-r--r--libc/sysdeps/linux/common/renameat.c14
-rw-r--r--libc/sysdeps/linux/common/sched_rr_get_interval.c5
-rw-r--r--libc/sysdeps/linux/common/select.c16
-rw-r--r--libc/sysdeps/linux/common/setitimer.c32
-rw-r--r--libc/sysdeps/linux/common/setrlimit.c53
-rw-r--r--libc/sysdeps/linux/common/setrlimit64.c24
-rw-r--r--libc/sysdeps/linux/common/settimeofday.c21
-rw-r--r--libc/sysdeps/linux/common/stat.c5
-rw-r--r--libc/sysdeps/linux/common/stat64.c4
-rw-r--r--libc/sysdeps/linux/common/statx_cp.c2
-rw-r--r--libc/sysdeps/linux/common/stubs.c6
-rw-r--r--libc/sysdeps/linux/common/time.c2
-rw-r--r--libc/sysdeps/linux/common/timerfd.c21
-rw-r--r--libc/sysdeps/linux/common/umount2.c2
-rw-r--r--libc/sysdeps/linux/common/utimensat.c24
-rw-r--r--libc/sysdeps/linux/common/wait4.c15
-rw-r--r--libc/sysdeps/linux/cris/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/csky/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/frv/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/h8300/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/hppa/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/i386/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/i386/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/i386/crt1.S20
-rw-r--r--libc/sysdeps/linux/ia64/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/kvx/bits/atomic.h212
-rw-r--r--libc/sysdeps/linux/kvx/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/kvx/bits/kernel_types.h2
-rw-r--r--libc/sysdeps/linux/kvx/bits/stat.h145
-rw-r--r--libc/sysdeps/linux/kvx/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/kvx/clone.S4
-rw-r--r--libc/sysdeps/linux/kvx/sys/procfs.h13
-rw-r--r--libc/sysdeps/linux/kvx/sys/ucontext.h5
-rw-r--r--libc/sysdeps/linux/kvx/sys/user.h28
-rw-r--r--libc/sysdeps/linux/lm32/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/m68k/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/m68k/crt1.S10
-rw-r--r--libc/sysdeps/linux/metag/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/microblaze/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/mips/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/mips/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/mips/bits/resource.h21
-rw-r--r--libc/sysdeps/linux/mips/bits/sem.h13
-rw-r--r--libc/sysdeps/linux/mips/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/mips/crt1.S23
-rw-r--r--libc/sysdeps/linux/nds32/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/nds32/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/nds32/bits/kernel_types.h22
-rw-r--r--libc/sysdeps/linux/nds32/bits/syscalls.h3
-rw-r--r--libc/sysdeps/linux/nds32/sys/ucontext.h6
-rw-r--r--libc/sysdeps/linux/nds32/vfork.S129
-rw-r--r--libc/sysdeps/linux/nios2/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/or1k/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/or1k/bits/kernel_stat.h27
-rw-r--r--libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/powerpc/bits/kernel_stat.h6
-rw-r--r--libc/sysdeps/linux/powerpc/bits/sem.h16
-rw-r--r--libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/powerpc/crt1.S23
-rw-r--r--libc/sysdeps/linux/powerpc/sys/procfs.h2
-rw-r--r--libc/sysdeps/linux/riscv32/Makefile6
-rw-r--r--libc/sysdeps/linux/riscv32/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/riscv32/__longjmp.S57
-rw-r--r--libc/sysdeps/linux/riscv32/__syscall_error.c18
-rw-r--r--libc/sysdeps/linux/riscv32/bits/atomic.h170
-rw-r--r--libc/sysdeps/linux/riscv32/bits/endian.h5
-rw-r--r--libc/sysdeps/linux/riscv32/bits/fcntl.h231
-rw-r--r--libc/sysdeps/linux/riscv32/bits/fenv.h73
-rw-r--r--libc/sysdeps/linux/riscv32/bits/kernel_types.h42
-rw-r--r--libc/sysdeps/linux/riscv32/bits/mman.h38
-rw-r--r--libc/sysdeps/linux/riscv32/bits/setjmp.h38
-rw-r--r--libc/sysdeps/linux/riscv32/bits/shm.h90
-rw-r--r--libc/sysdeps/linux/riscv32/bits/sigcontext.h32
-rw-r--r--libc/sysdeps/linux/riscv32/bits/stackinfo.h11
-rw-r--r--libc/sysdeps/linux/riscv32/bits/syscalls.h85
-rw-r--r--libc/sysdeps/linux/riscv32/bits/uClibc_arch_features.h36
-rw-r--r--libc/sysdeps/linux/riscv32/bits/uClibc_page.h28
-rw-r--r--libc/sysdeps/linux/riscv32/bits/wordsize.h30
-rw-r--r--libc/sysdeps/linux/riscv32/bsd-_setjmp.c1
-rw-r--r--libc/sysdeps/linux/riscv32/bsd-setjmp.c1
-rw-r--r--libc/sysdeps/linux/riscv32/cache.c55
-rw-r--r--libc/sysdeps/linux/riscv32/clone.S86
-rw-r--r--libc/sysdeps/linux/riscv32/crt1.S88
-rw-r--r--libc/sysdeps/linux/riscv32/crti.S17
-rw-r--r--libc/sysdeps/linux/riscv32/crtn.S13
-rw-r--r--libc/sysdeps/linux/riscv32/getcontext.S74
-rw-r--r--libc/sysdeps/linux/riscv32/jmpbuf-offsets.h23
-rw-r--r--libc/sysdeps/linux/riscv32/jmpbuf-unwind.h46
-rw-r--r--libc/sysdeps/linux/riscv32/setcontext.S112
-rw-r--r--libc/sysdeps/linux/riscv32/setjmp.S73
-rw-r--r--libc/sysdeps/linux/riscv32/swapcontext.S122
-rw-r--r--libc/sysdeps/linux/riscv32/sys/asm.h67
-rw-r--r--libc/sysdeps/linux/riscv32/sys/procfs.h114
-rw-r--r--libc/sysdeps/linux/riscv32/sys/ucontext.h108
-rw-r--r--libc/sysdeps/linux/riscv32/sys/user.h1
-rw-r--r--libc/sysdeps/linux/riscv32/sysdep.h126
-rw-r--r--libc/sysdeps/linux/riscv32/vfork.S42
-rw-r--r--libc/sysdeps/linux/riscv64/bits/atomic.h170
-rw-r--r--libc/sysdeps/linux/riscv64/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/riscv64/bits/uClibc_arch_features.h4
-rw-r--r--libc/sysdeps/linux/riscv64/bits/uClibc_page.h2
-rw-r--r--libc/sysdeps/linux/riscv64/bits/wordsize.h3
-rw-r--r--libc/sysdeps/linux/riscv64/cache.c4
-rw-r--r--libc/sysdeps/linux/riscv64/clone.S8
-rw-r--r--libc/sysdeps/linux/riscv64/jmpbuf-unwind.h7
-rw-r--r--libc/sysdeps/linux/riscv64/setjmp.S2
-rw-r--r--libc/sysdeps/linux/riscv64/sys/asm.h6
-rw-r--r--libc/sysdeps/linux/sh/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/sh/bits/kernel_types.h2
-rw-r--r--libc/sysdeps/linux/sh/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/sparc/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/sparc/bits/resource.h21
-rw-r--r--libc/sysdeps/linux/sparc/bits/sem.h18
-rw-r--r--libc/sysdeps/linux/sparc/bits/typesizes.h12
-rw-r--r--libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/sparc64/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/sparc64/bits/resource.h21
-rw-r--r--libc/sysdeps/linux/tile/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/x86_64/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/x86_64/crt1.S16
-rw-r--r--libc/sysdeps/linux/xtensa/Makefile.arch3
-rw-r--r--libc/sysdeps/linux/xtensa/__start_context.S100
-rw-r--r--libc/sysdeps/linux/xtensa/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/xtensa/crt1.S27
-rw-r--r--libc/sysdeps/linux/xtensa/getcontext.S99
-rw-r--r--libc/sysdeps/linux/xtensa/makecontext.c179
-rw-r--r--libc/sysdeps/linux/xtensa/setcontext.S116
-rw-r--r--libc/sysdeps/linux/xtensa/swapcontext.S173
-rw-r--r--libc/sysdeps/linux/xtensa/sysdep.h7
-rw-r--r--libc/sysdeps/linux/xtensa/ucontext_i.sym15
-rw-r--r--libc/unistd/daemon.c2
-rw-r--r--libc/unistd/sysconf.c4
-rw-r--r--libcrypt/crypt.c3
-rw-r--r--libcrypt/des.c222
-rw-r--r--libcrypt/des_tables.c4758
-rw-r--r--libcrypt/sha256-crypt.c12
-rw-r--r--libcrypt/sha512-crypt.c10
-rw-r--r--libm/s_lrint.c20
-rw-r--r--libm/s_nextafter.c9
-rw-r--r--libm/w_j0f.c2
-rw-r--r--libpthread/linuxthreads/condvar.c7
-rw-r--r--libpthread/linuxthreads/manager.c37
-rw-r--r--libpthread/linuxthreads/semaphore.c10
-rw-r--r--libpthread/linuxthreads/signals.c17
-rw-r--r--libpthread/linuxthreads/sysdeps/arm/pt-machine.h36
-rw-r--r--libpthread/linuxthreads/sysdeps/riscv64/pt-machine.h61
-rw-r--r--libpthread/nptl/init.c33
-rw-r--r--libpthread/nptl/pthreadP.h1
-rw-r--r--libpthread/nptl/pthread_condattr_setclock.c6
-rw-r--r--libpthread/nptl/pthread_create.c2
-rw-r--r--libpthread/nptl/pthread_mutex_init.c5
-rw-r--r--libpthread/nptl/pthread_mutex_lock.c13
-rw-r--r--libpthread/nptl/pthread_mutex_timedlock.c33
-rw-r--r--libpthread/nptl/pthread_mutex_trylock.c13
-rw-r--r--libpthread/nptl/pthread_mutex_unlock.c5
-rw-r--r--libpthread/nptl/sem_open.c4
-rw-r--r--libpthread/nptl/sysdeps/aarch64/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/alpha/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/arc/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/arm/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/csky/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/generic/Makefile.in4
-rw-r--r--libpthread/nptl/sysdeps/generic/libc-tls.c14
-rw-r--r--libpthread/nptl/sysdeps/i386/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/kvx/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/m68k/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/metag/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/microblaze/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/mips/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/nds32/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/nios2/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/or1k/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/powerpc/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/pthread/pthread.h4
-rw-r--r--libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c21
-rw-r--r--libpthread/nptl/sysdeps/riscv32/Makefile.arch4
-rw-r--r--libpthread/nptl/sysdeps/riscv32/dl-tls.h34
-rw-r--r--libpthread/nptl/sysdeps/riscv32/libc-tls.c34
-rw-r--r--libpthread/nptl/sysdeps/riscv32/pthread_spin_lock.c65
-rw-r--r--libpthread/nptl/sysdeps/riscv32/pthread_spin_trylock.c (renamed from libc/sysdeps/linux/i386/bits/wchar.h)19
-rw-r--r--libpthread/nptl/sysdeps/riscv32/pthreaddef.h33
-rw-r--r--libpthread/nptl/sysdeps/riscv32/tcb-offsets.sym7
-rw-r--r--libpthread/nptl/sysdeps/riscv32/tls.h170
-rw-r--r--libpthread/nptl/sysdeps/riscv64/dl-tls.h10
-rw-r--r--libpthread/nptl/sysdeps/riscv64/libc-tls.c2
-rw-r--r--libpthread/nptl/sysdeps/riscv64/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/riscv64/tcb-offsets.sym7
-rw-r--r--libpthread/nptl/sysdeps/riscv64/tls.h117
-rw-r--r--libpthread/nptl/sysdeps/sh/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/sparc/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h62
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h61
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nanosleep.c12
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile9
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile.arch9
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/pthreadtypes.h168
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/semaphore.h33
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/createthread.c23
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/fork.c11
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/pthread_once.c92
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/sysdep-cancel.h38
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/bits/pthreadtypes.h2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/createthread.c13
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/fork.c18
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_gettime.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_settime.c8
-rw-r--r--libpthread/nptl/sysdeps/x86_64/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/xtensa/pthreaddef.h3
-rw-r--r--librt/clock_getcpuclockid.c15
-rw-r--r--librt/clock_gettime.c16
-rw-r--r--librt/clock_nanosleep.c35
-rw-r--r--librt/mq_timedreceive.c10
-rw-r--r--librt/mq_timedsend.c9
-rw-r--r--librt/timer_gettime.c6
-rw-r--r--librt/timer_settime.c14
-rw-r--r--utils/ldd.c7
385 files changed, 13661 insertions, 1468 deletions
diff --git a/.gitignore b/.gitignore
index 3ded06ee8..886f021e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
*.oS
*.a
*.i
+*.s
*.o
*.depend
lib/
diff --git a/MAINTAINERS b/MAINTAINERS
index 039b16895..062a59e6e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5,7 +5,6 @@ specific changes:
ARC:
Alexey Brodkin <Alexey.Brodkin@synopsys.com>
-Vineet Gupta <Vineet.Gupta1@synopsys.com>
CSKY:
Guo Ren <ren_guo@c-sky.com>
diff --git a/Makefile.in b/Makefile.in
index 16ee9ee00..60ee79529 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -256,7 +256,7 @@ HEADERS_RM- := \
ifeq ($(UCLIBC_STRICT_HEADERS),y)
HEADERS_RM- += sgtty.h
endif
-HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h
+HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h sys/auxv.h
HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h
HEADERS_RM-$(UCLIBC_HAS_ARGP) += argp.h
HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h
diff --git a/Makerules b/Makerules
index fd40e6c7b..fe8a7916e 100644
--- a/Makerules
+++ b/Makerules
@@ -22,6 +22,9 @@ ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
libs: $(lib-gdb-y)
endif
libs: $(lib-a-y)
+ifeq ($(HAVE_LDSO),y)
+$(lib-a-y): | $(ldso)
+endif
endif
objs: all_objs
$(lib-so-y) $(lib-a-y): | $(top_builddir)lib
@@ -331,7 +334,7 @@ define link.so
-Wl,-soname=$(notdir $@).$(2) \
$(CFLAG_-nostdlib) $(CFLAG_-nostartfiles) \
-o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
- -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \
+ -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive -shared \
$(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
$(Q)$(LN) -sf $(1) $@.$(2)
$(Q)$(LN) -sf $(1) $@
@@ -405,8 +408,13 @@ else
CRTS=$(top_builddir)lib/$(CRT).o
endif
+ifeq ($(STATIC_PIE),y)
+CRTS+=$(top_builddir)lib/r$(CRT).o
+endif
+
ASFLAGS-$(CRT).o := -DL_$(CRT)
ASFLAGS-S$(CRT).o := $(PIEFLAG) -DL_S$(CRT)
+ASFLAGS-r$(CRT).o := $(PIEFLAG) -DL_r$(CRT)
$(CRTS): $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(CRT).S
$(compile.S)
$(Q)$(STRIPTOOL) -x -R .note -R .comment $@
diff --git a/Rules.mak b/Rules.mak
index 948369c0e..f2e5791e3 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -1,7 +1,7 @@
# Rules.mak for uClibc-ng
#
# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
-# Copyright (C) 2015-2018 Waldemar Brodkorb <wbx@uclibc-ng.org>
+# Copyright (C) 2015-2024 Waldemar Brodkorb <wbx@uclibc-ng.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
@@ -128,7 +128,7 @@ export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR
# Now config hard core
MAJOR_VERSION := 1
MINOR_VERSION := 0
-SUBLEVEL := 36
+SUBLEVEL := 47
EXTRAVERSION :=
VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
ABI_VERSION := $(MAJOR_VERSION)
@@ -142,17 +142,8 @@ export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION ABI_VERSION LC_ALL
LIBC := libc
SHARED_LIBNAME := $(LIBC).so.$(ABI_VERSION)
-UCLIBC_LDSO_NAME := ld-uClibc
-ARCH_NATIVE_BIT := 32
-ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 powerpc64 s390x sparc64 x86_64 kvx ),)
-UCLIBC_LDSO_NAME := ld64-uClibc
-ARCH_NATIVE_BIT := 64
-else
-ifeq ($(CONFIG_MIPS_N64_ABI),y)
-UCLIBC_LDSO_NAME := ld64-uClibc
-ARCH_NATIVE_BIT := 64
-endif
-endif
+UCLIBC_LDSO_NAME := $(call qstrip,$(TARGET_LDSO_NAME))
+ARCH_NATIVE_BIT := $(call qstrip,$(TARGET_ARCH_BITS))
UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION)
NONSHARED_LIBNAME := uclibc_nonshared.a
@@ -176,6 +167,8 @@ endif
ifneq ($(HAVE_SHARED),y)
libc :=
+endif
+ifneq ($(HAVE_LDSO),y)
interp :=
ldso :=
endif
@@ -305,6 +298,7 @@ ifneq ($(TARGET_ARCH),c6x)
ifneq ($(TARGET_ARCH),h8300)
ifneq ($(TARGET_ARCH),arc)
ifneq ($(TARGET_ARCH),aarch64)
+ifneq ($(TARGET_ARCH),riscv32)
CPU_CFLAGS-y += -msoft-float
endif
endif
@@ -316,6 +310,7 @@ endif
endif
endif
endif
+endif
ifeq ($(TARGET_ARCH),aarch64)
CPU_CFLAGS-y += -ftls-model=initial-exec
@@ -466,7 +461,8 @@ ifeq ($(TARGET_ARCH),csky)
endif
ifeq ($(TARGET_ARCH),kvx)
- CPU_CFLAGS-$(CONFIG_KVX) += -march=kvx
+ CPU_CFLAGS-y += -march=$(call qstrip,$(TARGET_MARCH))
+ CPU_LDFLAGS-y += -march=$(call qstrip,$(TARGET_MARCH))
endif
ifeq ($(TARGET_ARCH),m68k)
@@ -483,9 +479,10 @@ ifeq ($(TARGET_ARCH),powerpc)
PICFLAG:=-fpic
PIEFLAG_NAME:=-fpie
PPC_HAS_REL16:=$(shell printf "\t.text\n\taddis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha\n" | $(CC) -c -x assembler -o /dev/null - 2> /dev/null && echo -n y || echo -n n)
+ PPC_HAS_SECUREPLT:=$(shell $(CC) --verbose 2>&1 | grep -- --enable-secureplt > /dev/null && echo -n y || echo -n n)
+ CPU_CFLAGS-$(PPC_HAS_SECUREPLT) += -DPPC_HAS_SECUREPLT
CPU_CFLAGS-$(PPC_HAS_REL16)+= -DHAVE_ASM_PPC_REL16
CPU_CFLAGS-$(CONFIG_E500) += "-D__NO_MATH_INLINES"
-
endif
ifeq ($(TARGET_ARCH),bfin)
@@ -673,6 +670,10 @@ ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
CFLAGS += -D__USE_STDIO_FUTEXES__
endif
+ifeq ($(UCLIBC_USE_TIME64),y)
+CFLAGS += -D__UCLIBC_HAVE_STATX__
+endif
+
ifeq ($(UCLIBC_HAS_THREADS),y)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
PTNAME := nptl
diff --git a/docs/porting.txt b/docs/porting.txt
index 380645801..31c188ae1 100644
--- a/docs/porting.txt
+++ b/docs/porting.txt
@@ -12,6 +12,8 @@ you are hacking on.
the shared library loader work requires you first have basic architecture
support working. Thus you should add ARCH_HAS_NO_SHARED and
ARCH_HAS_NO_LDSO to Config.ARCH's TARGET_ARCH
+- When static pie support is added this TARGET_arch can be appended to the
+ list in extra/Configs/Config.in
====================
=== libc sysdeps ===
@@ -56,6 +58,15 @@ you are hacking on.
usually these are written in assembler, but you may be able to cheat and
write them in C ... see other ports for more information
+- Once static and pie executables are stable, static-pie support can be
+ added by modifying crt1.S to calculate the address that the kernel loaded
+ the main elf. Once the elf load address is found, call reloc_static_pie to
+ perform all the dynamic relocations normally handled by ldso. This new
+ code should be placed at the begining of _start and surrounded by defines
+ so that it is only compiled into rcrt1.o and not the static or shared
+ versions. This is usually done by using the special L_rcrt1 preprocessor
+ define. i386 and x86_64 have good reference implementations.
+
====================
=== ldso sysdeps ===
====================
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 7dca9e305..2d1692ba5 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -39,6 +39,7 @@ choice
default TARGET_or1k if DESIRED_TARGET_ARCH = "or1k"
default TARGET_powerpc if DESIRED_TARGET_ARCH = "powerpc"
default TARGET_riscv64 if DESIRED_TARGET_ARCH = "riscv64"
+ default TARGET_riscv32 if DESIRED_TARGET_ARCH = "riscv32"
default TARGET_sh if DESIRED_TARGET_ARCH = "sh"
default TARGET_sparc if DESIRED_TARGET_ARCH = "sparc"
default TARGET_sparc64 if DESIRED_TARGET_ARCH = "sparc64"
@@ -125,6 +126,9 @@ config TARGET_powerpc
config TARGET_riscv64
bool "riscv64"
+config TARGET_riscv32
+ bool "riscv32"
+
config TARGET_sh
bool "superh"
@@ -145,6 +149,27 @@ config TARGET_xtensa
endchoice
+config TARGET_LDSO_NAME
+ string
+ default "ld64-uClibc" if TARGET_ia64
+ default "ld64-uClibc" if TARGET_powerpc64
+ default "ld64-uClibc" if TARGET_sparc64
+ default "ld64-uClibc" if TARGET_x86_64
+ default "ld64-uClibc" if TARGET_kvx
+ default "ld64-uClibc" if CONFIG_MIPS_N64_ABI
+ default "ld-uClibc"
+
+config TARGET_ARCH_BITS
+ int
+ default 64 if TARGET_aarch64
+ default 64 if TARGET_ia64
+ default 64 if TARGET_powerpc64
+ default 64 if TARGET_riscv64
+ default 64 if TARGET_sparc64
+ default 64 if TARGET_x86_64
+ default 64 if TARGET_kvx
+ default 64 if CONFIG_MIPS_N64_ABI
+ default 32
menu "Target Architecture Features and Options"
@@ -240,6 +265,10 @@ if TARGET_riscv64
source "extra/Configs/Config.riscv64"
endif
+if TARGET_riscv32
+source "extra/Configs/Config.riscv32"
+endif
+
if TARGET_sh
source "extra/Configs/Config.sh"
endif
@@ -301,6 +330,14 @@ config DOPIC
If you wish to build all of uClibc as PIC objects, then answer Y here.
If you are unsure, then you should answer N.
+config STATIC_PIE
+ bool "Add support for Static Position Independent Executables (PIE)"
+ default n
+ depends on DOPIC && !UCLIBC_FORMAT_FDPIC_ELF && \
+ (TARGET_aarch64 || TARGET_arm || TARGET_i386 || \
+ TARGET_m68k || TARGET_mips || TARGET_powerpc || \
+ TARGET_riscv64 || TARGET_x86_64 || TARGET_xtensa)
+
config ARCH_HAS_NO_SHARED
bool
@@ -311,9 +348,13 @@ config ARCH_HAS_NO_LDSO
config ARCH_HAS_UCONTEXT
bool
+config HAVE_LDSO
+ bool
+
config HAVE_SHARED
bool "Enable shared libraries"
depends on !ARCH_HAS_NO_SHARED
+ select HAVE_LDSO
default y
help
If you wish to build uClibc with support for shared libraries then
@@ -420,6 +461,22 @@ config LDSO_PRELINK_SUPPORT
time. It also is able to load and handle prelinked libraries and
binaries at runtime.
+config ARCH_VDSO_SUPPORT
+ bool
+
+config VDSO_SUPPORT
+ bool "Dynamic linker vDSO support"
+ depends on ARCH_VDSO_SUPPORT
+ help
+ Enable this option to support vDSO loading
+
+ vDSO provides access to some kernel function without a systemcall
+ if provided by the kernel
+
+ most archs support gettimeofday() and clock_gettime()
+
+ vDSO loading can be disabled via VDSO_DISABLE environment variable
+
config UCLIBC_STATIC_LDCONFIG
bool "Link ldconfig statically"
depends on HAVE_SHARED
@@ -488,7 +545,7 @@ config LDSO_LD_LIBRARY_PATH
config UCLIBC_CTOR_DTOR
bool
- default y if !TARGET_riscv64
+ default y
help
If you wish to build uClibc with support for global constructor
(ctor) and global destructor (dtor) support, then answer Y here.
@@ -505,7 +562,7 @@ config UCLIBC_CTOR_DTOR
config LDSO_GNU_HASH_SUPPORT
bool "Enable GNU hash style support"
- depends on HAVE_SHARED
+ depends on HAVE_SHARED && !TARGET_mips
help
Newest binutils support a new hash style named GNU-hash. The dynamic
linker will use the new GNU-hash section (.gnu.hash) for symbol lookup
@@ -537,7 +594,7 @@ config UCLIBC_HAS_LINUXTHREADS
# linuxthreads need nanosleep()
select UCLIBC_HAS_REALTIME
depends on !TARGET_aarch64 && \
- !TARGET_riscv64 && \
+ !TARGET_riscv32 && \
!TARGET_metag
help
If you want to compile uClibc with Linuxthreads support, then answer Y.
@@ -592,6 +649,15 @@ config PTHREADS_DEBUG_SUPPORT
If you are doing development and want to debug applications using
uClibc's pthread library, answer Y. Otherwise, answer N.
+config PTHREADS_STACK_DEFAULT_SIZE
+ int "Default thread stack size"
+ default 4194304 if TARGET_alpha # 4 MiB
+ default 4194304 if TARGET_powerpc # 4 MiB
+ default 2097152 # 2 MiB
+ help
+ Set the default thread stack size. This option is useful on MMU-less
+ systems where the stack size is fixed and the default stack size may
+ be excessively large and waste memory.
config UCLIBC_HAS_SYSLOG
bool "Syslog support"
@@ -958,6 +1024,26 @@ config UCLIBC_FALLBACK_TO_ETC_LOCALTIME
Most people will answer Y.
+config UCLIBC_USE_TIME64
+ bool "Use *time64 syscalls instead of 32bit ones (if possible)"
+ depends on TARGET_arc || \
+ TARGET_arm || \
+ TARGET_i386 || \
+ TARGET_m68k || \
+ TARGET_microblaze || \
+ (TARGET_mips && !CONFIG_MIPS_N64_ABI) || \
+ TARGET_or1k || \
+ TARGET_powerpc || \
+ TARGET_riscv32 || \
+ TARGET_sparc || \
+ TARGET_sh || \
+ TARGET_xtensa
+ # TODO: add support for other architectures
+ default n
+
+ help
+ Replace 32bit syscalls to their 64/time64 analog if possible.
+
endmenu
menu "Advanced Library Settings"
@@ -1344,6 +1430,57 @@ config UCLIBC_HAS_RESOLVER_SUPPORT
ns_name_pack, ns_name_compress, ns_name_skip, dn_skipname,
ns_get16, ns_get32, ns_put16, ns_put32
+choice
+ prompt "DNS Query ID generation"
+ default UCLIBC_DNSRAND_MODE_PRNGPLUS
+ help
+ Control how successive dns query ids' are generated during
+ dns lookup.
+
+config UCLIBC_DNSRAND_MODE_URANDOM
+ bool "urandom"
+ help
+ "urandom" uses /dev/urandom available under many unix flavours
+ to generate dns query id. This can generate good random ids,
+ by dipping into the entropy pool maintained by the system.
+ However this is relatively slow compared to the other options,
+ as it may involve cryptographic operations internally and
+ kernel-userspace handshake.
+
+config UCLIBC_DNSRAND_MODE_CLOCK
+ bool "clock"
+ depends on UCLIBC_HAS_REALTIME
+ help
+ "clock" uses CLOCK_REALTIME of the system to generate plausibly
+ random dns query id. Systems require to have clock source with
+ nanosec granularity mapped to this clock id for this to generate
+ plausibly random values. However has processor and io performances
+ improve in future, its effectiveness can get impacted.
+
+config UCLIBC_DNSRAND_MODE_PRNGPLUS
+ bool "prngplus"
+ help
+ "prngplus" uses random prng available within uclibc, to indirectly
+ generate the dns query id. This tries to provide a good balance
+ between speed and randomness to an extent. It periodically reseeds
+ the prng using random value generated from either the urandom or
+ else the clock, if either of them is available. Additionally applies
+ transform (one way, if possible) on internal generated random values.
+ These make it difficult to infer internal state of prng from unbroken
+ sequences of exposed random values.
+ This is the default.
+
+config UCLIBC_DNSRAND_MODE_SIMPLECOUNTER
+ bool "simplecounter"
+ help
+ "simplecounter" uses a simple counter to generate dns query id.
+ This is a very simple logic and can be subjected to dns poison
+ attack relatively easily.
+ It is recommended to avoid this option.
+
+endchoice
+
+
endif
@@ -2234,6 +2371,7 @@ config SUPPORT_LD_DEBUG
nofixups never fixes up jump relocations
bindings displays the resolve processing (function calls);
detail shows the relocation patch
+ vdso display vdso symbol table processing
all Enable everything!
The additional environment variable:
diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch
index 91b639493..4bcf3ff3f 100644
--- a/extra/Configs/Config.in.arch
+++ b/extra/Configs/Config.in.arch
@@ -10,6 +10,14 @@
if !ARCH_USE_MMU
choice
prompt "Target File Format"
+config UCLIBC_FORMAT_ELF
+ bool "ELF (using ELF_FDPIC loader)"
+ depends on !ARCH_USE_MMU && (TARGET_arm || TARGET_m68k || \
+ TARGET_riscv64)
+ select DOPIC
+ select STATIC_PIE
+ select ARCH_HAS_NO_SHARED
+ select HAVE_LDSO
config UCLIBC_FORMAT_FDPIC_ELF
bool "FDPIC ELF"
depends on !ARCH_USE_MMU && (TARGET_bfin || TARGET_frv || TARGET_arm)
diff --git a/extra/Configs/Config.kvx b/extra/Configs/Config.kvx
index 398ffceaa..04df53c38 100644
--- a/extra/Configs/Config.kvx
+++ b/extra/Configs/Config.kvx
@@ -7,6 +7,24 @@ config TARGET_ARCH
string
default "kvx"
+choice
+ prompt "Target architecture variant"
+ help
+ Select CPU variant to use
+
+config CONFIG_KVX_COOLIDGE_V1
+ bool "Coolidge V1"
+
+config CONFIG_KVX_COOLIDGE_V2
+ bool "Coolidge V2"
+
+endchoice
+
+config TARGET_MARCH
+ string
+ default "kv3-1" if CONFIG_KVX_COOLIDGE_V1
+ default "kv3-2" if CONFIG_KVX_COOLIDGE_V2
+
config FORCE_OPTIONS_FOR_ARCH
bool
default y
diff --git a/extra/Configs/Config.mips b/extra/Configs/Config.mips
index 8137d8be4..14b784fcc 100644
--- a/extra/Configs/Config.mips
+++ b/extra/Configs/Config.mips
@@ -13,6 +13,7 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_ANY_ENDIAN
select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS
+ select ARCH_VDSO_SUPPORT
choice
prompt "Target ABI"
diff --git a/extra/Configs/Config.nds32 b/extra/Configs/Config.nds32
index 2ed6a32b7..8bac9e679 100644
--- a/extra/Configs/Config.nds32
+++ b/extra/Configs/Config.nds32
@@ -11,7 +11,6 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_ANY_ENDIAN
- select ARCH_HAS_DEPRECATED_SYSCALLS
select ARCH_HAS_MMU
select ARCH_HAS_UCONTEXT
diff --git a/extra/Configs/Config.riscv32 b/extra/Configs/Config.riscv32
new file mode 100644
index 000000000..304d30f70
--- /dev/null
+++ b/extra/Configs/Config.riscv32
@@ -0,0 +1,14 @@
+#
+# For a description of the syntax of this configuration file,
+# see extra/config/Kconfig-language.txt
+#
+
+config TARGET_ARCH
+ string
+ default "riscv32"
+
+config FORCE_OPTIONS_FOR_ARCH
+ bool
+ default y
+ select ARCH_LITTLE_ENDIAN
+ select ARCH_HAS_MMU
diff --git a/extra/Configs/Config.x86_64 b/extra/Configs/Config.x86_64
index 317a5007f..73c0e13a5 100644..100755
--- a/extra/Configs/Config.x86_64
+++ b/extra/Configs/Config.x86_64
@@ -14,3 +14,4 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_HAS_MMU
select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS
+ select ARCH_VDSO_SUPPORT
diff --git a/extra/Configs/Config.xtensa b/extra/Configs/Config.xtensa
index 3ee8817ba..7316c542d 100644
--- a/extra/Configs/Config.xtensa
+++ b/extra/Configs/Config.xtensa
@@ -10,5 +10,6 @@ config TARGET_ARCH
config FORCE_OPTIONS_FOR_ARCH
bool
default y
- select ARCH_HAS_DEPRECATED_SYSCALLS
select ARCH_ANY_ENDIAN
+ select ARCH_HAS_DEPRECATED_SYSCALLS
+ select ARCH_HAS_UCONTEXT
diff --git a/extra/locale/gen_wc8bit.c b/extra/locale/gen_wc8bit.c
index 8031df1cf..110541ad5 100644
--- a/extra/locale/gen_wc8bit.c
+++ b/extra/locale/gen_wc8bit.c
@@ -121,7 +121,8 @@ int main(int argc, char **argv)
}
locale_failure:
- printf("could not find a UTF8 locale ... please enable en_US.UTF-8\n");
+ fprintf(stderr,
+ "could not find a UTF8 locale ... please enable en_US.UTF-8\n");
return EXIT_FAILURE;
locale_success:
pclose(fp);
diff --git a/extra/locale/programs/locale.c b/extra/locale/programs/locale.c
index 5d16d1276..4157c4a8e 100644
--- a/extra/locale/programs/locale.c
+++ b/extra/locale/programs/locale.c
@@ -231,7 +231,7 @@ static void find_locale_string(locale_entry * loc_rec, char *loc)
*loc = '\0';
} else {
dotcs = (uint16_t) loc_rec->dot_cs;
- cs = (uint16_t) loc_rec->cs;;
+ cs = (uint16_t) loc_rec->cs;
loc = strncpy(loc, GET_LOCALE_NAME(idx), 5);
if (loc[2] == '_') {
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index 17c68f595..315305b1c 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -283,6 +283,7 @@ typedef enum __ns_type {
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
+ ns_t_tkey = 249, /* Transaction key */
ns_t_tsig = 250, /* Transaction signature. */
ns_t_ixfr = 251, /* Incremental zone transfer. */
ns_t_axfr = 252, /* Transfer zone of authority. */
diff --git a/include/assert.h b/include/assert.h
index ee8e85fa2..fd71e833b 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -76,3 +76,8 @@ __END_DECLS
# endif
#endif /* NDEBUG. */
+
+#if defined __USE_ISOC11 && !defined __cplusplus
+# undef static_assert
+# define static_assert _Static_assert
+#endif
diff --git a/include/elf.h b/include/elf.h
index 7d66d70a4..c2efa9978 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -60,6 +60,9 @@ typedef uint16_t Elf64_Section;
typedef Elf32_Half Elf32_Versym;
typedef Elf64_Half Elf64_Versym;
+/* Type for relative relocations in DT_RELR format */
+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
/* The ELF file header. This appears at the start of every ELF file. */
@@ -270,9 +273,10 @@ typedef struct
#define EM_METAG 174 /* Imagination Technologies Meta */
#define EM_AARCH64 183 /* ARM AARCH64 */
#define EM_MICROBLAZE 189 /* Xilinx Microblaze */
-#define EM_ARCV2 195 /* ARCv2 Cores */
+#define EM_ARCV2 195 /* Synopsys ARCv2 Cores */
#define EM_RISCV 243 /* RISC-V */
#define EM_CSKY 252 /* C-SKY Cores */
+#define EM_ARCV3_32 255 /* Synopsys ARCv3 32-bit Cores */
#define EM_KVX 256 /* Kalray VLIW core of the MPPA processor family */
/* NEXT FREE NUMBER: Increment this after adding your official arch number */
@@ -817,7 +821,10 @@ typedef struct
#define DT_ENCODING 32 /* Start of encoded range */
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
-#define DT_NUM 34 /* Number used */
+#define DT_RELRSZ 35 /* Size in bytes, of DT_RELR table */
+#define DT_RELR 36 /* Address of Relr relocs */
+#define DT_RELRENT 37 /* Size in bytes of one DT_RELR entry */
+#define DT_NUM 38 /* Number used */
#define DT_LOOS 0x6000000d /* Start of OS-specific */
#define DT_HIOS 0x6ffff000 /* End of OS-specific */
#define DT_LOPROC 0x70000000 /* Start of processor-specific */
diff --git a/include/fcntl.h b/include/fcntl.h
index 35797c689..ce15ceaf6 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -104,8 +104,9 @@ libc_hidden_proto(fcntl64)
#endif
/* Open FILE and return a new file descriptor for it, or -1 on error.
- OFLAG determines the type of access used. If O_CREAT is on OFLAG,
- the third argument is taken as a `mode_t', the mode of the created file.
+ OFLAG determines the type of access used. If O_CREAT or O_TMPFILE
+ is on OFLAG, the third argument is taken as a `mode_t', the mode of
+ the created file.
This function is a cancellation point and therefore not marked with
__THROW. */
@@ -295,6 +296,26 @@ int name_to_handle_at(int dirfd, const char *pathname,
int open_by_handle_at(int mount_fd, struct file_handle *handle, int flags);
#endif
+#ifdef __USE_GNU
+# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
+# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
+/* Owner types. */
+enum __pid_type
+ {
+ F_OWNER_TID = 0, /* Kernel thread. */
+ F_OWNER_PID, /* Process. */
+ F_OWNER_PGRP, /* Process group. */
+ F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
+ };
+
+/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
+struct f_owner_ex
+ {
+ enum __pid_type type; /* Owner type of ID. */
+ __pid_t pid; /* ID of owner. */
+ };
+#endif
+
__END_DECLS
#endif /* fcntl.h */
diff --git a/include/features.h b/include/features.h
index d6e45c2ff..11b34205f 100644
--- a/include/features.h
+++ b/include/features.h
@@ -40,7 +40,8 @@
_SVID_SOURCE ISO C, POSIX, and SVID things.
_ATFILE_SOURCE Additional *at interfaces.
_GNU_SOURCE All of the above, plus GNU extensions.
- _DEFAULT_SOURCE Equivalent to defining _BSD_SOURCE and _SVID_SOURCE.
+ _DEFAULT_SOURCE Equivalent to defining _BSD_SOURCE and _SVID_SOURCE,
+ as well as _POSIX_C_SOURCE=200809L.
_REENTRANT Select additionally reentrant object.
_THREAD_SAFE Same as _REENTRANT, often used by other systems.
_FORTIFY_SOURCE If set to numeric value > 0 additional security
@@ -142,18 +143,19 @@
/* Whether to use feature set F. */
#define __GLIBC_USE(F) __GLIBC_USE_ ## F
-/* _DEFAULT_SOURCE is equivalent to defining _BSD_SOURCE and _SVID_SOURCE
- * and vice versa. */
-#ifdef _DEFAULT_SOURCE
+/* _DEFAULT_SOURCE is equivalent to defining _BSD_SOURCE, _SVID_SOURCE
+ * and _POSIX_C_SOURCE=200809L and vice versa. */
+#if defined _DEFAULT_SOURCE || defined _BSD_SOURCE || defined _SVID_SOURCE
+# undef _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
# define _SVID_SOURCE 1
-#endif
-
-#if defined _BSD_SOURCE || defined _SVID_SOURCE
-# undef _DEFAULT_SOURCE
-# define _DEFAULT_SOURCE 1
+# if _POSIX_C_SOURCE < 200809L
+# undef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 200809L
+# endif
#endif
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
diff --git a/include/internal/time64_helpers.h b/include/internal/time64_helpers.h
new file mode 100644
index 000000000..2284aacd9
--- /dev/null
+++ b/include/internal/time64_helpers.h
@@ -0,0 +1,31 @@
+#ifndef _TIME64_HELPERS_H
+#define _TIME64_HELPERS_H
+
+#include <bits/types.h>
+#include <time.h>
+#include <stddef.h>
+
+struct __ts64_struct {
+ __S64_TYPE tv_sec;
+ __S64_TYPE tv_nsec;
+};
+
+#define TO_TS64_P(__ts) (((struct timespec *)(__ts)) ? \
+ (&(struct __ts64_struct) {.tv_sec = ((struct timespec *)(__ts))->tv_sec, \
+ .tv_nsec = ((struct timespec *)(__ts))->tv_nsec}) : NULL)
+
+struct __its64_struct {
+ __S64_TYPE interval_tv_sec;
+ __S64_TYPE interval_tv_nsec;
+ __S64_TYPE value_tv_sec;
+ __S64_TYPE value_tv_nsec;
+};
+
+#define TO_ITS64_P(__its) (((struct itimerspec *)(__its)) ? \
+ (&(struct __its64_struct) {.interval_tv_sec = ((struct itimerspec *)(__its))->it_interval.tv_sec, \
+ .interval_tv_nsec = ((struct itimerspec *)(__its))->it_interval.tv_nsec, \
+ .value_tv_sec = ((struct itimerspec *)(__its))->it_value.tv_sec, \
+ .value_tv_nsec = ((struct itimerspec *)(__its))->it_value.tv_nsec}) : NULL)
+
+
+#endif /* _TIME64_HELPERS_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4dc05c76e..2254375ad 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -156,6 +156,11 @@
# define ASM_LINE_SEP ;
#endif
+#ifndef __attribute_copy__
+/* Provide an empty definition when cdefs.h is not included. */
+# define __attribute_copy__(arg)
+#endif
+
#ifndef __ASSEMBLER__
/* GCC understands weak symbols and aliases; use its interface where
possible, instead of embedded assembly language. */
@@ -163,13 +168,13 @@
/* Define ALIASNAME as a strong alias for NAME. */
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
# define _strong_alias(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+ extern __typeof (name) aliasname __attribute__ ((alias (#name))) __attribute_copy__ (name);
/* Same, but does not check for type match. Use sparingly.
Example: strong_alias(stat,stat64) may fail, this one works: */
# define strong_alias_untyped(name, aliasname) \
_strong_alias_untyped(name, aliasname)
# define _strong_alias_untyped(name, aliasname) \
- extern __typeof (aliasname) aliasname __attribute__ ((alias (#name)));
+ extern __typeof (aliasname) aliasname __attribute__ ((alias (#name))) __attribute_copy__ (name);
# ifdef HAVE_WEAK_SYMBOLS
@@ -182,7 +187,7 @@
If weak aliases are not available, this defines a strong alias. */
# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
# define _weak_alias(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
+ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) __attribute_copy__ (name);
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
# define weak_extern(symbol) _weak_extern (weak symbol)
@@ -423,7 +428,8 @@ FIXME! - ?
# define __hidden_asmname2(prefix, name) #prefix name
# define __hidden_ver1(local, internal, name) \
extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
- extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local))))
+ extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) \
+ __attribute_copy__ (name)
# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
# define hidden_data_ver(local, name) hidden_ver(local, name)
# define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
diff --git a/include/resolv.h b/include/resolv.h
index 485b8db98..2a82641a4 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -457,7 +457,7 @@ __END_DECLS
# ifndef NOT_IN_libc
# define __resp __libc_resp
# endif
-# define _res (*__resp)
+# define _res (*__res_state())
extern __thread struct __res_state *__resp attribute_tls_model_ie;
# endif
# else
diff --git a/include/setjmp.h b/include/setjmp.h
index 27cac9500..5d7df3667 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -27,21 +27,7 @@
__BEGIN_DECLS
#include <bits/setjmp.h> /* Get `__jmp_buf'. */
-#include <bits/sigset.h> /* Get `__sigset_t'. */
-
-
-/* Calling environment, plus possibly a saved signal mask. */
-struct __jmp_buf_tag
- {
- /* NOTE: The machine-dependent definitions of `__sigsetjmp'
- assume that a `jmp_buf' begins with a `__jmp_buf' and that
- `__mask_was_saved' follows it. Do not move these members
- or add others before it. */
- __jmp_buf __jmpbuf; /* Calling environment. */
- int __mask_was_saved; /* Saved the signal mask? */
- __sigset_t __saved_mask; /* Saved signal mask. */
- };
-
+#include <bits/jmp_buf_tag.h>
__BEGIN_NAMESPACE_STD
@@ -108,8 +94,10 @@ __END_DECLS
#ifdef _LIBC
extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn;
libc_hidden_proto(__longjmp)
-extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn;
-extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn;
+extern void __libc_longjmp(struct __jmp_buf_tag __env[1], int __val)
+ __THROWNL attribute_noreturn;
+extern void __libc_siglongjmp(sigjmp_buf __env, int __val)
+ __THROWNL attribute_noreturn;
extern void _longjmp_unwind(jmp_buf __env, int __val);
libc_hidden_proto(_longjmp_unwind)
extern int __sigjmp_save(sigjmp_buf __env, int __savemask) attribute_hidden;
diff --git a/include/stdlib.h b/include/stdlib.h
index 6a253cc3f..8b1375184 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -979,12 +979,14 @@ extern int getpt (void);
# endif
#endif
-#if 0 /* def __USE_BSD */
+#ifdef __USE_BSD
/* Put the 1 minute, 5 minute and 15 minute load averages into the first
NELEM elements of LOADAVG. Return the number written (never more than
three, but may be less than NELEM), or -1 if an error occurred. */
extern int getloadavg (double __loadavg[], int __nelem)
__THROW __nonnull ((1));
+
+extern void *reallocarray (void *__ptr, size_t __m, size_t __n);
#endif
#ifdef _LIBC
diff --git a/include/string.h b/include/string.h
index 8315203a4..1dc994df7 100644
--- a/include/string.h
+++ b/include/string.h
@@ -141,7 +141,8 @@ extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
libc_hidden_proto(strxfrm_l)
#endif
-#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_SVID || defined __USE_BSD || \
+ defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Duplicate S, returning an identical malloc'd string. */
extern char *strdup (const char *__s)
__THROW __attribute_malloc__ __nonnull ((1));
@@ -343,6 +344,7 @@ extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
#endif
#ifdef __USE_BSD
+extern void explicit_bzero (void *__d, size_t __n);
# ifdef __UCLIBC_SUSV3_LEGACY__
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
extern void bcopy (const void *__src, void *__dest, size_t __n)
diff --git a/include/sys/auxv.h b/include/sys/auxv.h
new file mode 100644
index 000000000..b07026457
--- /dev/null
+++ b/include/sys/auxv.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 2022 uClibc-ng
+ This file is part of the uClibc-ng Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H 1
+
+#include <features.h>
+#include <elf.h>
+#include <bits/hwcap.h>
+
+__BEGIN_DECLS
+
+/* Return the value associated with an Elf*_auxv_t type from the auxv list
+ passed to the program on startup. If TYPE was not present in the auxv
+ list, returns zero and sets errno to ENOENT. */
+extern unsigned long int getauxval (unsigned long int __type) __THROW;
+
+__END_DECLS
+
+#endif /* sys/auxv.h */
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index a4359a05c..5c4daebcd 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -330,6 +330,17 @@
# endif
#endif
+/* Undefine (also defined in libc-symbols.h). */
+#undef __attribute_copy__
+#if __GNUC_PREREQ (9, 0)
+/* Copies attributes from the declaration or type referenced by
+ the argument. */
+# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg)))
+#else
+# define __attribute_copy__(arg)
+#endif
+
+
/* GCC 4.3 and above allow passing all anonymous arguments of an
__extern_always_inline function to some other vararg function. */
#if __GNUC_PREREQ (4,3)
diff --git a/include/sys/personality.h b/include/sys/personality.h
index ee1de6403..fd77bdbd9 100644
--- a/include/sys/personality.h
+++ b/include/sys/personality.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +13,9 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
-/* Taken verbatim from Linux 2.4 (include/linux/personality.h). */
+/* Taken verbatim from Linux 2.6 (include/linux/personality.h). */
#ifndef _SYS_PERSONALITY_H
#define _SYS_PERSONALITY_H 1
@@ -26,11 +26,17 @@
These occupy the top three bytes. */
enum
{
+ UNAME26 = 0x0020000,
+ ADDR_NO_RANDOMIZE = 0x0040000,
+ FDPIC_FUNCPTRS = 0x0080000,
MMAP_PAGE_ZERO = 0x0100000,
+ ADDR_COMPAT_LAYOUT = 0x0200000,
+ READ_IMPLIES_EXEC = 0x0400000,
ADDR_LIMIT_32BIT = 0x0800000,
SHORT_INODE = 0x1000000,
WHOLE_SECONDS = 0x2000000,
STICKY_TIMEOUTS = 0x4000000,
+ ADDR_LIMIT_3GB = 0x8000000
};
/* Personality types.
@@ -41,6 +47,7 @@ enum
{
PER_LINUX = 0x0000,
PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
+ PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS,
PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE,
@@ -51,14 +58,15 @@ enum
PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
PER_LINUX32 = 0x0008,
+ PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, /* IRIX5 32-bit */
PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, /* IRIX6 new 32-bit */
PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, /* IRIX6 64-bit */
PER_RISCOS = 0x000c,
PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
- PER_HPUX = 0x000f,
- PER_OSF4 = 0x0010,
+ PER_OSF4 = 0x000f,
+ PER_HPUX = 0x0010,
PER_MASK = 0x00ff,
};
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 17167ed99..a5c69d84e 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -101,6 +101,29 @@ extern int setpriority (__priority_which_t __which, id_t __who, int __prio)
__THROW;
libc_hidden_proto(setpriority)
+#ifdef __USE_GNU
+/* Modify and return resource limits of a process atomically. */
+# ifndef __USE_FILE_OFFSET64
+extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
+ const struct rlimit *__new_limit,
+ struct rlimit *__old_limit) __THROW;
+# else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
+ enum __rlimit_resource __resource,
+ const struct rlimit *__new_limit,
+ struct rlimit *__old_limit), prlimit64);
+# else
+# define prlimit prlimit64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
+ const struct rlimit64 *__new_limit,
+ struct rlimit64 *__old_limit) __THROW;
+# endif
+#endif
+
__END_DECLS
#endif /* sys/resource.h */
diff --git a/include/sys/stat.h b/include/sys/stat.h
index b6480bf97..99a6382a0 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -117,7 +117,8 @@ __BEGIN_DECLS
# ifdef __S_IFLNK
# define S_IFLNK __S_IFLNK
# endif
-# if (defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98) \
+# if (defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98 \
+ || defined __USE_XOPEN2K) \
&& defined __S_IFSOCK
# define S_IFSOCK __S_IFSOCK
# endif
@@ -142,7 +143,7 @@ __BEGIN_DECLS
# define S_ISLNK(mode) 0
#endif
-#if (defined __USE_BSD || defined __USE_UNIX98) \
+#if (defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K) \
&& defined __S_IFSOCK
# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
#endif
@@ -301,7 +302,7 @@ extern int lchmod (const char *__file, __mode_t __mode)
#endif
/* Set file access permissions of the file FD is open on to MODE. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
extern int fchmod (int __fd, __mode_t __mode) __THROW;
#endif
diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h
index f27112a11..e900640bb 100644
--- a/ldso/include/dl-defs.h
+++ b/ldso/include/dl-defs.h
@@ -72,7 +72,7 @@ typedef struct {
#endif
#ifdef _LIBC
-#ifndef __ARCH_HAS_NO_SHARED__
+#ifndef __ARCH_HAS_NO_LDSO__
/* arch specific defines */
#include <dl-sysdep.h>
#endif
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h
index 2b99958d9..832f6b1dd 100644
--- a/ldso/include/dl-elf.h
+++ b/ldso/include/dl-elf.h
@@ -250,5 +250,46 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info
(((X) & PF_W) ? PROT_WRITE : 0) | \
(((X) & PF_X) ? PROT_EXEC : 0))
+/* FDPIC ABI don't use relative relocations */
+#if !defined(__FDPIC__)
+/* Apply relocations in DT_RELR format */
+#define DL_DO_RELOCATE_RELR(load_addr, relr_start, relr_end) \
+ do { \
+ const ElfW(Relr) *relr = 0; \
+ ElfW(Addr) *relr_reloc_addr = 0; \
+ for (relr = relr_start; relr < relr_end; relr++) { \
+ ElfW(Relr) relr_entry = *relr; \
+ if (!(relr_entry & 1)) \
+ { \
+ relr_reloc_addr = (ElfW(Addr) *)DL_RELOC_ADDR(load_addr, relr_entry); \
+ *relr_reloc_addr = (ElfW(Addr))DL_RELOC_ADDR(load_addr, relr_reloc_addr); \
+ relr_reloc_addr++; \
+ } \
+ else \
+ { \
+ for (long int i = 0; (relr_entry >>= 1) != 0; ++i) { \
+ if ((relr_entry & 1) != 0) \
+ relr_reloc_addr[i] = (ElfW(Addr))DL_RELOC_ADDR(load_addr, relr_reloc_addr[i]); \
+ } \
+ relr_reloc_addr += CHAR_BIT * sizeof(ElfW(Relr)) - 1; \
+ } \
+ } \
+ } while (0)
+
+/* The macro to prepare data for the above DL_DO_RELOCATE_RELR */
+#define DL_RELOCATE_RELR(dyn) \
+ do { \
+ if (dyn->dynamic_info[DT_RELRENT]) \
+ _dl_assert(dyn->dynamic_info[DT_RELRENT] == sizeof(ElfW(Relr))); \
+ if (dyn->dynamic_info[DT_RELR] && \
+ dyn->dynamic_info[DT_RELRSZ]) { \
+ ElfW(Relr) *relr_start = (ElfW(Relr) *)((ElfW(Addr))dyn->loadaddr + (ElfW(Addr))dyn->dynamic_info[DT_RELR]); \
+ ElfW(Relr) *relr_end = (ElfW(Relr) *)((const char *)relr_start + dyn->dynamic_info[DT_RELRSZ]); \
+ _dl_if_debug_dprint("Relocating DT_RELR in %s: start:%p, end:%p\n", \
+ dyn->libname, (void *)relr_start, (void *)relr_end); \
+ DL_DO_RELOCATE_RELR(dyn->loadaddr, relr_start, relr_end); \
+ } \
+ } while (0)
+#endif /* __FDPIC__ */
#endif /* _DL_ELF_H */
diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
index bf6997188..4a66161e0 100644
--- a/ldso/include/dl-string.h
+++ b/ldso/include/dl-string.h
@@ -103,7 +103,7 @@ static __always_inline char * _dl_strstr(const char *s1, const char *s2)
do {
if (!*p)
- return (char *) s1;;
+ return (char *) s1;
if (*p == *s) {
++p;
++s;
@@ -257,7 +257,7 @@ static __always_inline char * _dl_simple_ltoahex(char *local, unsigned long i)
/* On some (wierd) arches, none of this stuff works at all, so
* disable the whole lot... */
/* The same applies for ARM FDPIC at least for the moment. */
-#if defined(__mips__) || (__FDPIC__)
+#if defined(__mips__) || defined(__FDPIC__)
# define SEND_STDERR(X)
# define SEND_ADDRESS_STDERR(X, add_a_newline)
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index 2e8bb3630..b40f58b10 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -20,7 +20,7 @@ extern int _dl_errno;
#define _SYS_MMAN_H 1
#include <bits/mman.h>
-#ifdef __ARCH_HAS_DEPRECATED_SYSCALLS__
+#if defined(__ARCH_HAS_DEPRECATED_SYSCALLS__) && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))
/* Pull in whatever this particular arch's kernel thinks the kernel version of
* struct stat should look like. It turns out that each arch has a different
* opinion on the subject, and different kernel revs use different names... */
@@ -116,7 +116,7 @@ static __always_inline _syscall3(unsigned long, _dl_read, int, fd,
static __always_inline _syscall3(int, _dl_mprotect, const void *, addr,
unsigned long, len, int, prot)
-#if defined __NR_fstatat64 && !defined __NR_stat
+#if defined __NR_fstatat64 && !defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))
# define __NR__dl_fstatat64 __NR_fstatat64
static __always_inline _syscall4(int, _dl_fstatat64, int, fd, const char *,
fn, struct stat *, stat, int, flags)
@@ -126,7 +126,7 @@ static __always_inline int _dl_stat(const char *file_name,
{
return _dl_fstatat64(AT_FDCWD, file_name, buf, 0);
}
-#elif defined __NR_newfstatat && !defined __NR_stat
+#elif defined __NR_newfstatat && !defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))
# define __NR__dl_newfstatat __NR_newfstatat
static __always_inline _syscall4(int, _dl_newfstatat, int, fd, const char *,
fn, struct stat *, stat, int, flags)
@@ -136,7 +136,7 @@ static __always_inline int _dl_stat(const char *file_name,
{
return _dl_newfstatat(AT_FDCWD, file_name, buf, 0);
}
-#elif defined __NR_stat
+#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))
# define __NR__dl_stat __NR_stat
static __always_inline _syscall2(int, _dl_stat, const char *, file_name,
struct stat *, buf)
@@ -160,7 +160,7 @@ static __always_inline int _dl_stat(const char *file_name,
}
#endif
-#if defined __NR_fstat64 && !defined __NR_fstat
+#if defined __NR_fstat64 && !defined __NR_fstat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))
# define __NR__dl_fstat __NR_fstat64
static __always_inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf)
#elif defined __NR_fstat
@@ -168,7 +168,7 @@ static __always_inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf)
static __always_inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf)
#elif defined __NR_statx && defined __UCLIBC_HAVE_STATX__
# define __NR__dl_fstatx __NR_statx
-static __always_inline _syscall5(int, _dl_fstatx, int, fd, const char *, file_name, int, flags, unsigned int, mask, struct stat *, buf);
+static __always_inline _syscall5(int, _dl_fstatx, int, fd, const char *, file_name, int, flags, unsigned int, mask, struct statx *, buf);
static __always_inline int _dl_fstat(int fd,
struct stat *buf)
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h
index f19957d1d..80d5d5dd5 100644..100755
--- a/ldso/include/ldso.h
+++ b/ldso/include/ldso.h
@@ -48,7 +48,7 @@
/* Pull in the MIN macro */
#include <sys/param.h>
/* Pull in the ldso syscalls and string functions */
-#ifndef __ARCH_HAS_NO_SHARED__
+#if !defined(__ARCH_HAS_NO_SHARED__) || !defined(__ARCH_HAS_NO_LDSO__)
#include <dl-syscall.h>
#include <dl-string.h>
/* Now the ldso specific headers */
@@ -109,6 +109,7 @@ extern char *_dl_debug_reloc;
extern char *_dl_debug_detail;
extern char *_dl_debug_nofixups;
extern char *_dl_debug_bindings;
+extern char *_dl_debug_vdso;
extern int _dl_debug_file;
# define __dl_debug_dprint(fmt, args...) \
_dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __func__, __LINE__, ## args);
@@ -148,6 +149,7 @@ extern int _dl_debug_file;
#define NULL ((void *) 0)
#endif
+
extern void *_dl_malloc(size_t size);
extern void *_dl_calloc(size_t __nmemb, size_t __size);
extern void *_dl_realloc(void *__ptr, size_t __size);
@@ -176,7 +178,7 @@ extern void _dl_dprintf(int, const char *, ...);
#endif
extern void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
- ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
+ char **envp, char **argv
DL_GET_READY_TO_RUN_EXTRA_PARMS);
#ifdef HAVE_DL_INLINES_H
@@ -185,6 +187,17 @@ extern void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE loa
#else /* __ARCH_HAS_NO_SHARED__ */
#include <dl-defs.h>
+#include <dl-elf.h>
+
+#endif
+
+#define AUX_MAX_AT_ID 40
+extern ElfW(auxv_t) _dl_auxvt[AUX_MAX_AT_ID];
+
+void load_vdso( uint32_t sys_info_ehdr, char **envp );
+
+#ifdef __VDSO_SUPPORT__
+extern void* _dl__vdso_gettimeofday;
#endif
#endif /* _LDSO_H */
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index 4f2a18454..6e8a0c388 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -38,7 +38,8 @@ CFLAGS-ldso.c += -DLDSO_MULTILIB_DIR=\"$(MULTILIB_DIR)\"
endif
ifeq ($(TARGET_ARCH),arc)
-CFLAGS-ldso.c += -mno-long-calls
+$(eval $(call check-gcc-var,-mno-long-calls))
+CFLAGS-ldso.c += $(CFLAGS_-mno-long-calls)
endif
LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1
@@ -62,14 +63,15 @@ ldso_FULL_NAME := $(UCLIBC_LDSO_NAME)-$(VERSION).so
$(UCLIBC_LDSO_NAME)_DIR := $(top_srcdir)ldso/ldso
$(UCLIBC_LDSO_NAME)_OUT := $(top_builddir)ldso/ldso
-$(UCLIBC_LDSO_NAME)_CSRC := $($(UCLIBC_LDSO_NAME)_DIR)/ldso.c
+$(UCLIBC_LDSO_NAME)_CSRC := $($(UCLIBC_LDSO_NAME)_DIR)/ldso.c $($(UCLIBC_LDSO_NAME)_DIR)/dl-vdso.c
# prerequesites
$($(UCLIBC_LDSO_NAME)_OUT)/ldso.o $($(UCLIBC_LDSO_NAME)_OUT)/ldso.oS: \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-debug.c \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-startup.c \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-array.c \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-hash.c \
- $($(UCLIBC_LDSO_NAME)_DIR)/dl-elf.c
+ $($(UCLIBC_LDSO_NAME)_DIR)/dl-elf.c \
+ $($(UCLIBC_LDSO_NAME)_DIR)/dl-vdso.c
$(UCLIBC_LDSO_NAME)_COBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/%.c,$($(UCLIBC_LDSO_NAME)_OUT)/%.o,$($(UCLIBC_LDSO_NAME)_CSRC))
$(UCLIBC_LDSO_NAME)_SSRC := $(wildcard $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/*.S)
diff --git a/ldso/ldso/aarch64/elfinterp.c b/ldso/ldso/aarch64/elfinterp.c
index adabafaad..717a76980 100644
--- a/ldso/ldso/aarch64/elfinterp.c
+++ b/ldso/ldso/aarch64/elfinterp.c
@@ -253,6 +253,8 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
return 0;
}
+#undef __AARCH64_LAZY_RELOC_WORKS
+#ifdef __AARCH64_LAZY_RELOC_WORKS
static int
_dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
@@ -303,11 +305,17 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
return 0;
}
+#endif
void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size)
{
+#ifdef __AARCH64_LAZY_RELOC_WORKS
(void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
+#else
+ _dl_parse_relocation_information(rpnt, &_dl_loaded_modules->symbol_scope,
+ rel_addr, rel_size);
+#endif
}
int _dl_parse_relocation_information(struct dyn_elf *rpnt,
diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h
index ed8b37205..c8915511a 100644
--- a/ldso/ldso/arc/dl-sysdep.h
+++ b/ldso/ldso/arc/dl-sysdep.h
@@ -75,6 +75,9 @@ do { \
#elif defined(__HS__)
#define MAGIC1 EM_ARCV2
#define ELF_TARGET "ARCv2" /* For error messages */
+#elif defined(__ARC64_ARCH32__)
+#define MAGIC1 EM_ARCV3_32
+#define ELF_TARGET "ARCv3_32" /* For error messages */
#endif
#undef MAGIC2
diff --git a/ldso/ldso/arc/resolve.S b/ldso/ldso/arc/resolve.S
index 891f66b97..2b66c69cb 100644
--- a/ldso/ldso/arc/resolve.S
+++ b/ldso/ldso/arc/resolve.S
@@ -4,6 +4,7 @@
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
*/
+#include <asm.h>
#include <sysdep.h>
#include <sys/syscall.h>
@@ -12,30 +13,30 @@
; r10-r12 are already clobbered by PLTn, PLT0 thus neednot be saved
.macro SAVE_CALLER_SAVED
- push_s r0
- push_s r1
- push_s r2
- push_s r3
- st.a r4, [sp, -4]
- st.a r5, [sp, -4]
- st.a r6, [sp, -4]
- st.a r7, [sp, -4]
- st.a r8, [sp, -4]
- st.a r9, [sp, -4]
- push_s blink
+ PUSHR_S r0
+ PUSHR_S r1
+ PUSHR_S r2
+ PUSHR_S r3
+ PUSHR r4
+ PUSHR r5
+ PUSHR r6
+ PUSHR r7
+ PUSHR r8
+ PUSHR r9
+ PUSHR_S blink
.endm
.macro RESTORE_CALLER_SAVED_BUT_R0
- ld.ab blink,[sp, 4]
- ld.ab r9, [sp, 4]
- ld.ab r8, [sp, 4]
- ld.ab r7, [sp, 4]
- ld.ab r6, [sp, 4]
- ld.ab r5, [sp, 4]
- ld.ab r4, [sp, 4]
- pop_s r3
- pop_s r2
- pop_s r1
+ POPR blink
+ POPR r9
+ POPR r8
+ POPR r7
+ POPR r6
+ POPR r5
+ POPR r4
+ POPR_S r3
+ POPR_S r2
+ POPR_S r1
.endm
; Upon entry, PLTn, which led us here, sets up the following regs
@@ -53,5 +54,5 @@ ENTRY(_dl_linux_resolve)
RESTORE_CALLER_SAVED_BUT_R0
j_s.d [r0] ; r0 has resolved function addr
- pop_s r0 ; restore first arg to resolved call
+ POPR_S r0 ; restore first arg to resolved call
END(_dl_linux_resolve)
diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h
index cacd461e1..d00e7b053 100644
--- a/ldso/ldso/arm/dl-startup.h
+++ b/ldso/ldso/arm/dl-startup.h
@@ -301,3 +301,5 @@ int raise(int sig)
_dl_exit(1);
}
#endif /* __FDPIC__ */
+
+#define DL_UPDATE_LOADADDR_HDR(LOADADDR, ADDR, PHDR)
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 2bcfcda64..4f50d62b7 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -182,7 +182,10 @@ search_for_named_library(const char *name, unsigned int rflags, const char *path
} else {
_dl_strcpy(mylibname, ".");
}
- _dl_strcat(mylibname, "/");
+ plen = _dl_strlen(mylibname);
+ if ((plen == 0) || (mylibname[plen-1] != '/')) {
+ _dl_strcat(mylibname, "/");
+ }
_dl_strcat(mylibname, name);
#ifdef __LDSO_SAFE_RUNPATH__
if (*mylibname == '/')
@@ -897,7 +900,8 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned int rflags,
_dl_memset(*rpnt, 0, sizeof(struct dyn_elf));
}
#endif
- (*rpnt)->dyn = tpnt;
+ if (*rpnt)
+ (*rpnt)->dyn = tpnt;
tpnt->usage_count++;
if (tpnt->rtld_flags & RTLD_NODELETE)
tpnt->usage_count++;
@@ -1024,6 +1028,11 @@ int _dl_fixup(struct dyn_elf *rpnt, struct r_scope_elem *scope, int now_flag)
return goof;
}
+#if !defined(__FDPIC__) && !defined(__DSBT__)
+ /* Process DT_RELR relative relocations */
+ DL_RELOCATE_RELR(tpnt);
+#endif
+
reloc_size = tpnt->dynamic_info[DT_RELOC_TABLE_SIZE];
/* On some machines, notably SPARC & PPC, DT_REL* includes DT_JMPREL in its
range. Note that according to the ELF spec, this is completely legal! */
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 24b046c62..5b992a3a2 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -98,6 +98,9 @@
extern ElfW(Addr) _begin[] attribute_hidden;
#endif
+
+ElfW(auxv_t) _dl_auxvt[AUX_MAX_AT_ID];
+
#ifdef LDSO_NEED_DPNT
ElfW(Dyn) *_dl_saved_dpnt = 0;
#endif
@@ -127,7 +130,7 @@ DL_START(unsigned long args)
ElfW(Ehdr) *header;
struct elf_resolve tpnt_tmp;
struct elf_resolve *tpnt = &tpnt_tmp;
- ElfW(auxv_t) auxvt[AT_EGID + 1];
+ ElfW(auxv_t) _dl_auxvt_tmp[AUX_MAX_AT_ID];
ElfW(Dyn) *dpnt;
uint32_t *p32;
@@ -158,7 +161,7 @@ DL_START(unsigned long args)
/* Place -1 here as a checkpoint. We later check if it was changed
* when we read in the auxvt */
- auxvt[AT_UID].a_type = -1;
+ _dl_auxvt_tmp[AT_UID].a_type = -1;
/* The junk on the stack immediately following the environment is
* the Auxiliary Vector Table. Read out the elements of the auxvt,
@@ -166,9 +169,11 @@ DL_START(unsigned long args)
while (*aux_dat) {
ElfW(auxv_t) *auxv_entry = (ElfW(auxv_t) *) aux_dat;
- if (auxv_entry->a_type <= AT_EGID) {
- _dl_memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t)));
+ if (auxv_entry->a_type < AUX_MAX_AT_ID) {
+ _dl_memcpy(&(_dl_auxvt_tmp[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t)));
}
+
+
aux_dat += 2;
}
@@ -183,16 +188,16 @@ DL_START(unsigned long args)
* We use it if the kernel is not passing a valid address through the auxvt.
*/
- if (!auxvt[AT_BASE].a_un.a_val)
- auxvt[AT_BASE].a_un.a_val = (ElfW(Addr)) &_begin;
+ if (!_dl_auxvt_tmp[AT_BASE].a_un.a_val)
+ _dl_auxvt_tmp[AT_BASE].a_un.a_val = (ElfW(Addr)) &_begin;
/* Note: if the dynamic linker itself is prelinked, the load_addr is 0 */
DL_INIT_LOADADDR_BOOT(load_addr, elf_machine_load_address());
#else
- if (!auxvt[AT_BASE].a_un.a_val)
- auxvt[AT_BASE].a_un.a_val = elf_machine_load_address();
- DL_INIT_LOADADDR_BOOT(load_addr, auxvt[AT_BASE].a_un.a_val);
+ if (!_dl_auxvt_tmp[AT_BASE].a_un.a_val)
+ _dl_auxvt_tmp[AT_BASE].a_un.a_val = elf_machine_load_address();
+ DL_INIT_LOADADDR_BOOT(load_addr, _dl_auxvt_tmp[AT_BASE].a_un.a_val);
#endif
- header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val;
+ header = (ElfW(Ehdr) *) _dl_auxvt_tmp[AT_BASE].a_un.a_val;
/* Check the ELF header to make sure everything looks ok. */
if (!header || header->e_ident[EI_CLASS] != ELF_CLASS ||
@@ -255,12 +260,15 @@ DL_START(unsigned long args)
PERFORM_BOOTSTRAP_GOT(tpnt);
#endif
-#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__) || defined(__mips__)
-
/* OK, now do the relocations. We do not do a lazy binding here, so
that once we are done, we have considerably more flexibility. */
SEND_EARLY_STDERR_DEBUG("About to do library loader relocations\n");
+#if !defined(__FDPIC__) && !defined(__DSBT__)
+ /* Process DT_RELR relative relocations */
+ DL_RELOCATE_RELR(tpnt);
+#endif
+
{
int indx;
#if defined(ELF_MACHINE_PLTREL_OVERLAP)
@@ -337,7 +345,6 @@ DL_START(unsigned long args)
#endif
}
}
-#endif
SEND_STDERR_DEBUG("Done relocating ldso; we can now use globals and make function calls!\n");
@@ -356,10 +363,18 @@ DL_START(unsigned long args)
#endif
__rtld_stack_end = (void *)(argv - 1);
+ /*
+ * now the globals work. so copy the aux vector
+ */
+ _dl_memcpy( _dl_auxvt, _dl_auxvt_tmp, sizeof( ElfW(auxv_t) ) * AUX_MAX_AT_ID );
+
_dl_elf_main = (int (*)(int, char **, char **))
- _dl_get_ready_to_run(tpnt, load_addr, auxvt, envp, argv
+ _dl_get_ready_to_run(tpnt, load_addr, envp, argv
DL_GET_READY_TO_RUN_EXTRA_ARGS);
+
+ load_vdso(_dl_auxvt[AT_SYSINFO_EHDR].a_un.a_val, envp);
+
/* Transfer control to the application. */
SEND_STDERR_DEBUG("transfering control to application @ ");
SEND_ADDRESS_STDERR_DEBUG(_dl_elf_main, 1);
diff --git a/ldso/ldso/dl-vdso.c b/ldso/ldso/dl-vdso.c
new file mode 100755
index 000000000..c8d724cd0
--- /dev/null
+++ b/ldso/ldso/dl-vdso.c
@@ -0,0 +1,362 @@
+
+#include <elf.h>
+//#include <stdio.h>
+#include <string.h>
+
+#include "sys/auxv.h"
+//#include <linux/time.h>
+//#include <time.h>
+
+#include "ldso.h"
+#include "generated/autoconf.h"
+
+#ifndef ELF_BITS
+# if ULONG_MAX > 0xffffffffUL
+# define ELF_BITS 64
+# else
+# define ELF_BITS 32
+# endif
+#endif
+
+#define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x
+#define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x)
+#define ELF(x) ELF_BITS_XFORM(ELF_BITS, x)
+
+
+#ifndef __VDSO_SUPPORT__
+ void load_vdso( uint32_t sys_info_ehdr, char **envp ){
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2,"_dl_vdso support not enabled\n" );
+ }
+
+#endif
+ }
+#else
+
+
+
+
+
+
+//typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz);
+void* _dl__vdso_gettimeofday = 0;
+
+
+//typedef long (*clock_gettime_t)(int clk_id, struct timespec *tp);
+void* _dl__vdso_clock_gettime = 0;
+
+
+
+typedef struct{
+
+ void* base_addr;
+
+ ELF(Ehdr) *hdr;
+
+ char* section_header_strtab;
+
+ ELF(Sym) *dynsym_table;
+ uint32_t dynsym_table_num;
+
+ char* dynstr_table;
+
+ uint16_t *versym_table;
+
+ ELF(Verdef) *verdef_table;
+ uint32_t verdef_num;
+
+ ELF(Dyn) *dynamic_section;
+ uint32_t dynamic_section_num;
+
+ char* text_section;
+
+
+ char* vers_strings[10];
+
+
+}elf_infos;
+
+/*
+ * the raise() dummy function is needed because of divisons in this code
+ * but keep it hidden in this object
+ *
+ * fixes link error with gcc 12 for arm
+ */
+#pragma GCC visibility push(hidden)
+int raise(int sig){
+ sig = sig;
+ return 0;
+}
+#pragma GCC visibility pop
+
+
+static int vdso_check_elf_header( elf_infos* elf ){
+
+ if ( 0 != _dl_memcmp( ELFMAG, elf->base_addr, 4 ) ){
+ return 1;
+ }
+
+ if (elf->hdr->e_ident[EI_CLASS] != (ELF_BITS == 32 ? ELFCLASS32 : ELFCLASS64)) {
+ _dl_dprintf(2,"vdso ELF Bits check error\n");
+ return 1; /* Wrong ELF class -- check ELF_BITS */
+ }
+
+ return 0;
+}
+
+static ELF(Shdr) *vdso_get_sec_header( elf_infos* elf, int index ){
+
+ return (ELF(Shdr) *) ( elf->base_addr + elf->hdr->e_shoff + ( index * sizeof( ELF(Shdr) )) );
+
+}
+
+
+void load_vdso( uint32_t sys_info_ehdr, char **envp ){
+
+ elf_infos vdso_infos;
+
+
+
+ if ( sys_info_ehdr == 0 ){
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2,"_dl_vdso no vdso provied by kernel\n" );
+ }
+#endif
+ return;
+
+ }
+
+ char* _dl_vdso_disable = _dl_getenv("VDSO_DISABLE", envp);
+ if ( _dl_vdso_disable != 0 ){
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2,"_dl_vdso vdso support disabled\n" );
+ }
+#endif
+ return;
+ }
+
+
+ _dl_memset( &vdso_infos, 0 , sizeof( elf_infos ) );
+
+
+ vdso_infos.base_addr = (void*)sys_info_ehdr;
+ vdso_infos.hdr = (ELF(Ehdr)*)vdso_infos.base_addr;
+
+ //printf("base : %p\n",vdso_infos.base_addr);
+
+ if ( 0 != vdso_check_elf_header( &vdso_infos ) ){
+ return;
+ }
+
+
+
+ ELF(Shdr) *sec_header = vdso_get_sec_header( &vdso_infos, vdso_infos.hdr->e_shstrndx);
+ vdso_infos.section_header_strtab = ( vdso_infos.base_addr + sec_header->sh_offset );
+
+ /*
+ *
+ * load ELF section headers
+ *
+ */
+
+ for ( int i = 0 ; i < vdso_infos.hdr->e_shnum; i++ ){
+
+ sec_header = vdso_get_sec_header( &vdso_infos, i );
+
+ char* name = vdso_infos.section_header_strtab + sec_header->sh_name;
+
+ if( ( SHT_DYNSYM == sec_header->sh_type ) && ( 0 == _dl_strcmp( ".dynsym",name ) ) ){
+ vdso_infos.dynsym_table = ( vdso_infos.base_addr + sec_header->sh_offset );
+ vdso_infos.dynsym_table_num = sec_header->sh_size / sec_header->sh_entsize ;
+ continue;
+ }
+
+ if( ( SHT_STRTAB == sec_header->sh_type ) && ( 0 == _dl_strcmp( ".dynstr",name ) ) ){
+ vdso_infos.dynstr_table = ( vdso_infos.base_addr + sec_header->sh_offset );
+ continue;
+ }
+
+ if( ( SHT_GNU_versym == sec_header->sh_type ) && ( 0 == _dl_strcmp( ".gnu.version",name ) ) ){
+ vdso_infos.versym_table = ( vdso_infos.base_addr + sec_header->sh_offset );
+ continue;
+ }
+
+ if( ( SHT_GNU_verdef == sec_header->sh_type ) && ( 0 == _dl_strcmp( ".gnu.version_d",name ) ) ){
+ vdso_infos.verdef_table = ( vdso_infos.base_addr + sec_header->sh_offset );
+ continue;
+ }
+
+ if( ( SHT_DYNAMIC == sec_header->sh_type ) && ( 0 == _dl_strcmp( ".dynamic",name ) ) ){
+ vdso_infos.dynamic_section = ( vdso_infos.base_addr + sec_header->sh_offset );
+ vdso_infos.dynamic_section_num = sec_header->sh_size / sec_header->sh_entsize ;
+ continue;
+ }
+
+ if( ( SHT_PROGBITS == sec_header->sh_type ) && ( 0 == _dl_strcmp( ".text",name ) ) ){
+ vdso_infos.text_section = ( vdso_infos.base_addr + sec_header->sh_offset );
+ continue;
+ }
+
+ }
+
+
+ /*
+ *
+ * check section header -> dynamic table consistence
+ *
+ */
+
+
+ for( int i = 0 ; i < vdso_infos.dynamic_section_num ; i++ ){
+ ELF(Dyn) *dyn_sec = &vdso_infos.dynamic_section[i];
+ if ( dyn_sec->d_tag == 0 ) continue;
+
+
+ if ( dyn_sec->d_tag == DT_STRTAB ){
+ char* strtab = ( vdso_infos.base_addr + dyn_sec->d_un.d_ptr );
+ if ( strtab != (char*) vdso_infos.dynstr_table ){
+ _dl_dprintf(2,"vdso elf DT_STRTAB check error\n");
+ return;
+ }
+ continue;
+ }
+
+ if ( dyn_sec->d_tag == DT_SYMTAB ){
+ char* symtab = ( vdso_infos.base_addr + dyn_sec->d_un.d_ptr );
+ if ( symtab != (char*) vdso_infos.dynsym_table ){
+ _dl_dprintf(2,"vdso elf DT_SYMTAB check error\n");
+ return;
+ }
+ continue;
+ }
+
+ if ( dyn_sec->d_tag == DT_VERDEF ){
+ Elf32_Verdef* verdef = ( vdso_infos.base_addr + dyn_sec->d_un.d_ptr );
+ if ( verdef != (Elf32_Verdef*) vdso_infos.verdef_table ){
+ _dl_dprintf(2,"vdso elf DT_VERDEF check error\n");
+ return;
+ }
+ continue;
+ }
+
+ if ( dyn_sec->d_tag == DT_VERDEFNUM ){
+ vdso_infos.verdef_num = dyn_sec->d_un.d_val;
+ continue;
+ }
+
+ if ( dyn_sec->d_tag == DT_VERSYM ){
+ uint16_t* versym = ( vdso_infos.base_addr + dyn_sec->d_un.d_ptr );
+ if ( versym != vdso_infos.versym_table ){
+ _dl_dprintf(2,"vdso elf DT_VERSYM check error\n");
+ return;
+ }
+ continue;
+ }
+
+ }
+
+ /*
+ *
+ * load vdso version definition strings
+ *
+ */
+
+ ELF(Verdef) *vd = vdso_infos.verdef_table;
+ for( int i = 0 ; i < vdso_infos.verdef_num ; i++ ){
+
+ ELF(Verdaux) *vd_aux = (ELF(Verdaux) *)(( ( char*)vd ) + vd->vd_aux);
+
+ vdso_infos.vers_strings[ vd->vd_ndx ] = vdso_infos.dynstr_table + vd_aux->vda_name;
+
+ vd = ( ELF(Verdef) *)(( ( char*)vd ) + vd->vd_next);
+
+ }
+
+ /*
+ *
+ * load function from the vdso
+ *
+ */
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ int vdso_functions = 0;
+ for( int i = 0 ; i < vdso_infos.dynsym_table_num ; i++ ){
+ ELF(Sym)* sym = &vdso_infos.dynsym_table[i];
+
+ if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC)
+ continue;
+
+ char* name = vdso_infos.dynstr_table + sym->st_name;
+ if ( name[0] == 0 ){
+ continue;
+ }
+
+ vdso_functions++;
+ }
+ _dl_dprintf(2,"_dl_vdso_load functions found : %d\n", vdso_functions );
+ }
+
+#endif
+
+ for( int i = 0 ; i < vdso_infos.dynsym_table_num ; i++ ){
+ ELF(Sym)* sym = &vdso_infos.dynsym_table[i];
+
+ if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC)
+ continue;
+
+
+
+ char* name = vdso_infos.dynstr_table + sym->st_name;
+ char* vers = vdso_infos.vers_strings[ vdso_infos.versym_table[i] ];
+ void* func_addr = (void*)( vdso_infos.base_addr + sym->st_value );
+
+ // the function name is patched to zero if the kernel has no timer which is
+ // usable for the function
+ if ( name[0] == 0 ){
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2," function at address %p disabled by the kernel\n", sym->st_value );
+ }
+#endif
+ continue;
+ }
+
+ //printf(" %s@@%s\n", name , vers );
+
+ //print_sym( sym );
+ if ( 0 == _dl_strcmp( name, "__vdso_gettimeofday" ) ){
+ _dl__vdso_gettimeofday = func_addr;
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2," %s at address %p\n", name, func_addr );
+ }
+#endif
+ continue;
+ }
+
+ if ( 0 == _dl_strcmp( name, "__vdso_clock_gettime" ) ){
+ _dl__vdso_clock_gettime = func_addr;
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2," %s at address %p\n", name, func_addr );
+ }
+#endif
+ continue;
+ }
+
+#ifdef __SUPPORT_LD_DEBUG__
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2," <%s> not handled\n", name );
+ }
+#endif
+
+
+ }
+
+
+}
+
+#endif // __VDSO_SUPPORT__
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index b33547670..435bd43bc 100644..100755
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -73,6 +73,7 @@ char *_dl_debug_reloc = NULL;
char *_dl_debug_detail = NULL;
char *_dl_debug_nofixups = NULL;
char *_dl_debug_bindings = NULL;
+char *_dl_debug_vdso = NULL;
int _dl_debug_file = 2;
#endif
@@ -350,10 +351,9 @@ static void trace_objects(struct elf_resolve *tpnt, char *str_name)
static struct elf_resolve * add_ldso(struct elf_resolve *tpnt,
DL_LOADADDR_TYPE load_addr,
ElfW(Addr) ldso_mapaddr,
- ElfW(auxv_t) auxvt[AT_EGID + 1],
struct dyn_elf *rpnt)
{
- ElfW(Ehdr) *epnt = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val;
+ ElfW(Ehdr) *epnt = (ElfW(Ehdr) *) _dl_auxvt[AT_BASE].a_un.a_val;
ElfW(Phdr) *myppnt = (ElfW(Phdr) *)
DL_RELOC_ADDR(DL_GET_RUN_ADDR(load_addr, ldso_mapaddr),
epnt->e_phoff);
@@ -422,7 +422,7 @@ static void _dl_setup_progname(const char *argv0)
}
void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
- ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
+ char **envp, char **argv
DL_GET_READY_TO_RUN_EXTRA_PARMS)
{
ElfW(Addr) app_mapaddr = 0, ldso_mapaddr = 0;
@@ -461,7 +461,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
_dl_memset(app_tpnt, 0, sizeof(*app_tpnt));
/* Store the page size for later use */
- _dl_pagesize = (auxvt[AT_PAGESZ].a_un.a_val) ? (size_t) auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
+ _dl_pagesize = (_dl_auxvt[AT_PAGESZ].a_un.a_val) ? (size_t) _dl_auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
/* Make it so _dl_malloc can use the page of memory we have already
* allocated. We shouldn't need to grab any more memory. This must
* be first since things like _dl_dprintf() use _dl_malloc()...
@@ -485,7 +485,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
#endif
#ifndef __LDSO_STANDALONE_SUPPORT__
- if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
+ if (_start == (void *) _dl_auxvt[AT_ENTRY].a_un.a_val) {
_dl_dprintf(2, "Standalone execution is not enabled\n");
_dl_exit(1);
}
@@ -504,10 +504,10 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
* Note that for SUID programs we ignore the settings in
* LD_LIBRARY_PATH.
*/
- if ((auxvt[AT_UID].a_un.a_val == (size_t)-1 && _dl_suid_ok()) ||
- (auxvt[AT_UID].a_un.a_val != (size_t)-1 &&
- auxvt[AT_UID].a_un.a_val == auxvt[AT_EUID].a_un.a_val &&
- auxvt[AT_GID].a_un.a_val == auxvt[AT_EGID].a_un.a_val)) {
+ if ((_dl_auxvt[AT_UID].a_un.a_val == (size_t)-1 && _dl_suid_ok()) ||
+ (_dl_auxvt[AT_UID].a_un.a_val != (size_t)-1 &&
+ _dl_auxvt[AT_UID].a_un.a_val == _dl_auxvt[AT_EUID].a_un.a_val &&
+ _dl_auxvt[AT_GID].a_un.a_val == _dl_auxvt[AT_EGID].a_un.a_val)) {
_dl_secure = 0;
#ifdef __LDSO_PRELOAD_ENV_SUPPORT__
_dl_preload = _dl_getenv("LD_PRELOAD", envp);
@@ -546,7 +546,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
#endif
#ifdef __LDSO_STANDALONE_SUPPORT__
- if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
+ if (_start == (void *) _dl_auxvt[AT_ENTRY].a_un.a_val) {
ElfW(Addr) *aux_dat = (ElfW(Addr) *) argv;
int argc = (int) aux_dat[-1];
@@ -643,11 +643,11 @@ of this helper program; chances are you did not intend to run this program.\n\
*/
{
unsigned int idx;
- ElfW(Phdr) *phdr = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val;
+ ElfW(Phdr) *phdr = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val;
- for (idx = 0; idx < auxvt[AT_PHNUM].a_un.a_val; idx++, phdr++)
+ for (idx = 0; idx < _dl_auxvt[AT_PHNUM].a_un.a_val; idx++, phdr++)
if (phdr->p_type == PT_PHDR) {
- DL_INIT_LOADADDR_PROG(app_tpnt->loadaddr, auxvt[AT_PHDR].a_un.a_val - phdr->p_vaddr);
+ DL_INIT_LOADADDR_PROG(app_tpnt->loadaddr, _dl_auxvt[AT_PHDR].a_un.a_val - phdr->p_vaddr);
break;
}
@@ -662,8 +662,8 @@ of this helper program; chances are you did not intend to run this program.\n\
*/
debug_addr = _dl_zalloc(sizeof(struct r_debug));
- ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val;
- for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) {
+ ppnt = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val;
+ for (i = 0; i < _dl_auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) {
if (ppnt->p_type == PT_GNU_RELRO) {
relro_addr = ppnt->p_vaddr;
relro_size = ppnt->p_memsz;
@@ -685,8 +685,8 @@ of this helper program; chances are you did not intend to run this program.\n\
int j;
ElfW(Phdr) *ppnt_outer = ppnt;
_dl_debug_early("calling mprotect on the application program\n");
- ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val;
- for (j = 0; j < auxvt[AT_PHNUM].a_un.a_val; j++, ppnt++) {
+ ppnt = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val;
+ for (j = 0; j < _dl_auxvt[AT_PHNUM].a_un.a_val; j++, ppnt++) {
if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
_dl_mprotect((void *) (DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr) & PAGE_ALIGN),
(DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr) & ADDR_ALIGN) +
@@ -713,8 +713,8 @@ of this helper program; chances are you did not intend to run this program.\n\
(unsigned long) DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr),
ppnt->p_filesz);
_dl_loaded_modules->libtype = elf_executable;
- _dl_loaded_modules->ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val;
- _dl_loaded_modules->n_phent = auxvt[AT_PHNUM].a_un.a_val;
+ _dl_loaded_modules->ppnt = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val;
+ _dl_loaded_modules->n_phent = _dl_auxvt[AT_PHNUM].a_un.a_val;
_dl_symbol_tables = rpnt = _dl_zalloc(sizeof(struct dyn_elf));
rpnt->dyn = _dl_loaded_modules;
app_tpnt->mapaddr = app_mapaddr;
@@ -792,7 +792,7 @@ of this helper program; chances are you did not intend to run this program.\n\
if (_dl_debug) {
if (_dl_strstr(_dl_debug, "all")) {
_dl_debug_detail = _dl_debug_move = _dl_debug_symbols
- = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = (void*)1;
+ = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = _dl_debug_vdso = (void*)1;
} else {
_dl_debug_detail = _dl_strstr(_dl_debug, "detail");
_dl_debug_move = _dl_strstr(_dl_debug, "move");
@@ -800,6 +800,7 @@ of this helper program; chances are you did not intend to run this program.\n\
_dl_debug_reloc = _dl_strstr(_dl_debug, "reloc");
_dl_debug_nofixups = _dl_strstr(_dl_debug, "nofix");
_dl_debug_bindings = _dl_strstr(_dl_debug, "bind");
+ _dl_debug_vdso = _dl_strstr(_dl_debug, "vdso");
}
}
@@ -856,7 +857,7 @@ of this helper program; chances are you did not intend to run this program.\n\
}
#endif
- ldso_mapaddr = (ElfW(Addr)) auxvt[AT_BASE].a_un.a_val;
+ ldso_mapaddr = (ElfW(Addr)) _dl_auxvt[AT_BASE].a_un.a_val;
/*
* OK, fix one more thing - set up debug_addr so it will point
* to our chain. Later we may need to fill in more fields, but this
@@ -1046,7 +1047,7 @@ of this helper program; chances are you did not intend to run this program.\n\
if (!ldso_tpnt) {
/* Insert the ld.so only once */
ldso_tpnt = add_ldso(tpnt, load_addr,
- ldso_mapaddr, auxvt, rpnt);
+ ldso_mapaddr, rpnt);
} else {
ldso_tpnt->init_flag |= DL_OPENED2;
}
@@ -1148,7 +1149,7 @@ of this helper program; chances are you did not intend to run this program.\n\
* again once all libs are loaded.
*/
if (!ldso_tpnt) {
- tpnt = add_ldso(tpnt, load_addr, ldso_mapaddr, auxvt, rpnt);
+ tpnt = add_ldso(tpnt, load_addr, ldso_mapaddr, rpnt);
tpnt->usage_count++;
nscope_elem++;
} else
@@ -1450,11 +1451,11 @@ of this helper program; chances are you did not intend to run this program.\n\
_dl_debug_state();
#ifdef __LDSO_STANDALONE_SUPPORT__
- if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val)
+ if (_start == (void *) _dl_auxvt[AT_ENTRY].a_un.a_val)
return (void *) app_tpnt->l_entry;
else
#endif
- return (void *) auxvt[AT_ENTRY].a_un.a_val;
+ return (void *) _dl_auxvt[AT_ENTRY].a_un.a_val;
}
#include "dl-hash.c"
diff --git a/ldso/ldso/m68k/dl-startup.h b/ldso/ldso/m68k/dl-startup.h
index dfece443f..9c3285e27 100644
--- a/ldso/ldso/m68k/dl-startup.h
+++ b/ldso/ldso/m68k/dl-startup.h
@@ -55,6 +55,9 @@ _dl_start_user:\n\
* do something a little more subtle here. */
#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *) ARGS) + 1)
+/* We can't call functions earlier in the dl startup process */
+#define NO_FUNCS_BEFORE_BOOTSTRAP
+
/* Handle relocation of the symbols in the dynamic loader. */
static __always_inline
void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
diff --git a/ldso/ldso/m68k/dl-sysdep.h b/ldso/ldso/m68k/dl-sysdep.h
index 21937b259..5d2d7a097 100644
--- a/ldso/ldso/m68k/dl-sysdep.h
+++ b/ldso/ldso/m68k/dl-sysdep.h
@@ -83,3 +83,5 @@ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
*reloc_addr = load_off + rpnt->r_addend;
} while (--relative_count);
}
+
+#define DL_UPDATE_LOADADDR_HDR(LOADADDR, ADDR, PHDR)
diff --git a/ldso/ldso/mips/dl-startup.h b/ldso/ldso/mips/dl-startup.h
index 8026f1702..c2168d774 100644
--- a/ldso/ldso/mips/dl-startup.h
+++ b/ldso/ldso/mips/dl-startup.h
@@ -7,6 +7,7 @@
#include <sgidefs.h>
+#ifndef L_rcrt1
__asm__(""
" .text\n"
" .globl _start\n"
@@ -114,6 +115,7 @@ __asm__(""
"\n\n"
".previous\n"
);
+#endif
/*
* Get a pointer to the argv array. On many platforms this can be just
@@ -191,6 +193,5 @@ do { \
case R_MIPS_NONE: \
break; \
default: \
- SEND_STDERR("Aiieeee!"); \
_dl_exit(1); \
}
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h
index 8b2a517e2..8503350c5 100644
--- a/ldso/ldso/powerpc/dl-startup.h
+++ b/ldso/ldso/powerpc/dl-startup.h
@@ -26,6 +26,10 @@ __asm__(
" bl _GLOBAL_OFFSET_TABLE_-4@local\n" /* Put our GOT pointer in r31, */
" mflr 31\n"
#endif
+/* I'm quite sure this piece of code is always compiled as PIC but let's be sure */
+#if defined(PPC_HAS_SECUREPLT) && defined(__PIC__)
+ " mr 30,31\n"
+#endif
" addi 1,1,16\n" /* Restore SP */
" lwz 7,_dl_skip_args@got(31)\n" /* load EA of _dl_skip_args */
" lwz 7,0(7)\n" /* Load word from _dl_skip_args */
diff --git a/ldso/ldso/riscv32/dl-startup.h b/ldso/ldso/riscv32/dl-startup.h
new file mode 100644
index 000000000..6f16918d6
--- /dev/null
+++ b/ldso/ldso/riscv32/dl-startup.h
@@ -0,0 +1,92 @@
+/*
+ * Architecture specific code used by dl-startup.c
+ * Copyright (C) 2024 Waldemar Brodkorb <wbx@uclibc-ng.org>
+ * Ported from GNU libc
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <features.h>
+#include <sys/asm.h>
+
+#ifndef _RTLD_PROLOGUE
+# define _RTLD_PROLOGUE(entry) \
+ ".globl\t" __STRING (entry) "\n\t" \
+ ".type\t" __STRING (entry) ", @function\n" \
+ __STRING (entry) ":\n\t"
+#endif
+
+#ifndef _RTLD_EPILOGUE
+# define _RTLD_EPILOGUE(entry) \
+ ".size\t" __STRING (entry) ", . - " __STRING (entry) "\n\t"
+#endif
+
+#define STRINGXP(X) __STRING (X)
+
+__asm__(\
+ ".text\n\
+ " _RTLD_PROLOGUE (_start) "\
+ mv a0, sp\n\
+ jal _dl_start\n\
+ # Stash user entry point in s0.\n\
+ mv s0, a0\n\
+ # See if we were run as a command with the executable file\n\
+ # name as an extra leading argument.\n\
+ lw a0, _dl_skip_args\n\
+ # Load the original argument count.\n\
+ " STRINGXP (REG_L) " a1, 0(sp)\n\
+ # Subtract _dl_skip_args from it.\n\
+ sub a1, a1, a0\n\
+ # Adjust the stack pointer to skip _dl_skip_args words.\n\
+ sll a0, a0, " STRINGXP (PTRLOG) "\n\
+ add sp, sp, a0\n\
+ # Save back the modified argument count.\n\
+ " STRINGXP (REG_S) " a1, 0(sp)\n\
+ # Pass our finalizer function to _start.\n\
+ lla a0, _dl_fini\n\
+ # Jump to the user entry point.\n\
+ jr s0\n\
+ " _RTLD_EPILOGUE (_start) "\
+ .previous" \
+);
+
+/* Get a pointer to the argv array. On many platforms this can be just
+ * the address of the first argument, on other platforms we need to
+ * do something a little more subtle here. */
+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*)ARGS)+1)
+
+/* Function calls are not safe until the GOT relocations have been done. */
+#define NO_FUNCS_BEFORE_BOOTSTRAP
+
+/* Handle relocation of the symbols in the dynamic loader. */
+static __always_inline
+void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, ElfW(Addr) *reloc_addr,
+ ElfW(Addr) symbol_addr, ElfW(Addr) load_addr, ElfW(Addr) *sym)
+{
+ switch (ELF_R_TYPE(rpnt->r_info)) {
+ case R_RISCV_NONE:
+ break;
+ case R_RISCV_JUMP_SLOT:
+ *reloc_addr = symbol_addr + rpnt->r_addend;
+ break;
+ default:
+ _dl_exit(1);
+ }
+}
+
+#define DL_UPDATE_LOADADDR_HDR(LOADADDR, ADDR, PHDR)
diff --git a/ldso/ldso/riscv32/dl-syscalls.h b/ldso/ldso/riscv32/dl-syscalls.h
new file mode 100644
index 000000000..f40c4fd31
--- /dev/null
+++ b/ldso/ldso/riscv32/dl-syscalls.h
@@ -0,0 +1 @@
+/* stub for arch-specific syscall issues */
diff --git a/ldso/ldso/riscv32/dl-sysdep.h b/ldso/ldso/riscv32/dl-sysdep.h
new file mode 100644
index 000000000..e0a59fddd
--- /dev/null
+++ b/ldso/ldso/riscv32/dl-sysdep.h
@@ -0,0 +1,91 @@
+/*
+ * Various assembly language/system dependent hacks that are required
+ * so that we can minimize the amount of platform specific code.
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2024 by Waldemar Brodkorb <wbx@uclibc-ng.org>
+ * Ported from GNU C Library
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+/* Define this if the system uses RELOCA. */
+#define ELF_USES_RELOCA
+
+#include <elf.h>
+#include <link.h>
+
+/* Initialization sequence for the GOT. */
+#define INIT_GOT(GOT_BASE,MODULE) \
+{ \
+ GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \
+ GOT_BASE[1] = (unsigned long) MODULE; \
+}
+
+/* Here we define the magic numbers that this dynamic loader should accept */
+#define MAGIC1 EM_RISCV
+#undef MAGIC2
+
+/* Used for error messages */
+#define ELF_TARGET "RISC-V"
+
+struct elf_resolve;
+unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
+
+#define ELF_MACHINE_JMP_SLOT R_RISCV_JUMP_SLOT
+
+#define elf_machine_type_class(type) \
+ ((ELF_RTYPE_CLASS_PLT * ((type) == ELF_MACHINE_JMP_SLOT \
+ || (__WORDSIZE == 32 && (type) == R_RISCV_TLS_DTPREL32) \
+ || (__WORDSIZE == 32 && (type) == R_RISCV_TLS_DTPMOD32) \
+ || (__WORDSIZE == 32 && (type) == R_RISCV_TLS_TPREL32) \
+ || (__WORDSIZE == 64 && (type) == R_RISCV_TLS_DTPREL64) \
+ || (__WORDSIZE == 64 && (type) == R_RISCV_TLS_DTPMOD64) \
+ || (__WORDSIZE == 64 && (type) == R_RISCV_TLS_TPREL64))) \
+ | (ELF_RTYPE_CLASS_COPY * ((type) == R_RISCV_COPY)))
+
+
+/* Return the link-time address of _DYNAMIC. */
+static inline ElfW(Addr)
+elf_machine_dynamic (void)
+{
+ extern ElfW(Addr) _GLOBAL_OFFSET_TABLE_ __attribute__ ((visibility ("hidden")));
+ return _GLOBAL_OFFSET_TABLE_;
+}
+
+
+/* Return the run-time load address of the shared object. */
+static __always_inline ElfW(Addr) __attribute__ ((unused))
+elf_machine_load_address (void)
+{
+ ElfW(Addr) load_addr;
+ __asm__ ("lla %0, _DYNAMIC" : "=r" (load_addr));
+ return load_addr - elf_machine_dynamic ();
+}
+
+static __always_inline void
+elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+{
+ Elf32_Rela *rpnt = (Elf32_Rela*)rel_addr;
+ --rpnt;
+ do {
+ Elf32_Addr *const reloc_addr = (Elf32_Addr*)(load_off + (++rpnt)->r_offset);
+
+ *reloc_addr = load_off + rpnt->r_addend;
+ } while (--relative_count);
+}
diff --git a/ldso/ldso/riscv32/elfinterp.c b/ldso/ldso/riscv32/elfinterp.c
new file mode 100644
index 000000000..1a0d5d445
--- /dev/null
+++ b/ldso/ldso/riscv32/elfinterp.c
@@ -0,0 +1,295 @@
+/* RISCV ELF shared library loader suppport
+ *
+ * Copyright (C) 2001-2004 Erik Andersen
+ * Copyright (C) 2024 Waldemar Brodkorb <wbx@uclibc-ng.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the above contributors may not be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* Program to load an ELF binary on a linux system, and run it.
+ References to symbols in sharable libraries can be resolved by either
+ an ELF sharable library or a linux style of shared library. */
+
+#include "ldso.h"
+
+extern int _dl_linux_resolve(void);
+
+unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
+{
+ ELF_RELOC *this_reloc;
+ char *strtab;
+ ElfW(Sym) *symtab;
+ int symtab_index;
+ char *rel_addr;
+ char *new_addr;
+ char **got_addr;
+ ElfW(Addr) instr_addr;
+ char *symname;
+
+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
+ this_reloc = (ELF_RELOC *)(rel_addr + reloc_entry);
+ symtab_index = ELF_R_SYM(this_reloc->r_info);
+
+ symtab = (ElfW(Sym) *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
+ symname = strtab + symtab[symtab_index].st_name;
+
+ /* Address of jump instruction to fix up */
+ instr_addr = (this_reloc->r_offset + tpnt->loadaddr);
+ got_addr = (char **)instr_addr;
+
+ /* Get the address of the GOT entry */
+ new_addr = _dl_find_hash(symname, &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
+ if (unlikely(!new_addr)) {
+ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
+ _dl_exit(1);
+ }
+#if defined (__SUPPORT_LD_DEBUG__)
+ if (_dl_debug_bindings) {
+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
+ if (_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ "\tpatched %x ==> %x @ %x", *got_addr, new_addr, got_addr);
+ }
+ if (!_dl_debug_nofixups) {
+ *got_addr = new_addr;
+ }
+#else
+ *got_addr = new_addr;
+#endif
+ return (unsigned long)new_addr;
+}
+
+static int
+_dl_parse(struct elf_resolve *tpnt, struct r_scope_elem *scope,
+ unsigned long rel_addr, unsigned long rel_size,
+ int (*reloc_fnc) (struct elf_resolve *tpnt, struct r_scope_elem *scope,
+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab))
+{
+ unsigned int i;
+ char *strtab;
+ ElfW(Sym) *symtab;
+ ELF_RELOC *rpnt;
+ int symtab_index;
+
+ /* Parse the relocation information */
+ rpnt = (ELF_RELOC *)rel_addr;
+ rel_size = rel_size / sizeof(ELF_RELOC);
+
+ symtab = (ElfW(Sym) *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
+
+ for (i = 0; i < rel_size; i++, rpnt++) {
+ int res;
+
+ symtab_index = ELF_R_SYM(rpnt->r_info);
+
+ debug_sym(symtab, strtab, symtab_index);
+ debug_reloc(symtab, strtab, rpnt);
+
+ res = reloc_fnc(tpnt, scope, rpnt, symtab, strtab);
+
+ if (res==0)
+ continue;
+
+ _dl_dprintf(2, "\n%s: ", _dl_progname);
+
+ if (symtab_index)
+ _dl_dprintf(2, "symbol '%s': ",
+ strtab + symtab[symtab_index].st_name);
+
+ if (unlikely(res < 0)) {
+ int reloc_type = ELF_R_TYPE(rpnt->r_info);
+ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
+ _dl_exit(-res);
+ } else if (unlikely(res > 0)) {
+ _dl_dprintf(2, "can't resolve symbol\n");
+ return res;
+ }
+ }
+
+ return 0;
+}
+
+static int
+_dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
+{
+ int reloc_type;
+ int symtab_index;
+ char *symname;
+#if defined USE_TLS && USE_TLS
+ struct elf_resolve *tls_tpnt = NULL;
+#endif
+ struct symbol_ref sym_ref;
+ ElfW(Addr) *reloc_addr;
+ ElfW(Addr) symbol_addr;
+#if defined (__SUPPORT_LD_DEBUG__)
+ ElfW(Addr) old_val;
+#endif
+
+ reloc_addr = (ElfW(Addr)*)(tpnt->loadaddr + (unsigned long)rpnt->r_offset);
+ reloc_type = ELF_R_TYPE(rpnt->r_info);
+ symtab_index = ELF_R_SYM(rpnt->r_info);
+ sym_ref.sym = &symtab[symtab_index];
+ sym_ref.tpnt = NULL;
+ symbol_addr = 0;
+ symname = strtab + sym_ref.sym->st_name;
+
+ if (symtab_index) {
+ symbol_addr = (ElfW(Addr))_dl_find_hash(symname, scope, tpnt,
+ elf_machine_type_class(reloc_type), &sym_ref);
+
+ /*
+ * We want to allow undefined references to weak symbols - this might
+ * have been intentional. We should not be linking local symbols
+ * here, so all bases should be covered.
+ */
+ if (unlikely (!symbol_addr &&
+ (ELF_ST_TYPE(symtab[symtab_index].st_info) != STT_TLS) &&
+ (ELF_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK))) {
+ return 1;
+ }
+ if (_dl_trace_prelink) {
+ _dl_debug_lookup (symname, tpnt, &symtab[symtab_index],
+ &sym_ref, elf_machine_type_class(reloc_type));
+ }
+#if defined USE_TLS && USE_TLS
+ tls_tpnt = sym_ref.tpnt;
+#endif
+ } else {
+ /*
+ * Relocs against STN_UNDEF are usually treated as using a
+ * symbol value of zero, and using the module containing the
+ * reloc itself.
+ */
+ symbol_addr = sym_ref.sym->st_value;
+#if defined USE_TLS && USE_TLS
+ tls_tpnt = tpnt;
+#endif
+ }
+
+#if defined (__SUPPORT_LD_DEBUG__)
+ old_val = *reloc_addr;
+#endif
+
+ switch (reloc_type) {
+ case R_RISCV_NONE:
+ break;
+ case R_RISCV_32: /* REL_SYMBOLIC */
+ case R_RISCV_JUMP_SLOT: /* REL_PLT */
+ *reloc_addr = symbol_addr + rpnt->r_addend;
+ break;
+ case R_RISCV_RELATIVE:
+ *reloc_addr += tpnt->loadaddr + rpnt->r_addend;
+ break;
+ case R_RISCV_COPY:
+ if (symbol_addr) {
+ _dl_memcpy((char *)reloc_addr, (char *)symbol_addr,
+ sym_ref.sym->st_size);
+ }
+ break;
+#if defined USE_TLS && USE_TLS
+ case R_RISCV_TLS_DTPMOD32:
+ *reloc_addr = tls_tpnt->l_tls_modid;
+ break;
+ case R_RISCV_TLS_DTPREL32:
+ *reloc_addr = symbol_addr -TLS_DTV_OFFSET + rpnt->r_addend;
+ break;
+ case R_RISCV_TLS_TPREL32:
+ CHECK_STATIC_TLS ((struct link_map *) tls_tpnt);
+ *reloc_addr = tls_tpnt->l_tls_offset + symbol_addr + rpnt->r_addend;
+ break;
+#endif
+ default:
+ return -1; /*call _dl_exit(1) */
+ }
+
+#if defined (__SUPPORT_LD_DEBUG__)
+ if (_dl_debug_reloc && _dl_debug_detail) {
+ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
+ old_val, *reloc_addr, reloc_addr);
+ }
+#endif
+
+ return 0;
+}
+
+#undef __RISCV_LAZY_RELOC_WORKS
+#ifdef __RISCV_LAZY_RELOC_WORKS
+static int
+_dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
+{
+ int reloc_type;
+ ElfW(Addr) *reloc_addr;
+#if defined (__SUPPORT_LD_DEBUG__)
+ ElfW(Addr) old_val;
+#endif
+
+ (void)scope;
+ (void)strtab;
+
+ reloc_addr = (ElfW(Addr)*)(tpnt->loadaddr + rpnt->r_offset);
+ reloc_type = ELF_R_TYPE(rpnt->r_info);
+
+#if defined (__SUPPORT_LD_DEBUG__)
+ old_val = *reloc_addr;
+#endif
+
+ switch (reloc_type) {
+ case R_RISCV_NONE:
+ break;
+ case R_RISCV_JUMP_SLOT:
+ break;
+ default:
+ return -1; /*call _dl_exit(1) */
+ }
+
+#if defined (__SUPPORT_LD_DEBUG__)
+ if (_dl_debug_reloc && _dl_debug_detail) {
+ _dl_dprintf(_dl_debug_file, "\tpatched_lazy: %x ==> %x @ %x\n",
+ old_val, *reloc_addr, reloc_addr);
+ }
+#endif
+
+ return 0;
+}
+#endif
+
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size)
+{
+#ifdef __RISCV_LAZY_RELOC_WORKS
+ (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
+#else
+ _dl_parse_relocation_information(rpnt, &_dl_loaded_modules->symbol_scope,
+ rel_addr, rel_size);
+#endif
+}
+
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
+ struct r_scope_elem *scope, unsigned long rel_addr, unsigned long rel_size)
+{
+ return _dl_parse(rpnt->dyn, scope, rel_addr, rel_size, _dl_do_reloc);
+}
diff --git a/ldso/ldso/riscv32/resolve.S b/ldso/ldso/riscv32/resolve.S
new file mode 100644
index 000000000..bfa91ecdb
--- /dev/null
+++ b/ldso/ldso/riscv32/resolve.S
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2024 by Waldemar Brodkorb <wbx@uclibc-ng.org>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ * ported from GNU libc
+ */
+
+/* Copyright (C) 2017-2019 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <features.h>
+
+#include <sysdep.h>
+#include <sys/asm.h>
+
+/* Assembler veneer called from the PLT header code for lazy loading.
+ The PLT header passes its own args in t0-t2. */
+
+#ifdef __riscv_float_abi_soft
+# define FRAME_SIZE (-((-10 * SZREG) & ALMASK))
+#else
+# define FRAME_SIZE (-((-10 * SZREG - 8 * SZFREG) & ALMASK))
+#endif
+
+ENTRY (_dl_linux_resolve)
+ # Save arguments to stack.
+ addi sp, sp, -FRAME_SIZE
+ REG_S ra, 9*SZREG(sp)
+ REG_S a0, 1*SZREG(sp)
+ REG_S a1, 2*SZREG(sp)
+ REG_S a2, 3*SZREG(sp)
+ REG_S a3, 4*SZREG(sp)
+ REG_S a4, 5*SZREG(sp)
+ REG_S a5, 6*SZREG(sp)
+ REG_S a6, 7*SZREG(sp)
+ REG_S a7, 8*SZREG(sp)
+
+#ifndef __riscv_float_abi_soft
+ FREG_S fa0, (10*SZREG + 0*SZFREG)(sp)
+ FREG_S fa1, (10*SZREG + 1*SZFREG)(sp)
+ FREG_S fa2, (10*SZREG + 2*SZFREG)(sp)
+ FREG_S fa3, (10*SZREG + 3*SZFREG)(sp)
+ FREG_S fa4, (10*SZREG + 4*SZFREG)(sp)
+ FREG_S fa5, (10*SZREG + 5*SZFREG)(sp)
+ FREG_S fa6, (10*SZREG + 6*SZFREG)(sp)
+ FREG_S fa7, (10*SZREG + 7*SZFREG)(sp)
+#endif
+
+ # Update .got.plt and obtain runtime address of callee.
+ slli a1, t1, 1
+ mv a0, t0 # link map
+ add a1, a1, t1 # reloc offset (== thrice the .got.plt offset)
+ la a2, _dl_fixup
+ jalr a2
+ mv t1, a0
+
+ # Restore arguments from stack.
+ REG_L ra, 9*SZREG(sp)
+ REG_L a0, 1*SZREG(sp)
+ REG_L a1, 2*SZREG(sp)
+ REG_L a2, 3*SZREG(sp)
+ REG_L a3, 4*SZREG(sp)
+ REG_L a4, 5*SZREG(sp)
+ REG_L a5, 6*SZREG(sp)
+ REG_L a6, 7*SZREG(sp)
+ REG_L a7, 8*SZREG(sp)
+
+#ifndef __riscv_float_abi_soft
+ FREG_L fa0, (10*SZREG + 0*SZFREG)(sp)
+ FREG_L fa1, (10*SZREG + 1*SZFREG)(sp)
+ FREG_L fa2, (10*SZREG + 2*SZFREG)(sp)
+ FREG_L fa3, (10*SZREG + 3*SZFREG)(sp)
+ FREG_L fa4, (10*SZREG + 4*SZFREG)(sp)
+ FREG_L fa5, (10*SZREG + 5*SZFREG)(sp)
+ FREG_L fa6, (10*SZREG + 6*SZFREG)(sp)
+ FREG_L fa7, (10*SZREG + 7*SZFREG)(sp)
+#endif
+
+ addi sp, sp, FRAME_SIZE
+
+ # Invoke the callee.
+ jr t1
+END (_dl_linux_resolve)
+
diff --git a/ldso/ldso/riscv64/dl-startup.h b/ldso/ldso/riscv64/dl-startup.h
index dabe1bebd..82e525e66 100644
--- a/ldso/ldso/riscv64/dl-startup.h
+++ b/ldso/ldso/riscv64/dl-startup.h
@@ -88,3 +88,5 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, ElfW(Addr) *reloc_addr,
_dl_exit(1);
}
}
+
+#define DL_UPDATE_LOADADDR_HDR(LOADADDR, ADDR, PHDR)
diff --git a/ldso/ldso/riscv64/dl-sysdep.h b/ldso/ldso/riscv64/dl-sysdep.h
index 91a45af46..01f3e49bf 100644
--- a/ldso/ldso/riscv64/dl-sysdep.h
+++ b/ldso/ldso/riscv64/dl-sysdep.h
@@ -58,23 +58,20 @@ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
|| (__WORDSIZE == 64 && (type) == R_RISCV_TLS_TPREL64))) \
| (ELF_RTYPE_CLASS_COPY * ((type) == R_RISCV_COPY)))
-
-/* Return the link-time address of _DYNAMIC. */
+/* Return the run-time load address of the shared object. */
static inline ElfW(Addr)
-elf_machine_dynamic (void)
+elf_machine_load_address (void)
{
- extern ElfW(Addr) _GLOBAL_OFFSET_TABLE_ __attribute__ ((visibility ("hidden")));
- return _GLOBAL_OFFSET_TABLE_;
+ extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
+ return (ElfW(Addr)) &__ehdr_start;
}
-
-/* Return the run-time load address of the shared object. */
-static __always_inline ElfW(Addr) __attribute__ ((unused))
-elf_machine_load_address (void)
+/* Return the link-time address of _DYNAMIC. */
+static inline ElfW(Addr)
+elf_machine_dynamic (void)
{
- ElfW(Addr) load_addr;
- __asm__ ("lla %0, _DYNAMIC" : "=r" (load_addr));
- return load_addr - elf_machine_dynamic ();
+ extern ElfW(Dyn) _DYNAMIC[] attribute_hidden;
+ return (ElfW(Addr)) _DYNAMIC - elf_machine_load_address ();
}
static __always_inline void
diff --git a/ldso/ldso/riscv64/elfinterp.c b/ldso/ldso/riscv64/elfinterp.c
index 8ddba1f9f..5266d96b2 100644
--- a/ldso/ldso/riscv64/elfinterp.c
+++ b/ldso/ldso/riscv64/elfinterp.c
@@ -204,15 +204,17 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
*reloc_addr += tpnt->loadaddr + rpnt->r_addend;
break;
case R_RISCV_COPY:
- _dl_memcpy((void *) reloc_addr,
- (void *) symbol_addr, sym_ref.sym->st_size);
+ if (symbol_addr) {
+ _dl_memcpy((char *)reloc_addr, (char *)symbol_addr,
+ sym_ref.sym->st_size);
+ }
break;
#if defined USE_TLS && USE_TLS
case R_RISCV_TLS_DTPMOD64:
*reloc_addr = tls_tpnt->l_tls_modid;
break;
case R_RISCV_TLS_DTPREL64:
- *reloc_addr = symbol_addr;
+ *reloc_addr = symbol_addr - TLS_DTV_OFFSET + rpnt->r_addend;
break;
case R_RISCV_TLS_TPREL64:
CHECK_STATIC_TLS ((struct link_map *) tls_tpnt);
diff --git a/ldso/ldso/xtensa/dl-startup.h b/ldso/ldso/xtensa/dl-startup.h
index db223fead..c9350c0f2 100644
--- a/ldso/ldso/xtensa/dl-startup.h
+++ b/ldso/ldso/xtensa/dl-startup.h
@@ -7,6 +7,7 @@
* Parts taken from glibc/sysdeps/xtensa/dl-machine.h.
*/
+#ifndef L_rcrt1
__asm__ (
" .text\n"
" .align 4\n"
@@ -81,6 +82,7 @@ __asm__ (
" addi a5, a5, 8\n"
" bnez a6, 3b\n"
" j .Lfixup_stack_ret");
+#endif
/* Get a pointer to the argv value. */
#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *) ARGS) + 1)
@@ -88,12 +90,11 @@ __asm__ (
/* Function calls are not safe until the GOT relocations have been done. */
#define NO_FUNCS_BEFORE_BOOTSTRAP
+#if defined(__ARCH_USE_MMU__)
#define PERFORM_BOOTSTRAP_GOT(tpnt) \
do { \
xtensa_got_location *got_loc; \
unsigned long l_addr = tpnt->loadaddr; \
- Elf32_Word relative_count; \
- unsigned long rel_addr; \
Elf32_Addr prev_got_start = 0, prev_got_end = 0; \
int x; \
\
@@ -125,13 +126,5 @@ do { \
prev_got_end - prev_got_start, \
PROT_READ | PROT_WRITE | PROT_EXEC); \
} \
-\
- /* The following is a stripped down version of the code following \
- the invocation of PERFORM_BOOTSTRAP_GOT in dl-startup.c. That \
- code is skipped when PERFORM_BOOTSTRAP_GOT is defined, so it has \
- to be done here instead. */ \
- relative_count = tpnt->dynamic_info[DT_RELCONT_IDX]; \
- rel_addr = tpnt->dynamic_info[DT_RELOC_TABLE_ADDR]; \
- if (rel_addr) \
- elf_machine_relative(load_addr, rel_addr, relative_count); \
} while (0)
+#endif
diff --git a/ldso/ldso/xtensa/dl-sysdep.h b/ldso/ldso/xtensa/dl-sysdep.h
index d308237d3..6b908989a 100644
--- a/ldso/ldso/xtensa/dl-sysdep.h
+++ b/ldso/ldso/xtensa/dl-sysdep.h
@@ -94,9 +94,6 @@ typedef struct xtensa_got_location_struct {
/* Used for error messages. */
#define ELF_TARGET "Xtensa"
-/* Need bootstrap relocations */
-#define ARCH_NEEDS_BOOTSTRAP_RELOCS
-
struct elf_resolve;
extern unsigned long _dl_linux_resolver (struct elf_resolve *, int);
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
index 91c417cc2..5e43f2303 100644
--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -26,7 +26,7 @@ CSRC-$(V4_OR_V6) += \
inet_lnaof.c inet_netof.c
# multi source resolv.c
CSRC-$(V4_OR_V6) += \
- encodeh.c decodeh.c encoded.c decoded.c \
+ encodeh.c decodeh.c \
encodeq.c encodea.c \
read_etc_hosts_r.c \
dnslookup.c opennameservers.c closenameservers.c \
diff --git a/libc/inet/decoded.c b/libc/inet/decoded.c
deleted file mode 100644
index 378cbfad7..000000000
--- a/libc/inet/decoded.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#define L_decoded
-#include RESOLVER
diff --git a/libc/inet/encoded.c b/libc/inet/encoded.c
deleted file mode 100644
index 27f92becd..000000000
--- a/libc/inet/encoded.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#define L_encoded
-#include RESOLVER
diff --git a/libc/inet/encodeq.c b/libc/inet/encodeq.c
index 5555aa548..dc7945bc6 100644
--- a/libc/inet/encodeq.c
+++ b/libc/inet/encodeq.c
@@ -5,4 +5,6 @@
*/
#define L_encodeq
+#define L_ns_name
+#define L_res_comp
#include RESOLVER
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index a9000ae13..f34a4726c 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -959,8 +959,7 @@ getaddrinfo(const char *name, const char *service,
last_i = i;
if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC))
continue;
- /*if (p) - freeaddrinfo works ok on NULL too */
- freeaddrinfo(p);
+ freeaddrinfo(p); /* freeaddrinfo works ok on NULL too */
return -(i & GAIH_EAI);
}
if (end)
diff --git a/libc/inet/getnet.c b/libc/inet/getnet.c
index d90fa701e..8743fb9a5 100644
--- a/libc/inet/getnet.c
+++ b/libc/inet/getnet.c
@@ -69,6 +69,7 @@ int getnetent_r(struct netent *result_buf,
char **tok = NULL;
const size_t aliaslen = sizeof(char *) * MAXTOKENS;
int ret = ERANGE;
+ (void)h_errnop;
*result = NULL;
if (buflen < aliaslen
@@ -147,6 +148,7 @@ int getnetbyname_r(const char *name,
{
register char **cp;
int ret, herrnop;
+ (void)h_errnop;
__UCLIBC_MUTEX_LOCK(mylock);
setnetent(net_stayopen);
@@ -181,6 +183,7 @@ int getnetbyaddr_r(uint32_t net, int type,
int *h_errnop)
{
int ret, herrnop;
+ (void)h_errnop;
__UCLIBC_MUTEX_LOCK(mylock);
setnetent(net_stayopen);
diff --git a/libc/inet/hostid.c b/libc/inet/hostid.c
index 4ddfbd123..5977ada25 100644
--- a/libc/inet/hostid.c
+++ b/libc/inet/hostid.c
@@ -61,8 +61,7 @@ long int gethostid(void)
* Mitch
*/
if (gethostname(host, HOST_NAME_MAX) >= 0 && *host) {
- struct addrinfo hints, *results, *addr;
- memset(&hints, 0, sizeof(struct addrinfo));
+ struct addrinfo hints = {.ai_family = AF_INET}, *results, *addr;
if (!getaddrinfo(host, NULL, &hints, &results)) {
for (addr = results; addr; addr = results->ai_next) {
/* Just so it doesn't look exactly like the
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index ed2e0d2fa..d7a659a8c 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -11,6 +11,7 @@
/*
* Portions Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
+ * Portions Copyright © 2021 mirabilos <m@mirbsd.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -247,6 +248,7 @@ Domain name in a message can be represented as either:
#include <netdb.h>
#include <ctype.h>
#include <stdbool.h>
+#include <stdint.h>
#include <time.h>
#include <arpa/nameser.h>
#include <sys/utsname.h>
@@ -254,6 +256,7 @@ Domain name in a message can be represented as either:
#include <sys/stat.h>
#include <sys/param.h>
#include <bits/uClibc_mutex.h>
+#include <fcntl.h>
#include "internal/parse_config.h"
/* poll() is not supported in kernel <= 2.0, therefore if __NR_poll is
@@ -395,14 +398,6 @@ extern int __dns_lookup(const char *name,
int type,
unsigned char **outpacket,
struct resolv_answer *a) attribute_hidden;
-extern int __encode_dotted(const char *dotted,
- unsigned char *dest,
- int maxlen) attribute_hidden;
-extern int __decode_dotted(const unsigned char *packet,
- int offset,
- int packet_len,
- char *dest,
- int dest_len) attribute_hidden;
extern int __encode_header(struct resolv_header *h,
unsigned char *dest,
int maxlen) attribute_hidden;
@@ -416,6 +411,13 @@ extern int __encode_answer(struct resolv_answer *a,
int maxlen) attribute_hidden;
extern void __open_nameservers(void) attribute_hidden;
extern void __close_nameservers(void) attribute_hidden;
+extern int __hnbad(const char *dotted) attribute_hidden;
+
+#define __encode_dotted(dotted,dest,maxlen) \
+ dn_comp((dotted), (dest), (maxlen), NULL, NULL)
+#define __decode_dotted(packet,offset,packet_len,dest,dest_len) \
+ dn_expand((packet), (packet) + (packet_len), (packet) + (offset), \
+ (dest), (dest_len))
/*
* Theory of operation.
@@ -552,116 +554,6 @@ void __decode_header(unsigned char *data,
#endif /* L_decodeh */
-#ifdef L_encoded
-
-/* Encode a dotted string into nameserver transport-level encoding.
- This routine is fairly dumb, and doesn't attempt to compress
- the data */
-int __encode_dotted(const char *dotted, unsigned char *dest, int maxlen)
-{
- unsigned used = 0;
-
- while (dotted && *dotted) {
- char *c = strchr(dotted, '.');
- int l = c ? c - dotted : strlen(dotted);
-
- /* two consecutive dots are not valid */
- if (l == 0)
- return -1;
-
- if (l >= (maxlen - used - 1))
- return -1;
-
- dest[used++] = l;
- memcpy(dest + used, dotted, l);
- used += l;
-
- if (!c)
- break;
- dotted = c + 1;
- }
-
- if (maxlen < 1)
- return -1;
-
- dest[used++] = 0;
-
- return used;
-}
-#endif /* L_encoded */
-
-
-#ifdef L_decoded
-
-/* Decode a dotted string from nameserver transport-level encoding.
- This routine understands compressed data. */
-int __decode_dotted(const unsigned char *packet,
- int offset,
- int packet_len,
- char *dest,
- int dest_len)
-{
- unsigned b;
- bool measure = 1;
- unsigned total = 0;
- unsigned used = 0;
- unsigned maxiter = 256;
-
- if (!packet)
- return -1;
-
- dest[0] = '\0';
- while (--maxiter) {
- if (offset >= packet_len)
- return -1;
- b = packet[offset++];
- if (b == 0)
- break;
-
- if (measure)
- total++;
-
- if ((b & 0xc0) == 0xc0) {
- if (offset >= packet_len)
- return -1;
- if (measure)
- total++;
- /* compressed item, redirect */
- offset = ((b & 0x3f) << 8) | packet[offset];
- measure = 0;
- continue;
- }
-
- if (used + b + 1 >= dest_len)
- return -1;
- if (offset + b >= packet_len)
- return -1;
- memcpy(dest + used, packet + offset, b);
- offset += b;
- used += b;
-
- if (measure)
- total += b;
-
- if (packet[offset] != 0)
- dest[used++] = '.';
- else
- dest[used++] = '\0';
- }
- if (!maxiter)
- return -1;
-
- /* The null byte must be counted too */
- if (measure)
- total++;
-
- DPRINTF("Total decode len = %d\n", total);
-
- return total;
-}
-#endif /* L_decoded */
-
-
#ifdef L_encodeq
int __encode_question(const struct resolv_question *q,
@@ -1155,6 +1047,263 @@ static int __decode_answer(const unsigned char *message, /* packet */
return i + RRFIXEDSZ + a->rdlength;
}
+
+#if defined __UCLIBC_DNSRAND_MODE_URANDOM__ || defined __UCLIBC_DNSRAND_MODE_PRNGPLUS__
+
+/*
+ * Get a random int from urandom.
+ * Return 0 on success and -1 on failure.
+ *
+ * This will dip into the entropy pool maintaind by the system.
+ */
+int _dnsrand_getrandom_urandom(int *rand_value) {
+ static int urand_fd = -1;
+ static int errCnt = 0;
+ if (urand_fd == -1) {
+ urand_fd = open("/dev/urandom", O_RDONLY);
+ if (urand_fd == -1) {
+ if ((errCnt % 16) == 0) {
+ DPRINTF("uCLibC:WARN:DnsRandGetRand: urandom is unavailable...\n");
+ }
+ errCnt += 1;
+ return -1;
+ }
+ }
+ if (read(urand_fd, rand_value, sizeof(int)) == sizeof(int)) { /* small reads like few bytes here should be safe in general. */
+ DPRINTF("uCLibC:DBUG:DnsRandGetRand: URandom:0x%lx\n", *rand_value);
+ return 0;
+ }
+ return -1;
+}
+
+#endif
+
+#if defined __UCLIBC_DNSRAND_MODE_CLOCK__ || defined __UCLIBC_DNSRAND_MODE_PRNGPLUS__
+
+/*
+ * Try get a sort of random int by looking at current time in system realtime clock.
+ * Return 0 on success and -1 on failure.
+ *
+ * This requries the realtime related uclibc feature to be enabled and also
+ * the system should have a clock source with nanosec resolution to be mapped
+ * to CLOCK_REALTIME, for this to generate values that appear random plausibly.
+ */
+int _dnsrand_getrandom_clock(int *rand_value) {
+#if defined __USE_POSIX199309 && defined __UCLIBC_HAS_REALTIME__
+ struct timespec ts;
+ if (clock_gettime(CLOCK_REALTIME, &ts) == 0) {
+ *rand_value = (ts.tv_sec + ts.tv_nsec) % INT_MAX;
+ DPRINTF("uCLibC:DBUG:DnsRandGetRand: Clock:0x%lx\n", *rand_value);
+ return 0;
+ }
+#endif
+ return -1;
+}
+
+#endif
+
+#ifdef __UCLIBC_DNSRAND_MODE_PRNGPLUS__
+
+/*
+ * Try get a random int by first checking at urandom and then at realtime clock.
+ * Return 0 on success and -1 on failure.
+ *
+ * Chances are most embedded targets using linux/bsd/... could have urandom and
+ * also it can potentially give better random values, so try urandom first.
+ * However if there is failure wrt urandom, then try realtime clock based helper.
+ */
+int _dnsrand_getrandom_urcl(int *rand_value) {
+ if (_dnsrand_getrandom_urandom(rand_value) == 0) {
+ return 0;
+ }
+ if (_dnsrand_getrandom_clock(rand_value) == 0) {
+ return 0;
+ }
+ DPRINTF("uCLibC:DBUG:DnsRandGetRand: URCL:Nothing:0x%lx\n", *rand_value);
+ return -1;
+}
+
+#define DNSRAND_PRNGSTATE_INT32LEN 32
+#undef DNSRAND_PRNGRUN_SHORT
+#ifdef DNSRAND_PRNGRUN_SHORT
+#define DNSRAND_RESEED_OP1 (DNSRAND_PRNGSTATE_INT32LEN/2)
+#define DNSRAND_RESEED_OP2 (DNSRAND_PRNGSTATE_INT32LEN/4)
+#else
+#define DNSRAND_RESEED_OP1 (DNSRAND_PRNGSTATE_INT32LEN*6)
+#define DNSRAND_RESEED_OP2 DNSRAND_PRNGSTATE_INT32LEN
+#endif
+
+#define DNSRAND_TIMEFORCED_RESEED_CHECKMOD (DNSRAND_PRNGSTATE_INT32LEN/8)
+#define DNSRAND_TIMEFORCED_RESEED_SECS 120
+
+time_t clock_getcursec(void) {
+ static time_t dummyTime = 0;
+#if defined __USE_POSIX199309 && defined __UCLIBC_HAS_REALTIME__
+ struct timespec ts;
+ if (clock_gettime(CLOCK_REALTIME, &ts) == 0) {
+ return ts.tv_sec;
+ }
+#endif
+ dummyTime += DNSRAND_TIMEFORCED_RESEED_SECS;
+ return dummyTime;
+}
+
+/*
+ * This logic uses uclibc's random PRNG to generate random int. This keeps the
+ * logic fast by not depending on a more involved CPRNG kind of logic nor on a
+ * kernel to user space handshake at the core.
+ *
+ * However to ensure that pseudo random sequences based on a given seeding of the
+ * PRNG logic, is not generated for too long so as to allow a advarsary to try guess
+ * the internal states of the prng logic and inturn the next number, srandom is
+ * used periodically to reseed PRNG logic, when and where possible.
+ *
+ * To help with this periodic reseeding, by default the logic will first try to
+ * see if it can get some relatively random number using /dev/urandom. If not it
+ * will try use the current time to generate plausibly random value as substitute.
+ * If neither of these sources are available, then the prng itself is used to seed
+ * a new state, so that the pseudo random sequence can continue, which is better
+ * than the fallback simple counter.
+ *
+ * Also to add bit more of variance wrt this periodic reseeding, the period interval
+ * at which this reseeding occurs keeps changing within a predefined window. The
+ * window is controlled based on how often this logic is called (which currently
+ * will depend on how often requests for dns query (and inturn dnsrand_next) occurs,
+ * as well as a self driven periodically changing request count boundry.
+ *
+ * The internally generated random values are not directly exposed, instead result
+ * of adjacent values large mult with mod is used to greatly reduce the possibility
+ * of trying to infer the internal values from externally exposed random values.
+ * This should also make longer run of prng ok to an extent.
+ *
+ * NOTE: The Random PRNG used here maintains its own internal state data, so that
+ * it doesnt impact any other users of random prng calls in the system/program
+ * compiled against uclibc.
+ *
+ * NOTE: If your target doesnt support int64_t, then the code uses XOR instead of
+ * mult with mod based transform on the internal random sequence, to generate the
+ * random number that is returned. However as XOR is not a one way transform, this
+ * is supported only in DNSRAND_PRNGRUN_SHORT mode by default, which needs to be
+ * explicitly enabled by the platform developer, by defining the same.
+ *
+ */
+int _dnsrand_getrandom_prng(int *rand_value) {
+ static time_t reSeededSec = 0;
+ time_t curSec = 0;
+ bool bTimeForcedReSeed = 0;
+ static int cnt = -1;
+ static int nextReSeedWindow = DNSRAND_RESEED_OP1;
+ static int32_t prngState[DNSRAND_PRNGSTATE_INT32LEN]; /* prng logic internally assumes int32_t wrt state array, so to help align if required */
+ static struct random_data prngData;
+ int32_t val, val2;
+ int calc;
+ int prngSeed = 0x19481869;
+
+ if (cnt == -1) {
+ _dnsrand_getrandom_urcl(&prngSeed);
+ memset(&prngData, 0, sizeof(prngData));
+ initstate_r(prngSeed, (char*)&prngState, DNSRAND_PRNGSTATE_INT32LEN*4, &prngData);
+ }
+ cnt += 1;
+ if ((cnt % DNSRAND_TIMEFORCED_RESEED_CHECKMOD) == 0) {
+ curSec = clock_getcursec();
+ if ((curSec - reSeededSec) >= DNSRAND_TIMEFORCED_RESEED_SECS) {
+ bTimeForcedReSeed = 1;
+ }
+ }
+ if (((cnt % nextReSeedWindow) == 0) || bTimeForcedReSeed) {
+ if (curSec == 0) curSec = clock_getcursec();
+ reSeededSec = curSec;
+ if (_dnsrand_getrandom_urcl(&prngSeed) != 0) {
+ random_r(&prngData, &prngSeed);
+ }
+ srandom_r(prngSeed, &prngData);
+ random_r(&prngData, &val);
+ nextReSeedWindow = DNSRAND_RESEED_OP1 + (val % DNSRAND_RESEED_OP2);
+ DPRINTF("uCLibC:DBUG:DnsRandNext: PRNGWindow:%d\n", nextReSeedWindow);
+ cnt = 0;
+ }
+ random_r(&prngData, &val);
+ random_r(&prngData, &val2);
+#ifdef INT64_MAX
+ calc = ((int64_t)val * (int64_t)val2) % INT_MAX;
+#else
+# ifdef DNSRAND_PRNGRUN_SHORT
+ calc = val ^ val2;
+# warning "[No int64] using xor based random number transform logic in short prng run mode, bcas int64_t not supported on this target"
+# else
+# error "[No int64] using xor based random number transform logic only supported with short prng runs, you may want to define DNSRAND_PRNGRUN_SHORT"
+# endif
+#endif
+ *rand_value = calc;
+ DPRINTF("uCLibC:DBUG:DnsRandGetRand: PRNGPlus: %d, 0x%lx 0x%lx 0x%lx\n", cnt, val, val2, *rand_value);
+ return 0;
+}
+
+#endif
+
+/**
+ * If DNS query's id etal is generated using a simple counter, then it can be
+ * subjected to dns poisoning relatively easily, so adding some randomness can
+ * increase the difficulty wrt dns poisoning and is thus desirable.
+ *
+ * However given that embedded targets may or may not have different sources available
+ * with them to try generate random values, this logic tries to provides flexibility
+ * to the platform developer to decide, how they may want to handle this.
+ *
+ * If a given target doesnt support urandom nor realtime clock OR for some reason
+ * if the platform developer doesnt want to use random dns query id etal, then
+ * they can define __UCLIBC_DNSRAND_MODE_SIMPLECOUNTER__ so that a simple incrementing
+ * counter is used.
+ *
+ * However if the target has support for urandom or realtime clock, then the prngplus
+ * based random generation tries to give a good balance between randomness and performance.
+ * This is the default and is enabled when no other mode is defined. It is also indirectly
+ * enabled by defining __UCLIBC_DNSRAND_MODE_PRNGPLUS__ instead of the other modes.
+ *
+ * If urandom is available on the target and one wants to keep things simple and use
+ * it directly, then one can define __UCLIBC_DNSRAND_MODE_URANDOM__. Do note that this
+ * will be relatively slower compared to other options. But it can normally generate
+ * good random values/ids by dipping into the entropy pool available in the system.
+ *
+ * If system realtime clock is available on target and enabled, then if one wants to
+ * keep things simple and use it directly, then define __UCLIBC_DNSRAND_MODE_CLOCK__.
+ * Do note that this requires nanosecond resolution / granularity wrt the realtime
+ * clock source to generate plausibly random values/ids. As processor &/ io performance
+ * improves, the effectiveness of this strategy can be impacted in some cases.
+ *
+ * If either the URandom or Clock based get random fails, then the logic is setup to
+ * try fallback to the simple counter mode, with the help of the def_value, which is
+ * setup to be the next increment wrt the previously generated / used value, by the
+ * caller of dnsrand_next.
+ *
+ */
+int dnsrand_next(int def_value) {
+ int val = def_value;
+#if defined __UCLIBC_DNSRAND_MODE_SIMPLECOUNTER__
+ return val;
+#elif defined __UCLIBC_DNSRAND_MODE_URANDOM__
+ if (_dnsrand_getrandom_urandom(&val) == 0) {
+ return val;
+ }
+ return def_value;
+#elif defined __UCLIBC_DNSRAND_MODE_CLOCK__
+ if (_dnsrand_getrandom_clock(&val) == 0) {
+ return val;
+ }
+ return def_value;
+#else
+ if (_dnsrand_getrandom_prng(&val) == 0) {
+ return val;
+ }
+ return def_value;
+#endif
+}
+
+int dnsrand_setup(int def_value) {
+ return def_value;
+}
+
/* On entry:
* a.buf(len) = auxiliary buffer for IP addresses after first one
* a.add_count = how many additional addresses are there already
@@ -1204,6 +1353,7 @@ int __dns_lookup(const char *name,
bool ends_with_dot;
bool contains_dot;
sockaddr46_t sa;
+ int num_answers;
fd = -1;
lookup = NULL;
@@ -1258,7 +1408,7 @@ int __dns_lookup(const char *name,
}
/* first time? pick starting server etc */
if (local_ns_num < 0) {
- local_id = last_id;
+ local_id = dnsrand_setup(last_id);
/*TODO: implement /etc/resolv.conf's "options rotate"
(a.k.a. RES_ROTATE bit in _res.options)
local_ns_num = 0;
@@ -1268,7 +1418,7 @@ int __dns_lookup(const char *name,
}
if (local_ns_num >= __nameservers)
local_ns_num = 0;
- local_id++;
+ local_id = dnsrand_next(++local_id);
local_id &= 0xffff;
/* write new values back while still under lock */
last_id = local_id;
@@ -1446,6 +1596,7 @@ int __dns_lookup(const char *name,
goto fail1;
}
pos = HFIXEDSZ;
+ /*XXX TODO: check that question matches query (and qdcount==1?) */
for (j = 0; j < h.qdcount; j++) {
DPRINTF("Skipping question %d at %d\n", j, pos);
i = __length_question(packet + pos, packet_len - pos);
@@ -1460,6 +1611,7 @@ int __dns_lookup(const char *name,
DPRINTF("Decoding answer at pos %d\n", pos);
first_answer = 1;
+ num_answers = 0;
a->dotted = NULL;
for (j = 0; j < h.ancount; j++) {
i = __decode_answer(packet, pos, packet_len, &ma);
@@ -1467,12 +1619,15 @@ int __dns_lookup(const char *name,
DPRINTF("failed decode %d\n", i);
/* If the message was truncated but we have
* decoded some answers, pretend it's OK */
- if (j && h.tc)
+ if (num_answers && h.tc)
break;
goto try_next_server;
}
pos += i;
+ if (__hnbad(ma.dotted))
+ break;
+ ++num_answers;
if (first_answer) {
ma.buf = a->buf;
ma.buflen = a->buflen;
@@ -1502,6 +1657,10 @@ int __dns_lookup(const char *name,
++a->add_count;
}
}
+ if (!num_answers) {
+ h_errno = NO_RECOVERY;
+ goto fail1;
+ }
/* Success! */
DPRINTF("Answer name = |%s|\n", a->dotted);
@@ -1619,7 +1778,7 @@ int __read_etc_hosts_r(
found:
result_buf->h_name = *(result_buf->h_aliases++);
result_buf->h_addr_list = (char**)(buf + HALISTOFF);
- *(result_buf->h_addr_list + 1) = '\0';
+ *(result_buf->h_addr_list + 1) = 0;
h_addr0 = (struct in_addr*)(buf + INADDROFF);
result_buf->h_addr = (char*)h_addr0;
if (0) /* nothing */;
@@ -2468,7 +2627,7 @@ int gethostbyaddr_r(const void *addr, socklen_t addrlen,
/* Decode CNAME into buf, feed it to __dns_lookup() again */
i = __decode_dotted(packet, a.rdoffset, packet_len, buf, buflen);
free(packet);
- if (i < 0) {
+ if (i < 0 || __hnbad(buf)) {
*h_errnop = NO_RECOVERY;
return -1;
}
@@ -2477,6 +2636,10 @@ int gethostbyaddr_r(const void *addr, socklen_t addrlen,
if (a.atype == T_PTR) { /* ADDRESS */
i = __decode_dotted(packet, a.rdoffset, packet_len, buf, buflen);
free(packet);
+ if (__hnbad(buf)) {
+ *h_errnop = NO_RECOVERY;
+ return -1;
+ }
result_buf->h_name = buf;
result_buf->h_addrtype = type;
result_buf->h_length = addrlen;
@@ -2646,7 +2809,7 @@ libc_hidden_def(gethostbyaddr)
* 'exp_dn' is a pointer to a buffer of size 'length' for the result.
* Return size of compressed name or -1 if there was an error.
*/
-int dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
+int weak_function dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
char *dst, int dstsiz)
{
int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz);
@@ -2655,14 +2818,14 @@ int dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
dst[0] = '\0';
return n;
}
-libc_hidden_def(dn_expand)
+libc_hidden_weak(dn_expand)
/*
* Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
* Return the size of the compressed name or -1.
* 'length' is the size of the array pointed to by 'comp_dn'.
*/
-int
+int weak_function
dn_comp(const char *src, u_char *dst, int dstsiz,
u_char **dnptrs, u_char **lastdnptr)
{
@@ -2670,7 +2833,7 @@ dn_comp(const char *src, u_char *dst, int dstsiz,
(const u_char **) dnptrs,
(const u_char **) lastdnptr);
}
-libc_hidden_def(dn_comp)
+libc_hidden_weak(dn_comp)
#endif /* L_res_comp */
@@ -2710,7 +2873,7 @@ static int special(int ch)
* note:
* Root domain returns as "." not "".
*/
-int ns_name_uncompress(const u_char *msg, const u_char *eom,
+int weak_function ns_name_uncompress(const u_char *msg, const u_char *eom,
const u_char *src, char *dst, size_t dstsiz)
{
u_char tmp[NS_MAXCDNAME];
@@ -2723,7 +2886,7 @@ int ns_name_uncompress(const u_char *msg, const u_char *eom,
return -1;
return n;
}
-libc_hidden_def(ns_name_uncompress)
+libc_hidden_weak(ns_name_uncompress)
/*
* ns_name_ntop(src, dst, dstsiz)
@@ -2734,7 +2897,7 @@ libc_hidden_def(ns_name_uncompress)
* The root is returned as "."
* All other domains are returned in non absolute form
*/
-int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
+int weak_function ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
{
const u_char *cp;
char *dn, *eom;
@@ -2804,7 +2967,7 @@ int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
*dn++ = '\0';
return (dn - dst);
}
-libc_hidden_def(ns_name_ntop)
+libc_hidden_weak(ns_name_ntop)
static int encode_bitstring(const char **bp, const char *end,
unsigned char **labelp,
@@ -2918,7 +3081,7 @@ static int encode_bitstring(const char **bp, const char *end,
return 0;
}
-int ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
+int weak_function ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
{
static const char digits[] = "0123456789";
u_char *label, *bp, *eom;
@@ -3039,7 +3202,52 @@ int ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
errno = EMSGSIZE;
return -1;
}
-libc_hidden_def(ns_name_pton)
+libc_hidden_weak(ns_name_pton)
+
+/*
+ * __hnbad(dotted)
+ * Check whether a name is valid enough for DNS. The rules, as
+ * laid down by glibc, are:
+ * - printable input string
+ * - converts to label notation
+ * - each label only contains [0-9a-zA-Z_-], up to 63 octets
+ * - first label doesn’t begin with ‘-’
+ * This both is weaker than Unix hostnames (e.g. it allows
+ * underscores and leading/trailing hyphen-minus) and stronger
+ * than general (e.g. a leading “*.” is valid sometimes), take care.
+ * return:
+ * 0 if the name is ok
+ */
+int weak_function __hnbad(const char *dotted)
+{
+ unsigned char c, n, *cp;
+ unsigned char buf[NS_MAXCDNAME];
+
+ cp = (unsigned char *)dotted;
+ while ((c = *cp++))
+ if (c < 0x21 || c > 0x7E)
+ return (1);
+ if (ns_name_pton(dotted, buf, sizeof(buf)) < 0)
+ return (2);
+ if (buf[0] > 0 && buf[1] == '-')
+ return (3);
+ cp = buf;
+ while ((n = *cp++)) {
+ if (n > 63)
+ return (4);
+ while (n--) {
+ c = *cp++;
+ if (c < '-' ||
+ (c > '-' && c < '0') ||
+ (c > '9' && c < 'A') ||
+ (c > 'Z' && c < '_') ||
+ (c > '_' && c < 'a') ||
+ c > 'z')
+ return (5);
+ }
+ }
+ return (0);
+}
/*
* ns_name_unpack(msg, eom, src, dst, dstsiz)
@@ -3047,7 +3255,7 @@ libc_hidden_def(ns_name_pton)
* return:
* -1 if it fails, or consumed octets if it succeeds.
*/
-int ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
+int weak_function ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
u_char *dst, size_t dstsiz)
{
const u_char *srcp, *dstlim;
@@ -3114,7 +3322,7 @@ int ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
len = srcp - src;
return len;
}
-libc_hidden_def(ns_name_unpack)
+libc_hidden_weak(ns_name_unpack)
static int labellen(const unsigned char *lp)
{
@@ -3208,7 +3416,7 @@ next:
return -1;
}
-int ns_name_pack(const unsigned char *src,
+int weak_function ns_name_pack(const unsigned char *src,
unsigned char *dst, int dstsiz,
const unsigned char **dnptrs,
const unsigned char **lastdnptr)
@@ -3311,15 +3519,15 @@ cleanup:
if (msg != NULL)
*lpp = NULL;
- errno = EMSGSIZE;
- return -1;
+ errno = EMSGSIZE;
+ return -1;
}
return dstp - dst;
}
-libc_hidden_def(ns_name_pack)
+libc_hidden_weak(ns_name_pack)
-int ns_name_compress(const char *src,
+int weak_function ns_name_compress(const char *src,
unsigned char *dst, size_t dstsiz,
const unsigned char **dnptrs,
const unsigned char **lastdnptr)
@@ -3331,9 +3539,9 @@ int ns_name_compress(const char *src,
return ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr);
}
-libc_hidden_def(ns_name_compress)
+libc_hidden_weak(ns_name_compress)
-int ns_name_skip(const unsigned char **ptrptr,
+int weak_function ns_name_skip(const unsigned char **ptrptr,
const unsigned char *eom)
{
const unsigned char *cp;
@@ -3375,9 +3583,9 @@ int ns_name_skip(const unsigned char **ptrptr,
return 0;
}
-libc_hidden_def(ns_name_skip)
+libc_hidden_weak(ns_name_skip)
-int dn_skipname(const unsigned char *ptr, const unsigned char *eom)
+int weak_function dn_skipname(const unsigned char *ptr, const unsigned char *eom)
{
const unsigned char *saveptr = ptr;
@@ -3386,7 +3594,7 @@ int dn_skipname(const unsigned char *ptr, const unsigned char *eom)
return ptr - saveptr;
}
-libc_hidden_def(dn_skipname)
+libc_hidden_weak(dn_skipname)
#endif /* L_ns_name */
@@ -3395,7 +3603,7 @@ libc_hidden_def(dn_skipname)
/* Will be called under __resolv_lock. */
static void res_sync_func(void)
{
- struct __res_state *rp = &(_res);
+ struct __res_state *rp = __res_state();
int n;
/* If we didn't get malloc failure earlier... */
@@ -3947,7 +4155,8 @@ res_ninit(res_state statp)
#endif /* L_res_init */
#ifdef L_res_state
-# if defined __UCLIBC_HAS_TLS__
+# if !defined __UCLIBC_HAS_TLS__
+extern struct __res_state *__resp;
struct __res_state *
__res_state (void)
{
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c
index edb5ab87e..774ed6091 100644
--- a/libc/inet/socketcalls.c
+++ b/libc/inet/socketcalls.c
@@ -10,6 +10,10 @@
#include <cancel.h>
#include <bits/kernel-features.h>
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
#ifdef __NR_socketcall
/* Various socketcall numbers */
#define SYS_SOCKET 1
@@ -272,7 +276,9 @@ lt_libc_hidden(recvmsg)
static ssize_t __NC(recvmmsg)(int sockfd, struct mmsghdr *msg, size_t vlen,
int flags, struct timespec *tmo)
{
-# ifdef __NR_recvmmsg
+# if defined(__UCLIBC_USE_TIME64__) && defined(__NR_recvmmsg_time64)
+ return (ssize_t)INLINE_SYSCALL(recvmmsg_time64, 5, sockfd, msg, vlen, flags, TO_TS64_P(tmo));
+# elif defined(__NR_recvmmsg)
return (ssize_t)INLINE_SYSCALL(recvmmsg, 5, sockfd, msg, vlen, flags, tmo);
# elif __NR_socketcall
unsigned long args[5];
diff --git a/libc/misc/Makefile.in b/libc/misc/Makefile.in
index e45002e60..caf7f1391 100644
--- a/libc/misc/Makefile.in
+++ b/libc/misc/Makefile.in
@@ -5,7 +5,9 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+
include $(top_srcdir)libc/misc/assert/Makefile.in
+include $(top_srcdir)libc/misc/auxvt/Makefile.in
include $(top_srcdir)libc/misc/ctype/Makefile.in
include $(top_srcdir)libc/misc/dirent/Makefile.in
include $(top_srcdir)libc/misc/error/Makefile.in
@@ -14,6 +16,7 @@ include $(top_srcdir)libc/misc/file/Makefile.in
include $(top_srcdir)libc/misc/fnmatch/Makefile.in
include $(top_srcdir)libc/misc/ftw/Makefile.in
include $(top_srcdir)libc/misc/fts/Makefile.in
+include $(top_srcdir)libc/misc/getloadavg/Makefile.in
include $(top_srcdir)libc/misc/glob/Makefile.in
include $(top_srcdir)libc/misc/internals/Makefile.in
include $(top_srcdir)libc/misc/locale/Makefile.in
diff --git a/libc/misc/auxvt/Makefile.in b/libc/misc/auxvt/Makefile.in
new file mode 100644
index 000000000..142ade10c
--- /dev/null
+++ b/libc/misc/auxvt/Makefile.in
@@ -0,0 +1,23 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libc/misc/auxvt
+
+CSRC-y := getauxval.c
+
+MISC_AUXVT_DIR := $(top_srcdir)libc/misc/auxvt
+MISC_AUXVT_OUT := $(top_builddir)libc/misc/auxvt
+
+MISC_AUXVT_SRC := $(patsubst %.c,$(MISC_AUXVT_DIR)/%.c,$(CSRC-y))
+MISC_AUXVT_OBJ := $(patsubst %.c,$(MISC_AUXVT_OUT)/%.o,$(CSRC-y))
+
+libc-y += $(MISC_AUXVT_OBJ)
+
+objclean-y += CLEAN_libc/misc/auxvt
+
+CLEAN_libc/misc/auxvt:
+ $(do_rm) $(addprefix $(MISC_AUXVT_OUT)/*., o os)
diff --git a/libc/misc/auxvt/getauxval.c b/libc/misc/auxvt/getauxval.c
new file mode 100755
index 000000000..2bdffaf2c
--- /dev/null
+++ b/libc/misc/auxvt/getauxval.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2022 Ramin Seyed Moussavi
+ * An getauxval() function compatible with the glibc auxv.h
+ * that is used by uClibc-ng.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "errno.h"
+#include "ldso.h"
+#include "sys/auxv.h"
+
+
+/*
+ *
+ * aarch64 gcc 11 uses __getauxval() in init_have_lse_atomics()
+ *
+ */
+unsigned long int __getauxval (unsigned long int __type)
+{
+ if ( __type >= AUX_MAX_AT_ID ){
+ __set_errno (ENOENT);
+ return 0;
+ }
+
+ if ( _dl_auxvt[__type].a_type == __type){
+ return _dl_auxvt[__type].a_un.a_val;
+ }
+
+ __set_errno (ENOENT);
+ return 0;
+}
+
+unsigned long int getauxval (unsigned long int __type){
+ return __getauxval( __type );
+}
+
diff --git a/libc/misc/fnmatch/fnmatch_loop.c b/libc/misc/fnmatch/fnmatch_loop.c
index fdd451d43..025510de6 100644
--- a/libc/misc/fnmatch/fnmatch_loop.c
+++ b/libc/misc/fnmatch/fnmatch_loop.c
@@ -620,7 +620,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
if (c == L('-') && *p != L(']'))
{
-#if _LIBC
+#ifdef _LIBC
/* We have to find the collation sequence
value for C. Collation sequence is nothing
we can regularly access. The sequence
@@ -917,7 +917,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
}
else if (c == L('[') && *p == L('.'))
{
- ++p;
while (1)
{
c = *++p;
diff --git a/libc/misc/getloadavg/Makefile b/libc/misc/getloadavg/Makefile
new file mode 100644
index 000000000..4a8f4a072
--- /dev/null
+++ b/libc/misc/getloadavg/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/getloadavg/Makefile.in b/libc/misc/getloadavg/Makefile.in
new file mode 100644
index 000000000..3c8ca24f0
--- /dev/null
+++ b/libc/misc/getloadavg/Makefile.in
@@ -0,0 +1,23 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libc/misc/getloadavg
+
+CSRC-y := getloadavg.c
+
+MISC_GETLOADAVG_DIR := $(top_srcdir)libc/misc/getloadavg
+MISC_GETLOADAVG_OUT := $(top_builddir)libc/misc/getloadavg
+
+MISC_GETLOADAVG_SRC := $(patsubst %.c,$(MISC_GETLOADAVG_DIR)/%.c,$(CSRC-y))
+MISC_GETLOADAVG_OBJ := $(patsubst %.c,$(MISC_GETLOADAVG_OUT)/%.o,$(CSRC-y))
+
+libc-y += $(MISC_GETLOADAVG_OBJ)
+
+objclean-y += CLEAN_libc/misc/getloadavg
+
+CLEAN_libc/misc/getloadavg:
+ $(do_rm) $(addprefix $(MISC_GETLOADAVG_OUT)/*., o os)
diff --git a/libc/misc/getloadavg/getloadavg.c b/libc/misc/getloadavg/getloadavg.c
new file mode 100644
index 000000000..0d98119a9
--- /dev/null
+++ b/libc/misc/getloadavg/getloadavg.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2005-2020 Rich Felker, et al.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Imported from musl C library
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif /* _GNU_SOURCE */
+#include <stdlib.h>
+#include <sys/sysinfo.h>
+
+int getloadavg(double *a, int n)
+{
+ struct sysinfo si;
+ if (n <= 0) return n ? -1 : 0;
+ sysinfo(&si);
+ if (n > 3) n = 3;
+ for (int i=0; i<n; i++)
+ a[i] = 1.0/(1<<SI_LOAD_SHIFT) * si.loads[i];
+ return n;
+}
diff --git a/libc/misc/internals/Makefile.in b/libc/misc/internals/Makefile.in
index a8e4e36f9..908b18321 100644
--- a/libc/misc/internals/Makefile.in
+++ b/libc/misc/internals/Makefile.in
@@ -17,7 +17,7 @@ MISC_INTERNALS_SRC := $(patsubst %.c,$(MISC_INTERNALS_DIR)/%.c,$(CSRC-y))
MISC_INTERNALS_OBJ := $(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC-y))
CFLAGS-__uClibc_main.c := $(SSP_DISABLE_FLAGS)
-
+CFLAGS-reloc_static_pie.c := $(SSP_DISABLE_FLAGS) -DL_rcrt1
libc-y += $(MISC_INTERNALS_OBJ)
ifneq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
@@ -34,6 +34,7 @@ libc-static-$(UCLIBC_FORMAT_FLAT_SEP_DATA) += \
libc-static-$(UCLIBC_FORMAT_SHARED_FLAT) += \
$(MISC_INTERNALS_OUT)/shared_flat_initfini.o \
$(MISC_INTERNALS_OUT)/shared_flat_add_library.o
+libc-static-$(STATIC_PIE) += $(MISC_INTERNALS_OUT)/reloc_static_pie.o
libc-shared-$(UCLIBC_FORMAT_SHARED_FLAT) += \
$(MISC_INTERNALS_OUT)/shared_flat_initfini.os \
$(MISC_INTERNALS_OUT)/shared_flat_add_library.os
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index affa0ce0a..64a9c8214 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -109,7 +109,7 @@ void internal_function _dl_aux_init (ElfW(auxv_t) *av);
* in or linker will disregard these weaks.
*/
-static int __pthread_return_0 (pthread_mutex_t *unused) { return 0; }
+static int __pthread_return_0 (pthread_mutex_t *unused) { (void)unused; return 0; }
weak_alias (__pthread_return_0, __pthread_mutex_lock)
weak_alias (__pthread_return_0, __pthread_mutex_trylock)
weak_alias (__pthread_return_0, __pthread_mutex_unlock)
@@ -117,6 +117,7 @@ weak_alias (__pthread_return_0, __pthread_mutex_unlock)
int weak_function
__pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
+ (void)mutex; (void)attr;
return 0;
}
diff --git a/libc/misc/internals/reloc_static_pie.c b/libc/misc/internals/reloc_static_pie.c
new file mode 100644
index 000000000..81af7d666
--- /dev/null
+++ b/libc/misc/internals/reloc_static_pie.c
@@ -0,0 +1,113 @@
+/* Support for relocating static PIE.
+ Copyright (C) 2017-2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+#define IS_IN_rtld // force inline function calls
+#include <link.h>
+#include <elf.h>
+#include <dl-elf.h>
+
+#include <ldso.h>
+#if defined(__mips__) || defined(__xtensa__)
+#include <dl-startup.h>
+#endif
+
+extern ElfW(Addr) _dl_load_base;
+
+void
+reloc_static_pie (ElfW(Addr) load_addr);
+
+void
+reloc_static_pie(ElfW(Addr) load_addr)
+{
+ int indx;
+ ElfW(Addr) got;
+ ElfW(Dyn) *dpnt;
+ struct elf_resolve tpnt_tmp;
+ struct elf_resolve *tpnt = &tpnt_tmp;
+
+ DL_BOOT_COMPUTE_GOT(got);
+ DL_BOOT_COMPUTE_DYN(dpnt, got, (DL_LOADADDR_TYPE)load_addr);
+
+ _dl_memset(tpnt, 0, sizeof(struct elf_resolve));
+ tpnt->loadaddr = load_addr;
+ tpnt->dynamic_addr = dpnt;
+
+ __dl_parse_dynamic_info(dpnt, tpnt->dynamic_info, NULL, load_addr);
+
+#if defined(PERFORM_BOOTSTRAP_GOT)
+ /* some arches (like MIPS) we have to tweak the GOT before relocations */
+ PERFORM_BOOTSTRAP_GOT(tpnt);
+#endif
+
+#if !defined(__FDPIC__)
+ DL_RELOCATE_RELR(tpnt);
+#endif
+
+#if defined(ELF_MACHINE_PLTREL_OVERLAP)
+# define INDX_MAX 1
+#else
+# define INDX_MAX 2
+#endif
+
+ for (indx = 0; indx < INDX_MAX; indx++) {
+ unsigned long rel_addr, rel_size;
+ ElfW(Word) relative_count = tpnt->dynamic_info[DT_RELCONT_IDX];
+
+ rel_addr = (indx ? tpnt->dynamic_info[DT_JMPREL] :
+ tpnt->dynamic_info[DT_RELOC_TABLE_ADDR]);
+ rel_size = (indx ? tpnt->dynamic_info[DT_PLTRELSZ] :
+ tpnt->dynamic_info[DT_RELOC_TABLE_SIZE]);
+
+ if (!rel_addr)
+ continue;
+
+ if((0 == indx) && relative_count) {
+ rel_size -= relative_count * sizeof(ELF_RELOC);
+ elf_machine_relative(load_addr, rel_addr, relative_count);
+ rel_addr += relative_count * sizeof(ELF_RELOC);
+ }
+
+#ifdef ARCH_NEEDS_BOOTSTRAP_RELOCS
+ {
+ ELF_RELOC *rpnt;
+ unsigned int i;
+ ElfW(Sym) *sym;
+ unsigned long symbol_addr;
+ int symtab_index;
+ unsigned long *reloc_addr;
+
+ /* Now parse the relocation information */
+ rpnt = (ELF_RELOC *) rel_addr;
+ for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), rpnt++) {
+ reloc_addr = (unsigned long *) DL_RELOC_ADDR(load_addr, (unsigned long)rpnt->r_offset);
+ symtab_index = ELF_R_SYM(rpnt->r_info);
+ symbol_addr = 0;
+ sym = NULL;
+ if (symtab_index) {
+ ElfW(Sym) *symtab;
+ symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB];
+ sym = &symtab[symtab_index];
+ symbol_addr = (unsigned long) DL_RELOC_ADDR(load_addr, sym->st_value);
+ }
+ /* Use this machine-specific macro to perform the actual relocation. */
+ PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr, sym);
+ }
+ }
+#endif
+ }
+ _dl_load_base = load_addr;
+}
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c
index d3a8ccbd8..f9b714a68 100644
--- a/libc/misc/internals/tempname.c
+++ b/libc/misc/internals/tempname.c
@@ -218,7 +218,8 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind, int flags,
/* Give up now. */
return -1;
} else
- fd = 0;
+ /* File already exists, so return with non-zero value */
+ return -1;
}
case __GT_FILE:
fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL | flags, mode);
diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c
index 608f84c1a..610e35af6 100644
--- a/libc/misc/mntent/mntent.c
+++ b/libc/misc/mntent/mntent.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ * Copyright (C) 1995-2020 Free Software Foundation, Inc.
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
@@ -92,9 +93,25 @@ int addmntent(FILE * filep, const struct mntent *mnt)
mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq, mnt->mnt_passno) < 0 ? 1 : 0);
}
-char *hasmntopt(const struct mntent *mnt, const char *opt)
+/* Search MNT->mnt_opts for an option matching OPT.
+ Returns the address of the substring, or null if none found. */
+char *hasmntopt (const struct mntent *mnt, const char *opt)
{
- return strstr(mnt->mnt_opts, opt);
+ const size_t optlen = strlen(opt);
+ char *rest = mnt->mnt_opts, *p;
+
+ while ((p = strstr(rest, opt)) != NULL) {
+ if ((p == rest || p[-1] == ',')
+ && (p[optlen] == '\0' || p[optlen] == '=' || p[optlen] == ','))
+ return p;
+
+ rest = strchr(p, ',');
+ if (rest == NULL)
+ break;
+ ++rest;
+ }
+
+ return NULL;
}
FILE *setmntent(const char *name, const char *mode)
diff --git a/libc/misc/regex/regex_internal.h b/libc/misc/regex/regex_internal.h
index 5d9154fa0..c0f61d4ce 100644
--- a/libc/misc/regex/regex_internal.h
+++ b/libc/misc/regex/regex_internal.h
@@ -58,7 +58,7 @@
#define gettext(msgid) (msgid)
#define gettext_noop(String) String
-#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL)
+#if (defined MB_CUR_MAX && defined HAVE_LOCALE_H && defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_WCRTOMB && defined HAVE_MBRTOWC && defined HAVE_WCSCOLL)
# define RE_ENABLE_I18N
#endif
diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c
index 64be1cae0..07076eff7 100644
--- a/libc/misc/sysvipc/sem.c
+++ b/libc/misc/sysvipc/sem.c
@@ -23,6 +23,9 @@
#include "ipc.h"
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
#ifdef L_semctl
/* Return identifier for array of NSEMS semaphores associated with
@@ -53,7 +56,12 @@ int semctl(int semid, int semnum, int cmd, ...)
arg = va_arg (ap, union semun);
va_end (ap);
#ifdef __NR_semctl
- return __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
+ int __ret = __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
+#if defined(__UCLIBC_USE_TIME64__)
+ arg.buf->sem_otime = (__time_t)arg.buf->__sem_otime_internal_1 | (__time_t)(arg.buf->__sem_otime_internal_2) << 32;
+ arg.buf->sem_ctime = (__time_t)arg.buf->__sem_ctime_internal_1 | (__time_t)(arg.buf->__sem_ctime_internal_2) << 32;
+#endif
+ return __ret;
#else
return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd|__IPC_64, &arg, NULL);
#endif
@@ -90,7 +98,13 @@ int semop (int semid, struct sembuf *sops, size_t nsops)
#ifdef L_semtimedop
-#ifdef __NR_semtimedop
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_semtimedop_time64)
+int semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout)
+{
+ return INLINE_SYSCALL(semtimedop_time64, 4, semid, sops, nsops, TO_TS64_P(timeout));
+}
+
+#elif defined(__NR_semtimedop)
_syscall4(int, semtimedop, int, semid, struct sembuf *, sops, size_t, nsops, const struct timespec *, timeout)
#else
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index cd189169a..b6a5b097d 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -1311,7 +1311,7 @@ ISO_LOOP:
j = (i & 128) ? 100: 12;
if (i & 64) {
- field_val /= j;;
+ field_val /= j;
}
if (i & 32) {
field_val %= j;
@@ -2478,9 +2478,16 @@ DST_CORRECT:
+ p[3]) + p[7])));
DST_CORRECT:
+#if defined(__UCLIBC_USE_TIME64__)
+ if (((unsigned long long)(secs - LLONG_MIN))
+ > (((unsigned long long)LLONG_MAX) - LLONG_MIN)
+ )
+#else
if (((unsigned long long)(secs - LONG_MIN))
> (((unsigned long long)LONG_MAX) - LONG_MIN)
- ) {
+ )
+#endif
+ {
t = ((time_t)(-1));
goto DONE;
}
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index 201f30772..2714d47d7 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -781,6 +781,7 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
size_t count;
int incr;
char buf[MB_LEN_MAX];
+ (void)ps;
#ifdef __CTYPE_HAS_UTF_8_LOCALES
if (ENCODING == __ctype_encoding_utf8) {
diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c
index 3557a039e..b237534cd 100644
--- a/libc/signal/sigwait.c
+++ b/libc/signal/sigwait.c
@@ -24,7 +24,8 @@
#include <signal.h>
#include <cancel.h>
-#if defined __NR_rt_sigtimedwait && defined __UCLIBC_HAS_REALTIME__
+#if (defined(__NR_rt_sigtimedwait) || (defined(__UCLIBC_USE_TIME64__) && defined(__NR_rt_sigtimedwait_time64))) && \
+ defined(__UCLIBC_HAS_REALTIME__)
#include <string.h>
diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c
index 3baf75fdd..757a05ecf 100644
--- a/libc/stdlib/malloc-simple/alloc.c
+++ b/libc/stdlib/malloc-simple/alloc.c
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
#include <errno.h>
#include <sys/mman.h>
#include <malloc.h>
@@ -28,6 +29,15 @@ void *malloc(size_t size)
size++;
}
+ /* prevent Undefined Behaviour for pointer arithmetic (substract) of too big pointers
+ * see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
+ * No need to check for size + sizeof(size_t) integer overflow since we already check for PTRDIFF_MAX
+ */
+ if (unlikely(size > PTRDIFF_MAX)) {
+ __set_errno(ENOMEM);
+ return 0;
+ }
+
#ifdef __ARCH_USE_MMU__
# define MMAP_FLAGS MAP_PRIVATE | MAP_ANONYMOUS
#else
@@ -148,6 +158,16 @@ void * memalign (size_t alignment, size_t size)
void * result;
unsigned long int adj;
+ if (unlikely(size > PTRDIFF_MAX)) {
+ __set_errno(ENOMEM);
+ return NULL;
+ }
+
+ if (unlikely((size + alignment - 1 < size) && (alignment != 0))) {
+ __set_errno(ENOMEM);
+ return NULL;
+ }
+
result = malloc (size + alignment - 1);
if (result == NULL)
return NULL;
diff --git a/libc/stdlib/malloc-standard/malloc.c b/libc/stdlib/malloc-standard/malloc.c
index 1f898eb29..cecea87ec 100644
--- a/libc/stdlib/malloc-standard/malloc.c
+++ b/libc/stdlib/malloc-standard/malloc.c
@@ -176,6 +176,7 @@ void __do_check_remalloced_chunk(mchunkptr p, size_t s)
size_t sz = p->size & ~PREV_INUSE;
#endif
+ (void)s;
__do_check_inuse_chunk(p);
/* Legal size ... */
diff --git a/libc/stdlib/malloc-standard/reallocarray.c b/libc/stdlib/malloc-standard/reallocarray.c
new file mode 100644
index 000000000..e4044c3f5
--- /dev/null
+++ b/libc/stdlib/malloc-standard/reallocarray.c
@@ -0,0 +1,36 @@
+/*
+Copyright © 2005-2020 Rich Felker, et al.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#define _BSD_SOURCE
+#include <errno.h>
+#include <stdlib.h>
+
+void *reallocarray(void *ptr, size_t m, size_t n)
+{
+ if (n && m > -1 / n) {
+ errno = ENOMEM;
+ return 0;
+ }
+
+ return realloc(ptr, m * n);
+}
diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c
index b009c4310..05ce3fe84 100644
--- a/libc/stdlib/random.c
+++ b/libc/stdlib/random.c
@@ -139,8 +139,8 @@ static struct random_data unsafe_state =
in the initialization of randtbl) because the state table pointer is set
to point to randtbl[1] (as explained below).) */
- fptr : &randtbl[SEP_3 + 1],
- rptr : &randtbl[1],
+ .fptr = &randtbl[SEP_3 + 1],
+ .rptr = &randtbl[1],
/* The following things are the pointer to the state information table,
the type of the current generator, the degree of the current polynomial
@@ -152,13 +152,13 @@ static struct random_data unsafe_state =
indexing every time to find the address of the last element to see if
the front and rear pointers have wrapped. */
- state : &randtbl[1],
+ .state = &randtbl[1],
- rand_type : TYPE_3,
- rand_deg : DEG_3,
- rand_sep : SEP_3,
+ .rand_type = TYPE_3,
+ .rand_deg = DEG_3,
+ .rand_sep = SEP_3,
- end_ptr : &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
+ .end_ptr = &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
};
diff --git a/libc/string/arc/memcmp.S b/libc/string/arc/memcmp.S
index a60757e7a..20122a296 100644
--- a/libc/string/arc/memcmp.S
+++ b/libc/string/arc/memcmp.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
+ * Copyright (C) 2013, 2022 Synopsys, Inc. (www.synopsys.com)
* Copyright (C) 2007 ARC International (UK) LTD
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
@@ -17,6 +17,8 @@
#endif
ENTRY(memcmp)
+
+#if defined(__ARC700__) || defined(__ARCHS__)
or r12,r0,r1
asl_s r12,r12,30
sub r3,r2,1
@@ -149,6 +151,96 @@ ENTRY(memcmp)
.Lnil:
j_s.d [blink]
mov r0,0
+
+#elif (__ARC64_ARCH32__)
+ ;; Based on Synopsys code from newlib's arc64/memcmp.S
+ cmp r2, 32
+ bls.d @.L_compare_1_bytes
+ mov r3, r0 ; "r0" will be used as return value
+
+ lsr r12, r2, 4 ; counter for 16-byte chunks
+ xor r13, r13, r13 ; the mask showing inequal registers
+
+.L_compare_16_bytes:
+ ld.ab r4, [r3, +4]
+ ld.ab r5, [r1, +4]
+ ld.ab r6, [r3, +4]
+ ld.ab r7, [r1, +4]
+ ld.ab r8, [r3, +4]
+ ld.ab r9, [r1, +4]
+ ld.ab r10, [r3, +4]
+ ld.ab r11, [r1, +4]
+ xor.f 0, r4, r5
+ xor.ne r13, r13, 0b0001
+ xor.f 0, r6, r7
+ xor.ne r13, r13, 0b0010
+ xor.f 0, r8, r9
+ xor.ne r13, r13, 0b0100
+ xor.f 0, r10, r11
+ xor.ne r13, r13, 0b1000
+ brne r13, 0, @.L_unequal_find
+ dbnz r12, @.L_compare_16_bytes
+
+ ;; Adjusting the pointers because of the extra loads in the end
+ sub r1, r1, 4
+ sub r3, r3, 4
+ bmsk_s r2, r2, 3 ; any remaining bytes to compare
+
+.L_compare_1_bytes:
+ cmp r2, 0
+ jeq.d [blink]
+ xor_s r0, r0, r0
+
+2:
+ ldb.ab r4, [r3, +1]
+ ldb.ab r5, [r1, +1]
+ sub.f r0, r4, r5
+ jne [blink]
+ dbnz r2, @2b
+ j_s [blink]
+
+ ;; At this point, we want to find the _first_ comparison that marked the
+ ;; inequality of "lhs" and "rhs"
+.L_unequal_find:
+ ffs r13, r13
+ asl r13, r13, 2
+ bi [r13]
+.L_unequal_r4r5:
+ mov r1, r4
+ b.d @.L_diff_byte_in_regs
+ mov r2, r5
+ nop
+.L_unequal_r6r7:
+ mov r1, r6
+ b.d @.L_diff_byte_in_regs
+ mov r2, r7
+ nop
+.L_unequal_r8r9:
+ mov r1, r8
+ b.d @.L_diff_byte_in_regs
+ mov r2, r9
+ nop
+.L_unequal_r10r11:
+ mov r1, r10
+ mov r2, r11
+
+ ;; fall-through
+ ;; If we're here, that means the two operands are not equal.
+.L_diff_byte_in_regs:
+ xor r0, r1, r2
+ ffs r0, r0
+ and r0, r0, 0x18
+ lsr r1, r1, r0
+ lsr r2, r2, r0
+ bmsk_s r1, r1, 7
+ bmsk_s r2, r2, 7
+ j_s.d [blink]
+ sub r0, r1, r2
+
+#else
+#error "Unsupported ARC CPU type"
+#endif
+
END(memcmp)
libc_hidden_def(memcmp)
diff --git a/libc/string/arc/memcpy.S b/libc/string/arc/memcpy.S
index 69d7220b8..153083765 100644
--- a/libc/string/arc/memcpy.S
+++ b/libc/string/arc/memcpy.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014-2015, 2017 Synopsys, Inc. (www.synopsys.com)
+ * Copyright (C) 2013, 2014-2015, 2017, 2022 Synopsys, Inc. (www.synopsys.com)
* Copyright (C) 2007 ARC International (UK) LTD
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
@@ -7,13 +7,9 @@
#include <sysdep.h>
-#if !defined(__ARC700__) && !defined(__ARCHS__)
-#error "Neither ARC700 nor ARCHS is defined!"
-#endif
-
ENTRY(memcpy)
-#ifdef __ARC700__
+#if defined(__ARC700__)
/* This memcpy implementation does not support objects of 1GB or larger -
the check for alignment does not work then. */
/* We assume that most sources and destinations are aligned, and
@@ -73,9 +69,9 @@ ENTRY(memcpy)
.Lendbloop:
j_s.d [blink]
stb r12,[r5,0]
-#endif /* __ARC700__ */
-#ifdef __ARCHS__
+#elif defined(__ARCHS__)
+
#ifdef __LITTLE_ENDIAN__
# define SHIFT_1(RX,RY,IMM) asl RX, RY, IMM ; <<
# define SHIFT_2(RX,RY,IMM) lsr RX, RY, IMM ; >>
@@ -299,7 +295,58 @@ ENTRY(memcpy)
stb.ab r6, [r3,1]
.Lcopybytewise_3:
j [blink]
-#endif /* __ARCHS__ */
+
+#elif defined(__ARC64_ARCH32__)
+ ;; Based on Synopsys code from newlib's arc64/memcpy.S
+ lsr.f r11, r2, 4 ; counter for 16-byte chunks
+ beq.d @.L_write_15_bytes
+ mov r3, r0 ; work on a copy of "r0"
+
+.L_write_16_bytes:
+#if defined(__ARC64_LL64__)
+ ldd.ab r4, [r1, 8]
+ ldd.ab r6, [r1, 8]
+ std.ab r4, [r3, 8]
+ std.ab r6, [r3, 8]
+ dbnz r11, @.L_write_16_bytes
+#else
+ ld.ab r4, [r1, 4]
+ ld.ab r5, [r1, 4]
+ ld.ab r6, [r1, 4]
+ ld.ab r7, [r1, 4]
+ st.ab r4, [r3, 4]
+ st.ab r5, [r3, 4]
+ st.ab r6, [r3, 4]
+ dbnz.d r11, @.L_write_16_bytes
+ st.ab r7, [r3, 4]
+#endif
+ bmsk_s r2, r2, 3
+
+.L_write_15_bytes:
+ bbit0.d r2, 1, @1f
+ lsr r11, r2, 2
+ ldh.ab r4, [r1, 2]
+ sth.ab r4, [r3, 2]
+1:
+ bbit0.d r2, 0, @1f
+ xor r11, r11, 3
+ ldb.ab r4, [r1, 1]
+ stb.ab r4, [r3, 1]
+1:
+ asl r11, r11, 1
+ bi [r11]
+ ld.ab r4,[r1, 4]
+ st.ab r4,[r3, 4]
+ ld.ab r4,[r1, 4]
+ st.ab r4,[r3, 4]
+ ld r4,[r1]
+ st r4,[r3]
+
+ j_s [blink]
+
+#else
+#error "Unsupported ARC CPU type"
+#endif
END(memcpy)
libc_hidden_def(memcpy)
diff --git a/libc/string/arc/memset.S b/libc/string/arc/memset.S
index 0b74ddc7f..5aa5d6c65 100644
--- a/libc/string/arc/memset.S
+++ b/libc/string/arc/memset.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014-2015, 2017 Synopsys, Inc. (www.synopsys.com)
+ * Copyright (C) 2013, 2014-2015, 2017, 2022 Synopsys, Inc. (www.synopsys.com)
* Copyright (C) 2007 ARC International (UK) LTD
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
@@ -7,13 +7,9 @@
#include <sysdep.h>
-#if !defined(__ARC700__) && !defined(__ARCHS__)
-#error "Neither ARC700 nor ARCHS is defined!"
-#endif
-
ENTRY(memset)
-#ifdef __ARC700__
+#if defined(__ARC700__)
#define SMALL 7 /* Must be at least 6 to deal with alignment/loop issues. */
mov_s r4,r0
@@ -52,9 +48,8 @@ ENTRY(memset)
stb.ab r1,[r4,1]
.Ltiny_end:
j_s [blink]
-#endif /* __ARC700__ */
-#ifdef __ARCHS__
+#elif defined(__ARCHS__)
#ifdef DONT_USE_PREALLOC
#define PREWRITE(A,B) prefetchw [(A),(B)]
#else
@@ -156,7 +151,55 @@ ENTRY(memset)
.Lcopy3bytes:
j [blink]
-#endif /* __ARCHS__ */
+
+#elif defined(__ARC64_ARCH32__)
+ ;; Based on Synopsys code from newlib's arc64/memset.S
+
+ ;; Assemble the bytes to 32bit words
+ bmsk_s r1, r1, 7 ; treat it like unsigned char
+ lsl8 r3, r1
+ or_s r1, r1, r3
+ lsl16 r3, r1
+ or r6, r1, r3
+ mov r7,r6
+
+ lsr.f r5, r2, 4 ; counter for 16-byte chunks
+ beq.d @.L_write_15_bytes
+ mov r4, r0 ; work on a copy of "r0"
+
+.L_write_16_bytes:
+#if defined(__ARC64_LL64__)
+ std.ab r6, [r4, 8]
+ std.ab r6, [r4, 8]
+ dbnz r5, @.L_write_16_bytes
+#else
+ st.ab r6, [r4, 4]
+ st.ab r6, [r4, 4]
+ st.ab r6, [r4, 4]
+ dbnz.d r5, @.L_write_16_bytes
+ st.ab r6, [r4, 4]
+#endif
+ bmsk_s r2, r2, 3
+
+.L_write_15_bytes:
+ bbit0.d r2, 1, @1f
+ lsr r3, r2, 2
+ sth.ab r6, [r4, 2]
+1:
+ bbit0.d r2, 0, @1f
+ xor r3, r3, 3
+ stb.ab r6, [r4, 1]
+1:
+ bi [r3]
+ st.ab r6,[r4, 4]
+ st.ab r6,[r4, 4]
+ st.ab r6,[r4, 4]
+
+ j_s [blink]
+
+#else
+#error "Unsupported ARC CPU type"
+#endif
END(memset)
libc_hidden_def(memset)
diff --git a/libc/string/arc/strchr.S b/libc/string/arc/strchr.S
index 443993589..df25eb3be 100644
--- a/libc/string/arc/strchr.S
+++ b/libc/string/arc/strchr.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
+ * Copyright (C) 2013, 2022 Synopsys, Inc. (www.synopsys.com)
* Copyright (C) 2007 ARC International (UK) LTD
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
@@ -7,6 +7,7 @@
#include <sysdep.h>
#include <features.h>
+#include <asm.h>
/* ARC700 has a relatively long pipeline and branch prediction, so we want
to avoid branches that are hard to predict. On the other hand, the
@@ -21,7 +22,7 @@ ENTRY(strchr)
mov_s r3,0x01010101
breq.d r2,r0,.Laligned
asl r4,r5,16
- sub_s r0,r0,r2
+ SUBR_S r0,r0,r2
asl r7,r2,3
ld_s r2,[r0]
#ifdef __LITTLE_ENDIAN__
@@ -77,10 +78,10 @@ ENTRY(strchr)
sub r3,r7,1
bic r3,r3,r7
norm r2,r3
- sub_s r0,r0,1
- asr_s r2,r2,3
+ SUBR_S r0,r0,1
+ ASRR_S r2,r2,3
j.d [blink]
- sub_s r0,r0,r2
+ SUBR_S r0,r0,r2
.balign 4
.Lfound0_ua:
@@ -90,13 +91,13 @@ ENTRY(strchr)
bic r3,r3,r6
and r2,r3,r4
or_s r12,r12,r2
- sub_s r3,r12,1
+ SUBR_S r3,r12,1
bic_s r3,r3,r12
norm r3,r3
- add_s r0,r0,3
- asr_s r12,r3,3
+ ADDR_S r0,r0,3
+ ASRR_S r12,r3,3
asl.f 0,r2,r3
- sub_s r0,r0,r12
+ SUBR_S r0,r0,r12
j_s.d [blink]
mov.pl r0,0
#else /* BIG ENDIAN */
@@ -106,10 +107,10 @@ ENTRY(strchr)
bic r2,r7,r6
.Lfound_char_b:
norm r2,r2
- sub_s r0,r0,4
+ SUBR_S r0,r0,4
asr_s r2,r2,3
j.d [blink]
- add_s r0,r0,r2
+ ADDR_S r0,r0,r2
.Lfound0_ua:
mov_s r3,r7
@@ -126,7 +127,7 @@ ENTRY(strchr)
add.pl r3,r3,1
asr_s r12,r3,3
asl.f 0,r2,r3
- add_s r0,r0,r12
+ ADDR_S r0,r0,r12
j_s.d [blink]
mov.mi r0,0
#endif /* ENDIAN */
diff --git a/libc/string/arc/strcmp.S b/libc/string/arc/strcmp.S
index ad38d9e00..48d2d7ec1 100644
--- a/libc/string/arc/strcmp.S
+++ b/libc/string/arc/strcmp.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014-2015, 2017 Synopsys, Inc. (www.synopsys.com)
+ * Copyright (C) 2013, 2014-2015, 2017, 2022 Synopsys, Inc. (www.synopsys.com)
* Copyright (C) 2007 ARC International (UK) LTD
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
@@ -7,14 +7,11 @@
#include <features.h>
#include <sysdep.h>
-
-#if !defined(__ARC700__) && !defined(__ARCHS__)
-#error "Neither ARC700 nor ARCHS is defined!"
-#endif
+#include <asm.h>
ENTRY(strcmp)
-#ifdef __ARC700__
+#if defined(__ARC700__) || defined(__ARC64_ARCH32__)
/* This is optimized primarily for the ARC700.
It would be possible to speed up the loops by one cycle / word
respective one cycle / byte by forcing double source 1 alignment, unrolling
@@ -38,7 +35,7 @@ ENTRY(strcmp)
breq r2,r3,.Lwordloop
#ifdef __LITTLE_ENDIAN__
xor r0,r2,r3 ; mask for difference
- sub_s r1,r0,1
+ SUBR_S r1,r0,1
bic_s r0,r0,r1 ; mask for least significant difference bit
sub r1,r5,r0
xor r0,r5,r1 ; mask for least significant difference byte
@@ -55,7 +52,7 @@ ENTRY(strcmp)
.Lfound0:
xor r0,r2,r3 ; mask for difference
or r0,r0,r4 ; or in zero indicator
- sub_s r1,r0,1
+ SUBR_S r1,r0,1
bic_s r0,r0,r1 ; mask for least significant difference bit
sub r1,r5,r0
xor r0,r5,r1 ; mask for least significant difference byte
@@ -99,31 +96,28 @@ ENTRY(strcmp)
.Lcmpend:
j_s.d [blink]
sub r0,r2,r3
-#endif /* __ARC700__ */
-#ifdef __ARCHS__
+#elif defined(__ARCHS__)
or r2, r0, r1
bmsk_s r2, r2, 1
brne r2, 0, @.Lcharloop
;;; s1 and s2 are word aligned
- ld.ab r2, [r0, 4]
mov_s r12, 0x01010101
ror r11, r12
.align 4
.LwordLoop:
+ ld.ab r2, [r0, 4]
+ sub r4, r2, r12
ld.ab r3, [r1, 4]
;; Detect NULL char in str1
- sub r4, r2, r12
- ld.ab r5, [r0, 4]
bic r4, r4, r2
and r4, r4, r11
brne.d.nt r4, 0, .LfoundNULL
;; Check if the read locations are the same
cmp r2, r3
- beq.d .LwordLoop
- mov.eq r2, r5
+ beq .LwordLoop
;; A match is found, spot it out
#ifdef __LITTLE_ENDIAN__
@@ -168,7 +162,10 @@ ENTRY(strcmp)
.Lcmpend:
j_s.d [blink]
sub r0, r2, r3
-#endif /* __ARCHS__ */
+
+#else
+#error "Unsupported ARC CPU type"
+#endif
END(strcmp)
libc_hidden_def(strcmp)
diff --git a/libc/string/arc/strlen.S b/libc/string/arc/strlen.S
index 0b9b93815..0d1d3aa4e 100644
--- a/libc/string/arc/strlen.S
+++ b/libc/string/arc/strlen.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
+ * Copyright (C) 2013, 2022 Synopsys, Inc. (www.synopsys.com)
* Copyright (C) 2007 ARC International (UK) LTD
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
@@ -7,6 +7,7 @@
#include <sysdep.h>
+#include <asm.h>
ENTRY(strlen)
or r3,r0,7
@@ -15,7 +16,7 @@ ENTRY(strlen)
mov r4,0x01010101
; uses long immediate
#ifdef __LITTLE_ENDIAN__
- asl_s r1,r0,3
+ ASLR_S r1,r0,3
btst_s r0,2
asl r7,r4,r1
ror r5,r4
@@ -59,7 +60,7 @@ ENTRY(strlen)
sub.ne r3,r3,4
mov.eq r1,r12
#ifdef __LITTLE_ENDIAN__
- sub_s r2,r1,1
+ SUBR_S r2,r1,1
bic_s r2,r2,r1
norm r1,r2
sub_s r0,r0,3
diff --git a/libc/string/arm/memset.S b/libc/string/arm/memset.S
index 412270f50..29c583f16 100644
--- a/libc/string/arm/memset.S
+++ b/libc/string/arm/memset.S
@@ -32,6 +32,7 @@ memset:
cmp r2, #8 @ at least 8 bytes to do?
bcc 2f
+ and r1, r1, #0xFF
lsl r3, r1, #8
orr r1, r3
lsl r3, r1, #16
@@ -68,6 +69,7 @@ memset:
mov a4, a1
cmp a3, $8 @ at least 8 bytes to do?
blo 2f
+ and a2, a2, #0xFF
orr a2, a2, a2, lsl $8
orr a2, a2, a2, lsl $16
1:
diff --git a/libc/string/explicit_bzero.c b/libc/string/explicit_bzero.c
new file mode 100644
index 000000000..b09e4c1f4
--- /dev/null
+++ b/libc/string/explicit_bzero.c
@@ -0,0 +1,30 @@
+/*
+Copyright © 2005-2020 Rich Felker, et al.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#define _BSD_SOURCE
+#include <string.h>
+
+void explicit_bzero(void *d, size_t n)
+{
+ d = memset(d, 0, n);
+ __asm__ __volatile__ ("" : : "r"(d) : "memory");
+}
diff --git a/libc/string/generic/strchr.c b/libc/string/generic/strchr.c
index 321d2b8c3..b34884d67 100644
--- a/libc/string/generic/strchr.c
+++ b/libc/string/generic/strchr.c
@@ -60,22 +60,19 @@ char *strchr (const char *s, int c_in)
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
- switch (sizeof (longword))
- {
- case 4: magic_bits = 0x7efefeffL; break;
- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
- default:
- abort ();
- }
-
/* Set up a longword, each of whose bytes is C. */
+#if __WORDSIZE == 32
+ magic_bits = 0x7efefeffL;
charmask = c | (c << 8);
charmask |= charmask << 16;
- if (sizeof (longword) > 4)
- /* Do the shift in two steps to avoid a warning if long has 32 bits. */
- charmask |= (charmask << 16) << 16;
- if (sizeof (longword) > 8)
- abort ();
+#elif __WORDSIZE == 64
+ magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+ charmask |= (charmask << 16) << 16;
+#else
+ #error unexpected integer size strchr()
+#endif
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing
diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c
index d11d9e00d..d9fadc776 100644
--- a/libc/string/generic/strchrnul.c
+++ b/libc/string/generic/strchrnul.c
@@ -59,22 +59,19 @@ char *strchrnul (const char *s, int c_in)
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
- switch (sizeof (longword))
- {
- case 4: magic_bits = 0x7efefeffL; break;
- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
- default:
- abort ();
- }
- /* Set up a longword, each of whose bytes is C. */
+#if __WORDSIZE == 32
+ magic_bits = 0x7efefeffL;
charmask = c | (c << 8);
charmask |= charmask << 16;
- if (sizeof (longword) > 4)
- /* Do the shift in two steps to avoid a warning if long has 32 bits. */
- charmask |= (charmask << 16) << 16;
- if (sizeof (longword) > 8)
- abort ();
+#elif __WORDSIZE == 64
+ magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+ charmask |= (charmask << 16) << 16;
+#else
+ #error unexpected integer size strchr()
+#endif
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing
diff --git a/libc/string/kvx/memcpy.S b/libc/string/kvx/memcpy.S
index 290e705b4..70e8db910 100644
--- a/libc/string/kvx/memcpy.S
+++ b/libc/string/kvx/memcpy.S
@@ -53,7 +53,7 @@ ENTRY(memcpy)
;;
cb.deqz $r7? .Lstreaming_loop_end
;;
- loopdo $r7? .Lstreaming_loop_end
+ loopdo $r7, .Lstreaming_loop_end
;;
sq 0[$r0] = $r32r33
addd $r2 = $r2, -256
@@ -162,7 +162,7 @@ ENTRY(memcpy)
;;
cb.deqz $r7? .Lloop_32_end
;;
- loopdo $r7? .Lloop_32_end
+ loopdo $r7, .Lloop_32_end
;;
lo $r32r33r34r35 = 0[$r1]
addd $r1 = $r1, 32
diff --git a/libc/string/strcasestr.c b/libc/string/strcasestr.c
index 3334086bf..8f57cc0a3 100644
--- a/libc/string/strcasestr.c
+++ b/libc/string/strcasestr.c
@@ -16,7 +16,7 @@ char *strcasestr(const char *s1, const char *s2)
#if 1
do {
if (!*p) {
- return (char *) s1;;
+ return (char *) s1;
}
if ((*p == *s)
|| (tolower(*((unsigned char *)p)) == tolower(*((unsigned char *)s)))
diff --git a/libc/string/strstr.c b/libc/string/strstr.c
index 7e2a64e7d..bf56b9c12 100644
--- a/libc/string/strstr.c
+++ b/libc/string/strstr.c
@@ -22,7 +22,7 @@ Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
do {
if (!*p) {
- return (Wchar *) s1;;
+ return (Wchar *) s1;
}
if (*p == *s) {
++p;
diff --git a/libc/sysdeps/linux/aarch64/bits/fcntl.h b/libc/sysdeps/linux/aarch64/bits/fcntl.h
index 80657c008..dbe929351 100644
--- a/libc/sysdeps/linux/aarch64/bits/fcntl.h
+++ b/libc/sysdeps/linux/aarch64/bits/fcntl.h
@@ -52,6 +52,7 @@
# define O_DIRECT 0200000
# define O_NOATIME 01000000
# define O_PATH 010000000
+# define O_TMPFILE 020040000
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -93,8 +94,6 @@
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
#endif
@@ -105,9 +104,9 @@
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
#endif
-#ifdef __USE_XOPEN2K8
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
+ close-on-exit set on new fd. */
#endif
/* For F_[GET|SET]FD. */
@@ -169,25 +168,6 @@ struct flock64
};
#endif
-
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
diff --git a/libc/sysdeps/linux/aarch64/bits/hwcap.h b/libc/sysdeps/linux/aarch64/bits/hwcap.h
new file mode 100644
index 000000000..20061f5d1
--- /dev/null
+++ b/libc/sysdeps/linux/aarch64/bits/hwcap.h
@@ -0,0 +1,99 @@
+/* Defines for bits in AT_HWCAP. AArch64 Linux version.
+ Copyright (C) 2016-2023 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#if !defined (_SYS_AUXV_H)
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+/* The following must match the kernel's <asm/hwcap.h> and update the
+ list together with sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c. */
+#define HWCAP_FP (1 << 0)
+#define HWCAP_ASIMD (1 << 1)
+#define HWCAP_EVTSTRM (1 << 2)
+#define HWCAP_AES (1 << 3)
+#define HWCAP_PMULL (1 << 4)
+#define HWCAP_SHA1 (1 << 5)
+#define HWCAP_SHA2 (1 << 6)
+#define HWCAP_CRC32 (1 << 7)
+#define HWCAP_ATOMICS (1 << 8)
+#define HWCAP_FPHP (1 << 9)
+#define HWCAP_ASIMDHP (1 << 10)
+#define HWCAP_CPUID (1 << 11)
+#define HWCAP_ASIMDRDM (1 << 12)
+#define HWCAP_JSCVT (1 << 13)
+#define HWCAP_FCMA (1 << 14)
+#define HWCAP_LRCPC (1 << 15)
+#define HWCAP_DCPOP (1 << 16)
+#define HWCAP_SHA3 (1 << 17)
+#define HWCAP_SM3 (1 << 18)
+#define HWCAP_SM4 (1 << 19)
+#define HWCAP_ASIMDDP (1 << 20)
+#define HWCAP_SHA512 (1 << 21)
+#define HWCAP_SVE (1 << 22)
+#define HWCAP_ASIMDFHM (1 << 23)
+#define HWCAP_DIT (1 << 24)
+#define HWCAP_USCAT (1 << 25)
+#define HWCAP_ILRCPC (1 << 26)
+#define HWCAP_FLAGM (1 << 27)
+#define HWCAP_SSBS (1 << 28)
+#define HWCAP_SB (1 << 29)
+#define HWCAP_PACA (1 << 30)
+#define HWCAP_PACG (1UL << 31)
+
+#define HWCAP2_DCPODP (1 << 0)
+#define HWCAP2_SVE2 (1 << 1)
+#define HWCAP2_SVEAES (1 << 2)
+#define HWCAP2_SVEPMULL (1 << 3)
+#define HWCAP2_SVEBITPERM (1 << 4)
+#define HWCAP2_SVESHA3 (1 << 5)
+#define HWCAP2_SVESM4 (1 << 6)
+#define HWCAP2_FLAGM2 (1 << 7)
+#define HWCAP2_FRINT (1 << 8)
+#define HWCAP2_SVEI8MM (1 << 9)
+#define HWCAP2_SVEF32MM (1 << 10)
+#define HWCAP2_SVEF64MM (1 << 11)
+#define HWCAP2_SVEBF16 (1 << 12)
+#define HWCAP2_I8MM (1 << 13)
+#define HWCAP2_BF16 (1 << 14)
+#define HWCAP2_DGH (1 << 15)
+#define HWCAP2_RNG (1 << 16)
+#define HWCAP2_BTI (1 << 17)
+#define HWCAP2_MTE (1 << 18)
+#define HWCAP2_ECV (1 << 19)
+#define HWCAP2_AFP (1 << 20)
+#define HWCAP2_RPRES (1 << 21)
+#define HWCAP2_MTE3 (1 << 22)
+#define HWCAP2_SME (1 << 23)
+#define HWCAP2_SME_I16I64 (1 << 24)
+#define HWCAP2_SME_F64F64 (1 << 25)
+#define HWCAP2_SME_I8I32 (1 << 26)
+#define HWCAP2_SME_F16F32 (1 << 27)
+#define HWCAP2_SME_B16F32 (1 << 28)
+#define HWCAP2_SME_F32F32 (1 << 29)
+#define HWCAP2_SME_FA64 (1 << 30)
+#define HWCAP2_WFXT (1UL << 31)
+#define HWCAP2_EBF16 (1UL << 32)
+#define HWCAP2_SVE_EBF16 (1UL << 33)
+#define HWCAP2_CSSC (1UL << 34)
+#define HWCAP2_RPRFM (1UL << 35)
+#define HWCAP2_SVE2P1 (1UL << 36)
+#define HWCAP2_SME2 (1UL << 37)
+#define HWCAP2_SME2P1 (1UL << 38)
+#define HWCAP2_SME_I16I32 (1UL << 39)
+#define HWCAP2_SME_BI32I32 (1UL << 40)
+#define HWCAP2_SME_B16B16 (1UL << 41)
+#define HWCAP2_SME_F16F16 (1UL << 42)
diff --git a/libc/sysdeps/linux/aarch64/crt1.S b/libc/sysdeps/linux/aarch64/crt1.S
index 09d0327ac..e9f946894 100644
--- a/libc/sysdeps/linux/aarch64/crt1.S
+++ b/libc/sysdeps/linux/aarch64/crt1.S
@@ -48,6 +48,20 @@ _start:
mov x29, #0
mov x30, #0
+#ifdef L_rcrt1
+ /* Save off the atexit pointer */
+ mov x19, x0
+
+ /* Calculate load address... idk how this works, but it does */
+ adrp x0, _start
+
+ /* Do relocations */
+ bl reloc_static_pie
+
+ /* restore atexit pointer */
+ mov x0, x19
+#endif
+
/* Setup _fini in argument register */
mov x5, x0
diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
index 35f8a704f..11e68214e 100644
--- a/libc/sysdeps/linux/alpha/bits/fcntl.h
+++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 02000000 /* Direct disk access. */
# define O_NOATIME 04000000 /* Do not set atime. */
# define O_PATH 040000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0100100000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -96,11 +97,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* for F_[GET|SET]FD */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/alpha/bits/resource.h b/libc/sysdeps/linux/alpha/bits/resource.h
index 74f4eed69..dba818714 100644
--- a/libc/sysdeps/linux/alpha/bits/resource.h
+++ b/libc/sysdeps/linux/alpha/bits/resource.h
@@ -99,7 +99,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
@@ -107,13 +113,13 @@ enum __rlimit_resource
/* Value to indicate that there is no limit. */
#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((long int)(~0UL >> 1))
+# define RLIM_INFINITY ((unsigned long int)(~0UL))
#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
+# define RLIM_INFINITY 0xffffffffffffffffULL
#endif
#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+# define RLIM64_INFINITY 0xffffffffffffffffULL
#endif
/* We can represent all limits. */
@@ -159,6 +165,15 @@ enum __rusage_who
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+#ifdef __USE_GNU
+ ,
+ /* The calling thread. */
+ RUSAGE_THREAD = 1
+# define RUSAGE_THREAD RUSAGE_THREAD
+ /* Name for the same functionality on Solaris. */
+# define RUSAGE_LWP RUSAGE_THREAD
+#endif
};
#define __need_timeval
diff --git a/libc/sysdeps/linux/arc/asm.h b/libc/sysdeps/linux/arc/asm.h
new file mode 100644
index 000000000..f83075ea1
--- /dev/null
+++ b/libc/sysdeps/linux/arc/asm.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2022, Synopsys, Inc. (www.synopsys.com)
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef _ARC_ASM_H
+#define _ARC_ASM_H
+
+/*
+ * Some 16-bit instructions were excluded from the ARCv3 ISA
+ * the following macros are introduced to handle these changes in one place.
+ * This will allow not to change existing ARCv2 code and use 16-bit versions
+ * of instructions for ARCv2 and replace them with 32-bit vesrions for ARCv3
+ */
+
+#if defined (__ARC64_ARCH32__)
+
+.macro PUSHR reg
+ push \reg
+.endm
+
+.macro PUSHR_S reg
+ push \reg
+.endm
+
+.macro POPR reg
+ pop \reg
+.endm
+
+.macro POPR_S reg
+ pop \reg
+.endm
+
+.macro SUBR_S dst,src1,src2
+ sub \dst, \src1, \src2
+.endm
+
+.macro ADDR_S dst,src1,src2
+ add \dst, \src1, \src2
+.endm
+
+.macro ASRR_S dst,src1,src2
+ asr \dst, \src1, \src2
+.endm
+
+.macro ASLR_S dst,src1,src2
+ asl \dst, \src1, \src2
+.endm
+
+#elif defined (__ARC64_ARCH64__)
+
+# error ARCv3 64-bit is not supported by uClibc-ng
+
+#else /* ARCHS || ARC700 */
+
+.macro PUSHR reg
+ push \reg
+.endm
+
+.macro PUSHR_S reg
+ push_s \reg
+.endm
+
+.macro POPR reg
+ pop \reg
+.endm
+
+.macro POPR_S reg
+ pop_s \reg
+.endm
+
+.macro SUBR_S dst,src1,src2
+ sub_s \dst, \src1, \src2
+.endm
+
+.macro ADDR_S dst,src1,src2
+ add_s \dst, \src1, \src2
+.endm
+
+.macro ASRR_S dst,src1,src2
+ asr_s \dst, \src1, \src2
+.endm
+
+.macro ASLR_S dst,src1,src2
+ asl_s \dst, \src1, \src2
+.endm
+
+#endif
+
+#endif /* _ARC_ASM_H */
diff --git a/libc/sysdeps/linux/arc/bits/atomic.h b/libc/sysdeps/linux/arc/bits/atomic.h
index 587860964..610b3c7c7 100644
--- a/libc/sysdeps/linux/arc/bits/atomic.h
+++ b/libc/sysdeps/linux/arc/bits/atomic.h
@@ -26,8 +26,10 @@ void __arc_link_error (void);
#ifdef __A7__
#define atomic_full_barrier() __asm__ __volatile__("": : :"memory")
+#define ARC_BARRIER_INSTR ""
#else
#define atomic_full_barrier() __asm__ __volatile__("dmb 3": : :"memory")
+#define ARC_BARRIER_INSTR "dmb 3"
#endif
/* Atomic compare and exchange. */
@@ -38,11 +40,12 @@ void __arc_link_error (void);
#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
({ __arc_link_error (); oldval; })
-#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
({ __arc_link_error (); oldval; })
#ifdef __CONFIG_ARC_HAS_ATOMICS__
+#ifdef __A7__
#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
({ \
__typeof(oldval) prev; \
@@ -60,8 +63,55 @@ void __arc_link_error (void);
\
prev; \
})
+#else /* !__A7__ */
+#define USE_ATOMIC_COMPILER_BUILTINS 1
-#else
+#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+ ({ \
+ __typeof(*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n(mem, (void *) &__oldval, newval, 0, \
+ __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+#define __arch_compare_and_exchange_val_8_rel(mem, newval, oldval) \
+ ({ __arc_link_error (); oldval; })
+
+#define __arch_compare_and_exchange_val_16_rel(mem, newval, oldval) \
+ ({ __arc_link_error (); oldval; })
+
+#define __arch_compare_and_exchange_val_64_rel(mem, newval, oldval) \
+ ({ __arc_link_error (); oldval; })
+
+#define __arch_compare_and_exchange_val_32_rel(mem, newval, oldval) \
+ ({ \
+ __typeof(*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n(mem, (void *) &__oldval, newval, 0, \
+ __ATOMIC_RELEASE, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+/* Compare and exchange with "acquire" semantics, ie barrier after */
+#define atomic_compare_and_exchange_val_acq(mem, new, old) \
+ __atomic_val_bysize(__arch_compare_and_exchange_val, acq, \
+ mem, new, old)
+
+/* Compare and exchange with "release" semantics, ie barrier before */
+#define atomic_compare_and_exchange_val_rel(mem, new, old) \
+ __atomic_val_bysize(__arch_compare_and_exchange_val, rel, \
+ mem, new, old)
+
+/* Explicitly define here to use release semantics*/
+#define atomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
+ ({ \
+ __typeof (oldval) __atg3_old = (oldval); \
+ atomic_compare_and_exchange_val_rel (mem, newval, __atg3_old) \
+ != __atg3_old; \
+ })
+
+#endif /* __A7__ */
+
+#else /* !__CONFIG_ARC_HAS_ATOMICS__ */
#ifndef __NR_arc_usr_cmpxchg
#error "__NR_arc_usr_cmpxchg missing: Please upgrade to kernel 4.9+ headers"
@@ -101,6 +151,21 @@ void __arc_link_error (void);
__typeof__(*(mem)) val = newval; \
\
__asm__ __volatile__( \
+ "ex %0, [%1]\n" \
+ ARC_BARRIER_INSTR \
+ : "+r" (val) \
+ : "r" (mem) \
+ : "memory" ); \
+ \
+ val; \
+ })
+
+#define __arch_exchange_32_rel(mem, newval) \
+ ({ \
+ __typeof__(*(mem)) val = newval; \
+ \
+ __asm__ __volatile__( \
+ ARC_BARRIER_INSTR"\n" \
"ex %0, [%1]" \
: "+r" (val) \
: "r" (mem) \
@@ -115,3 +180,10 @@ void __arc_link_error (void);
abort(); \
__arch_exchange_32_acq(mem, newval); \
})
+
+#define atomic_exchange_rel(mem, newval) \
+ ({ \
+ if (sizeof(*(mem)) != 4) \
+ abort(); \
+ __arch_exchange_32_rel(mem, newval); \
+ })
diff --git a/libc/sysdeps/linux/arc/bits/fcntl.h b/libc/sysdeps/linux/arc/bits/fcntl.h
index 0e8227e29..beb32e41e 100755
--- a/libc/sysdeps/linux/arc/bits/fcntl.h
+++ b/libc/sysdeps/linux/arc/bits/fcntl.h
@@ -41,6 +41,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -89,11 +90,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/arc/bits/syscalls.h b/libc/sysdeps/linux/arc/bits/syscalls.h
index c858d788b..000b6b631 100644
--- a/libc/sysdeps/linux/arc/bits/syscalls.h
+++ b/libc/sysdeps/linux/arc/bits/syscalls.h
@@ -100,7 +100,7 @@ extern long __syscall_error (int);
#ifdef __A7__
#define ARC_TRAP_INSN "trap0 \n\t"
-#elif defined(__HS__)
+#else
#define ARC_TRAP_INSN "trap_s 0 \n\t"
#endif
@@ -182,7 +182,7 @@ extern long __syscall_error (int);
#ifdef __A7__
#define ARC_TRAP_INSN trap0
-#elif defined(__HS__)
+#else
#define ARC_TRAP_INSN trap_s 0
#endif
diff --git a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h
index 119bbb7e1..94e089d5d 100755
--- a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h
@@ -17,9 +17,6 @@
/* can your target use syscall6() for mmap ? */
#undef __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
diff --git a/libc/sysdeps/linux/arc/crt1.S b/libc/sysdeps/linux/arc/crt1.S
index 70a06e058..ff36d252e 100644
--- a/libc/sysdeps/linux/arc/crt1.S
+++ b/libc/sysdeps/linux/arc/crt1.S
@@ -40,7 +40,9 @@ __start:
ld_s r1, [sp] ; argc
mov_s r5, r0 ; rltd_fini
- add_s r2, sp, 4 ; argv
+ /* Use the universal 32-bit add instruction as 16-bit add_s was excluded from
+ ARCv3 ISA */
+ add r2, sp, 4 ; argv
#ifdef L_Scrt1
ld r0, [pcl, @main@gotpc]
ld r3, [pcl, @_init@gotpc]
diff --git a/libc/sysdeps/linux/arc/sigrestorer.S b/libc/sysdeps/linux/arc/sigrestorer.S
index e4deb6bd4..60d35ab3e 100644
--- a/libc/sysdeps/linux/arc/sigrestorer.S
+++ b/libc/sysdeps/linux/arc/sigrestorer.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 Synopsys, Inc. (www.synopsys.com)
+ * Copyright (C) 2017-2022 Synopsys, Inc. (www.synopsys.com)
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
*/
@@ -22,4 +22,5 @@
__default_rt_sa_restorer:
mov r8, __NR_rt_sigreturn
ARC_TRAP_INSN
+ j_s [blink]
diff --git a/libc/sysdeps/linux/arm/bits/elf-fdpic.h b/libc/sysdeps/linux/arm/bits/elf-fdpic.h
index 3d6db54af..f2ef9aeca 100644
--- a/libc/sysdeps/linux/arm/bits/elf-fdpic.h
+++ b/libc/sysdeps/linux/arm/bits/elf-fdpic.h
@@ -91,7 +91,7 @@ __reloc_pointer (void *p,
/* This should be computed as part of the pointer comparison
above, but we want to use the carry in the comparison, so we
can't convert it to an integer type beforehand. */
- unsigned long offset = p - (void*)map->segs[c].p_vaddr;
+ unsigned long offset = (char*)p - (char*)map->segs[c].p_vaddr;
/* We only check for one-past-the-end for the last segment,
assumed to be the data segment, because other cases are
ambiguous in the absence of padding between segments, and
diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
index 02495c763..823660648 100644
--- a/libc/sysdeps/linux/arm/bits/fcntl.h
+++ b/libc/sysdeps/linux/arm/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -101,11 +102,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/arm/bits/hwcap.h b/libc/sysdeps/linux/arm/bits/hwcap.h
new file mode 100644
index 000000000..0a741b469
--- /dev/null
+++ b/libc/sysdeps/linux/arm/bits/hwcap.h
@@ -0,0 +1,50 @@
+/* Defines for bits in AT_HWCAP. ARM Linux version.
+ Copyright (C) 2012-2023 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#if !defined (_SYS_AUXV_H) && !defined (_LINUX_ARM_SYSDEP_H)
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+/* The following must match the kernel's <asm/hwcap.h>. */
+#define HWCAP_ARM_SWP 1
+#define HWCAP_ARM_HALF 2
+#define HWCAP_ARM_THUMB 4
+#define HWCAP_ARM_26BIT 8
+#define HWCAP_ARM_FAST_MULT 16
+#define HWCAP_ARM_FPA 32
+#define HWCAP_ARM_VFP 64
+#define HWCAP_ARM_EDSP 128
+#define HWCAP_ARM_JAVA 256
+#define HWCAP_ARM_IWMMXT 512
+#define HWCAP_ARM_CRUNCH 1024
+#define HWCAP_ARM_THUMBEE 2048
+#define HWCAP_ARM_NEON 4096
+#define HWCAP_ARM_VFPv3 8192
+#define HWCAP_ARM_VFPv3D16 16384
+#define HWCAP_ARM_TLS 32768
+#define HWCAP_ARM_VFPv4 65536
+#define HWCAP_ARM_IDIVA 131072
+#define HWCAP_ARM_IDIVT 262144
+#define HWCAP_ARM_VFPD32 524288
+#define HWCAP_ARM_LPAE 1048576
+#define HWCAP_ARM_EVTSTRM 2097152
+#define HWCAP_FPHP 4194304
+#define HWCAP_ASIMDHP 8388608
+#define HWCAP_ASIMDDP 16777216
+#define HWCAP_ASIMDFHM 33554432
+#define HWCAP_ASIMDBF16 67108864
+#define HWCAP_I8MM 134217728
diff --git a/libc/sysdeps/linux/arm/bits/kernel_stat.h b/libc/sysdeps/linux/arm/bits/kernel_stat.h
index b293dfc05..cdbeeb4de 100644
--- a/libc/sysdeps/linux/arm/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/arm/bits/kernel_stat.h
@@ -50,7 +50,6 @@ struct kernel_stat64 {
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
-
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
diff --git a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
index b0b093c99..671afd3ac 100644
--- a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
@@ -11,9 +11,6 @@
/* can your target use syscall6() for mmap ? */
#undef __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#ifdef __ARM_EABI__
#define __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S
index a1d7f0f23..799f11080 100644
--- a/libc/sysdeps/linux/arm/crt1.S
+++ b/libc/sysdeps/linux/arm/crt1.S
@@ -245,7 +245,23 @@ _start:
mov fp, #0
mov lr, #0
-#ifdef __ARCH_USE_MMU__
+#if defined(__ARCH_USE_MMU__) || defined(__UCLIBC_FORMAT_ELF__)
+#ifdef L_rcrt1
+ /* We don't need to save a1 since no dynamic linker should have run */
+ ldr a1, .L_GOT /* Get value at .L_GOT + 0 (offset to GOT)*/
+ adr a2, .L_GOT /* Get address of .L_GOT */
+ ldr a3, .L_GOT+16 /* Get value of _start(GOT) stored in .L_GOT */
+ adr a4, _start /* Get address of _start after relocation (changes to pc - ~30 or so) */
+ add a1, a1, a2 /* Calculate where the GOT is */
+ ldr a2, [a1, a3] /* GOT + _start(GOT) = offset of _start from begin of file */
+ sub a1, a4, a2 /* Current addr of _start - offset from beginning of file = load addr */
+ bl reloc_static_pie
+ mov a1, #0 /* Clean up a1 so that a random address won't get called at the end of program */
+
+ /* Clear the frame pointer and link register again since it might be modified by previous call */
+ mov fp, #0
+ mov lr, #0
+#endif
/* Pop argc off the stack and save a pointer to argv */
ldr a2, [sp], #4
mov a3, sp
@@ -309,6 +325,9 @@ _start:
.word _fini(GOT)
.word _init(GOT)
.word main(GOT)
+#ifdef L_rcrt1
+ .word _start(GOT)
+#endif
#endif
#endif
diff --git a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
index 6f1039a34..ec0a3b55d 100644
--- a/libc/sysdeps/linux/avr32/bits/fcntl.h
+++ b/libc/sysdeps/linux/avr32/bits/fcntl.h
@@ -35,6 +35,7 @@
# define O_DIRECT 00040000 /* must be a directory */
# define O_NOATIME 01000000 /* don't set atime */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h
index 2527a176a..0909ae6c4 100644
--- a/libc/sysdeps/linux/bfin/bits/fcntl.h
+++ b/libc/sysdeps/linux/bfin/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* don't set atime */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -100,11 +101,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h
index 02c2ee131..14aea565e 100644
--- a/libc/sysdeps/linux/c6x/bits/fcntl.h
+++ b/libc/sysdeps/linux/c6x/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_LARGEFILE 0100000
# define O_NOATIME 01000000
# define O_PATH 010000000/* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000/* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/c6x/bits/resource.h b/libc/sysdeps/linux/c6x/bits/resource.h
index 72b08ce84..438827542 100644
--- a/libc/sysdeps/linux/c6x/bits/resource.h
+++ b/libc/sysdeps/linux/c6x/bits/resource.h
@@ -143,6 +143,15 @@ enum __rusage_who
/* Both. */
RUSAGE_BOTH = -2
#define RUSAGE_BOTH RUSAGE_BOTH
+
+#ifdef __USE_GNU
+ ,
+ /* The calling thread. */
+ RUSAGE_THREAD = 1
+# define RUSAGE_THREAD RUSAGE_THREAD
+ /* Name for the same functionality on Solaris. */
+# define RUSAGE_LWP RUSAGE_THREAD
+#endif
};
#define __need_timeval
diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h
index 70b708d70..451271725 100644..100755
--- a/libc/sysdeps/linux/c6x/bits/syscalls.h
+++ b/libc/sysdeps/linux/c6x/bits/syscalls.h
@@ -167,11 +167,15 @@ type name(C_DECL_ARGS_##nargs(args)) { \
return (type)INLINE_SYSCALL_NOERR(name, nargs, C_ARGS_##nargs(args)); \
}
+#define SYSCALL_FUNC_BODY(nargs, type, name, args...) \
+ return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args));
+
#define _syscall0(args...) SYSCALL_FUNC(0, args)
#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args)
#define _syscall1(args...) SYSCALL_FUNC(1, args)
#define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args)
#define _syscall2(args...) SYSCALL_FUNC(2, args)
+#define _syscall2_body(args...) SYSCALL_FUNC_BODY(2, args)
#define _syscall3(args...) SYSCALL_FUNC(3, args)
#define _syscall4(args...) SYSCALL_FUNC(4, args)
#define _syscall5(args...) SYSCALL_FUNC(5, args)
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 9562de52c..848bc1e4a 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -38,6 +38,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
pipe2.c \
ppoll.c \
prctl.c \
+ prlimit.c \
readahead.c \
reboot.c \
remap_file_pages.c \
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
index f4244148d..aff5299a1 100644
--- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c
+++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
@@ -9,7 +9,7 @@
#include <sys/syscall.h>
-#ifdef __NR_rt_sigtimedwait
+#if defined(__NR_rt_sigtimedwait) || (defined(__NR_rt_sigtimedwait_time64) && defined(__UCLIBC_USE_TIME64__))
# include <signal.h>
# include <cancel.h>
# ifdef __UCLIBC_HAS_THREADS_NATIVE__
@@ -21,6 +21,10 @@
# include <string.h>
# endif
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info,
const struct timespec *timeout)
{
@@ -52,8 +56,13 @@ int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info,
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
/* on uClibc we use the kernel sigset_t size */
+# if defined(__UCLIBC_USE_TIME64__) && defined(__NR_rt_sigtimedwait_time64)
+ result = INLINE_SYSCALL(rt_sigtimedwait_time64, 4, set, info,
+ TO_TS64_P(timeout), __SYSCALL_SIGSET_T_SIZE);
+# else
result = INLINE_SYSCALL(rt_sigtimedwait, 4, set, info,
timeout, __SYSCALL_SIGSET_T_SIZE);
+# endif
/* The kernel generates a SI_TKILL code in si_code in case tkill is
used. tkill is transparently used in raise(). Since having
@@ -65,9 +74,14 @@ int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info,
return result;
# else
/* on uClibc we use the kernel sigset_t size */
+# if defined(__UCLIBC_USE_TIME64__) && defined(__NR_rt_sigtimedwait_time64)
+ return INLINE_SYSCALL(rt_sigtimedwait_time64, 4, set, info,
+ TO_TS64_P(timeout), __SYSCALL_SIGSET_T_SIZE);
+# else
return INLINE_SYSCALL(rt_sigtimedwait, 4, set, info,
timeout, __SYSCALL_SIGSET_T_SIZE);
# endif
+# endif
}
CANCELLABLE_SYSCALL(int, sigtimedwait,
(const sigset_t *set, siginfo_t *info, const struct timespec *timeout),
diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
index d2d176a64..7830b2e2c 100644
--- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
+++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
@@ -9,7 +9,7 @@
#include <sys/syscall.h>
-#ifdef __NR_rt_sigtimedwait
+#if defined(__NR_rt_sigtimedwait) || (defined(__UCLIBC_USE_TIME64__) && defined(__NR_rt_sigtimedwait_time64))
# define __need_NULL
# include <stddef.h>
# include <signal.h>
diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c
index dc43fe732..861f6ad8e 100644
--- a/libc/sysdeps/linux/common/alarm.c
+++ b/libc/sysdeps/linux/common/alarm.c
@@ -9,7 +9,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-#ifdef __NR_alarm
+#if defined(__NR_alarm) && !defined(__UCLIBC_USE_TIME64__)
_syscall1(unsigned int, alarm, unsigned int, seconds)
#else
# include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/bits/hwcap.h b/libc/sysdeps/linux/common/bits/hwcap.h
new file mode 100644
index 000000000..e7b899df0
--- /dev/null
+++ b/libc/sysdeps/linux/common/bits/hwcap.h
@@ -0,0 +1,22 @@
+/* Defines for bits in AT_HWCAP.
+ Copyright (C) 2012-2023 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_AUXV_H
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+/* No bits defined for this architecture. */
diff --git a/libc/sysdeps/linux/common/bits/jmp_buf_tag.h b/libc/sysdeps/linux/common/bits/jmp_buf_tag.h
new file mode 100644
index 000000000..367b7bc66
--- /dev/null
+++ b/libc/sysdeps/linux/common/bits/jmp_buf_tag.h
@@ -0,0 +1,37 @@
+/* Define struct __jmp_buf_tag.
+ Copyright (C) 1991-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef __jmp_buf_tag_defined
+#define __jmp_buf_tag_defined 1
+
+#include <bits/setjmp.h>
+#include <bits/sigset.h>
+
+/* Calling environment, plus possibly a saved signal mask. */
+struct __jmp_buf_tag
+ {
+ /* NOTE: The machine-dependent definitions of `__sigsetjmp'
+ assume that a `jmp_buf' begins with a `__jmp_buf' and that
+ `__mask_was_saved' follows it. Do not move these members
+ or add others before it. */
+ __jmp_buf __jmpbuf; /* Calling environment. */
+ int __mask_was_saved; /* Saved the signal mask? */
+ __sigset_t __saved_mask; /* Saved signal mask. */
+ };
+
+#endif
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index f1ebe0204..2f4f407bd 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -490,6 +490,11 @@
# define __ASSUME_FALLOCATE 1
#endif
+/* prlimit64 is available in 2.6.36. */
+#if __LINUX_KERNEL_VERSION >= 0x020624
+# define __ASSUME_PRLIMIT64 1
+#endif
+
/* getcpu is a syscall for x86-64 since 3.1. */
#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
# define __ASSUME_GETCPU_SYSCALL 1
diff --git a/libc/sysdeps/linux/common/bits/mman-linux.h b/libc/sysdeps/linux/common/bits/mman-linux.h
index 6ca08415a..4947ddd89 100644
--- a/libc/sysdeps/linux/common/bits/mman-linux.h
+++ b/libc/sysdeps/linux/common/bits/mman-linux.h
@@ -46,6 +46,7 @@
/* Other flags. */
#define MAP_FIXED 0x10 /* Interpret addr exactly. */
+# define MAP_FIXED_NOREPLACE 0x100000 /* Used to solve problem with MAP_FIXED */
#ifdef __USE_MISC
# define MAP_FILE 0
# ifdef __MAP_ANONYMOUS
diff --git a/libc/sysdeps/linux/common/bits/resource.h b/libc/sysdeps/linux/common/bits/resource.h
index df0ba56d9..89c3d4e41 100644
--- a/libc/sysdeps/linux/common/bits/resource.h
+++ b/libc/sysdeps/linux/common/bits/resource.h
@@ -99,7 +99,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
@@ -159,6 +165,15 @@ enum __rusage_who
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+#ifdef __USE_GNU
+ ,
+ /* The calling thread. */
+ RUSAGE_THREAD = 1
+# define RUSAGE_THREAD RUSAGE_THREAD
+ /* Name for the same functionality on Solaris. */
+# define RUSAGE_LWP RUSAGE_THREAD
+#endif
};
#define __need_timeval
diff --git a/libc/sysdeps/linux/common/bits/sched.h b/libc/sysdeps/linux/common/bits/sched.h
index 9d05314f5..18a9fb98d 100644
--- a/libc/sysdeps/linux/common/bits/sched.h
+++ b/libc/sysdeps/linux/common/bits/sched.h
@@ -31,6 +31,7 @@
#ifdef __USE_GNU
# define SCHED_BATCH 3
# define SCHED_IDLE 5
+# define SCHED_DEADLINE 6
# define SCHED_RESET_ON_FORK 0x40000000
#endif
diff --git a/libc/sysdeps/linux/common/bits/sem.h b/libc/sysdeps/linux/common/bits/sem.h
index 910c4b714..24a130981 100644
--- a/libc/sysdeps/linux/common/bits/sem.h
+++ b/libc/sysdeps/linux/common/bits/sem.h
@@ -39,15 +39,31 @@
struct semid_ds
{
struct ipc_perm sem_perm; /* operation permission struct */
+#if defined(__UCLIBC_USE_TIME64__)
+ unsigned long int __sem_otime_internal_1;
+ unsigned long int __sem_otime_internal_2;
+#else
__time_t sem_otime; /* last semop() time */
-#if __WORDSIZE == 32
+#endif
+#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__)) || \
+ ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__)) && !defined(__UCLIBC_USE_TIME64__))
unsigned long int __uclibc_unused1;
#endif
+#if defined(__UCLIBC_USE_TIME64__)
+ unsigned long int __sem_ctime_internal_1;
+ unsigned long int __sem_ctime_internal_2;
+#else
__time_t sem_ctime; /* last time changed by semctl() */
-#if __WORDSIZE == 32
+#endif
+#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__)) || \
+ ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__)) && !defined(__UCLIBC_USE_TIME64__))
unsigned long int __uclibc_unused2;
#endif
unsigned long int sem_nsems; /* number of semaphores in set */
+#if defined(__UCLIBC_USE_TIME64__)
+ __time_t sem_otime; /* last semop() time */
+ __time_t sem_ctime; /* last time changed by semctl() */
+#endif
unsigned long int __uclibc_unused3;
unsigned long int __uclibc_unused4;
};
diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h
index 3665345a6..c3b193e6f 100644..100755
--- a/libc/sysdeps/linux/common/bits/syscalls-common.h
+++ b/libc/sysdeps/linux/common/bits/syscalls-common.h
@@ -99,21 +99,75 @@ type name(C_DECL_ARGS_##nargs(args)) { \
return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args)); \
}
+#define SYSCALL_FUNC_TIME64(nargs, type, name, args...) \
+type name(C_DECL_ARGS_##nargs(args)) { \
+ return (type)INLINE_SYSCALL(name##_time64, nargs, C_ARGS_##nargs(args)); \
+}
+
+#define SYSCALL_FUNC_64(nargs, type, name, args...) \
+type name(C_DECL_ARGS_##nargs(args)) { \
+ return (type)INLINE_SYSCALL(name##64, nargs, C_ARGS_##nargs(args)); \
+}
+
+
#define SYSCALL_NOERR_FUNC(nargs, type, name, args...) \
type name(C_DECL_ARGS_##nargs(args)) { \
return (type)INLINE_SYSCALL_NOERR(name, nargs, C_ARGS_##nargs(args)); \
}
+#define SYSCALL_NOERR_FUNC_TIME64(nargs, type, name, args...) \
+type name(C_DECL_ARGS_##nargs(args)) { \
+ return (type)INLINE_SYSCALL_NOERR(name##_time64, nargs, C_ARGS_##nargs(args)); \
+}
+
+#define SYSCALL_NOERR_FUNC_64(nargs, type, name, args...) \
+type name(C_DECL_ARGS_##nargs(args)) { \
+ return (type)INLINE_SYSCALL_NOERR(name##64, nargs, C_ARGS_##nargs(args)); \
+}
+
+#define SYSCALL_FUNC_BODY(nargs, type, name, args...) \
+ return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args));
+
+#define SYSCALL_FUNC_BODY_TIME64(nargs, type, name, args...) \
+ return (type)INLINE_SYSCALL(name##_time64, nargs, C_ARGS_##nargs(args));
+
+#define SYSCALL_FUNC_BODY_64(nargs, type, name, args...) \
+ return (type)INLINE_SYSCALL(name##64, nargs, C_ARGS_##nargs(args));
+
#define _syscall0(args...) SYSCALL_FUNC(0, args)
#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args)
#define _syscall1(args...) SYSCALL_FUNC(1, args)
#define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args)
#define _syscall2(args...) SYSCALL_FUNC(2, args)
+#define _syscall2_body(args...) SYSCALL_FUNC_BODY(2, args)
#define _syscall3(args...) SYSCALL_FUNC(3, args)
#define _syscall4(args...) SYSCALL_FUNC(4, args)
#define _syscall5(args...) SYSCALL_FUNC(5, args)
#define _syscall6(args...) SYSCALL_FUNC(6, args)
+#define _syscall0_time64(args...) SYSCALL_FUNC_TIME64(0, args)
+#define _syscall_noerr0_time64(args...) SYSCALL_NOERR_FUNC_TIME64(0, args)
+#define _syscall1_time64(args...) SYSCALL_FUNC_TIME64(1, args)
+#define _syscall_noerr1_time64(args...) SYSCALL_NOERR_FUNC_TIME64(1, args)
+#define _syscall2_time64(args...) SYSCALL_FUNC_TIME64(2, args)
+#define _syscall2_body_time64(args...) SYSCALL_FUNC_BODY_TIME64(2, args)
+#define _syscall3_time64(args...) SYSCALL_FUNC_TIME64(3, args)
+#define _syscall4_time64(args...) SYSCALL_FUNC_TIME64(4, args)
+#define _syscall5_time64(args...) SYSCALL_FUNC_TIME64(5, args)
+#define _syscall6_time64(args...) SYSCALL_FUNC_TIME64(6, args)
+
+#define _syscall0_64(args...) SYSCALL_FUNC_64(0, args)
+#define _syscall_noerr0_64(args...) SYSCALL_NOERR_FUNC_64(0, args)
+#define _syscall1_64(args...) SYSCALL_FUNC_64(1, args)
+#define _syscall_noerr1_64(args...) SYSCALL_NOERR_FUNC_64(1, args)
+#define _syscall2_64(args...) SYSCALL_FUNC_64(2, args)
+#define _syscall2_body_64(args...) SYSCALL_FUNC_BODY_64(2, args)
+#define _syscall3_64(args...) SYSCALL_FUNC_64(3, args)
+#define _syscall4_64(args...) SYSCALL_FUNC_64(4, args)
+#define _syscall5_64(args...) SYSCALL_FUNC_64(5, args)
+#define _syscall6_64(args...) SYSCALL_FUNC_64(6, args)
+
+
#endif /* _syscall0 */
#endif /* __ASSEMBLER__ */
diff --git a/libc/sysdeps/linux/common/bits/typesizes.h b/libc/sysdeps/linux/common/bits/typesizes.h
index e1c5a27bb..dcb2c3b0a 100644
--- a/libc/sysdeps/linux/common/bits/typesizes.h
+++ b/libc/sysdeps/linux/common/bits/typesizes.h
@@ -46,9 +46,21 @@
#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
#define __ID_T_TYPE __U32_TYPE
#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+
+#ifdef __UCLIBC_USE_TIME64__
+#define __TIME_T_TYPE __S64_TYPE
+#else
#define __TIME_T_TYPE __SLONGWORD_TYPE
+#endif /* __UCLIBC_USE_TIME64__ */
+
#define __USECONDS_T_TYPE __U32_TYPE
+
+#ifdef __UCLIBC_USE_TIME64__
+#define __SUSECONDS_T_TYPE __S64_TYPE
+#else
#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#endif
+
#define __DADDR_T_TYPE __S32_TYPE
#define __SWBLK_T_TYPE __SLONGWORD_TYPE
#define __KEY_T_TYPE __S32_TYPE
diff --git a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h
index 47ea3cda1..91b789c80 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h
@@ -36,6 +36,7 @@
#include <limits.h>
#include <stdint.h>
+#include <wchar.h>
#if WCHAR_MIN == 0
typedef wchar_t __uwchar_t;
diff --git a/libc/sysdeps/linux/common/bits/wchar.h b/libc/sysdeps/linux/common/bits/wchar.h
index a3ff5319e..ce951d9b6 100644
--- a/libc/sysdeps/linux/common/bits/wchar.h
+++ b/libc/sysdeps/linux/common/bits/wchar.h
@@ -1,5 +1,5 @@
/* wchar_t type related definitions.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,12 +14,36 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#ifndef _BITS_WCHAR_H
#define _BITS_WCHAR_H 1
-#define __WCHAR_MIN (-2147483647 - 1)
-#define __WCHAR_MAX (2147483647)
+/* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__
+ are not defined, give the right value and type as long as both int
+ and wchar_t are 32-bit types. Adding L'\0' to a constant value
+ ensures that the type is correct; it is necessary to use (L'\0' +
+ 0) rather than just L'\0' so that the type in C++ is the promoted
+ version of wchar_t rather than the distinct wchar_t type itself.
+ Because wchar_t in preprocessor #if expressions is treated as
+ intmax_t or uintmax_t, the expression (L'\0' - 1) would have the
+ wrong value for WCHAR_MAX in such expressions and so cannot be used
+ to define __WCHAR_MAX in the unsigned case. */
+
+#ifdef __WCHAR_MAX__
+# define __WCHAR_MAX __WCHAR_MAX__
+#elif L'\0' - 1 > 0
+# define __WCHAR_MAX (0xffffffffu + L'\0')
+#else
+# define __WCHAR_MAX (0x7fffffff + L'\0')
+#endif
+
+#ifdef __WCHAR_MIN__
+# define __WCHAR_MIN __WCHAR_MIN__
+#elif L'\0' - 1 > 0
+# define __WCHAR_MIN (L'\0' + 0)
+#else
+# define __WCHAR_MIN (-__WCHAR_MAX - 1)
+#endif
#endif /* bits/wchar.h */
diff --git a/libc/sysdeps/linux/common/clock_adjtime.c b/libc/sysdeps/linux/common/clock_adjtime.c
index 9f55d4527..53f64e9d5 100644
--- a/libc/sysdeps/linux/common/clock_adjtime.c
+++ b/libc/sysdeps/linux/common/clock_adjtime.c
@@ -10,6 +10,10 @@
#include <sys/syscall.h>
#include <sys/timex.h>
-#ifdef __NR_clock_adjtime
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_adjtime64)
+_syscall2_64(int, clock_adjtime, clockid_t, clock_id, struct timex*, ntx)
+#elif defined(__NR_clock_adjtime)
_syscall2(int, clock_adjtime, clockid_t, clock_id, struct timex*, ntx)
+#else
+#error "clock_adjtime syscall is not defined!"
#endif
diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c
index 532047ede..fd0f8c14c 100644
--- a/libc/sysdeps/linux/common/clock_getres.c
+++ b/libc/sysdeps/linux/common/clock_getres.c
@@ -10,7 +10,21 @@
#include <sys/syscall.h>
#include <time.h>
-#ifdef __NR_clock_getres
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_getres_time64)
+#include "internal/time64_helpers.h"
+
+int clock_getres(clockid_t clock_id, struct timespec *res)
+{
+ struct __ts64_struct __ts64;
+ int __ret = INLINE_SYSCALL(clock_getres_time64, 2, clock_id, &__ts64);
+ if (__ret == 0 && res) {
+ res->tv_sec = __ts64.tv_sec;
+ res->tv_nsec = __ts64.tv_nsec;
+ };
+
+ return __ret;
+}
+#elif defined(__NR_clock_getres)
_syscall2(int, clock_getres, clockid_t, clock_id, struct timespec*, res)
#else
# include <unistd.h>
diff --git a/libc/sysdeps/linux/common/clock_gettime.c b/libc/sysdeps/linux/common/clock_gettime.c
index 95d398239..4d787b9b7 100644
--- a/libc/sysdeps/linux/common/clock_gettime.c
+++ b/libc/sysdeps/linux/common/clock_gettime.c
@@ -11,7 +11,21 @@
#include <sys/syscall.h>
#include <time.h>
-#ifdef __NR_clock_gettime
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_gettime64)
+#include "internal/time64_helpers.h"
+
+int clock_gettime(clockid_t clock_id, struct timespec *tp)
+{
+ struct __ts64_struct __ts64;
+ int __ret = INLINE_SYSCALL(clock_gettime64, 2, clock_id, &__ts64);
+ if (tp) {
+ tp->tv_sec = __ts64.tv_sec;
+ tp->tv_nsec = __ts64.tv_nsec;
+ }
+
+ return __ret;
+}
+#elif defined(__NR_clock_gettime)
_syscall2(int, clock_gettime, clockid_t, clock_id, struct timespec*, tp)
#else
# include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c
index 636f18417..3abc5f49b 100644
--- a/libc/sysdeps/linux/common/clock_settime.c
+++ b/libc/sysdeps/linux/common/clock_settime.c
@@ -10,7 +10,15 @@
#include <sys/syscall.h>
#include <time.h>
-#ifdef __NR_clock_settime
+
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_settime64)
+#include "internal/time64_helpers.h"
+
+int clock_settime(clockid_t clock_id, const struct timespec *tp)
+{
+ return INLINE_SYSCALL(clock_settime64, 2, clock_id, TO_TS64_P(tp));
+}
+#elif defined(__NR_clock_settime)
_syscall2(int, clock_settime, clockid_t, clock_id, const struct timespec*, tp)
#else
# include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c
index 0b2798ad4..65e879799 100644
--- a/libc/sysdeps/linux/common/fstat.c
+++ b/libc/sysdeps/linux/common/fstat.c
@@ -10,10 +10,11 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/syscall.h>
+#include <bits/uClibc_arch_features.h>
#include "xstatconv.h"
-#if defined __NR_fstat64 && !defined __NR_fstat
+#if defined __NR_fstat64 && !defined __NR_fstat && !defined(__UCLIBC_USE_TIME64__)
int fstat(int fd, struct stat *buf)
{
return INLINE_SYSCALL(fstat64, 2, fd, buf);
@@ -29,7 +30,7 @@ int fstat(int fd, struct stat *buf)
}
libc_hidden_def(fstat)
-#elif __NR_statx && defined __UCLIBC_HAVE_STATX__
+#elif defined __NR_statx && defined __UCLIBC_HAVE_STATX__
# include <fcntl.h>
# include <statx_cp.h>
@@ -40,6 +41,8 @@ int fstat(int fd, struct stat *buf)
STATX_BASIC_STATS, &tmp);
if (rc == 0)
__cp_stat_statx ((struct stat *)buf, &tmp);
+
+ return rc;
}
libc_hidden_def(fstat)
diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c
index fe1cb4fe5..359c22af6 100644
--- a/libc/sysdeps/linux/common/fstat64.c
+++ b/libc/sysdeps/linux/common/fstat64.c
@@ -9,7 +9,7 @@
#include <_lfs_64.h>
#include <sys/syscall.h>
-#ifdef __NR_fstat64
+#if defined(__NR_fstat64) && !defined(__UCLIBC_USE_TIME64__)
# include <unistd.h>
# include <sys/stat.h>
# include "xstatconv.h"
@@ -45,7 +45,7 @@ int fstat64(int fd, struct stat64 *buf)
int rc = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH,
STATX_BASIC_STATS, &tmp);
if (rc == 0)
- __cp_stat_statx ((struct stat64 *)buf, &tmp);
+ __cp_stat64_statx ((struct stat64 *)buf, &tmp);
return rc;
}
diff --git a/libc/sysdeps/linux/common/fstatat.c b/libc/sysdeps/linux/common/fstatat.c
index 13673d76c..14b118cc0 100644
--- a/libc/sysdeps/linux/common/fstatat.c
+++ b/libc/sysdeps/linux/common/fstatat.c
@@ -9,13 +9,14 @@
#include <sys/syscall.h>
#include <sys/stat.h>
#include "xstatconv.h"
+#include <bits/uClibc_arch_features.h>
/* 64bit ports tend to favor newfstatat() */
#if __WORDSIZE == 64 && defined __NR_newfstatat
# define __NR_fstatat64 __NR_newfstatat
#endif
-#ifdef __NR_fstatat64
+#if defined(__NR_fstatat64) && !defined(__UCLIBC_USE_TIME64__)
int fstatat(int fd, const char *file, struct stat *buf, int flag)
{
int ret;
@@ -31,5 +32,44 @@ int fstatat(int fd, const char *file, struct stat *buf, int flag)
}
libc_hidden_def(fstatat)
#else
+
+#if defined(__NR_statx) && defined __UCLIBC_HAVE_STATX__
+#include <sys/sysmacros.h> // for makedev
+
+int fstatat(int fd, const char *file, struct stat *buf, int flag)
+{
+ int ret;
+ struct statx tmp;
+
+ ret = INLINE_SYSCALL(statx, 5, fd, file, flag,
+ STATX_BASIC_STATS, &tmp);
+ if (ret != 0)
+ return ret;
+
+ *buf = (struct stat) {
+ .st_dev = makedev(tmp.stx_dev_major, tmp.stx_dev_minor),
+ .st_ino = tmp.stx_ino,
+ .st_mode = tmp.stx_mode,
+ .st_nlink = tmp.stx_nlink,
+ .st_uid = tmp.stx_uid,
+ .st_gid = tmp.stx_gid,
+ .st_rdev = makedev(tmp.stx_rdev_major, tmp.stx_rdev_minor),
+ .st_size = tmp.stx_size,
+ .st_blksize = tmp.stx_blksize,
+ .st_blocks = tmp.stx_blocks,
+ .st_atim.tv_sec = tmp.stx_atime.tv_sec,
+ .st_atim.tv_nsec = tmp.stx_atime.tv_nsec,
+ .st_mtim.tv_sec = tmp.stx_mtime.tv_sec,
+ .st_mtim.tv_nsec = tmp.stx_mtime.tv_nsec,
+ .st_ctim.tv_sec = tmp.stx_ctime.tv_sec,
+ .st_ctim.tv_nsec = tmp.stx_ctime.tv_nsec,
+ };
+
+ return ret;
+}
+libc_hidden_def(fstatat)
+
+#endif
+
/* should add emulation with fstat() and /proc/self/fd/ ... */
#endif
diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c
index 711521a6a..16dbf9215 100644
--- a/libc/sysdeps/linux/common/fstatat64.c
+++ b/libc/sysdeps/linux/common/fstatat64.c
@@ -23,7 +23,7 @@
# define __NR_fstatat64 __NR_newfstatat
#endif
-#ifdef __NR_fstatat64
+#if defined(__NR_fstatat64) && !defined(__UCLIBC_USE_TIME64__)
# include <sys/stat.h>
# include "xstatconv.h"
int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
@@ -43,5 +43,26 @@ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
}
libc_hidden_def(fstatat64)
#else
+
+#if defined(__NR_statx) && defined(__UCLIBC_HAVE_STATX__)
+# include <sys/stat.h>
+# include <statx_cp.h>
+# include <fcntl.h> // for AT_NO_AUTOMOUNT
+
+int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
+{
+ struct statx tmp;
+
+ int r = INLINE_SYSCALL(statx, 5, fd, file, AT_NO_AUTOMOUNT | flag,
+ STATX_BASIC_STATS, &tmp);
+
+ if (r == 0)
+ __cp_stat64_statx ((struct stat64 *)buf, &tmp);
+
+ return r;
+}
+libc_hidden_def(fstatat64)
+#endif
+
/* should add emulation with fstat64() and /proc/self/fd/ ... */
#endif
diff --git a/libc/sysdeps/linux/common/futimesat.c b/libc/sysdeps/linux/common/futimesat.c
index bd73eae7e..fd19fea7c 100644
--- a/libc/sysdeps/linux/common/futimesat.c
+++ b/libc/sysdeps/linux/common/futimesat.c
@@ -11,6 +11,28 @@
#ifdef __NR_futimesat
_syscall3(int, futimesat, int, fd, const char *, file, const struct timeval *, tvp)
-#else
-/* should add emulation with futimes() and /proc/self/fd/ ... */
+#elif defined __NR_utimensat
+#include <errno.h>
+#define __need_NULL
+#include <stddef.h>
+
+int futimesat(int dirfd, const char *file, const struct timeval tvp[2])
+{
+ struct timespec ts[2];
+
+ if (tvp != NULL)
+ {
+ if (tvp[0].tv_usec < 0 || tvp[0].tv_usec >= 1000000
+ || tvp[1].tv_usec < 0 || tvp[1].tv_usec >= 1000000)
+ {
+ __set_errno(EINVAL);
+ return -1;
+ }
+
+ TIMEVAL_TO_TIMESPEC(&tvp[0], &ts[0]);
+ TIMEVAL_TO_TIMESPEC(&tvp[1], &ts[1]);
+ }
+
+ return utimensat(dirfd, file, tvp ? ts : NULL, 0);
+}
#endif
diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c
index 26d3d2946..46726fcbd 100644
--- a/libc/sysdeps/linux/common/getrlimit.c
+++ b/libc/sysdeps/linux/common/getrlimit.c
@@ -9,10 +9,11 @@
#include <sys/syscall.h>
#include <sys/resource.h>
#include <bits/wordsize.h>
+#include <stddef.h> // needed for NULL to be defined
/* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */
-#if defined __NR_ugetrlimit
+#if defined(__NR_ugetrlimit)
/* just call ugetrlimit() */
# define __NR___syscall_ugetrlimit __NR_ugetrlimit
@@ -23,17 +24,58 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
return __syscall_ugetrlimit(resource, rlimits);
}
+libc_hidden_def(getrlimit)
+
+#elif defined(__NR_prlimit64)
+/* Use prlimit64 if present, the prlimit64 syscall is free from a back
+ compatibility stuff for an old getrlimit */
+
+# if __WORDSIZE == 32 && !defined(__USE_FILE_OFFSET64)
+/* If struct rlimit has 64-bit fields (if __WORDSIZE == 64 or __USE_FILE_OFFSET64
+ is defined), then use getrlimit as an alias to getrlimit64, see getrlimit64.c */
+int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
+{
+ struct rlimit64 rlimits64;
+ int res = INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, &rlimits64);
+
+ if (res == 0) {
+ /* If the syscall succeeds but the values do not fit into a
+ rlimit structure set EOVERFLOW errno and retrun -1. */
+ rlimits->rlim_cur = rlimits64.rlim_cur;
+ if (rlimits64.rlim_cur != rlimits->rlim_cur) {
+ if (rlimits64.rlim_cur != RLIM64_INFINITY) {
+ __set_errno(EOVERFLOW);
+ return -1;
+ }
+ rlimits->rlim_cur = RLIM_INFINITY;
+ }
-#elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
+ rlimits->rlim_max = rlimits64.rlim_max;
+ if (rlimits64.rlim_max != rlimits->rlim_max) {
+ if (rlimits64.rlim_max != RLIM64_INFINITY) {
+ __set_errno(EOVERFLOW);
+ return -1;
+ }
+ rlimits->rlim_max = RLIM_INFINITY;
+ }
+ }
+ return res;
+}
+libc_hidden_def(getrlimit)
+# endif
+
+#else
+
+# if !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
/* We don't need to wrap getrlimit() */
_syscall2(int, getrlimit, __rlimit_resource_t, resource,
struct rlimit *, rlim)
-#else
+# else
/* we have to handle old style getrlimit() */
-# define __NR___syscall_getrlimit __NR_getrlimit
+# define __NR___syscall_getrlimit __NR_getrlimit
static __always_inline
_syscall2(int, __syscall_getrlimit, int, resource, struct rlimit *, rlim)
@@ -54,9 +96,7 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
rlimits->rlim_max = RLIM_INFINITY;
return result;
}
-#endif
-libc_hidden_def(getrlimit)
+# endif
-#if __WORDSIZE == 64
-strong_alias_untyped(getrlimit, getrlimit64)
+libc_hidden_def(getrlimit)
#endif
diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c
index be98098a1..47f1410fb 100644
--- a/libc/sysdeps/linux/common/getrlimit64.c
+++ b/libc/sysdeps/linux/common/getrlimit64.c
@@ -17,14 +17,31 @@
#include <_lfs_64.h>
#include <bits/wordsize.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <stddef.h> // needed for NULL to be defined
-/* the regular getrlimit will work just fine for 64bit users */
-#if __WORDSIZE == 32
-# include <sys/resource.h>
+#if defined(__NR_prlimit64)
+
+/* the regular prlimit64 will work just fine for 64-bit users */
+int getrlimit64 (__rlimit_resource_t resource, struct rlimit64 *rlimits)
+{
+ return INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, rlimits);
+}
+
+# if !defined(__NR_ugetrlimit) && (__WORDSIZE == 64 || defined (__USE_FILE_OFFSET64))
+/* If getrlimit is not implemented through the __NR_ugetrlimit and size of
+ rlimit_t == rlimit64_t then use getrlimit as an alias to getrlimit64 */
+strong_alias_untyped(getrlimit64, getrlimit)
+libc_hidden_def(getrlimit)
+# endif
+
+#else
/* Put the soft and hard limits for RESOURCE in *RLIMITS.
- Returns 0 if successful, -1 if not (and sets errno). */
+ Returns 0 if successful, -1 if not (and sets errno).
+ The regular getrlimit will work just fine for 64-bit users */
int getrlimit64 (__rlimit_resource_t resource, struct rlimit64 *rlimits)
{
struct rlimit rlimits32;
@@ -44,3 +61,4 @@ int getrlimit64 (__rlimit_resource_t resource, struct rlimit64 *rlimits)
return 0;
}
#endif
+
diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c
index 1c62b3937..ed18b2be5 100644..100755
--- a/libc/sysdeps/linux/common/gettimeofday.c
+++ b/libc/sysdeps/linux/common/gettimeofday.c
@@ -8,6 +8,37 @@
#include <sys/syscall.h>
#include <sys/time.h>
+#include <time.h>
+
+#ifdef __VDSO_SUPPORT__
+#include "ldso.h"
+#endif
+
+#ifdef __VDSO_SUPPORT__
+typedef int (*gettimeofday_func)(struct timeval * tv, __timezone_ptr_t tz);
+#endif
+
+int gettimeofday(struct timeval * tv, __timezone_ptr_t tz) {
+
+ #ifdef __VDSO_SUPPORT__
+ if ( _dl__vdso_gettimeofday != 0 ){
+ gettimeofday_func func= _dl__vdso_gettimeofday;
+ return func( tv, tz );
+
+ }else{
+ _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
+ }
+ #else
+ if (!tv)
+ return 0;
+
+ struct timespec __ts;
+ int __ret = clock_gettime(CLOCK_REALTIME, &__ts);
+ tv->tv_sec = __ts.tv_sec;
+ tv->tv_usec = (suseconds_t)__ts.tv_nsec / 1000;
+ return __ret;
+ #endif
+}
+
-_syscall2(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
libc_hidden_def(gettimeofday)
diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c
index 8a0baf85f..2ebd8615e 100644
--- a/libc/sysdeps/linux/common/lstat.c
+++ b/libc/sysdeps/linux/common/lstat.c
@@ -9,8 +9,9 @@
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <bits/uClibc_arch_features.h>
-#if defined __NR_fstatat64 && !defined __NR_lstat
+#if defined __NR_fstatat64 && !defined __NR_lstat && !defined(__UCLIBC_USE_TIME64__)
# include <fcntl.h>
int lstat(const char *file_name, struct stat *buf)
diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index 61892994e..efc5b1b7f 100644
--- a/libc/sysdeps/linux/common/lstat64.c
+++ b/libc/sysdeps/linux/common/lstat64.c
@@ -11,7 +11,7 @@
#include <unistd.h>
#include <sys/stat.h>
-#if defined __NR_fstatat64 && !defined __NR_lstat
+#if defined __NR_fstatat64 && !defined __NR_lstat && !defined(__UCLIBC_USE_TIME64__)
# include <fcntl.h>
int lstat64(const char *file_name, struct stat64 *buf)
diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c
index 4463e108a..2b59fefef 100644
--- a/libc/sysdeps/linux/common/nanosleep.c
+++ b/libc/sysdeps/linux/common/nanosleep.c
@@ -10,11 +10,21 @@
#include <time.h>
#include <cancel.h>
-#define __NR___nanosleep_nocancel __NR_nanosleep
-static _syscall2(int, __NC(nanosleep), const struct timespec *, req,
- struct timespec *, rem);
+
+int _NC(nanosleep)(const struct timespec *req, struct timespec *rem)
+{
+ int __ret = clock_nanosleep(CLOCK_REALTIME, 0, req, rem);
+
+ if (__ret != 0) {
+ __set_errno(__ret);
+ return -1;
+ }
+
+ return __ret;
+};
CANCELLABLE_SYSCALL(int, nanosleep,
(const struct timespec *req, struct timespec *rem),
(req, rem))
+
lt_libc_hidden(nanosleep)
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index ccdcf3848..ac09d40f0 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -31,7 +31,7 @@ int open(const char *file, int oflag, ...)
int oldtype, result;
#endif
- if (oflag & O_CREAT) {
+ if (oflag & (O_CREAT | (O_TMPFILE &~ O_DIRECTORY))) {
va_list arg;
va_start(arg, oflag);
mode = va_arg(arg, mode_t);
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index 6e65a988e..9d4c06b18 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -10,13 +10,13 @@
#include <stdarg.h>
#include <cancel.h>
-/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+/* Open FILE with access OFLAG. If OFLAG includes O_CREAT or O_TMPFILE,
a third argument is the file protection. */
int open64(const char *file, int oflag, ...)
{
mode_t mode = 0;
- if (oflag & O_CREAT) {
+ if (oflag & (O_CREAT | (O_TMPFILE &~ O_DIRECTORY))) {
va_list arg;
va_start (arg, oflag);
mode = va_arg (arg, mode_t);
diff --git a/libc/sysdeps/linux/common/openat64.c b/libc/sysdeps/linux/common/openat64.c
index eda3e7db1..cd1b23fa5 100644
--- a/libc/sysdeps/linux/common/openat64.c
+++ b/libc/sysdeps/linux/common/openat64.c
@@ -9,10 +9,18 @@
#include <_lfs_64.h>
#include <sys/syscall.h>
#include <fcntl.h>
+#include <stdarg.h>
#ifdef __NR_openat
-static int __openat64(int fd, const char *file, int oflag, mode_t mode)
+static int __openat64(int fd, const char *file, int oflag, ...)
{
+ va_list ap;
+ mode_t mode;
+
+ va_start(ap, oflag);
+ mode = va_arg(ap, int);
+ va_end(ap);
+
return openat(fd, file, oflag | O_LARGEFILE, mode);
}
strong_alias_untyped(__openat64,openat64)
diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c
index 781f1ff1c..870717bd7 100644
--- a/libc/sysdeps/linux/common/ppoll.c
+++ b/libc/sysdeps/linux/common/ppoll.c
@@ -18,7 +18,7 @@
#include <sys/syscall.h>
-#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+#if (defined __NR_ppoll || defined(__NR_ppoll_time64)) && defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
#define __need_NULL
#include <stddef.h>
@@ -26,6 +26,10 @@
#include <sys/poll.h>
#include <cancel.h>
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
static int
__NC(ppoll)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
const sigset_t *sigmask)
@@ -37,11 +41,14 @@ __NC(ppoll)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
tval = *timeout;
timeout = &tval;
}
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_ppoll_time64)
+ return INLINE_SYSCALL(ppoll_time64, 5, fds, nfds, TO_TS64_P(timeout), sigmask, __SYSCALL_SIGSET_T_SIZE);
+#else
return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, __SYSCALL_SIGSET_T_SIZE);
+#endif
}
CANCELLABLE_SYSCALL(int, ppoll, (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
const sigset_t *sigmask),
(fds, nfds, timeout, sigmask))
-
#endif
diff --git a/libc/sysdeps/linux/common/prlimit.c b/libc/sysdeps/linux/common/prlimit.c
new file mode 100644
index 000000000..81c0f4619
--- /dev/null
+++ b/libc/sysdeps/linux/common/prlimit.c
@@ -0,0 +1,76 @@
+/* Get/set resource limits. Linux specific syscall.
+ Copyright (C) 2021-2022 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <sys/resource.h>
+#include <sysdep.h>
+#include <stddef.h> // needed for NULL to be defined
+
+#if defined(__NR_prlimit64) && __WORDSIZE == 32 && !defined(__USE_FILE_OFFSET64)
+int
+prlimit (__pid_t pid, enum __rlimit_resource resource,
+ const struct rlimit *new_rlimit, struct rlimit *old_rlimit)
+{
+ struct rlimit64 new_rlimit64;
+ struct rlimit64 *new_rlimit64_ptr = NULL;
+ struct rlimit64 old_rlimit64;
+ struct rlimit64 *old_rlimit64_ptr = (old_rlimit != NULL ? &old_rlimit64 : NULL);
+ int res;
+
+ if (new_rlimit != NULL) {
+ if (new_rlimit->rlim_cur == RLIM_INFINITY)
+ new_rlimit64.rlim_cur = RLIM64_INFINITY;
+ else
+ new_rlimit64.rlim_cur = new_rlimit->rlim_cur;
+ if (new_rlimit->rlim_max == RLIM_INFINITY)
+ new_rlimit64.rlim_max = RLIM64_INFINITY;
+ else
+ new_rlimit64.rlim_max = new_rlimit->rlim_max;
+ new_rlimit64_ptr = &new_rlimit64;
+ }
+
+ res = INLINE_SYSCALL (prlimit64, 4, pid, resource, new_rlimit64_ptr,
+ old_rlimit64_ptr);
+
+ if (res == 0 && old_rlimit != NULL) {
+ /* If the syscall succeeds but the values do not fit into a
+ rlimit structure set EOVERFLOW errno and retrun -1.
+ With current Linux implementation of the prlimit64 syscall,
+ overflow can't happen. An extra condition has been added to get
+ the same behavior as in glibc for future potential overflows. */
+ old_rlimit->rlim_cur = old_rlimit64.rlim_cur;
+ if (old_rlimit64.rlim_cur != old_rlimit->rlim_cur) {
+ if (new_rlimit == NULL &&
+ old_rlimit64.rlim_cur != RLIM64_INFINITY) {
+ __set_errno(EOVERFLOW);
+ return -1;
+ }
+ old_rlimit->rlim_cur = RLIM_INFINITY;
+ }
+ old_rlimit->rlim_max = old_rlimit64.rlim_max;
+ if (old_rlimit64.rlim_max != old_rlimit->rlim_max) {
+ if (new_rlimit == NULL &&
+ old_rlimit64.rlim_max != RLIM64_INFINITY) {
+ __set_errno(EOVERFLOW);
+ return -1;
+ }
+ old_rlimit->rlim_max = RLIM_INFINITY;
+ }
+ }
+
+ return res;
+}
+#endif
diff --git a/libc/sysdeps/linux/common/prlimit64.c b/libc/sysdeps/linux/common/prlimit64.c
new file mode 100644
index 000000000..6f57b939e
--- /dev/null
+++ b/libc/sysdeps/linux/common/prlimit64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2023 uClibc-ng
+ * An prlimit64() - get/set resource limits Linux specific syscall.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <sys/resource.h>
+#include <sysdep.h>
+
+#if defined(__NR_prlimit64)
+
+int
+prlimit64 (__pid_t pid, enum __rlimit_resource resource,
+ const struct rlimit64 *new_rlimit, struct rlimit64 *old_rlimit)
+{
+ return INLINE_SYSCALL (prlimit64, 4, pid, resource, new_rlimit,
+ old_rlimit);
+}
+
+# if __WORDSIZE == 64 || defined (__USE_FILE_OFFSET64)
+strong_alias_untyped(prlimit64, prlimit)
+# endif
+
+#endif \ No newline at end of file
diff --git a/libc/sysdeps/linux/common/pselect.c b/libc/sysdeps/linux/common/pselect.c
index bf2c08375..7a446a589 100644
--- a/libc/sysdeps/linux/common/pselect.c
+++ b/libc/sysdeps/linux/common/pselect.c
@@ -26,6 +26,10 @@
#include <signal.h>
#include <cancel.h>
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, const struct timespec *timeout,
const sigset_t *sigmask)
@@ -56,8 +60,11 @@ static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds,
sigmask = (void *)&data;
}
-
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_pselect6_time64)
+ return INLINE_SYSCALL(pselect6_time64, 6, nfds, readfds, writefds, exceptfds, TO_TS64_P(timeout), sigmask);
+#else
return INLINE_SYSCALL(pselect6, 6, nfds, readfds, writefds, exceptfds, timeout, sigmask);
+#endif
#else
struct timeval tval;
int retval;
@@ -88,6 +95,7 @@ static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds,
return retval;
#endif
}
+
CANCELLABLE_SYSCALL(int, pselect, (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
const struct timespec *timeout, const sigset_t *sigmask),
(nfds, readfds, writefds, exceptfds, timeout, sigmask))
diff --git a/libc/sysdeps/linux/common/renameat.c b/libc/sysdeps/linux/common/renameat.c
index b0b91fa3e..0156981de 100644
--- a/libc/sysdeps/linux/common/renameat.c
+++ b/libc/sysdeps/linux/common/renameat.c
@@ -6,12 +6,18 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <sys/syscall.h>
#include <stdio.h>
+#include <fcntl.h>
+#include <sysdep.h>
+#include <errno.h>
+int
+renameat (int oldfd, const char *old, int newfd, const char *new)
+{
#ifdef __NR_renameat
-_syscall4(int, renameat, int, oldfd, const char *, old, int, newfd, const char *, new)
-libc_hidden_def(renameat)
+ return INLINE_SYSCALL (renameat, 4, oldfd, old, newfd, new);
#else
-/* should add emulation with rename() and /proc/self/fd/ ... */
+ return INLINE_SYSCALL (renameat2, 5, oldfd, old, newfd, new, 0);
#endif
+}
+libc_hidden_def (renameat)
diff --git a/libc/sysdeps/linux/common/sched_rr_get_interval.c b/libc/sysdeps/linux/common/sched_rr_get_interval.c
index 7a7de2bc5..c9be134cb 100644
--- a/libc/sysdeps/linux/common/sched_rr_get_interval.c
+++ b/libc/sysdeps/linux/common/sched_rr_get_interval.c
@@ -10,7 +10,12 @@
#include <sys/types.h>
#include <sys/syscall.h>
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_sched_rr_get_interval_time64)
+#define __NR___syscall_sched_rr_get_interval __NR_sched_rr_get_interval_time64
+#else
#define __NR___syscall_sched_rr_get_interval __NR_sched_rr_get_interval
+#endif
+
static __inline__ _syscall2(int, __syscall_sched_rr_get_interval,
__kernel_pid_t, pid, struct timespec *, tp)
diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c
index 3132a109c..84016dd0b 100644
--- a/libc/sysdeps/linux/common/select.c
+++ b/libc/sysdeps/linux/common/select.c
@@ -15,17 +15,19 @@
# define __NR_select __NR__newselect
#endif
-#if !defined __NR_select && defined __NR_pselect6
+#if defined(__NR_pselect6) || defined(__NR_pselect6_time64)
# include <stdint.h>
# define USEC_PER_SEC 1000000L
#endif
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
int __NC(select)(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout)
{
-#ifdef __NR_select
- return INLINE_SYSCALL(select, 5, n, readfds, writefds, exceptfds, timeout);
-#elif defined __NR_pselect6
+#if defined(__NR_pselect6) || defined(__NR_pselect6_time64)
struct timespec _ts, *ts = 0;
if (timeout) {
uint32_t usec;
@@ -47,8 +49,14 @@ int __NC(select)(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
ts = &_ts;
}
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_pselect6_time64)
+ return INLINE_SYSCALL(pselect6_time64, 6, n, readfds, writefds, exceptfds, TO_TS64_P(ts), 0);
+#else
return INLINE_SYSCALL(pselect6, 6, n, readfds, writefds, exceptfds, ts, 0);
#endif
+#elif defined(__NR_select)
+ return INLINE_SYSCALL(select, 5, n, readfds, writefds, exceptfds, ts);
+#endif
}
/* we should guard it, but we need it in other files, so let it fail
* if we miss any of the syscalls */
diff --git a/libc/sysdeps/linux/common/setitimer.c b/libc/sysdeps/linux/common/setitimer.c
index 2febabbc8..eab541329 100644
--- a/libc/sysdeps/linux/common/setitimer.c
+++ b/libc/sysdeps/linux/common/setitimer.c
@@ -10,6 +10,38 @@
#include <sys/time.h>
+#if defined(__UCLIBC_USE_TIME64__)
+
+struct itimerval32_struct {
+ __S32_TYPE __interval_sec;
+ __S32_TYPE __interval_usec;
+ __S32_TYPE __value_sec;
+ __S32_TYPE __value_usec;
+};
+
+int setitimer(__itimer_which_t which, const struct itimerval *restrict new, struct itimerval *restrict old)
+{
+ struct itimerval32_struct __itv32 = {
+ .__interval_sec = new->it_interval.tv_sec,
+ .__interval_usec = new->it_interval.tv_usec,
+ .__value_sec = new->it_value.tv_sec,
+ .__value_usec = new->it_value.tv_usec
+ };
+ struct itimerval32_struct __itv32_old;
+
+ int __ret = INLINE_SYSCALL(setitimer, 3, which, &__itv32, &__itv32_old);
+ if (__ret == 0 && old) {
+ old->it_interval.tv_sec = __itv32_old.__interval_sec;
+ old->it_interval.tv_usec = __itv32_old.__interval_usec;
+ old->it_value.tv_sec = __itv32_old.__value_sec;
+ old->it_value.tv_usec = __itv32_old.__value_usec;
+ }
+
+ return __ret;
+}
+#else
_syscall3(int, setitimer, __itimer_which_t, which,
const struct itimerval *, new, struct itimerval *, old)
+
+#endif
libc_hidden_def(setitimer)
diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c
index 8f4973b72..9c6707235 100644
--- a/libc/sysdeps/linux/common/setrlimit.c
+++ b/libc/sysdeps/linux/common/setrlimit.c
@@ -9,36 +9,65 @@
#include <sys/syscall.h>
#include <sys/resource.h>
#include <bits/wordsize.h>
+#include <stddef.h> // needed for NULL to be defined
/* Only wrap setrlimit if the new usetrlimit is not present and setrlimit sucks */
#if defined(__NR_usetrlimit)
-
/* just call usetrlimit() */
# define __NR___syscall_usetrlimit __NR_usetrlimit
static __always_inline
_syscall2(int, __syscall_usetrlimit, enum __rlimit_resource, resource,
const struct rlimit *, rlim)
-int setrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
+int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
{
return __syscall_usetrlimit(resource, rlimits);
}
+libc_hidden_def(setrlimit)
+
+#elif defined(__NR_prlimit64)
+
+/* Use prlimit64 if present, the prlimit64 syscall is free from a back
+ compatibility stuff for setrlimit */
+
+ # if __WORDSIZE == 32 && !defined(__USE_FILE_OFFSET64)
+/* If struct rlimit has 64-bit fields (if __WORDSIZE == 64 or __USE_FILE_OFFSET64
+ is defined), then use setrlimit as an alias to setrlimit64, see setrlimit64.c */
+int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
+{
+ struct rlimit64 rlimits64;
+
+ if (rlimits->rlim_cur == RLIM_INFINITY)
+ rlimits64.rlim_cur = RLIM64_INFINITY;
+ else
+ rlimits64.rlim_cur = rlimits->rlim_cur;
+ if (rlimits->rlim_max == RLIM_INFINITY)
+ rlimits64.rlim_max = RLIM64_INFINITY;
+ else
+ rlimits64.rlim_max = rlimits->rlim_max;
+
+ return INLINE_SYSCALL (prlimit64, 4, 0, resource, &rlimits64, NULL);
+}
+libc_hidden_def(setrlimit)
+# endif
+
+#else
-#elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
+# if !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
/* We don't need to wrap setrlimit() */
_syscall2(int, setrlimit, __rlimit_resource_t, resource,
const struct rlimit *, rlim)
-#else
+# else
-# define __need_NULL
-# include <stddef.h>
-# include <errno.h>
-# include <sys/param.h>
+# define __need_NULL
+# include <stddef.h>
+# include <errno.h>
+# include <sys/param.h>
/* we have to handle old style setrlimit() */
-# define __NR___syscall_setrlimit __NR_setrlimit
+# define __NR___syscall_setrlimit __NR_setrlimit
static __always_inline
_syscall2(int, __syscall_setrlimit, int, resource, const struct rlimit *, rlim)
@@ -59,9 +88,7 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
RLIM_INFINITY >> 1);
return __syscall_setrlimit(resource, &rlimits_small);
}
-#endif
-libc_hidden_def(setrlimit)
+# endif
-#if __WORDSIZE == 64
-strong_alias_untyped(setrlimit, setrlimit64)
+libc_hidden_def(setrlimit)
#endif
diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c
index fee14f4ad..3446c58fe 100644
--- a/libc/sysdeps/linux/common/setrlimit64.c
+++ b/libc/sysdeps/linux/common/setrlimit64.c
@@ -17,15 +17,31 @@
#include <_lfs_64.h>
#include <bits/wordsize.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <stddef.h> // needed for NULL to be defined
-/* the regular setrlimit will work just fine for 64bit users */
-#if __WORDSIZE == 32
-# include <sys/resource.h>
+#if defined(__NR_prlimit64)
+
+int setrlimit64 (__rlimit_resource_t resource, const struct rlimit64 *rlimits)
+{
+ return INLINE_SYSCALL (prlimit64, 4, 0, resource, rlimits, NULL);
+}
+
+# if !defined(__NR_usetrlimit) && (__WORDSIZE == 64 || defined (__USE_FILE_OFFSET64))
+/* If setrlimit is not implemented through the __NR_usetrlimit and size of
+ rlimit_t == rlimit64_t then use setrlimit as an alias to setrlimit64 */
+strong_alias_untyped(setrlimit64, setrlimit)
+libc_hidden_def(setrlimit)
+# endif
+
+#else
/* Set the soft and hard limits for RESOURCE to *RLIMITS.
Only the super-user can increase hard limits.
- Return 0 if successful, -1 if not (and sets errno). */
+ Return 0 if successful, -1 if not (and sets errno).
+ The regular setrlimit will work just fine for 64bit users */
int setrlimit64 (__rlimit_resource_t resource, const struct rlimit64 *rlimits)
{
struct rlimit rlimits32;
diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c
index 14a261794..75d18ffc2 100644
--- a/libc/sysdeps/linux/common/settimeofday.c
+++ b/libc/sysdeps/linux/common/settimeofday.c
@@ -10,9 +10,21 @@
#ifdef __USE_BSD
# include <sys/time.h>
-# ifdef __NR_settimeofday
-_syscall2(int, settimeofday, const struct timeval *, tv,
- const struct timezone *, tz)
+# include <time.h>
+
+int settimeofday(const struct timeval *tv, const struct timezone *tz)
+{
+ if (!tv)
+ return 0;
+
+ struct timespec __ts = {
+ .tv_sec = tv->tv_sec,
+ .tv_nsec = tv->tv_usec * 1000
+ };
+
+ return clock_settime(CLOCK_REALTIME, &__ts);
+}
+
# elif defined __USE_SVID && defined __NR_stime
# define __need_NULL
# include <stddef.h>
@@ -36,7 +48,6 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
return stime(&when);
}
# endif
-# if defined __NR_settimeofday || (defined __USE_SVID && defined __NR_stime)
+# if defined __NR_settimeofday || defined(__UCLIBC_USE_TIME64__) || (defined __USE_SVID && defined __NR_stime)
libc_hidden_def(settimeofday)
# endif
-#endif
diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c
index a860c0c7f..42f39aea6 100644
--- a/libc/sysdeps/linux/common/stat.c
+++ b/libc/sysdeps/linux/common/stat.c
@@ -9,10 +9,11 @@
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <bits/uClibc_arch_features.h>
#undef stat
-#if defined __NR_fstatat64 && !defined __NR_stat
+#if defined __NR_fstatat64 && !defined __NR_stat && !defined(__UCLIBC_USE_TIME64__)
# include <fcntl.h>
int stat(const char *file_name, struct stat *buf)
@@ -25,7 +26,7 @@ int stat(const char *file_name, struct stat *buf)
int stat(const char *file_name, struct stat *buf)
{
- return fstatat64(AT_FDCWD, file_name, buf, 0);
+ return fstatat64(AT_FDCWD, file_name, (struct stat64 *)buf, 0);
}
#elif __NR_statx && defined __UCLIBC_HAVE_STATX__
# include <fcntl.h>
diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c
index 47d938b11..0875ba39d 100644
--- a/libc/sysdeps/linux/common/stat64.c
+++ b/libc/sysdeps/linux/common/stat64.c
@@ -10,7 +10,7 @@
#include <sys/syscall.h>
#include <sys/stat.h>
-#if defined __NR_fstatat64 && !defined __NR_stat64
+#if defined __NR_fstatat64 && !defined __NR_stat64 && !defined(__UCLIBC_USE_TIME64__)
#include <fcntl.h>
#include <unistd.h>
@@ -30,7 +30,7 @@ int stat64(const char *file_name, struct stat64 *buf)
int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, file_name, AT_NO_AUTOMOUNT,
STATX_BASIC_STATS, &tmp);
if (rc == 0)
- __cp_stat_statx ((struct stat64 *)buf, &tmp);
+ __cp_stat64_statx ((struct stat64 *)buf, &tmp);
return rc;
}
diff --git a/libc/sysdeps/linux/common/statx_cp.c b/libc/sysdeps/linux/common/statx_cp.c
index 9f024eec8..c50d28ecb 100644
--- a/libc/sysdeps/linux/common/statx_cp.c
+++ b/libc/sysdeps/linux/common/statx_cp.c
@@ -24,7 +24,7 @@
#include <statx_cp.h>
-#if !defined(__NR_fstat64) || !defined(__NR_fstatat64)
+#if (!defined(__NR_fstat64) || !defined(__NR_fstatat64)) || defined(__UCLIBC_USE_TIME64__)
void
__cp_stat64_statx (struct stat64 *to, struct statx *from)
{
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index c17e509b9..634dcde0d 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -34,10 +34,6 @@ __attribute_used__ static int ret_enosys_stub(void)
link_warning(stub, #stub ": this function is not implemented") \
strong_alias(ret_enosys_stub, stub)
-#ifndef __ARCH_USE_MMU__
-# undef __NR_fork
-#endif
-
#ifdef __arm__
# define __NR_fadvise64_64 __NR_arm_fadvise64_64
# define __NR_fadvise64 __NR_arm_fadvise64_64
@@ -120,7 +116,7 @@ make_stub(fgetxattr)
make_stub(flistxattr)
#endif
-#if !defined __NR_fork && !defined __NR_clone
+#if !defined __ARCH_USE_MMU__ || (!defined __NR_fork && !defined __NR_clone)
make_stub(fork)
#endif
diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c
index 22403f174..d084ffaad 100644
--- a/libc/sysdeps/linux/common/time.c
+++ b/libc/sysdeps/linux/common/time.c
@@ -9,7 +9,7 @@
#include <sys/syscall.h>
#include <time.h>
-#ifdef __NR_time
+#if defined(__NR_time) && !defined(__UCLIBC_USE_TIME64__)
_syscall_noerr1(time_t, time, time_t *, t)
#else
# include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/timerfd.c b/libc/sysdeps/linux/common/timerfd.c
index f4854ac90..b4a9e1a93 100644
--- a/libc/sysdeps/linux/common/timerfd.c
+++ b/libc/sysdeps/linux/common/timerfd.c
@@ -9,6 +9,10 @@
#include <sys/syscall.h>
#include <sys/timerfd.h>
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
/*
* timerfd_create()
*/
@@ -19,13 +23,24 @@ _syscall2(int, timerfd_create, int, clockid, int, flags)
/*
* timerfd_settime()
*/
-#ifdef __NR_timerfd_settime
-_syscall4(int,timerfd_settime, int, ufd, int, flags, const struct itimerspec *, utmr, struct itimerspec *, otmr)
+#if defined(__NR_timerfd_settime) || defined(__NR_timerfd_settime64)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timerfd_settime64)
+int timerfd_settime(int ufd, int flags, const struct itimerspec *utmr, struct itimerspec *otmr)
+{
+ return INLINE_SYSCALL(timerfd_settime64, 4, ufd, flags, TO_ITS64_P(utmr), otmr);
+}
+#else
+_syscall4(int, timerfd_settime, int, ufd, int, flags, const struct itimerspec *, utmr, struct itimerspec *, otmr)
+#endif
#endif
/*
* timerfd_gettime()
*/
-#ifdef __NR_timerfd_gettime
+#if defined(__NR_timerfd_gettime) || defined(__NR_timerfd_gettime64)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timerfd_gettime64)
+_syscall2_64(int, timerfd_gettime, int, ufd, struct itimerspec *, otmr)
+#else
_syscall2(int, timerfd_gettime, int, ufd, struct itimerspec *, otmr)
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c
index b39d8ef73..507171f24 100644
--- a/libc/sysdeps/linux/common/umount2.c
+++ b/libc/sysdeps/linux/common/umount2.c
@@ -14,7 +14,7 @@ _syscall2(int, umount2, const char *, special_file, int, flags)
libc_hidden_def(umount2)
#endif
-#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __NR_oldumount
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __NR_oldumount && !defined __NR_umount2
_syscall2(int, umount, const char *, special_file, int, flags)
strong_alias(umount,umount2)
#endif
diff --git a/libc/sysdeps/linux/common/utimensat.c b/libc/sysdeps/linux/common/utimensat.c
index 2cfb8247d..fa6f90e55 100644
--- a/libc/sysdeps/linux/common/utimensat.c
+++ b/libc/sysdeps/linux/common/utimensat.c
@@ -9,8 +9,30 @@
#include <sys/syscall.h>
#include <sys/stat.h>
-#ifdef __NR_utimensat
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
+#if defined(__NR_utimensat) || defined(__NR_utimensat_time64)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_utimensat_time64)
+int utimensat(int fd, const char *path, const struct timespec times[2], int flags)
+{
+ struct __ts64_struct __times64[2] = {
+ {
+ .tv_sec = times ? times[0].tv_sec : 0,
+ .tv_nsec = times ? times[0].tv_nsec : 0
+ },
+ {
+ .tv_sec = times ? times[1].tv_sec : 0,
+ .tv_nsec = times ? times[1].tv_nsec : 0
+ }
+ };
+
+ return INLINE_SYSCALL(utimensat_time64, 4, fd, path, times ? &__times64 : 0, flags);
+}
+#else
_syscall4(int, utimensat, int, fd, const char *, path, const struct timespec *, times, int, flags)
+#endif
libc_hidden_def(utimensat)
#else
/* should add emulation with utimens() and /proc/self/fd/ ... */
diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c
index 19f02ae22..cd042d5e7 100644
--- a/libc/sysdeps/linux/common/wait4.c
+++ b/libc/sysdeps/linux/common/wait4.c
@@ -8,6 +8,7 @@
#include <sys/syscall.h>
#include <sys/wait.h>
+#include <sys/resource.h>
# define __NR___syscall_wait4 __NR_wait4
static __always_inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid,
@@ -15,7 +16,21 @@ static __always_inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid,
pid_t __wait4_nocancel(pid_t pid, int *status, int opts, struct rusage *rusage)
{
+#if defined(__UCLIBC_USE_TIME64__)
+ char *arg_rusage = rusage ? (char *)&rusage->ru_maxrss - 4 * sizeof(__S32_TYPE) : 0;
+ int __ret = __syscall_wait4(pid, status, opts, (struct rusage *)arg_rusage);
+ if (__ret > 0 && rusage) {
+ __S32_TYPE __rusage[4];
+ memcpy(__rusage, arg_rusage, 4 * sizeof(__S32_TYPE));
+ struct timeval tv_utime = {.tv_sec = __rusage[0], .tv_usec = __rusage[1]};
+ struct timeval tv_stime = {.tv_sec = __rusage[2], .tv_usec = __rusage[2]};
+ rusage->ru_utime = tv_utime;
+ rusage->ru_stime = tv_stime;
+ }
+ return __ret;
+#else
return __syscall_wait4(pid, status, opts, rusage);
+#endif
}
#ifdef __USE_BSD
strong_alias(__wait4_nocancel,wait4)
diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
index 27f1f8b91..e9bc90ea9 100644
--- a/libc/sysdeps/linux/cris/bits/fcntl.h
+++ b/libc/sysdeps/linux/cris/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -101,11 +102,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/csky/bits/fcntl.h b/libc/sysdeps/linux/csky/bits/fcntl.h
index de8a8a0bc..b36f41569 100644
--- a/libc/sysdeps/linux/csky/bits/fcntl.h
+++ b/libc/sysdeps/linux/csky/bits/fcntl.h
@@ -42,6 +42,7 @@
# define O_DIRECT 00040000 /* direct disk access hint */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -89,11 +90,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h
index b5fe0b588..02c8ac310 100644
--- a/libc/sysdeps/linux/frv/bits/fcntl.h
+++ b/libc/sysdeps/linux/frv/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* don't set atime */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -100,11 +101,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h b/libc/sysdeps/linux/h8300/bits/fcntl.h
index 64ec08ff2..2062f7cda 100644
--- a/libc/sysdeps/linux/h8300/bits/fcntl.h
+++ b/libc/sysdeps/linux/h8300/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -100,11 +101,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h
index 719955802..4ce76ce5f 100644
--- a/libc/sysdeps/linux/hppa/bits/fcntl.h
+++ b/libc/sysdeps/linux/hppa/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 00040000 /* Direct disk access. */
# define O_NOATIME 04000000 /* Do not set atime. */
# define O_PATH 020000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 040010000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -97,11 +98,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h
index d03489ebf..f3c08bbe5 100644
--- a/libc/sysdeps/linux/i386/bits/fcntl.h
+++ b/libc/sysdeps/linux/i386/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -101,11 +102,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
index cd80c87bf..5b6c2fc78 100644
--- a/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
@@ -11,9 +11,6 @@
/* can your target use syscall6() for mmap ? */
#undef __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/i386/crt1.S b/libc/sysdeps/linux/i386/crt1.S
index 35a6552e8..decc68967 100644
--- a/libc/sysdeps/linux/i386/crt1.S
+++ b/libc/sysdeps/linux/i386/crt1.S
@@ -67,6 +67,9 @@
#endif
.type main,%function
.type __uClibc_main,%function
+#ifdef L_rcrt1
+.type reloc_static_pie,%function
+#endif
_start:
/* Clear the frame pointer. The ABI suggests this be done, to mark
the outermost frame obviously. */
@@ -100,6 +103,23 @@ _start:
pop %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-.L0],%ebx
+#ifdef L_rcrt1
+ /* We cannot rely on _DYNAMIC being usable here due to RELRO.
+ Instead we calculate the load address based off a symbol
+ that we know will exist, _start. */
+ pushl %ecx /* Save ecx so it won't get clobbered */
+ pushl %ebx /* Save ebx so it won't get clobbered */
+ xorl %ecx, %ecx /* Clear ecx */
+ addl _start@GOT(%ebx), %ecx /* Get the offset of _start */
+ movl _start@GOT(%ebx), %eax /* Get the run time address of _start */
+ subl %ecx, %eax /* Subtract to find the load address */
+ pushl %eax /* Pass the load address */
+ call reloc_static_pie@PLT
+ popl %eax /* Clean up from function call */
+ popl %ebx /* Restore the GOT address */
+ popl %ecx /* restore ecx */
+#endif
+
/* Push address of our own entry points to .fini and .init. */
pushl _fini@GOT(%ebx)
pushl _init@GOT(%ebx)
diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h
index 66f4e9ceb..a20f44ff7 100644
--- a/libc/sysdeps/linux/ia64/bits/fcntl.h
+++ b/libc/sysdeps/linux/ia64/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -97,11 +98,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/kvx/bits/atomic.h b/libc/sysdeps/linux/kvx/bits/atomic.h
index 3c423e9ba..6e81e6704 100644
--- a/libc/sysdeps/linux/kvx/bits/atomic.h
+++ b/libc/sysdeps/linux/kvx/bits/atomic.h
@@ -1,6 +1,7 @@
-/* Copyright (C) 2010-2012 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
+ Copyright (C) 2023 Kalray Inc.
+
This file is part of the GNU C Library.
- Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,10 +17,15 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+/* Mostly copied from aarch64 atomic.h */
+
#ifndef _KVX_BITS_ATOMIC_H
#define _KVX_BITS_ATOMIC_H
+#define typeof __typeof__
+
#include <stdint.h>
+#include <sysdep.h>
typedef int8_t atomic8_t;
typedef uint8_t uatomic8_t;
@@ -60,82 +66,130 @@ typedef uintmax_t uatomic_max_t;
# define atomic_write_barrier() __builtin_kvx_fence()
#endif
-/*
- * On kvx, we have a boolean compare and swap which means that the operation
- * returns only the success of operation.
- * If operation succeeds, this is simple, we just need to return the provided
- * old value. However, if it fails, we need to load the value to return it for
- * the caller. If the loaded value is different from the "old" provided by the
- * caller, we can return it since it will mean it failed.
- * However, if for some reason the value we read is equal to the old value
- * provided by the caller, we can't simply return it or the caller will think it
- * succeeded. So if the value we read is the same as the "old" provided by
- * the caller, we try again until either we succeed or we fail with a different
- * value than the provided one.
- */
-#define __cmpxchg(ptr, old, new, op_suffix, load_suffix) \
-({ \
- register unsigned long __rn __asm__("r62"); \
- register unsigned long __ro __asm__("r63"); \
- __asm__ __volatile__ ( \
- /* Fence to guarantee previous store to be committed */ \
- "fence\n" \
- /* Init "expect" with previous value */ \
- "copyd $r63 = %[rOld]\n" \
- ";;\n" \
- "1:\n" \
- /* Init "update" value with new */ \
- "copyd $r62 = %[rNew]\n" \
- ";;\n" \
- "acswap" #op_suffix " 0[%[rPtr]], $r62r63\n" \
- ";;\n" \
- /* if acswap succeeds, simply return */ \
- "cb.dnez $r62? 2f\n" \
- ";;\n" \
- /* We failed, load old value */ \
- "l" #op_suffix #load_suffix" $r63 = 0[%[rPtr]]\n" \
- ";;\n" \
- /* Check if equal to "old" one */ \
- "compd.ne $r62 = $r63, %[rOld]\n" \
- ";;\n" \
- /* If different from "old", return it to caller */ \
- "cb.deqz $r62? 1b\n" \
- ";;\n" \
- "2:\n" \
- : "+r" (__rn), "+r" (__ro) \
- : [rPtr] "r" (ptr), [rOld] "r" (old), [rNew] "r" (new) \
- : "memory"); \
- (__ro); \
-})
-
-#define cmpxchg(ptr, o, n) \
-({ \
- unsigned long __cmpxchg__ret; \
- switch (sizeof(*(ptr))) { \
- case 4: \
- __cmpxchg__ret = __cmpxchg((ptr), (o), (n), w, s); \
- break; \
- case 8: \
- __cmpxchg__ret = __cmpxchg((ptr), (o), (n), d, ); \
- break; \
- } \
- (__typeof(*(ptr))) (__cmpxchg__ret); \
-})
-
-#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
- cmpxchg((mem), (oldval), (newval))
-
-
-#define atomic_exchange_acq(mem, newval) \
-({ \
- unsigned long __aea__ret, __aea__old; \
- volatile __typeof((mem)) __aea__m = (mem); \
- do { \
- __aea__old = *__aea__m; \
- __aea__ret = atomic_compare_and_exchange_val_acq((mem), \
- (newval), (__aea__old));\
- } while (__aea__old != __aea__ret); \
- (__aea__old); \
-})
+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 1
+
+/* Compare and exchange.
+ For all "bool" routines, we return FALSE if exchange succesful. */
+
+# define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_64_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_64_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+
+/* Compare and exchange with "acquire" semantics, ie barrier after. */
+
+# define atomic_compare_and_exchange_bool_acq(mem, new, old) \
+ __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+# define atomic_compare_and_exchange_val_acq(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+/* Compare and exchange with "release" semantics, ie barrier before. */
+
+# define atomic_compare_and_exchange_val_rel(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_RELEASE)
+
+
+/* Atomic exchange (without compare). */
+
+# define __arch_exchange_8_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_16_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_32_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_64_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define atomic_exchange_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_RELEASE)
+
+
+/* Atomically add value and return the previous (unincremented) value. */
+
+# define __arch_exchange_and_add_8_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_16_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_32_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_64_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define atomic_exchange_and_add_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
+ __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_and_add_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
#endif
diff --git a/libc/sysdeps/linux/kvx/bits/fcntl.h b/libc/sysdeps/linux/kvx/bits/fcntl.h
index c1815b44f..ea0c59d09 100644
--- a/libc/sysdeps/linux/kvx/bits/fcntl.h
+++ b/libc/sysdeps/linux/kvx/bits/fcntl.h
@@ -42,6 +42,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -86,11 +87,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/kvx/bits/kernel_types.h b/libc/sysdeps/linux/kvx/bits/kernel_types.h
index 832b17674..8f6bda8e9 100644
--- a/libc/sysdeps/linux/kvx/bits/kernel_types.h
+++ b/libc/sysdeps/linux/kvx/bits/kernel_types.h
@@ -7,6 +7,8 @@
#ifndef __ASM_GENERIC_POSIX_TYPES_H
#define __ASM_GENERIC_POSIX_TYPES_H
+#include <asm/bitsperlong.h>
+
typedef unsigned long __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
typedef unsigned int __kernel_mode_t;
diff --git a/libc/sysdeps/linux/kvx/bits/stat.h b/libc/sysdeps/linux/kvx/bits/stat.h
new file mode 100644
index 000000000..716d86150
--- /dev/null
+++ b/libc/sysdeps/linux/kvx/bits/stat.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#include <bits/align64bit.h>
+#include <bits/wordsize.h>
+#include <endian.h>
+
+/* Versions of the `struct stat' data structure. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
+
+/* Versions of the `xmknod' interface. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+
+/*
+ * This struct is exactly the same with the stat64 one because kvx is 64 bit
+ */
+struct stat
+ {
+ unsigned long long st_dev; /* Device. */
+ unsigned long long st_ino; /* 32bit file serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned int st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group.*/
+ unsigned long long st_rdev; /* Device number, if device. */
+ unsigned long long _pad1;
+ __off_t st_size; /* SIze of file, in bytes. */
+ int st_blksize; /* Optimal block size for I/O. */
+ int __pad2;
+ long long st_blocks; /* Number 512-byte blocks allocated */
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
+ long int st_atime; /* Time of last access. */
+ unsigned long int st_atime_nsec;
+ long int st_mtime; /* Time of last modification. */
+ unsigned long int st_mtime_nsec;
+ long int st_ctime; /* Time of last status change. */
+ unsigned long int st_ctime_nsec;
+#endif
+ unsigned int __uclibc_unused4;
+ unsigned int __uclibc_unused5;
+ } __ARCH_64BIT_ALIGNMENT__;
+
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ unsigned long long st_dev; /* Device. */
+ unsigned long long st_ino; /* 32bit file serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned int st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group.*/
+ unsigned long long st_rdev; /* Device number, if device. */
+ unsigned long long __pad3;
+ long long st_size; /* Size of file, in bytes. */
+ int st_blksize; /* Optimal block size for I/O. */
+ int __pad4;
+ long long st_blocks; /* Number 512-byte blocks allocated */
+# if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# else
+ long int st_atime; /* Time of last access. */
+ unsigned long int st_atime_nsec;
+ long int st_mtime; /* Time of last modification. */
+ unsigned long int st_mtime_nsec;
+ long int st_ctime; /* Time of last status change. */
+ unsigned long int st_ctime_nsec;
+# endif
+ unsigned int __uclibc_unused4;
+ unsigned int __uclibc_unused5;
+};
+#endif
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported. */
+#define _STATBUF_ST_NSEC
+
+/* Encoding of the file mode. */
+
+#define __S_IFMT 0170000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0040000 /* Directory. */
+#define __S_IFCHR 0020000 /* Character device. */
+#define __S_IFBLK 0060000 /* Block device. */
+#define __S_IFREG 0100000 /* Regular file. */
+#define __S_IFIFO 0010000 /* FIFO. */
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* POSIX.1b objects. Note that these macros always evaluate to zero. But
+ they do it by enforcing the correct use of the macros. */
+#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+
+/* Protection bits. */
+
+#define __S_ISUID 04000 /* Set user ID on execution. */
+#define __S_ISGID 02000 /* Set group ID on execution. */
+#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
+#define __S_IREAD 0400 /* Read by owner. */
+#define __S_IWRITE 0200 /* Write by owner. */
+#define __S_IEXEC 0100 /* Execute by owner. */
+
+#ifdef __USE_ATFILE
+# define UTIME_NOW ((1l << 30) - 1l)
+# define UTIME_OMIT ((1l << 30) - 2l)
+#endif
diff --git a/libc/sysdeps/linux/kvx/bits/uClibc_arch_features.h b/libc/sysdeps/linux/kvx/bits/uClibc_arch_features.h
index 7aae2d7c3..ecccdc7bb 100644
--- a/libc/sysdeps/linux/kvx/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/kvx/bits/uClibc_arch_features.h
@@ -11,6 +11,9 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
+/* does your target use statx */
+#define __UCLIBC_HAVE_STATX__
+
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/kvx/clone.S b/libc/sysdeps/linux/kvx/clone.S
index 71ea80a01..71553a4a9 100644
--- a/libc/sysdeps/linux/kvx/clone.S
+++ b/libc/sysdeps/linux/kvx/clone.S
@@ -59,10 +59,10 @@ ENTRY (__clone)
scall SYS_ify(clone)
;;
/* If 0, then we are the child */
- cb.deqz $r0, L(child_start)
+ cb.deqz $r0? L(child_start)
;;
/* Else we are the parent, and we need to check for errors */
- cb.dltz $r0, L(clone_error)
+ cb.dltz $r0? L(clone_error)
;;
/* No error ! Yeepa ! */
ret
diff --git a/libc/sysdeps/linux/kvx/sys/procfs.h b/libc/sysdeps/linux/kvx/sys/procfs.h
index bbbfb838e..b72322888 100644
--- a/libc/sysdeps/linux/kvx/sys/procfs.h
+++ b/libc/sysdeps/linux/kvx/sys/procfs.h
@@ -31,20 +31,15 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/user.h>
+#include <sys/ucontext.h>
-__BEGIN_DECLS
+#define ELF_NGREG NGREG
-/* Type for a general-purpose register. */
typedef unsigned long elf_greg_t;
-/* No FP registers for kvx. */
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct {} elf_fpregset_t;
-/* And the whole bunch of them. We could have used `struct
- pt_regs' directly in the typedef, but tradition says that
- the register set is an array, which does have some peculiar
- semantics, so leave it that way. */
-#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+__BEGIN_DECLS
/* Signal info. */
struct elf_siginfo
diff --git a/libc/sysdeps/linux/kvx/sys/ucontext.h b/libc/sysdeps/linux/kvx/sys/ucontext.h
index 548892389..a97b83cad 100644
--- a/libc/sysdeps/linux/kvx/sys/ucontext.h
+++ b/libc/sysdeps/linux/kvx/sys/ucontext.h
@@ -12,12 +12,11 @@
#include <signal.h>
#include <bits/sigcontext.h>
+#define NGREG 70
+
/* Type for general register. */
typedef unsigned long greg_t;
-/* Number of general registers. */
-#define NGREG 64
-
typedef struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
diff --git a/libc/sysdeps/linux/kvx/sys/user.h b/libc/sysdeps/linux/kvx/sys/user.h
index 2e228ff19..c871f1a03 100644
--- a/libc/sysdeps/linux/kvx/sys/user.h
+++ b/libc/sysdeps/linux/kvx/sys/user.h
@@ -1,27 +1 @@
-/*
- * This file is subject to the terms and conditions of the LGPL V2.1
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2019 Kalray Inc.
- */
-
-#ifndef _SYS_USER_H
-#define _SYS_USER_H 1
-
-struct user_regs_struct
-{
- /* GPR */
- unsigned long long gpr_regs[64];
-
- /* SFR */
- unsigned long lc;
- unsigned long le;
- unsigned long ls;
- unsigned long ra;
-
- unsigned long cs;
- unsigned long spc;
-};
-
-#endif
+/* This file is not needed, but in practice gdb might try to include it. */
diff --git a/libc/sysdeps/linux/lm32/bits/fcntl.h b/libc/sysdeps/linux/lm32/bits/fcntl.h
index d1c6e31d7..0bfea6e7a 100644
--- a/libc/sysdeps/linux/lm32/bits/fcntl.h
+++ b/libc/sysdeps/linux/lm32/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -100,11 +101,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set of pipe page size array */
# define F_GETPIPE_SZ 1032 /* Get of pipe page size array */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
index 684d8b88b..5a56c8781 100644
--- a/libc/sysdeps/linux/m68k/bits/fcntl.h
+++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -100,11 +101,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
index 7baae5007..5cfaa4343 100644
--- a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
@@ -15,9 +15,6 @@
/* can your target use syscall6() for mmap ? */
#undef __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/m68k/crt1.S b/libc/sysdeps/linux/m68k/crt1.S
index 815a6076f..e7292682b 100644
--- a/libc/sysdeps/linux/m68k/crt1.S
+++ b/libc/sysdeps/linux/m68k/crt1.S
@@ -78,9 +78,13 @@ _start:
sub.l %fp, %fp
#if !defined __ARCH_USE_MMU__ && defined __PIC__
+#ifdef UCLIBC_FORMAT_ELF
+ move.l #_GLOBAL_OFFSET_TABLE_, %a5
+#else
/* Set up the global pointer. The GOT is at the beginning of the
data segment, whose address is in %d5. */
move.l %d5,%a5
+#endif
.equ have_current_got, 1
#endif
@@ -92,11 +96,11 @@ _start:
arguments for `main': argc, argv. envp will be determined
later in __libc_start_main. */
move.l (%sp)+, %d0 /* Pop the argument count. */
-#ifndef __ARCH_USE_MMU__
- move.l (%sp)+, %a0
-#else
+#if defined(__ARCH_USE_MMU__) || defined(__UCLIBC_FORMAT_ELF__)
move.l %sp, %a0 /* The argument vector starts just at the
current stack top. */
+#else
+ move.l (%sp)+, %a0
#endif
/* Provide the highest stack address to the user code (for stacks
diff --git a/libc/sysdeps/linux/metag/bits/fcntl.h b/libc/sysdeps/linux/metag/bits/fcntl.h
index 4130a5ba1..bdd697348 100644
--- a/libc/sysdeps/linux/metag/bits/fcntl.h
+++ b/libc/sysdeps/linux/metag/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -101,11 +102,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
index 677858227..110927d95 100644
--- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
+++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -100,11 +101,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
index 312cccbce..321d699b0 100644
--- a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
@@ -11,9 +11,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
index ac825a01f..33251c74d 100644
--- a/libc/sysdeps/linux/mips/bits/fcntl.h
+++ b/libc/sysdeps/linux/mips/bits/fcntl.h
@@ -55,6 +55,7 @@
# define O_DIRECT 0x8000 /* Direct disk access hint. */
# define O_NOATIME 0x40000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0x410000 /* Atomically create nameless file. */
#endif
/* For now Linux has no synchronisity options for data and read operations.
@@ -113,11 +114,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/mips/bits/kernel_stat.h b/libc/sysdeps/linux/mips/bits/kernel_stat.h
index a2a6169a3..23a6ce61a 100644
--- a/libc/sysdeps/linux/mips/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h
@@ -14,7 +14,11 @@ typedef struct {
} __ktimespec_t;
#else
typedef struct {
+#if defined(__UCLIBC_USE_TIME64__)
+ __S32_TYPE tv_sec;
+#else
time_t tv_sec;
+#endif
unsigned long tv_nsec;
} __ktimespec_t;
#endif
diff --git a/libc/sysdeps/linux/mips/bits/resource.h b/libc/sysdeps/linux/mips/bits/resource.h
index b204aefd6..97487d274 100644
--- a/libc/sysdeps/linux/mips/bits/resource.h
+++ b/libc/sysdeps/linux/mips/bits/resource.h
@@ -99,7 +99,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
@@ -117,10 +123,10 @@ enum __rlimit_resource
# ifndef __USE_FILE_OFFSET64
# define RLIM_INFINITY ((long int)(~0UL >> 1))
# else
-# define RLIM_INFINITY 0x7fffffffffffffffULL
+# define RLIM_INFINITY 0xffffffffffffffffULL
# endif
# ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffULL
+# define RLIM64_INFINITY 0xffffffffffffffffULL
# endif
#endif
@@ -167,6 +173,15 @@ enum __rusage_who
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+#ifdef __USE_GNU
+ ,
+ /* The calling thread. */
+ RUSAGE_THREAD = 1
+# define RUSAGE_THREAD RUSAGE_THREAD
+ /* Name for the same functionality on Solaris. */
+# define RUSAGE_LWP RUSAGE_THREAD
+#endif
};
#define __need_timeval
diff --git a/libc/sysdeps/linux/mips/bits/sem.h b/libc/sysdeps/linux/mips/bits/sem.h
index 3e4e9682b..35eaa05c3 100644
--- a/libc/sysdeps/linux/mips/bits/sem.h
+++ b/libc/sysdeps/linux/mips/bits/sem.h
@@ -38,9 +38,20 @@
struct semid_ds
{
struct ipc_perm sem_perm; /* operation permission struct */
- __time_t sem_otime; /* last semop() time */
+#if defined(__UCLIBC_USE_TIME64__)
+ unsigned long int __sem_otime_internal_1; /* last semop() time */
+ unsigned long int __sem_otime_internal_2;
+ unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */
+ unsigned long int __sem_ctime_internal_2;
+#else
+ __time_t sem_otime; /* last semop() time */
__time_t sem_ctime; /* last time changed by semctl() */
+#endif
unsigned long int sem_nsems; /* number of semaphores in set */
+#if defined(__UCLIBC_USE_TIME64__)
+ __time_t sem_otime;
+ __time_t sem_ctime;
+#endif
unsigned long int __uclibc_unused1;
unsigned long int __uclibc_unused2;
};
diff --git a/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h b/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
index 59d9f0807..bcdf124a4 100644
--- a/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
@@ -12,9 +12,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#if _MIPS_SIM == _ABIO32
#define __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S
index 083615515..7c4db447c 100644
--- a/libc/sysdeps/linux/mips/crt1.S
+++ b/libc/sysdeps/linux/mips/crt1.S
@@ -78,6 +78,10 @@
.weak _init
.weak _fini
#endif
+#ifdef L_rcrt1
+ .type reloc_static_pie,@function
+ .hidden .L0
+#endif
.type main,@function
.type __uClibc_main,@function
.ent __start
@@ -90,6 +94,25 @@ __start:
PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */
move $31, $0
#endif
+#ifdef L_rcrt1
+ PTR_LA $4, _DYNAMIC /* Place _DYNAMIC into the GOT */
+ REG_S $4, -0x7ff0($28) /* offset to GOT stolen from dl-startup */
+ jal .L0 /* Get the current $pc address */
+.L0:
+ PTR_SUBU $4, $31, $25 /* Calculate load addr */
+ move $31, $0 /* Clear ra */
+ and $29, -2 * SZREG /* Ensure stack is aligned */
+ PTR_ADDIU $29, (-2 * SZREG) /* Allocate 2 register spaces on stack */
+ REG_S $2, SZREG($29) /* Store atexit in case it exists */
+ PTR_LA $5, reloc_static_pie /* function calls before relocation
+ don't work unless we set $t9 manually */
+ PTR_ADDU $25, $4, $5 /* store reloc_static_pie in $t9 */
+ jalr $25 /* call reloc_static_pie */
+ nop /* delay slot, just in case */
+ REG_L $2, SZREG($29) /* cleanup stack */
+ PTR_ADDIU $29, $29, (2 * SZREG)
+
+#endif
PTR_LA $4, main /* main */
PTR_L $5, 0($29) /* argc */
diff --git a/libc/sysdeps/linux/nds32/Makefile.arch b/libc/sysdeps/linux/nds32/Makefile.arch
index caf163844..c7627b847 100644
--- a/libc/sysdeps/linux/nds32/Makefile.arch
+++ b/libc/sysdeps/linux/nds32/Makefile.arch
@@ -2,6 +2,6 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
CSRC-y := brk.c prctl.c mremap.c
-SSRC-y := setjmp.S __longjmp.S bsd-setjmp.S bsd-_setjmp.S clone.S vfork.S sysdep.S
+SSRC-y := setjmp.S __longjmp.S bsd-setjmp.S bsd-_setjmp.S clone.S sysdep.S
CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c swapcontext.c
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S
diff --git a/libc/sysdeps/linux/nds32/bits/fcntl.h b/libc/sysdeps/linux/nds32/bits/fcntl.h
index fa9f039f5..2e6a95ec8 100644
--- a/libc/sysdeps/linux/nds32/bits/fcntl.h
+++ b/libc/sysdeps/linux/nds32/bits/fcntl.h
@@ -58,6 +58,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -105,11 +106,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/nds32/bits/kernel_types.h b/libc/sysdeps/linux/nds32/bits/kernel_types.h
index 1b6ae4d1b..6b142d2e5 100644
--- a/libc/sysdeps/linux/nds32/bits/kernel_types.h
+++ b/libc/sysdeps/linux/nds32/bits/kernel_types.h
@@ -14,13 +14,13 @@
typedef unsigned short __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
-typedef unsigned short __kernel_mode_t;
+typedef unsigned int __kernel_mode_t;
typedef unsigned short __kernel_nlink_t;
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
-typedef unsigned short __kernel_ipc_pid_t;
-typedef unsigned short __kernel_uid_t;
-typedef unsigned short __kernel_gid_t;
+typedef int __kernel_ipc_pid_t;
+typedef unsigned int __kernel_uid_t;
+typedef unsigned int __kernel_gid_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
@@ -34,19 +34,11 @@ typedef unsigned short __kernel_gid16_t;
typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;
-typedef unsigned short __kernel_old_uid_t;
-typedef unsigned short __kernel_old_gid_t;
-typedef __kernel_dev_t __kernel_old_dev_t;
+typedef __kernel_uid_t __kernel_old_uid_t;
+typedef __kernel_gid_t __kernel_old_gid_t;
+typedef unsigned int __kernel_old_dev_t;
typedef long __kernel_long_t;
typedef unsigned long __kernel_ulong_t;
__extension__ typedef long long __kernel_loff_t;
-typedef struct {
-#ifdef __USE_ALL
- int val[2];
-#else
- int __val[2];
-#endif
-} __kernel_fsid_t;
-
#endif /* __ARCH_NDS32_POSIX_TYPES_H */
diff --git a/libc/sysdeps/linux/nds32/bits/syscalls.h b/libc/sysdeps/linux/nds32/bits/syscalls.h
index a5cdda18a..50e30db7d 100644
--- a/libc/sysdeps/linux/nds32/bits/syscalls.h
+++ b/libc/sysdeps/linux/nds32/bits/syscalls.h
@@ -37,8 +37,7 @@
#define Y(x) X(x)
#define LIB_SYSCALL __NR_syscall
-#define __issue_syscall(syscall_name) \
-" syscall " Y(syscall_name) "; \n"
+#define __issue_syscall(syscall_name) "syscall 0x0;\n"
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) ((unsigned int) (val) >= 0xfffff001u)
diff --git a/libc/sysdeps/linux/nds32/sys/ucontext.h b/libc/sysdeps/linux/nds32/sys/ucontext.h
index 0d7422aab..ea86a3ad0 100644
--- a/libc/sysdeps/linux/nds32/sys/ucontext.h
+++ b/libc/sysdeps/linux/nds32/sys/ucontext.h
@@ -36,10 +36,10 @@ typedef struct sigcontext mcontext_t;
/* Userlevel context. */
-typedef struct ucontext
+typedef struct ucontext_t
{
- unsigned long int uc_flags;
- struct ucontext *uc_link;
+ unsigned long int __uc_flags;
+ struct ucontext_t *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
__sigset_t uc_sigmask;
diff --git a/libc/sysdeps/linux/nds32/vfork.S b/libc/sysdeps/linux/nds32/vfork.S
deleted file mode 100644
index ab32135fc..000000000
--- a/libc/sysdeps/linux/nds32/vfork.S
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2016-2017 Andes Technology, Inc.
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
- Contributed by Philip Blundell <philb@gnu.org>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <sysdep.h>
-#define _ERRNO_H 1
-#include <bits/errno.h>
-
-/* Clone the calling process, but without copying the whole address space.
- The calling process is suspended until the new process exits or is
- replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
- and the process ID of the new process to the old process. */
-
-ENTRY (__vfork)
-#ifdef PIC
-.pic
-#endif
-
-#ifdef __NR_vfork
- syscall __NR_vfork
- bltz $r0, 2f
-1:
- ret
-2:
- sltsi $r1, $r0, -4096
- bnez $r1, 1b;
-
-# ifdef __ASSUME_VFORK_SYSCALL
-# ifdef PIC
- pushm $gp, $lp
- cfi_adjust_cfa_offset(8)
- cfi_rel_offset(gp, 0)
- cfi_rel_offset(lp, 4)
- mfusr $r15, $PC
- sethi $gp, hi20(_GLOBAL_OFFSET_TABLE_+4)
- ori $gp, $gp, lo12(_GLOBAL_OFFSET_TABLE_+8)
- add $gp, $gp, $r15
-
- ! r15=C_SYMBOL_NAME(__syscall_error)@PLT
- sethi $r15, hi20(C_SYMBOL_NAME(__syscall_error)@PLT)
- ori $r15, $r15, lo12(C_SYMBOL_NAME(__syscall_error)@PLT)
- add $r15, $r15, $gp
-
- ! jump to SYSCALL_ERROR
- jral $r15
- popm $gp, $lp
- cfi_adjust_cfa_offset(-8)
- cfi_restore(lp)
- cfi_restore(gp)
- ret
-# else
- j C_SYMBOL_NAME(__syscall_error)
-# endif
-# else
- /* Check if vfork syscall is known at all. */
- li $r1, -ENOSYS
- beq $r0, $r1, 1f
-
-# ifdef PIC
-3:
- pushm $gp, $lp
- cfi_adjust_cfa_offset(8)
- cfi_rel_offset(gp, 0)
- cfi_rel_offset(lp, 4)
- mfusr $r15, $PC
- sethi $gp, hi20(_GLOBAL_OFFSET_TABLE_+4)
- ori $gp, $gp, lo12(_GLOBAL_OFFSET_TABLE_+8)
- add $gp, $gp, $r15
-
- ! r15=C_SYMBOL_NAME(__syscall_error)@PLT
- sethi $r15, hi20(C_SYMBOL_NAME(__syscall_error)@PLT)
- ori $r15, $r15, lo12(C_SYMBOL_NAME(__syscall_error)@PLT)
- add $r15, $r15, $gp
-
- ! jump to SYSCALL_ERROR
- jral $r15
- popm $gp, $lp
- cfi_adjust_cfa_offset(-8)
- cfi_restore(lp)
- cfi_restore(gp)
- ret
-# else
- j C_SYMBOL_NAME(__syscall_error)
-# endif
-1:
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
- /* If we don't have vfork, fork is close enough. */
- syscall __NR_fork
- bgez $r0, 1f
- sltsi $r1, $r0, -4096
- bnez $r1, 1f
-
-# ifdef PIC
- b 3b
-# else
- j C_SYMBOL_NAME(__syscall_error)
-# endif
-1:
- ret
-
-#elif !defined __NR_vfork
-# error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
-#endif
-
-PSEUDO_END (__vfork)
-weak_alias (__vfork, vfork)
-libc_hidden_def (vfork)
diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h
index 1ad086b8c..200a35443 100644
--- a/libc/sysdeps/linux/nios2/bits/fcntl.h
+++ b/libc/sysdeps/linux/nios2/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -100,11 +101,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/or1k/bits/fcntl.h b/libc/sysdeps/linux/or1k/bits/fcntl.h
index a82ede424..c9599ef3a 100644
--- a/libc/sysdeps/linux/or1k/bits/fcntl.h
+++ b/libc/sysdeps/linux/or1k/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -102,11 +103,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/or1k/bits/kernel_stat.h b/libc/sysdeps/linux/or1k/bits/kernel_stat.h
new file mode 100644
index 000000000..2e5eab901
--- /dev/null
+++ b/libc/sysdeps/linux/or1k/bits/kernel_stat.h
@@ -0,0 +1,27 @@
+#ifndef _BITS_STAT_STRUCT_H
+#define _BITS_STAT_STRUCT_H
+
+struct kernel_stat {
+ unsigned long st_dev; /* Device. */
+ unsigned long st_ino; /* File serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned int st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group. */
+ unsigned long st_rdev; /* Device number, if device. */
+ unsigned long __pad1;
+ long st_size; /* Size of file, in bytes. */
+ int st_blksize; /* Optimal block size for I/O. */
+ int __pad2;
+ long st_blocks; /* Number 512-byte blocks allocated. */
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ unsigned int __unused4;
+ unsigned int __unused5;
+};
+
+#define kernel_stat64 kernel_stat
+
+#endif /* _BITS_STAT_STRUCT_H */
+
diff --git a/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h b/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h
index a9560b0b9..e11e71f88 100644
--- a/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h
@@ -14,9 +14,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
index 30f1e4e21..ef1beeca0 100644
--- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
+++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 0400000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -101,11 +102,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
index ce62b2ba2..023eefeea 100644
--- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
@@ -39,9 +39,9 @@ struct kernel_stat64 {
long long st_size; /* Size of file, in bytes. */
long st_blksize; /* Optimal block size for I/O. */
long long st_blocks; /* Number 512-byte blocks allocated. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
unsigned long int __uclibc_unused4;
unsigned long int __uclibc_unused5;
};
diff --git a/libc/sysdeps/linux/powerpc/bits/sem.h b/libc/sysdeps/linux/powerpc/bits/sem.h
index a9d895374..8d338eac0 100644
--- a/libc/sysdeps/linux/powerpc/bits/sem.h
+++ b/libc/sysdeps/linux/powerpc/bits/sem.h
@@ -35,6 +35,7 @@
#define SETALL 17 /* set all semval's */
+
/* Data structure describing a set of semaphores. */
struct semid_ds
{
@@ -42,16 +43,31 @@ struct semid_ds
#if __WORDSIZE == 32
unsigned int __uclibc_unused1;
#endif
+#if defined(__UCLIBC_USE_TIME64__)
+ unsigned long int __sem_otime_internal_1; /* last semop() time */
+ unsigned long int __sem_otime_internal_2;
+#else
__time_t sem_otime; /* last semop() time */
+#endif
#if __WORDSIZE == 32
unsigned int __uclibc_unused2;
#endif
+#if defined(__UCLIBC_USE_TIME64__)
+ unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */
+ unsigned long int __sem_ctime_internal_2;
+#else
__time_t sem_ctime; /* last time changed by semctl() */
+#endif
unsigned long int sem_nsems; /* number of semaphores in set */
+#if defined(__UCLIBC_USE_TIME64__)
+ __time_t sem_otime;
+ __time_t sem_ctime;
+#endif
unsigned long __uclibc_unused3;
unsigned long __uclibc_unused4;
};
+
/* The user should define a union like the following to use it for arguments
for `semctl'.
diff --git a/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
index bc6ae652e..661069384 100644
--- a/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
@@ -11,9 +11,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#define __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S
index 27bfc5a5a..3ac32636c 100644
--- a/libc/sysdeps/linux/powerpc/crt1.S
+++ b/libc/sysdeps/linux/powerpc/crt1.S
@@ -41,6 +41,9 @@
.weak _init
.weak _fini
#endif
+#ifdef L_rcrt1
+ .type reloc_static_pie,%function
+#endif
.type main,%function
.type __uClibc_main,%function
@@ -57,6 +60,26 @@ _start:
bl _GLOBAL_OFFSET_TABLE_-4@local
mflr r31
# endif
+ /* in PIC/PIE, plt stubs need r30 to point to the GOT if using secure-plt */
+# ifdef PPC_HAS_SECUREPLT
+ mr 30,31
+# endif
+#ifdef L_rcrt1
+ stwu r3, -4(r1) /* Save r3 */
+ stwu r9, -16(r1) /* Save r9 */
+ bcl 20,31,2f /* Jump to label 2 */
+2: mflr r3 /* Load lr into r3 */
+ addis r3, r3, _DYNAMIC-2b@ha /* Add high half of _DYNAMIC to r3 */
+ addi r3,r3,_DYNAMIC-2b@l /* Add low half of _DYNAMIC */
+ lwz r4, 0(r31) /* load _DYNAMIC from the GOT */
+ subf r3, r4, r3 /* sub _DYNAMIC@got and it's actual address */
+ bl reloc_static_pie /* Call reloc_static_pie */
+ lwzu r9, 0(r1) /* restore r9 */
+ addi r1, r1, 16 /* update stack pointer */
+ lwzu r3, 0(r1) /* restore r3 */
+ addi r1, r1, 4 /* update stack pointer */
+ li r5, 0 /* zero r5 */
+#endif
#endif
/* Set up the small data pointer in r13. */
#ifdef __PIC__
diff --git a/libc/sysdeps/linux/powerpc/sys/procfs.h b/libc/sysdeps/linux/powerpc/sys/procfs.h
index 7ae12e3cc..9e6ec191c 100644
--- a/libc/sysdeps/linux/powerpc/sys/procfs.h
+++ b/libc/sysdeps/linux/powerpc/sys/procfs.h
@@ -34,7 +34,7 @@ __BEGIN_DECLS
/* These definitions are normally provided by ucontext.h via
asm/sigcontext.h, asm/ptrace.h, and asm/elf.h. Otherwise we define
them here. */
-#ifndef __PPC64_ELF_H
+#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H
#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
#define ELF_NFPREG 33 /* includes fpscr */
#if __WORDSIZE == 32
diff --git a/libc/sysdeps/linux/riscv32/Makefile b/libc/sysdeps/linux/riscv32/Makefile
new file mode 100644
index 000000000..43dc60a42
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/Makefile
@@ -0,0 +1,6 @@
+top_srcdir=../../../../
+top_builddir=../../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.arch
+include $(top_srcdir)Makerules
diff --git a/libc/sysdeps/linux/riscv32/Makefile.arch b/libc/sysdeps/linux/riscv32/Makefile.arch
new file mode 100644
index 000000000..21ecaa65b
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/Makefile.arch
@@ -0,0 +1,2 @@
+CSRC-y := __syscall_error.c cache.c
+SSRC-y := __longjmp.S setjmp.S vfork.S clone.S
diff --git a/libc/sysdeps/linux/riscv32/__longjmp.S b/libc/sysdeps/linux/riscv32/__longjmp.S
new file mode 100644
index 000000000..6079f98c1
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/__longjmp.S
@@ -0,0 +1,57 @@
+/* longjmp, RISC-V version.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <sys/asm.h>
+
+ENTRY (__longjmp)
+ REG_L ra, 0*SZREG(a0)
+ REG_L s0, 1*SZREG(a0)
+ REG_L s1, 2*SZREG(a0)
+ REG_L s2, 3*SZREG(a0)
+ REG_L s3, 4*SZREG(a0)
+ REG_L s4, 5*SZREG(a0)
+ REG_L s5, 6*SZREG(a0)
+ REG_L s6, 7*SZREG(a0)
+ REG_L s7, 8*SZREG(a0)
+ REG_L s8, 9*SZREG(a0)
+ REG_L s9, 10*SZREG(a0)
+ REG_L s10,11*SZREG(a0)
+ REG_L s11,12*SZREG(a0)
+ REG_L sp, 13*SZREG(a0)
+
+#ifndef __riscv_float_abi_soft
+ FREG_L fs0, 14*SZREG+ 0*SZFREG(a0)
+ FREG_L fs1, 14*SZREG+ 1*SZFREG(a0)
+ FREG_L fs2, 14*SZREG+ 2*SZFREG(a0)
+ FREG_L fs3, 14*SZREG+ 3*SZFREG(a0)
+ FREG_L fs4, 14*SZREG+ 4*SZFREG(a0)
+ FREG_L fs5, 14*SZREG+ 5*SZFREG(a0)
+ FREG_L fs6, 14*SZREG+ 6*SZFREG(a0)
+ FREG_L fs7, 14*SZREG+ 7*SZFREG(a0)
+ FREG_L fs8, 14*SZREG+ 8*SZFREG(a0)
+ FREG_L fs9, 14*SZREG+ 9*SZFREG(a0)
+ FREG_L fs10,14*SZREG+10*SZFREG(a0)
+ FREG_L fs11,14*SZREG+11*SZFREG(a0)
+#endif
+
+ seqz a0, a1
+ add a0, a0, a1 # a0 = (a1 == 0) ? 1 : a1
+ ret
+
+END (__longjmp)
+libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/riscv32/__syscall_error.c b/libc/sysdeps/linux/riscv32/__syscall_error.c
new file mode 100644
index 000000000..c682aae49
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/__syscall_error.c
@@ -0,0 +1,18 @@
+/* Wrapper for setting errno.
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <errno.h>
+#include <features.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ * an error number into errno. */
+long __syscall_error(int err_no) attribute_hidden;
+long __syscall_error(int err_no)
+{
+ __set_errno(-err_no);
+ return -1;
+}
diff --git a/libc/sysdeps/linux/riscv32/bits/atomic.h b/libc/sysdeps/linux/riscv32/bits/atomic.h
new file mode 100644
index 000000000..555a73dec
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/atomic.h
@@ -0,0 +1,170 @@
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _RISCV32_ATOMIC_MACHINE_H
+#define _RISCV32_ATOMIC_MACHINE_H 1
+
+#define typeof __typeof__
+
+#include <stdint.h>
+#include <sysdep.h>
+
+typedef int8_t atomic8_t;
+typedef int16_t atomic16_t;
+typedef int32_t atomic32_t;
+typedef int64_t atomic64_t;
+
+typedef uint8_t uatomic8_t;
+typedef uint16_t uatomic16_t;
+typedef uint32_t uatomic32_t;
+typedef uint64_t uatomic64_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 1
+
+/* Compare and exchange.
+ For all "bool" routines, we return FALSE if exchange succesful. */
+
+# define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_64_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_64_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+
+/* Compare and exchange with "acquire" semantics, ie barrier after. */
+
+# define atomic_compare_and_exchange_bool_acq(mem, new, old) \
+ __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+# define atomic_compare_and_exchange_val_acq(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+/* Compare and exchange with "release" semantics, ie barrier before. */
+
+# define atomic_compare_and_exchange_val_rel(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_RELEASE)
+
+
+/* Atomic exchange (without compare). */
+
+# define __arch_exchange_8_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_16_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_32_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_64_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define atomic_exchange_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_RELEASE)
+
+
+/* Atomically add value and return the previous (unincremented) value. */
+
+# define __arch_exchange_and_add_8_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_16_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_32_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_64_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define atomic_exchange_and_add_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
+ __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_and_add_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
+ __ATOMIC_RELEASE)
+
+/* Barrier macro. */
+#define atomic_full_barrier() __sync_synchronize()
+
+#endif
diff --git a/libc/sysdeps/linux/riscv32/bits/endian.h b/libc/sysdeps/linux/riscv32/bits/endian.h
new file mode 100644
index 000000000..4aaf559d4
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/endian.h
@@ -0,0 +1,5 @@
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/libc/sysdeps/linux/riscv32/bits/fcntl.h b/libc/sysdeps/linux/riscv32/bits/fcntl.h
new file mode 100644
index 000000000..a9d7c84e0
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/fcntl.h
@@ -0,0 +1,231 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ *
+ * Licensed under the LGPL v2.1 or later, see the file
+ * COPYING.LIB in this tarball.
+ */
+
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+#include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 00000003
+#define O_RDONLY 00000000
+#define O_WRONLY 00000001
+#define O_RDWR 00000002
+#define O_CREAT 00000100 /* not fcntl */
+#define O_EXCL 00000200 /* not fcntl */
+#define O_NOCTTY 00000400 /* not fcntl */
+#define O_TRUNC 00001000 /* not fcntl */
+#define O_APPEND 00002000
+#define O_NONBLOCK 00004000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 00010000
+#define O_FSYNC O_SYNC
+#define O_ASYNC 00020000
+
+#ifdef __USE_XOPEN2K8
+# define O_DIRECTORY 00200000 /* Must be a directory. */
+# define O_NOFOLLOW 00400000 /* Do not follow links. */
+# define O_CLOEXEC 02000000 /* Set close_on_exec. */
+#endif
+
+#ifdef __USE_GNU
+# define O_DIRECT 00040000 /* Direct disk access. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE 00100000
+#endif
+
+/* For now Linux has synchronisity options for data and read operations.
+ We define the symbols here but let them do the same as O_SYNC since
+ this is a superset. */
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC O_SYNC /* Synchronize data. */
+# define O_RSYNC O_SYNC /* Synchronize read operations. */
+#endif
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+
+#ifndef __USE_FILE_OFFSET64
+# define F_GETLK 5 /* Get record locking info. */
+# define F_SETLK 6 /* Set record locking info (non-blocking). */
+# define F_SETLKW 7 /* Set record locking info (blocking). */
+#else
+# define F_GETLK F_GETLK64 /* Get record locking info. */
+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
+#endif
+#define F_GETLK64 12 /* Get record locking info. */
+#define F_SETLK64 13 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 14 /* Set record locking info (blocking). */
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
+# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
+# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG 10 /* Set number of signal to be sent. */
+# define F_GETSIG 11 /* Get number of signal to be sent. */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETLEASE 1024 /* Set a lease. */
+# define F_GETLEASE 1025 /* Enquire what lease is active. */
+# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
+#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
+
+/* For F_[GET|SET]FL. */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
+#define F_RDLCK 0 /* Read lock. */
+#define F_WRLCK 1 /* Write lock. */
+#define F_UNLCK 2 /* Remove lock. */
+
+/* For old implementation of bsd flock(). */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+#ifdef __USE_BSD
+/* Operations for bsd flock(), also used by the kernel implementation. */
+# define LOCK_SH 1 /* shared lock */
+# define LOCK_EX 2 /* exclusive lock */
+# define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+# define LOCK_UN 8 /* remove lock */
+#endif
+
+#ifdef __USE_GNU
+# define LOCK_MAND 32 /* This is a mandatory flock: */
+# define LOCK_READ 64 /* ... which allows concurrent read operations. */
+# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
+# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY. */
+# define DN_ACCESS 0x00000001 /* File accessed. */
+# define DN_MODIFY 0x00000002 /* File modified. */
+# define DN_CREATE 0x00000004 /* File created. */
+# define DN_DELETE 0x00000008 /* File removed. */
+# define DN_RENAME 0x00000010 /* File renamed. */
+# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
+#endif
+
+struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+ BSD systems which did not managed to hide these kernel macros. */
+#ifdef __USE_BSD
+# define FAPPEND O_APPEND
+# define FFSYNC O_FSYNC
+# define FASYNC O_ASYNC
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
+#endif /* Use BSD. */
+
+/* Advise to `posix_fadvise'. */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
+#endif
+
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
+/* Flags for SYNC_FILE_RANGE. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
+__BEGIN_DECLS
+
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+
+/* Splice address range into a pipe. */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+
+/* Splice two files together. */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers. */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+
+#endif
+__END_DECLS
diff --git a/libc/sysdeps/linux/riscv32/bits/fenv.h b/libc/sysdeps/linux/riscv32/bits/fenv.h
new file mode 100644
index 000000000..a3f8031af
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/fenv.h
@@ -0,0 +1,73 @@
+/* Floating point environment, RISC-V version.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+enum
+ {
+ FE_INEXACT =
+#define FE_INEXACT (0x01)
+ FE_INEXACT,
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW (0x02)
+ FE_UNDERFLOW,
+ FE_OVERFLOW =
+#define FE_OVERFLOW (0x04)
+ FE_OVERFLOW,
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO (0x08)
+ FE_DIVBYZERO,
+ FE_INVALID =
+#define FE_INVALID (0x10)
+ FE_INVALID
+ };
+
+#define FE_ALL_EXCEPT \
+ (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+enum
+ {
+ FE_TONEAREST =
+#define FE_TONEAREST (0x0)
+ FE_TONEAREST,
+ FE_TOWARDZERO =
+#define FE_TOWARDZERO (0x1)
+ FE_TOWARDZERO,
+ FE_DOWNWARD =
+#define FE_DOWNWARD (0x2)
+ FE_DOWNWARD,
+ FE_UPWARD =
+#define FE_UPWARD (0x3)
+ FE_UPWARD
+ };
+
+
+typedef unsigned int fexcept_t;
+typedef unsigned int fenv_t;
+
+/* If the default argument is used we use this value. */
+#define FE_DFL_ENV ((__const fenv_t *) -1)
+
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+/* Type representing floating-point control modes. */
+typedef unsigned int femode_t;
+
+/* Default floating-point control modes. */
+# define FE_DFL_MODE ((const femode_t *) -1L)
+#endif
diff --git a/libc/sysdeps/linux/riscv32/bits/kernel_types.h b/libc/sysdeps/linux/riscv32/bits/kernel_types.h
new file mode 100644
index 000000000..832b17674
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/kernel_types.h
@@ -0,0 +1,42 @@
+/* Note that we use the exact same include guard #define names
+ * as asm/posix_types.h. This will avoid gratuitous conflicts
+ * with the posix_types.h kernel header, and will ensure that
+ * our private content, and not the kernel header, will win.
+ * -Erik
+ */
+#ifndef __ASM_GENERIC_POSIX_TYPES_H
+#define __ASM_GENERIC_POSIX_TYPES_H
+
+typedef unsigned long __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned int __kernel_mode_t;
+typedef unsigned int __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef int __kernel_pid_t;
+typedef int __kernel_ipc_pid_t;
+typedef unsigned int __kernel_uid_t;
+typedef unsigned int __kernel_gid_t;
+typedef unsigned long __kernel_size_t;
+typedef long __kernel_ssize_t;
+typedef long __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_daddr_t;
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+typedef long long __kernel_loff_t;
+typedef unsigned int __kernel_old_dev_t;
+typedef long __kernel_long_t;
+typedef unsigned long __kernel_ulong_t;
+
+typedef struct {
+ int val[2];
+} __kernel_fsid_t;
+
+#endif /* __ASM_GENERIC_POSIX_TYPES_H */
diff --git a/libc/sysdeps/linux/riscv32/bits/mman.h b/libc/sysdeps/linux/riscv32/bits/mman.h
new file mode 100644
index 000000000..fa6f8e6a0
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/mman.h
@@ -0,0 +1,38 @@
+/* Definitions for POSIX memory map interface. Linux/RISC-V version.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_MMAN_H
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
+#endif
+
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
+# define MAP_DENYWRITE 0x00800 /* ETXTBSY. */
+# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
+# define MAP_LOCKED 0x02000 /* Lock the mapping. */
+# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
+# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
+# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
+# define MAP_STACK 0x20000 /* Allocation is for a stack. */
+# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
+# define MAP_SYNC 0x80000 /* Perform synchronous page
+ faults for the mapping. */
+# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could - be uninitialized. */
+#endif
+
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
diff --git a/libc/sysdeps/linux/riscv32/bits/setjmp.h b/libc/sysdeps/linux/riscv32/bits/setjmp.h
new file mode 100644
index 000000000..c45f93957
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/setjmp.h
@@ -0,0 +1,38 @@
+/* Define the machine-dependent type `jmp_buf'. RISC-V version.
+ Copyright (C) 2011-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _RISCV_BITS_SETJMP_H
+#define _RISCV_BITS_SETJMP_H
+
+typedef struct __jmp_buf_internal_tag
+ {
+ /* Program counter. */
+ long int __pc;
+ /* Callee-saved registers. */
+ long int __regs[12];
+ /* Stack pointer. */
+ long int __sp;
+
+ /* Callee-saved floating point registers. */
+#if defined __riscv_float_abi_double
+ double __fpregs[12];
+#elif !defined __riscv_float_abi_soft
+# error unsupported FLEN
+#endif
+ } __jmp_buf[1];
+
+#endif /* _RISCV_BITS_SETJMP_H */
diff --git a/libc/sysdeps/linux/riscv32/bits/shm.h b/libc/sysdeps/linux/riscv32/bits/shm.h
new file mode 100644
index 000000000..8a11c7050
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/shm.h
@@ -0,0 +1,90 @@
+/*
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
+ * in this tarball.
+ */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Permission flag for shmget. */
+#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
+#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'. */
+#define SHM_RDONLY 010000 /* attach read-only else read-write */
+#define SHM_RND 020000 /* round attach address to SHMLBA */
+#define SHM_REMAP 040000 /* take-over region on attach */
+
+/* Commands for `shmctl'. */
+#define SHM_LOCK 11 /* lock segment (root only) */
+#define SHM_UNLOCK 12 /* unlock segment (root only) */
+
+__BEGIN_DECLS
+
+/* Segment low boundary address multiple. */
+#define SHMLBA (__getpagesize () << 2)
+extern int __getpagesize (void) __THROW __attribute__ ((__const__));
+
+
+/* Type to count number of attaches. */
+typedef unsigned long int shmatt_t;
+
+/* Data structure describing a set of semaphores. */
+struct shmid_ds
+ {
+ struct ipc_perm shm_perm; /* operation permission struct */
+ size_t shm_segsz; /* size of segment in bytes */
+ __time_t shm_atime; /* time of last shmat() */
+ unsigned long int __uclibc_unused1;
+ __time_t shm_dtime; /* time of last shmdt() */
+ unsigned long int __uclibc_unused2;
+ __time_t shm_ctime; /* time of last change by shmctl() */
+ unsigned long int __uclibc_unused3;
+ __pid_t shm_cpid; /* pid of creator */
+ __pid_t shm_lpid; /* pid of last shmop */
+ shmatt_t shm_nattch; /* number of current attaches */
+ unsigned long int __uclibc_unused4;
+ unsigned long int __uclibc_unused5;
+ };
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+# define SHM_STAT 13
+# define SHM_INFO 14
+
+/* shm_mode upper byte flags */
+# define SHM_DEST 01000 /* segment will be destroyed on last detach */
+# define SHM_LOCKED 02000 /* segment will not be swapped */
+# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
+# define SHM_NORESERVE 010000 /* don't check for reservations */
+
+struct shminfo
+ {
+ unsigned long int shmmax;
+ unsigned long int shmmin;
+ unsigned long int shmmni;
+ unsigned long int shmseg;
+ unsigned long int shmall;
+ unsigned long int __uclibc_unused1;
+ unsigned long int __uclibc_unused2;
+ unsigned long int __uclibc_unused3;
+ unsigned long int __uclibc_unused4;
+ };
+
+struct shm_info
+ {
+ int used_ids;
+ unsigned long int shm_tot; /* total allocated shm */
+ unsigned long int shm_rss; /* total resident shm */
+ unsigned long int shm_swp; /* total swapped shm */
+ unsigned long int swap_attempts;
+ unsigned long int swap_successes;
+ };
+
+#endif /* __USE_MISC */
+
+__END_DECLS
diff --git a/libc/sysdeps/linux/riscv32/bits/sigcontext.h b/libc/sysdeps/linux/riscv32/bits/sigcontext.h
new file mode 100644
index 000000000..9b896a626
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/sigcontext.h
@@ -0,0 +1,32 @@
+/* Machine-dependent signal context structure for Linux. RISC-V version.
+ Copyright (C) 1996-2018 Free Software
+ Foundation, Inc. This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+struct sigcontext {
+ /* gregs[0] holds the program counter. */
+ unsigned long int gregs[32];
+ unsigned long long int fpregs[66] __attribute__ ((__aligned__ (16)));
+};
+
+#endif
diff --git a/libc/sysdeps/linux/riscv32/bits/stackinfo.h b/libc/sysdeps/linux/riscv32/bits/stackinfo.h
new file mode 100644
index 000000000..a9fd8173b
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/stackinfo.h
@@ -0,0 +1,11 @@
+/*
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
+ * in this tarball.
+ */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H 1
+
+#define _STACK_GROWS_DOWN 1
+
+#endif
diff --git a/libc/sysdeps/linux/riscv32/bits/syscalls.h b/libc/sysdeps/linux/riscv32/bits/syscalls.h
new file mode 100644
index 000000000..d1f1d9170
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/syscalls.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2018 by Waldemar Brodkorb <wbx@uclibc-ng.org>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ * ported from GNU C Library
+ */
+
+#ifndef _BITS_SYSCALLS_H
+#define _BITS_SYSCALLS_H
+#ifndef _SYSCALL_H
+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
+#endif
+
+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+ ({ long _sys_result; \
+ { \
+ register long int _a7 __asm__ ("a7"); \
+ LOAD_ARGS_##nr (args) \
+ _a7 = (name); \
+ \
+ __asm__ volatile ( \
+ "scall\n\t" \
+ : "=r" (_a0) \
+ : "r"(_a7) ASM_ARGS_##nr \
+ : "memory"); \
+ _sys_result = _a0; \
+ } \
+ _sys_result; \
+ })
+
+/* Macros for setting up inline __asm__ input regs */
+# define ASM_ARGS_0
+# define ASM_ARGS_1 , "r" (_a0)
+# define ASM_ARGS_2 ASM_ARGS_1, "r" (_a1)
+# define ASM_ARGS_3 ASM_ARGS_2, "r" (_a2)
+# define ASM_ARGS_4 ASM_ARGS_3, "r" (_a3)
+# define ASM_ARGS_5 ASM_ARGS_4, "r" (_a4)
+# define ASM_ARGS_6 ASM_ARGS_5, "r" (_a5)
+# define ASM_ARGS_7 ASM_ARGS_6, "r" (_a6)
+
+/* Macros for converting sys-call wrapper args into sys call args */
+# define LOAD_ARGS_0() \
+ register long _a0 __asm__ ("a0");
+# define LOAD_ARGS_1(a0) \
+ long _a0tmp; \
+ LOAD_ARGS_0 () \
+ _a0tmp = (long) (a0); \
+ _a0 = _a0tmp;
+# define LOAD_ARGS_2(a0, a1) \
+ register long _a1 __asm__ ("a1"); \
+ long _a1tmp; \
+ LOAD_ARGS_1 (a0) \
+ _a1tmp = (long) (a1); \
+ _a1 = _a1tmp;
+# define LOAD_ARGS_3(a0, a1, a2) \
+ register long _a2 __asm__ ("a2"); \
+ long _a2tmp; \
+ LOAD_ARGS_2 (a0, a1) \
+ _a2tmp = (long) (a2); \
+ _a2 = _a2tmp;
+# define LOAD_ARGS_4(a0, a1, a2, a3) \
+ register long _a3 __asm__ ("a3"); \
+ long _a3tmp; \
+ LOAD_ARGS_3 (a0, a1, a2) \
+ _a3tmp = (long) (a3); \
+ _a3 = _a3tmp;
+# define LOAD_ARGS_5(a0, a1, a2, a3, a4) \
+ register long _a4 __asm__ ("a4"); \
+ long _a4tmp; \
+ LOAD_ARGS_4 (a0, a1, a2, a3) \
+ _a4tmp = (long) (a4); \
+ _a4 = _a4tmp;
+# define LOAD_ARGS_6(a0, a1, a2, a3, a4, a5) \
+ register long _a5 __asm__ ("a5"); \
+ long _a5tmp; \
+ LOAD_ARGS_5 (a0, a1, a2, a3, a4) \
+ _a5tmp = (long) (a5); \
+ _a5 = _a5tmp;
+# define LOAD_ARGS_7(a0, a1, a2, a3, a4, a5, a6)\
+ register long _a6 __asm__ ("a6"); \
+ long _a6tmp; \
+ LOAD_ARGS_6 (a0, a1, a2, a3, a4, a5) \
+ _a6tmp = (long) (a6); \
+ _a6 = _a6tmp;
+
+#endif
diff --git a/libc/sysdeps/linux/riscv32/bits/uClibc_arch_features.h b/libc/sysdeps/linux/riscv32/bits/uClibc_arch_features.h
new file mode 100644
index 000000000..b53c47278
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/uClibc_arch_features.h
@@ -0,0 +1,36 @@
+/*
+ * Track misc arch-specific features that aren't config options
+ */
+
+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
+#define _BITS_UCLIBC_ARCH_FEATURES_H
+
+#define __UCLIBC_ABORT_INSTRUCTION__ "unimp"
+
+#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
+
+/* does your target have a broken create_module() ? */
+#define __UCLIBC_BROKEN_CREATE_MODULE__
+
+/* does your target have to worry about older [gs]etrlimit() ? */
+#define __UCLIBC_HANDLE_OLDER_RLIMIT__
+
+/* does your target have an asm .set ? */
+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
+
+/* define if target doesn't like .global */
+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
+
+/* define if target supports .weak */
+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
+
+/* define if target supports .weakext */
+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
+
+/* define if target supports IEEE signed zero floats */
+#define __UCLIBC_HAVE_SIGNED_ZERO__
+
+/* define if target supports CFI pseudo ops */
+#define __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__
+
+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/riscv32/bits/uClibc_page.h b/libc/sysdeps/linux/riscv32/bits/uClibc_page.h
new file mode 100644
index 000000000..d1f9262fd
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/uClibc_page.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2004 Erik Andersen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * The GNU C Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the GNU C Library; see the file COPYING.LIB. If
+ * not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Supply an architecture specific value for PAGE_SIZE and friends. */
+
+#ifndef _UCLIBC_PAGE_H
+#define _UCLIBC_PAGE_H
+
+/* PAGE_SHIFT determines the page size -- in this case 4096 */
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#endif /* _UCLIBC_PAGE_H */
diff --git a/libc/sysdeps/linux/riscv32/bits/wordsize.h b/libc/sysdeps/linux/riscv32/bits/wordsize.h
new file mode 100644
index 000000000..1fc649aad
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bits/wordsize.h
@@ -0,0 +1,30 @@
+/* Determine the wordsize from the preprocessor defines. RISC-V version.
+ Copyright (C) 2002-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#if __riscv_xlen == (__SIZEOF_POINTER__ * 8)
+# define __WORDSIZE __riscv_xlen
+#else
+# error unsupported ABI
+#endif
+
+#if __riscv_xlen == 64
+# define __WORDSIZE_TIME64_COMPAT32 1
+#else
+# define __WORDSIZE_TIME64_COMPAT32 1
+// # warning "rv32i-based targets are experimental"
+#endif
diff --git a/libc/sysdeps/linux/riscv32/bsd-_setjmp.c b/libc/sysdeps/linux/riscv32/bsd-_setjmp.c
new file mode 100644
index 000000000..0d413101c
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bsd-_setjmp.c
@@ -0,0 +1 @@
+/* _setjmp is implemented in setjmp.S */
diff --git a/libc/sysdeps/linux/riscv32/bsd-setjmp.c b/libc/sysdeps/linux/riscv32/bsd-setjmp.c
new file mode 100644
index 000000000..0d413101c
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/bsd-setjmp.c
@@ -0,0 +1 @@
+/* _setjmp is implemented in setjmp.S */
diff --git a/libc/sysdeps/linux/riscv32/cache.c b/libc/sysdeps/linux/riscv32/cache.c
new file mode 100644
index 000000000..aa99a2a0d
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/cache.c
@@ -0,0 +1,55 @@
+/* RISC-V instruction cache flushing VDSO calls
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+#include <atomic.h>
+#include <sys/syscall.h>
+
+#ifndef __NR_riscv_flush_icache
+#define __NR_riscv_flush_icache 259
+#endif
+
+typedef int (*func_type) (void *, void *, unsigned long int);
+
+static int
+__riscv_flush_icache_syscall (void *start, void *end, unsigned long int flags)
+{
+ return INLINE_SYSCALL (riscv_flush_icache, 3, start, end, flags);
+}
+
+static func_type
+__lookup_riscv_flush_icache (void)
+{
+ /* always call the system call directly.*/
+ return &__riscv_flush_icache_syscall;
+}
+
+int
+__riscv_flush_icache (void *start, void *end, unsigned long int flags)
+{
+ static volatile func_type cached_func;
+
+ func_type func = atomic_load_relaxed (&cached_func);
+
+ if (!func)
+ {
+ func = __lookup_riscv_flush_icache ();
+ atomic_store_relaxed (&cached_func, func);
+ }
+
+ return func (start, end, flags);
+}
diff --git a/libc/sysdeps/linux/riscv32/clone.S b/libc/sysdeps/linux/riscv32/clone.S
new file mode 100644
index 000000000..315de2ac8
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/clone.S
@@ -0,0 +1,86 @@
+/* Wrapper around clone system call. RISC-V version.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* clone() is even more special than fork() as it mucks with stacks
+ and invokes a function in the right context after its all over. */
+
+#include <sys/asm.h>
+#include <sysdep.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
+ void *parent_tidptr, void *tls, void *child_tidptr) */
+
+ .text
+LEAF (clone)
+
+ /* Align stack to a 128-bit boundary as per RISC-V ABI. */
+ andi a1,a1,ALMASK
+
+ /* Sanity check arguments. */
+ beqz a0,L (invalid) /* No NULL function pointers. */
+ beqz a1,L (invalid) /* No NULL stack pointers. */
+
+ addi a1,a1,-16 /* Reserve argument save space. */
+ REG_S a0,0(a1) /* Save function pointer. */
+ REG_S a3,SZREG(a1) /* Save argument pointer. */
+
+ /* The syscall expects the args to be in different slots. */
+ mv a0,a2
+ mv a2,a4
+ mv a3,a5
+ mv a4,a6
+
+ /* Do the system call. */
+ li a7,__NR_clone
+ scall
+
+ bltz a0,L (error)
+ beqz a0,L (thread_start)
+
+ /* Successful return from the parent. */
+ ret
+
+L (invalid):
+ li a0, -EINVAL
+ /* Something bad happened -- no child created. */
+L (error):
+ tail __syscall_error
+ END (clone)
+
+/* Load up the arguments to the function. Put this block of code in
+ its own function so that we can terminate the stack trace with our
+ debug info. */
+
+ENTRY (__thread_start)
+L (thread_start):
+ .cfi_label .Ldummy
+ cfi_undefined (ra)
+
+ /* Restore the arg for user's function. */
+ REG_L a1,0(sp) /* Function pointer. */
+ REG_L a0,SZREG(sp) /* Argument pointer. */
+
+ /* Call the user's function. */
+ jalr a1
+
+ /* Call exit with the function's return value. */
+ li a7, __NR_exit
+ scall
+
+ END (__thread_start)
diff --git a/libc/sysdeps/linux/riscv32/crt1.S b/libc/sysdeps/linux/riscv32/crt1.S
new file mode 100644
index 000000000..15aa0763c
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/crt1.S
@@ -0,0 +1,88 @@
+/* Startup code compliant to the ELF RISC-V ABI.
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The GNU Lesser General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ Note that people who make modified versions of this file are not
+ obligated to grant this special exception for their modified
+ versions; it is their choice whether to do so. The GNU Lesser
+ General Public License gives permission to release a modified
+ version without this exception; this exception also makes it
+ possible to release a modified version which carries forward this
+ exception.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define __ASSEMBLY__ 1
+
+#include <sysdep.h>
+#include <sys/asm.h>
+
+/* The entry point's job is to call __uClibc_main. Per the ABI,
+ a0 contains the address of a function to be passed to atexit.
+ __uClibc_main wants this in a5. */
+
+.text
+ .globl _start
+ .type _start,%function
+
+ .weak _init
+ .weak _fini
+
+_start:
+ call .Lload_gp
+ mv a5, a0 /* rtld_fini. */
+ /* main may be in a shared library. */
+ la a0, main
+ REG_L a1, 0(sp) /* argc. */
+ addi a2, sp, SZREG /* argv. */
+ andi sp, sp, ALMASK /* Align stack. */
+ lla a3, _init
+ lla a4, _fini
+ mv a6, sp /* stack_end. */
+
+ tail __uClibc_main@plt
+
+ .size _start,.-_start
+
+/* Dynamic links need the global pointer to be initialized prior to calling
+ any shared library's initializers, so we use preinit_array to load it.
+ This doesn't cut it for static links, though, since the global pointer
+ needs to be initialized before calling __libc_start_main in that case.
+ So we redundantly initialize it at the beginning of _start. */
+
+.Lload_gp:
+.option push
+.option norelax
+ lla gp, __global_pointer$
+.option pop
+ ret
+
+ .section .preinit_array,"aw"
+ .dc.a .Lload_gp
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/sysdeps/linux/riscv32/crti.S b/libc/sysdeps/linux/riscv32/crti.S
new file mode 100644
index 000000000..176de9199
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/crti.S
@@ -0,0 +1,17 @@
+/* dummy _init and _fini */
+
+ .section .init
+ .globl _init
+ .align 2
+ .type _init,@function
+
+_init:
+
+
+ .section .fini
+ .global _fini
+ .align 2
+ .type _fini,@function
+
+_fini:
+
diff --git a/libc/sysdeps/linux/riscv32/crtn.S b/libc/sysdeps/linux/riscv32/crtn.S
new file mode 100644
index 000000000..6f70e7716
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/crtn.S
@@ -0,0 +1,13 @@
+/* Dummy crtn file.
+
+ In this configuration, crti.o and crtn.o are both empty because the
+ .init_array/.fini_array sections are used exclusively.
+
+ Older ports cannot use this because even if the linker used to
+ build libc itself has .init_array support, we don't want to produce
+ a crt[in].o that presume a linker that new will be used to link
+ other things later.
+
+ But new configurations without compatibility concerns for
+ toolchains without .init_array support can use this to avoid the
+ superfluous .init and .fini boilerplate code. */
diff --git a/libc/sysdeps/linux/riscv32/getcontext.S b/libc/sysdeps/linux/riscv32/getcontext.S
new file mode 100644
index 000000000..0b9e7c2d3
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/getcontext.S
@@ -0,0 +1,74 @@
+/* Save current context.
+ Copyright (C) 2009-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "ucontext-macros.h"
+
+/* int getcontext (ucontext_t *ucp) */
+
+ .text
+LEAF (getcontext)
+ SAVE_INT_REG (ra, 0, a0)
+ SAVE_INT_REG (ra, 1, a0)
+ SAVE_INT_REG (sp, 2, a0)
+ SAVE_INT_REG (s0, 8, a0)
+ SAVE_INT_REG (s1, 9, a0)
+ SAVE_INT_REG (x0, 10, a0) /* return 0 by overwriting a0. */
+ SAVE_INT_REG (s2, 18, a0)
+ SAVE_INT_REG (s3, 19, a0)
+ SAVE_INT_REG (s4, 20, a0)
+ SAVE_INT_REG (s5, 21, a0)
+ SAVE_INT_REG (s6, 22, a0)
+ SAVE_INT_REG (s7, 23, a0)
+ SAVE_INT_REG (s8, 24, a0)
+ SAVE_INT_REG (s9, 25, a0)
+ SAVE_INT_REG (s10, 26, a0)
+ SAVE_INT_REG (s11, 27, a0)
+
+#ifndef __riscv_float_abi_soft
+ frsr a1
+
+ SAVE_FP_REG (fs0, 8, a0)
+ SAVE_FP_REG (fs1, 9, a0)
+ SAVE_FP_REG (fs2, 18, a0)
+ SAVE_FP_REG (fs3, 19, a0)
+ SAVE_FP_REG (fs4, 20, a0)
+ SAVE_FP_REG (fs5, 21, a0)
+ SAVE_FP_REG (fs6, 22, a0)
+ SAVE_FP_REG (fs7, 23, a0)
+ SAVE_FP_REG (fs8, 24, a0)
+ SAVE_FP_REG (fs9, 25, a0)
+ SAVE_FP_REG (fs10, 26, a0)
+ SAVE_FP_REG (fs11, 27, a0)
+
+ sw a1, MCONTEXT_FSR(a0)
+#endif /* __riscv_float_abi_soft */
+
+/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
+ li a3, _NSIG8
+ add a2, a0, UCONTEXT_SIGMASK
+ mv a1, zero
+ li a0, SIG_BLOCK
+
+ li a7, SYS_ify (rt_sigprocmask)
+ scall
+ bltz a0, 99f
+
+ ret
+
+99: j __syscall_error
+
+PSEUDO_END (getcontext)
diff --git a/libc/sysdeps/linux/riscv32/jmpbuf-offsets.h b/libc/sysdeps/linux/riscv32/jmpbuf-offsets.h
new file mode 100644
index 000000000..fff4d0d9c
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/jmpbuf-offsets.h
@@ -0,0 +1,23 @@
+/* Private macros for accessing __jmp_buf contents. RISC-V version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <jmpbuf-unwind.h>
+
+/* Helper for generic ____longjmp_chk(). */
+#define JB_FRAME_ADDRESS(buf) \
+ ((void *) _jmpbuf_sp (buf))
diff --git a/libc/sysdeps/linux/riscv32/jmpbuf-unwind.h b/libc/sysdeps/linux/riscv32/jmpbuf-unwind.h
new file mode 100644
index 000000000..2e5f37f10
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/jmpbuf-unwind.h
@@ -0,0 +1,46 @@
+/* Examine __jmp_buf for unwinding frames. RISC-V version.
+ Copyright (C) 2003-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <setjmp.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+ uintptr_t sp = regs[0].__sp;
+#ifdef PTR_DEMANGLE
+ PTR_DEMANGLE (sp);
+#endif
+ return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+ ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding. */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/libc/sysdeps/linux/riscv32/setcontext.S b/libc/sysdeps/linux/riscv32/setcontext.S
new file mode 100644
index 000000000..15cc17bd8
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/setcontext.S
@@ -0,0 +1,112 @@
+/* Set current context.
+ Copyright (C) 2009-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "ucontext-macros.h"
+
+/* int __setcontext (const ucontext_t *ucp)
+
+ Restores the machine context in UCP and thereby resumes execution
+ in that context.
+
+ This implementation is intended to be used for *synchronous* context
+ switches only. Therefore, it does not have to restore anything
+ other than the PRESERVED state. */
+
+ .text
+LEAF (setcontext)
+
+ mv t0, a0 /* Save ucp into t0. */
+
+/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */
+ li a3, _NSIG8
+ mv a2, zero
+ add a1, a0, UCONTEXT_SIGMASK
+ li a0, SIG_SETMASK
+
+ li a7, SYS_ify (rt_sigprocmask)
+ scall
+
+ bltz a0, 99f
+
+ cfi_def_cfa (t0, 0)
+
+#ifndef __riscv_float_abi_soft
+ lw t1, MCONTEXT_FSR(t0)
+
+ RESTORE_FP_REG_CFI (fs0, 8, t0)
+ RESTORE_FP_REG_CFI (fs1, 9, t0)
+ RESTORE_FP_REG_CFI (fs2, 18, t0)
+ RESTORE_FP_REG_CFI (fs3, 19, t0)
+ RESTORE_FP_REG_CFI (fs4, 20, t0)
+ RESTORE_FP_REG_CFI (fs5, 21, t0)
+ RESTORE_FP_REG_CFI (fs6, 22, t0)
+ RESTORE_FP_REG_CFI (fs7, 23, t0)
+ RESTORE_FP_REG_CFI (fs8, 24, t0)
+ RESTORE_FP_REG_CFI (fs9, 25, t0)
+ RESTORE_FP_REG_CFI (fs10, 26, t0)
+ RESTORE_FP_REG_CFI (fs11, 27, t0)
+
+ fssr t1
+#endif /* __riscv_float_abi_soft */
+
+ /* Note the contents of argument registers will be random
+ unless makecontext() has been called. */
+ RESTORE_INT_REG (t1, 0, t0)
+ RESTORE_INT_REG_CFI (ra, 1, t0)
+ RESTORE_INT_REG (sp, 2, t0)
+ RESTORE_INT_REG_CFI (s0, 8, t0)
+ RESTORE_INT_REG_CFI (s1, 9, t0)
+ RESTORE_INT_REG (a0, 10, t0)
+ RESTORE_INT_REG (a1, 11, t0)
+ RESTORE_INT_REG (a2, 12, t0)
+ RESTORE_INT_REG (a3, 13, t0)
+ RESTORE_INT_REG (a4, 14, t0)
+ RESTORE_INT_REG (a5, 15, t0)
+ RESTORE_INT_REG (a6, 16, t0)
+ RESTORE_INT_REG (a7, 17, t0)
+ RESTORE_INT_REG_CFI (s2, 18, t0)
+ RESTORE_INT_REG_CFI (s3, 19, t0)
+ RESTORE_INT_REG_CFI (s4, 20, t0)
+ RESTORE_INT_REG_CFI (s5, 21, t0)
+ RESTORE_INT_REG_CFI (s6, 22, t0)
+ RESTORE_INT_REG_CFI (s7, 23, t0)
+ RESTORE_INT_REG_CFI (s8, 24, t0)
+ RESTORE_INT_REG_CFI (s9, 25, t0)
+ RESTORE_INT_REG_CFI (s10, 26, t0)
+ RESTORE_INT_REG_CFI (s11, 27, t0)
+
+ jr t1
+
+99: j __syscall_error
+
+PSEUDO_END (setcontext)
+
+LEAF (start_context)
+
+ /* Terminate call stack by noting ra == 0. Happily, s0 == 0 here. */
+ cfi_register (ra, s0)
+
+ /* Call the function passed to makecontext. */
+ jalr s1
+
+ /* Invoke subsequent context if present, else exit(0). */
+ mv a0, s2
+ beqz s2, 1f
+ jal setcontext
+1: j exit
+
+PSEUDO_END (start_context)
diff --git a/libc/sysdeps/linux/riscv32/setjmp.S b/libc/sysdeps/linux/riscv32/setjmp.S
new file mode 100644
index 000000000..100a0bd78
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/setjmp.S
@@ -0,0 +1,73 @@
+/* setjmp for RISC-V.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <sys/asm.h>
+
+ENTRY (_setjmp)
+ li a1, 0
+ j HIDDEN_JUMPTARGET (__sigsetjmp)
+END (_setjmp)
+ENTRY (setjmp)
+ li a1, 1
+ /* Fallthrough */
+END (setjmp)
+ENTRY (__sigsetjmp)
+ REG_S ra, 0*SZREG(a0)
+ REG_S s0, 1*SZREG(a0)
+ REG_S s1, 2*SZREG(a0)
+ REG_S s2, 3*SZREG(a0)
+ REG_S s3, 4*SZREG(a0)
+ REG_S s4, 5*SZREG(a0)
+ REG_S s5, 6*SZREG(a0)
+ REG_S s6, 7*SZREG(a0)
+ REG_S s7, 8*SZREG(a0)
+ REG_S s8, 9*SZREG(a0)
+ REG_S s9, 10*SZREG(a0)
+ REG_S s10,11*SZREG(a0)
+ REG_S s11,12*SZREG(a0)
+ REG_S sp, 13*SZREG(a0)
+
+#ifndef __riscv_float_abi_soft
+ FREG_S fs0, 14*SZREG+ 0*SZFREG(a0)
+ FREG_S fs1, 14*SZREG+ 1*SZFREG(a0)
+ FREG_S fs2, 14*SZREG+ 2*SZFREG(a0)
+ FREG_S fs3, 14*SZREG+ 3*SZFREG(a0)
+ FREG_S fs4, 14*SZREG+ 4*SZFREG(a0)
+ FREG_S fs5, 14*SZREG+ 5*SZFREG(a0)
+ FREG_S fs6, 14*SZREG+ 6*SZFREG(a0)
+ FREG_S fs7, 14*SZREG+ 7*SZFREG(a0)
+ FREG_S fs8, 14*SZREG+ 8*SZFREG(a0)
+ FREG_S fs9, 14*SZREG+ 9*SZFREG(a0)
+ FREG_S fs10,14*SZREG+10*SZFREG(a0)
+ FREG_S fs11,14*SZREG+11*SZFREG(a0)
+#endif
+
+#if !IS_IN_libc && IS_IN_rtld
+ /* In ld.so we never save the signal mask. */
+ li a0, 0
+ ret
+#else
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+ j __sigjmp_save
+#endif
+
+
+END (__sigsetjmp)
+
+hidden_def (__sigsetjmp)
+weak_alias (_setjmp, __GI__setjmp)
diff --git a/libc/sysdeps/linux/riscv32/swapcontext.S b/libc/sysdeps/linux/riscv32/swapcontext.S
new file mode 100644
index 000000000..f5e12b2db
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/swapcontext.S
@@ -0,0 +1,122 @@
+/* Save and set current context.
+ Copyright (C) 2009-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "ucontext-macros.h"
+
+/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
+
+LEAF (swapcontext)
+ mv t0, a1 /* Save ucp into t0. */
+
+ SAVE_INT_REG (ra, 0, a0)
+ SAVE_INT_REG (ra, 1, a0)
+ SAVE_INT_REG (sp, 2, a0)
+ SAVE_INT_REG (s0, 8, a0)
+ SAVE_INT_REG (s1, 9, a0)
+ SAVE_INT_REG (x0, 10, a0) /* return 0 by overwriting a0. */
+ SAVE_INT_REG (s2, 18, a0)
+ SAVE_INT_REG (s3, 19, a0)
+ SAVE_INT_REG (s4, 20, a0)
+ SAVE_INT_REG (s5, 21, a0)
+ SAVE_INT_REG (s6, 22, a0)
+ SAVE_INT_REG (s7, 23, a0)
+ SAVE_INT_REG (s8, 24, a0)
+ SAVE_INT_REG (s9, 25, a0)
+ SAVE_INT_REG (s10, 26, a0)
+ SAVE_INT_REG (s11, 27, a0)
+
+#ifndef __riscv_float_abi_soft
+ frsr a1
+
+ SAVE_FP_REG (fs0, 8, a0)
+ SAVE_FP_REG (fs1, 9, a0)
+ SAVE_FP_REG (fs2, 18, a0)
+ SAVE_FP_REG (fs3, 19, a0)
+ SAVE_FP_REG (fs4, 20, a0)
+ SAVE_FP_REG (fs5, 21, a0)
+ SAVE_FP_REG (fs6, 22, a0)
+ SAVE_FP_REG (fs7, 23, a0)
+ SAVE_FP_REG (fs8, 24, a0)
+ SAVE_FP_REG (fs9, 25, a0)
+ SAVE_FP_REG (fs10, 26, a0)
+ SAVE_FP_REG (fs11, 27, a0)
+
+ sw a1, MCONTEXT_FSR(a0)
+#endif /* __riscv_float_abi_soft */
+
+/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, &oucp->uc_sigmask, _NSIG8) */
+ li a3, _NSIG8
+ add a2, a0, UCONTEXT_SIGMASK
+ add a1, t0, UCONTEXT_SIGMASK
+ li a0, SIG_SETMASK
+
+ li a7, SYS_ify (rt_sigprocmask)
+ scall
+
+ bltz a0, 99f
+
+#ifndef __riscv_float_abi_soft
+ lw t1, MCONTEXT_FSR(t0)
+
+ RESTORE_FP_REG (fs0, 8, t0)
+ RESTORE_FP_REG (fs1, 9, t0)
+ RESTORE_FP_REG (fs2, 18, t0)
+ RESTORE_FP_REG (fs3, 19, t0)
+ RESTORE_FP_REG (fs4, 20, t0)
+ RESTORE_FP_REG (fs5, 21, t0)
+ RESTORE_FP_REG (fs6, 22, t0)
+ RESTORE_FP_REG (fs7, 23, t0)
+ RESTORE_FP_REG (fs8, 24, t0)
+ RESTORE_FP_REG (fs9, 25, t0)
+ RESTORE_FP_REG (fs10, 26, t0)
+ RESTORE_FP_REG (fs11, 27, t0)
+
+ fssr t1
+#endif /* __riscv_float_abi_soft */
+
+ /* Note the contents of argument registers will be random
+ unless makecontext() has been called. */
+ RESTORE_INT_REG (t1, 0, t0)
+ RESTORE_INT_REG (ra, 1, t0)
+ RESTORE_INT_REG (sp, 2, t0)
+ RESTORE_INT_REG (s0, 8, t0)
+ RESTORE_INT_REG (s1, 9, t0)
+ RESTORE_INT_REG (a0, 10, t0)
+ RESTORE_INT_REG (a1, 11, t0)
+ RESTORE_INT_REG (a2, 12, t0)
+ RESTORE_INT_REG (a3, 13, t0)
+ RESTORE_INT_REG (a4, 14, t0)
+ RESTORE_INT_REG (a5, 15, t0)
+ RESTORE_INT_REG (a6, 16, t0)
+ RESTORE_INT_REG (a7, 17, t0)
+ RESTORE_INT_REG (s2, 18, t0)
+ RESTORE_INT_REG (s3, 19, t0)
+ RESTORE_INT_REG (s4, 20, t0)
+ RESTORE_INT_REG (s5, 21, t0)
+ RESTORE_INT_REG (s6, 22, t0)
+ RESTORE_INT_REG (s7, 23, t0)
+ RESTORE_INT_REG (s8, 24, t0)
+ RESTORE_INT_REG (s9, 25, t0)
+ RESTORE_INT_REG (s10, 26, t0)
+ RESTORE_INT_REG (s11, 27, t0)
+
+ jr t1
+
+
+99: j __syscall_error
+
+PSEUDO_END (swapcontext)
diff --git a/libc/sysdeps/linux/riscv32/sys/asm.h b/libc/sysdeps/linux/riscv32/sys/asm.h
new file mode 100644
index 000000000..3c94c9a70
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/sys/asm.h
@@ -0,0 +1,67 @@
+/* Miscellaneous macros.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_ASM_H
+#define _SYS_ASM_H
+
+/* Macros to handle different pointer/register sizes for 32/64-bit code. */
+#if __riscv_xlen == 64
+# define PTRLOG 3
+# define SZREG 8
+# define REG_S sd
+# define REG_L ld
+#elif __riscv_xlen == 32
+# define PTRLOG 2
+# define SZREG 4
+# define REG_S sw
+# define REG_L lw
+// # warning "rv32i-based targets are experimental"
+#else
+# error __riscv_xlen must equal 32 or 64
+#endif
+
+#if !defined __riscv_float_abi_soft
+/* For ABI uniformity, reserve 8 bytes for floats, even if double-precision
+ floating-point is not supported in hardware. */
+# if defined __riscv_float_abi_double
+# define FREG_L fld
+# define FREG_S fsd
+# define SZFREG 8
+# else
+# error unsupported FLEN
+# endif
+#endif
+
+/* Declare leaf routine. */
+#define LEAF(symbol) \
+ .globl symbol; \
+ .align 2; \
+ .type symbol,@function; \
+symbol: \
+ cfi_startproc;
+
+/* Mark end of function. */
+#undef END
+#define END(function) \
+ cfi_endproc; \
+ .size function,.-function
+
+/* Stack alignment. */
+#define ALMASK ~15
+
+#endif /* sys/asm.h */
diff --git a/libc/sysdeps/linux/riscv32/sys/procfs.h b/libc/sysdeps/linux/riscv32/sys/procfs.h
new file mode 100644
index 000000000..518de5674
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/sys/procfs.h
@@ -0,0 +1,114 @@
+/* Core image file related definitions, RISC-V version.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H 1
+
+/* This is somehow modelled after the file of the same name on SysVr4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+#include <sys/ucontext.h>
+
+/* ELF register definitions */
+#define ELF_NGREG NGREG
+#define ELF_NFPREG NFPREG
+
+typedef unsigned long int elf_greg_t;
+typedef unsigned long int elf_gregset_t[32];
+typedef union __riscv_mc_fp_state elf_fpregset_t;
+
+__BEGIN_DECLS
+
+struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_code; /* Extra code. */
+ int si_errno; /* Errno. */
+ };
+
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ gdb doesn't really use excluded. Fields present but not used are
+ marked with "XXX". */
+struct elf_prstatus
+ {
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned long int pr_sigpend; /* Set of pending signals. */
+ unsigned long int pr_sighold; /* Set of held signals. */
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct timeval pr_utime; /* User time. */
+ struct timeval pr_stime; /* System time. */
+ struct timeval pr_cutime; /* Cumulative user time. */
+ struct timeval pr_cstime; /* Cumulative system time. */
+ elf_gregset_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+#define ELF_PRARGSZ (80) /* Number of chars for args */
+
+struct elf_prpsinfo
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned long int pr_flag; /* Flags. */
+ long int pr_uid;
+ long int pr_gid;
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+/* The rest of this file provides the types for emulation of the
+ Solaris <proc_service.h> interfaces that should be implemented by
+ users of libthread_db. */
+
+/* Addresses. */
+typedef void *psaddr_t;
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+ therefore habe only ine PID type. */
+typedef __pid_t lwpid_t;
+
+/* Process status and info. In the end we do provide typedefs for them. */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif /* sys/procfs.h */
diff --git a/libc/sysdeps/linux/riscv32/sys/ucontext.h b/libc/sysdeps/linux/riscv32/sys/ucontext.h
new file mode 100644
index 000000000..2893ff359
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/sys/ucontext.h
@@ -0,0 +1,108 @@
+/* struct ucontext definition, RISC-V version.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Don't rely on this, the interface is currently messed up and may need to
+ be broken to be fixed. */
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H 1
+
+#include <features.h>
+#include <signal.h>
+#include <bits/sigcontext.h>
+
+typedef unsigned long int __riscv_mc_gp_state[32];
+
+#ifdef __USE_MISC
+# define NGREG 32
+
+# define REG_PC 0
+# define REG_RA 1
+# define REG_SP 2
+# define REG_TP 4
+# define REG_S0 8
+# define REG_S1 9
+# define REG_A0 10
+# define REG_S2 18
+# define REG_NARGS 8
+
+typedef unsigned long int greg_t;
+
+/* Container for all general registers. */
+typedef __riscv_mc_gp_state gregset_t;
+
+/* Container for floating-point state. */
+typedef union __riscv_mc_fp_state fpregset_t;
+#endif
+
+struct __riscv_mc_f_ext_state
+ {
+ unsigned int __f[32];
+ unsigned int __fcsr;
+ };
+
+struct __riscv_mc_d_ext_state
+ {
+ unsigned long long int __f[32];
+ unsigned int __fcsr;
+ };
+
+struct __riscv_mc_q_ext_state
+ {
+ unsigned long long int __f[64] __attribute__ ((__aligned__ (16)));
+ unsigned int __fcsr;
+ /* Reserved for expansion of sigcontext structure. Currently zeroed
+ upon signal, and must be zero upon sigreturn. */
+ unsigned int __glibc_reserved[3];
+ };
+
+union __riscv_mc_fp_state
+ {
+ struct __riscv_mc_f_ext_state __f;
+ struct __riscv_mc_d_ext_state __d;
+ struct __riscv_mc_q_ext_state __q;
+ };
+
+typedef struct mcontext_t
+ {
+ __riscv_mc_gp_state __gregs;
+ union __riscv_mc_fp_state __fpregs;
+ } mcontext_t;
+
+/* Userlevel context. */
+typedef struct ucontext_t
+ {
+ unsigned long int __uc_flags;
+ struct ucontext_t *uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ /* There's some padding here to allow sigset_t to be expanded in the
+ future. Though this is unlikely, other architectures put uc_sigmask
+ at the end of this structure and explicitly state it can be
+ expanded, so we didn't want to box ourselves in here. */
+ char __glibc_reserved[1024 / 8 - sizeof (sigset_t)];
+ /* We can't put uc_sigmask at the end of this structure because we need
+ to be able to expand sigcontext in the future. For example, the
+ vector ISA extension will almost certainly add ISA state. We want
+ to ensure all user-visible ISA state can be saved and restored via a
+ ucontext, so we're putting this at the end in order to allow for
+ infinite extensibility. Since we know this will be extended and we
+ assume sigset_t won't be extended an extreme amount, we're
+ prioritizing this. */
+ mcontext_t uc_mcontext;
+ } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/libc/sysdeps/linux/riscv32/sys/user.h b/libc/sysdeps/linux/riscv32/sys/user.h
new file mode 100644
index 000000000..c871f1a03
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/sys/user.h
@@ -0,0 +1 @@
+/* This file is not needed, but in practice gdb might try to include it. */
diff --git a/libc/sysdeps/linux/riscv32/sysdep.h b/libc/sysdeps/linux/riscv32/sysdep.h
new file mode 100644
index 000000000..3fa04bb57
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/sysdep.h
@@ -0,0 +1,126 @@
+/* Assembly macros for RISC-V.
+ Copyright (C) 2011-2018
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _LINUX_RISCV_SYSDEP_H
+#define _LINUX_RISCV_SYSDEP_H 1
+
+#include <common/sysdep.h>
+#include <sys/syscall.h>
+
+#ifdef __ASSEMBLER__
+
+# include <sys/asm.h>
+
+# define ENTRY(name) LEAF(name)
+
+# define L(label) .L ## label
+
+/* Performs a system call, handling errors by setting errno. Linux indicates
+ errors by setting a0 to a value between -1 and -4095. */
+# undef PSEUDO
+# define PSEUDO(name, syscall_name, args) \
+ .text; \
+ .align 2; \
+ ENTRY (name); \
+ li a7, SYS_ify (syscall_name); \
+ scall; \
+ li a7, -4096; \
+ bgtu a0, a7, .Lsyscall_error ## name;
+
+# undef PSEUDO_END
+# define PSEUDO_END(sym) \
+ SYSCALL_ERROR_HANDLER (sym) \
+ ret; \
+ END (sym)
+
+# if !IS_IN_libc
+# if defined (__PIC__)
+# define SYSCALL_ERROR_HANDLER(name) \
+.Lsyscall_error ## name: \
+ la.tls.ie t1, errno; \
+ add t1, t1, tp; \
+ neg a0, a0; \
+ sw a0, 0(t1); \
+ li a0, -1;
+# else
+# define SYSCALL_ERROR_HANDLER(name) \
+.Lsyscall_error ## name: \
+ lui t1, %tprel_hi(errno); \
+ add t1, t1, tp, %tprel_add(errno); \
+ neg a0, a0; \
+ sw a0, %tprel_lo(errno)(t1); \
+ li a0, -1;
+# endif
+# else
+# define SYSCALL_ERROR_HANDLER(name) \
+.Lsyscall_error ## name: \
+ j __syscall_error;
+# endif
+
+/* Performs a system call, not setting errno. */
+# undef PSEUDO_NEORRNO
+# define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .align 2; \
+ ENTRY (name); \
+ li a7, SYS_ify (syscall_name); \
+ scall;
+
+# undef PSEUDO_END_NOERRNO
+# define PSEUDO_END_NOERRNO(name) \
+ END (name)
+
+# undef ret_NOERRNO
+# define ret_NOERRNO ret
+
+/* Perfroms a system call, returning the error code. */
+# undef PSEUDO_ERRVAL
+# define PSEUDO_ERRVAL(name, syscall_name, args) \
+ PSEUDO_NOERRNO (name, syscall_name, args) \
+ neg a0, a0;
+
+# undef PSEUDO_END_ERRVAL
+# define PSEUDO_END_ERRVAL(name) \
+ END (name)
+
+# undef ret_ERRVAL
+# define ret_ERRVAL ret
+
+#endif /* __ASSEMBLER__ */
+
+/* In order to get __set_errno() definition in INLINE_SYSCALL. */
+#ifndef __ASSEMBLER__
+# include <errno.h>
+#endif
+
+#undef SYS_ify
+#define SYS_ify(syscall_name) __NR_##syscall_name
+
+#ifndef __ASSEMBLER__
+
+/* List of system calls which are supported as vsyscalls. */
+# define HAVE_CLOCK_GETRES_VSYSCALL 1
+# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+# define HAVE_GETTIMEOFDAY_VSYSCALL 1
+# define HAVE_GETCPU_VSYSCALL 1
+
+
+extern long int __syscall_error (long int neg_errno);
+
+#endif /* ! __ASSEMBLER__ */
+
+#endif /* linux/riscv/sysdep.h */
diff --git a/libc/sysdeps/linux/riscv32/vfork.S b/libc/sysdeps/linux/riscv32/vfork.S
new file mode 100644
index 000000000..a624f2a7c
--- /dev/null
+++ b/libc/sysdeps/linux/riscv32/vfork.S
@@ -0,0 +1,42 @@
+/* vfork for Linux, RISC-V version.
+ Copyright (C) 2005-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* vfork() is just a special case of clone(). */
+
+#include <sys/asm.h>
+#include <sysdep.h>
+#define __ASSEMBLY__
+#include <linux/sched.h>
+#include <asm/signal.h>
+
+ .text
+LEAF (__vfork)
+
+ li a0, (CLONE_VFORK | CLONE_VM | SIGCHLD)
+ mv a1, sp
+
+ li a7, __NR_clone
+ scall
+
+ bltz a0, 1f
+ ret
+
+1: j __syscall_error
+END (__vfork)
+libc_hidden_def(vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/libc/sysdeps/linux/riscv64/bits/atomic.h b/libc/sysdeps/linux/riscv64/bits/atomic.h
new file mode 100644
index 000000000..8bf6abfac
--- /dev/null
+++ b/libc/sysdeps/linux/riscv64/bits/atomic.h
@@ -0,0 +1,170 @@
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _RISCV64_ATOMIC_MACHINE_H
+#define _RISCV64_ATOMIC_MACHINE_H 1
+
+#define typeof __typeof__
+
+#include <stdint.h>
+#include <sysdep.h>
+
+typedef int8_t atomic8_t;
+typedef int16_t atomic16_t;
+typedef int32_t atomic32_t;
+typedef int64_t atomic64_t;
+
+typedef uint8_t uatomic8_t;
+typedef uint16_t uatomic16_t;
+typedef uint32_t uatomic32_t;
+typedef uint64_t uatomic64_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 1
+
+/* Compare and exchange.
+ For all "bool" routines, we return FALSE if exchange succesful. */
+
+# define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_64_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_64_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+
+/* Compare and exchange with "acquire" semantics, ie barrier after. */
+
+# define atomic_compare_and_exchange_bool_acq(mem, new, old) \
+ __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+# define atomic_compare_and_exchange_val_acq(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+/* Compare and exchange with "release" semantics, ie barrier before. */
+
+# define atomic_compare_and_exchange_val_rel(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_RELEASE)
+
+
+/* Atomic exchange (without compare). */
+
+# define __arch_exchange_8_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_16_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_32_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_64_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define atomic_exchange_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_RELEASE)
+
+
+/* Atomically add value and return the previous (unincremented) value. */
+
+# define __arch_exchange_and_add_8_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_16_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_32_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define __arch_exchange_and_add_64_int(mem, value, model) \
+ __atomic_fetch_add (mem, value, model)
+
+# define atomic_exchange_and_add_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
+ __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_and_add_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
+ __ATOMIC_RELEASE)
+
+/* Barrier macro. */
+#define atomic_full_barrier() __sync_synchronize()
+
+#endif
diff --git a/libc/sysdeps/linux/riscv64/bits/fcntl.h b/libc/sysdeps/linux/riscv64/bits/fcntl.h
index a08bbf5b5..a9d7c84e0 100644
--- a/libc/sysdeps/linux/riscv64/bits/fcntl.h
+++ b/libc/sysdeps/linux/riscv64/bits/fcntl.h
@@ -40,6 +40,7 @@
# define O_DIRECT 00040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -88,11 +89,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/riscv64/bits/uClibc_arch_features.h b/libc/sysdeps/linux/riscv64/bits/uClibc_arch_features.h
index 3b8361442..63b17770d 100644
--- a/libc/sysdeps/linux/riscv64/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/riscv64/bits/uClibc_arch_features.h
@@ -5,7 +5,7 @@
#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
#define _BITS_UCLIBC_ARCH_FEATURES_H
-#undef __UCLIBC_ABORT_INSTRUCTION__
+#define __UCLIBC_ABORT_INSTRUCTION__ "unimp"
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
@@ -13,7 +13,7 @@
/* does your target use statx */
#undef __UCLIBC_HAVE_STATX__
-#define __UCLIBC_SYSCALL_ALIGN_64BIT__
+#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
/* does your target have a broken create_module() ? */
#define __UCLIBC_BROKEN_CREATE_MODULE__
diff --git a/libc/sysdeps/linux/riscv64/bits/uClibc_page.h b/libc/sysdeps/linux/riscv64/bits/uClibc_page.h
index 4792d370f..7282638ba 100644
--- a/libc/sysdeps/linux/riscv64/bits/uClibc_page.h
+++ b/libc/sysdeps/linux/riscv64/bits/uClibc_page.h
@@ -21,7 +21,7 @@
#define _UCLIBC_PAGE_H
/* PAGE_SHIFT determines the page size -- in this case 4096 */
-#define PAGE_SHIFT 13
+#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
diff --git a/libc/sysdeps/linux/riscv64/bits/wordsize.h b/libc/sysdeps/linux/riscv64/bits/wordsize.h
index 67a16ba62..1fc649aad 100644
--- a/libc/sysdeps/linux/riscv64/bits/wordsize.h
+++ b/libc/sysdeps/linux/riscv64/bits/wordsize.h
@@ -25,5 +25,6 @@
#if __riscv_xlen == 64
# define __WORDSIZE_TIME64_COMPAT32 1
#else
-# error "rv32i-based targets are not supported"
+# define __WORDSIZE_TIME64_COMPAT32 1
+// # warning "rv32i-based targets are experimental"
#endif
diff --git a/libc/sysdeps/linux/riscv64/cache.c b/libc/sysdeps/linux/riscv64/cache.c
index 216b333f3..aa99a2a0d 100644
--- a/libc/sysdeps/linux/riscv64/cache.c
+++ b/libc/sysdeps/linux/riscv64/cache.c
@@ -19,6 +19,10 @@
#include <atomic.h>
#include <sys/syscall.h>
+#ifndef __NR_riscv_flush_icache
+#define __NR_riscv_flush_icache 259
+#endif
+
typedef int (*func_type) (void *, void *, unsigned long int);
static int
diff --git a/libc/sysdeps/linux/riscv64/clone.S b/libc/sysdeps/linux/riscv64/clone.S
index f7684c88d..315de2ac8 100644
--- a/libc/sysdeps/linux/riscv64/clone.S
+++ b/libc/sysdeps/linux/riscv64/clone.S
@@ -29,6 +29,9 @@
.text
LEAF (clone)
+ /* Align stack to a 128-bit boundary as per RISC-V ABI. */
+ andi a1,a1,ALMASK
+
/* Sanity check arguments. */
beqz a0,L (invalid) /* No NULL function pointers. */
beqz a1,L (invalid) /* No NULL stack pointers. */
@@ -57,7 +60,7 @@ L (invalid):
li a0, -EINVAL
/* Something bad happened -- no child created. */
L (error):
- j __syscall_error
+ tail __syscall_error
END (clone)
/* Load up the arguments to the function. Put this block of code in
@@ -66,6 +69,9 @@ L (error):
ENTRY (__thread_start)
L (thread_start):
+ .cfi_label .Ldummy
+ cfi_undefined (ra)
+
/* Restore the arg for user's function. */
REG_L a1,0(sp) /* Function pointer. */
REG_L a0,SZREG(sp) /* Argument pointer. */
diff --git a/libc/sysdeps/linux/riscv64/jmpbuf-unwind.h b/libc/sysdeps/linux/riscv64/jmpbuf-unwind.h
index 2e5f37f10..fb5d65ddd 100644
--- a/libc/sysdeps/linux/riscv64/jmpbuf-unwind.h
+++ b/libc/sysdeps/linux/riscv64/jmpbuf-unwind.h
@@ -23,8 +23,8 @@
/* Test if longjmp to JMPBUF would unwind the frame
containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+ ((void *) (address) < (void *) ((jmpbuf)[0].__sp))
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
@@ -33,9 +33,6 @@ static inline uintptr_t __attribute__ ((unused))
_jmpbuf_sp (__jmp_buf regs)
{
uintptr_t sp = regs[0].__sp;
-#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (sp);
-#endif
return sp;
}
diff --git a/libc/sysdeps/linux/riscv64/setjmp.S b/libc/sysdeps/linux/riscv64/setjmp.S
index 4cdb8e9c3..100a0bd78 100644
--- a/libc/sysdeps/linux/riscv64/setjmp.S
+++ b/libc/sysdeps/linux/riscv64/setjmp.S
@@ -20,7 +20,7 @@
ENTRY (_setjmp)
li a1, 0
- j __sigsetjmp
+ j HIDDEN_JUMPTARGET (__sigsetjmp)
END (_setjmp)
ENTRY (setjmp)
li a1, 1
diff --git a/libc/sysdeps/linux/riscv64/sys/asm.h b/libc/sysdeps/linux/riscv64/sys/asm.h
index ddb84b683..3c94c9a70 100644
--- a/libc/sysdeps/linux/riscv64/sys/asm.h
+++ b/libc/sysdeps/linux/riscv64/sys/asm.h
@@ -26,7 +26,11 @@
# define REG_S sd
# define REG_L ld
#elif __riscv_xlen == 32
-# error "rv32i-based targets are not supported"
+# define PTRLOG 2
+# define SZREG 4
+# define REG_S sw
+# define REG_L lw
+// # warning "rv32i-based targets are experimental"
#else
# error __riscv_xlen must equal 32 or 64
#endif
diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h
index 58fd316eb..0d687f04f 100644
--- a/libc/sysdeps/linux/sh/bits/fcntl.h
+++ b/libc/sysdeps/linux/sh/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -101,11 +102,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/sh/bits/kernel_types.h b/libc/sysdeps/linux/sh/bits/kernel_types.h
index ac97261e6..90b2e66b6 100644
--- a/libc/sysdeps/linux/sh/bits/kernel_types.h
+++ b/libc/sysdeps/linux/sh/bits/kernel_types.h
@@ -21,6 +21,7 @@ typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
+typedef long long __kernel_time64_t;
typedef long __kernel_suseconds_t;
typedef long __kernel_clock_t;
typedef int __kernel_daddr_t;
@@ -33,6 +34,7 @@ typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;
typedef __kernel_dev_t __kernel_old_dev_t;
typedef long __kernel_long_t;
+typedef __kernel_long_t __kernel_old_time_t;
typedef unsigned long __kernel_ulong_t;
typedef long long __kernel_loff_t;
diff --git a/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h
index 049c5ca1a..401bd45d6 100644
--- a/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h
@@ -15,9 +15,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h
index b93e3d354..935495937 100644
--- a/libc/sysdeps/linux/sparc/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc/bits/fcntl.h
@@ -51,6 +51,7 @@
# define O_DIRECT 0x100000 /* direct disk access hint */
# define O_NOATIME 0x200000 /* Do not set atime. */
# define O_PATH 0x1000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0x2010000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -102,11 +103,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
#define F_GETLK64 12 /* Get record locking info. */
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
diff --git a/libc/sysdeps/linux/sparc/bits/resource.h b/libc/sysdeps/linux/sparc/bits/resource.h
index 1005aeced..48e1049f4 100644
--- a/libc/sysdeps/linux/sparc/bits/resource.h
+++ b/libc/sysdeps/linux/sparc/bits/resource.h
@@ -98,7 +98,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
@@ -108,11 +114,11 @@ enum __rlimit_resource
#ifndef __USE_FILE_OFFSET64
# define RLIM_INFINITY ((long int)(~0UL >> 1))
#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
+# define RLIM_INFINITY 0xffffffffffffffffULL
#endif
#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+# define RLIM64_INFINITY 0xffffffffffffffffULL
#endif
/* We can represent all limits. */
@@ -158,6 +164,15 @@ enum __rusage_who
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+#ifdef __USE_GNU
+ ,
+ /* The calling thread. */
+ RUSAGE_THREAD = 1
+# define RUSAGE_THREAD RUSAGE_THREAD
+ /* Name for the same functionality on Solaris. */
+# define RUSAGE_LWP RUSAGE_THREAD
+#endif
};
#define __need_timeval
diff --git a/libc/sysdeps/linux/sparc/bits/sem.h b/libc/sysdeps/linux/sparc/bits/sem.h
index 04c579fc6..23fd7c2eb 100644
--- a/libc/sysdeps/linux/sparc/bits/sem.h
+++ b/libc/sysdeps/linux/sparc/bits/sem.h
@@ -38,10 +38,24 @@ struct semid_ds
{
struct ipc_perm sem_perm; /* operation permission struct */
unsigned int __pad1;
- __time_t sem_otime; /* last semop() time */
+#if defined(__UCLIBC_USE_TIME64__)
+ unsigned long int __sem_otime_internal_1; /* last semop() time */
+ unsigned long int __sem_otime_internal_2;
+#else
+ __time_t sem_otime; /* last semop() time */
+#endif
unsigned int __pad2;
- __time_t sem_ctime; /* last time changed by semctl() */
+#if defined(__UCLIBC_USE_TIME64__)
+ unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */
+ unsigned long int __sem_ctime_internal_2;
+#else
+ __time_t sem_ctime; /* last time changed by semctl() */
+#endif
unsigned long int sem_nsems; /* number of semaphores in set */
+#if defined(__UCLIBC_USE_TIME64__)
+ __time_t sem_otime;
+ __time_t sem_ctime;
+#endif
unsigned long int __uclibc_unused1;
unsigned long int __uclibc_unused2;
};
diff --git a/libc/sysdeps/linux/sparc/bits/typesizes.h b/libc/sysdeps/linux/sparc/bits/typesizes.h
index 37b7656aa..c7b7f5576 100644
--- a/libc/sysdeps/linux/sparc/bits/typesizes.h
+++ b/libc/sysdeps/linux/sparc/bits/typesizes.h
@@ -46,9 +46,21 @@
#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
#define __ID_T_TYPE __U32_TYPE
#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+
+#ifdef __UCLIBC_USE_TIME64__
+#define __TIME_T_TYPE __S64_TYPE
+#else
#define __TIME_T_TYPE __SLONGWORD_TYPE
+#endif
+
#define __USECONDS_T_TYPE __U32_TYPE
+
+#ifdef __UCLIBC_USE_TIME64__
+#define __SUSECONDS_T_TYPE __S64_TYPE
+#else
#define __SUSECONDS_T_TYPE __S32_TYPE
+#endif
+
#define __DADDR_T_TYPE __S32_TYPE
#define __SWBLK_T_TYPE __SLONGWORD_TYPE
#define __KEY_T_TYPE __S32_TYPE
diff --git a/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h
index 76f5084ff..283a250bb 100644
--- a/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h
@@ -11,9 +11,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/sparc64/bits/fcntl.h b/libc/sysdeps/linux/sparc64/bits/fcntl.h
index 2443a92c8..395c95baf 100644
--- a/libc/sysdeps/linux/sparc64/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc64/bits/fcntl.h
@@ -47,6 +47,7 @@
# define O_NOATIME 0x200000 /* Do not set atime. */
# define O_CLOEXEC 0x400000 /* Set close_on_exit. */
# define O_PATH 0x1000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0x2010000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -98,11 +99,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
#define F_GETLK64 7 /* Get record locking info. */
#define F_SETLK64 8 /* Set record locking info (non-blocking). */
diff --git a/libc/sysdeps/linux/sparc64/bits/resource.h b/libc/sysdeps/linux/sparc64/bits/resource.h
index 366e5c2d9..84c768785 100644
--- a/libc/sysdeps/linux/sparc64/bits/resource.h
+++ b/libc/sysdeps/linux/sparc64/bits/resource.h
@@ -98,7 +98,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
@@ -122,11 +128,11 @@ enum __rlimit_resource
#ifndef __USE_FILE_OFFSET64
# define RLIM_INFINITY ((long int)(~0UL >> 1))
#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
+# define RLIM_INFINITY 0xffffffffffffffffULL
#endif
#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+# define RLIM64_INFINITY 0xffffffffffffffffULL
#endif
#endif
@@ -174,6 +180,15 @@ enum __rusage_who
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+#ifdef __USE_GNU
+ ,
+ /* The calling thread. */
+ RUSAGE_THREAD = 1
+# define RUSAGE_THREAD RUSAGE_THREAD
+ /* Name for the same functionality on Solaris. */
+# define RUSAGE_LWP RUSAGE_THREAD
+#endif
};
#define __need_timeval
diff --git a/libc/sysdeps/linux/tile/bits/fcntl.h b/libc/sysdeps/linux/tile/bits/fcntl.h
index 3cb4d2caf..818da5c4a 100644
--- a/libc/sysdeps/linux/tile/bits/fcntl.h
+++ b/libc/sysdeps/linux/tile/bits/fcntl.h
@@ -40,6 +40,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -88,11 +89,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h
index bb75b76e0..3547a2046 100644
--- a/libc/sysdeps/linux/x86_64/bits/fcntl.h
+++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -115,11 +116,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/x86_64/crt1.S b/libc/sysdeps/linux/x86_64/crt1.S
index 87777dd5d..701cbf2f6 100644
--- a/libc/sysdeps/linux/x86_64/crt1.S
+++ b/libc/sysdeps/linux/x86_64/crt1.S
@@ -80,6 +80,20 @@ _start:
the outermost frame obviously. */
xorl %ebp, %ebp
+#ifdef L_rcrt1
+ pushq %rdi /* save rdi (but should be 0...) */
+ pushq %rdx /* store rdx (rtld_fini) */
+ xorq %rcx, %rcx /* ensure rcx is 0 */
+ addq _start@GOTPCREL(%rip), %rcx /* get offset of _start from beginning of file */
+ movq _start@GOTPCREL(%rip), %rax /* get run time address of _start */
+ subq %rcx, %rax /* calculate run time load offset */
+ movq %rax, %rdi /* load offset -> param 1 */
+ call reloc_static_pie /* relocate dynamic addrs */
+ xorq %rax, %rax /* cleanup */
+ popq %rdx
+ popq %rdi
+#endif
+
/* Extract the arguments as encoded on the stack and set up
the arguments for __libc_start_main (int (*main) (int, char **, char **),
int argc, char *argv,
@@ -107,7 +121,7 @@ _start:
which grow downwards). */
pushq %rsp
-#if defined(L_Scrt1)
+#if defined(L_Scrt1) || defined(L_rcrt1)
/* Give address for main() */
movq main@GOTPCREL(%rip), %rdi
diff --git a/libc/sysdeps/linux/xtensa/Makefile.arch b/libc/sysdeps/linux/xtensa/Makefile.arch
index 23cd08ee5..f3a93caaa 100644
--- a/libc/sysdeps/linux/xtensa/Makefile.arch
+++ b/libc/sysdeps/linux/xtensa/Makefile.arch
@@ -10,3 +10,6 @@ SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S \
sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
CSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.c
+
+CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
+SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += setcontext.S getcontext.S swapcontext.S __start_context.S
diff --git a/libc/sysdeps/linux/xtensa/__start_context.S b/libc/sysdeps/linux/xtensa/__start_context.S
new file mode 100644
index 000000000..a30d7b618
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/__start_context.S
@@ -0,0 +1,100 @@
+/* Copyright (C) 2018 - 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+#if defined(__XTENSA_CALL0_ABI__)
+/*
+ * There's no entry instruction, makecontext sets up ucontext_t as if
+ * getcontext was called above and is about to return here.
+ * Registers on entry to this function:
+ * a12: func to call
+ * a13: ucp->uc_link, next context to activate if func returns
+ * a14: func argc
+ */
+ .literal_position
+
+ENTRY_PREFIX(__start_context)
+
+ beqz a14, 1f
+
+ /* load func arguments 0..1 from stack and free that space */
+ l32i a2, a1, 8
+ l32i a3, a1, 12
+ addi a1, a1, 16
+ bltui a14, 3, 1f
+
+ /* load func arguments 2..5 from stack and free that space */
+ l32i a4, a1, 0
+ l32i a5, a1, 4
+ l32i a6, a1, 8
+ l32i a7, a1, 12
+ addi a1, a1, 16
+ /* func arguments 6..argc - 1 are now at the top of the stack */
+1:
+ callx0 a12
+ beqz a13, 1f
+ mov a2, a13
+ movi a4, JUMPTARGET (setcontext)
+ callx0 a4
+1:
+ movi a4, JUMPTARGET (_exit)
+ movi a2, 0
+ callx0 a4
+ ill
+END(__start_context)
+#elif defined(__XTENSA_WINDOWED_ABI__)
+/*
+ * There's no entry instruction, makecontext sets up ucontext_t as if
+ * getcontext was called above and is about to return here.
+ * Registers on entry to this function:
+ * a2: func to call
+ * a3: ucp->uc_link, next context to activate if func returns
+ * a4: func argc
+ * a5..a7: func arguments 0..2
+ */
+ .literal_position
+
+ENTRY_PREFIX(__start_context)
+
+ mov a10, a5
+ mov a11, a6
+ mov a12, a7
+ bltui a4, 4, 1f
+
+ /* load func arguments 3..5 from stack and free that space */
+ l32i a13, a1, 4
+ l32i a14, a1, 8
+ l32i a15, a1, 12
+ addi a5, a1, 16
+ movsp a1, a5
+ /* func arguments 6..argc - 1 are now at the top of the stack */
+1:
+ callx8 a2
+ beqz a3, 1f
+ mov a6, a3
+ movi a4, JUMPTARGET (setcontext)
+ callx4 a4
+1:
+ movi a4, JUMPTARGET (_exit)
+ movi a6, 0
+ callx4 a4
+ ill
+END(__start_context)
+#else
+#error Unsupported Xtensa ABI
+#endif
diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h
index f8ae40ca7..5af9d2124 100644
--- a/libc/sysdeps/linux/xtensa/bits/fcntl.h
+++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -101,11 +102,13 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
#endif
+#if defined __USE_XOPEN2K8 || defined __USE_GNU
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
diff --git a/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h b/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h
index de9b38983..a15744c2f 100644
--- a/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h
@@ -11,9 +11,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use statx */
-#undef __UCLIBC_HAVE_STATX__
-
/* does your target align 64bit values in register pairs ? (32bit arches only) */
#define __UCLIBC_SYSCALL_ALIGN_64BIT__
diff --git a/libc/sysdeps/linux/xtensa/crt1.S b/libc/sysdeps/linux/xtensa/crt1.S
index efbe264c0..3fa14ae58 100644
--- a/libc/sysdeps/linux/xtensa/crt1.S
+++ b/libc/sysdeps/linux/xtensa/crt1.S
@@ -76,9 +76,26 @@
.global _start
.type _start, @function
_start:
+#ifdef L_rcrt1
+ .begin no-transform
+ call0 1f
+.Lret_addr:
+ .end no-transform
+ .align 4
+1:
+#endif
#if defined(__XTENSA_WINDOWED_ABI__)
+#ifdef L_rcrt1
+ movi a6, .Lret_addr
+ sub a6, a0, a6
+ movi a0, 0
+ movi a4, reloc_static_pie
+ add a4, a4, a6
+ callx4 a4
+#else
/* Clear a0 to obviously mark the outermost frame. */
movi a0, 0
+#endif
/* Load up the user's main function. */
movi a6, main
@@ -106,8 +123,18 @@ _start:
movi a4, __uClibc_main
callx4 a4
#elif defined(__XTENSA_CALL0_ABI__)
+#ifdef L_rcrt1
+ mov a12, a2
+ movi a2, .Lret_addr
+ sub a2, a0, a2
+ movi a0, reloc_static_pie
+ add a0, a0, a2
+ callx0 a0
+ mov a7, a12
+#else
/* Setup the shared library termination function. */
mov a7, a2
+#endif
/* Load up the user's main function. */
movi a2, main
diff --git a/libc/sysdeps/linux/xtensa/getcontext.S b/libc/sysdeps/linux/xtensa/getcontext.S
new file mode 100644
index 000000000..7588a91b3
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/getcontext.S
@@ -0,0 +1,99 @@
+/* Copyright (C) 2018 - 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include "ucontext_i.h"
+
+#if defined(__XTENSA_CALL0_ABI__)
+ENTRY(__getcontext)
+ s32i a0, a2, MCONTEXT_SC_PC
+ s32i a1, a2, MCONTEXT_SC_A_0 + 4
+
+ /* save callee-saved registers in the context */
+ s32i a12, a2, MCONTEXT_SC_A_0 + 48
+ s32i a13, a2, MCONTEXT_SC_A_0 + 52
+ s32i a14, a2, MCONTEXT_SC_A_0 + 56
+ s32i a15, a2, MCONTEXT_SC_A_0 + 60
+
+ movi a3, 0
+ addi a4, a2, UCONTEXT_SIGMASK
+ movi a2, SIG_BLOCK
+ movi a5, JUMPTARGET (sigprocmask)
+ jx a5
+END(__getcontext)
+#elif defined(__XTENSA_WINDOWED_ABI__)
+ENTRY(__getcontext)
+ movi a4, __window_spill
+ callx4 a4
+ s32i a0, a2, MCONTEXT_SC_PC
+
+ /* copy registers a0..a3 from spill area */
+ addi a3, a1, -16
+ l32i a4, a3, 0
+ l32i a5, a3, 4
+ l32i a6, a3, 8
+ l32i a7, a3, 12
+ s32i a4, a2, MCONTEXT_SC_A_0 + 0
+ s32i a5, a2, MCONTEXT_SC_A_0 + 4
+ s32i a6, a2, MCONTEXT_SC_A_0 + 8
+ s32i a7, a2, MCONTEXT_SC_A_0 + 12
+
+ /* if it was call4 then register saving is done */
+ extui a4, a0, 30, 2
+ bltui a4, 2, 1f
+
+ /* otherwise load spill overflow area address into a3 */
+ addi a3, a5, -16
+ l32i a3, a3, 4
+ addi a3, a3, -32
+ beqi a4, 2, 2f
+
+ /* copy registers a8..a11 from spill overflow area */
+ addi a3, a3, -16
+ l32i a4, a3, 16
+ l32i a5, a3, 20
+ l32i a6, a3, 24
+ l32i a7, a3, 28
+ s32i a4, a2, MCONTEXT_SC_A_0 + 32
+ s32i a5, a2, MCONTEXT_SC_A_0 + 36
+ s32i a6, a2, MCONTEXT_SC_A_0 + 40
+ s32i a7, a2, MCONTEXT_SC_A_0 + 44
+
+ /* copy registers a4..a7 from spill overflow area */
+2:
+ l32i a4, a3, 0
+ l32i a5, a3, 4
+ l32i a6, a3, 8
+ l32i a7, a3, 12
+ s32i a4, a2, MCONTEXT_SC_A_0 + 16
+ s32i a5, a2, MCONTEXT_SC_A_0 + 20
+ s32i a6, a2, MCONTEXT_SC_A_0 + 24
+ s32i a7, a2, MCONTEXT_SC_A_0 + 28
+1:
+ movi a6, SIG_BLOCK
+ movi a7, 0
+ addi a8, a2, UCONTEXT_SIGMASK
+ movi a4, JUMPTARGET (sigprocmask)
+ callx4 a4
+ mov a2, a6
+ retw
+END(__getcontext)
+#else
+#error Unsupported Xtensa ABI
+#endif
+
+weak_alias (__getcontext, getcontext)
diff --git a/libc/sysdeps/linux/xtensa/makecontext.c b/libc/sysdeps/linux/xtensa/makecontext.c
new file mode 100644
index 000000000..da26a0130
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/makecontext.c
@@ -0,0 +1,179 @@
+/* Copyright (C) 2018 - 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <string.h>
+#include <ucontext.h>
+
+extern void __start_context (void);
+
+#if defined(__XTENSA_CALL0_ABI__)
+/*
+ * makecontext sets up new stack like this:
+ *
+ * +------------------ stack top (uc_stack.ss_sp + uc_stack.ss_size)
+ * | optional alignment
+ * +------------------ CFA of __start_context, initial sp points here
+ * | optional padding
+ * +------------------ Optional arguments 6..argc - 1
+ * | func arg argc - 1
+ * | func arg argc - 2
+ * | ...
+ * | func arg 6
+ * +------------------ Optional arguments 2..5
+ * | func arg 5
+ * 16 | func arg 4
+ * | func arg 3
+ * | func arg 2
+ * +------------------ Optional arguments 0..1
+ * | func arg 1
+ * 16 | func arg 0
+ * | padding
+ * | padding
+ * +------------------ CFA of pseudo getcontext
+ * |
+ * +------------------ stack bottom (uc_stack.ss_sp)
+ *
+ * When argc is 0 arguments areas are not allocated,
+ * when 1 <= argc < 3 only area for arguments 0..1 is allocated,
+ * when 3 <= argc < 7 areas for arguments 0..1 and 2..5 is allocated,
+ * when argc >= 7 all three arguments areas are allocated.
+ * Arguments 0..5 area is deallocated by the __start_context after
+ * arguments are loaded into registers.
+ * uc_mcontext registers are set as if __start_context made call0
+ * to getcontext, sp points to that pseudo getcontext CFA.
+ * setcontext/swapcontext will arrange for restoring regiters
+ * a1, a12..a15 of __start_context.
+ */
+
+void
+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
+{
+ unsigned long sp = ((unsigned long) ucp->uc_stack.ss_sp
+ + ucp->uc_stack.ss_size) & -16;
+ int i;
+
+ if (argc > 0)
+ sp -= 4 * (argc + 2);
+ sp &= -16;
+
+ ucp->uc_mcontext.sc_pc = (unsigned long) __start_context;
+ ucp->uc_mcontext.sc_a[1] = sp;
+ ucp->uc_mcontext.sc_a[12] = (unsigned long) func;
+ ucp->uc_mcontext.sc_a[13] = (unsigned long) ucp->uc_link;
+ ucp->uc_mcontext.sc_a[14] = argc;
+
+ if (argc)
+ {
+ va_list ap;
+
+ va_start (ap, argc);
+ for (i = 0; i < argc; ++i)
+ ((int *) sp)[i + 2] = va_arg (ap, int);
+ va_end (ap);
+ }
+}
+#elif defined(__XTENSA_WINDOWED_ABI__)
+/*
+ * makecontext sets up new stack like this:
+ *
+ * +------------------ stack top (uc_stack.ss_sp + uc_stack.ss_size)
+ * | optional alignment
+ * +------------------ CFA of __start_context
+ * 16 | Outermost caller spill area
+ * +------------------
+ * 16 | __start_context overflow area
+ * +------------------ initial sp points here
+ * | optional padding
+ * +------------------ Optional arguments 6..argc - 1
+ * | func arg argc - 1
+ * | func arg argc - 2
+ * | ...
+ * | func arg 6
+ * +------------------ Optional arguments 3..5
+ * | func arg 5
+ * 16 | func arg 4
+ * | func arg 3
+ * | padding
+ * +------------------ CFA of pseudo getcontext
+ * 16 | __start_context caller spill area
+ * +------------------
+ * |
+ * +------------------ stack bottom (uc_stack.ss_sp)
+ *
+ * When argc < 4 both arguments areas are not allocated,
+ * when 4 <= argc < 7 only area for arguments 3..5 is allocated,
+ * when argc >= 7 both arguments areas are allocated.
+ * Arguments 3..5 area is deallocated by the __start_context after
+ * arguments are loaded into registers.
+ * uc_mcontext registers are set as if __start_context made call8
+ * to getcontext, sp points to that pseudo getcontext CFA, spill
+ * area under that sp has a1 pointing to the __start_context CFA
+ * at the top of the stack. setcontext/swapcontext will arrange for
+ * restoring regiters a0..a7 of __start_context.
+ */
+
+void
+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
+{
+ unsigned long sp = ((unsigned long) ucp->uc_stack.ss_sp
+ + ucp->uc_stack.ss_size - 32) & -16;
+ unsigned long spill0[4] =
+ {
+ 0, sp + 32, 0, 0,
+ };
+ int i;
+
+ memset ((void *) sp, 0, 32);
+
+ if (argc > 2)
+ sp -= 4 * (argc - 2);
+ sp &= -16;
+
+ ucp->uc_mcontext.sc_pc =
+ ((unsigned long) __start_context & 0x3fffffff) + 0x80000000;
+ ucp->uc_mcontext.sc_a[0] = 0;
+ ucp->uc_mcontext.sc_a[1] = sp;
+ ucp->uc_mcontext.sc_a[2] = (unsigned long) func;
+ ucp->uc_mcontext.sc_a[3] = (unsigned long) ucp->uc_link;
+ ucp->uc_mcontext.sc_a[4] = argc;
+
+ if (argc)
+ {
+ va_list ap;
+
+ va_start (ap, argc);
+ for (i = 0; i < argc; ++i)
+ {
+ if (i < 3)
+ ucp->uc_mcontext.sc_a[5 + i] = va_arg (ap, int);
+ else
+ ((int *) sp)[i - 2] = va_arg (ap, int);
+ }
+ va_end (ap);
+ }
+
+ sp -= 16;
+ memcpy ((void *) sp, spill0, sizeof (spill0));
+}
+#else
+#error Unsupported Xtensa ABI
+#endif
+
+weak_alias (__makecontext, makecontext)
diff --git a/libc/sysdeps/linux/xtensa/setcontext.S b/libc/sysdeps/linux/xtensa/setcontext.S
new file mode 100644
index 000000000..4df7cc049
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/setcontext.S
@@ -0,0 +1,116 @@
+/* Copyright (C) 2018 - 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include "ucontext_i.h"
+
+#if defined(__XTENSA_CALL0_ABI__)
+ENTRY(__setcontext)
+ addi sp, sp, -16
+ s32i a0, sp, 0
+ s32i a2, sp, 4
+
+ addi a3, a2, UCONTEXT_SIGMASK
+ movi a4, 0
+ movi a2, SIG_SETMASK
+ movi a5, JUMPTARGET (sigprocmask)
+ callx0 a5
+ bnez a2, .Lerror
+
+ l32i a2, sp, 4
+ l32i a0, a2, MCONTEXT_SC_PC
+ l32i a1, a2, MCONTEXT_SC_A_0 + 4
+
+ /* load callee-saved registers from the context */
+ l32i a12, a2, MCONTEXT_SC_A_0 + 48
+ l32i a13, a2, MCONTEXT_SC_A_0 + 52
+ l32i a14, a2, MCONTEXT_SC_A_0 + 56
+ l32i a15, a2, MCONTEXT_SC_A_0 + 60
+ movi a2, 0
+ ret
+.Lerror:
+ l32i a0, sp, 0
+ addi sp, sp, 16
+ ret
+END(__setcontext)
+#elif defined(__XTENSA_WINDOWED_ABI__)
+ENTRY(__setcontext)
+ movi a6, SIG_SETMASK
+ addi a7, a2, UCONTEXT_SIGMASK
+ movi a8, 0
+ movi a4, JUMPTARGET (sigprocmask)
+ callx4 a4
+ bnez a6, .Lerror
+ movi a4, __window_spill
+ callx4 a4
+
+ l32i a0, a2, MCONTEXT_SC_PC
+
+ /* copy registers a0..a3 to spill area */
+ addi a3, a1, -16
+ l32i a4, a2, MCONTEXT_SC_A_0 + 0
+ l32i a5, a2, MCONTEXT_SC_A_0 + 4
+ l32i a6, a2, MCONTEXT_SC_A_0 + 8
+ l32i a7, a2, MCONTEXT_SC_A_0 + 12
+ s32i a4, a3, 0
+ s32i a5, a3, 4
+ s32i a6, a3, 8
+ s32i a7, a3, 12
+
+ /* if it was call4 then register setup is done */
+ extui a4, a0, 30, 2
+ bltui a4, 2, 1f
+
+ /* otherwise load spill overflow area address into a3 */
+ addi a3, a5, -16
+ l32i a3, a3, 4
+ addi a3, a3, -32
+ beqi a4, 2, 2f
+
+ /* copy registers a8..a11 to spill overflow area */
+ addi a3, a3, -16
+ l32i a4, a2, MCONTEXT_SC_A_0 + 32
+ l32i a5, a2, MCONTEXT_SC_A_0 + 36
+ l32i a6, a2, MCONTEXT_SC_A_0 + 40
+ l32i a7, a2, MCONTEXT_SC_A_0 + 44
+ s32i a4, a3, 16
+ s32i a5, a3, 20
+ s32i a6, a3, 24
+ s32i a7, a3, 28
+
+ /* copy registers a4..a7 to spill overflow area */
+2:
+ l32i a4, a2, MCONTEXT_SC_A_0 + 16
+ l32i a5, a2, MCONTEXT_SC_A_0 + 20
+ l32i a6, a2, MCONTEXT_SC_A_0 + 24
+ l32i a7, a2, MCONTEXT_SC_A_0 + 28
+ s32i a4, a3, 0
+ s32i a5, a3, 4
+ s32i a6, a3, 8
+ s32i a7, a3, 12
+1:
+ movi a2, 0
+ retw
+.Lerror:
+ mov a2, a6
+ retw
+END(__setcontext)
+#else
+#error Unsupported Xtensa ABI
+#endif
+
+weak_alias (__setcontext, setcontext)
diff --git a/libc/sysdeps/linux/xtensa/swapcontext.S b/libc/sysdeps/linux/xtensa/swapcontext.S
new file mode 100644
index 000000000..a215edc6d
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/swapcontext.S
@@ -0,0 +1,173 @@
+/* Copyright (C) 2018 - 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include "ucontext_i.h"
+
+#if defined(__XTENSA_CALL0_ABI__)
+ENTRY(__swapcontext)
+ s32i a0, a2, MCONTEXT_SC_PC
+ s32i a1, a2, MCONTEXT_SC_A_0 + 4
+
+ /* save callee-saved registers in the context */
+ s32i a12, a2, MCONTEXT_SC_A_0 + 48
+ s32i a13, a2, MCONTEXT_SC_A_0 + 52
+ s32i a14, a2, MCONTEXT_SC_A_0 + 56
+ s32i a15, a2, MCONTEXT_SC_A_0 + 60
+
+ mov a12, a3
+ mov a13, a2
+
+ addi a3, a3, UCONTEXT_SIGMASK
+ addi a4, a2, UCONTEXT_SIGMASK
+ movi a2, SIG_SETMASK
+ movi a5, JUMPTARGET (sigprocmask)
+ callx0 a5
+ bnez a2, .Lerror
+
+ mov a2, a12
+ l32i a0, a2, MCONTEXT_SC_PC
+ l32i a1, a2, MCONTEXT_SC_A_0 + 4
+
+ /* load callee-saved registers from the context */
+ l32i a12, a2, MCONTEXT_SC_A_0 + 48
+ l32i a13, a2, MCONTEXT_SC_A_0 + 52
+ l32i a14, a2, MCONTEXT_SC_A_0 + 56
+ l32i a15, a2, MCONTEXT_SC_A_0 + 60
+
+ movi a2, 0
+ ret
+.Lerror:
+ l32i a0, a13, MCONTEXT_SC_PC
+ l32i a12, a13, MCONTEXT_SC_A_0 + 48
+ l32i a13, a13, MCONTEXT_SC_A_0 + 52
+ ret
+END(__swapcontext)
+#elif defined(__XTENSA_WINDOWED_ABI__)
+ENTRY(__swapcontext)
+ movi a4, __window_spill
+ callx4 a4
+ mov a9, a3
+ s32i a0, a2, MCONTEXT_SC_PC
+
+ /* copy registers a0..a3 from spill area */
+ addi a3, a1, -16
+ l32i a4, a3, 0
+ l32i a5, a3, 4
+ l32i a6, a3, 8
+ l32i a7, a3, 12
+ s32i a4, a2, MCONTEXT_SC_A_0 + 0
+ s32i a5, a2, MCONTEXT_SC_A_0 + 4
+ s32i a6, a2, MCONTEXT_SC_A_0 + 8
+ s32i a7, a2, MCONTEXT_SC_A_0 + 12
+
+ /* if it was call4 then register saving is done */
+ extui a4, a0, 30, 2
+ bltui a4, 2, 1f
+
+ /* otherwise load spill overflow area address into a3 */
+ addi a3, a5, -16
+ l32i a3, a3, 4
+ addi a3, a3, -32
+ beqi a4, 2, 2f
+
+ /* copy registers a8..a11 from spill overflow area */
+ addi a3, a3, -16
+ l32i a4, a3, 16
+ l32i a5, a3, 20
+ l32i a6, a3, 24
+ l32i a7, a3, 28
+ s32i a4, a2, MCONTEXT_SC_A_0 + 32
+ s32i a5, a2, MCONTEXT_SC_A_0 + 36
+ s32i a6, a2, MCONTEXT_SC_A_0 + 40
+ s32i a7, a2, MCONTEXT_SC_A_0 + 44
+
+ /* copy registers a4..a7 from spill overflow area */
+2:
+ l32i a4, a3, 0
+ l32i a5, a3, 4
+ l32i a6, a3, 8
+ l32i a7, a3, 12
+ s32i a4, a2, MCONTEXT_SC_A_0 + 16
+ s32i a5, a2, MCONTEXT_SC_A_0 + 20
+ s32i a6, a2, MCONTEXT_SC_A_0 + 24
+ s32i a7, a2, MCONTEXT_SC_A_0 + 28
+1:
+ movi a6, SIG_SETMASK
+ addi a7, a9, UCONTEXT_SIGMASK
+ addi a8, a2, UCONTEXT_SIGMASK
+ mov a2, a9
+ movi a4, JUMPTARGET (sigprocmask)
+ callx4 a4
+ bnez a6, .Lerror
+
+ l32i a0, a2, MCONTEXT_SC_PC
+
+ /* copy registers a0..a3 to spill area */
+ addi a3, a1, -16
+ l32i a4, a2, MCONTEXT_SC_A_0 + 0
+ l32i a5, a2, MCONTEXT_SC_A_0 + 4
+ l32i a6, a2, MCONTEXT_SC_A_0 + 8
+ l32i a7, a2, MCONTEXT_SC_A_0 + 12
+ s32i a4, a3, 0
+ s32i a5, a3, 4
+ s32i a6, a3, 8
+ s32i a7, a3, 12
+
+ /* if it was call4 then register setup is done */
+ extui a4, a0, 30, 2
+ bltui a4, 2, 1f
+
+ /* otherwise load spill overflow area address into a3 */
+ addi a3, a5, -16
+ l32i a3, a3, 4
+ addi a3, a3, -32
+ beqi a4, 2, 2f
+
+ /* copy registers a8..a11 to spill overflow area */
+ addi a3, a3, -16
+ l32i a4, a2, MCONTEXT_SC_A_0 + 32
+ l32i a5, a2, MCONTEXT_SC_A_0 + 36
+ l32i a6, a2, MCONTEXT_SC_A_0 + 40
+ l32i a7, a2, MCONTEXT_SC_A_0 + 44
+ s32i a4, a3, 16
+ s32i a5, a3, 20
+ s32i a6, a3, 24
+ s32i a7, a3, 28
+
+ /* copy registers a4..a7 to spill overflow area */
+2:
+ l32i a4, a2, MCONTEXT_SC_A_0 + 16
+ l32i a5, a2, MCONTEXT_SC_A_0 + 20
+ l32i a6, a2, MCONTEXT_SC_A_0 + 24
+ l32i a7, a2, MCONTEXT_SC_A_0 + 28
+ s32i a4, a3, 0
+ s32i a5, a3, 4
+ s32i a6, a3, 8
+ s32i a7, a3, 12
+1:
+ movi a2, 0
+ retw
+.Lerror:
+ mov a2, a6
+ retw
+END(__swapcontext)
+#else
+#error Unsupported Xtensa ABI
+#endif
+
+weak_alias (__swapcontext, swapcontext)
diff --git a/libc/sysdeps/linux/xtensa/sysdep.h b/libc/sysdeps/linux/xtensa/sysdep.h
index 0671f0783..80b3f30fc 100644
--- a/libc/sysdeps/linux/xtensa/sysdep.h
+++ b/libc/sysdeps/linux/xtensa/sysdep.h
@@ -39,12 +39,15 @@
#endif
-#define ENTRY(name) \
+#define ENTRY_PREFIX(name) \
.globl C_SYMBOL_NAME(name); \
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name), @function); \
.align ALIGNARG(2); \
LITERAL_POSITION; \
- C_LABEL(name) \
+ C_LABEL(name)
+
+#define ENTRY(name) \
+ ENTRY_PREFIX(name) \
abi_entry(sp, FRAMESIZE);
#define HIDDEN_ENTRY(name) \
diff --git a/libc/sysdeps/linux/xtensa/ucontext_i.sym b/libc/sysdeps/linux/xtensa/ucontext_i.sym
new file mode 100644
index 000000000..4770c36c9
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/ucontext_i.sym
@@ -0,0 +1,15 @@
+#include <inttypes.h>
+#include <signal.h>
+#include <stddef.h>
+#include <sys/ucontext.h>
+
+SIG_BLOCK
+SIG_SETMASK
+
+-- Offsets of the fields in the ucontext_t structure.
+#define ucontext(member) offsetof (ucontext_t, member)
+#define mcontext(member) ucontext (uc_mcontext.member)
+
+UCONTEXT_SIGMASK ucontext (uc_sigmask)
+MCONTEXT_SC_A_0 mcontext (sc_a[0])
+MCONTEXT_SC_PC mcontext (sc_pc)
diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c
index 53fd902bf..599c3c8e6 100644
--- a/libc/unistd/daemon.c
+++ b/libc/unistd/daemon.c
@@ -63,7 +63,7 @@
/* use clone() to get fork() like behavior here -- we just want to disassociate
* from the controlling terminal
*/
-pid_t _fork_parent(void)
+static inline pid_t _fork_parent(void)
{
INTERNAL_SYSCALL_DECL(err);
register long ret = INTERNAL_SYSCALL(clone, err, 2, CLONE_VM, 0);
diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c
index 172794e9c..d04705abb 100644
--- a/libc/unistd/sysconf.c
+++ b/libc/unistd/sysconf.c
@@ -46,7 +46,7 @@
long int get_phys_pages(void)
{
struct sysinfo si;
- int ps = getpagesize();;
+ int ps = getpagesize();
sysinfo(&si);
@@ -59,7 +59,7 @@ long int get_phys_pages(void)
long int get_avphys_pages(void)
{
struct sysinfo si;
- int ps = getpagesize();;
+ int ps = getpagesize();
sysinfo(&si);
diff --git a/libcrypt/crypt.c b/libcrypt/crypt.c
index 8399205ca..cfcd11f91 100644
--- a/libcrypt/crypt.c
+++ b/libcrypt/crypt.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <crypt.h>
+#include <errno.h>
#include "libcrypt.h"
char *crypt(const char *key, const char *salt)
@@ -26,7 +27,7 @@ char *crypt(const char *key, const char *salt)
return __sha512_crypt(ukey, usalt);
#endif
}
- /* __set_errno(EINVAL);*/ /* ENOSYS might be misleading */
+ __set_errno(EINVAL);
return NULL;
}
return __des_crypt(ukey, usalt);
diff --git a/libcrypt/des.c b/libcrypt/des.c
index 64a977c3b..a90d9db98 100644
--- a/libcrypt/des.c
+++ b/libcrypt/des.c
@@ -64,121 +64,23 @@
#include <string.h>
#include <crypt.h>
#include "libcrypt.h"
+#include "des_tables.c"
/* Re-entrantify me -- all this junk needs to be in
* struct crypt_data to make this really reentrant... */
-static u_char inv_key_perm[64];
-static u_char inv_comp_perm[56];
-static u_char un_pbox[32];
static u_int32_t en_keysl[16], en_keysr[16];
static u_int32_t de_keysl[16], de_keysr[16];
-static u_int32_t ip_maskl[8][256], ip_maskr[8][256];
-static u_int32_t fp_maskl[8][256], fp_maskr[8][256];
-static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128];
-static u_int32_t comp_maskl[8][128], comp_maskr[8][128];
static u_int32_t saltbits;
static u_int32_t old_salt;
static u_int32_t old_rawkey0, old_rawkey1;
-
-/* Static stuff that stays resident and doesn't change after
- * being initialized, and therefore doesn't need to be made
- * reentrant. */
-static u_char init_perm[64], final_perm[64];
-static u_char m_sbox[4][4096];
-static u_int32_t psbox[4][256];
-
-
-
-
/* A pile of data */
static const u_char ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-static const u_char IP[64] = {
- 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
- 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
- 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
- 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
-};
-
-static const u_char key_perm[56] = {
- 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
- 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
- 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
- 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
-};
-
static const u_char key_shifts[16] = {
1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
};
-static const u_char comp_perm[48] = {
- 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
- 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
- 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
- 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32
-};
-
-/*
- * No E box is used, as it's replaced by some ANDs, shifts, and ORs.
- */
-
-static const u_char sbox[8][64] = {
- {
- 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
- 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
- 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
- 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
- },
- {
- 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
- 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
- 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
- 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
- },
- {
- 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
- 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
- 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
- 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
- },
- {
- 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
- 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
- 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
- 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
- },
- {
- 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
- 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
- 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
- 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
- },
- {
- 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
- 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
- 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
- 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
- },
- {
- 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
- 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
- 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
- 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
- },
- {
- 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
- 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
- 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
- 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
- }
-};
-
-static const u_char pbox[32] = {
- 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
- 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
-};
-
static const u_int32_t bits32[32] =
{
0x80000000, 0x40000000, 0x20000000, 0x10000000,
@@ -217,138 +119,16 @@ des_init(void)
{
static int des_initialised = 0;
- int i, j, b, k, inbit, obit;
- u_int32_t *p, *il, *ir, *fl, *fr;
- const u_int32_t *bits28, *bits24;
- u_char u_sbox[8][64];
-
if (des_initialised==1)
return;
old_rawkey0 = old_rawkey1 = 0L;
saltbits = 0L;
old_salt = 0L;
- bits24 = (bits28 = bits32 + 4) + 4;
-
- /*
- * Invert the S-boxes, reordering the input bits.
- */
- for (i = 0; i < 8; i++)
- for (j = 0; j < 64; j++) {
- b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
- u_sbox[i][j] = sbox[i][b];
- }
-
- /*
- * Convert the inverted S-boxes into 4 arrays of 8 bits.
- * Each will handle 12 bits of the S-box input.
- */
- for (b = 0; b < 4; b++)
- for (i = 0; i < 64; i++)
- for (j = 0; j < 64; j++)
- m_sbox[b][(i << 6) | j] =
- (u_char)((u_sbox[(b << 1)][i] << 4) |
- u_sbox[(b << 1) + 1][j]);
-
- /*
- * Set up the initial & final permutations into a useful form, and
- * initialise the inverted key permutation.
- */
- for (i = 0; i < 64; i++) {
- init_perm[final_perm[i] = IP[i] - 1] = (u_char)i;
- inv_key_perm[i] = 255;
- }
-
- /*
- * Invert the key permutation and initialise the inverted key
- * compression permutation.
- */
- for (i = 0; i < 56; i++) {
- inv_key_perm[key_perm[i] - 1] = (u_char)i;
- inv_comp_perm[i] = 255;
- }
-
- /*
- * Invert the key compression permutation.
- */
- for (i = 0; i < 48; i++) {
- inv_comp_perm[comp_perm[i] - 1] = (u_char)i;
- }
-
- /*
- * Set up the OR-mask arrays for the initial and final permutations,
- * and for the key initial and compression permutations.
- */
- for (k = 0; k < 8; k++) {
- for (i = 0; i < 256; i++) {
- *(il = &ip_maskl[k][i]) = 0L;
- *(ir = &ip_maskr[k][i]) = 0L;
- *(fl = &fp_maskl[k][i]) = 0L;
- *(fr = &fp_maskr[k][i]) = 0L;
- for (j = 0; j < 8; j++) {
- inbit = 8 * k + j;
- if (i & bits8[j]) {
- if ((obit = init_perm[inbit]) < 32)
- *il |= bits32[obit];
- else
- *ir |= bits32[obit-32];
- if ((obit = final_perm[inbit]) < 32)
- *fl |= bits32[obit];
- else
- *fr |= bits32[obit - 32];
- }
- }
- }
- for (i = 0; i < 128; i++) {
- *(il = &key_perm_maskl[k][i]) = 0L;
- *(ir = &key_perm_maskr[k][i]) = 0L;
- for (j = 0; j < 7; j++) {
- inbit = 8 * k + j;
- if (i & bits8[j + 1]) {
- if ((obit = inv_key_perm[inbit]) == 255)
- continue;
- if (obit < 28)
- *il |= bits28[obit];
- else
- *ir |= bits28[obit - 28];
- }
- }
- *(il = &comp_maskl[k][i]) = 0L;
- *(ir = &comp_maskr[k][i]) = 0L;
- for (j = 0; j < 7; j++) {
- inbit = 7 * k + j;
- if (i & bits8[j + 1]) {
- if ((obit=inv_comp_perm[inbit]) == 255)
- continue;
- if (obit < 24)
- *il |= bits24[obit];
- else
- *ir |= bits24[obit - 24];
- }
- }
- }
- }
-
- /*
- * Invert the P-box permutation, and convert into OR-masks for
- * handling the output of the S-box arrays setup above.
- */
- for (i = 0; i < 32; i++)
- un_pbox[pbox[i] - 1] = (u_char)i;
-
- for (b = 0; b < 4; b++)
- for (i = 0; i < 256; i++) {
- *(p = &psbox[b][i]) = 0L;
- for (j = 0; j < 8; j++) {
- if (i & bits8[j])
- *p |= bits32[un_pbox[8 * b + j]];
- }
- }
des_initialised = 1;
}
-
static void
setup_salt(u_int32_t salt)
{
diff --git a/libcrypt/des_tables.c b/libcrypt/des_tables.c
new file mode 100644
index 000000000..bc601e2e9
--- /dev/null
+++ b/libcrypt/des_tables.c
@@ -0,0 +1,4758 @@
+#if 0
+/* Generated with the following change */
+
+static u_int32_t ip_maskl[8][256], ip_maskr[8][256];
+static u_int32_t fp_maskl[8][256], fp_maskr[8][256];
+static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128];
+static u_int32_t comp_maskl[8][128], comp_maskr[8][128];
+
+/* Static stuff that stays resident and doesn't change after
+ * being initialized, and therefore doesn't need to be made
+ * reentrant. */
+static u_char m_sbox[4][4096];
+static u_int32_t psbox[4][256];
+
+static const u_char IP[64] = {
+ 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
+ 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
+ 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
+ 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
+};
+
+static const u_char key_perm[56] = {
+ 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
+ 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
+ 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
+ 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
+};
+
+static const u_char comp_perm[48] = {
+ 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
+ 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
+ 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
+ 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32
+};
+
+/*
+ * No E box is used, as it's replaced by some ANDs, shifts, and ORs.
+ */
+
+static const u_char sbox[8][64] = {
+ {
+ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
+ 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
+ 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
+ 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
+ },
+ {
+ 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
+ 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
+ 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
+ 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
+ },
+ {
+ 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 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 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
+ 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
+ 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
+ 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
+ }
+};
+
+static const u_char pbox[32] = {
+ 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
+ 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
+};
+
+static void
+des_init(void)
+{
+ static int des_initialised = 0;
+
+ int i, j, b, k, inbit, obit;
+ u_int32_t *p, *il, *ir, *fl, *fr;
+ const u_int32_t *bits28, *bits24;
+ u_char u_sbox[8][64];
+ u_char inv_key_perm[64];
+ u_char inv_comp_perm[56];
+ u_char un_pbox[32] = {0};
+ u_char init_perm[64] = {0}, final_perm[64] = {0};
+
+ if (des_initialised==1)
+ return;
+
+ old_rawkey0 = old_rawkey1 = 0L;
+ saltbits = 0L;
+ old_salt = 0L;
+ bits24 = (bits28 = bits32 + 4) + 4;
+
+ /*
+ * Invert the S-boxes, reordering the input bits.
+ */
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 64; j++) {
+ b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
+ u_sbox[i][j] = sbox[i][b];
+ }
+
+ /*
+ * Convert the inverted S-boxes into 4 arrays of 8 bits.
+ * Each will handle 12 bits of the S-box input.
+ */
+ for (b = 0; b < 4; b++)
+ for (i = 0; i < 64; i++)
+ for (j = 0; j < 64; j++)
+ m_sbox[b][(i << 6) | j] =
+ (u_char)((u_sbox[(b << 1)][i] << 4) |
+ u_sbox[(b << 1) + 1][j]);
+
+ /*
+ * Set up the initial & final permutations into a useful form, and
+ * initialise the inverted key permutation.
+ */
+ for (i = 0; i < 64; i++) {
+ init_perm[final_perm[i] = IP[i] - 1] = (u_char)i;
+ inv_key_perm[i] = 255;
+ }
+
+ /*
+ * Invert the key permutation and initialise the inverted key
+ * compression permutation.
+ */
+ for (i = 0; i < 56; i++) {
+ inv_key_perm[key_perm[i] - 1] = (u_char)i;
+ inv_comp_perm[i] = 255;
+ }
+
+ /*
+ * Invert the key compression permutation.
+ */
+ for (i = 0; i < 48; i++) {
+ inv_comp_perm[comp_perm[i] - 1] = (u_char)i;
+ }
+
+ /*
+ * Set up the OR-mask arrays for the initial and final permutations,
+ * and for the key initial and compression permutations.
+ */
+ for (k = 0; k < 8; k++) {
+ for (i = 0; i < 256; i++) {
+ *(il = &ip_maskl[k][i]) = 0L;
+ *(ir = &ip_maskr[k][i]) = 0L;
+ *(fl = &fp_maskl[k][i]) = 0L;
+ *(fr = &fp_maskr[k][i]) = 0L;
+ for (j = 0; j < 8; j++) {
+ inbit = 8 * k + j;
+ if (i & bits8[j]) {
+ if ((obit = init_perm[inbit]) < 32)
+ *il |= bits32[obit];
+ else
+ *ir |= bits32[obit-32];
+ if ((obit = final_perm[inbit]) < 32)
+ *fl |= bits32[obit];
+ else
+ *fr |= bits32[obit - 32];
+ }
+ }
+ }
+ for (i = 0; i < 128; i++) {
+ *(il = &key_perm_maskl[k][i]) = 0L;
+ *(ir = &key_perm_maskr[k][i]) = 0L;
+ for (j = 0; j < 7; j++) {
+ inbit = 8 * k + j;
+ if (i & bits8[j + 1]) {
+ if ((obit = inv_key_perm[inbit]) == 255)
+ continue;
+ if (obit < 28)
+ *il |= bits28[obit];
+ else
+ *ir |= bits28[obit - 28];
+ }
+ }
+ *(il = &comp_maskl[k][i]) = 0L;
+ *(ir = &comp_maskr[k][i]) = 0L;
+ for (j = 0; j < 7; j++) {
+ inbit = 7 * k + j;
+ if (i & bits8[j + 1]) {
+ if ((obit=inv_comp_perm[inbit]) == 255)
+ continue;
+ if (obit < 24)
+ *il |= bits24[obit];
+ else
+ *ir |= bits24[obit - 24];
+ }
+ }
+ }
+ }
+
+ /*
+ * Invert the P-box permutation, and convert into OR-masks for
+ * handling the output of the S-box arrays setup above.
+ */
+ for (i = 0; i < 32; i++)
+ un_pbox[pbox[i] - 1] = (u_char)i;
+
+ for (b = 0; b < 4; b++)
+ for (i = 0; i < 256; i++) {
+ *(p = &psbox[b][i]) = 0L;
+ for (j = 0; j < 8; j++) {
+ if (i & bits8[j])
+ *p |= bits32[un_pbox[8 * b + j]];
+ }
+ }
+
+ des_initialised = 1;
+}
+
+static void dump_u_int32_t(u_int32_t *p, const char *prefix, size_t n)
+{
+ size_t i;
+ const size_t w = 4;
+
+ for (i = 0; i < n; ++i) {
+ if (i % w == 0)
+ printf("%s", prefix);
+ printf("0x%08x,%c", p[i], (i % w) == w - 1 ? '\n' : ' ');
+ }
+}
+
+static void dump_u_char(u_char *p, const char *prefix, size_t n)
+{
+ size_t i;
+ const size_t w = 16;
+
+ for (i = 0; i < n; ++i) {
+ if (i % w == 0)
+ printf("%s", prefix);
+ printf("0x%02x,%c", p[i], (i % w) == w - 1 ? '\n' : ' ');
+ }
+}
+
+#define dump_array(type, a, n) \
+ do {\
+ printf("static const %s %s[%d] = {\n", #type, #a, (n)); \
+ dump_##type(&a[0], "\t", (n)); \
+ printf("};\n"); \
+ } while (0)
+
+#define dump_array2(type, a, m, n) \
+ do {\
+ int i; \
+ printf("static const %s %s[%d][%d] = {\n", #type, #a, (m), (n)); \
+ for (i = 0; i < m; ++i) { \
+ printf("%s{\n", i ? ", " : "\t"); \
+ dump_##type(&a[i][0], "\t\t", (n)); \
+ printf("\t}"); \
+ } \
+ printf("\n};\n"); \
+ } while (0)
+
+#define dump_u32_array(a, n) dump_array(u_int32_t, a, n)
+#define dump_u32_array2(a, m, n) dump_array2(u_int32_t, a, m, n)
+
+#define dump_u8_array(a, n) dump_array(u_char, a, n)
+#define dump_u8_array2(a, m, n) dump_array2(u_char, a, m, n)
+
+void dump_des(void)
+{
+ des_init();
+
+ dump_u32_array2(ip_maskl, 8, 256);
+ dump_u32_array2(ip_maskr, 8, 256);
+ dump_u32_array2(fp_maskl, 8, 256);
+ dump_u32_array2(fp_maskr, 8, 256);
+
+ dump_u32_array2(key_perm_maskl, 8, 128);
+ dump_u32_array2(key_perm_maskr, 8, 128);
+ dump_u32_array2(comp_maskl, 8, 128);
+ dump_u32_array2(comp_maskr, 8, 128);
+
+ dump_u8_array2(m_sbox, 4, 4096);
+ dump_u32_array2(psbox, 4, 256);
+}
+
+#endif
+
+static const u_int32_t ip_maskl[8][256] = {
+ {
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000100, 0x00000101, 0x00000100, 0x00000101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x00010000, 0x00010001, 0x00010000, 0x00010001,
+ 0x00010100, 0x00010101, 0x00010100, 0x00010101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01000000, 0x01000001, 0x01000000, 0x01000001,
+ 0x01000100, 0x01000101, 0x01000100, 0x01000101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ 0x01010000, 0x01010001, 0x01010000, 0x01010001,
+ 0x01010100, 0x01010101, 0x01010100, 0x01010101,
+ }, {
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000002,
+ 0x00000200, 0x00000202, 0x00000200, 0x00000202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x00020000, 0x00020002, 0x00020000, 0x00020002,
+ 0x00020200, 0x00020202, 0x00020200, 0x00020202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02000000, 0x02000002, 0x02000000, 0x02000002,
+ 0x02000200, 0x02000202, 0x02000200, 0x02000202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ 0x02020000, 0x02020002, 0x02020000, 0x02020002,
+ 0x02020200, 0x02020202, 0x02020200, 0x02020202,
+ }, {
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00000000, 0x00000004, 0x00000000, 0x00000004,
+ 0x00000400, 0x00000404, 0x00000400, 0x00000404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x00040000, 0x00040004, 0x00040000, 0x00040004,
+ 0x00040400, 0x00040404, 0x00040400, 0x00040404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04000000, 0x04000004, 0x04000000, 0x04000004,
+ 0x04000400, 0x04000404, 0x04000400, 0x04000404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ 0x04040000, 0x04040004, 0x04040000, 0x04040004,
+ 0x04040400, 0x04040404, 0x04040400, 0x04040404,
+ }, {
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00000000, 0x00000008, 0x00000000, 0x00000008,
+ 0x00000800, 0x00000808, 0x00000800, 0x00000808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x00080000, 0x00080008, 0x00080000, 0x00080008,
+ 0x00080800, 0x00080808, 0x00080800, 0x00080808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08000000, 0x08000008, 0x08000000, 0x08000008,
+ 0x08000800, 0x08000808, 0x08000800, 0x08000808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ 0x08080000, 0x08080008, 0x08080000, 0x08080008,
+ 0x08080800, 0x08080808, 0x08080800, 0x08080808,
+ }, {
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00000000, 0x00000010, 0x00000000, 0x00000010,
+ 0x00001000, 0x00001010, 0x00001000, 0x00001010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x00100000, 0x00100010, 0x00100000, 0x00100010,
+ 0x00101000, 0x00101010, 0x00101000, 0x00101010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10000000, 0x10000010, 0x10000000, 0x10000010,
+ 0x10001000, 0x10001010, 0x10001000, 0x10001010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ 0x10100000, 0x10100010, 0x10100000, 0x10100010,
+ 0x10101000, 0x10101010, 0x10101000, 0x10101010,
+ }, {
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00000000, 0x00000020, 0x00000000, 0x00000020,
+ 0x00002000, 0x00002020, 0x00002000, 0x00002020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x00200000, 0x00200020, 0x00200000, 0x00200020,
+ 0x00202000, 0x00202020, 0x00202000, 0x00202020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20000000, 0x20000020, 0x20000000, 0x20000020,
+ 0x20002000, 0x20002020, 0x20002000, 0x20002020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ 0x20200000, 0x20200020, 0x20200000, 0x20200020,
+ 0x20202000, 0x20202020, 0x20202000, 0x20202020,
+ }, {
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00000000, 0x00000040, 0x00000000, 0x00000040,
+ 0x00004000, 0x00004040, 0x00004000, 0x00004040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x00400000, 0x00400040, 0x00400000, 0x00400040,
+ 0x00404000, 0x00404040, 0x00404000, 0x00404040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40000000, 0x40000040, 0x40000000, 0x40000040,
+ 0x40004000, 0x40004040, 0x40004000, 0x40004040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ 0x40400000, 0x40400040, 0x40400000, 0x40400040,
+ 0x40404000, 0x40404040, 0x40404000, 0x40404040,
+ }, {
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000080,
+ 0x00008000, 0x00008080, 0x00008000, 0x00008080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x00800000, 0x00800080, 0x00800000, 0x00800080,
+ 0x00808000, 0x00808080, 0x00808000, 0x00808080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80000000, 0x80000080, 0x80000000, 0x80000080,
+ 0x80008000, 0x80008080, 0x80008000, 0x80008080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ 0x80800000, 0x80800080, 0x80800000, 0x80800080,
+ 0x80808000, 0x80808080, 0x80808000, 0x80808080,
+ }
+};
+static const u_int32_t ip_maskr[8][256] = {
+ {
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00000100, 0x00000100, 0x00000101, 0x00000101,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010000, 0x00010000, 0x00010001, 0x00010001,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x00010100, 0x00010100, 0x00010101, 0x00010101,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000000, 0x01000000, 0x01000001, 0x01000001,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01000100, 0x01000100, 0x01000101, 0x01000101,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010000, 0x01010000, 0x01010001, 0x01010001,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ 0x01010100, 0x01010100, 0x01010101, 0x01010101,
+ }, {
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000002,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00000200, 0x00000200, 0x00000202, 0x00000202,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020000, 0x00020000, 0x00020002, 0x00020002,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x00020200, 0x00020200, 0x00020202, 0x00020202,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000000, 0x02000000, 0x02000002, 0x02000002,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02000200, 0x02000200, 0x02000202, 0x02000202,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020000, 0x02020000, 0x02020002, 0x02020002,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ 0x02020200, 0x02020200, 0x02020202, 0x02020202,
+ }, {
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000000, 0x00000000, 0x00000004, 0x00000004,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00000400, 0x00000400, 0x00000404, 0x00000404,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040000, 0x00040000, 0x00040004, 0x00040004,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x00040400, 0x00040400, 0x00040404, 0x00040404,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000000, 0x04000000, 0x04000004, 0x04000004,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04000400, 0x04000400, 0x04000404, 0x04000404,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040000, 0x04040000, 0x04040004, 0x04040004,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ 0x04040400, 0x04040400, 0x04040404, 0x04040404,
+ }, {
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000000, 0x00000000, 0x00000008, 0x00000008,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00000800, 0x00000800, 0x00000808, 0x00000808,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080000, 0x00080000, 0x00080008, 0x00080008,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x00080800, 0x00080800, 0x00080808, 0x00080808,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000000, 0x08000000, 0x08000008, 0x08000008,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08000800, 0x08000800, 0x08000808, 0x08000808,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080000, 0x08080000, 0x08080008, 0x08080008,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ 0x08080800, 0x08080800, 0x08080808, 0x08080808,
+ }, {
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00000000, 0x00000000, 0x00000010, 0x00000010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00001000, 0x00001000, 0x00001010, 0x00001010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00100000, 0x00100000, 0x00100010, 0x00100010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x00101000, 0x00101000, 0x00101010, 0x00101010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10000000, 0x10000000, 0x10000010, 0x10000010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10001000, 0x10001000, 0x10001010, 0x10001010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10100000, 0x10100000, 0x10100010, 0x10100010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ 0x10101000, 0x10101000, 0x10101010, 0x10101010,
+ }, {
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000020, 0x00000020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00002000, 0x00002000, 0x00002020, 0x00002020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00200000, 0x00200000, 0x00200020, 0x00200020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x00202000, 0x00202000, 0x00202020, 0x00202020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20000000, 0x20000000, 0x20000020, 0x20000020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20002000, 0x20002000, 0x20002020, 0x20002020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20200000, 0x20200000, 0x20200020, 0x20200020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ 0x20202000, 0x20202000, 0x20202020, 0x20202020,
+ }, {
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00000000, 0x00000000, 0x00000040, 0x00000040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00004000, 0x00004000, 0x00004040, 0x00004040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00400000, 0x00400000, 0x00400040, 0x00400040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x00404000, 0x00404000, 0x00404040, 0x00404040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40000000, 0x40000000, 0x40000040, 0x40000040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40004000, 0x40004000, 0x40004040, 0x40004040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40400000, 0x40400000, 0x40400040, 0x40400040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ 0x40404000, 0x40404000, 0x40404040, 0x40404040,
+ }, {
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00008000, 0x00008000, 0x00008080, 0x00008080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00800000, 0x00800000, 0x00800080, 0x00800080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x00808000, 0x00808000, 0x00808080, 0x00808080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80000000, 0x80000000, 0x80000080, 0x80000080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80008000, 0x80008000, 0x80008080, 0x80008080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80800000, 0x80800000, 0x80800080, 0x80800080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ 0x80808000, 0x80808000, 0x80808080, 0x80808080,
+ }
+};
+static const u_int32_t fp_maskl[8][256] = {
+ {
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ 0x00000000, 0x40000000, 0x00400000, 0x40400000,
+ 0x00004000, 0x40004000, 0x00404000, 0x40404000,
+ 0x00000040, 0x40000040, 0x00400040, 0x40400040,
+ 0x00004040, 0x40004040, 0x00404040, 0x40404040,
+ }, {
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ 0x00000000, 0x10000000, 0x00100000, 0x10100000,
+ 0x00001000, 0x10001000, 0x00101000, 0x10101000,
+ 0x00000010, 0x10000010, 0x00100010, 0x10100010,
+ 0x00001010, 0x10001010, 0x00101010, 0x10101010,
+ }, {
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000004, 0x04000004, 0x00040004, 0x04040004,
+ 0x00000404, 0x04000404, 0x00040404, 0x04040404,
+ }, {
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101,
+ }, {
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ 0x00000000, 0x80000000, 0x00800000, 0x80800000,
+ 0x00008000, 0x80008000, 0x00808000, 0x80808000,
+ 0x00000080, 0x80000080, 0x00800080, 0x80800080,
+ 0x00008080, 0x80008080, 0x00808080, 0x80808080,
+ }, {
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ 0x00000000, 0x20000000, 0x00200000, 0x20200000,
+ 0x00002000, 0x20002000, 0x00202000, 0x20202000,
+ 0x00000020, 0x20000020, 0x00200020, 0x20200020,
+ 0x00002020, 0x20002020, 0x00202020, 0x20202020,
+ }, {
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000008, 0x08000008, 0x00080008, 0x08080008,
+ 0x00000808, 0x08000808, 0x00080808, 0x08080808,
+ }, {
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000002, 0x02000002, 0x00020002, 0x02020002,
+ 0x00000202, 0x02000202, 0x00020202, 0x02020202,
+ }
+};
+static const u_int32_t fp_maskr[8][256] = {
+ {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+ 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+ 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+ 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x40400000, 0x40400000, 0x40400000, 0x40400000,
+ 0x40400000, 0x40400000, 0x40400000, 0x40400000,
+ 0x40400000, 0x40400000, 0x40400000, 0x40400000,
+ 0x40400000, 0x40400000, 0x40400000, 0x40400000,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x40004000, 0x40004000, 0x40004000, 0x40004000,
+ 0x40004000, 0x40004000, 0x40004000, 0x40004000,
+ 0x40004000, 0x40004000, 0x40004000, 0x40004000,
+ 0x40004000, 0x40004000, 0x40004000, 0x40004000,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x40404000, 0x40404000, 0x40404000, 0x40404000,
+ 0x40404000, 0x40404000, 0x40404000, 0x40404000,
+ 0x40404000, 0x40404000, 0x40404000, 0x40404000,
+ 0x40404000, 0x40404000, 0x40404000, 0x40404000,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x40000040, 0x40000040, 0x40000040, 0x40000040,
+ 0x40000040, 0x40000040, 0x40000040, 0x40000040,
+ 0x40000040, 0x40000040, 0x40000040, 0x40000040,
+ 0x40000040, 0x40000040, 0x40000040, 0x40000040,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x40400040, 0x40400040, 0x40400040, 0x40400040,
+ 0x40400040, 0x40400040, 0x40400040, 0x40400040,
+ 0x40400040, 0x40400040, 0x40400040, 0x40400040,
+ 0x40400040, 0x40400040, 0x40400040, 0x40400040,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x40004040, 0x40004040, 0x40004040, 0x40004040,
+ 0x40004040, 0x40004040, 0x40004040, 0x40004040,
+ 0x40004040, 0x40004040, 0x40004040, 0x40004040,
+ 0x40004040, 0x40004040, 0x40004040, 0x40004040,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ 0x40404040, 0x40404040, 0x40404040, 0x40404040,
+ 0x40404040, 0x40404040, 0x40404040, 0x40404040,
+ 0x40404040, 0x40404040, 0x40404040, 0x40404040,
+ 0x40404040, 0x40404040, 0x40404040, 0x40404040,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x10000000, 0x10000000, 0x10000000, 0x10000000,
+ 0x10000000, 0x10000000, 0x10000000, 0x10000000,
+ 0x10000000, 0x10000000, 0x10000000, 0x10000000,
+ 0x10000000, 0x10000000, 0x10000000, 0x10000000,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x10100000, 0x10100000, 0x10100000, 0x10100000,
+ 0x10100000, 0x10100000, 0x10100000, 0x10100000,
+ 0x10100000, 0x10100000, 0x10100000, 0x10100000,
+ 0x10100000, 0x10100000, 0x10100000, 0x10100000,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x10001000, 0x10001000, 0x10001000, 0x10001000,
+ 0x10001000, 0x10001000, 0x10001000, 0x10001000,
+ 0x10001000, 0x10001000, 0x10001000, 0x10001000,
+ 0x10001000, 0x10001000, 0x10001000, 0x10001000,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x10101000, 0x10101000, 0x10101000, 0x10101000,
+ 0x10101000, 0x10101000, 0x10101000, 0x10101000,
+ 0x10101000, 0x10101000, 0x10101000, 0x10101000,
+ 0x10101000, 0x10101000, 0x10101000, 0x10101000,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x10000010, 0x10000010, 0x10000010, 0x10000010,
+ 0x10000010, 0x10000010, 0x10000010, 0x10000010,
+ 0x10000010, 0x10000010, 0x10000010, 0x10000010,
+ 0x10000010, 0x10000010, 0x10000010, 0x10000010,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x10100010, 0x10100010, 0x10100010, 0x10100010,
+ 0x10100010, 0x10100010, 0x10100010, 0x10100010,
+ 0x10100010, 0x10100010, 0x10100010, 0x10100010,
+ 0x10100010, 0x10100010, 0x10100010, 0x10100010,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x10001010, 0x10001010, 0x10001010, 0x10001010,
+ 0x10001010, 0x10001010, 0x10001010, 0x10001010,
+ 0x10001010, 0x10001010, 0x10001010, 0x10001010,
+ 0x10001010, 0x10001010, 0x10001010, 0x10001010,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ 0x10101010, 0x10101010, 0x10101010, 0x10101010,
+ 0x10101010, 0x10101010, 0x10101010, 0x10101010,
+ 0x10101010, 0x10101010, 0x10101010, 0x10101010,
+ 0x10101010, 0x10101010, 0x10101010, 0x10101010,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x04000000, 0x04000000, 0x04000000, 0x04000000,
+ 0x04000000, 0x04000000, 0x04000000, 0x04000000,
+ 0x04000000, 0x04000000, 0x04000000, 0x04000000,
+ 0x04000000, 0x04000000, 0x04000000, 0x04000000,
+ 0x00040000, 0x00040000, 0x00040000, 0x00040000,
+ 0x00040000, 0x00040000, 0x00040000, 0x00040000,
+ 0x00040000, 0x00040000, 0x00040000, 0x00040000,
+ 0x00040000, 0x00040000, 0x00040000, 0x00040000,
+ 0x04040000, 0x04040000, 0x04040000, 0x04040000,
+ 0x04040000, 0x04040000, 0x04040000, 0x04040000,
+ 0x04040000, 0x04040000, 0x04040000, 0x04040000,
+ 0x04040000, 0x04040000, 0x04040000, 0x04040000,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x04000400, 0x04000400, 0x04000400, 0x04000400,
+ 0x04000400, 0x04000400, 0x04000400, 0x04000400,
+ 0x04000400, 0x04000400, 0x04000400, 0x04000400,
+ 0x04000400, 0x04000400, 0x04000400, 0x04000400,
+ 0x00040400, 0x00040400, 0x00040400, 0x00040400,
+ 0x00040400, 0x00040400, 0x00040400, 0x00040400,
+ 0x00040400, 0x00040400, 0x00040400, 0x00040400,
+ 0x00040400, 0x00040400, 0x00040400, 0x00040400,
+ 0x04040400, 0x04040400, 0x04040400, 0x04040400,
+ 0x04040400, 0x04040400, 0x04040400, 0x04040400,
+ 0x04040400, 0x04040400, 0x04040400, 0x04040400,
+ 0x04040400, 0x04040400, 0x04040400, 0x04040400,
+ 0x00000004, 0x00000004, 0x00000004, 0x00000004,
+ 0x00000004, 0x00000004, 0x00000004, 0x00000004,
+ 0x00000004, 0x00000004, 0x00000004, 0x00000004,
+ 0x00000004, 0x00000004, 0x00000004, 0x00000004,
+ 0x04000004, 0x04000004, 0x04000004, 0x04000004,
+ 0x04000004, 0x04000004, 0x04000004, 0x04000004,
+ 0x04000004, 0x04000004, 0x04000004, 0x04000004,
+ 0x04000004, 0x04000004, 0x04000004, 0x04000004,
+ 0x00040004, 0x00040004, 0x00040004, 0x00040004,
+ 0x00040004, 0x00040004, 0x00040004, 0x00040004,
+ 0x00040004, 0x00040004, 0x00040004, 0x00040004,
+ 0x00040004, 0x00040004, 0x00040004, 0x00040004,
+ 0x04040004, 0x04040004, 0x04040004, 0x04040004,
+ 0x04040004, 0x04040004, 0x04040004, 0x04040004,
+ 0x04040004, 0x04040004, 0x04040004, 0x04040004,
+ 0x04040004, 0x04040004, 0x04040004, 0x04040004,
+ 0x00000404, 0x00000404, 0x00000404, 0x00000404,
+ 0x00000404, 0x00000404, 0x00000404, 0x00000404,
+ 0x00000404, 0x00000404, 0x00000404, 0x00000404,
+ 0x00000404, 0x00000404, 0x00000404, 0x00000404,
+ 0x04000404, 0x04000404, 0x04000404, 0x04000404,
+ 0x04000404, 0x04000404, 0x04000404, 0x04000404,
+ 0x04000404, 0x04000404, 0x04000404, 0x04000404,
+ 0x04000404, 0x04000404, 0x04000404, 0x04000404,
+ 0x00040404, 0x00040404, 0x00040404, 0x00040404,
+ 0x00040404, 0x00040404, 0x00040404, 0x00040404,
+ 0x00040404, 0x00040404, 0x00040404, 0x00040404,
+ 0x00040404, 0x00040404, 0x00040404, 0x00040404,
+ 0x04040404, 0x04040404, 0x04040404, 0x04040404,
+ 0x04040404, 0x04040404, 0x04040404, 0x04040404,
+ 0x04040404, 0x04040404, 0x04040404, 0x04040404,
+ 0x04040404, 0x04040404, 0x04040404, 0x04040404,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x01000000, 0x01000000, 0x01000000, 0x01000000,
+ 0x01000000, 0x01000000, 0x01000000, 0x01000000,
+ 0x01000000, 0x01000000, 0x01000000, 0x01000000,
+ 0x01000000, 0x01000000, 0x01000000, 0x01000000,
+ 0x00010000, 0x00010000, 0x00010000, 0x00010000,
+ 0x00010000, 0x00010000, 0x00010000, 0x00010000,
+ 0x00010000, 0x00010000, 0x00010000, 0x00010000,
+ 0x00010000, 0x00010000, 0x00010000, 0x00010000,
+ 0x01010000, 0x01010000, 0x01010000, 0x01010000,
+ 0x01010000, 0x01010000, 0x01010000, 0x01010000,
+ 0x01010000, 0x01010000, 0x01010000, 0x01010000,
+ 0x01010000, 0x01010000, 0x01010000, 0x01010000,
+ 0x00000100, 0x00000100, 0x00000100, 0x00000100,
+ 0x00000100, 0x00000100, 0x00000100, 0x00000100,
+ 0x00000100, 0x00000100, 0x00000100, 0x00000100,
+ 0x00000100, 0x00000100, 0x00000100, 0x00000100,
+ 0x01000100, 0x01000100, 0x01000100, 0x01000100,
+ 0x01000100, 0x01000100, 0x01000100, 0x01000100,
+ 0x01000100, 0x01000100, 0x01000100, 0x01000100,
+ 0x01000100, 0x01000100, 0x01000100, 0x01000100,
+ 0x00010100, 0x00010100, 0x00010100, 0x00010100,
+ 0x00010100, 0x00010100, 0x00010100, 0x00010100,
+ 0x00010100, 0x00010100, 0x00010100, 0x00010100,
+ 0x00010100, 0x00010100, 0x00010100, 0x00010100,
+ 0x01010100, 0x01010100, 0x01010100, 0x01010100,
+ 0x01010100, 0x01010100, 0x01010100, 0x01010100,
+ 0x01010100, 0x01010100, 0x01010100, 0x01010100,
+ 0x01010100, 0x01010100, 0x01010100, 0x01010100,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x01000001, 0x01000001, 0x01000001, 0x01000001,
+ 0x01000001, 0x01000001, 0x01000001, 0x01000001,
+ 0x01000001, 0x01000001, 0x01000001, 0x01000001,
+ 0x01000001, 0x01000001, 0x01000001, 0x01000001,
+ 0x00010001, 0x00010001, 0x00010001, 0x00010001,
+ 0x00010001, 0x00010001, 0x00010001, 0x00010001,
+ 0x00010001, 0x00010001, 0x00010001, 0x00010001,
+ 0x00010001, 0x00010001, 0x00010001, 0x00010001,
+ 0x01010001, 0x01010001, 0x01010001, 0x01010001,
+ 0x01010001, 0x01010001, 0x01010001, 0x01010001,
+ 0x01010001, 0x01010001, 0x01010001, 0x01010001,
+ 0x01010001, 0x01010001, 0x01010001, 0x01010001,
+ 0x00000101, 0x00000101, 0x00000101, 0x00000101,
+ 0x00000101, 0x00000101, 0x00000101, 0x00000101,
+ 0x00000101, 0x00000101, 0x00000101, 0x00000101,
+ 0x00000101, 0x00000101, 0x00000101, 0x00000101,
+ 0x01000101, 0x01000101, 0x01000101, 0x01000101,
+ 0x01000101, 0x01000101, 0x01000101, 0x01000101,
+ 0x01000101, 0x01000101, 0x01000101, 0x01000101,
+ 0x01000101, 0x01000101, 0x01000101, 0x01000101,
+ 0x00010101, 0x00010101, 0x00010101, 0x00010101,
+ 0x00010101, 0x00010101, 0x00010101, 0x00010101,
+ 0x00010101, 0x00010101, 0x00010101, 0x00010101,
+ 0x00010101, 0x00010101, 0x00010101, 0x00010101,
+ 0x01010101, 0x01010101, 0x01010101, 0x01010101,
+ 0x01010101, 0x01010101, 0x01010101, 0x01010101,
+ 0x01010101, 0x01010101, 0x01010101, 0x01010101,
+ 0x01010101, 0x01010101, 0x01010101, 0x01010101,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x80000000, 0x80000000, 0x80000000, 0x80000000,
+ 0x80000000, 0x80000000, 0x80000000, 0x80000000,
+ 0x80000000, 0x80000000, 0x80000000, 0x80000000,
+ 0x80000000, 0x80000000, 0x80000000, 0x80000000,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x80800000, 0x80800000, 0x80800000, 0x80800000,
+ 0x80800000, 0x80800000, 0x80800000, 0x80800000,
+ 0x80800000, 0x80800000, 0x80800000, 0x80800000,
+ 0x80800000, 0x80800000, 0x80800000, 0x80800000,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x80008000, 0x80008000, 0x80008000, 0x80008000,
+ 0x80008000, 0x80008000, 0x80008000, 0x80008000,
+ 0x80008000, 0x80008000, 0x80008000, 0x80008000,
+ 0x80008000, 0x80008000, 0x80008000, 0x80008000,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x80808000, 0x80808000, 0x80808000, 0x80808000,
+ 0x80808000, 0x80808000, 0x80808000, 0x80808000,
+ 0x80808000, 0x80808000, 0x80808000, 0x80808000,
+ 0x80808000, 0x80808000, 0x80808000, 0x80808000,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x80000080, 0x80000080, 0x80000080, 0x80000080,
+ 0x80000080, 0x80000080, 0x80000080, 0x80000080,
+ 0x80000080, 0x80000080, 0x80000080, 0x80000080,
+ 0x80000080, 0x80000080, 0x80000080, 0x80000080,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x80800080, 0x80800080, 0x80800080, 0x80800080,
+ 0x80800080, 0x80800080, 0x80800080, 0x80800080,
+ 0x80800080, 0x80800080, 0x80800080, 0x80800080,
+ 0x80800080, 0x80800080, 0x80800080, 0x80800080,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x80008080, 0x80008080, 0x80008080, 0x80008080,
+ 0x80008080, 0x80008080, 0x80008080, 0x80008080,
+ 0x80008080, 0x80008080, 0x80008080, 0x80008080,
+ 0x80008080, 0x80008080, 0x80008080, 0x80008080,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ 0x80808080, 0x80808080, 0x80808080, 0x80808080,
+ 0x80808080, 0x80808080, 0x80808080, 0x80808080,
+ 0x80808080, 0x80808080, 0x80808080, 0x80808080,
+ 0x80808080, 0x80808080, 0x80808080, 0x80808080,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x20000000, 0x20000000, 0x20000000, 0x20000000,
+ 0x20000000, 0x20000000, 0x20000000, 0x20000000,
+ 0x20000000, 0x20000000, 0x20000000, 0x20000000,
+ 0x20000000, 0x20000000, 0x20000000, 0x20000000,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x20200000, 0x20200000, 0x20200000, 0x20200000,
+ 0x20200000, 0x20200000, 0x20200000, 0x20200000,
+ 0x20200000, 0x20200000, 0x20200000, 0x20200000,
+ 0x20200000, 0x20200000, 0x20200000, 0x20200000,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x20002000, 0x20002000, 0x20002000, 0x20002000,
+ 0x20002000, 0x20002000, 0x20002000, 0x20002000,
+ 0x20002000, 0x20002000, 0x20002000, 0x20002000,
+ 0x20002000, 0x20002000, 0x20002000, 0x20002000,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x20202000, 0x20202000, 0x20202000, 0x20202000,
+ 0x20202000, 0x20202000, 0x20202000, 0x20202000,
+ 0x20202000, 0x20202000, 0x20202000, 0x20202000,
+ 0x20202000, 0x20202000, 0x20202000, 0x20202000,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x20000020, 0x20000020, 0x20000020, 0x20000020,
+ 0x20000020, 0x20000020, 0x20000020, 0x20000020,
+ 0x20000020, 0x20000020, 0x20000020, 0x20000020,
+ 0x20000020, 0x20000020, 0x20000020, 0x20000020,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x20200020, 0x20200020, 0x20200020, 0x20200020,
+ 0x20200020, 0x20200020, 0x20200020, 0x20200020,
+ 0x20200020, 0x20200020, 0x20200020, 0x20200020,
+ 0x20200020, 0x20200020, 0x20200020, 0x20200020,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x20002020, 0x20002020, 0x20002020, 0x20002020,
+ 0x20002020, 0x20002020, 0x20002020, 0x20002020,
+ 0x20002020, 0x20002020, 0x20002020, 0x20002020,
+ 0x20002020, 0x20002020, 0x20002020, 0x20002020,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ 0x20202020, 0x20202020, 0x20202020, 0x20202020,
+ 0x20202020, 0x20202020, 0x20202020, 0x20202020,
+ 0x20202020, 0x20202020, 0x20202020, 0x20202020,
+ 0x20202020, 0x20202020, 0x20202020, 0x20202020,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x08000000, 0x08000000, 0x08000000, 0x08000000,
+ 0x08000000, 0x08000000, 0x08000000, 0x08000000,
+ 0x08000000, 0x08000000, 0x08000000, 0x08000000,
+ 0x08000000, 0x08000000, 0x08000000, 0x08000000,
+ 0x00080000, 0x00080000, 0x00080000, 0x00080000,
+ 0x00080000, 0x00080000, 0x00080000, 0x00080000,
+ 0x00080000, 0x00080000, 0x00080000, 0x00080000,
+ 0x00080000, 0x00080000, 0x00080000, 0x00080000,
+ 0x08080000, 0x08080000, 0x08080000, 0x08080000,
+ 0x08080000, 0x08080000, 0x08080000, 0x08080000,
+ 0x08080000, 0x08080000, 0x08080000, 0x08080000,
+ 0x08080000, 0x08080000, 0x08080000, 0x08080000,
+ 0x00000800, 0x00000800, 0x00000800, 0x00000800,
+ 0x00000800, 0x00000800, 0x00000800, 0x00000800,
+ 0x00000800, 0x00000800, 0x00000800, 0x00000800,
+ 0x00000800, 0x00000800, 0x00000800, 0x00000800,
+ 0x08000800, 0x08000800, 0x08000800, 0x08000800,
+ 0x08000800, 0x08000800, 0x08000800, 0x08000800,
+ 0x08000800, 0x08000800, 0x08000800, 0x08000800,
+ 0x08000800, 0x08000800, 0x08000800, 0x08000800,
+ 0x00080800, 0x00080800, 0x00080800, 0x00080800,
+ 0x00080800, 0x00080800, 0x00080800, 0x00080800,
+ 0x00080800, 0x00080800, 0x00080800, 0x00080800,
+ 0x00080800, 0x00080800, 0x00080800, 0x00080800,
+ 0x08080800, 0x08080800, 0x08080800, 0x08080800,
+ 0x08080800, 0x08080800, 0x08080800, 0x08080800,
+ 0x08080800, 0x08080800, 0x08080800, 0x08080800,
+ 0x08080800, 0x08080800, 0x08080800, 0x08080800,
+ 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+ 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+ 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+ 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+ 0x08000008, 0x08000008, 0x08000008, 0x08000008,
+ 0x08000008, 0x08000008, 0x08000008, 0x08000008,
+ 0x08000008, 0x08000008, 0x08000008, 0x08000008,
+ 0x08000008, 0x08000008, 0x08000008, 0x08000008,
+ 0x00080008, 0x00080008, 0x00080008, 0x00080008,
+ 0x00080008, 0x00080008, 0x00080008, 0x00080008,
+ 0x00080008, 0x00080008, 0x00080008, 0x00080008,
+ 0x00080008, 0x00080008, 0x00080008, 0x00080008,
+ 0x08080008, 0x08080008, 0x08080008, 0x08080008,
+ 0x08080008, 0x08080008, 0x08080008, 0x08080008,
+ 0x08080008, 0x08080008, 0x08080008, 0x08080008,
+ 0x08080008, 0x08080008, 0x08080008, 0x08080008,
+ 0x00000808, 0x00000808, 0x00000808, 0x00000808,
+ 0x00000808, 0x00000808, 0x00000808, 0x00000808,
+ 0x00000808, 0x00000808, 0x00000808, 0x00000808,
+ 0x00000808, 0x00000808, 0x00000808, 0x00000808,
+ 0x08000808, 0x08000808, 0x08000808, 0x08000808,
+ 0x08000808, 0x08000808, 0x08000808, 0x08000808,
+ 0x08000808, 0x08000808, 0x08000808, 0x08000808,
+ 0x08000808, 0x08000808, 0x08000808, 0x08000808,
+ 0x00080808, 0x00080808, 0x00080808, 0x00080808,
+ 0x00080808, 0x00080808, 0x00080808, 0x00080808,
+ 0x00080808, 0x00080808, 0x00080808, 0x00080808,
+ 0x00080808, 0x00080808, 0x00080808, 0x00080808,
+ 0x08080808, 0x08080808, 0x08080808, 0x08080808,
+ 0x08080808, 0x08080808, 0x08080808, 0x08080808,
+ 0x08080808, 0x08080808, 0x08080808, 0x08080808,
+ 0x08080808, 0x08080808, 0x08080808, 0x08080808,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x02000000, 0x02000000, 0x02000000, 0x02000000,
+ 0x02000000, 0x02000000, 0x02000000, 0x02000000,
+ 0x02000000, 0x02000000, 0x02000000, 0x02000000,
+ 0x02000000, 0x02000000, 0x02000000, 0x02000000,
+ 0x00020000, 0x00020000, 0x00020000, 0x00020000,
+ 0x00020000, 0x00020000, 0x00020000, 0x00020000,
+ 0x00020000, 0x00020000, 0x00020000, 0x00020000,
+ 0x00020000, 0x00020000, 0x00020000, 0x00020000,
+ 0x02020000, 0x02020000, 0x02020000, 0x02020000,
+ 0x02020000, 0x02020000, 0x02020000, 0x02020000,
+ 0x02020000, 0x02020000, 0x02020000, 0x02020000,
+ 0x02020000, 0x02020000, 0x02020000, 0x02020000,
+ 0x00000200, 0x00000200, 0x00000200, 0x00000200,
+ 0x00000200, 0x00000200, 0x00000200, 0x00000200,
+ 0x00000200, 0x00000200, 0x00000200, 0x00000200,
+ 0x00000200, 0x00000200, 0x00000200, 0x00000200,
+ 0x02000200, 0x02000200, 0x02000200, 0x02000200,
+ 0x02000200, 0x02000200, 0x02000200, 0x02000200,
+ 0x02000200, 0x02000200, 0x02000200, 0x02000200,
+ 0x02000200, 0x02000200, 0x02000200, 0x02000200,
+ 0x00020200, 0x00020200, 0x00020200, 0x00020200,
+ 0x00020200, 0x00020200, 0x00020200, 0x00020200,
+ 0x00020200, 0x00020200, 0x00020200, 0x00020200,
+ 0x00020200, 0x00020200, 0x00020200, 0x00020200,
+ 0x02020200, 0x02020200, 0x02020200, 0x02020200,
+ 0x02020200, 0x02020200, 0x02020200, 0x02020200,
+ 0x02020200, 0x02020200, 0x02020200, 0x02020200,
+ 0x02020200, 0x02020200, 0x02020200, 0x02020200,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x02000002, 0x02000002, 0x02000002, 0x02000002,
+ 0x02000002, 0x02000002, 0x02000002, 0x02000002,
+ 0x02000002, 0x02000002, 0x02000002, 0x02000002,
+ 0x02000002, 0x02000002, 0x02000002, 0x02000002,
+ 0x00020002, 0x00020002, 0x00020002, 0x00020002,
+ 0x00020002, 0x00020002, 0x00020002, 0x00020002,
+ 0x00020002, 0x00020002, 0x00020002, 0x00020002,
+ 0x00020002, 0x00020002, 0x00020002, 0x00020002,
+ 0x02020002, 0x02020002, 0x02020002, 0x02020002,
+ 0x02020002, 0x02020002, 0x02020002, 0x02020002,
+ 0x02020002, 0x02020002, 0x02020002, 0x02020002,
+ 0x02020002, 0x02020002, 0x02020002, 0x02020002,
+ 0x00000202, 0x00000202, 0x00000202, 0x00000202,
+ 0x00000202, 0x00000202, 0x00000202, 0x00000202,
+ 0x00000202, 0x00000202, 0x00000202, 0x00000202,
+ 0x00000202, 0x00000202, 0x00000202, 0x00000202,
+ 0x02000202, 0x02000202, 0x02000202, 0x02000202,
+ 0x02000202, 0x02000202, 0x02000202, 0x02000202,
+ 0x02000202, 0x02000202, 0x02000202, 0x02000202,
+ 0x02000202, 0x02000202, 0x02000202, 0x02000202,
+ 0x00020202, 0x00020202, 0x00020202, 0x00020202,
+ 0x00020202, 0x00020202, 0x00020202, 0x00020202,
+ 0x00020202, 0x00020202, 0x00020202, 0x00020202,
+ 0x00020202, 0x00020202, 0x00020202, 0x00020202,
+ 0x02020202, 0x02020202, 0x02020202, 0x02020202,
+ 0x02020202, 0x02020202, 0x02020202, 0x02020202,
+ 0x02020202, 0x02020202, 0x02020202, 0x02020202,
+ 0x02020202, 0x02020202, 0x02020202, 0x02020202,
+ }
+};
+static const u_int32_t key_perm_maskl[8][128] = {
+ {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x00001000, 0x00001000, 0x00001000, 0x00001000,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x00001010, 0x00001010, 0x00001010, 0x00001010,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x00100000, 0x00100000, 0x00100000, 0x00100000,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x00100010, 0x00100010, 0x00100010, 0x00100010,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x00101000, 0x00101000, 0x00101000, 0x00101000,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ 0x00101010, 0x00101010, 0x00101010, 0x00101010,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x00002000, 0x00002000, 0x00002000, 0x00002000,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x00002020, 0x00002020, 0x00002020, 0x00002020,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x00200000, 0x00200000, 0x00200000, 0x00200000,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x00200020, 0x00200020, 0x00200020, 0x00200020,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x00202000, 0x00202000, 0x00202000, 0x00202000,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ 0x00202020, 0x00202020, 0x00202020, 0x00202020,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x00000040, 0x00000040, 0x00000040, 0x00000040,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x00004000, 0x00004000, 0x00004000, 0x00004000,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x00004040, 0x00004040, 0x00004040, 0x00004040,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x00400000, 0x00400000, 0x00400000, 0x00400000,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x00400040, 0x00400040, 0x00400040, 0x00400040,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x00404000, 0x00404000, 0x00404000, 0x00404000,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ 0x00404040, 0x00404040, 0x00404040, 0x00404040,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x00000080, 0x00000080, 0x00000080, 0x00000080,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x00008000, 0x00008000, 0x00008000, 0x00008000,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x00008080, 0x00008080, 0x00008080, 0x00008080,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x00800000, 0x00800000, 0x00800000, 0x00800000,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x00800080, 0x00800080, 0x00800080, 0x00800080,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x00808000, 0x00808000, 0x00808000, 0x00808000,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ 0x00808080, 0x00808080, 0x00808080, 0x00808080,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000100, 0x00000100, 0x00000100, 0x00000100,
+ 0x00000100, 0x00000100, 0x00000100, 0x00000100,
+ 0x00000101, 0x00000101, 0x00000101, 0x00000101,
+ 0x00000101, 0x00000101, 0x00000101, 0x00000101,
+ 0x00010000, 0x00010000, 0x00010000, 0x00010000,
+ 0x00010000, 0x00010000, 0x00010000, 0x00010000,
+ 0x00010001, 0x00010001, 0x00010001, 0x00010001,
+ 0x00010001, 0x00010001, 0x00010001, 0x00010001,
+ 0x00010100, 0x00010100, 0x00010100, 0x00010100,
+ 0x00010100, 0x00010100, 0x00010100, 0x00010100,
+ 0x00010101, 0x00010101, 0x00010101, 0x00010101,
+ 0x00010101, 0x00010101, 0x00010101, 0x00010101,
+ 0x01000000, 0x01000000, 0x01000000, 0x01000000,
+ 0x01000000, 0x01000000, 0x01000000, 0x01000000,
+ 0x01000001, 0x01000001, 0x01000001, 0x01000001,
+ 0x01000001, 0x01000001, 0x01000001, 0x01000001,
+ 0x01000100, 0x01000100, 0x01000100, 0x01000100,
+ 0x01000100, 0x01000100, 0x01000100, 0x01000100,
+ 0x01000101, 0x01000101, 0x01000101, 0x01000101,
+ 0x01000101, 0x01000101, 0x01000101, 0x01000101,
+ 0x01010000, 0x01010000, 0x01010000, 0x01010000,
+ 0x01010000, 0x01010000, 0x01010000, 0x01010000,
+ 0x01010001, 0x01010001, 0x01010001, 0x01010001,
+ 0x01010001, 0x01010001, 0x01010001, 0x01010001,
+ 0x01010100, 0x01010100, 0x01010100, 0x01010100,
+ 0x01010100, 0x01010100, 0x01010100, 0x01010100,
+ 0x01010101, 0x01010101, 0x01010101, 0x01010101,
+ 0x01010101, 0x01010101, 0x01010101, 0x01010101,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000200, 0x00000200, 0x00000200, 0x00000200,
+ 0x00000200, 0x00000200, 0x00000200, 0x00000200,
+ 0x00000202, 0x00000202, 0x00000202, 0x00000202,
+ 0x00000202, 0x00000202, 0x00000202, 0x00000202,
+ 0x00020000, 0x00020000, 0x00020000, 0x00020000,
+ 0x00020000, 0x00020000, 0x00020000, 0x00020000,
+ 0x00020002, 0x00020002, 0x00020002, 0x00020002,
+ 0x00020002, 0x00020002, 0x00020002, 0x00020002,
+ 0x00020200, 0x00020200, 0x00020200, 0x00020200,
+ 0x00020200, 0x00020200, 0x00020200, 0x00020200,
+ 0x00020202, 0x00020202, 0x00020202, 0x00020202,
+ 0x00020202, 0x00020202, 0x00020202, 0x00020202,
+ 0x02000000, 0x02000000, 0x02000000, 0x02000000,
+ 0x02000000, 0x02000000, 0x02000000, 0x02000000,
+ 0x02000002, 0x02000002, 0x02000002, 0x02000002,
+ 0x02000002, 0x02000002, 0x02000002, 0x02000002,
+ 0x02000200, 0x02000200, 0x02000200, 0x02000200,
+ 0x02000200, 0x02000200, 0x02000200, 0x02000200,
+ 0x02000202, 0x02000202, 0x02000202, 0x02000202,
+ 0x02000202, 0x02000202, 0x02000202, 0x02000202,
+ 0x02020000, 0x02020000, 0x02020000, 0x02020000,
+ 0x02020000, 0x02020000, 0x02020000, 0x02020000,
+ 0x02020002, 0x02020002, 0x02020002, 0x02020002,
+ 0x02020002, 0x02020002, 0x02020002, 0x02020002,
+ 0x02020200, 0x02020200, 0x02020200, 0x02020200,
+ 0x02020200, 0x02020200, 0x02020200, 0x02020200,
+ 0x02020202, 0x02020202, 0x02020202, 0x02020202,
+ 0x02020202, 0x02020202, 0x02020202, 0x02020202,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000004, 0x00000004, 0x00000004, 0x00000004,
+ 0x00000004, 0x00000004, 0x00000004, 0x00000004,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000404, 0x00000404, 0x00000404, 0x00000404,
+ 0x00000404, 0x00000404, 0x00000404, 0x00000404,
+ 0x00040000, 0x00040000, 0x00040000, 0x00040000,
+ 0x00040000, 0x00040000, 0x00040000, 0x00040000,
+ 0x00040004, 0x00040004, 0x00040004, 0x00040004,
+ 0x00040004, 0x00040004, 0x00040004, 0x00040004,
+ 0x00040400, 0x00040400, 0x00040400, 0x00040400,
+ 0x00040400, 0x00040400, 0x00040400, 0x00040400,
+ 0x00040404, 0x00040404, 0x00040404, 0x00040404,
+ 0x00040404, 0x00040404, 0x00040404, 0x00040404,
+ 0x04000000, 0x04000000, 0x04000000, 0x04000000,
+ 0x04000000, 0x04000000, 0x04000000, 0x04000000,
+ 0x04000004, 0x04000004, 0x04000004, 0x04000004,
+ 0x04000004, 0x04000004, 0x04000004, 0x04000004,
+ 0x04000400, 0x04000400, 0x04000400, 0x04000400,
+ 0x04000400, 0x04000400, 0x04000400, 0x04000400,
+ 0x04000404, 0x04000404, 0x04000404, 0x04000404,
+ 0x04000404, 0x04000404, 0x04000404, 0x04000404,
+ 0x04040000, 0x04040000, 0x04040000, 0x04040000,
+ 0x04040000, 0x04040000, 0x04040000, 0x04040000,
+ 0x04040004, 0x04040004, 0x04040004, 0x04040004,
+ 0x04040004, 0x04040004, 0x04040004, 0x04040004,
+ 0x04040400, 0x04040400, 0x04040400, 0x04040400,
+ 0x04040400, 0x04040400, 0x04040400, 0x04040400,
+ 0x04040404, 0x04040404, 0x04040404, 0x04040404,
+ 0x04040404, 0x04040404, 0x04040404, 0x04040404,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+ 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+ 0x00000800, 0x00000800, 0x00000800, 0x00000800,
+ 0x00000800, 0x00000800, 0x00000800, 0x00000800,
+ 0x00000808, 0x00000808, 0x00000808, 0x00000808,
+ 0x00000808, 0x00000808, 0x00000808, 0x00000808,
+ 0x00080000, 0x00080000, 0x00080000, 0x00080000,
+ 0x00080000, 0x00080000, 0x00080000, 0x00080000,
+ 0x00080008, 0x00080008, 0x00080008, 0x00080008,
+ 0x00080008, 0x00080008, 0x00080008, 0x00080008,
+ 0x00080800, 0x00080800, 0x00080800, 0x00080800,
+ 0x00080800, 0x00080800, 0x00080800, 0x00080800,
+ 0x00080808, 0x00080808, 0x00080808, 0x00080808,
+ 0x00080808, 0x00080808, 0x00080808, 0x00080808,
+ 0x08000000, 0x08000000, 0x08000000, 0x08000000,
+ 0x08000000, 0x08000000, 0x08000000, 0x08000000,
+ 0x08000008, 0x08000008, 0x08000008, 0x08000008,
+ 0x08000008, 0x08000008, 0x08000008, 0x08000008,
+ 0x08000800, 0x08000800, 0x08000800, 0x08000800,
+ 0x08000800, 0x08000800, 0x08000800, 0x08000800,
+ 0x08000808, 0x08000808, 0x08000808, 0x08000808,
+ 0x08000808, 0x08000808, 0x08000808, 0x08000808,
+ 0x08080000, 0x08080000, 0x08080000, 0x08080000,
+ 0x08080000, 0x08080000, 0x08080000, 0x08080000,
+ 0x08080008, 0x08080008, 0x08080008, 0x08080008,
+ 0x08080008, 0x08080008, 0x08080008, 0x08080008,
+ 0x08080800, 0x08080800, 0x08080800, 0x08080800,
+ 0x08080800, 0x08080800, 0x08080800, 0x08080800,
+ 0x08080808, 0x08080808, 0x08080808, 0x08080808,
+ 0x08080808, 0x08080808, 0x08080808, 0x08080808,
+ }
+};
+static const u_int32_t key_perm_maskr[8][128] = {
+ {
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ 0x00000000, 0x00100000, 0x00001000, 0x00101000,
+ 0x00000010, 0x00100010, 0x00001010, 0x00101010,
+ 0x00000001, 0x00100001, 0x00001001, 0x00101001,
+ 0x00000011, 0x00100011, 0x00001011, 0x00101011,
+ }, {
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ 0x00000000, 0x00200000, 0x00002000, 0x00202000,
+ 0x00000020, 0x00200020, 0x00002020, 0x00202020,
+ 0x00000002, 0x00200002, 0x00002002, 0x00202002,
+ 0x00000022, 0x00200022, 0x00002022, 0x00202022,
+ }, {
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ 0x00000000, 0x00400000, 0x00004000, 0x00404000,
+ 0x00000040, 0x00400040, 0x00004040, 0x00404040,
+ 0x00000004, 0x00400004, 0x00004004, 0x00404004,
+ 0x00000044, 0x00400044, 0x00004044, 0x00404044,
+ }, {
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ 0x00000000, 0x00800000, 0x00008000, 0x00808000,
+ 0x00000080, 0x00800080, 0x00008080, 0x00808080,
+ 0x00000008, 0x00800008, 0x00008008, 0x00808008,
+ 0x00000088, 0x00800088, 0x00008088, 0x00808088,
+ }, {
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ }, {
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ 0x00000000, 0x02000000, 0x00020000, 0x02020000,
+ 0x00000200, 0x02000200, 0x00020200, 0x02020200,
+ }, {
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ 0x00000000, 0x04000000, 0x00040000, 0x04040000,
+ 0x00000400, 0x04000400, 0x00040400, 0x04040400,
+ }, {
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ 0x00000000, 0x08000000, 0x00080000, 0x08080000,
+ 0x00000800, 0x08000800, 0x00080800, 0x08080800,
+ }
+};
+static const u_int32_t comp_maskl[8][128] = {
+ {
+ 0x00000000, 0x00000010, 0x00004000, 0x00004010,
+ 0x00040000, 0x00040010, 0x00044000, 0x00044010,
+ 0x00000100, 0x00000110, 0x00004100, 0x00004110,
+ 0x00040100, 0x00040110, 0x00044100, 0x00044110,
+ 0x00020000, 0x00020010, 0x00024000, 0x00024010,
+ 0x00060000, 0x00060010, 0x00064000, 0x00064010,
+ 0x00020100, 0x00020110, 0x00024100, 0x00024110,
+ 0x00060100, 0x00060110, 0x00064100, 0x00064110,
+ 0x00000001, 0x00000011, 0x00004001, 0x00004011,
+ 0x00040001, 0x00040011, 0x00044001, 0x00044011,
+ 0x00000101, 0x00000111, 0x00004101, 0x00004111,
+ 0x00040101, 0x00040111, 0x00044101, 0x00044111,
+ 0x00020001, 0x00020011, 0x00024001, 0x00024011,
+ 0x00060001, 0x00060011, 0x00064001, 0x00064011,
+ 0x00020101, 0x00020111, 0x00024101, 0x00024111,
+ 0x00060101, 0x00060111, 0x00064101, 0x00064111,
+ 0x00080000, 0x00080010, 0x00084000, 0x00084010,
+ 0x000c0000, 0x000c0010, 0x000c4000, 0x000c4010,
+ 0x00080100, 0x00080110, 0x00084100, 0x00084110,
+ 0x000c0100, 0x000c0110, 0x000c4100, 0x000c4110,
+ 0x000a0000, 0x000a0010, 0x000a4000, 0x000a4010,
+ 0x000e0000, 0x000e0010, 0x000e4000, 0x000e4010,
+ 0x000a0100, 0x000a0110, 0x000a4100, 0x000a4110,
+ 0x000e0100, 0x000e0110, 0x000e4100, 0x000e4110,
+ 0x00080001, 0x00080011, 0x00084001, 0x00084011,
+ 0x000c0001, 0x000c0011, 0x000c4001, 0x000c4011,
+ 0x00080101, 0x00080111, 0x00084101, 0x00084111,
+ 0x000c0101, 0x000c0111, 0x000c4101, 0x000c4111,
+ 0x000a0001, 0x000a0011, 0x000a4001, 0x000a4011,
+ 0x000e0001, 0x000e0011, 0x000e4001, 0x000e4011,
+ 0x000a0101, 0x000a0111, 0x000a4101, 0x000a4111,
+ 0x000e0101, 0x000e0111, 0x000e4101, 0x000e4111,
+ }, {
+ 0x00000000, 0x00800000, 0x00000002, 0x00800002,
+ 0x00000200, 0x00800200, 0x00000202, 0x00800202,
+ 0x00200000, 0x00a00000, 0x00200002, 0x00a00002,
+ 0x00200200, 0x00a00200, 0x00200202, 0x00a00202,
+ 0x00001000, 0x00801000, 0x00001002, 0x00801002,
+ 0x00001200, 0x00801200, 0x00001202, 0x00801202,
+ 0x00201000, 0x00a01000, 0x00201002, 0x00a01002,
+ 0x00201200, 0x00a01200, 0x00201202, 0x00a01202,
+ 0x00000000, 0x00800000, 0x00000002, 0x00800002,
+ 0x00000200, 0x00800200, 0x00000202, 0x00800202,
+ 0x00200000, 0x00a00000, 0x00200002, 0x00a00002,
+ 0x00200200, 0x00a00200, 0x00200202, 0x00a00202,
+ 0x00001000, 0x00801000, 0x00001002, 0x00801002,
+ 0x00001200, 0x00801200, 0x00001202, 0x00801202,
+ 0x00201000, 0x00a01000, 0x00201002, 0x00a01002,
+ 0x00201200, 0x00a01200, 0x00201202, 0x00a01202,
+ 0x00000040, 0x00800040, 0x00000042, 0x00800042,
+ 0x00000240, 0x00800240, 0x00000242, 0x00800242,
+ 0x00200040, 0x00a00040, 0x00200042, 0x00a00042,
+ 0x00200240, 0x00a00240, 0x00200242, 0x00a00242,
+ 0x00001040, 0x00801040, 0x00001042, 0x00801042,
+ 0x00001240, 0x00801240, 0x00001242, 0x00801242,
+ 0x00201040, 0x00a01040, 0x00201042, 0x00a01042,
+ 0x00201240, 0x00a01240, 0x00201242, 0x00a01242,
+ 0x00000040, 0x00800040, 0x00000042, 0x00800042,
+ 0x00000240, 0x00800240, 0x00000242, 0x00800242,
+ 0x00200040, 0x00a00040, 0x00200042, 0x00a00042,
+ 0x00200240, 0x00a00240, 0x00200242, 0x00a00242,
+ 0x00001040, 0x00801040, 0x00001042, 0x00801042,
+ 0x00001240, 0x00801240, 0x00001242, 0x00801242,
+ 0x00201040, 0x00a01040, 0x00201042, 0x00a01042,
+ 0x00201240, 0x00a01240, 0x00201242, 0x00a01242,
+ }, {
+ 0x00000000, 0x00002000, 0x00000004, 0x00002004,
+ 0x00000400, 0x00002400, 0x00000404, 0x00002404,
+ 0x00000000, 0x00002000, 0x00000004, 0x00002004,
+ 0x00000400, 0x00002400, 0x00000404, 0x00002404,
+ 0x00400000, 0x00402000, 0x00400004, 0x00402004,
+ 0x00400400, 0x00402400, 0x00400404, 0x00402404,
+ 0x00400000, 0x00402000, 0x00400004, 0x00402004,
+ 0x00400400, 0x00402400, 0x00400404, 0x00402404,
+ 0x00000020, 0x00002020, 0x00000024, 0x00002024,
+ 0x00000420, 0x00002420, 0x00000424, 0x00002424,
+ 0x00000020, 0x00002020, 0x00000024, 0x00002024,
+ 0x00000420, 0x00002420, 0x00000424, 0x00002424,
+ 0x00400020, 0x00402020, 0x00400024, 0x00402024,
+ 0x00400420, 0x00402420, 0x00400424, 0x00402424,
+ 0x00400020, 0x00402020, 0x00400024, 0x00402024,
+ 0x00400420, 0x00402420, 0x00400424, 0x00402424,
+ 0x00008000, 0x0000a000, 0x00008004, 0x0000a004,
+ 0x00008400, 0x0000a400, 0x00008404, 0x0000a404,
+ 0x00008000, 0x0000a000, 0x00008004, 0x0000a004,
+ 0x00008400, 0x0000a400, 0x00008404, 0x0000a404,
+ 0x00408000, 0x0040a000, 0x00408004, 0x0040a004,
+ 0x00408400, 0x0040a400, 0x00408404, 0x0040a404,
+ 0x00408000, 0x0040a000, 0x00408004, 0x0040a004,
+ 0x00408400, 0x0040a400, 0x00408404, 0x0040a404,
+ 0x00008020, 0x0000a020, 0x00008024, 0x0000a024,
+ 0x00008420, 0x0000a420, 0x00008424, 0x0000a424,
+ 0x00008020, 0x0000a020, 0x00008024, 0x0000a024,
+ 0x00008420, 0x0000a420, 0x00008424, 0x0000a424,
+ 0x00408020, 0x0040a020, 0x00408024, 0x0040a024,
+ 0x00408420, 0x0040a420, 0x00408424, 0x0040a424,
+ 0x00408020, 0x0040a020, 0x00408024, 0x0040a024,
+ 0x00408420, 0x0040a420, 0x00408424, 0x0040a424,
+ }, {
+ 0x00000000, 0x00010000, 0x00000008, 0x00010008,
+ 0x00000080, 0x00010080, 0x00000088, 0x00010088,
+ 0x00000000, 0x00010000, 0x00000008, 0x00010008,
+ 0x00000080, 0x00010080, 0x00000088, 0x00010088,
+ 0x00100000, 0x00110000, 0x00100008, 0x00110008,
+ 0x00100080, 0x00110080, 0x00100088, 0x00110088,
+ 0x00100000, 0x00110000, 0x00100008, 0x00110008,
+ 0x00100080, 0x00110080, 0x00100088, 0x00110088,
+ 0x00000800, 0x00010800, 0x00000808, 0x00010808,
+ 0x00000880, 0x00010880, 0x00000888, 0x00010888,
+ 0x00000800, 0x00010800, 0x00000808, 0x00010808,
+ 0x00000880, 0x00010880, 0x00000888, 0x00010888,
+ 0x00100800, 0x00110800, 0x00100808, 0x00110808,
+ 0x00100880, 0x00110880, 0x00100888, 0x00110888,
+ 0x00100800, 0x00110800, 0x00100808, 0x00110808,
+ 0x00100880, 0x00110880, 0x00100888, 0x00110888,
+ 0x00000000, 0x00010000, 0x00000008, 0x00010008,
+ 0x00000080, 0x00010080, 0x00000088, 0x00010088,
+ 0x00000000, 0x00010000, 0x00000008, 0x00010008,
+ 0x00000080, 0x00010080, 0x00000088, 0x00010088,
+ 0x00100000, 0x00110000, 0x00100008, 0x00110008,
+ 0x00100080, 0x00110080, 0x00100088, 0x00110088,
+ 0x00100000, 0x00110000, 0x00100008, 0x00110008,
+ 0x00100080, 0x00110080, 0x00100088, 0x00110088,
+ 0x00000800, 0x00010800, 0x00000808, 0x00010808,
+ 0x00000880, 0x00010880, 0x00000888, 0x00010888,
+ 0x00000800, 0x00010800, 0x00000808, 0x00010808,
+ 0x00000880, 0x00010880, 0x00000888, 0x00010888,
+ 0x00100800, 0x00110800, 0x00100808, 0x00110808,
+ 0x00100880, 0x00110880, 0x00100888, 0x00110888,
+ 0x00100800, 0x00110800, 0x00100808, 0x00110808,
+ 0x00100880, 0x00110880, 0x00100888, 0x00110888,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }
+};
+static const u_int32_t comp_maskr[8][128] = {
+ {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }, {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ }, {
+ 0x00000000, 0x00000000, 0x00000080, 0x00000080,
+ 0x00002000, 0x00002000, 0x00002080, 0x00002080,
+ 0x00000001, 0x00000001, 0x00000081, 0x00000081,
+ 0x00002001, 0x00002001, 0x00002081, 0x00002081,
+ 0x00200000, 0x00200000, 0x00200080, 0x00200080,
+ 0x00202000, 0x00202000, 0x00202080, 0x00202080,
+ 0x00200001, 0x00200001, 0x00200081, 0x00200081,
+ 0x00202001, 0x00202001, 0x00202081, 0x00202081,
+ 0x00020000, 0x00020000, 0x00020080, 0x00020080,
+ 0x00022000, 0x00022000, 0x00022080, 0x00022080,
+ 0x00020001, 0x00020001, 0x00020081, 0x00020081,
+ 0x00022001, 0x00022001, 0x00022081, 0x00022081,
+ 0x00220000, 0x00220000, 0x00220080, 0x00220080,
+ 0x00222000, 0x00222000, 0x00222080, 0x00222080,
+ 0x00220001, 0x00220001, 0x00220081, 0x00220081,
+ 0x00222001, 0x00222001, 0x00222081, 0x00222081,
+ 0x00000002, 0x00000002, 0x00000082, 0x00000082,
+ 0x00002002, 0x00002002, 0x00002082, 0x00002082,
+ 0x00000003, 0x00000003, 0x00000083, 0x00000083,
+ 0x00002003, 0x00002003, 0x00002083, 0x00002083,
+ 0x00200002, 0x00200002, 0x00200082, 0x00200082,
+ 0x00202002, 0x00202002, 0x00202082, 0x00202082,
+ 0x00200003, 0x00200003, 0x00200083, 0x00200083,
+ 0x00202003, 0x00202003, 0x00202083, 0x00202083,
+ 0x00020002, 0x00020002, 0x00020082, 0x00020082,
+ 0x00022002, 0x00022002, 0x00022082, 0x00022082,
+ 0x00020003, 0x00020003, 0x00020083, 0x00020083,
+ 0x00022003, 0x00022003, 0x00022083, 0x00022083,
+ 0x00220002, 0x00220002, 0x00220082, 0x00220082,
+ 0x00222002, 0x00222002, 0x00222082, 0x00222082,
+ 0x00220003, 0x00220003, 0x00220083, 0x00220083,
+ 0x00222003, 0x00222003, 0x00222083, 0x00222083,
+ }, {
+ 0x00000000, 0x00000010, 0x00800000, 0x00800010,
+ 0x00010000, 0x00010010, 0x00810000, 0x00810010,
+ 0x00000200, 0x00000210, 0x00800200, 0x00800210,
+ 0x00010200, 0x00010210, 0x00810200, 0x00810210,
+ 0x00000000, 0x00000010, 0x00800000, 0x00800010,
+ 0x00010000, 0x00010010, 0x00810000, 0x00810010,
+ 0x00000200, 0x00000210, 0x00800200, 0x00800210,
+ 0x00010200, 0x00010210, 0x00810200, 0x00810210,
+ 0x00100000, 0x00100010, 0x00900000, 0x00900010,
+ 0x00110000, 0x00110010, 0x00910000, 0x00910010,
+ 0x00100200, 0x00100210, 0x00900200, 0x00900210,
+ 0x00110200, 0x00110210, 0x00910200, 0x00910210,
+ 0x00100000, 0x00100010, 0x00900000, 0x00900010,
+ 0x00110000, 0x00110010, 0x00910000, 0x00910010,
+ 0x00100200, 0x00100210, 0x00900200, 0x00900210,
+ 0x00110200, 0x00110210, 0x00910200, 0x00910210,
+ 0x00000004, 0x00000014, 0x00800004, 0x00800014,
+ 0x00010004, 0x00010014, 0x00810004, 0x00810014,
+ 0x00000204, 0x00000214, 0x00800204, 0x00800214,
+ 0x00010204, 0x00010214, 0x00810204, 0x00810214,
+ 0x00000004, 0x00000014, 0x00800004, 0x00800014,
+ 0x00010004, 0x00010014, 0x00810004, 0x00810014,
+ 0x00000204, 0x00000214, 0x00800204, 0x00800214,
+ 0x00010204, 0x00010214, 0x00810204, 0x00810214,
+ 0x00100004, 0x00100014, 0x00900004, 0x00900014,
+ 0x00110004, 0x00110014, 0x00910004, 0x00910014,
+ 0x00100204, 0x00100214, 0x00900204, 0x00900214,
+ 0x00110204, 0x00110214, 0x00910204, 0x00910214,
+ 0x00100004, 0x00100014, 0x00900004, 0x00900014,
+ 0x00110004, 0x00110014, 0x00910004, 0x00910014,
+ 0x00100204, 0x00100214, 0x00900204, 0x00900214,
+ 0x00110204, 0x00110214, 0x00910204, 0x00910214,
+ }, {
+ 0x00000000, 0x00000400, 0x00001000, 0x00001400,
+ 0x00080000, 0x00080400, 0x00081000, 0x00081400,
+ 0x00000020, 0x00000420, 0x00001020, 0x00001420,
+ 0x00080020, 0x00080420, 0x00081020, 0x00081420,
+ 0x00004000, 0x00004400, 0x00005000, 0x00005400,
+ 0x00084000, 0x00084400, 0x00085000, 0x00085400,
+ 0x00004020, 0x00004420, 0x00005020, 0x00005420,
+ 0x00084020, 0x00084420, 0x00085020, 0x00085420,
+ 0x00000800, 0x00000c00, 0x00001800, 0x00001c00,
+ 0x00080800, 0x00080c00, 0x00081800, 0x00081c00,
+ 0x00000820, 0x00000c20, 0x00001820, 0x00001c20,
+ 0x00080820, 0x00080c20, 0x00081820, 0x00081c20,
+ 0x00004800, 0x00004c00, 0x00005800, 0x00005c00,
+ 0x00084800, 0x00084c00, 0x00085800, 0x00085c00,
+ 0x00004820, 0x00004c20, 0x00005820, 0x00005c20,
+ 0x00084820, 0x00084c20, 0x00085820, 0x00085c20,
+ 0x00000000, 0x00000400, 0x00001000, 0x00001400,
+ 0x00080000, 0x00080400, 0x00081000, 0x00081400,
+ 0x00000020, 0x00000420, 0x00001020, 0x00001420,
+ 0x00080020, 0x00080420, 0x00081020, 0x00081420,
+ 0x00004000, 0x00004400, 0x00005000, 0x00005400,
+ 0x00084000, 0x00084400, 0x00085000, 0x00085400,
+ 0x00004020, 0x00004420, 0x00005020, 0x00005420,
+ 0x00084020, 0x00084420, 0x00085020, 0x00085420,
+ 0x00000800, 0x00000c00, 0x00001800, 0x00001c00,
+ 0x00080800, 0x00080c00, 0x00081800, 0x00081c00,
+ 0x00000820, 0x00000c20, 0x00001820, 0x00001c20,
+ 0x00080820, 0x00080c20, 0x00081820, 0x00081c20,
+ 0x00004800, 0x00004c00, 0x00005800, 0x00005c00,
+ 0x00084800, 0x00084c00, 0x00085800, 0x00085c00,
+ 0x00004820, 0x00004c20, 0x00005820, 0x00005c20,
+ 0x00084820, 0x00084c20, 0x00085820, 0x00085c20,
+ }, {
+ 0x00000000, 0x00000100, 0x00040000, 0x00040100,
+ 0x00000000, 0x00000100, 0x00040000, 0x00040100,
+ 0x00000040, 0x00000140, 0x00040040, 0x00040140,
+ 0x00000040, 0x00000140, 0x00040040, 0x00040140,
+ 0x00400000, 0x00400100, 0x00440000, 0x00440100,
+ 0x00400000, 0x00400100, 0x00440000, 0x00440100,
+ 0x00400040, 0x00400140, 0x00440040, 0x00440140,
+ 0x00400040, 0x00400140, 0x00440040, 0x00440140,
+ 0x00008000, 0x00008100, 0x00048000, 0x00048100,
+ 0x00008000, 0x00008100, 0x00048000, 0x00048100,
+ 0x00008040, 0x00008140, 0x00048040, 0x00048140,
+ 0x00008040, 0x00008140, 0x00048040, 0x00048140,
+ 0x00408000, 0x00408100, 0x00448000, 0x00448100,
+ 0x00408000, 0x00408100, 0x00448000, 0x00448100,
+ 0x00408040, 0x00408140, 0x00448040, 0x00448140,
+ 0x00408040, 0x00408140, 0x00448040, 0x00448140,
+ 0x00000008, 0x00000108, 0x00040008, 0x00040108,
+ 0x00000008, 0x00000108, 0x00040008, 0x00040108,
+ 0x00000048, 0x00000148, 0x00040048, 0x00040148,
+ 0x00000048, 0x00000148, 0x00040048, 0x00040148,
+ 0x00400008, 0x00400108, 0x00440008, 0x00440108,
+ 0x00400008, 0x00400108, 0x00440008, 0x00440108,
+ 0x00400048, 0x00400148, 0x00440048, 0x00440148,
+ 0x00400048, 0x00400148, 0x00440048, 0x00440148,
+ 0x00008008, 0x00008108, 0x00048008, 0x00048108,
+ 0x00008008, 0x00008108, 0x00048008, 0x00048108,
+ 0x00008048, 0x00008148, 0x00048048, 0x00048148,
+ 0x00008048, 0x00008148, 0x00048048, 0x00048148,
+ 0x00408008, 0x00408108, 0x00448008, 0x00448108,
+ 0x00408008, 0x00408108, 0x00448008, 0x00448108,
+ 0x00408048, 0x00408148, 0x00448048, 0x00448148,
+ 0x00408048, 0x00408148, 0x00448048, 0x00448148,
+ }
+};
+static const u_char m_sbox[4][4096] = {
+ {
+ 0xef, 0xe3, 0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e, 0x78, 0x77, 0x7a, 0x7b, 0x71, 0x7a, 0x73, 0x74, 0x7f, 0x7d, 0x74, 0x71, 0x72,
+ 0x75, 0x7b, 0x78, 0x76, 0x7c, 0x77, 0x76, 0x7c, 0x79, 0x70, 0x73, 0x75, 0x72, 0x7e, 0x7f, 0x79,
+ 0x1f, 0x13, 0x11, 0x1d, 0x18, 0x14, 0x1e, 0x17, 0x16, 0x1f, 0x1b, 0x12, 0x13, 0x18, 0x14, 0x1e,
+ 0x19, 0x1c, 0x17, 0x10, 0x12, 0x11, 0x1d, 0x1a, 0x1c, 0x16, 0x10, 0x19, 0x15, 0x1b, 0x1a, 0x15,
+ 0x10, 0x1d, 0x1e, 0x18, 0x17, 0x1a, 0x1b, 0x11, 0x1a, 0x13, 0x14, 0x1f, 0x1d, 0x14, 0x11, 0x12,
+ 0x15, 0x1b, 0x18, 0x16, 0x1c, 0x17, 0x16, 0x1c, 0x19, 0x10, 0x13, 0x15, 0x12, 0x1e, 0x1f, 0x19,
+ 0x4f, 0x43, 0x41, 0x4d, 0x48, 0x44, 0x4e, 0x47, 0x46, 0x4f, 0x4b, 0x42, 0x43, 0x48, 0x44, 0x4e,
+ 0x49, 0x4c, 0x47, 0x40, 0x42, 0x41, 0x4d, 0x4a, 0x4c, 0x46, 0x40, 0x49, 0x45, 0x4b, 0x4a, 0x45,
+ 0x40, 0x4d, 0x4e, 0x48, 0x47, 0x4a, 0x4b, 0x41, 0x4a, 0x43, 0x44, 0x4f, 0x4d, 0x44, 0x41, 0x42,
+ 0x45, 0x4b, 0x48, 0x46, 0x4c, 0x47, 0x46, 0x4c, 0x49, 0x40, 0x43, 0x45, 0x42, 0x4e, 0x4f, 0x49,
+ 0x2f, 0x23, 0x21, 0x2d, 0x28, 0x24, 0x2e, 0x27, 0x26, 0x2f, 0x2b, 0x22, 0x23, 0x28, 0x24, 0x2e,
+ 0x29, 0x2c, 0x27, 0x20, 0x22, 0x21, 0x2d, 0x2a, 0x2c, 0x26, 0x20, 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x58, 0x56, 0x5c, 0x57, 0x56, 0x5c, 0x59, 0x50, 0x53, 0x55, 0x52, 0x5e, 0x5f, 0x59,
+ 0x0f, 0x03, 0x01, 0x0d, 0x08, 0x04, 0x0e, 0x07, 0x06, 0x0f, 0x0b, 0x02, 0x03, 0x08, 0x04, 0x0e,
+ 0x09, 0x0c, 0x07, 0x00, 0x02, 0x01, 0x0d, 0x0a, 0x0c, 0x06, 0x00, 0x09, 0x05, 0x0b, 0x0a, 0x05,
+ 0x00, 0x0d, 0x0e, 0x08, 0x07, 0x0a, 0x0b, 0x01, 0x0a, 0x03, 0x04, 0x0f, 0x0d, 0x04, 0x01, 0x02,
+ 0x05, 0x0b, 0x08, 0x06, 0x0c, 0x07, 0x06, 0x0c, 0x09, 0x00, 0x03, 0x05, 0x02, 0x0e, 0x0f, 0x09,
+ 0x3f, 0x33, 0x31, 0x3d, 0x38, 0x34, 0x3e, 0x37, 0x36, 0x3f, 0x3b, 0x32, 0x33, 0x38, 0x34, 0x3e,
+ 0x39, 0x3c, 0x37, 0x30, 0x32, 0x31, 0x3d, 0x3a, 0x3c, 0x36, 0x30, 0x39, 0x35, 0x3b, 0x3a, 0x35,
+ 0x30, 0x3d, 0x3e, 0x38, 0x37, 0x3a, 0x3b, 0x31, 0x3a, 0x33, 0x34, 0x3f, 0x3d, 0x34, 0x31, 0x32,
+ 0x35, 0x3b, 0x38, 0x36, 0x3c, 0x37, 0x36, 0x3c, 0x39, 0x30, 0x33, 0x35, 0x32, 0x3e, 0x3f, 0x39,
+ 0x7f, 0x73, 0x71, 0x7d, 0x78, 0x74, 0x7e, 0x77, 0x76, 0x7f, 0x7b, 0x72, 0x73, 0x78, 0x74, 0x7e,
+ 0x79, 0x7c, 0x77, 0x70, 0x72, 0x71, 0x7d, 0x7a, 0x7c, 0x76, 0x70, 0x79, 0x75, 0x7b, 0x7a, 0x75,
+ 0x70, 0x7d, 0x7e, 0x78, 0x77, 0x7a, 0x7b, 0x71, 0x7a, 0x73, 0x74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x47, 0x46, 0x4c, 0x49, 0x40, 0x43, 0x45, 0x42, 0x4e, 0x4f, 0x49,
+ 0x6f, 0x63, 0x61, 0x6d, 0x68, 0x64, 0x6e, 0x67, 0x66, 0x6f, 0x6b, 0x62, 0x63, 0x68, 0x64, 0x6e,
+ 0x69, 0x6c, 0x67, 0x60, 0x62, 0x61, 0x6d, 0x6a, 0x6c, 0x66, 0x60, 0x69, 0x65, 0x6b, 0x6a, 0x65,
+ 0x60, 0x6d, 0x6e, 0x68, 0x67, 0x6a, 0x6b, 0x61, 0x6a, 0x63, 0x64, 0x6f, 0x6d, 0x64, 0x61, 0x62,
+ 0x65, 0x6b, 0x68, 0x66, 0x6c, 0x67, 0x66, 0x6c, 0x69, 0x60, 0x63, 0x65, 0x62, 0x6e, 0x6f, 0x69,
+ 0x9f, 0x93, 0x91, 0x9d, 0x98, 0x94, 0x9e, 0x97, 0x96, 0x9f, 0x9b, 0x92, 0x93, 0x98, 0x94, 0x9e,
+ 0x99, 0x9c, 0x97, 0x90, 0x92, 0x91, 0x9d, 0x9a, 0x9c, 0x96, 0x90, 0x99, 0x95, 0x9b, 0x9a, 0x95,
+ 0x90, 0x9d, 0x9e, 0x98, 0x97, 0x9a, 0x9b, 0x91, 0x9a, 0x93, 0x94, 0x9f, 0x9d, 0x94, 0x91, 0x92,
+ 0x95, 0x9b, 0x98, 0x96, 0x9c, 0x97, 0x96, 0x9c, 0x99, 0x90, 0x93, 0x95, 0x92, 0x9e, 0x9f, 0x99,
+ 0x2f, 0x23, 0x21, 0x2d, 0x28, 0x24, 0x2e, 0x27, 0x26, 0x2f, 0x2b, 0x22, 0x23, 0x28, 0x24, 0x2e,
+ 0x29, 0x2c, 0x27, 0x20, 0x22, 0x21, 0x2d, 0x2a, 0x2c, 0x26, 0x20, 0x29, 0x25, 0x2b, 0x2a, 0x25,
+ 0x20, 0x2d, 0x2e, 0x28, 0x27, 0x2a, 0x2b, 0x21, 0x2a, 0x23, 0x24, 0x2f, 0x2d, 0x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 0x05, 0x0c, 0x02, 0x07, 0x08, 0x02, 0x04, 0x0e,
+ 0x77, 0x7d, 0x7d, 0x78, 0x7e, 0x7b, 0x73, 0x75, 0x70, 0x76, 0x76, 0x7f, 0x79, 0x70, 0x7a, 0x73,
+ 0x71, 0x74, 0x72, 0x77, 0x78, 0x72, 0x75, 0x7c, 0x7b, 0x71, 0x7c, 0x7a, 0x74, 0x7e, 0x7f, 0x79,
+ 0x7a, 0x73, 0x76, 0x7f, 0x79, 0x70, 0x70, 0x76, 0x7c, 0x7a, 0x7b, 0x71, 0x77, 0x7d, 0x7d, 0x78,
+ 0x7f, 0x79, 0x71, 0x74, 0x73, 0x75, 0x7e, 0x7b, 0x75, 0x7c, 0x72, 0x77, 0x78, 0x72, 0x74, 0x7e,
+ 0x97, 0x9d, 0x9d, 0x98, 0x9e, 0x9b, 0x93, 0x95, 0x90, 0x96, 0x96, 0x9f, 0x99, 0x90, 0x9a, 0x93,
+ 0x91, 0x94, 0x92, 0x97, 0x98, 0x92, 0x95, 0x9c, 0x9b, 0x91, 0x9c, 0x9a, 0x94, 0x9e, 0x9f, 0x99,
+ 0x9a, 0x93, 0x96, 0x9f, 0x99, 0x90, 0x90, 0x96, 0x9c, 0x9a, 0x9b, 0x91, 0x97, 0x9d, 0x9d, 0x98,
+ 0x9f, 0x99, 0x91, 0x94, 0x93, 0x95, 0x9e, 0x9b, 0x95, 0x9c, 0x92, 0x97, 0x98, 0x92, 0x94, 0x9e,
+ 0x07, 0x0d, 0x0d, 0x08, 0x0e, 0x0b, 0x03, 0x05, 0x00, 0x06, 0x06, 0x0f, 0x09, 0x00, 0x0a, 0x03,
+ 0x01, 0x04, 0x02, 0x07, 0x08, 0x02, 0x05, 0x0c, 0x0b, 0x01, 0x0c, 0x0a, 0x04, 0x0e, 0x0f, 0x09,
+ 0x0a, 0x03, 0x06, 0x0f, 0x09, 0x00, 0x00, 0x06, 0x0c, 0x0a, 0x0b, 0x01, 0x07, 0x0d, 0x0d, 0x08,
+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69, 0x60, 0x60, 0x66, 0x6c, 0x6a, 0x6b, 0x61, 0x67, 0x6d, 0x6d, 0x68,
+ 0x6f, 0x69, 0x61, 0x64, 0x63, 0x65, 0x6e, 0x6b, 0x65, 0x6c, 0x62, 0x67, 0x68, 0x62, 0x64, 0x6e,
+ 0x37, 0x3d, 0x3d, 0x38, 0x3e, 0x3b, 0x33, 0x35, 0x30, 0x36, 0x36, 0x3f, 0x39, 0x30, 0x3a, 0x33,
+ 0x31, 0x34, 0x32, 0x37, 0x38, 0x32, 0x35, 0x3c, 0x3b, 0x31, 0x3c, 0x3a, 0x34, 0x3e, 0x3f, 0x39,
+ 0x3a, 0x33, 0x36, 0x3f, 0x39, 0x30, 0x30, 0x36, 0x3c, 0x3a, 0x3b, 0x31, 0x37, 0x3d, 0x3d, 0x38,
+ 0x3f, 0x39, 0x31, 0x34, 0x33, 0x35, 0x3e, 0x3b, 0x35, 0x3c, 0x32, 0x37, 0x38, 0x32, 0x34, 0x3e,
+ 0x37, 0x3d, 0x3d, 0x38, 0x3e, 0x3b, 0x33, 0x35, 0x30, 0x36, 0x36, 0x3f, 0x39, 0x30, 0x3a, 0x33,
+ 0x31, 0x34, 0x32, 0x37, 0x38, 0x32, 0x35, 0x3c, 0x3b, 0x31, 0x3c, 0x3a, 0x34, 0x3e, 0x3f, 0x39,
+ 0x3a, 0x33, 0x36, 0x3f, 0x39, 0x30, 0x30, 0x36, 0x3c, 0x3a, 0x3b, 0x31, 0x37, 0x3d, 0x3d, 0x38,
+ 0x3f, 0x39, 0x31, 0x34, 0x33, 0x35, 0x3e, 0x3b, 0x35, 0x3c, 0x32, 0x37, 0x38, 0x32, 0x34, 0x3e,
+ 0x47, 0x4d, 0x4d, 0x48, 0x4e, 0x4b, 0x43, 0x45, 0x40, 0x46, 0x46, 0x4f, 0x49, 0x40, 0x4a, 0x43,
+ 0x41, 0x44, 0x42, 0x47, 0x48, 0x42, 0x45, 0x4c, 0x4b, 0x41, 0x4c, 0x4a, 0x44, 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x33, 0x35, 0x3e, 0x3b, 0x35, 0x3c, 0x32, 0x37, 0x38, 0x32, 0x34, 0x3e,
+ 0x87, 0x8d, 0x8d, 0x88, 0x8e, 0x8b, 0x83, 0x85, 0x80, 0x86, 0x86, 0x8f, 0x89, 0x80, 0x8a, 0x83,
+ 0x81, 0x84, 0x82, 0x87, 0x88, 0x82, 0x85, 0x8c, 0x8b, 0x81, 0x8c, 0x8a, 0x84, 0x8e, 0x8f, 0x89,
+ 0x8a, 0x83, 0x86, 0x8f, 0x89, 0x80, 0x80, 0x86, 0x8c, 0x8a, 0x8b, 0x81, 0x87, 0x8d, 0x8d, 0x88,
+ 0x8f, 0x89, 0x81, 0x84, 0x83, 0x85, 0x8e, 0x8b, 0x85, 0x8c, 0x82, 0x87, 0x88, 0x82, 0x84, 0x8e,
+ 0x07, 0x0d, 0x0d, 0x08, 0x0e, 0x0b, 0x03, 0x05, 0x00, 0x06, 0x06, 0x0f, 0x09, 0x00, 0x0a, 0x03,
+ 0x01, 0x04, 0x02, 0x07, 0x08, 0x02, 0x05, 0x0c, 0x0b, 0x01, 0x0c, 0x0a, 0x04, 0x0e, 0x0f, 0x09,
+ 0x0a, 0x03, 0x06, 0x0f, 0x09, 0x00, 0x00, 0x06, 0x0c, 0x0a, 0x0b, 0x01, 0x07, 0x0d, 0x0d, 0x08,
+ 0x0f, 0x09, 0x01, 0x04, 0x03, 0x05, 0x0e, 0x0b, 0x05, 0x0c, 0x02, 0x07, 0x08, 0x02, 0x04, 0x0e,
+ 0x77, 0x7d, 0x7d, 0x78, 0x7e, 0x7b, 0x73, 0x75, 0x70, 0x76, 0x76, 0x7f, 0x79, 0x70, 0x7a, 0x73,
+ 0x71, 0x74, 0x72, 0x77, 0x78, 0x72, 0x75, 0x7c, 0x7b, 0x71, 0x7c, 0x7a, 0x74, 0x7e, 0x7f, 0x79,
+ 0x7a, 0x73, 0x76, 0x7f, 0x79, 0x70, 0x70, 0x76, 0x7c, 0x7a, 0x7b, 0x71, 0x77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f, 0x6a, 0x64, 0x6f, 0x62, 0x69, 0x67, 0x62, 0x6c, 0x66, 0x69, 0x68, 0x65,
+ 0x60, 0x66, 0x6d, 0x61, 0x63, 0x6d, 0x64, 0x6e, 0x6e, 0x60, 0x67, 0x6b, 0x65, 0x63, 0x6b, 0x68,
+ 0x69, 0x64, 0x6e, 0x63, 0x6f, 0x62, 0x65, 0x6c, 0x62, 0x69, 0x68, 0x65, 0x6c, 0x6f, 0x63, 0x6a,
+ 0x67, 0x6b, 0x60, 0x6e, 0x64, 0x61, 0x6a, 0x67, 0x61, 0x66, 0x6d, 0x60, 0x6b, 0x68, 0x66, 0x6d,
+ 0x1c, 0x1a, 0x11, 0x1f, 0x1a, 0x14, 0x1f, 0x12, 0x19, 0x17, 0x12, 0x1c, 0x16, 0x19, 0x18, 0x15,
+ 0x10, 0x16, 0x1d, 0x11, 0x13, 0x1d, 0x14, 0x1e, 0x1e, 0x10, 0x17, 0x1b, 0x15, 0x13, 0x1b, 0x18,
+ 0x19, 0x14, 0x1e, 0x13, 0x1f, 0x12, 0x15, 0x1c, 0x12, 0x19, 0x18, 0x15, 0x1c, 0x1f, 0x13, 0x1a,
+ 0x17, 0x1b, 0x10, 0x1e, 0x14, 0x11, 0x1a, 0x17, 0x11, 0x16, 0x1d, 0x10, 0x1b, 0x18, 0x16, 0x1d,
+ 0x8c, 0x8a, 0x81, 0x8f, 0x8a, 0x84, 0x8f, 0x82, 0x89, 0x87, 0x82, 0x8c, 0x86, 0x89, 0x88, 0x85,
+ 0x80, 0x86, 0x8d, 0x81, 0x83, 0x8d, 0x84, 0x8e, 0x8e, 0x80, 0x87, 0x8b, 0x85, 0x83, 0x8b, 0x88,
+ 0x89, 0x84, 0x8e, 0x83, 0x8f, 0x82, 0x85, 0x8c, 0x82, 0x89, 0x88, 0x85, 0x8c, 0x8f, 0x83, 0x8a,
+ 0x87, 0x8b, 0x80, 0x8e, 0x84, 0x81, 0x8a, 0x87, 0x81, 0x86, 0x8d, 0x80, 0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x39, 0x38, 0x35,
+ 0x30, 0x36, 0x3d, 0x31, 0x33, 0x3d, 0x34, 0x3e, 0x3e, 0x30, 0x37, 0x3b, 0x35, 0x33, 0x3b, 0x38,
+ 0x39, 0x34, 0x3e, 0x33, 0x3f, 0x32, 0x35, 0x3c, 0x32, 0x39, 0x38, 0x35, 0x3c, 0x3f, 0x33, 0x3a,
+ 0x37, 0x3b, 0x30, 0x3e, 0x34, 0x31, 0x3a, 0x37, 0x31, 0x36, 0x3d, 0x30, 0x3b, 0x38, 0x36, 0x3d,
+ 0x0c, 0x0a, 0x01, 0x0f, 0x0a, 0x04, 0x0f, 0x02, 0x09, 0x07, 0x02, 0x0c, 0x06, 0x09, 0x08, 0x05,
+ 0x00, 0x06, 0x0d, 0x01, 0x03, 0x0d, 0x04, 0x0e, 0x0e, 0x00, 0x07, 0x0b, 0x05, 0x03, 0x0b, 0x08,
+ 0x09, 0x04, 0x0e, 0x03, 0x0f, 0x02, 0x05, 0x0c, 0x02, 0x09, 0x08, 0x05, 0x0c, 0x0f, 0x03, 0x0a,
+ 0x07, 0x0b, 0x00, 0x0e, 0x04, 0x01, 0x0a, 0x07, 0x01, 0x06, 0x0d, 0x00, 0x0b, 0x08, 0x06, 0x0d,
+ 0x9c, 0x9a, 0x91, 0x9f, 0x9a, 0x94, 0x9f, 0x92, 0x99, 0x97, 0x92, 0x9c, 0x96, 0x99, 0x98, 0x95,
+ 0x90, 0x96, 0x9d, 0x91, 0x93, 0x9d, 0x94, 0x9e, 0x9e, 0x90, 0x97, 0x9b, 0x95, 0x93, 0x9b, 0x98,
+ 0x99, 0x94, 0x9e, 0x93, 0x9f, 0x92, 0x95, 0x9c, 0x92, 0x99, 0x98, 0x95, 0x9c, 0x9f, 0x93, 0x9a,
+ 0x97, 0x9b, 0x90, 0x9e, 0x94, 0x91, 0x9a, 0x97, 0x91, 0x96, 0x9d, 0x90, 0x9b, 0x98, 0x96, 0x9d,
+ 0xec, 0xea, 0xe1, 0xef, 0xea, 0x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0a, 0x01, 0x0f, 0x0a, 0x04, 0x0f, 0x02, 0x09, 0x07, 0x02, 0x0c, 0x06, 0x09, 0x08, 0x05,
+ 0x00, 0x06, 0x0d, 0x01, 0x03, 0x0d, 0x04, 0x0e, 0x0e, 0x00, 0x07, 0x0b, 0x05, 0x03, 0x0b, 0x08,
+ 0x09, 0x04, 0x0e, 0x03, 0x0f, 0x02, 0x05, 0x0c, 0x02, 0x09, 0x08, 0x05, 0x0c, 0x0f, 0x03, 0x0a,
+ 0x07, 0x0b, 0x00, 0x0e, 0x04, 0x01, 0x0a, 0x07, 0x01, 0x06, 0x0d, 0x00, 0x0b, 0x08, 0x06, 0x0d,
+ 0x5c, 0x5a, 0x51, 0x5f, 0x5a, 0x54, 0x5f, 0x52, 0x59, 0x57, 0x52, 0x5c, 0x56, 0x59, 0x58, 0x55,
+ 0x50, 0x56, 0x5d, 0x51, 0x53, 0x5d, 0x54, 0x5e, 0x5e, 0x50, 0x57, 0x5b, 0x55, 0x53, 0x5b, 0x58,
+ 0x59, 0x54, 0x5e, 0x53, 0x5f, 0x52, 0x55, 0x5c, 0x52, 0x59, 0x58, 0x55, 0x5c, 0x5f, 0x53, 0x5a,
+ 0x57, 0x5b, 0x50, 0x5e, 0x54, 0x51, 0x5a, 0x57, 0x51, 0x56, 0x5d, 0x50, 0x5b, 0x58, 0x56, 0x5d,
+ 0x9c, 0x9a, 0x91, 0x9f, 0x9a, 0x94, 0x9f, 0x92, 0x99, 0x97, 0x92, 0x9c, 0x96, 0x99, 0x98, 0x95,
+ 0x90, 0x96, 0x9d, 0x91, 0x93, 0x9d, 0x94, 0x9e, 0x9e, 0x90, 0x97, 0x9b, 0x95, 0x93, 0x9b, 0x98,
+ 0x99, 0x94, 0x9e, 0x93, 0x9f, 0x92, 0x95, 0x9c, 0x92, 0x99, 0x98, 0x95, 0x9c, 0x9f, 0x93, 0x9a,
+ 0x97, 0x9b, 0x90, 0x9e, 0x94, 0x91, 0x9a, 0x97, 0x91, 0x96, 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 0x33, 0x3a,
+ 0x37, 0x3b, 0x30, 0x3e, 0x34, 0x31, 0x3a, 0x37, 0x31, 0x36, 0x3d, 0x30, 0x3b, 0x38, 0x36, 0x3d,
+ 0x4c, 0x4a, 0x41, 0x4f, 0x4a, 0x44, 0x4f, 0x42, 0x49, 0x47, 0x42, 0x4c, 0x46, 0x49, 0x48, 0x45,
+ 0x40, 0x46, 0x4d, 0x41, 0x43, 0x4d, 0x44, 0x4e, 0x4e, 0x40, 0x47, 0x4b, 0x45, 0x43, 0x4b, 0x48,
+ 0x49, 0x44, 0x4e, 0x43, 0x4f, 0x42, 0x45, 0x4c, 0x42, 0x49, 0x48, 0x45, 0x4c, 0x4f, 0x43, 0x4a,
+ 0x47, 0x4b, 0x40, 0x4e, 0x44, 0x41, 0x4a, 0x47, 0x41, 0x46, 0x4d, 0x40, 0x4b, 0x48, 0x46, 0x4d,
+ 0x0c, 0x0a, 0x01, 0x0f, 0x0a, 0x04, 0x0f, 0x02, 0x09, 0x07, 0x02, 0x0c, 0x06, 0x09, 0x08, 0x05,
+ 0x00, 0x06, 0x0d, 0x01, 0x03, 0x0d, 0x04, 0x0e, 0x0e, 0x00, 0x07, 0x0b, 0x05, 0x03, 0x0b, 0x08,
+ 0x09, 0x04, 0x0e, 0x03, 0x0f, 0x02, 0x05, 0x0c, 0x02, 0x09, 0x08, 0x05, 0x0c, 0x0f, 0x03, 0x0a,
+ 0x07, 0x0b, 0x00, 0x0e, 0x04, 0x01, 0x0a, 0x07, 0x01, 0x06, 0x0d, 0x00, 0x0b, 0x08, 0x06, 0x0d,
+ 0x5c, 0x5a, 0x51, 0x5f, 0x5a, 0x54, 0x5f, 0x52, 0x59, 0x57, 0x52, 0x5c, 0x56, 0x59, 0x58, 0x55,
+ 0x50, 0x56, 0x5d, 0x51, 0x53, 0x5d, 0x54, 0x5e, 0x5e, 0x50, 0x57, 0x5b, 0x55, 0x53, 0x5b, 0x58,
+ 0x59, 0x54, 0x5e, 0x53, 0x5f, 0x52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3f, 0x36, 0x3c, 0x3a, 0x39, 0x3d, 0x30, 0x3f, 0x33, 0x33, 0x35, 0x35, 0x36, 0x38, 0x3b,
+ 0x9d, 0x91, 0x92, 0x9f, 0x98, 0x9d, 0x94, 0x98, 0x96, 0x9a, 0x9f, 0x93, 0x9b, 0x97, 0x91, 0x94,
+ 0x9a, 0x9c, 0x99, 0x95, 0x93, 0x96, 0x9e, 0x9b, 0x95, 0x90, 0x90, 0x9e, 0x9c, 0x99, 0x97, 0x92,
+ 0x97, 0x92, 0x9b, 0x91, 0x94, 0x9e, 0x91, 0x97, 0x99, 0x94, 0x9c, 0x9a, 0x9e, 0x98, 0x92, 0x9d,
+ 0x90, 0x9f, 0x96, 0x9c, 0x9a, 0x99, 0x9d, 0x90, 0x9f, 0x93, 0x93, 0x95, 0x95, 0x96, 0x98, 0x9b,
+ 0x5d, 0x51, 0x52, 0x5f, 0x58, 0x5d, 0x54, 0x58, 0x56, 0x5a, 0x5f, 0x53, 0x5b, 0x57, 0x51, 0x54,
+ 0x5a, 0x5c, 0x59, 0x55, 0x53, 0x56, 0x5e, 0x5b, 0x55, 0x50, 0x50, 0x5e, 0x5c, 0x59, 0x57, 0x52,
+ 0x57, 0x52, 0x5b, 0x51, 0x54, 0x5e, 0x51, 0x57, 0x59, 0x54, 0x5c, 0x5a, 0x5e, 0x58, 0x52, 0x5d,
+ 0x50, 0x5f, 0x56, 0x5c, 0x5a, 0x59, 0x5d, 0x50, 0x5f, 0x53, 0x53, 0x55, 0x55, 0x56, 0x58, 0x5b,
+ 0x7d, 0x71, 0x72, 0x7f, 0x78, 0x7d, 0x74, 0x78, 0x76, 0x7a, 0x7f, 0x73, 0x7b, 0x77, 0x71, 0x74,
+ 0x7a, 0x7c, 0x79, 0x75, 0x73, 0x76, 0x7e, 0x7b, 0x75, 0x70, 0x70, 0x7e, 0x7c, 0x79, 0x77, 0x72,
+ 0x77, 0x72, 0x7b, 0x71, 0x74, 0x7e, 0x71, 0x77, 0x79, 0x74, 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0x61, 0x62, 0x6f, 0x68, 0x6d, 0x64, 0x68, 0x66, 0x6a, 0x6f, 0x63, 0x6b, 0x67, 0x61, 0x64,
+ 0x6a, 0x6c, 0x69, 0x65, 0x63, 0x66, 0x6e, 0x6b, 0x65, 0x60, 0x60, 0x6e, 0x6c, 0x69, 0x67, 0x62,
+ 0x67, 0x62, 0x6b, 0x61, 0x64, 0x6e, 0x61, 0x67, 0x69, 0x64, 0x6c, 0x6a, 0x6e, 0x68, 0x62, 0x6d,
+ 0x60, 0x6f, 0x66, 0x6c, 0x6a, 0x69, 0x6d, 0x60, 0x6f, 0x63, 0x63, 0x65, 0x65, 0x66, 0x68, 0x6b,
+ 0x1d, 0x11, 0x12, 0x1f, 0x18, 0x1d, 0x14, 0x18, 0x16, 0x1a, 0x1f, 0x13, 0x1b, 0x17, 0x11, 0x14,
+ 0x1a, 0x1c, 0x19, 0x15, 0x13, 0x16, 0x1e, 0x1b, 0x15, 0x10, 0x10, 0x1e, 0x1c, 0x19, 0x17, 0x12,
+ 0x17, 0x12, 0x1b, 0x11, 0x14, 0x1e, 0x11, 0x17, 0x19, 0x14, 0x1c, 0x1a, 0x1e, 0x18, 0x12, 0x1d,
+ 0x10, 0x1f, 0x16, 0x1c, 0x1a, 0x19, 0x1d, 0x10, 0x1f, 0x13, 0x13, 0x15, 0x15, 0x16, 0x18, 0x1b,
+ 0x6d, 0x61, 0x62, 0x6f, 0x68, 0x6d, 0x64, 0x68, 0x66, 0x6a, 0x6f, 0x63, 0x6b, 0x67, 0x61, 0x64,
+ 0x6a, 0x6c, 0x69, 0x65, 0x63, 0x66, 0x6e, 0x6b, 0x65, 0x60, 0x60, 0x6e, 0x6c, 0x69, 0x67, 0x62,
+ 0x67, 0x62, 0x6b, 0x61, 0x64, 0x6e, 0x61, 0x67, 0x69, 0x64, 0x6c, 0x6a, 0x6e, 0x68, 0x62, 0x6d,
+ 0x60, 0x6f, 0x66, 0x6c, 0x6a, 0x69, 0x6d, 0x60, 0x6f, 0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3f, 0x38, 0x3d, 0x34, 0x38, 0x36, 0x3a, 0x3f, 0x33, 0x3b, 0x37, 0x31, 0x34,
+ 0x3a, 0x3c, 0x39, 0x35, 0x33, 0x36, 0x3e, 0x3b, 0x35, 0x30, 0x30, 0x3e, 0x3c, 0x39, 0x37, 0x32,
+ 0x37, 0x32, 0x3b, 0x31, 0x34, 0x3e, 0x31, 0x37, 0x39, 0x34, 0x3c, 0x3a, 0x3e, 0x38, 0x32, 0x3d,
+ 0x30, 0x3f, 0x36, 0x3c, 0x3a, 0x39, 0x3d, 0x30, 0x3f, 0x33, 0x33, 0x35, 0x35, 0x36, 0x38, 0x3b,
+ 0x4d, 0x41, 0x42, 0x4f, 0x48, 0x4d, 0x44, 0x48, 0x46, 0x4a, 0x4f, 0x43, 0x4b, 0x47, 0x41, 0x44,
+ 0x4a, 0x4c, 0x49, 0x45, 0x43, 0x46, 0x4e, 0x4b, 0x45, 0x40, 0x40, 0x4e, 0x4c, 0x49, 0x47, 0x42,
+ 0x47, 0x42, 0x4b, 0x41, 0x44, 0x4e, 0x41, 0x47, 0x49, 0x44, 0x4c, 0x4a, 0x4e, 0x48, 0x42, 0x4d,
+ 0x40, 0x4f, 0x46, 0x4c, 0x4a, 0x49, 0x4d, 0x40, 0x4f, 0x43, 0x43, 0x45, 0x45, 0x46, 0x48, 0x4b,
+ 0x7d, 0x71, 0x72, 0x7f, 0x78, 0x7d, 0x74, 0x78, 0x76, 0x7a, 0x7f, 0x73, 0x7b, 0x77, 0x71, 0x74,
+ 0x7a, 0x7c, 0x79, 0x75, 0x73, 0x76, 0x7e, 0x7b, 0x75, 0x70, 0x70, 0x7e, 0x7c, 0x79, 0x77, 0x72,
+ 0x77, 0x72, 0x7b, 0x71, 0x74, 0x7e, 0x71, 0x77, 0x79, 0x74, 0x7c, 0x7a, 0x7e, 0x78, 0x72, 0x7d,
+ 0x70, 0x7f, 0x76, 0x7c, 0x7a, 0x79, 0x7d, 0x70, 0x7f, 0x73, 0x73, 0x75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0x50, 0x5f, 0x53, 0x53, 0x55, 0x55, 0x56, 0x58, 0x5b,
+ 0x2d, 0x21, 0x22, 0x2f, 0x28, 0x2d, 0x24, 0x28, 0x26, 0x2a, 0x2f, 0x23, 0x2b, 0x27, 0x21, 0x24,
+ 0x2a, 0x2c, 0x29, 0x25, 0x23, 0x26, 0x2e, 0x2b, 0x25, 0x20, 0x20, 0x2e, 0x2c, 0x29, 0x27, 0x22,
+ 0x27, 0x22, 0x2b, 0x21, 0x24, 0x2e, 0x21, 0x27, 0x29, 0x24, 0x2c, 0x2a, 0x2e, 0x28, 0x22, 0x2d,
+ 0x20, 0x2f, 0x26, 0x2c, 0x2a, 0x29, 0x2d, 0x20, 0x2f, 0x23, 0x23, 0x25, 0x25, 0x26, 0x28, 0x2b,
+ 0x9d, 0x91, 0x92, 0x9f, 0x98, 0x9d, 0x94, 0x98, 0x96, 0x9a, 0x9f, 0x93, 0x9b, 0x97, 0x91, 0x94,
+ 0x9a, 0x9c, 0x99, 0x95, 0x93, 0x96, 0x9e, 0x9b, 0x95, 0x90, 0x90, 0x9e, 0x9c, 0x99, 0x97, 0x92,
+ 0x97, 0x92, 0x9b, 0x91, 0x94, 0x9e, 0x91, 0x97, 0x99, 0x94, 0x9c, 0x9a, 0x9e, 0x98, 0x92, 0x9d,
+ 0x90, 0x9f, 0x96, 0x9c, 0x9a, 0x99, 0x9d, 0x90, 0x9f, 0x93, 0x93, 0x95, 0x95, 0x96, 0x98, 0x9b,
+ 0x3d, 0x31, 0x32, 0x3f, 0x38, 0x3d, 0x34, 0x38, 0x36, 0x3a, 0x3f, 0x33, 0x3b, 0x37, 0x31, 0x34,
+ 0x3a, 0x3c, 0x39, 0x35, 0x33, 0x36, 0x3e, 0x3b, 0x35, 0x30, 0x30, 0x3e, 0x3c, 0x39, 0x37, 0x32,
+ 0x37, 0x32, 0x3b, 0x31, 0x34, 0x3e, 0x31, 0x37, 0x39, 0x34, 0x3c, 0x3a, 0x3e, 0x38, 0x32, 0x3d,
+ 0x30, 0x3f, 0x36, 0x3c, 0x3a, 0x39, 0x3d, 0x30, 0x3f, 0x33, 0x33, 0x35, 0x35, 0x36, 0x38, 0x3b,
+ 0x2d, 0x21, 0x22, 0x2f, 0x28, 0x2d, 0x24, 0x28, 0x26, 0x2a, 0x2f, 0x23, 0x2b, 0x27, 0x21, 0x24,
+ 0x2a, 0x2c, 0x29, 0x25, 0x23, 0x26, 0x2e, 0x2b, 0x25, 0x20, 0x20, 0x2e, 0x2c, 0x29, 0x27, 0x22,
+ 0x27, 0x22, 0x2b, 0x21, 0x24, 0x2e, 0x21, 0x27, 0x29, 0x24, 0x2c, 0x2a, 0x2e, 0x28, 0x22, 0x2d,
+ 0x20, 0x2f, 0x26, 0x2c, 0x2a, 0x29, 0x2d, 0x20, 0x2f, 0x23, 0x23, 0x25, 0x25, 0x26, 0x28, 0x2b,
+ 0xcd, 0xc1, 0xc2, 0xcf, 0xc8, 0xcd, 0xc4, 0xc8, 0xc6, 0xca, 0xcf, 0xc3, 0xcb, 0xc7, 0xc1, 0xc4,
+ 0xca, 0xcc, 0xc9, 0xc5, 0xc3, 0xc6, 0xce, 0xcb, 0xc5, 0xc0, 0xc0, 0xce, 0xcc, 0xc9, 0xc7, 0xc2,
+ 0xc7, 0xc2, 0xcb, 0xc1, 0xc4, 0xce, 0xc1, 0xc7, 0xc9, 0xc4, 0xcc, 0xca, 0xce, 0xc8, 0xc2, 0xcd,
+ 0xc0, 0xcf, 0xc6, 0xcc, 0xca, 0xc9, 0xcd, 0xc0, 0xcf, 0xc3, 0xc3, 0xc5, 0xc5, 0xc6, 0xc8, 0xcb,
+ }
+};
+static const u_int32_t psbox[4][256] = {
+ {
+ 0x00000000, 0x00004000, 0x40000000, 0x40004000,
+ 0x00000010, 0x00004010, 0x40000010, 0x40004010,
+ 0x00080000, 0x00084000, 0x40080000, 0x40084000,
+ 0x00080010, 0x00084010, 0x40080010, 0x40084010,
+ 0x00000002, 0x00004002, 0x40000002, 0x40004002,
+ 0x00000012, 0x00004012, 0x40000012, 0x40004012,
+ 0x00080002, 0x00084002, 0x40080002, 0x40084002,
+ 0x00080012, 0x00084012, 0x40080012, 0x40084012,
+ 0x00000200, 0x00004200, 0x40000200, 0x40004200,
+ 0x00000210, 0x00004210, 0x40000210, 0x40004210,
+ 0x00080200, 0x00084200, 0x40080200, 0x40084200,
+ 0x00080210, 0x00084210, 0x40080210, 0x40084210,
+ 0x00000202, 0x00004202, 0x40000202, 0x40004202,
+ 0x00000212, 0x00004212, 0x40000212, 0x40004212,
+ 0x00080202, 0x00084202, 0x40080202, 0x40084202,
+ 0x00080212, 0x00084212, 0x40080212, 0x40084212,
+ 0x00008000, 0x0000c000, 0x40008000, 0x4000c000,
+ 0x00008010, 0x0000c010, 0x40008010, 0x4000c010,
+ 0x00088000, 0x0008c000, 0x40088000, 0x4008c000,
+ 0x00088010, 0x0008c010, 0x40088010, 0x4008c010,
+ 0x00008002, 0x0000c002, 0x40008002, 0x4000c002,
+ 0x00008012, 0x0000c012, 0x40008012, 0x4000c012,
+ 0x00088002, 0x0008c002, 0x40088002, 0x4008c002,
+ 0x00088012, 0x0008c012, 0x40088012, 0x4008c012,
+ 0x00008200, 0x0000c200, 0x40008200, 0x4000c200,
+ 0x00008210, 0x0000c210, 0x40008210, 0x4000c210,
+ 0x00088200, 0x0008c200, 0x40088200, 0x4008c200,
+ 0x00088210, 0x0008c210, 0x40088210, 0x4008c210,
+ 0x00008202, 0x0000c202, 0x40008202, 0x4000c202,
+ 0x00008212, 0x0000c212, 0x40008212, 0x4000c212,
+ 0x00088202, 0x0008c202, 0x40088202, 0x4008c202,
+ 0x00088212, 0x0008c212, 0x40088212, 0x4008c212,
+ 0x00800000, 0x00804000, 0x40800000, 0x40804000,
+ 0x00800010, 0x00804010, 0x40800010, 0x40804010,
+ 0x00880000, 0x00884000, 0x40880000, 0x40884000,
+ 0x00880010, 0x00884010, 0x40880010, 0x40884010,
+ 0x00800002, 0x00804002, 0x40800002, 0x40804002,
+ 0x00800012, 0x00804012, 0x40800012, 0x40804012,
+ 0x00880002, 0x00884002, 0x40880002, 0x40884002,
+ 0x00880012, 0x00884012, 0x40880012, 0x40884012,
+ 0x00800200, 0x00804200, 0x40800200, 0x40804200,
+ 0x00800210, 0x00804210, 0x40800210, 0x40804210,
+ 0x00880200, 0x00884200, 0x40880200, 0x40884200,
+ 0x00880210, 0x00884210, 0x40880210, 0x40884210,
+ 0x00800202, 0x00804202, 0x40800202, 0x40804202,
+ 0x00800212, 0x00804212, 0x40800212, 0x40804212,
+ 0x00880202, 0x00884202, 0x40880202, 0x40884202,
+ 0x00880212, 0x00884212, 0x40880212, 0x40884212,
+ 0x00808000, 0x0080c000, 0x40808000, 0x4080c000,
+ 0x00808010, 0x0080c010, 0x40808010, 0x4080c010,
+ 0x00888000, 0x0088c000, 0x40888000, 0x4088c000,
+ 0x00888010, 0x0088c010, 0x40888010, 0x4088c010,
+ 0x00808002, 0x0080c002, 0x40808002, 0x4080c002,
+ 0x00808012, 0x0080c012, 0x40808012, 0x4080c012,
+ 0x00888002, 0x0088c002, 0x40888002, 0x4088c002,
+ 0x00888012, 0x0088c012, 0x40888012, 0x4088c012,
+ 0x00808200, 0x0080c200, 0x40808200, 0x4080c200,
+ 0x00808210, 0x0080c210, 0x40808210, 0x4080c210,
+ 0x00888200, 0x0088c200, 0x40888200, 0x4088c200,
+ 0x00888210, 0x0088c210, 0x40888210, 0x4088c210,
+ 0x00808202, 0x0080c202, 0x40808202, 0x4080c202,
+ 0x00808212, 0x0080c212, 0x40808212, 0x4080c212,
+ 0x00888202, 0x0088c202, 0x40888202, 0x4088c202,
+ 0x00888212, 0x0088c212, 0x40888212, 0x4088c212,
+ }, {
+ 0x00000000, 0x80000000, 0x00400000, 0x80400000,
+ 0x00001000, 0x80001000, 0x00401000, 0x80401000,
+ 0x00000040, 0x80000040, 0x00400040, 0x80400040,
+ 0x00001040, 0x80001040, 0x00401040, 0x80401040,
+ 0x04000000, 0x84000000, 0x04400000, 0x84400000,
+ 0x04001000, 0x84001000, 0x04401000, 0x84401000,
+ 0x04000040, 0x84000040, 0x04400040, 0x84400040,
+ 0x04001040, 0x84001040, 0x04401040, 0x84401040,
+ 0x00000004, 0x80000004, 0x00400004, 0x80400004,
+ 0x00001004, 0x80001004, 0x00401004, 0x80401004,
+ 0x00000044, 0x80000044, 0x00400044, 0x80400044,
+ 0x00001044, 0x80001044, 0x00401044, 0x80401044,
+ 0x04000004, 0x84000004, 0x04400004, 0x84400004,
+ 0x04001004, 0x84001004, 0x04401004, 0x84401004,
+ 0x04000044, 0x84000044, 0x04400044, 0x84400044,
+ 0x04001044, 0x84001044, 0x04401044, 0x84401044,
+ 0x00010000, 0x80010000, 0x00410000, 0x80410000,
+ 0x00011000, 0x80011000, 0x00411000, 0x80411000,
+ 0x00010040, 0x80010040, 0x00410040, 0x80410040,
+ 0x00011040, 0x80011040, 0x00411040, 0x80411040,
+ 0x04010000, 0x84010000, 0x04410000, 0x84410000,
+ 0x04011000, 0x84011000, 0x04411000, 0x84411000,
+ 0x04010040, 0x84010040, 0x04410040, 0x84410040,
+ 0x04011040, 0x84011040, 0x04411040, 0x84411040,
+ 0x00010004, 0x80010004, 0x00410004, 0x80410004,
+ 0x00011004, 0x80011004, 0x00411004, 0x80411004,
+ 0x00010044, 0x80010044, 0x00410044, 0x80410044,
+ 0x00011044, 0x80011044, 0x00411044, 0x80411044,
+ 0x04010004, 0x84010004, 0x04410004, 0x84410004,
+ 0x04011004, 0x84011004, 0x04411004, 0x84411004,
+ 0x04010044, 0x84010044, 0x04410044, 0x84410044,
+ 0x04011044, 0x84011044, 0x04411044, 0x84411044,
+ 0x00000100, 0x80000100, 0x00400100, 0x80400100,
+ 0x00001100, 0x80001100, 0x00401100, 0x80401100,
+ 0x00000140, 0x80000140, 0x00400140, 0x80400140,
+ 0x00001140, 0x80001140, 0x00401140, 0x80401140,
+ 0x04000100, 0x84000100, 0x04400100, 0x84400100,
+ 0x04001100, 0x84001100, 0x04401100, 0x84401100,
+ 0x04000140, 0x84000140, 0x04400140, 0x84400140,
+ 0x04001140, 0x84001140, 0x04401140, 0x84401140,
+ 0x00000104, 0x80000104, 0x00400104, 0x80400104,
+ 0x00001104, 0x80001104, 0x00401104, 0x80401104,
+ 0x00000144, 0x80000144, 0x00400144, 0x80400144,
+ 0x00001144, 0x80001144, 0x00401144, 0x80401144,
+ 0x04000104, 0x84000104, 0x04400104, 0x84400104,
+ 0x04001104, 0x84001104, 0x04401104, 0x84401104,
+ 0x04000144, 0x84000144, 0x04400144, 0x84400144,
+ 0x04001144, 0x84001144, 0x04401144, 0x84401144,
+ 0x00010100, 0x80010100, 0x00410100, 0x80410100,
+ 0x00011100, 0x80011100, 0x00411100, 0x80411100,
+ 0x00010140, 0x80010140, 0x00410140, 0x80410140,
+ 0x00011140, 0x80011140, 0x00411140, 0x80411140,
+ 0x04010100, 0x84010100, 0x04410100, 0x84410100,
+ 0x04011100, 0x84011100, 0x04411100, 0x84411100,
+ 0x04010140, 0x84010140, 0x04410140, 0x84410140,
+ 0x04011140, 0x84011140, 0x04411140, 0x84411140,
+ 0x00010104, 0x80010104, 0x00410104, 0x80410104,
+ 0x00011104, 0x80011104, 0x00411104, 0x80411104,
+ 0x00010144, 0x80010144, 0x00410144, 0x80410144,
+ 0x00011144, 0x80011144, 0x00411144, 0x80411144,
+ 0x04010104, 0x84010104, 0x04410104, 0x84410104,
+ 0x04011104, 0x84011104, 0x04411104, 0x84411104,
+ 0x04010144, 0x84010144, 0x04410144, 0x84410144,
+ 0x04011144, 0x84011144, 0x04411144, 0x84411144,
+ }, {
+ 0x00000000, 0x00002000, 0x00200000, 0x00202000,
+ 0x00000008, 0x00002008, 0x00200008, 0x00202008,
+ 0x10000000, 0x10002000, 0x10200000, 0x10202000,
+ 0x10000008, 0x10002008, 0x10200008, 0x10202008,
+ 0x20000000, 0x20002000, 0x20200000, 0x20202000,
+ 0x20000008, 0x20002008, 0x20200008, 0x20202008,
+ 0x30000000, 0x30002000, 0x30200000, 0x30202000,
+ 0x30000008, 0x30002008, 0x30200008, 0x30202008,
+ 0x00000080, 0x00002080, 0x00200080, 0x00202080,
+ 0x00000088, 0x00002088, 0x00200088, 0x00202088,
+ 0x10000080, 0x10002080, 0x10200080, 0x10202080,
+ 0x10000088, 0x10002088, 0x10200088, 0x10202088,
+ 0x20000080, 0x20002080, 0x20200080, 0x20202080,
+ 0x20000088, 0x20002088, 0x20200088, 0x20202088,
+ 0x30000080, 0x30002080, 0x30200080, 0x30202080,
+ 0x30000088, 0x30002088, 0x30200088, 0x30202088,
+ 0x00040000, 0x00042000, 0x00240000, 0x00242000,
+ 0x00040008, 0x00042008, 0x00240008, 0x00242008,
+ 0x10040000, 0x10042000, 0x10240000, 0x10242000,
+ 0x10040008, 0x10042008, 0x10240008, 0x10242008,
+ 0x20040000, 0x20042000, 0x20240000, 0x20242000,
+ 0x20040008, 0x20042008, 0x20240008, 0x20242008,
+ 0x30040000, 0x30042000, 0x30240000, 0x30242000,
+ 0x30040008, 0x30042008, 0x30240008, 0x30242008,
+ 0x00040080, 0x00042080, 0x00240080, 0x00242080,
+ 0x00040088, 0x00042088, 0x00240088, 0x00242088,
+ 0x10040080, 0x10042080, 0x10240080, 0x10242080,
+ 0x10040088, 0x10042088, 0x10240088, 0x10242088,
+ 0x20040080, 0x20042080, 0x20240080, 0x20242080,
+ 0x20040088, 0x20042088, 0x20240088, 0x20242088,
+ 0x30040080, 0x30042080, 0x30240080, 0x30242080,
+ 0x30040088, 0x30042088, 0x30240088, 0x30242088,
+ 0x01000000, 0x01002000, 0x01200000, 0x01202000,
+ 0x01000008, 0x01002008, 0x01200008, 0x01202008,
+ 0x11000000, 0x11002000, 0x11200000, 0x11202000,
+ 0x11000008, 0x11002008, 0x11200008, 0x11202008,
+ 0x21000000, 0x21002000, 0x21200000, 0x21202000,
+ 0x21000008, 0x21002008, 0x21200008, 0x21202008,
+ 0x31000000, 0x31002000, 0x31200000, 0x31202000,
+ 0x31000008, 0x31002008, 0x31200008, 0x31202008,
+ 0x01000080, 0x01002080, 0x01200080, 0x01202080,
+ 0x01000088, 0x01002088, 0x01200088, 0x01202088,
+ 0x11000080, 0x11002080, 0x11200080, 0x11202080,
+ 0x11000088, 0x11002088, 0x11200088, 0x11202088,
+ 0x21000080, 0x21002080, 0x21200080, 0x21202080,
+ 0x21000088, 0x21002088, 0x21200088, 0x21202088,
+ 0x31000080, 0x31002080, 0x31200080, 0x31202080,
+ 0x31000088, 0x31002088, 0x31200088, 0x31202088,
+ 0x01040000, 0x01042000, 0x01240000, 0x01242000,
+ 0x01040008, 0x01042008, 0x01240008, 0x01242008,
+ 0x11040000, 0x11042000, 0x11240000, 0x11242000,
+ 0x11040008, 0x11042008, 0x11240008, 0x11242008,
+ 0x21040000, 0x21042000, 0x21240000, 0x21242000,
+ 0x21040008, 0x21042008, 0x21240008, 0x21242008,
+ 0x31040000, 0x31042000, 0x31240000, 0x31242000,
+ 0x31040008, 0x31042008, 0x31240008, 0x31242008,
+ 0x01040080, 0x01042080, 0x01240080, 0x01242080,
+ 0x01040088, 0x01042088, 0x01240088, 0x01242088,
+ 0x11040080, 0x11042080, 0x11240080, 0x11242080,
+ 0x11040088, 0x11042088, 0x11240088, 0x11242088,
+ 0x21040080, 0x21042080, 0x21240080, 0x21242080,
+ 0x21040088, 0x21042088, 0x21240088, 0x21242088,
+ 0x31040080, 0x31042080, 0x31240080, 0x31242080,
+ 0x31040088, 0x31042088, 0x31240088, 0x31242088,
+ }, {
+ 0x00000000, 0x00000800, 0x00020000, 0x00020800,
+ 0x00000020, 0x00000820, 0x00020020, 0x00020820,
+ 0x08000000, 0x08000800, 0x08020000, 0x08020800,
+ 0x08000020, 0x08000820, 0x08020020, 0x08020820,
+ 0x02000000, 0x02000800, 0x02020000, 0x02020800,
+ 0x02000020, 0x02000820, 0x02020020, 0x02020820,
+ 0x0a000000, 0x0a000800, 0x0a020000, 0x0a020800,
+ 0x0a000020, 0x0a000820, 0x0a020020, 0x0a020820,
+ 0x00000400, 0x00000c00, 0x00020400, 0x00020c00,
+ 0x00000420, 0x00000c20, 0x00020420, 0x00020c20,
+ 0x08000400, 0x08000c00, 0x08020400, 0x08020c00,
+ 0x08000420, 0x08000c20, 0x08020420, 0x08020c20,
+ 0x02000400, 0x02000c00, 0x02020400, 0x02020c00,
+ 0x02000420, 0x02000c20, 0x02020420, 0x02020c20,
+ 0x0a000400, 0x0a000c00, 0x0a020400, 0x0a020c00,
+ 0x0a000420, 0x0a000c20, 0x0a020420, 0x0a020c20,
+ 0x00100000, 0x00100800, 0x00120000, 0x00120800,
+ 0x00100020, 0x00100820, 0x00120020, 0x00120820,
+ 0x08100000, 0x08100800, 0x08120000, 0x08120800,
+ 0x08100020, 0x08100820, 0x08120020, 0x08120820,
+ 0x02100000, 0x02100800, 0x02120000, 0x02120800,
+ 0x02100020, 0x02100820, 0x02120020, 0x02120820,
+ 0x0a100000, 0x0a100800, 0x0a120000, 0x0a120800,
+ 0x0a100020, 0x0a100820, 0x0a120020, 0x0a120820,
+ 0x00100400, 0x00100c00, 0x00120400, 0x00120c00,
+ 0x00100420, 0x00100c20, 0x00120420, 0x00120c20,
+ 0x08100400, 0x08100c00, 0x08120400, 0x08120c00,
+ 0x08100420, 0x08100c20, 0x08120420, 0x08120c20,
+ 0x02100400, 0x02100c00, 0x02120400, 0x02120c00,
+ 0x02100420, 0x02100c20, 0x02120420, 0x02120c20,
+ 0x0a100400, 0x0a100c00, 0x0a120400, 0x0a120c00,
+ 0x0a100420, 0x0a100c20, 0x0a120420, 0x0a120c20,
+ 0x00000001, 0x00000801, 0x00020001, 0x00020801,
+ 0x00000021, 0x00000821, 0x00020021, 0x00020821,
+ 0x08000001, 0x08000801, 0x08020001, 0x08020801,
+ 0x08000021, 0x08000821, 0x08020021, 0x08020821,
+ 0x02000001, 0x02000801, 0x02020001, 0x02020801,
+ 0x02000021, 0x02000821, 0x02020021, 0x02020821,
+ 0x0a000001, 0x0a000801, 0x0a020001, 0x0a020801,
+ 0x0a000021, 0x0a000821, 0x0a020021, 0x0a020821,
+ 0x00000401, 0x00000c01, 0x00020401, 0x00020c01,
+ 0x00000421, 0x00000c21, 0x00020421, 0x00020c21,
+ 0x08000401, 0x08000c01, 0x08020401, 0x08020c01,
+ 0x08000421, 0x08000c21, 0x08020421, 0x08020c21,
+ 0x02000401, 0x02000c01, 0x02020401, 0x02020c01,
+ 0x02000421, 0x02000c21, 0x02020421, 0x02020c21,
+ 0x0a000401, 0x0a000c01, 0x0a020401, 0x0a020c01,
+ 0x0a000421, 0x0a000c21, 0x0a020421, 0x0a020c21,
+ 0x00100001, 0x00100801, 0x00120001, 0x00120801,
+ 0x00100021, 0x00100821, 0x00120021, 0x00120821,
+ 0x08100001, 0x08100801, 0x08120001, 0x08120801,
+ 0x08100021, 0x08100821, 0x08120021, 0x08120821,
+ 0x02100001, 0x02100801, 0x02120001, 0x02120801,
+ 0x02100021, 0x02100821, 0x02120021, 0x02120821,
+ 0x0a100001, 0x0a100801, 0x0a120001, 0x0a120801,
+ 0x0a100021, 0x0a100821, 0x0a120021, 0x0a120821,
+ 0x00100401, 0x00100c01, 0x00120401, 0x00120c01,
+ 0x00100421, 0x00100c21, 0x00120421, 0x00120c21,
+ 0x08100401, 0x08100c01, 0x08120401, 0x08120c01,
+ 0x08100421, 0x08100c21, 0x08120421, 0x08120c21,
+ 0x02100401, 0x02100c01, 0x02120401, 0x02120c01,
+ 0x02100421, 0x02100c21, 0x02120421, 0x02120c21,
+ 0x0a100401, 0x0a100c01, 0x0a120401, 0x0a120c01,
+ 0x0a100421, 0x0a100c21, 0x0a120421, 0x0a120c21,
+ }
+};
diff --git a/libcrypt/sha256-crypt.c b/libcrypt/sha256-crypt.c
index 81bbe6ae6..b2ab62e48 100644
--- a/libcrypt/sha256-crypt.c
+++ b/libcrypt/sha256-crypt.c
@@ -104,24 +104,24 @@ __sha256_crypt_r (const char *key,
salt_len = MIN (strcspn (salt, "$"), SALT_LEN_MAX);
key_len = strlen (key);
- if ((key - (char *) 0) % __alignof__ (uint32_t) != 0)
+ if ((uintptr_t)key % __alignof__ (uint32_t) != 0)
{
char *tmp = (char *) alloca (key_len + __alignof__ (uint32_t));
key = copied_key =
memcpy (tmp + __alignof__ (uint32_t)
- - (tmp - (char *) 0) % __alignof__ (uint32_t),
+ - (uintptr_t)tmp % __alignof__ (uint32_t),
key, key_len);
- assert ((key - (char *) 0) % __alignof__ (uint32_t) == 0);
+ assert ((uintptr_t)key % __alignof__ (uint32_t) == 0);
}
- if ((salt - (char *) 0) % __alignof__ (uint32_t) != 0)
+ if ((uintptr_t)salt % __alignof__ (uint32_t) != 0)
{
char *tmp = (char *) alloca (salt_len + __alignof__ (uint32_t));
salt = copied_salt =
memcpy (tmp + __alignof__ (uint32_t)
- - (tmp - (char *) 0) % __alignof__ (uint32_t),
+ - (uintptr_t)tmp % __alignof__ (uint32_t),
salt, salt_len);
- assert ((salt - (char *) 0) % __alignof__ (uint32_t) == 0);
+ assert ((uintptr_t)salt % __alignof__ (uint32_t) == 0);
}
struct sha256_ctx ctx;
diff --git a/libcrypt/sha512-crypt.c b/libcrypt/sha512-crypt.c
index 9d17255aa..b8984d4ab 100644
--- a/libcrypt/sha512-crypt.c
+++ b/libcrypt/sha512-crypt.c
@@ -104,24 +104,24 @@ __sha512_crypt_r (const char *key,
salt_len = MIN (strcspn (salt, "$"), SALT_LEN_MAX);
key_len = strlen (key);
- if ((key - (char *) 0) % __alignof__ (uint64_t) != 0)
+ if ((uintptr_t)key % __alignof__ (uint64_t) != 0)
{
char *tmp = (char *) alloca (key_len + __alignof__ (uint64_t));
key = copied_key =
memcpy (tmp + __alignof__ (uint64_t)
- - (tmp - (char *) 0) % __alignof__ (uint64_t),
+ - (uintptr_t)tmp % __alignof__ (uint64_t),
key, key_len);
assert ((key - (char *) 0) % __alignof__ (uint64_t) == 0);
}
- if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0)
+ if ((uintptr_t)salt % __alignof__ (uint64_t) != 0)
{
char *tmp = (char *) alloca (salt_len + __alignof__ (uint64_t));
salt = copied_salt =
memcpy (tmp + __alignof__ (uint64_t)
- - (tmp - (char *) 0) % __alignof__ (uint64_t),
+ - (uintptr_t)tmp % __alignof__ (uint64_t),
salt, salt_len);
- assert ((salt - (char *) 0) % __alignof__ (uint64_t) == 0);
+ assert ((uintptr_t)salt % __alignof__ (uint64_t) == 0);
}
struct sha512_ctx ctx;
diff --git a/libm/s_lrint.c b/libm/s_lrint.c
index 09800d8de..2a8db9fbe 100644
--- a/libm/s_lrint.c
+++ b/libm/s_lrint.c
@@ -49,19 +49,13 @@ lrint (double x)
if (_j0 < 20)
{
- if (_j0 < -1)
- return 0;
- else
- {
- w = two52[sx] + x;
- t = w - two52[sx];
- EXTRACT_WORDS (i0, i1, t);
- _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
- i0 &= 0xfffff;
- i0 |= 0x100000;
-
- result = i0 >> (20 - _j0);
- }
+ w = two52[sx] + x;
+ t = w - two52[sx];
+ EXTRACT_WORDS (i0, i1, t);
+ _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ i0 &= 0xfffff;
+ i0 |= 0x100000;
+ result = (_j0 < 0 ? 0 : i0 >> (20 - _j0));
}
else if (_j0 < (int32_t) (8 * sizeof (long int)) - 1)
{
diff --git a/libm/s_nextafter.c b/libm/s_nextafter.c
index 73a8ab2be..7eb4ec46e 100644
--- a/libm/s_nextafter.c
+++ b/libm/s_nextafter.c
@@ -18,6 +18,7 @@
#include "math.h"
#include "math_private.h"
+#include <float.h>
double nextafter(double x, double y)
{
@@ -68,5 +69,13 @@ double nextafter(double x, double y)
return x;
}
libm_hidden_def(nextafter)
+#if LDBL_MANT_DIG == DBL_MANT_DIG
strong_alias_untyped(nextafter, nexttoward)
libm_hidden_def(nexttoward)
+#else
+double nexttoward(double x, long double y)
+{
+ return nextafter(x, y);
+}
+libm_hidden_def(nexttoward)
+#endif
diff --git a/libm/w_j0f.c b/libm/w_j0f.c
index 89821bc98..496e098cd 100644
--- a/libm/w_j0f.c
+++ b/libm/w_j0f.c
@@ -63,6 +63,6 @@ y0f (float x)
return __kernel_standard_f (x, x, 135);
}
# endif /* __UCLIBC_HAS_FENV__ */
- return (float) __ieee754_y0f ((double) x);
+ return (float) __ieee754_y0 ((double) x);
}
#endif /* __DO_XSI_MATH__ */
diff --git a/libpthread/linuxthreads/condvar.c b/libpthread/linuxthreads/condvar.c
index 6ac1622da..01359ac83 100644
--- a/libpthread/linuxthreads/condvar.c
+++ b/libpthread/linuxthreads/condvar.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <sched.h>
#include <stddef.h>
+#include <string.h>
#include <sys/time.h>
#include "pthread.h"
#include "internals.h"
@@ -273,7 +274,7 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
}
libpthread_hidden_def(pthread_cond_broadcast)
-int pthread_condattr_init(pthread_condattr_t *attr attribute_unused)
+int pthread_condattr_init(pthread_condattr_t *attr)
{
memset (attr, '\0', sizeof (*attr));
return 0;
@@ -328,7 +329,11 @@ int pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t clock_id)
INTERNAL_SYSCALL_DECL (err);
int val;
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_getres_time64)
+ val = INTERNAL_SYSCALL (clock_getres_time64, err, 2, CLOCK_MONOTONIC, &ts);
+#else
val = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts);
+#endif
avail = INTERNAL_SYSCALL_ERROR_P (val, err) ? -1 : 1;
}
diff --git a/libpthread/linuxthreads/manager.c b/libpthread/linuxthreads/manager.c
index 2a1ee62af..73fd1dcdb 100644
--- a/libpthread/linuxthreads/manager.c
+++ b/libpthread/linuxthreads/manager.c
@@ -47,6 +47,15 @@
# define USE_SELECT
#endif
+/* MAP_FIXED_NOREPLACE is not supported in kernel <= 4.17
+ * If it's not already defined, define it to 0.
+ * We check the results of mmap to ensure the correct
+ * results, and error out otherwise.
+ */
+#ifndef MAP_FIXED_NOREPLACE
+#define MAP_FIXED_NOREPLACE 0
+#endif
+
/* Array of active threads. Entry 0 is reserved for the initial thread. */
struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX] =
{ { __LOCK_INITIALIZER, &__pthread_initial_thread, 0},
@@ -371,12 +380,19 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
/* Allocate space for stack and thread descriptor at default address */
new_thread = default_new_thread;
new_thread_bottom = (char *) (new_thread + 1) - stacksize;
- if (mmap((caddr_t)((char *)(new_thread + 1) - INITIAL_STACK_SIZE),
+ void * new_stack_addr = NULL;
+ new_stack_addr = mmap((caddr_t)((char *)(new_thread + 1) - INITIAL_STACK_SIZE),
INITIAL_STACK_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED | MAP_GROWSDOWN,
- -1, 0) == MAP_FAILED)
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE | MAP_GROWSDOWN,
+ -1, 0);
+ if (new_stack_addr == MAP_FAILED){
/* Bad luck, this segment is already mapped. */
return -1;
+ } else if ( new_stack_addr != (caddr_t)((char *)(new_thread + 1) - INITIAL_STACK_SIZE)) {
+ /* Worse luck, we almost overwrote an existing page */
+ munmap(new_stack_addr, INITIAL_STACK_SIZE);
+ return -2;
+ }
/* We manage to get a stack. Now see whether we need a guard
and allocate it if necessary. Notice that the default
attributes (stack_size = STACK_SIZE - pagesize) do not need
@@ -439,7 +455,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
* the kernel chokes on a non-aligned stack frame. Choose the lower
* available word boundary.
*/
- new_thread = ((pthread_descr) ((int)(new_thread_bottom + stacksize) & -sizeof(void*))) - 1;
+ new_thread = ((pthread_descr) ((long)(new_thread_bottom + stacksize) & -sizeof(void*))) - 1;
guardaddr = NULL;
guardsize = 0;
@@ -496,9 +512,10 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
return EAGAIN;
if (__pthread_handles[sseg].h_descr != NULL)
continue;
- if (pthread_allocate_stack(attr, thread_segment(sseg), pagesize,
+ int res = pthread_allocate_stack(attr, thread_segment(sseg), pagesize,
&new_thread, &new_thread_bottom,
- &guardaddr, &guardsize) == 0)
+ &guardaddr, &guardsize);
+ if ( res == 0)
break;
#ifndef __ARCH_USE_MMU__
else
@@ -507,6 +524,14 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
* use the next one. However, when there is no MMU, malloc () is used.
* It's waste of CPU cycles to continue to try if it fails. */
return EAGAIN;
+#else
+ else if (res == -2)
+ /* When there is an MMU, if pthread_allocate_stack failed with -2,
+ * it indicates that we are attempting to mmap in address space which
+ * is already allocated. Any additional attempts will result in failure
+ * since we have exhausted our stack area.
+ */
+ return EAGAIN;
#endif
}
__pthread_handles_num++;
diff --git a/libpthread/linuxthreads/semaphore.c b/libpthread/linuxthreads/semaphore.c
index 9025dfee6..9464204a9 100644
--- a/libpthread/linuxthreads/semaphore.c
+++ b/libpthread/linuxthreads/semaphore.c
@@ -61,7 +61,6 @@ int sem_wait(sem_t * sem)
volatile pthread_descr self = thread_self();
pthread_extricate_if extr;
int already_canceled = 0;
- int spurious_wakeup_count;
/* Set up extrication interface */
extr.pu_object = sem;
@@ -90,7 +89,6 @@ int sem_wait(sem_t * sem)
}
/* Wait for sem_post or cancellation, or fall through if already canceled */
- spurious_wakeup_count = 0;
while (1)
{
suspend(self);
@@ -98,8 +96,7 @@ int sem_wait(sem_t * sem)
&& (THREAD_GETMEM(self, p_woken_by_cancel) == 0
|| THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE))
{
- /* Count resumes that don't belong to us. */
- spurious_wakeup_count++;
+ /* Resume does not belong to us. */
continue;
}
break;
@@ -213,7 +210,6 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime)
pthread_descr self = thread_self();
pthread_extricate_if extr;
int already_canceled = 0;
- int spurious_wakeup_count;
__pthread_lock(&sem->__sem_lock, self);
if (sem->__sem_value > 0) {
@@ -250,7 +246,6 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime)
__pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
- spurious_wakeup_count = 0;
while (1)
{
if (timedsuspend(self, abstime) == 0) {
@@ -277,8 +272,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime)
&& (THREAD_GETMEM(self, p_woken_by_cancel) == 0
|| THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE))
{
- /* Count resumes that don't belong to us. */
- spurious_wakeup_count++;
+ /* Resume does not belong to us. */
continue;
}
break;
diff --git a/libpthread/linuxthreads/signals.c b/libpthread/linuxthreads/signals.c
index 0c0f2b6b1..91b88e2c7 100644
--- a/libpthread/linuxthreads/signals.c
+++ b/libpthread/linuxthreads/signals.c
@@ -134,6 +134,7 @@ int sigaction(int sig, const struct sigaction * act,
{
struct sigaction newact;
struct sigaction *newactp;
+ void *save = NULL;
#ifdef DEBUG_PT
printf(__FUNCTION__": pthreads wrapper!\n");
@@ -142,6 +143,8 @@ printf(__FUNCTION__": pthreads wrapper!\n");
sig == __pthread_sig_cancel ||
(sig == __pthread_sig_debug && __pthread_sig_debug > 0))
return EINVAL;
+ if (sig > 0 && sig < NSIG)
+ save = sighandler[sig].old;
if (act)
{
newact = *act;
@@ -154,22 +157,24 @@ printf(__FUNCTION__": pthreads wrapper!\n");
newact.sa_handler = (__sighandler_t) pthread_sighandler;
}
newactp = &newact;
+ if (sig > 0 && sig < NSIG)
+ sighandler[sig].old = (arch_sighandler_t) act->sa_handler;
}
else
newactp = NULL;
if (__libc_sigaction(sig, newactp, oact) == -1)
- return -1;
+ {
+ if (act && sig > 0 && sig < NSIG)
+ sighandler[sig].old = save;
+ return -1;
+ }
#ifdef DEBUG_PT
printf(__FUNCTION__": sighandler installed, sigaction successful\n");
#endif
if (sig > 0 && sig < NSIG)
{
if (oact != NULL)
- oact->sa_handler = (__sighandler_t) sighandler[sig].old;
- if (act)
- /* For the assignment is does not matter whether it's a normal
- or real-time signal. */
- sighandler[sig].old = (arch_sighandler_t) act->sa_handler;
+ oact->sa_handler = save;
}
return 0;
}
diff --git a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
index fc17e9bc7..3250961cf 100644
--- a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
+++ b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
@@ -28,36 +28,20 @@
# define PT_EI __extern_always_inline
#endif
-#if defined(__thumb2__)
-PT_EI long int ldrex(int *spinlock)
-{
- long int ret;
- __asm__ __volatile__(
- "ldrex %0, [%1]\n"
- : "=r"(ret)
- : "r"(spinlock) : "memory");
- return ret;
-}
-
-PT_EI long int strex(int val, int *spinlock)
-{
- long int ret;
- __asm__ __volatile__(
- "strex %0, %1, [%2]\n"
- : "=r"(ret)
- : "r" (val), "r"(spinlock) : "memory");
- return ret;
-}
-
+#if __ARM_ARCH >= 7 || defined(__thumb2__)
/* Spinlock implementation; required. */
PT_EI long int
testandset (int *spinlock)
{
- register unsigned int ret;
-
- do {
- ret = ldrex(spinlock);
- } while (strex(1, spinlock));
+ unsigned int ret, tmp, val = 1;
+
+ __asm__ __volatile__ (
+"0: ldrex %0, [%2] \n"
+" strex %1, %3, [%2] \n"
+" cmp %1, #0 \n"
+" bne 0b"
+ : "=&r" (ret), "=&r" (tmp)
+ : "r" (spinlock), "r" (val) : "memory", "cc");
return ret;
}
diff --git a/libpthread/linuxthreads/sysdeps/riscv64/pt-machine.h b/libpthread/linuxthreads/sysdeps/riscv64/pt-machine.h
new file mode 100644
index 000000000..d83057669
--- /dev/null
+++ b/libpthread/linuxthreads/sysdeps/riscv64/pt-machine.h
@@ -0,0 +1,61 @@
+/*
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef _PT_MACHINE_H
+#define _PT_MACHINE_H 1
+#include <features.h>
+
+#ifndef PT_EI
+# define PT_EI __extern_always_inline
+#endif
+
+#define HAS_COMPARE_AND_SWAP
+PT_EI int
+__compare_and_swap (long int *p, long int oldval, long int newval)
+{
+ long int ret, temp;
+
+ __asm__ __volatile__
+ ("/* Inline compare & swap */\n"
+ "1:\n\t"
+ "lr.d %1,%2\n\t"
+ "li %0,0\n\t"
+ "bne %1,%3,2f\n\t"
+ "li %0,1\n\t"
+ "sc.d %1,%4,%2\n\t"
+ "bnez %1,1b\n"
+ "2:\n\t"
+ "/* End compare & swap */"
+ : "=&r" (ret), "=&r" (temp), "+A" (*p)
+ : "r" (oldval), "r" (newval)
+ : "memory");
+
+ return ret;
+}
+
+extern long int testandset (int *spinlock);
+
+PT_EI long int
+testandset (int *spinlock)
+{
+ unsigned int old = 1;
+ int tmp = 1;
+
+ __asm__ __volatile__ (
+ "amoswap.w %0, %2, %1"
+ : "=r" (old), "+A" (*spinlock)
+ : "r" (tmp)
+ : "memory");
+
+ return old;
+}
+
+/* Get some notion of the current stack. Need not be exactly the top
+ of the stack, just something somewhere in the current frame. */
+#define CURRENT_STACK_FRAME stack_pointer
+register char * stack_pointer __asm__ ("sp");
+
+#else
+#error PT_MACHINE already defined
+#endif /* pt-machine.h */
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 4959d5ed8..a6c0ec6af 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -195,8 +195,14 @@ __pthread_initialize_minimal_internal (void)
doing the test once this early is beneficial. */
{
int word = 0;
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ word = INTERNAL_SYSCALL (futex_time64, err, 3, &word,
+ FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
+#else
word = INTERNAL_SYSCALL (futex, err, 3, &word,
FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
+#endif
+
if (!INTERNAL_SYSCALL_ERROR_P (word, err))
THREAD_SETMEM (pd, header.private_futex, FUTEX_PRIVATE_FLAG);
}
@@ -215,9 +221,16 @@ __pthread_initialize_minimal_internal (void)
is irrelevant. Given that passing six parameters is difficult
on some architectures we just pass whatever random value the
calling convention calls for to the kernel. It causes no harm. */
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ word = INTERNAL_SYSCALL (futex_time64, err, 5, &word,
+ FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME
+ | FUTEX_PRIVATE_FLAG, 1, NULL, 0);
+#else
word = INTERNAL_SYSCALL (futex, err, 5, &word,
FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME
| FUTEX_PRIVATE_FLAG, 1, NULL, 0);
+#endif
+
assert (INTERNAL_SYSCALL_ERROR_P (word, err));
if (INTERNAL_SYSCALL_ERRNO (word, err) != ENOSYS)
__set_futex_clock_realtime ();
@@ -278,17 +291,17 @@ __pthread_initialize_minimal_internal (void)
struct rlimit limit;
if (getrlimit (RLIMIT_STACK, &limit) != 0
|| limit.rlim_cur == RLIM_INFINITY)
- /* The system limit is not usable. Use an architecture-specific
- default. */
- limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
- else if (limit.rlim_cur < PTHREAD_STACK_MIN)
+ /* The system limit is not usable. Use a user-specified or
+ architecture-specific default. */
+ limit.rlim_cur = __PTHREADS_STACK_DEFAULT_SIZE__;
+ if (limit.rlim_cur < PTHREAD_STACK_MIN)
/* The system limit is unusably small.
Use the minimal size acceptable. */
limit.rlim_cur = PTHREAD_STACK_MIN;
- /* Do not exceed architecture specific default */
- if (limit.rlim_cur > ARCH_STACK_DEFAULT_SIZE)
- limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
+ /* Do not exceed the user-specified or architecture-specific default */
+ if (limit.rlim_cur > __PTHREADS_STACK_DEFAULT_SIZE__)
+ limit.rlim_cur = __PTHREADS_STACK_DEFAULT_SIZE__;
/* Make sure it meets the minimum size that allocate_stack
(allocatestack.c) will demand, which depends on the page size. */
@@ -337,3 +350,9 @@ __pthread_initialize_minimal_internal (void)
}
strong_alias (__pthread_initialize_minimal_internal,
__pthread_initialize_minimal)
+
+size_t
+__pthread_get_minstack (const pthread_attr_t *attr)
+{
+ return __static_tls_size + PTHREAD_STACK_MIN;
+}
diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index 13205512a..c686a4ca5 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -377,6 +377,7 @@ weak_function;
extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
+extern size_t __pthread_get_minstack (const pthread_attr_t *attr);
/* Namespace save aliases. */
extern int __pthread_getschedparam (pthread_t thread_id, int *policy,
diff --git a/libpthread/nptl/pthread_condattr_setclock.c b/libpthread/nptl/pthread_condattr_setclock.c
index b2f4aaf29..e7f3539d6 100644
--- a/libpthread/nptl/pthread_condattr_setclock.c
+++ b/libpthread/nptl/pthread_condattr_setclock.c
@@ -35,7 +35,7 @@ pthread_condattr_setclock (
if (clock_id == CLOCK_MONOTONIC)
{
#ifndef __ASSUME_POSIX_TIMERS
-# ifdef __NR_clock_getres
+# if defined(__NR_clock_getres) || defined(__NR_clock_getres_time64)
/* Check whether the clock is available. */
static int avail;
@@ -45,7 +45,11 @@ pthread_condattr_setclock (
INTERNAL_SYSCALL_DECL (err);
int val;
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_getres_time64)
+ val = INTERNAL_SYSCALL (clock_getres_time64, err, 2, CLOCK_MONOTONIC, &ts);
+#else
val = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts);
+#endif
avail = INTERNAL_SYSCALL_ERROR_P (val, err) ? -1 : 1;
}
diff --git a/libpthread/nptl/pthread_create.c b/libpthread/nptl/pthread_create.c
index 5a7957d6a..697af20e0 100644
--- a/libpthread/nptl/pthread_create.c
+++ b/libpthread/nptl/pthread_create.c
@@ -447,7 +447,7 @@ pthread_create (
performed in 'get_cached_stack'. This way we avoid doing this if
the stack freshly allocated with 'mmap'. */
-#if TLS_TCB_AT_TP
+#ifdef TLS_TCB_AT_TP
/* Reference to the TCB itself. */
pd->header.self = pd;
diff --git a/libpthread/nptl/pthread_mutex_init.c b/libpthread/nptl/pthread_mutex_init.c
index bf4c4d151..ba5c916eb 100644
--- a/libpthread/nptl/pthread_mutex_init.c
+++ b/libpthread/nptl/pthread_mutex_init.c
@@ -62,8 +62,13 @@ __pthread_mutex_init (
{
int lock = 0;
INTERNAL_SYSCALL_DECL (err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ int ret = INTERNAL_SYSCALL (futex_time64, err, 4, &lock, FUTEX_UNLOCK_PI,
+ 0, 0);
+#else
int ret = INTERNAL_SYSCALL (futex, err, 4, &lock, FUTEX_UNLOCK_PI,
0, 0);
+#endif
assert (INTERNAL_SYSCALL_ERROR_P (ret, err));
tpi_supported = INTERNAL_SYSCALL_ERRNO (ret, err) == ENOSYS ? -1 : 1;
}
diff --git a/libpthread/nptl/pthread_mutex_lock.c b/libpthread/nptl/pthread_mutex_lock.c
index 8353e8cd3..6e98a9760 100644
--- a/libpthread/nptl/pthread_mutex_lock.c
+++ b/libpthread/nptl/pthread_mutex_lock.c
@@ -300,9 +300,15 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
: PTHREAD_MUTEX_PSHARED (mutex));
INTERNAL_SYSCALL_DECL (__err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ int e = INTERNAL_SYSCALL (futex_time64, __err, 4, &mutex->__data.__lock,
+ __lll_private_flag (FUTEX_LOCK_PI,
+ private), 1, 0);
+#else
int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
__lll_private_flag (FUTEX_LOCK_PI,
private), 1, 0);
+#endif
if (INTERNAL_SYSCALL_ERROR_P (e, __err)
&& (INTERNAL_SYSCALL_ERRNO (e, __err) == ESRCH
@@ -357,10 +363,17 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
mutex->__data.__count = 0;
INTERNAL_SYSCALL_DECL (__err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ INTERNAL_SYSCALL (futex_time64, __err, 4, &mutex->__data.__lock,
+ __lll_private_flag (FUTEX_UNLOCK_PI,
+ PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
+ 0, 0);
+#else
INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
__lll_private_flag (FUTEX_UNLOCK_PI,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
0, 0);
+#endif
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
diff --git a/libpthread/nptl/pthread_mutex_timedlock.c b/libpthread/nptl/pthread_mutex_timedlock.c
index f56f6c55e..1191639b6 100644
--- a/libpthread/nptl/pthread_mutex_timedlock.c
+++ b/libpthread/nptl/pthread_mutex_timedlock.c
@@ -23,6 +23,10 @@
#include <lowlevellock.h>
#include <not-cancel.h>
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
/* We need to build this function with optimization to avoid
* lll_timedlock erroring out with
* error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
@@ -264,10 +268,17 @@ pthread_mutex_timedlock (
: PTHREAD_MUTEX_PSHARED (mutex));
INTERNAL_SYSCALL_DECL (__err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ int e = INTERNAL_SYSCALL (futex_time64, __err, 4, &mutex->__data.__lock,
+ __lll_private_flag (FUTEX_LOCK_PI,
+ private), 1,
+ TO_TS64_P(abstime));
+#else
int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
__lll_private_flag (FUTEX_LOCK_PI,
private), 1,
abstime);
+#endif
if (INTERNAL_SYSCALL_ERROR_P (e, __err))
{
if (INTERNAL_SYSCALL_ERRNO (e, __err) == ETIMEDOUT)
@@ -287,10 +298,23 @@ pthread_mutex_timedlock (
/* Delay the thread until the timeout is reached.
Then return ETIMEDOUT. */
struct timespec reltime;
- struct timespec now;
+#if defined(__UCLIBC_USE_TIME64__)
+ struct __ts64_struct __now64;
+#endif
+ struct timespec now = {.tv_sec = 0, .tv_nsec = 0};
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_gettime64)
+ int __r = INTERNAL_SYSCALL (clock_gettime64, __err, 2, CLOCK_REALTIME,
+ &__now64);
+
+ if (__r == 0) {
+ now.tv_sec = __now64.tv_sec;
+ now.tv_nsec = __now64.tv_nsec;
+ }
+#else
INTERNAL_SYSCALL (clock_gettime, __err, 2, CLOCK_REALTIME,
&now);
+#endif
reltime.tv_sec = abstime->tv_sec - now.tv_sec;
reltime.tv_nsec = abstime->tv_nsec - now.tv_nsec;
if (reltime.tv_nsec < 0)
@@ -340,10 +364,17 @@ pthread_mutex_timedlock (
mutex->__data.__count = 0;
INTERNAL_SYSCALL_DECL (__err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ INTERNAL_SYSCALL (futex_time64, __err, 4, &mutex->__data.__lock,
+ __lll_private_flag (FUTEX_UNLOCK_PI,
+ PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
+ 0, 0);
+#else
INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
__lll_private_flag (FUTEX_UNLOCK_PI,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
0, 0);
+#endif
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
diff --git a/libpthread/nptl/pthread_mutex_trylock.c b/libpthread/nptl/pthread_mutex_trylock.c
index e0d54bda7..ca02109ee 100644
--- a/libpthread/nptl/pthread_mutex_trylock.c
+++ b/libpthread/nptl/pthread_mutex_trylock.c
@@ -234,9 +234,15 @@ __pthread_mutex_trylock (
? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
: PTHREAD_MUTEX_PSHARED (mutex));
INTERNAL_SYSCALL_DECL (__err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ int e = INTERNAL_SYSCALL (futex_time64, __err, 4, &mutex->__data.__lock,
+ __lll_private_flag (FUTEX_TRYLOCK_PI,
+ private), 0, 0);
+#else
int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
__lll_private_flag (FUTEX_TRYLOCK_PI,
private), 0, 0);
+#endif
if (INTERNAL_SYSCALL_ERROR_P (e, __err)
&& INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK)
@@ -276,10 +282,17 @@ __pthread_mutex_trylock (
mutex->__data.__count = 0;
INTERNAL_SYSCALL_DECL (__err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ INTERNAL_SYSCALL (futex_time64, __err, 4, &mutex->__data.__lock,
+ __lll_private_flag (FUTEX_UNLOCK_PI,
+ PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
+ 0, 0);
+#else
INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
__lll_private_flag (FUTEX_UNLOCK_PI,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
0, 0);
+#endif
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
diff --git a/libpthread/nptl/pthread_mutex_unlock.c b/libpthread/nptl/pthread_mutex_unlock.c
index 1123e3c42..6f3ed8c44 100644
--- a/libpthread/nptl/pthread_mutex_unlock.c
+++ b/libpthread/nptl/pthread_mutex_unlock.c
@@ -222,8 +222,13 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
: PTHREAD_MUTEX_PSHARED (mutex));
INTERNAL_SYSCALL_DECL (__err);
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+ INTERNAL_SYSCALL (futex_time64, __err, 2, &mutex->__data.__lock,
+ __lll_private_flag (FUTEX_UNLOCK_PI, private));
+#else
INTERNAL_SYSCALL (futex, __err, 2, &mutex->__data.__lock,
__lll_private_flag (FUTEX_UNLOCK_PI, private));
+#endif
}
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
diff --git a/libpthread/nptl/sem_open.c b/libpthread/nptl/sem_open.c
index 2746da1b7..8c99d6dbe 100644
--- a/libpthread/nptl/sem_open.c
+++ b/libpthread/nptl/sem_open.c
@@ -147,11 +147,11 @@ __sem_search (const void *a, const void *b)
if (as->ino != bs->ino)
/* Cannot return the difference the type is larger than int. */
- return as->ino < bs->ino ? -1 : (as->ino == bs->ino ? 0 : 1);
+ return as->ino < bs->ino ? -1 : 1;
if (as->dev != bs->dev)
/* Cannot return the difference the type is larger than int. */
- return as->dev < bs->dev ? -1 : (as->dev == bs->dev ? 0 : 1);
+ return as->dev < bs->dev ? -1 : 1;
return strcmp (as->name, bs->name);
}
diff --git a/libpthread/nptl/sysdeps/aarch64/pthreaddef.h b/libpthread/nptl/sysdeps/aarch64/pthreaddef.h
index d9495f9cb..7172f406b 100644
--- a/libpthread/nptl/sysdeps/aarch64/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/aarch64/pthreaddef.h
@@ -14,9 +14,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/alpha/pthreaddef.h b/libpthread/nptl/sysdeps/alpha/pthreaddef.h
index 72a311c33..6b99f3b4f 100644
--- a/libpthread/nptl/sysdeps/alpha/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/alpha/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. The ABI requires 16. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/arc/pthreaddef.h b/libpthread/nptl/sysdeps/arc/pthreaddef.h
index bf4f0f29a..0fb28dc48 100644
--- a/libpthread/nptl/sysdeps/arc/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/arc/pthreaddef.h
@@ -17,9 +17,6 @@
#include <sysdep.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 8
diff --git a/libpthread/nptl/sysdeps/arm/pthreaddef.h b/libpthread/nptl/sysdeps/arm/pthreaddef.h
index a05ac879d..f790a6dca 100644
--- a/libpthread/nptl/sysdeps/arm/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/arm/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/csky/pthreaddef.h b/libpthread/nptl/sysdeps/csky/pthreaddef.h
index 992fced01..4aa97ee27 100644
--- a/libpthread/nptl/sysdeps/csky/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/csky/pthreaddef.h
@@ -5,9 +5,6 @@
* in this tarball.
*/
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/generic/Makefile.in b/libpthread/nptl/sysdeps/generic/Makefile.in
index eb656ee17..a5ba9bbe8 100644
--- a/libpthread/nptl/sysdeps/generic/Makefile.in
+++ b/libpthread/nptl/sysdeps/generic/Makefile.in
@@ -13,6 +13,10 @@ subdirs += libpthread/nptl/sysdeps/generic
libpthread_generic_DIR := $(top_srcdir)libpthread/nptl/sysdeps/generic
libpthread_generic_OUT := $(top_builddir)libpthread/nptl/sysdeps/generic
+ifeq ($(STATIC_PIE),y)
+CFLAGS-libc-tls.c := -DSTATIC_PIE
+endif
+
libpthread_generic_libc_a_CSRC = libc-tls.c
libpthread_generic_libc_a_COBJ = $(patsubst %.c,$(libpthread_generic_OUT)/%.o,$(libpthread_generic_libc_a_CSRC))
libpthread_generic_libc_a_OBJS = $(libpthread_generic_libc_a_COBJ)
diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c
index d746c9a38..7cfe9ac1a 100644
--- a/libpthread/nptl/sysdeps/generic/libc-tls.c
+++ b/libpthread/nptl/sysdeps/generic/libc-tls.c
@@ -117,6 +117,10 @@ init_static_tls (size_t memsz, size_t align)
GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx);
}
+#if !defined(__FDPIC__) && !defined(SHARED) && defined(STATIC_PIE)
+ElfW(Addr) _dl_load_base;
+#endif
+
void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
void
__libc_setup_tls (size_t tcbsize, size_t tcbalign)
@@ -142,6 +146,9 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
initimage = (void *) &__tdata_start;
#else
initimage = (void *) phdr->p_vaddr;
+#if !defined(SHARED) && defined(STATIC_PIE)
+ initimage += _dl_load_base;
+#endif
#endif
align = phdr->p_align;
if (phdr->p_align > max_align)
@@ -162,10 +169,13 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
for FDPIC MMU-less platforms:
fs/binfmt_elf_fdpic.c: fix brk area overlap with stack on NOMMU
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/binfmt_elf_fdpic.c?id=4ac313111018cb44ecc250445de5ccb93026a980
+ Loading static PIE ELFs on noMMU is possible since the linux kernel commit
+ 1bde925d2354 ("fs/binfmt_elf_fdpic.c: provide NOMMU loader for regular ELF binaries")
+ and it is subject to the same brk restriction.
*/
# if defined(TLS_TCB_AT_TP)
tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
-# if defined(__FDPIC__)
+# if defined(__FDPIC__) || (!defined(__ARCH_USE_MMU__) && defined(STATIC_PIE))
tlsblock = mmap (NULL, tcb_offset + tcbsize + max_align,
PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
# else
@@ -173,7 +183,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
# endif
# elif defined(TLS_DTV_AT_TP)
tcb_offset = roundup (tcbsize, align ?: 1);
-# if defined(__FDPIC__)
+# if defined(__FDPIC__) || (!defined(__ARCH_USE_MMU__) && defined(STATIC_PIE))
tlsblock = mmap (NULL, tcb_offset + memsz + max_align + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size),
PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
# else
diff --git a/libpthread/nptl/sysdeps/i386/pthreaddef.h b/libpthread/nptl/sysdeps/i386/pthreaddef.h
index a0659039d..2fd27113c 100644
--- a/libpthread/nptl/sysdeps/i386/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/i386/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/kvx/pthreaddef.h b/libpthread/nptl/sysdeps/kvx/pthreaddef.h
index 6e1485998..03945bc5f 100644
--- a/libpthread/nptl/sysdeps/kvx/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/kvx/pthreaddef.h
@@ -6,9 +6,6 @@
* Copyright (C) 2019 Kalray Inc.
*/
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 32
diff --git a/libpthread/nptl/sysdeps/m68k/pthreaddef.h b/libpthread/nptl/sysdeps/m68k/pthreaddef.h
index 1651b3d5f..04d565191 100644
--- a/libpthread/nptl/sysdeps/m68k/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/m68k/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/metag/pthreaddef.h b/libpthread/nptl/sysdeps/metag/pthreaddef.h
index bf4f0f29a..0fb28dc48 100644
--- a/libpthread/nptl/sysdeps/metag/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/metag/pthreaddef.h
@@ -17,9 +17,6 @@
#include <sysdep.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 8
diff --git a/libpthread/nptl/sysdeps/microblaze/pthreaddef.h b/libpthread/nptl/sysdeps/microblaze/pthreaddef.h
index 47e87dd71..a01b59fab 100644
--- a/libpthread/nptl/sysdeps/microblaze/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/microblaze/pthreaddef.h
@@ -19,9 +19,6 @@
#include <stdlib.h>
#include <string.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/mips/pthreaddef.h b/libpthread/nptl/sysdeps/mips/pthreaddef.h
index 692988205..adedd7715 100644
--- a/libpthread/nptl/sysdeps/mips/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/mips/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/nds32/pthreaddef.h b/libpthread/nptl/sysdeps/nds32/pthreaddef.h
index c9d3f7781..0dca16c34 100644
--- a/libpthread/nptl/sysdeps/nds32/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/nds32/pthreaddef.h
@@ -14,9 +14,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/nios2/pthreaddef.h b/libpthread/nptl/sysdeps/nios2/pthreaddef.h
index 4268252dd..5be435237 100644
--- a/libpthread/nptl/sysdeps/nios2/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/nios2/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 4
diff --git a/libpthread/nptl/sysdeps/or1k/pthreaddef.h b/libpthread/nptl/sysdeps/or1k/pthreaddef.h
index e8da3d965..394962172 100644
--- a/libpthread/nptl/sysdeps/or1k/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/or1k/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/powerpc/pthreaddef.h b/libpthread/nptl/sysdeps/powerpc/pthreaddef.h
index 36bf76404..a46c094b6 100644
--- a/libpthread/nptl/sysdeps/powerpc/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/powerpc/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. The ABI requires 16
bytes (for both 32-bit and 64-bit PowerPC). */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/pthread/pthread.h b/libpthread/nptl/sysdeps/pthread/pthread.h
index 1fba7fca6..531e17322 100644
--- a/libpthread/nptl/sysdeps/pthread/pthread.h
+++ b/libpthread/nptl/sysdeps/pthread/pthread.h
@@ -28,6 +28,7 @@
#include <signal.h>
#include <bits/pthreadtypes.h>
#include <bits/setjmp.h>
+#include <bits/jmp_buf_tag.h>
#include <bits/wordsize.h>
#if defined _LIBC && ( defined IS_IN_libc || !defined NOT_IN_libc )
#include <bits/uClibc_pthread.h>
@@ -726,8 +727,7 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
#endif
/* Function used in the macros. */
-struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
+extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
/* Mutex handling. */
diff --git a/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c
index f06b69e2f..ce738b1a1 100644
--- a/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c
+++ b/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c
@@ -95,17 +95,34 @@ __pthread_cond_timedwait (
while (1)
{
- struct timespec rt;
+ struct timespec rt = {.tv_sec = 0, .tv_nsec = 0};
+#if defined(__UCLIBC_USE_TIME64__)
+ struct __ts64_struct __rt64;
+#endif
{
#ifdef __NR_clock_gettime
INTERNAL_SYSCALL_DECL (err);
-# ifndef __ASSUME_POSIX_TIMERS
+# if !defined(__ASSUME_POSIX_TIMERS) || defined(__UCLIBC_USE_TIME64__)
int ret =
# endif
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_gettime64)
+ INTERNAL_SYSCALL (clock_gettime64, err, 2,
+ (cond->__data.__nwaiters
+ & ((1 << COND_NWAITERS_SHIFT) - 1)),
+ &__rt64);
+
+ if (ret == 0) {
+ rt.tv_sec = __rt64.tv_sec;
+ rt.tv_nsec = __rt64.tv_nsec;
+ }
+
+#else
INTERNAL_SYSCALL (clock_gettime, err, 2,
(cond->__data.__nwaiters
& ((1 << COND_NWAITERS_SHIFT) - 1)),
&rt);
+#endif
+
# ifndef __ASSUME_POSIX_TIMERS
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (ret, err), 0))
{
diff --git a/libpthread/nptl/sysdeps/riscv32/Makefile.arch b/libpthread/nptl/sysdeps/riscv32/Makefile.arch
new file mode 100644
index 000000000..01fdac0b5
--- /dev/null
+++ b/libpthread/nptl/sysdeps/riscv32/Makefile.arch
@@ -0,0 +1,4 @@
+# Makefile for uClibc-ng NPTL
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+libc_arch_a_CSRC = libc-tls.c
diff --git a/libpthread/nptl/sysdeps/riscv32/dl-tls.h b/libpthread/nptl/sysdeps/riscv32/dl-tls.h
new file mode 100644
index 000000000..31991be0d
--- /dev/null
+++ b/libpthread/nptl/sysdeps/riscv32/dl-tls.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Type used for the representation of TLS information in the GOT. */
+typedef struct
+{
+ unsigned long int ti_module;
+ unsigned long int ti_offset;
+} tls_index;
+
+/* The thread pointer points to the first static TLS block. */
+#define TLS_TP_OFFSET 0
+
+/* Dynamic thread vector pointers point 0x800 past the start of each
+ TLS block. */
+#define TLS_DTV_OFFSET 0x800
+
+extern void *__tls_get_addr (tls_index *ti);
+
+#define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
+#define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
diff --git a/libpthread/nptl/sysdeps/riscv32/libc-tls.c b/libpthread/nptl/sysdeps/riscv32/libc-tls.c
new file mode 100644
index 000000000..8c601c06d
--- /dev/null
+++ b/libpthread/nptl/sysdeps/riscv32/libc-tls.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdeps/generic/libc-tls.c>
+#include <dl-tls.h>
+
+/* On RISC-V 32, linker optimizations are not required, so __tls_get_addr
+ can be called even in statically linked binaries. In this case module
+ must be always 1 and PT_TLS segment exist in the binary, otherwise it
+ would not link. */
+
+#if defined(USE_TLS) && USE_TLS
+
+void *
+__tls_get_addr (tls_index *ti)
+{
+ dtv_t *dtv = THREAD_DTV ();
+ return (char *) dtv[1].pointer.val + ti->ti_offset;
+}
+
+#endif
diff --git a/libpthread/nptl/sysdeps/riscv32/pthread_spin_lock.c b/libpthread/nptl/sysdeps/riscv32/pthread_spin_lock.c
new file mode 100644
index 000000000..cec3acbc6
--- /dev/null
+++ b/libpthread/nptl/sysdeps/riscv32/pthread_spin_lock.c
@@ -0,0 +1,65 @@
+/* pthread_spin_lock -- lock a spin lock. Generic version.
+ Copyright (C) 2012-2016 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <atomic.h>
+#include "pthreadP.h"
+
+/* A machine-specific version can define SPIN_LOCK_READS_BETWEEN_CMPXCHG
+ to the number of plain reads that it's optimal to spin on between uses
+ of atomic_compare_and_exchange_val_acq. If spinning forever is optimal
+ then use -1. If no plain reads here would ever be optimal, use 0. */
+#define SPIN_LOCK_READS_BETWEEN_CMPXCHG 1000
+
+int
+pthread_spin_lock (pthread_spinlock_t *lock)
+{
+ /* atomic_exchange usually takes less instructions than
+ atomic_compare_and_exchange. On the other hand,
+ atomic_compare_and_exchange potentially generates less bus traffic
+ when the lock is locked.
+ We assume that the first try mostly will be successful, and we use
+ atomic_exchange. For the subsequent tries we use
+ atomic_compare_and_exchange. */
+ if (atomic_exchange_acq (lock, 1) == 0)
+ return 0;
+
+ do
+ {
+ /* The lock is contended and we need to wait. Going straight back
+ to cmpxchg is not a good idea on many targets as that will force
+ expensive memory synchronizations among processors and penalize other
+ running threads.
+ On the other hand, we do want to update memory state on the local core
+ once in a while to avoid spinning indefinitely until some event that
+ will happen to update local memory as a side-effect. */
+ if (SPIN_LOCK_READS_BETWEEN_CMPXCHG >= 0)
+ {
+ int wait = SPIN_LOCK_READS_BETWEEN_CMPXCHG;
+
+ while (*lock != 0 && wait > 0)
+ --wait;
+ }
+ else
+ {
+ while (*lock != 0)
+ ;
+ }
+ }
+ while (atomic_compare_and_exchange_val_acq (lock, 1, 0) != 0);
+
+ return 0;
+}
diff --git a/libc/sysdeps/linux/i386/bits/wchar.h b/libpthread/nptl/sysdeps/riscv32/pthread_spin_trylock.c
index b94fc7a3f..4e9aa64d3 100644
--- a/libc/sysdeps/linux/i386/bits/wchar.h
+++ b/libpthread/nptl/sysdeps/riscv32/pthread_spin_trylock.c
@@ -1,6 +1,5 @@
-/* wchar_t type related definitions.
- Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* pthread_spin_trylock -- trylock a spin lock. Generic version.
+ Copyright (C) 2012-2016 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,10 +15,12 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _BITS_WCHAR_H
-#define _BITS_WCHAR_H 1
+#include <errno.h>
+#include <atomic.h>
+#include "pthreadP.h"
-#define __WCHAR_MIN (-2147483647l - 1l)
-#define __WCHAR_MAX (2147483647l)
-
-#endif /* bits/wchar.h */
+int
+pthread_spin_trylock (pthread_spinlock_t *lock)
+{
+ return atomic_exchange_acq (lock, 1) ? EBUSY : 0;
+}
diff --git a/libpthread/nptl/sysdeps/riscv32/pthreaddef.h b/libpthread/nptl/sysdeps/riscv32/pthreaddef.h
new file mode 100644
index 000000000..5a929bc77
--- /dev/null
+++ b/libpthread/nptl/sysdeps/riscv32/pthreaddef.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Required stack pointer alignment at beginning. */
+#define STACK_ALIGN 16
+
+/* Minimal stack size after allocating thread descriptor and guard size. */
+#define MINIMAL_REST_STACK 2048
+
+/* Alignment requirement for TCB. */
+#define TCB_ALIGNMENT 16
+
+/* Location of current stack frame. */
+#define CURRENT_STACK_FRAME __builtin_frame_address (0)
+
+
+/* XXX Until we have a better place keep the definitions here. */
+#define __exit_thread_inline(val) \
+ INLINE_SYSCALL (exit, 1, (val))
+
diff --git a/libpthread/nptl/sysdeps/riscv32/tcb-offsets.sym b/libpthread/nptl/sysdeps/riscv32/tcb-offsets.sym
new file mode 100644
index 000000000..fe6856c5d
--- /dev/null
+++ b/libpthread/nptl/sysdeps/riscv32/tcb-offsets.sym
@@ -0,0 +1,7 @@
+#include <sysdep.h>
+#include <tls.h>
+
+#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
+
+MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
+
diff --git a/libpthread/nptl/sysdeps/riscv32/tls.h b/libpthread/nptl/sysdeps/riscv32/tls.h
new file mode 100644
index 000000000..8ef9f3511
--- /dev/null
+++ b/libpthread/nptl/sysdeps/riscv32/tls.h
@@ -0,0 +1,170 @@
+/* Definition for thread-local data handling. NPTL/RISCV32 version.
+ Copyright (C) 2005, 2007, 2011 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _TLS_H
+#define _TLS_H 1
+
+#ifndef __ASSEMBLER__
+# include <stdbool.h>
+# include <stddef.h>
+# include <stdint.h>
+
+/* Type for the dtv. */
+typedef union dtv
+{
+ size_t counter;
+ struct
+ {
+ void *val;
+ bool is_static;
+ } pointer;
+} dtv_t;
+
+#else /* __ASSEMBLER__ */
+# include <tcb-offsets.h>
+#endif /* __ASSEMBLER__ */
+
+/* We require TLS support in the tools. */
+#define HAVE_TLS_SUPPORT 1
+#define HAVE_TLS_MODEL_ATTRIBUTE 1
+#define HAVE___THREAD 1
+
+/* Signal that TLS support is available. */
+#define USE_TLS 1
+
+#ifndef __ASSEMBLER__
+
+register void *__thread_self __asm__("tp");
+# define READ_THREAD_POINTER() ({ __thread_self; })
+
+/* Get system call information. */
+# include <sysdep.h>
+
+/* The TP points to the start of the TLS block. */
+# define TLS_DTV_AT_TP 1
+
+/* Get the thread descriptor definition. */
+# include <../../descr.h>
+
+typedef struct
+{
+ dtv_t *dtv;
+ void *private;
+} tcbhead_t;
+
+/* This is the size of the initial TCB. Because our TCB is before the thread
+ pointer, we don't need this. */
+# define TLS_INIT_TCB_SIZE 0
+# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
+
+/* This is the size of the TCB. Because our TCB is before the thread
+ pointer, we don't need this. */
+# define TLS_TCB_SIZE 0
+# define TLS_TCB_ALIGN __alignof__ (struct pthread)
+
+/* This is the size we need before TCB - actually, it includes the TCB. */
+# define TLS_PRE_TCB_SIZE \
+ (sizeof (struct pthread) \
+ + ((sizeof (tcbhead_t) + __alignof (struct pthread) - 1) \
+ & ~(__alignof (struct pthread) - 1)))
+
+/* The thread pointer tp points to the end of the TCB.
+ The pthread_descr structure is immediately in front of the TCB. */
+# define TLS_TCB_OFFSET 0
+
+/* Install the dtv pointer. The pointer passed is to the element with
+ index -1 which contain the length. */
+# define INSTALL_DTV(tcbp, dtvp) \
+ (((tcbhead_t *) (tcbp))[-1].dtv = (dtvp) + 1)
+
+/* Install new dtv for current thread */
+# define INSTALL_NEW_DTV(dtv) \
+ (THREAD_DTV() = (dtv))
+
+/* Return dtv of given thread descriptor. */
+# define GET_DTV(tcbp) \
+ (((tcbhead_t *) (tcbp))[-1].dtv)
+
+/* Code to initially initialize the thread pointer.
+ *
+ * Set TP to the address _after_ tcbhead_t. This will allow us
+ * to change the size of tcbhead_t without having to re-link everything.
+ *
+ * secondcall has something to do with USE__THREAD,
+ * seems to always be 0 so we don't care about it.
+ *
+ * This has to return NULL on success (or a string with the failure text).
+ * It's hard to fail this, so return NULL always.
+ */
+# define TLS_INIT_TP(tcbp, secondcall) \
+ ({ __thread_self = (char*)tcbp + TLS_TCB_OFFSET; NULL; })
+
+/* Return the address of the dtv for the current thread. */
+# define THREAD_DTV() \
+ (((tcbhead_t *) (READ_THREAD_POINTER () - TLS_TCB_OFFSET))[-1].dtv)
+
+/* Return the thread descriptor for the current thread. */
+# define THREAD_SELF \
+ ((struct pthread *) (READ_THREAD_POINTER () \
+ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
+
+/* Informs libthread_db that the thread pointer is register 4, which is used
+ * to know how to do THREAD_SELF. */
+# define DB_THREAD_SELF \
+ REGISTER (64, 64, 4 * 8, - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
+
+/* Access to data in the thread descriptor is easy. */
+#define THREAD_GETMEM(descr, member) \
+ descr->member
+#define THREAD_GETMEM_NC(descr, member, idx) \
+ descr->member[idx]
+#define THREAD_SETMEM(descr, member, value) \
+ descr->member = (value)
+#define THREAD_SETMEM_NC(descr, member, idx, value) \
+ descr->member[idx] = (value)
+
+/* l_tls_offset == 0 is perfectly valid, so we have to use some different
+ value to mean unset l_tls_offset. */
+# define NO_TLS_OFFSET -1
+
+/* Get and set the global scope generation counter in struct pthread. */
+#define THREAD_GSCOPE_FLAG_UNUSED 0
+#define THREAD_GSCOPE_FLAG_USED 1
+#define THREAD_GSCOPE_FLAG_WAIT 2
+#define THREAD_GSCOPE_RESET_FLAG() \
+ do \
+ { int __res \
+ = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \
+ THREAD_GSCOPE_FLAG_UNUSED); \
+ if (__res == THREAD_GSCOPE_FLAG_WAIT) \
+ lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_SET_FLAG() \
+ do \
+ { \
+ THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \
+ atomic_write_barrier (); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_WAIT() \
+ GL(dl_wait_lookup_done) ()
+
+#endif /* __ASSEMBLER__ */
+
+#endif /* tls.h */
+
diff --git a/libpthread/nptl/sysdeps/riscv64/dl-tls.h b/libpthread/nptl/sysdeps/riscv64/dl-tls.h
index 01663edf3..31991be0d 100644
--- a/libpthread/nptl/sysdeps/riscv64/dl-tls.h
+++ b/libpthread/nptl/sysdeps/riscv64/dl-tls.h
@@ -21,4 +21,14 @@ typedef struct
unsigned long int ti_offset;
} tls_index;
+/* The thread pointer points to the first static TLS block. */
+#define TLS_TP_OFFSET 0
+
+/* Dynamic thread vector pointers point 0x800 past the start of each
+ TLS block. */
+#define TLS_DTV_OFFSET 0x800
+
extern void *__tls_get_addr (tls_index *ti);
+
+#define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
+#define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
diff --git a/libpthread/nptl/sysdeps/riscv64/libc-tls.c b/libpthread/nptl/sysdeps/riscv64/libc-tls.c
index 67c3a6016..6c686aa8b 100644
--- a/libpthread/nptl/sysdeps/riscv64/libc-tls.c
+++ b/libpthread/nptl/sysdeps/riscv64/libc-tls.c
@@ -28,7 +28,7 @@ void *
__tls_get_addr (tls_index *ti)
{
dtv_t *dtv = THREAD_DTV ();
- return (char *) dtv[1].pointer.val + ti->ti_offset;
+ return (char *) dtv[1].pointer.val + GET_ADDR_OFFSET;
}
#endif
diff --git a/libpthread/nptl/sysdeps/riscv64/pthreaddef.h b/libpthread/nptl/sysdeps/riscv64/pthreaddef.h
index fbd40a74f..5a929bc77 100644
--- a/libpthread/nptl/sysdeps/riscv64/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/riscv64/pthreaddef.h
@@ -14,9 +14,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/riscv64/tcb-offsets.sym b/libpthread/nptl/sysdeps/riscv64/tcb-offsets.sym
index 86025a402..fe6856c5d 100644
--- a/libpthread/nptl/sysdeps/riscv64/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/riscv64/tcb-offsets.sym
@@ -1,6 +1,7 @@
#include <sysdep.h>
#include <tls.h>
-MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads)
-TID_OFFSET offsetof (struct pthread, tid)
-TP_TO_PTHREAD_OFFSET -(sizeof (struct pthread) + sizeof (tcbhead_t))
+#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
+
+MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
+
diff --git a/libpthread/nptl/sysdeps/riscv64/tls.h b/libpthread/nptl/sysdeps/riscv64/tls.h
index f33e6ed77..d802ec2a9 100644
--- a/libpthread/nptl/sysdeps/riscv64/tls.h
+++ b/libpthread/nptl/sysdeps/riscv64/tls.h
@@ -1,6 +1,5 @@
/* Definition for thread-local data handling. NPTL/RISCV64 version.
Copyright (C) 2005, 2007, 2011 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -35,15 +34,6 @@ typedef union dtv
} pointer;
} dtv_t;
-typedef struct
-{
- dtv_t *dtv;
-} tcbhead_t;
-
-register tcbhead_t *__thread_self __asm__("tp");
-
-# define TLS_MULTIPLE_THREADS_IN_TCB 1
-
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>
#endif /* __ASSEMBLER__ */
@@ -58,71 +48,56 @@ register tcbhead_t *__thread_self __asm__("tp");
#ifndef __ASSEMBLER__
+register void *__thread_self __asm__("tp");
+# define READ_THREAD_POINTER() ({ __thread_self; })
+
/* Get system call information. */
# include <sysdep.h>
-/* The TP points to the start of the TLS block.
- * As I understand it, this isn't strictly that "TP points to DTV" - it's
- * more where to place the TCB in the TLS block. This will place it in
- * the beginning.
- *
- * Layout:
- * ------------------------------------
- * | PRE | TCB | TLS MEMORY .. |
- * ------------------------------------
- * ^ x4 / TP
- *
- * PRE is the struct pthread described below
- * TCB is tcbhead_t
- * TLS memory is where the TLS program sections are loaded
- *
- * See _dl_allocate_tls_storage and __libc_setup_tls for more information.
- */
+/* The TP points to the start of the TLS block. */
# define TLS_DTV_AT_TP 1
/* Get the thread descriptor definition. */
# include <../../descr.h>
-/* Requirements for the TCB. */
-# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
-# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
+typedef struct
+{
+ dtv_t *dtv;
+ void *private;
+} tcbhead_t;
-# define TLS_TCB_SIZE sizeof (tcbhead_t)
-# define TLS_TCB_ALIGN __alignof__ (tcbhead_t)
+/* This is the size of the initial TCB. Because our TCB is before the thread
+ pointer, we don't need this. */
+# define TLS_INIT_TCB_SIZE 0
+# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
-/* This is the size of the TCB. */
+/* This is the size of the TCB. Because our TCB is before the thread
+ pointer, we don't need this. */
+# define TLS_TCB_SIZE 0
+# define TLS_TCB_ALIGN __alignof__ (struct pthread)
-/* This is the size we need before TCB.
- * To support THREAD_GETMEM with friends we want to have a
- * struct pthread available.
- * Yank it in infront of everything, I'm sure nobody will mind.
- *
- * This memory is really allocated PRE the TLS block, so it's possible
- * to do ((char*)tlsblock) - TLS_PRE_TCB_SIZE to access it.
- * This is done for THREAD_SELF. */
-# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
+/* This is the size we need before TCB - actually, it includes the TCB. */
+# define TLS_PRE_TCB_SIZE \
+ (sizeof (struct pthread) \
+ + ((sizeof (tcbhead_t) + __alignof (struct pthread) - 1) \
+ & ~(__alignof (struct pthread) - 1)))
+/* The thread pointer tp points to the end of the TCB.
+ The pthread_descr structure is immediately in front of the TCB. */
+# define TLS_TCB_OFFSET 0
-/* Install the dtv pointer.
- * When called, dtvp is a pointer not the DTV per say (which should start
- * with the generation counter) but to the length of the DTV.
- * We can always index with -1, so we store dtvp[1]
- */
+/* Install the dtv pointer. The pointer passed is to the element with
+ index -1 which contain the length. */
# define INSTALL_DTV(tcbp, dtvp) \
- (((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1)
+ (((tcbhead_t *) (tcbp))[-1].dtv = (dtvp) + 1)
-/* Install new dtv for current thread
- * In a logicial world dtv here would also point to the length of the DTV.
- * However it does not, this time it points to the generation counter,
- * so just store it.
- *
- * Note: -1 is still valid and contains the length. */
+/* Install new dtv for current thread */
# define INSTALL_NEW_DTV(dtv) \
(THREAD_DTV() = (dtv))
/* Return dtv of given thread descriptor. */
# define GET_DTV(tcbp) \
- (((tcbhead_t *) (tcbp))->dtv)
+ (((tcbhead_t *) (tcbp))[-1].dtv)
/* Code to initially initialize the thread pointer.
*
@@ -136,31 +111,21 @@ register tcbhead_t *__thread_self __asm__("tp");
* It's hard to fail this, so return NULL always.
*/
# define TLS_INIT_TP(tcbp, secondcall) \
- ({__thread_self = ((tcbhead_t *)tcbp + 1); NULL;})
+ ({ __thread_self = (char*)tcbp + TLS_TCB_OFFSET; NULL; })
-/* Return the address of the dtv for the current thread.
- *
- * Dereference TP, offset to dtv - really straightforward.
- * Remember that we made TP point to after tcb, so we need to reverse that.
- */
+/* Return the address of the dtv for the current thread. */
# define THREAD_DTV() \
- ((((tcbhead_t *)__thread_self)-1)->dtv)
+ (((tcbhead_t *) (READ_THREAD_POINTER () - TLS_TCB_OFFSET))[-1].dtv)
-/* Return the thread descriptor for the current thread.
- *
- * Return a pointer to the TLS_PRE area where we allocated space for
- * a struct pthread. Again, TP points to after tcbhead_t, compensate with
- * TLS_INIT_TCB_SIZE.
- *
- * I regard this is a seperate system from the "normal" TLS.
- */
+/* Return the thread descriptor for the current thread. */
# define THREAD_SELF \
- ((struct pthread *) ((char *) __thread_self - TLS_INIT_TCB_SIZE \
- - TLS_PRE_TCB_SIZE))
+ ((struct pthread *) (READ_THREAD_POINTER () \
+ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
-/* Magic for libthread_db to know how to do THREAD_SELF. */
+/* Informs libthread_db that the thread pointer is register 4, which is used
+ * to know how to do THREAD_SELF. */
# define DB_THREAD_SELF \
- CONST_THREAD_AREA (64, sizeof (struct pthread))
+ REGISTER (64, 64, 4 * 8, - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
/* Access to data in the thread descriptor is easy. */
#define THREAD_GETMEM(descr, member) \
@@ -172,6 +137,10 @@ register tcbhead_t *__thread_self __asm__("tp");
#define THREAD_SETMEM_NC(descr, member, idx, value) \
descr->member[idx] = (value)
+/* l_tls_offset == 0 is perfectly valid, so we have to use some different
+ value to mean unset l_tls_offset. */
+# define NO_TLS_OFFSET -1
+
/* Get and set the global scope generation counter in struct pthread. */
#define THREAD_GSCOPE_FLAG_UNUSED 0
#define THREAD_GSCOPE_FLAG_USED 1
diff --git a/libpthread/nptl/sysdeps/sh/pthreaddef.h b/libpthread/nptl/sysdeps/sh/pthreaddef.h
index fc3ae6029..918aaf54f 100644
--- a/libpthread/nptl/sysdeps/sh/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/sh/pthreaddef.h
@@ -17,9 +17,6 @@
#include <sysdep.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 8
diff --git a/libpthread/nptl/sysdeps/sparc/pthreaddef.h b/libpthread/nptl/sysdeps/sparc/pthreaddef.h
index 435fedcf3..65f6655a4 100644
--- a/libpthread/nptl/sysdeps/sparc/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/sparc/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h
index b5b0afdf8..6ecc23e25 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h
@@ -24,6 +24,10 @@
#include <sysdep.h>
#include <bits/kernel-features.h>
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_REQUEUE 3
@@ -71,10 +75,33 @@
# endif
#endif
-
#define lll_futex_wait(futexp, val, private) \
lll_futex_timed_wait(futexp, val, NULL, private)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+
+#define lll_futex_timed_wait(futexp, val, timespec, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 4, (futexp), \
+ __lll_private_flag (FUTEX_WAIT, private), \
+ (val), (TO_TS64_P(timespec))); \
+ __ret; \
+ })
+
+#define lll_futex_wake(futexp, nr, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 4, (futexp), \
+ __lll_private_flag (FUTEX_WAKE, private), \
+ (nr), 0); \
+ __ret; \
+ })
+
+#else
+
#define lll_futex_timed_wait(futexp, val, timespec, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
@@ -95,6 +122,8 @@
__ret; \
})
+#endif
+
#define lll_robust_dead(futexv, private) \
do \
{ \
@@ -105,6 +134,35 @@
while (0)
/* Returns non-zero if error happened, zero if success. */
+
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+
+#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE, private),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
+
+/* Returns non-zero if error happened, zero if success. */
+#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_WAKE_OP, private), \
+ (nr_wake), (nr_wake2), (futexp2), \
+ FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
+#else
+
+
#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
@@ -128,6 +186,8 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+#endif
+
#define lll_trylock(lock) \
atomic_compare_and_exchange_val_acq(&(lock), 1, 0)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h
index 450a286b4..9fc000a91 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h
@@ -26,6 +26,10 @@
#include <sysdep.h>
#include <bits/kernel-features.h>
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_REQUEUE 3
@@ -77,6 +81,30 @@
#define lll_futex_wait(futexp, val, private) \
lll_futex_timed_wait(futexp, val, NULL, private)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+
+#define lll_futex_timed_wait(futexp, val, timespec, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret attribute_unused; \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 4, (long) (futexp), \
+ __lll_private_flag (FUTEX_WAIT, private), \
+ (val), (TO_TS64_P(timespec))); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
+ })
+
+#define lll_futex_wake(futexp, nr, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret attribute_unused; \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 4, (long) (futexp), \
+ __lll_private_flag (FUTEX_WAKE, private), \
+ (nr), 0); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
+ })
+
+#else
+
#define lll_futex_timed_wait(futexp, val, timespec, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
@@ -97,6 +125,8 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
+#endif
+
#define lll_robust_dead(futexv, private) \
do \
{ \
@@ -106,6 +136,35 @@
} \
while (0)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64)
+
+/* Returns non-zero if error happened, zero if success. */
+#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret attribute_unused; \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 6, (long) (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE, private),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
+/* Returns non-zero if error happened, zero if success. */
+#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret attribute_unused; \
+ \
+ __ret = INTERNAL_SYSCALL (futex_time64, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_WAKE_OP, private), \
+ (nr_wake), (nr_wake2), (futexp2), \
+ FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
+
+#else
+
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
({ \
@@ -130,6 +189,8 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+#endif
+
static inline int __attribute__((always_inline))
__lll_trylock(int *futex)
{
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nanosleep.c b/libpthread/nptl/sysdeps/unix/sysv/linux/nanosleep.c
index 73fae44bc..9c7230934 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nanosleep.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nanosleep.c
@@ -8,11 +8,17 @@
/* Pause execution for a number of nanoseconds. */
int
-nanosleep (const struct timespec *requested_time,
+_NC(nanosleep) (const struct timespec *requested_time,
struct timespec *remaining)
{
- return _syscall2(int, __NC(nanosleep), const struct timespec*,
- requested_time, struct timespec* remaining)
+ int __ret = clock_nanosleep(CLOCK_REALTIME, 0, requested_time, remaining);
+
+ if (__ret != 0) {
+ __set_errno(__ret);
+ return -1;
+ }
+
+ return __ret;
}
CANCELLABLE_SYSCALL(int, nanosleep, (const struct timespec *requested_time,
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile
new file mode 100644
index 000000000..2caba11b7
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile
@@ -0,0 +1,9 @@
+# Makefile for uClibc-ng NPTL
+# Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+
+top_srcdir=../../../../../../../
+top_builddir=../../../../../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.arch
+include $(top_srcdir)Makerules
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile.arch
new file mode 100644
index 000000000..94aa25ffb
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/Makefile.arch
@@ -0,0 +1,9 @@
+# Makefile for uClibc-ng NPTL
+# Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+
+libpthread_linux_arch_SSRC =
+libpthread_linux_arch_CSRC = pthread_once.c
+
+libc_linux_arch_CSRC = fork.c
+
+CFLAGS += $(SSP_ALL_CFLAGS)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/pthreadtypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/pthreadtypes.h
new file mode 100644
index 000000000..ad10c405c
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/pthreadtypes.h
@@ -0,0 +1,168 @@
+/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_PTHREADTYPES_H
+#define _BITS_PTHREADTYPES_H 1
+
+#define __SIZEOF_PTHREAD_ATTR_T 32
+#define __SIZEOF_PTHREAD_MUTEX_T 32
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_COND_COMPAT_T 12
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+
+/* Thread identifiers. The structure of the attribute type is not
+ exposed on purpose. */
+typedef unsigned long int pthread_t;
+
+union pthread_attr_t
+{
+ char __size[__SIZEOF_PTHREAD_ATTR_T];
+ long int __align;
+};
+#ifndef __have_pthread_attr_t
+typedef union pthread_attr_t pthread_attr_t;
+# define __have_pthread_attr_t 1
+#endif
+
+typedef struct __pthread_internal_slist
+{
+ struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+
+/* Data structures for mutex handling. The structure of the attribute
+ type is not exposed on purpose. */
+typedef union
+{
+ struct __pthread_mutex_s
+ {
+ int __lock;
+ unsigned int __count;
+ int __owner;
+ /* KIND must stay at this position in the structure to maintain
+ binary compatibility with static initializers. */
+ int __kind;
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+ } __data;
+ char __size[__SIZEOF_PTHREAD_MUTEX_T];
+ long int __align;
+} pthread_mutex_t;
+
+typedef union
+{
+ char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
+ long int __align;
+} pthread_mutexattr_t;
+
+
+/* Data structure for conditional variable handling. The structure of
+ the attribute type is not exposed on purpose. */
+typedef union
+{
+ struct
+ {
+ int __lock;
+ unsigned int __futex;
+ __extension__ unsigned long long int __total_seq;
+ __extension__ unsigned long long int __wakeup_seq;
+ __extension__ unsigned long long int __woken_seq;
+ void *__mutex;
+ unsigned int __nwaiters;
+ unsigned int __broadcast_seq;
+ } __data;
+ char __size[__SIZEOF_PTHREAD_COND_T];
+ __extension__ long long int __align;
+} pthread_cond_t;
+
+typedef union
+{
+ char __size[__SIZEOF_PTHREAD_CONDATTR_T];
+ long int __align;
+} pthread_condattr_t;
+
+
+/* Keys for thread-specific data */
+typedef unsigned int pthread_key_t;
+
+
+/* Once-only execution */
+typedef int pthread_once_t;
+
+
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
+/* Data structure for read-write lock variable handling. The
+ structure of the attribute type is not exposed on purpose. */
+typedef union
+{
+ struct
+ {
+ int __lock;
+ unsigned int __nr_readers;
+ unsigned int __readers_wakeup;
+ unsigned int __writer_wakeup;
+ unsigned int __nr_readers_queued;
+ unsigned int __nr_writers_queued;
+ int __writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ unsigned int __flags;
+ } __data;
+ char __size[__SIZEOF_PTHREAD_RWLOCK_T];
+ long int __align;
+} pthread_rwlock_t;
+
+typedef union
+{
+ char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
+ long int __align;
+} pthread_rwlockattr_t;
+#endif
+
+
+#ifdef __USE_XOPEN2K
+/* POSIX spinlock data type. */
+typedef volatile int pthread_spinlock_t;
+
+
+/* POSIX barriers data type. The structure of the type is
+ deliberately not exposed. */
+typedef union
+{
+ char __size[__SIZEOF_PTHREAD_BARRIER_T];
+ long int __align;
+} pthread_barrier_t;
+
+typedef union
+{
+ char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
+ int __align;
+} pthread_barrierattr_t;
+#endif
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/semaphore.h b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/semaphore.h
new file mode 100644
index 000000000..796a4383b
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/bits/semaphore.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2002, 2005, 2007 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SEMAPHORE_H
+# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead."
+#endif
+
+
+#define __SIZEOF_SEM_T (4 * __SIZEOF_POINTER__)
+
+
+/* Value returned if `sem_open' failed. */
+#define SEM_FAILED ((sem_t *) 0)
+
+
+typedef union
+{
+ char __size[__SIZEOF_SEM_T];
+ long int __align;
+} sem_t;
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/createthread.c b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/createthread.c
new file mode 100644
index 000000000..3079007c7
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/createthread.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Value passed to 'clone' for initialization of the thread register. */
+#define TLS_VALUE ((void *) (pd) \
+ + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
+
+/* Get the real implementation. */
+#include <sysdeps/pthread/createthread.c>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/fork.c
new file mode 100644
index 000000000..c5d963aad
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/fork.c
@@ -0,0 +1,11 @@
+#include <sched.h>
+#include <signal.h>
+#include <sysdep.h>
+#include <tls.h>
+
+#define ARCH_FORK() \
+ INLINE_SYSCALL (clone, 5, \
+ CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \
+ NULL, NULL, &THREAD_SELF->tid)
+
+#include "../fork.c"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/pthread_once.c b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/pthread_once.c
new file mode 100644
index 000000000..ce68ce68c
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/pthread_once.c
@@ -0,0 +1,92 @@
+/* Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "pthreadP.h"
+#include <lowlevellock.h>
+
+
+unsigned long int __fork_generation attribute_hidden;
+
+
+static void
+clear_once_control (void *arg)
+{
+ pthread_once_t *once_control = (pthread_once_t *) arg;
+
+ *once_control = 0;
+ lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
+}
+
+
+int
+__pthread_once (once_control, init_routine)
+ pthread_once_t *once_control;
+ void (*init_routine) (void);
+{
+ while (1)
+ {
+ int oldval, val, newval;
+
+ val = *once_control;
+ do
+ {
+ /* Check if the initialized has already been done. */
+ if ((val & 2) != 0)
+ return 0;
+
+ oldval = val;
+ newval = (oldval & 3) | __fork_generation | 1;
+ val = atomic_compare_and_exchange_val_acq (once_control, newval,
+ oldval);
+ }
+ while (__builtin_expect (val != oldval, 0));
+
+ /* Check if another thread already runs the initializer. */
+ if ((oldval & 1) != 0)
+ {
+ /* Check whether the initializer execution was interrupted
+ by a fork. */
+ if (((oldval ^ newval) & -4) == 0)
+ {
+ /* Same generation, some other thread was faster. Wait. */
+ lll_futex_wait (once_control, newval, LLL_PRIVATE);
+ continue;
+ }
+ }
+
+ /* This thread is the first here. Do the initialization.
+ Register a cleanup handler so that in case the thread gets
+ interrupted the initialization can be restarted. */
+ pthread_cleanup_push (clear_once_control, once_control);
+
+ init_routine ();
+
+ pthread_cleanup_pop (0);
+
+
+ /* Add one to *once_control. */
+ atomic_increment (once_control);
+
+ /* Wake up all other threads. */
+ lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
+ break;
+ }
+
+ return 0;
+}
+weak_alias (__pthread_once, pthread_once)
+strong_alias (__pthread_once, __pthread_once_internal)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/sysdep-cancel.h
new file mode 100644
index 000000000..f7e70514a
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv32/sysdep-cancel.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 2014 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <tls.h>
+#ifndef __ASSEMBLER__
+# include <pthreadP.h>
+#endif
+
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+
+#else
+
+# define SINGLE_THREAD_P 1
+# define NO_CANCELLATION 1
+
+#endif
+
+#define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/bits/pthreadtypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/bits/pthreadtypes.h
index 13d138cd3..e0c0534f6 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/bits/pthreadtypes.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/bits/pthreadtypes.h
@@ -101,7 +101,7 @@ typedef union
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
- long int __align;
+ int __align;
} pthread_condattr_t;
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/createthread.c b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/createthread.c
index 10bb1bbfe..3079007c7 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/createthread.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/createthread.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2012 Free Software Foundation, Inc.
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -7,16 +8,16 @@
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; see the file COPYING.LIB. If
- not, see <http://www.gnu.org/licenses/>.  */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Value passed to 'clone' for initialization of the thread register. */
#define TLS_VALUE ((void *) (pd) \
- + TLS_PRE_TCB_SIZE + TLS_INIT_TCB_SIZE)
+ + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
-/* Get the real implementation. */
+/* Get the real implementation. */
#include <sysdeps/pthread/createthread.c>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/fork.c
index e55d05d41..c5d963aad 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/riscv64/fork.c
@@ -1,19 +1,3 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
- Contributed by Phil Blundell <pb@nexus.co.uk>, 2005
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
#include <sched.h>
#include <signal.h>
#include <sysdep.h>
@@ -22,6 +6,6 @@
#define ARCH_FORK() \
INLINE_SYSCALL (clone, 5, \
CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \
- NULL, &THREAD_SELF->tid, NULL)
+ NULL, NULL, &THREAD_SELF->tid)
#include "../fork.c"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
index 93e4e6070..cd8d2f84f 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
@@ -140,8 +140,13 @@ timer_create (
INTERNAL_SYSCALL_DECL (err);
struct timespec ts;
int res;
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_getres_time64)
+ res = INTERNAL_SYSCALL (clock_getres_time64, err, 2,
+ CLOCK_REALTIME, &ts);
+#else
res = INTERNAL_SYSCALL (clock_getres, err, 2,
CLOCK_REALTIME, &ts);
+#endif
__no_posix_timers = (INTERNAL_SYSCALL_ERROR_P (res, err)
? -1 : 1);
}
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_gettime.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_gettime.c
index 699874f3f..220df0c37 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -50,7 +50,11 @@ timer_gettime (
struct timer *kt = (struct timer *) timerid;
/* Delete the kernel timer object. */
+# if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timer_gettime64)
+ int res = INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);
+# else
int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
+# endif
# ifndef __ASSUME_POSIX_TIMERS
if (res != -1 || errno != ENOSYS)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
index 514913317..60f2a724c 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
@@ -164,7 +164,7 @@ __start_helper_thread (void)
and should go away automatically when canceled. */
pthread_attr_t attr;
(void) pthread_attr_init (&attr);
- (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+ (void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
/* Block all signals in the helper thread but SIGSETXID. To do this
thoroughly we temporarily have to block all signals here. The
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_settime.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_settime.c
index 81a0fa568..1cccf57cb 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_settime.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_settime.c
@@ -23,6 +23,9 @@
#include <bits/kernel-features.h>
#include "kernel-posix-timers.h"
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
#ifdef __NR_timer_settime
# ifndef __ASSUME_POSIX_TIMERS
@@ -54,8 +57,13 @@ timer_settime (
struct timer *kt = (struct timer *) timerid;
/* Delete the kernel timer object. */
+# if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timer_settime64)
+ int res = INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags,
+ TO_ITS64_P(value), ovalue);
+# else
int res = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
value, ovalue);
+# endif
# ifndef __ASSUME_POSIX_TIMERS
if (res != -1 || errno != ENOSYS)
diff --git a/libpthread/nptl/sysdeps/x86_64/pthreaddef.h b/libpthread/nptl/sysdeps/x86_64/pthreaddef.h
index 2b2285285..98ab8cfb1 100644
--- a/libpthread/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/x86_64/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/xtensa/pthreaddef.h b/libpthread/nptl/sysdeps/xtensa/pthreaddef.h
index 34c1851c3..13d8fef4c 100644
--- a/libpthread/nptl/sysdeps/xtensa/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/xtensa/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; see the file COPYING.LIB. If
not, see <http://www.gnu.org/licenses/>.  */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/librt/clock_getcpuclockid.c b/librt/clock_getcpuclockid.c
index b6142a78a..a402e56d7 100644
--- a/librt/clock_getcpuclockid.c
+++ b/librt/clock_getcpuclockid.c
@@ -30,7 +30,7 @@
int
clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
{
-#ifdef __NR_clock_getres
+#if defined(__NR_clock_getres) || defined(__NR_clock_getres_time64)
/* The clockid_t value is a simple computation from the PID.
But we do a clock_getres call to validate it. */
@@ -47,7 +47,11 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
# endif
{
INTERNAL_SYSCALL_DECL (err);
+# if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_getres_time64)
+ int r = INTERNAL_SYSCALL (clock_getres_time64, err, 2, pidclock, NULL);
+# else
int r = INTERNAL_SYSCALL (clock_getres, err, 2, pidclock, NULL);
+# endif
if (!INTERNAL_SYSCALL_ERROR_P (r, err))
{
*clock_id = pidclock;
@@ -66,12 +70,21 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL)
{
# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
+# if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_getres_time64)
+ if (pidclock == MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED)
+ || INTERNAL_SYSCALL_ERROR_P (INTERNAL_SYSCALL
+ (clock_getres_time64, err, 2,
+ MAKE_PROCESS_CPUCLOCK
+ (0, CPUCLOCK_SCHED), NULL),
+ err))
+# else
if (pidclock == MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED)
|| INTERNAL_SYSCALL_ERROR_P (INTERNAL_SYSCALL
(clock_getres, err, 2,
MAKE_PROCESS_CPUCLOCK
(0, CPUCLOCK_SCHED), NULL),
err))
+# endif
/* The kernel doesn't support these clocks at all. */
__libc_missing_posix_cpu_timers = 1;
else
diff --git a/librt/clock_gettime.c b/librt/clock_gettime.c
index e65d39d44..eab9a3343 100644
--- a/librt/clock_gettime.c
+++ b/librt/clock_gettime.c
@@ -22,10 +22,26 @@
#include <sys/time.h>
#include "kernel-posix-cpu-timers.h"
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_gettime64)
+#define SYSCALL_GETTIME \
+ { \
+ struct __ts64_struct __ts64; \
+ retval = INLINE_SYSCALL (clock_gettime64, 2, clock_id, &__ts64); \
+ if (tp) { \
+ tp->tv_sec = __ts64.tv_sec; \
+ tp->tv_nsec = __ts64.tv_nsec; \
+ } \
+ break; \
+ }
+#else
#define SYSCALL_GETTIME \
retval = INLINE_SYSCALL (clock_gettime, 2, clock_id, tp); \
break
+#endif
/* The REALTIME and MONOTONIC clock are definitely supported in the kernel. */
#define SYSDEP_GETTIME \
diff --git a/librt/clock_nanosleep.c b/librt/clock_nanosleep.c
index 1515cf5b0..5537b0609 100644
--- a/librt/clock_nanosleep.c
+++ b/librt/clock_nanosleep.c
@@ -21,6 +21,9 @@
#include "kernel-posix-cpu-timers.h"
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
/* We can simply use the syscall. The CPU clocks are not supported
with this function. */
@@ -36,18 +39,40 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
-#if defined(SINGLE_THREAD_P)
- r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem);
+ if (SINGLE_THREAD_P) {
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_nanosleep_time64)
+ struct __ts64_struct __req, __rem;
+ __req.tv_sec = req->tv_sec;
+ __req.tv_nsec = req->tv_nsec;
+ r = INTERNAL_SYSCALL (clock_nanosleep_time64, err, 4, clock_id, flags, &__req, &__rem);
+ if (rem) {
+ rem->tv_sec = (time_t) __rem.tv_sec;
+ rem->tv_nsec = __rem.tv_nsec;
+ }
#else
+ r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem);
+#endif
+ }
+ else
{
+#ifdef __NEW_THREADS
int oldstate = LIBC_CANCEL_ASYNC ();
-
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_nanosleep_time64)
+ struct __ts64_struct __req, __rem;
+ __req.tv_sec = req->tv_sec;
+ __req.tv_nsec = req->tv_nsec;
+ r = INTERNAL_SYSCALL (clock_nanosleep_time64, err, 4, clock_id, flags, &__req, &__rem);
+ if (rem) {
+ rem->tv_sec = (time_t) __rem.tv_sec;
+ rem->tv_nsec = __rem.tv_nsec;
+ }
+#else
r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req,
rem);
-
+#endif
LIBC_CANCEL_RESET (oldstate);
- }
#endif
+ }
return (INTERNAL_SYSCALL_ERROR_P (r, err)
? INTERNAL_SYSCALL_ERRNO (r, err) : 0);
diff --git a/librt/mq_timedreceive.c b/librt/mq_timedreceive.c
index 9f5efc4fa..f89b4c36b 100644
--- a/librt/mq_timedreceive.c
+++ b/librt/mq_timedreceive.c
@@ -8,9 +8,19 @@
#include <unistd.h>
#include <cancel.h>
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_mq_timedreceive_time64)
+#include "internal/time64_helpers.h"
+
+int _NC(mq_timedreceive)(mqd_t mqdes, char *restrict msg_ptr, size_t msg_len, unsigned int *restrict msq_prio, const struct timespec *restrict abs_timeout)
+{
+ return INLINE_SYSCALL(mq_timedreceive_time64, 5, mqdes, msg_ptr, msg_len, msq_prio, TO_TS64_P(abs_timeout));
+}
+#else
#define __NR___mq_timedreceive_nocancel __NR_mq_timedreceive
_syscall5(ssize_t, __NC(mq_timedreceive), mqd_t, mqdes, char *__restrict, msg_ptr, size_t, msg_len, unsigned int *__restrict, msq_prio, const struct timespec *__restrict, abs_timeout)
+#endif
CANCELLABLE_SYSCALL(ssize_t, mq_timedreceive, (mqd_t mqdes, char *__restrict msg_ptr, size_t msq_len, unsigned int *__restrict msq_prio, const struct timespec *__restrict abs_timeout),
(mqdes, msg_ptr, msq_len, msq_prio, abs_timeout))
+
lt_libc_hidden(mq_timedreceive)
diff --git a/librt/mq_timedsend.c b/librt/mq_timedsend.c
index 7c2e97ee3..b081ac0ce 100644
--- a/librt/mq_timedsend.c
+++ b/librt/mq_timedsend.c
@@ -8,8 +8,17 @@
#include <unistd.h>
#include <cancel.h>
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_mq_timedsend_time64)
+#include "internal/time64_helpers.h"
+
+int _NC(mq_timedsend)(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msq_prio, const struct timespec *abs_timeout)
+{
+ return INLINE_SYSCALL(mq_timedsend_time64, 5, mqdes, msg_ptr, msg_len, msq_prio, TO_TS64_P(abs_timeout));
+}
+#else
#define __NR___mq_timedsend_nocancel __NR_mq_timedsend
_syscall5(int, __NC(mq_timedsend), mqd_t, mqdes, const char *, msg_ptr, size_t, msg_len, unsigned int, msq_prio, const struct timespec *, abs_timeout)
+#endif
CANCELLABLE_SYSCALL(int, mq_timedsend, (mqd_t mqdes, const char *msg_ptr, size_t msq_len, unsigned int msq_prio, const struct timespec *abs_timeout),
(mqdes, msg_ptr, msq_len, msq_prio, abs_timeout))
diff --git a/librt/timer_gettime.c b/librt/timer_gettime.c
index e13f44642..9495c802d 100644
--- a/librt/timer_gettime.c
+++ b/librt/timer_gettime.c
@@ -9,9 +9,13 @@
#include "kernel-posix-timers.h"
-#ifdef __NR_timer_gettime
+#if defined(__NR_timer_gettime) || defined(__NR_timer_gettime64)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timer_gettime64)
+#define __NR___syscall_timer_gettime __NR_timer_gettime64
+#else
#define __NR___syscall_timer_gettime __NR_timer_gettime
+#endif
static __inline__ _syscall2(int, __syscall_timer_gettime, kernel_timer_t, ktimerid,
void *, value);
diff --git a/librt/timer_settime.c b/librt/timer_settime.c
index 2703fa913..425cd7ee9 100644
--- a/librt/timer_settime.c
+++ b/librt/timer_settime.c
@@ -9,9 +9,20 @@
#include "kernel-posix-timers.h"
-#ifdef __NR_timer_settime
+#if defined(__NR_timer_settime) || defined(__NR_timer_settime64)
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timer_settime64)
+#include "internal/time64_helpers.h"
+
+int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue)
+{
+ struct timer *kt = (struct timer *)timerid;
+
+ return INLINE_SYSCALL(timer_settime64, 4, kt->ktimerid, flags, TO_ITS64_P(value), ovalue);
+}
+#else
#define __NR___syscall_timer_settime __NR_timer_settime
+
static __inline__ _syscall4(int, __syscall_timer_settime, kernel_timer_t, ktimerid,
int, flags, const void *, value, void *, ovalue);
@@ -26,3 +37,4 @@ int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
}
#endif
+#endif
diff --git a/utils/ldd.c b/utils/ldd.c
index dfc4ee9a5..46cd97170 100644
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -30,7 +30,12 @@
#endif
#if defined(__arc__)
-#define MATCH_MACHINE(x) (x == EM_ARCOMPACT)
+#define MATCH_MACHINE(x) (x == EM_ARCOMPACT || x == EM_ARCV2)
+#define ELFCLASSM ELFCLASS32
+#endif
+
+#if defined(__ARC64_ARCH32__)
+#define MATCH_MACHINE(x) (x == EM_ARCV3_32)
#define ELFCLASSM ELFCLASS32
#endif